Commit 0462a586 authored by 查济's avatar 查济

Merge branch 'feature-zhaji' into 'develop'

"feature-zhaJi:修改变更项目逻辑,增加险种排序"

See merge request fangxinjiang/yifu!74
parents b2c9b192 51ed63eb
......@@ -591,6 +591,36 @@ public class InsurancesConstants {
public static final String DELETE_INSURANCE_TYPE_STANDARD = "删除购买标准";
/**
* 导入减员数据
*/
public static final String INSURANCE_REFUND_IMPORT = "导入减员数据";
/**
* 导出待减员数据
*/
public static final String INSURANCE_REFUND_EXPORT = "导出待减员数据";
/**
* 减员成功
*/
public static final String INSURANCE_REFUND_SUCCESS = "减员成功";
/**
* 减员退回
*/
public static final String INSURANCE_REFUND_FAILED = "减员退回";
/**
* 变更所属项目
*/
public static final String DEPT_CHANGE = "变更所属项目";
/**
* 变更结算月
*/
public static final String MONTH_CHANGE = "变更结算月";
}
......@@ -26,4 +26,9 @@ public class Dept implements Serializable {
*/
@Schema(description = "项目名称")
private String projectName;
public Dept(String departNo, String departName) {
this.deptNo =departNo;
this.projectName =departName;
}
}
......@@ -41,7 +41,8 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
public IPage<TInsuranceCompany> pageDiy(Page page, TInsuranceCompany insuranceCompany) {
LambdaQueryWrapper<TInsuranceCompany> wrapper = new LambdaQueryWrapper<>();
wrapper.orderByDesc(TInsuranceCompany::getCreateTime);
return this.baseMapper.selectPage(page,wrapper);
IPage<TInsuranceCompany> list = this.baseMapper.selectPage(page, wrapper);
return list;
}
@Override
......
......@@ -2055,9 +2055,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
Map<String, List<InsuranceRefundCheck>> refundMap = checkInsuranceRefundList(insuranceRefundCheckList);
List<InsuranceRefundCheck> successList = refundMap.get("successList");
List<TInsuranceOperate> operateList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(successList)){
for (InsuranceRefundCheck refund : successList){
TInsuranceRefund insuranceRefund = new TInsuranceRefund();
TInsuranceOperate insuranceOperate = new TInsuranceOperate();
insuranceRefund.setInsDetailId(refund.getId());
insuranceRefund.setReduceHandleStatus(CommonConstants.ONE_INT);
insuranceRefund.setCreateBy(user.getId());
......@@ -2077,8 +2079,15 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.set(TInsuranceDetail :: getReduceHandleStatus,CommonConstants.ONE_INT);
updateWrapper.eq(TInsuranceDetail :: getId,refund.getId());
update(updateWrapper);
insuranceOperate.setInsuranceDetailId(refund.getId());
insuranceOperate.setCreateBy(user.getId());
insuranceOperate.setCreateName(user.getNickname());
insuranceOperate.setCreateTime(LocalDateTime.now());
insuranceOperate.setOperateDesc(InsurancesConstants.INSURANCE_REFUND_IMPORT);
operateList.add(insuranceOperate);
}
}
tInsuranceOperateService.saveBatch(operateList);
List<InsuranceRefundCheck> errorList = refundMap.get("errorList");
return R.ok(errorList,"校验完成");
}
......@@ -2298,7 +2307,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//操作记录
addOperate(detailList,user,InsurancesConstants.REFUND_EXPORT);
addOperate(detailList,user,InsurancesConstants.INSURANCE_REFUND_EXPORT);
}
return refundExportList;
}
......@@ -2323,6 +2332,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<TInsuranceDetail> successList = new ArrayList<>();
List<TInsuranceDetail> tInsuranceDetails = this.listByIds(insuranceDetailList);
List<TInsuranceRefund> refundList = new ArrayList<>();
List<TInsuranceOperate> operateList = new ArrayList<>();
for (TInsuranceDetail tInsuranceDetail : tInsuranceDetails) {
TInsuranceRefund refund = new TInsuranceRefund();
RefundErrorVo refundErrorVo = new RefundErrorVo();
......@@ -2347,6 +2357,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceDetail.setBuyHandleStatus(CommonConstants.THREE_INT);
}
successList.add(tInsuranceDetail);
//新增减员记录
refund.setInsDetailId(tInsuranceDetail.getId());
refund.setCreateBy(user.getId());
refund.setCreateTime(LocalDateTime.now());
......@@ -2364,9 +2375,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateBatchById(successList);
//操作记录
if(CommonConstants.FOUR_INT == refundType){
addOperate(successList,user,InsurancesConstants.REFUND_EXPORT_SUCCESS);
addOperate(successList,user,InsurancesConstants.INSURANCE_REFUND_SUCCESS);
}else{
addOperate(successList,user,InsurancesConstants.REFUND_EXPORT_FAILED);
addOperate(successList,user,InsurancesConstants.INSURANCE_REFUND_FAILED);
}
return R.ok(errorList,"操作成功");
}
......@@ -2388,6 +2399,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
Map<String, List<SettleMonthChangeCheckParam>> map = settleMonthChangeCheck(settleMonthCheckList);
//todo 生成EKP通知,通知ekp变更结算月份
List<SettleMonthChangeCheckParam> successList = map.get("successList");
List<TInsuranceOperate> operateList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(successList)){
for (SettleMonthChangeCheckParam success : successList) {
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
......@@ -2396,8 +2408,16 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.set(TInsuranceDetail :: getUpdateBy,user.getId())
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now());
update(updateWrapper);
TInsuranceOperate insuranceOperate = new TInsuranceOperate();
insuranceOperate.setInsuranceDetailId(success.getId());
insuranceOperate.setCreateBy(user.getId());
insuranceOperate.setCreateName(user.getNickname());
insuranceOperate.setCreateTime(LocalDateTime.now());
insuranceOperate.setOperateDesc(InsurancesConstants.MONTH_CHANGE);
operateList.add(insuranceOperate);
}
}
tInsuranceOperateService.saveBatch(operateList);
List<SettleMonthChangeCheckParam> errorList = map.get("errorList");
return R.ok(errorList,"导入成功");
}
......@@ -2419,19 +2439,97 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
Map<String, List<DeptChangeCheckParam>> stringListMap = deptChangeCheck(deptChangeCheckList);
//todo 生成EKP通知,通知ekp变更结算所属项目
List<DeptChangeCheckParam> successList = stringListMap.get("successList");
List<TInsuranceOperate> operateList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(successList)){
for (DeptChangeCheckParam success : successList) {
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
Integer oldSettleType = success.getOldSettleType();
Integer newSettleType = success.getNewSettleType();
updateWrapper.eq(TInsuranceDetail ::getId,success.getId())
.set(TInsuranceDetail :: getDeptNo,success.getNewDeptNo())
.set(TInsuranceDetail :: getSettleType,success.getNewSettleType())
.set(TInsuranceDetail :: getUpdateBy,user.getId())
.set(TInsuranceDetail ::getEstimatePremium,success.getEstimatePremium())
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now());
TInsuranceSettle tInsuranceSettle = new TInsuranceSettle();
//如果旧项目为合并结算,且新项目也是合并结算,则计算新的预估保费,作废旧的预估保费
if(CommonConstants.ZERO_INT == oldSettleType && CommonConstants.ZERO_INT == newSettleType){
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,success.getEstimatePremium());
//如果存在则更新,不存在则新建
if (StringUtils.isNotBlank(success.getDefaultSettleId())){
tInsuranceSettle.setId(success.getDefaultSettleId());
tInsuranceSettle.setSettleType(success.getNewSettleType());
tInsuranceSettle.setInsDetailId(success.getId());
tInsuranceSettle.setEstimatePremium(success.getEstimatePremium());
tInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(tInsuranceSettle);
}else{
tInsuranceSettle.setInsDetailId(success.getId());
tInsuranceSettle.setSettleType(success.getNewSettleType());
tInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING);
tInsuranceSettle.setEstimatePremium(success.getEstimatePremium());
tInsuranceSettle.setIsActualPush(CommonConstants.ZERO_INT);
tInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
tInsuranceSettle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(tInsuranceSettle);
//将结算id赋值给保单信息
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,tInsuranceSettle.getId());
}
}
//如果旧项目为预估,且新的项目为单独结算,则作废旧的预估保费,更新项目信息
if(CommonConstants.ZERO_INT == oldSettleType && CommonConstants.ONE_INT == newSettleType){
//更新旧的结算信息
if (StringUtils.isNotBlank(success.getDefaultSettleId())){
tInsuranceSettle.setId(success.getDefaultSettleId());
tInsuranceSettle.setSettleType(success.getNewSettleType());
tInsuranceSettle.setInsDetailId(success.getId());
tInsuranceSettle.setEstimatePremium(new BigDecimal("0"));
tInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(tInsuranceSettle);
}else{
//更新预估保费
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,new BigDecimal("0"));
}
}
//如果旧项目为单独结算,且新项目为合并结算,则计算预估保费,作废旧的预估保费
if(CommonConstants.ONE_INT == oldSettleType && CommonConstants.ZERO_INT == newSettleType){
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,success.getEstimatePremium());
//更新旧的结算信息
if (StringUtils.isNotBlank(success.getDefaultSettleId())){
tInsuranceSettle.setId(success.getDefaultSettleId());
tInsuranceSettle.setSettleType(success.getNewSettleType());
tInsuranceSettle.setInsDetailId(success.getId());
tInsuranceSettle.setEstimatePremium(success.getEstimatePremium());
tInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(tInsuranceSettle);
//推送EKP
}else{
tInsuranceSettle.setInsDetailId(success.getId());
tInsuranceSettle.setSettleType(success.getNewSettleType());
tInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING);
tInsuranceSettle.setEstimatePremium(success.getEstimatePremium());
tInsuranceSettle.setIsActualPush(CommonConstants.ZERO_INT);
tInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
tInsuranceSettle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(tInsuranceSettle);
//更新保单信息
updateWrapper.set(TInsuranceDetail::getDefaultSettleId,tInsuranceSettle.getId());
}
}
//如果旧项目为单独结算,且新项目也是单独结算,则更新单独结算信息
if(CommonConstants.ONE_INT == oldSettleType && CommonConstants.ONE_INT == newSettleType){
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,success.getEstimatePremium());
}
update(updateWrapper);
TInsuranceOperate insuranceOperate = new TInsuranceOperate();
insuranceOperate.setInsuranceDetailId(success.getId());
insuranceOperate.setCreateBy(user.getId());
insuranceOperate.setCreateName(user.getNickname());
insuranceOperate.setCreateTime(LocalDateTime.now());
insuranceOperate.setOperateDesc(InsurancesConstants.DEPT_CHANGE);
operateList.add(insuranceOperate);
}
}
tInsuranceOperateService.saveBatch(operateList);
List<DeptChangeCheckParam> errorList = stringListMap.get("errorList");
return R.ok(errorList,"导入成功");
}
......@@ -3144,7 +3242,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
//预估
if (insuranceDetail.getSettleType() == CommonConstants.ZERO_INT){
if (param.getNewSettleType() == CommonConstants.ZERO_INT){
//根据险种获取费率,没费率返回错误
TInsuranceType insuranceType = tInsuranceTypeService.getById(insuranceDetail.getInsuranceTypeId());
//险种存不存在
......@@ -3177,7 +3275,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}else {
// 预估保费 = 费率 * 购买标准
BigDecimal estimatePremium = new BigDecimal(insuranceDetail.getBuyStandard()).multiply(new BigDecimal(typeRate.getRate())).setScale(2,BigDecimal.ROUND_HALF_UP);
insuranceDetail.setEstimatePremium(estimatePremium);
param.setEstimatePremium(estimatePremium);
}
}else {
//按天
......@@ -3185,15 +3283,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
long day = LocalDateUtil.betweenDay(insuranceDetail.getPolicyStart().toString(), insuranceDetail.getPolicyEnd().toString());
//预估保费 = (购买标准 / 365) * 天数
BigDecimal estimatePremium = new BigDecimal(insuranceDetail.getBuyStandard()).divide(new BigDecimal("365"),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(day)).setScale(2,BigDecimal.ROUND_HALF_UP);
insuranceDetail.setEstimatePremium(estimatePremium);
param.setEstimatePremium(estimatePremium);
}
}
}
}
//判断当前数据中是否存在重复数据
param.setEstimatePremium(insuranceDetail.getEstimatePremium());
param.setActualPremium(insuranceDetail.getActualPremium());
param.setOldSettleType(insuranceDetail.getSettleType());
param.setDefaultSettleId(insuranceDetail.getDefaultSettleId());
param.setId(insuranceDetail.getId());
successList.add(param);
}
......@@ -3202,20 +3298,28 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return map;
}
/**
* 查询项目列表
*
* @author zhaji
* @param
* @return {@link R}
*/
@Override
public R getDeptList(){
List<Dept> deptList = new ArrayList<>();
R<TSettleDomainListVo> tSettleDomainListVoR = archivesDaprUtil.selectAllSettleDomainSelectVos();
if (null != tSettleDomainListVoR && tSettleDomainListVoR.getCode() == CommonConstants.SUCCESS && Common.isNotNull(tSettleDomainListVoR.getData())) {
TSettleDomainListVo data = tSettleDomainListVoR.getData();
List<TSettleDomainSelectVo> listSelectVO = data.getListSelectVO();
List<Dept> deptList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(listSelectVO)){
//listSelectVO.stream().filter(item->deptList.add(new Dept(item.getDepartNo(),item.getDepartName())));
for (TSettleDomainSelectVo tSettleDomainSelectVo : listSelectVO) {
Dept dept = new Dept();
dept.setDeptNo(tSettleDomainSelectVo.getDepartNo());
dept.setProjectName(tSettleDomainSelectVo.getDepartName());
deptList.add(dept);
deptList.add(new Dept(tSettleDomainSelectVo.getDepartNo(),tSettleDomainSelectVo.getDepartName()));
}
}
}
return R.ok(deptList);
};
......
......@@ -51,6 +51,7 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
*/
@Override
public IPage<InsuranceTypeVo> pageDiy(Page<TInsuranceType> page, TInsuranceType insuranceType) {
return this.baseMapper.selectInsuranceTypePage(page,insuranceType);
}
......
......@@ -284,7 +284,8 @@
detail.POLICY_END as policyEnd,
detail.POLICY_EFFECT as policyEffect,
detail.IS_USE as isUse,
detail.INVOICE_NO as isOverdue,
detail.IS_EFFECT as isEffect,
detail.IS_OVERDUE as isOverdue,
detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
detail.INSURANCE_TYPE_NAME as insuranceTypeName,
detail.BUY_STANDARD as buyStandard
......
......@@ -69,7 +69,7 @@
a.INSURANCE_COMPANY_ID = b.ID
and
a.DELETE_FLAG = 0
ORDER BY a.create_time DESC
</select>
<select id="getInsuranceTypeDetailById" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceTypeVo">
select
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment