|
@@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.entity.ImportParams;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
@@ -86,7 +87,43 @@ public class InsPlyMainServiceImpl extends ServiceImpl<InsPlyMainMapper, InsPlyM
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private EsmUserReferrerService esmUserReferrerService;
|
|
private EsmUserReferrerService esmUserReferrerService;
|
|
|
|
|
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult updatePly(InsPlyMain insPlyMain) throws Exception {
|
|
|
|
|
+ String msg = "修改成功";
|
|
|
|
|
+ try {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 1.校验必填字段是否为空
|
|
|
|
|
+ */
|
|
|
|
|
+ isNullCmain(-1, insPlyMain);
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 2.码值校验:保险公司、协议号、机构代码、业务员工号
|
|
|
|
|
+ */
|
|
|
|
|
+ checkData(-1, insPlyMain);
|
|
|
|
|
+ insPlyMain.setUpdateuser(StpUtil.getLoginId().toString());
|
|
|
|
|
+ insPlyMain.setUpdatetime(LocalDateTime.now());
|
|
|
|
|
+ this.baseMapper.update(insPlyMain,new LambdaUpdateWrapper<InsPlyMain>().eq(InsPlyMain::getPolicyno,insPlyMain.getPolicyno()));
|
|
|
|
|
+
|
|
|
|
|
+ //生成保司费用(应收费用)
|
|
|
|
|
+ insPlyIncomeMapper.delete(new LambdaUpdateWrapper<InsPlyIncome>().eq(InsPlyIncome::getPolicyno,insPlyMain.getPolicyno()));
|
|
|
|
|
+ gene_orderIncome( insPlyMain);
|
|
|
|
|
+ //生成机构费用
|
|
|
|
|
+ insDeptFeeService.deleteByPolicyno(insPlyMain.getPolicyno());
|
|
|
|
|
+ gene_deptfee( insPlyMain);
|
|
|
|
|
+ //生成分销费用
|
|
|
|
|
+ insCommissionService.deleteByPolicyno(insPlyMain.getPolicyno());
|
|
|
|
|
+ saveRetail(insPlyMain);
|
|
|
|
|
+ //个代费用生成
|
|
|
|
|
+ insCompanyFeeService.deleteByPolicyno(insPlyMain.getPolicyno());
|
|
|
|
|
+ saveInsCompanyFee(insPlyMain);
|
|
|
|
|
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ throw e;
|
|
|
|
|
+ }
|
|
|
|
|
+ return HttpResult.ok(msg, null);
|
|
|
|
|
+ }
|
|
|
|
|
+ @Override
|
|
|
public HttpResult<BasePageResult<InsPlyMain>> queryPly(InsPlyMainVo insPlyMainVo) {
|
|
public HttpResult<BasePageResult<InsPlyMain>> queryPly(InsPlyMainVo insPlyMainVo) {
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -134,6 +171,13 @@ public class InsPlyMainServiceImpl extends ServiceImpl<InsPlyMainMapper, InsPlyM
|
|
|
* 2.码值校验:保险公司、协议号、机构代码、业务员工号
|
|
* 2.码值校验:保险公司、协议号、机构代码、业务员工号
|
|
|
*/
|
|
*/
|
|
|
checkData(i, excelVo);
|
|
checkData(i, excelVo);
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 3.校验保单是否已导入
|
|
|
|
|
+ */
|
|
|
|
|
+ InsPlyMain plyMain=this.baseMapper.selectById(excelVo.getPolicyno());
|
|
|
|
|
+ if(plyMain!=null){
|
|
|
|
|
+ throw new DescribeException("保单号:【"+excelVo.getPolicyno()+"】已导入,请核对!");
|
|
|
|
|
+ }
|
|
|
excelVo.setAllFeeValue(excelVo.getCommissionFeevalue().add(excelVo.getOtherFeevalue()));
|
|
excelVo.setAllFeeValue(excelVo.getCommissionFeevalue().add(excelVo.getOtherFeevalue()));
|
|
|
excelVo.setBatchno(batchno);
|
|
excelVo.setBatchno(batchno);
|
|
|
excelVo.setCreator(StpUtil.getLoginId().toString());
|
|
excelVo.setCreator(StpUtil.getLoginId().toString());
|
|
@@ -423,24 +467,35 @@ public class InsPlyMainServiceImpl extends ServiceImpl<InsPlyMainMapper, InsPlyM
|
|
|
||StringUtils.isNullOrEmpty(excelVo.getUserFeeProportion())
|
|
||StringUtils.isNullOrEmpty(excelVo.getUserFeeProportion())
|
|
|
||StringUtils.isNullOrEmpty(excelVo.getUserFeelPremiums())
|
|
||StringUtils.isNullOrEmpty(excelVo.getUserFeelPremiums())
|
|
|
) {
|
|
) {
|
|
|
- throw new DescribeException("第" + (i + 1) + "行 必填字段 不可为空");
|
|
|
|
|
|
|
+ String msg="";
|
|
|
|
|
+ if(i>=0){
|
|
|
|
|
+ msg="第" + (i + 1) + "行 必填字段 不可为空";
|
|
|
|
|
+ }else
|
|
|
|
|
+ {
|
|
|
|
|
+ msg="必填字段 不可为空,请核对";
|
|
|
|
|
+ }
|
|
|
|
|
+ throw new DescribeException(msg);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
private void checkData(int i, InsPlyMain excelVo) {
|
|
private void checkData(int i, InsPlyMain excelVo) {
|
|
|
|
|
+ String msg="";
|
|
|
|
|
+ if(i<0){
|
|
|
|
|
+ msg="第" + (i + 1) + "行";
|
|
|
|
|
+ }
|
|
|
EsmInsCompany esmInsCompany =esmInsCompanyMapper.selectById(excelVo.getCompanyId());
|
|
EsmInsCompany esmInsCompany =esmInsCompanyMapper.selectById(excelVo.getCompanyId());
|
|
|
if(StringUtils.isNullOrEmpty(esmInsCompany)){
|
|
if(StringUtils.isNullOrEmpty(esmInsCompany)){
|
|
|
- throw new DescribeException("第" + (i + 1) + "行 保司编码错误,请核对!");
|
|
|
|
|
|
|
+ throw new DescribeException(msg+" 保司编码错误,请核对!");
|
|
|
}
|
|
}
|
|
|
SysDept sysDept=sysDeptMapper.selectById(excelVo.getDeptId());
|
|
SysDept sysDept=sysDeptMapper.selectById(excelVo.getDeptId());
|
|
|
if(StringUtils.isNullOrEmpty(sysDept)){
|
|
if(StringUtils.isNullOrEmpty(sysDept)){
|
|
|
- throw new DescribeException("第" + (i + 1) + "行 机构编码错误,请核对!");
|
|
|
|
|
|
|
+ throw new DescribeException(msg+" 机构编码错误,请核对!");
|
|
|
}
|
|
}
|
|
|
SysUser sysUser=sysUserMapper.selectById(excelVo.getUserId());
|
|
SysUser sysUser=sysUserMapper.selectById(excelVo.getUserId());
|
|
|
if(StringUtils.isNullOrEmpty(sysUser)){
|
|
if(StringUtils.isNullOrEmpty(sysUser)){
|
|
|
- throw new DescribeException("第" + (i + 1) + "行 人员编码错误,请核对!");
|
|
|
|
|
|
|
+ throw new DescribeException(msg+" 人员编码错误,请核对!");
|
|
|
}
|
|
}
|
|
|
if(!"交强".equals(excelVo.getRiskcode())&&!"商业".equals(excelVo.getRiskcode())){
|
|
if(!"交强".equals(excelVo.getRiskcode())&&!"商业".equals(excelVo.getRiskcode())){
|
|
|
- throw new DescribeException("第" + (i + 1) + "行 险种错误,只能填写 【交强】、【商业】!");
|
|
|
|
|
|
|
+ throw new DescribeException(msg+" 险种错误,只能填写 【交强】、【商业】!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|