InsPlyMainServiceImpl.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. package com.ydtech.modules.fnc.service.impl;
  2. import cn.afterturn.easypoi.excel.ExcelImportUtil;
  3. import cn.afterturn.easypoi.excel.entity.ImportParams;
  4. import cn.dev33.satoken.stp.StpUtil;
  5. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  6. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  7. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  8. import com.github.pagehelper.PageHelper;
  9. import com.github.pagehelper.PageInfo;
  10. import com.ydtech.aop.exception.DescribeException;
  11. import com.ydtech.constants.SysConstants;
  12. import com.ydtech.core.page.HttpResult;
  13. import com.ydtech.modules.admin.dao.SysDeptMapper;
  14. import com.ydtech.modules.admin.dao.SysUserMapper;
  15. import com.ydtech.modules.admin.model.SysDept;
  16. import com.ydtech.modules.admin.model.SysUser;
  17. import com.ydtech.modules.esm.dao.EsmInsCompanyMapper;
  18. import com.ydtech.modules.esm.model.EsmInsCompany;
  19. import com.ydtech.modules.esm.service.EsmUserReferrerService;
  20. import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
  21. import com.ydtech.modules.fnc.entity.InsPlyIncome;
  22. import com.ydtech.modules.fnc.entity.InsPlyMain;
  23. import com.ydtech.modules.fnc.dao.InsPlyMainMapper;
  24. import com.ydtech.modules.fnc.service.InsPlyMainService;
  25. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  26. import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
  27. import com.ydtech.modules.fnc.vo.InsPlyMainVo;
  28. import com.ydtech.modules.ins.model.InsCmain;
  29. import com.ydtech.modules.ins.model.InsCommission;
  30. import com.ydtech.modules.ins.model.InsCompanyFee;
  31. import com.ydtech.modules.ins.model.InsDeptFee;
  32. import com.ydtech.modules.ins.model.vo.InsCmainExcelVO;
  33. import com.ydtech.modules.ins.service.InsCommissionService;
  34. import com.ydtech.modules.ins.service.InsCompanyFeeService;
  35. import com.ydtech.modules.ins.service.InsDeptFeeService;
  36. import com.ydtech.modules.order.entity.BasePageResult;
  37. import com.ydtech.modules.order.entity.InsAreaCompany;
  38. import com.ydtech.modules.order.entity.InsFeeOrder;
  39. import com.ydtech.modules.order.entity.InsOrders;
  40. import com.ydtech.security.PubUserInfo;
  41. import com.ydtech.utils.BigDecimalUtils;
  42. import com.ydtech.utils.DateUtil;
  43. import com.ydtech.utils.StringUtils;
  44. import com.ydtech.utils.excel.ExcelUtils2;
  45. import org.jsoup.helper.DataUtil;
  46. import org.springframework.beans.BeanUtils;
  47. import org.springframework.beans.factory.annotation.Autowired;
  48. import org.springframework.stereotype.Service;
  49. import org.springframework.transaction.annotation.Transactional;
  50. import org.springframework.web.multipart.MultipartFile;
  51. import javax.servlet.http.HttpServletRequest;
  52. import java.io.IOException;
  53. import java.math.BigDecimal;
  54. import java.time.LocalDateTime;
  55. import java.util.ArrayList;
  56. import java.util.Date;
  57. import java.util.List;
  58. /**
  59. * <p>
  60. * 服务实现类
  61. * </p>
  62. *
  63. * @author gws
  64. * @since 2024-01-23
  65. */
  66. @Service
  67. public class InsPlyMainServiceImpl extends ServiceImpl<InsPlyMainMapper, InsPlyMain> implements InsPlyMainService {
  68. @Autowired
  69. private EsmInsCompanyMapper esmInsCompanyMapper;
  70. @Autowired
  71. private SysDeptMapper sysDeptMapper;
  72. @Autowired
  73. private SysUserMapper sysUserMapper;
  74. @Autowired
  75. private InsPlyIncomeMapper insPlyIncomeMapper;
  76. @Autowired
  77. private InsDeptFeeService insDeptFeeService;
  78. @Autowired
  79. private InsCommissionService insCommissionService;
  80. @Autowired
  81. private InsCompanyFeeService insCompanyFeeService;
  82. @Autowired
  83. private EsmUserReferrerService esmUserReferrerService;
  84. public HttpResult<BasePageResult<InsPlyMain>> queryPly(InsPlyMainVo insPlyMainVo) {
  85. try {
  86. PageInfo<List<InsPlyMain>> pageHelper = null;
  87. PageHelper.startPage(insPlyMainVo.getPageNum(), insPlyMainVo.getPageSize());
  88. LambdaQueryWrapper<InsPlyMain> wrapper=new LambdaQueryWrapper<InsPlyMain>();
  89. wrapper.eq(StringUtils.isNotEmpty(insPlyMainVo.getBatchno()),InsPlyMain::getBatchno,insPlyMainVo.getBatchno());
  90. wrapper.eq(StringUtils.isNotEmpty(insPlyMainVo.getDeptId()),InsPlyMain::getDeptId,insPlyMainVo.getDeptId());
  91. wrapper.eq(StringUtils.isNotEmpty(insPlyMainVo.getPolicyno()),InsPlyMain::getPolicyno,insPlyMainVo.getPolicyno());
  92. List<InsPlyMain> list = this.baseMapper.selectList(wrapper);
  93. pageHelper = new PageInfo(list);
  94. BasePageResult<InsPlyMain> pageResult = new BasePageResult<InsPlyMain>(insPlyMainVo.getPageNum(), insPlyMainVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list);
  95. return HttpResult.ok(pageResult);
  96. } catch (Exception e) {
  97. e.printStackTrace();
  98. return HttpResult.error("查询异常");
  99. }
  100. }
  101. /**
  102. * 保单导入
  103. *
  104. * @param file excel文件
  105. * @return
  106. */
  107. @Transactional
  108. @Override
  109. public HttpResult excelImport(MultipartFile file) throws Exception {
  110. String msg = "导入成功";
  111. try {
  112. List<InsPlyMain> insPlyMainList = ExcelUtils2.importExcel(file, 0, 1, InsPlyMain.class);
  113. // 校验保单信息
  114. Date date = new Date();
  115. int count = 0;
  116. String batchno = DateUtil.formatFullTime(LocalDateTime.now())+StpUtil.getLoginId().toString();
  117. for (int i = 0; i < insPlyMainList.size(); i++) {
  118. InsPlyMain excelVo = insPlyMainList.get(i);
  119. /**
  120. * 1.校验是否为空
  121. */
  122. isNullCmain(i, excelVo);
  123. /**
  124. * 2.码值校验:保险公司、协议号、机构代码、业务员工号
  125. */
  126. checkData(i, excelVo);
  127. excelVo.setAllFeeValue(excelVo.getCommissionFeevalue().add(excelVo.getOtherFeevalue()));
  128. excelVo.setBatchno(batchno);
  129. excelVo.setCreator(StpUtil.getLoginId().toString());
  130. excelVo.setCreatetime(LocalDateTime.now());
  131. this.baseMapper.insert(excelVo);
  132. //生成保司费用(应收费用)
  133. gene_orderIncome( excelVo);
  134. //生成机构费用
  135. gene_deptfee( excelVo);
  136. //生成分销费用
  137. saveRetail(excelVo);
  138. //个代费用生成
  139. saveInsCompanyFee(excelVo);
  140. count++;
  141. }
  142. if (insPlyMainList.size() != count) {
  143. throw new DescribeException("导入数据错误,应导入" + insPlyMainList.size() + "条数据,实际导入" + count + "条数据,请检查excel数据格式后重新导入或请联系相关人员!");
  144. }
  145. msg = "导入成功,批次号:"+batchno+" 成功导入<" + insPlyMainList.size() + ">条数据!";
  146. } catch (IOException e) {
  147. e.printStackTrace();
  148. throw e;
  149. }
  150. return HttpResult.ok(msg, null);
  151. }
  152. /**
  153. * 生成保司费用(应收费用)
  154. * @throws Exception
  155. */
  156. private void gene_orderIncome(InsPlyMain excelVo) throws Exception{
  157. InsPlyIncome insPlyIncome =new InsPlyIncome();
  158. insPlyIncome.setOrderno(excelVo.getOrderno());
  159. insPlyIncome.setDeptId(excelVo.getDeptId());
  160. insPlyIncome.setCompanyId(excelVo.getCompanyId());
  161. insPlyIncome.setAgreementId(excelVo.getAgreementId());
  162. insPlyIncome.setLicenseno(excelVo.getLicenseno());
  163. insPlyIncome.setPayDate(StringUtils.isNullOrEmpty(excelVo.getPayDate())?excelVo.getCreatetime():excelVo.getPayDate());
  164. insPlyIncome.setCreateTime(LocalDateTime.now() );
  165. insPlyIncome.setPolicyno(excelVo.getPolicyno());
  166. insPlyIncome.setRiskcode(excelVo.getRiskcode());
  167. insPlyIncome.setTaxamount(excelVo.getTaxamount());
  168. insPlyIncome.setNoTaxPremium(excelVo.getNoTaxPremium());
  169. insPlyIncome.setCommissionFeerate(excelVo.getCommissionFeerate());
  170. insPlyIncome.setOtherFeerate(excelVo.getOtherFeerate());
  171. insPlyIncome.setCommissionFeevalue(excelVo.getCommissionFeevalue());
  172. insPlyIncome.setOtherFeevalue(excelVo.getOtherFeevalue());
  173. insPlyIncome.setAllFeeValue(excelVo.getAllFeeValue());
  174. insPlyIncomeMapper.insert(insPlyIncome);
  175. }
  176. /**
  177. * 生成机构费用
  178. * @throws Exception
  179. */
  180. private void gene_deptfee( InsPlyMain excelVo) throws Exception{
  181. InsDeptFee deptFee = new InsDeptFee();
  182. deptFee.setOrderno(excelVo.getOrderno());
  183. deptFee.setAgreeid(excelVo.getAgreementId());
  184. deptFee.setAuditstatus("1");
  185. deptFee.setSettlestatus("0");
  186. deptFee.setInscompany(excelVo.getCompanyId());
  187. deptFee.setPolicyno(excelVo.getPolicyno());
  188. deptFee.setRiskcode(excelVo.getRiskcode());
  189. deptFee.setLicenseno(excelVo.getLicenseno());
  190. geneInsDeptFee(deptFee,excelVo);
  191. }
  192. private void geneInsDeptFee(InsDeptFee deptFee,InsPlyMain excelVo) {
  193. if (excelVo.getFirstDeptPremiums().doubleValue() > 0) {
  194. deptFee.setComcode(excelVo.getDeptId().substring(0, 2)); //99140302M01D01
  195. deptFee.setKeeprate(excelVo.getFirstDeptProportion().doubleValue() );
  196. deptFee.setKeepamount(excelVo.getFirstDeptPremiums().doubleValue());
  197. deptFee.setComlevel("一级");
  198. insDeptFeeService.insert(deptFee);
  199. }
  200. if (excelVo.getSecondDeptPremiums().doubleValue() > 0) {
  201. deptFee.setComcode(excelVo.getDeptId().substring(0, 4)); //99140302M01D01
  202. deptFee.setKeeprate(excelVo.getSecondDeptProportion().doubleValue() );
  203. deptFee.setKeepamount(excelVo.getSecondDeptPremiums().doubleValue());
  204. deptFee.setComlevel("二级");
  205. insDeptFeeService.insert(deptFee);
  206. }
  207. if (excelVo.getThirdDeptPremiums().doubleValue() > 0) {
  208. deptFee.setComcode(excelVo.getDeptId().substring(0, 6)); //99140302M01D01
  209. deptFee.setKeeprate(excelVo.getThirdDeptProportion().doubleValue() );
  210. deptFee.setKeepamount(excelVo.getThirdDeptPremiums().doubleValue());
  211. deptFee.setComlevel("三级");
  212. insDeptFeeService.insert(deptFee);
  213. }
  214. if (excelVo.getForthDeptPremiums().doubleValue() > 0) {
  215. deptFee.setComcode(excelVo.getDeptId().substring(0, 8)); //99140302M01D01
  216. deptFee.setKeeprate(excelVo.getForthDeptProportion().doubleValue() );
  217. deptFee.setKeepamount(excelVo.getForthDeptPremiums().doubleValue());
  218. deptFee.setComlevel("四级");
  219. insDeptFeeService.insert(deptFee);
  220. }
  221. if (excelVo.getFifthDeptPremiums().doubleValue() > 0) {
  222. deptFee.setComcode(excelVo.getDeptId().substring(0, 11)); //99140302M01D01
  223. deptFee.setKeeprate(excelVo.getFifthDeptProportion().doubleValue() );
  224. deptFee.setKeepamount(excelVo.getFifthDeptPremiums().doubleValue());
  225. deptFee.setComlevel("五级");
  226. insDeptFeeService.insert(deptFee);
  227. }
  228. }
  229. /**
  230. * 三级分销费用保存
  231. *
  232. * @return
  233. */
  234. public void saveRetail(InsPlyMain excelVo) throws Exception{
  235. List<String> userlist=new ArrayList<>();
  236. esmUserReferrerService.getUpUser(excelVo.getUserId(),userlist);
  237. //userlist:包括本人在内向上所有人
  238. if(userlist.size()-1>0){
  239. if(userlist.size()-1>=1
  240. && excelVo.getThirdDetailProportion().doubleValue()>0)
  241. {//三级分销
  242. SysUser user=sysUserMapper.selectById(userlist.get(1));
  243. InsCommission commission = new InsCommission();
  244. commission.setOrderno(excelVo.getOrderno());
  245. commission.setDeptid(excelVo.getDeptId());
  246. commission.setDeptname(excelVo.getDeptName());
  247. commission.setInscompany(excelVo.getCompanyId());
  248. commission.setAgreeid(excelVo.getAgreementId());
  249. commission.setRefereescode(user.getId());
  250. commission.setRefereesname(user.getName());
  251. commission.setLevel("3");
  252. commission.setAuditstatus("1"); //0未审核 1已审核
  253. commission.setSettlestatus("0"); //0未结算 1已结算
  254. commission.setInsuredtime(excelVo.getPayDate().toString()); //承保确认时间
  255. commission.setPolicyno(excelVo.getPolicyno());
  256. commission.setRiskcode(excelVo.getRiskcode());
  257. commission.setLicenseno(excelVo.getLicenseno());
  258. commission.setCommissionrate(excelVo.getThirdDetailProportion().doubleValue());
  259. commission.setCommissionamount(excelVo.getThirdDetailPremiums().doubleValue());
  260. insCommissionService.insert(commission);
  261. }
  262. if(userlist.size()-1>=2
  263. &&excelVo.getSecondDetailPremiums().doubleValue()>0)
  264. {//二级分销
  265. SysUser user=sysUserMapper.selectById(userlist.get(1));
  266. InsCommission commission = new InsCommission();
  267. commission.setOrderno(excelVo.getOrderno());
  268. commission.setDeptid(excelVo.getDeptId());
  269. commission.setDeptname(excelVo.getDeptName());
  270. commission.setInscompany(excelVo.getCompanyId());
  271. commission.setAgreeid(excelVo.getAgreementId());
  272. commission.setRefereescode(user.getId());
  273. commission.setRefereesname(user.getName());
  274. commission.setLevel("2");
  275. commission.setAuditstatus("1"); //0未审核 1已审核
  276. commission.setSettlestatus("0"); //0未结算 1已结算
  277. commission.setInsuredtime(excelVo.getPayDate().toString()); //承保确认时间
  278. commission.setPolicyno(excelVo.getPolicyno());
  279. commission.setRiskcode(excelVo.getRiskcode());
  280. commission.setLicenseno(excelVo.getLicenseno());
  281. commission.setCommissionrate(excelVo.getSecondDetailProportion().doubleValue());
  282. commission.setCommissionamount(excelVo.getSecondDetailPremiums().doubleValue());
  283. insCommissionService.insert(commission);
  284. }
  285. if(userlist.size()-1>=3
  286. &&excelVo.getFirstDetailPremiums().doubleValue()>0)
  287. {//一级分销
  288. SysUser user=sysUserMapper.selectById(userlist.get(1));
  289. InsCommission commission = new InsCommission();
  290. commission.setOrderno(excelVo.getOrderno());
  291. commission.setDeptid(excelVo.getDeptId());
  292. commission.setDeptname(excelVo.getDeptName());
  293. commission.setInscompany(excelVo.getCompanyId());
  294. commission.setAgreeid(excelVo.getAgreementId());
  295. commission.setRefereescode(user.getId());
  296. commission.setRefereesname(user.getName());
  297. commission.setLevel("1");
  298. commission.setAuditstatus("1"); //0未审核 1已审核
  299. commission.setSettlestatus("0"); //0未结算 1已结算
  300. commission.setInsuredtime(excelVo.getPayDate().toString()); //承保确认时间
  301. commission.setPolicyno(excelVo.getPolicyno());
  302. commission.setRiskcode(excelVo.getRiskcode());
  303. commission.setLicenseno(excelVo.getLicenseno());
  304. commission.setCommissionrate(excelVo.getFirstDetailProportion().doubleValue());
  305. commission.setCommissionamount(excelVo.getFirstDetailPremiums().doubleValue());
  306. insCommissionService.insert(commission);
  307. }
  308. }
  309. }
  310. /**
  311. * 生成个代费用
  312. * @throws Exception
  313. */
  314. public void saveInsCompanyFee(InsPlyMain excelVo) throws Exception {
  315. SysDept sysDept=sysDeptMapper.selectById(excelVo.getDeptId());
  316. SysUser sysUser=sysUserMapper.selectById(excelVo.getUserId());
  317. InsCompanyFee insCompanyFee = new InsCompanyFee();
  318. insCompanyFee.setOrderno(excelVo.getOrderno());
  319. // insCompanyFee.setFrameNo(excelVo.getFrameno());
  320. insCompanyFee.setLicenseNo(excelVo.getLicenseno());
  321. insCompanyFee.setInscompany(excelVo.getCompanyId());
  322. insCompanyFee.setAgreeid(excelVo.getAgreementId());
  323. insCompanyFee.setUserid(excelVo.getUserId());
  324. insCompanyFee.setUsername(sysUser.getName());
  325. insCompanyFee.setDeptid(excelVo.getDeptId());
  326. insCompanyFee.setDeptname(sysDept.getName());
  327. insCompanyFee.setSettletype("B");
  328. insCompanyFee.setSettlestatus("0");
  329. insCompanyFee.setCreatetime(DateUtil.getDateFormat(new Date(),DateUtil.FULL_TIME_SPLIT_PATTERN));
  330. BigDecimal dept_rate=excelVo.getFirstDeptProportion()
  331. .add(excelVo.getSecondDeptProportion())
  332. .add(excelVo.getThirdDeptProportion())
  333. .add(excelVo.getForthDeptProportion())
  334. .add(excelVo.getFifthDeptProportion());
  335. BigDecimal retail_rate=excelVo.getFirstDetailProportion()
  336. .add(excelVo.getSecondDetailProportion())
  337. .add(excelVo.getThirdDetailProportion());
  338. insCompanyFee.setPolicyno(excelVo.getPolicyno());
  339. insCompanyFee.setRiskcode(excelVo.getRiskcode());
  340. if("交强".equals(excelVo.getRiskcode())){
  341. //交强费用比例=总费用比例-五级机构管理费比例-三级分销比例
  342. insCompanyFee.setFeerate(excelVo.getCommissionFeerate().add(excelVo.getOtherFeerate()).subtract(dept_rate).subtract(retail_rate).doubleValue());
  343. insCompanyFee.setFeeamount(excelVo.getNoTaxPremium().multiply(new BigDecimal(insCompanyFee.getFeerate())).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
  344. insCompanyFee.setJqpremium(excelVo.getNoTaxPremium().doubleValue());
  345. //保存业务员费用
  346. insCompanyFeeService.insert(insCompanyFee);
  347. }
  348. if("商业".equals(excelVo.getRiskcode())){
  349. //商业费用比例=总费用比例-五级机构管理费比例-三级分销比例
  350. insCompanyFee.setDisrate(excelVo.getCommissionFeerate().add(excelVo.getOtherFeerate()).subtract(dept_rate).subtract(retail_rate).doubleValue());
  351. insCompanyFee.setDisamount(excelVo.getNoTaxPremium().multiply(new BigDecimal(insCompanyFee.getDisrate())).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
  352. insCompanyFee.setSypremium(excelVo.getNoTaxPremium().doubleValue());
  353. //保存业务员费用
  354. insCompanyFeeService.insert(insCompanyFee);
  355. }
  356. }
  357. private void isNullCmain(int i, InsPlyMain excelVo) {
  358. if (StringUtils.isNullOrEmpty(excelVo.getOrderno())
  359. ||StringUtils.isNullOrEmpty(excelVo.getPolicyno())
  360. ||StringUtils.isNullOrEmpty(excelVo.getCompanyId())
  361. ||StringUtils.isNullOrEmpty(excelVo.getDeptId())
  362. ||StringUtils.isNullOrEmpty(excelVo.getUserId())
  363. ||StringUtils.isNullOrEmpty(excelVo.getRiskcode())
  364. ||StringUtils.isNullOrEmpty(excelVo.getLicenseno())
  365. ||StringUtils.isNullOrEmpty(excelVo.getPayDate())
  366. ||StringUtils.isNullOrEmpty(excelVo.getPremium())
  367. ||StringUtils.isNullOrEmpty(excelVo.getTaxamount())
  368. ||StringUtils.isNullOrEmpty(excelVo.getNoTaxPremium())
  369. ||StringUtils.isNullOrEmpty(excelVo.getCommissionFeerate())
  370. ||StringUtils.isNullOrEmpty(excelVo.getCommissionFeevalue())
  371. ||StringUtils.isNullOrEmpty(excelVo.getOtherFeerate())
  372. ||StringUtils.isNullOrEmpty(excelVo.getOtherFeevalue())
  373. ||StringUtils.isNullOrEmpty(excelVo.getFirstDeptProportion())
  374. ||StringUtils.isNullOrEmpty(excelVo.getFirstDeptPremiums())
  375. ||StringUtils.isNullOrEmpty(excelVo.getSecondDeptProportion())
  376. ||StringUtils.isNullOrEmpty(excelVo.getSecondDeptPremiums())
  377. ||StringUtils.isNullOrEmpty(excelVo.getThirdDeptProportion())
  378. ||StringUtils.isNullOrEmpty(excelVo.getThirdDeptPremiums())
  379. ||StringUtils.isNullOrEmpty(excelVo.getForthDeptProportion())
  380. ||StringUtils.isNullOrEmpty(excelVo.getForthDeptPremiums())
  381. ||StringUtils.isNullOrEmpty(excelVo.getFifthDeptProportion())
  382. ||StringUtils.isNullOrEmpty(excelVo.getFifthDeptPremiums())
  383. ||StringUtils.isNullOrEmpty(excelVo.getFirstDetailProportion())
  384. ||StringUtils.isNullOrEmpty(excelVo.getFirstDetailPremiums())
  385. ||StringUtils.isNullOrEmpty(excelVo.getSecondDetailProportion())
  386. ||StringUtils.isNullOrEmpty(excelVo.getSecondDetailPremiums())
  387. ||StringUtils.isNullOrEmpty(excelVo.getThirdDetailProportion())
  388. ||StringUtils.isNullOrEmpty(excelVo.getThirdDetailPremiums())
  389. ||StringUtils.isNullOrEmpty(excelVo.getUserFeeProportion())
  390. ||StringUtils.isNullOrEmpty(excelVo.getUserFeelPremiums())
  391. ) {
  392. throw new DescribeException("第" + (i + 1) + "行 必填字段 不可为空");
  393. }
  394. }
  395. private void checkData(int i, InsPlyMain excelVo) {
  396. EsmInsCompany esmInsCompany =esmInsCompanyMapper.selectById(excelVo.getCompanyId());
  397. if(StringUtils.isNullOrEmpty(esmInsCompany)){
  398. throw new DescribeException("第" + (i + 1) + "行 保司编码错误,请核对!");
  399. }
  400. SysDept sysDept=sysDeptMapper.selectById(excelVo.getDeptId());
  401. if(StringUtils.isNullOrEmpty(sysDept)){
  402. throw new DescribeException("第" + (i + 1) + "行 机构编码错误,请核对!");
  403. }
  404. SysUser sysUser=sysUserMapper.selectById(excelVo.getUserId());
  405. if(StringUtils.isNullOrEmpty(sysUser)){
  406. throw new DescribeException("第" + (i + 1) + "行 人员编码错误,请核对!");
  407. }
  408. if(!"交强".equals(excelVo.getRiskcode())&&!"商业".equals(excelVo.getRiskcode())){
  409. throw new DescribeException("第" + (i + 1) + "行 险种错误,只能填写 【交强】、【商业】!");
  410. }
  411. }
  412. }