zoujiajian 1 년 전
부모
커밋
31fb09b3f9
1개의 변경된 파일32개의 추가작업 그리고 0개의 파일을 삭제
  1. 32 0
      netflix-web/src/main/java/com/cyksj/web/controller/manage/account/AccountTempController.java

+ 32 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/AccountTempController.java

@@ -7,11 +7,14 @@ import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.context.AnalysisContext;
 import com.alibaba.excel.event.AnalysisEventListener;
 import com.alibaba.excel.support.ExcelTypeEnum;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.mapper.AccountMapper;
+import com.cyksj.mapper.NetflixTempAccountUserMapper;
 import com.cyksj.model.entity.Account;
+import com.cyksj.model.entity.NetflixTempAccountUser;
 import com.cyksj.model.excel.ExcelPrepareAccountData;
 import com.cyksj.service.mange.AccountCommonService;
 import com.cyksj.web.util.EasyExcelUtils;
@@ -26,6 +29,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.util.List;
 
 /**
  * 项目名: yhlxj
@@ -46,6 +50,8 @@ public class AccountTempController {
 
 	private final AccountCommonService accountCommonService;
 
+	private final NetflixTempAccountUserMapper netflixTempAccountUserMapper;
+
 	/**
 	 * 新增临时账号
 	 */
@@ -64,6 +70,20 @@ public class AccountTempController {
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
 
+	/**
+	 * 删除
+	 */
+	@DeleteMapping("/delete/{id}")
+	public Result<String> deletedById(@PathVariable Long id) {
+		Account account = accountMapper.selectById(id);
+		if (account != null && account.getType() == 3) {
+			accountMapper.deleteById(id);
+			netflixTempAccountUserMapper.delete(Wrappers.lambdaQuery(NetflixTempAccountUser.class)
+					.eq(NetflixTempAccountUser::getAccountId, account.getId()));
+		}
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
+
 	/**
 	 * 临时账号模板
 	 */
@@ -130,4 +150,16 @@ public class AccountTempController {
 		SearchResult<Account> search = beanSearcher.search(Account.class, MapUtils.flatBuilder(request.getParameterMap()).field(Account::getType, 3).build());
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
+
+	/**
+	 * excel奈飞退款
+	 */
+	@PutMapping("/refund")
+	public void excelRefund(MultipartFile file) throws IOException {
+		if (!file.getOriginalFilename().contains(".xls")) {
+			throw BusinessRuntimeException.getInstance("请导入excel文件");
+		}
+		List<Object> accountList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(0).doReadSync();
+
+	}
 }