InsPlyMainServiceImpl.java 22 KB

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