From 5e7341ad54041a1c17a60fc4269eb71f44529476 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期二, 05 三月 2024 14:30:22 +0800
Subject: [PATCH] 111
---
server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java | 103 ++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 80 insertions(+), 23 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
index bf1e82b..c32d163 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
@@ -122,9 +122,11 @@
if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
throw new BusinessException(ResponseStatus.DATA_EMPTY);
}
- if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())
- ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.SIGNATURE.getKey())
- ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.APPROVE.getKey())){
+ if(
+// Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())
+// ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.SIGNATURE.getKey())
+// ||
+ Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.APPROVE.getKey())){
//宸叉彁浜ゅ拰宸插畬鎴愮姸鎬佷笉鏀寔瀹℃牳涓嶉�氳繃
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
}
@@ -194,16 +196,15 @@
param.getPidanFile().setObjType(Constants.MultiFile.CA_PD_PDF.getKey());
param.getPidanFile().setType(Constants.TWO);
multifileMapper.insert(param.getPidanFile());
-
update.setApplyId(model.getApplyId());
if(Constants.equalsInteger(model.getType(),Constants.ZERO)){
//濡傛灉鏄姞鍑忎繚鐢宠 澶勭悊鍔犲噺淇濇槑缁嗘暟鎹�
- dealDetailsValidTime(update);
+ dealDetailsValidTime(update,insuranceApply);
}else{
//濡傛灉鏄崲鍘傜敵璇� 澶勭悊鏄庣粏鏁版嵁
- dealDetailsDUdata(update);
+ dealDetailsDUdata(update,insuranceApply);
}
applyChangeMapper.updateById(update);
@@ -294,12 +295,13 @@
* 澶勭悊鍔犲噺淇濇槑缁嗘暟鎹�
* @param update
*/
- private void dealDetailsDUdata(ApplyChange update ) {
+ private void dealDetailsDUdata(ApplyChange update,InsuranceApply insuranceApply) {
List<ApplyChagneDetail> detailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class,
new MPJLambdaWrapper<ApplyChagneDetail>()
.selectAll(ApplyChagneDetail.class)
.selectAs(Solutions::getTimeUnit,ApplyChagneDetail::getSolutionTimeUnit)
.selectAs(Solutions::getPrice,ApplyChagneDetail::getSolutionPrice)
+ .selectAs(Solutions::getId,ApplyChagneDetail::getSolutionId)
.selectAs(Solutions::getName,ApplyChagneDetail::getSolutionsName)
.selectAs(Worktype::getName,ApplyChagneDetail::getWorkTypeName)
.selectAs(DispatchUnit::getName,ApplyChagneDetail::getDuName)
@@ -397,10 +399,16 @@
applyDetailJoinMapper.insert(applyDetail);
MemberInsurance memberInsurance = new MemberInsurance(applyDetail,update.getId());
+ memberInsurance.setSolutionId(detail.getSolutionId());
+ memberInsurance.setWorktypeName(detail.getWorkTypeName());
+ memberInsurance.setDuName(detail.getDuName());
+ memberInsurance.setApplyChangeId(detail.getApplyChangeId());
+ memberInsurance.setSolutionName(detail.getSolutionsName());
+ memberInsurance.setPdCode(update.getValidCode());
+ memberInsurance.setBdCode(insuranceApply.getCode());
memberInsurance.setRelationType(Constants.ONE);
memberInsuranceJoinMapper.insert(memberInsurance);
}else{
-
applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda()
.set(ApplyDetail::getEditor,update.getEditor())
.set(ApplyDetail::getEditDate,update.getEditDate())
@@ -408,7 +416,6 @@
.set(ApplyDetail::getWorktypeId,detail.getWorktypeId())
.eq(ApplyDetail::getId,oldModel.getId())
);
-
//鍛樺伐鎶曚繚鏄庣粏璁板綍 鍘嗗彶鏁版嵁
memberInsuranceJoinMapper.update(null,new UpdateWrapper<MemberInsurance>().lambda()
.set(MemberInsurance::getDuId,detail.getDuId())
@@ -440,7 +447,7 @@
* 澶勭悊鍔犲噺淇濇槑缁嗘暟鎹�
* @param update
*/
- private void dealDetailsValidTime(ApplyChange update) {
+ private void dealDetailsValidTime(ApplyChange update,InsuranceApply insuranceApply) {
List<ApplyChagneDetail> detailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class,
new MPJLambdaWrapper<ApplyChagneDetail>()
.selectAll(ApplyChagneDetail.class)
@@ -477,6 +484,16 @@
//鍔犱繚 娣诲姞鐨勯噾棰�
CountCyclePriceVO countCyclePriceVO_add = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO_add);
+ Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId());
+ if(Objects.isNull(solutions)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌淇濋櫓鏂规");
+ }
+ if(solutions.getDataType().equals(Constants.ONE)){
+ solutions = solutionsMapper.selectOne(new QueryWrapper<Solutions>().lambda().eq(Solutions::getBaseId,solutions.getBaseId()).eq(Solutions::getDataType,Constants.TWO).last("limit 1"));
+ if(Objects.isNull(solutions)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌鏂规鏈�鏂扮増鏈俊鎭�");
+ }
+ }
for (ApplyChagneDetail detail : detailList) {
@@ -522,7 +539,7 @@
if(new Date().compareTo(DateUtil.getMontageDate(detail.getStartTime(), 2))>=0){
Integer days = DateUtil.daysBetweenDates(DateUtil.getMontageDate(new Date(), 2), detail.getStartTime()) + 1;
- //濡傛灉宸蹭骇鐢熻垂鐢紝璁$畻宸蹭骇鐢熻垂鐢�
+ //濡傛灉宸插凡浜х敓璐圭敤锛岃绠楀凡宸蹭骇鐢熻垂鐢�
add.setCurrentFee(this.getApplyPrice(update.getApplyId(), days));
}else{
add.setCurrentFee(BigDecimal.ZERO);
@@ -531,7 +548,9 @@
totalFee = totalFee.add(add.getFee());
currentFee = currentFee.add(add.getCurrentFee());
- MemberInsurance memberInsurance = new MemberInsurance(detail, update, update.getEditor(), add.getId());
+ MemberInsurance memberInsurance = new MemberInsurance(detail, update, update.getEditor(), add.getId(),solutions.getId());
+ memberInsurance.setStartTime(add.getStartTime());
+ memberInsurance.setEndTime(add.getEndTime());
memberInsurance.setRelationType(Constants.ONE);
memberInsuranceList.add(memberInsurance);
@@ -567,10 +586,13 @@
CountCyclePriceVO timeoutCountCyclePriceVOReduce = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO_reduce);
updateCurrentFee = timeoutCountCyclePriceVOReduce.getCyclePrice().subtract(countCyclePriceVO_reduce.getCyclePrice());
}
+
+
applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda()
.setSql(" fee = ifnull(fee,0)+" + updateFee)
.setSql(" current_fee = " + updateCurrentFee)
- .set(ApplyDetail::getEndTime, DateUtil.getMontageDate(update.getApplyStartTime(), 3))
+ .set(insuranceApply.getStartTime().compareTo(update.getValidTime())!=0,ApplyDetail::getEndTime, DateUtil.getMontageDate(update.getApplyStartTime(), 3))
+ .set(insuranceApply.getStartTime().compareTo(update.getValidTime())==0,ApplyDetail::getEndTime, DateUtil.getMontageDate(update.getApplyStartTime(), 2))
.set(ApplyDetail::getEditor, update.getEditor())
.set(ApplyDetail::getEditDate, update.getEditDate())
.eq(ApplyDetail::getId, oldModel.getId())
@@ -581,7 +603,9 @@
//淇敼 鍛樺伐鎶曚繚鏄庣粏璁板綍 鍘嗗彶鏁版嵁
memberInsuranceJoinMapper.update(null, new UpdateWrapper<MemberInsurance>().lambda()
.setSql(" fee = ifnull(fee,0)+" + updateFee)
- .set(MemberInsurance::getEndTime, update.getApplyStartTime())
+ .set(insuranceApply.getStartTime().compareTo(update.getValidTime())!=0,MemberInsurance::getEndTime,DateUtil.getMontageDate(update.getApplyStartTime(), 3))
+ .set(insuranceApply.getStartTime().compareTo(update.getValidTime())==0,MemberInsurance::getEndTime,DateUtil.getMontageDate(update.getApplyStartTime(), 2))
+ .set(MemberInsurance::getStartTime, update.getApplyStartTime())
.eq(MemberInsurance::getRelationId, oldModel.getId())
);
@@ -661,10 +685,15 @@
){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
}
+ if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())){
+ update.setStatus(Constants.ApplyChangeStatus.SIGNATURE.getKey());
+ }else {
+ update.setStatus(Constants.ApplyChangeStatus.UPLOAD.getKey());
+ }
applyLogType = Constants.ApplyLogType.CA_PALTFORM_REFUSE_APPLY;
info = applyLogType.getInfo();
info = info.replace("${param}", param.getCheckInfo());
- update.setStatus(Constants.ApplyChangeStatus.SIGNATURE.getKey());
+
noticeType = Constants.NoticeType.FIVE;
}else{
//濡傛灉鏄悓鎰�,涓ょ鐢宠閫�鍥炵姸鎬侀兘鍙搷浣�
@@ -693,7 +722,7 @@
}
//鍒犻櫎鍏朵粬寰呭姙
noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,model.getId()));
- Notices notices = new Notices(noticeObjectType,Constants.ZERO,model.getId(),solutions.getName(),
+ Notices notices = new Notices(noticeObjectType,Constants.ONE,model.getId(),solutions.getName(),
model.getCompanyId(), noticeType);
noticesMapper.insert(notices);
@@ -735,6 +764,14 @@
if(Objects.isNull(solutions)){
throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌淇濋櫓鏂规");
}
+ if(solutions.getDataType().equals(Constants.ONE)){
+ solutions = solutionsMapper.selectOne(new QueryWrapper<Solutions>().lambda().eq(Solutions::getBaseId,solutions.getBaseId()).eq(Solutions::getDataType,Constants.TWO).last("limit 1"));
+ if(Objects.isNull(solutions)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌鏂规鏈�鏂扮増鏈俊鎭�");
+ }
+ }
+
+
CompanySolution companySolution = companySolutionMapper.selectOne(new QueryWrapper<CompanySolution>().lambda()
.eq(CompanySolution::getCompanyId,loginUserInfo.getCompanyId())
.eq(CompanySolution::getSolutionBaseId,solutions.getBaseId())
@@ -776,9 +813,7 @@
applyChangeMapper.updateById(applyChangeFee);
Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_COMPANY_COMMIT;
- String info =applyLogType.getInfo();
- info = info.replace("${param}", "");
- ApplyLog log = new ApplyLog(applyChange,applyLogType.getName(),info,applyChange.getId(),applyLogType.getKey(), null, null);
+ ApplyLog log = new ApplyLog(applyChange,applyLogType.getName(),"",applyChange.getId(),applyLogType.getKey(), null, null);
applyLogMapper.insert(log);
@@ -829,9 +864,15 @@
if(Objects.isNull(solutions)){
throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌淇濋櫓鏂规");
}
+ if(solutions.getDataType().equals(Constants.ONE)){
+ solutions = solutionsMapper.selectOne(new QueryWrapper<Solutions>().lambda().eq(Solutions::getBaseId,solutions.getBaseId()).eq(Solutions::getDataType,Constants.TWO).last("limit 1"));
+ if(Objects.isNull(solutions)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌鏂规鏈�鏂扮増鏈俊鎭�");
+ }
+ }
CompanySolution companySolution = companySolutionMapper.selectOne(new QueryWrapper<CompanySolution>().lambda()
.eq(CompanySolution::getCompanyId,loginUserInfo.getCompanyId())
- .eq(CompanySolution::getSolutionBaseId,solutions.getId())
+ .eq(CompanySolution::getSolutionBaseId,solutions.getBaseId())
.eq(CompanySolution::getIsdeleted,Constants.ZERO)
.last(" limit 1 ")
);
@@ -908,6 +949,13 @@
if(companySolution.getCanAdd().equals(Constants.ZERO)){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "璇ヤ紒涓氬垎閰嶄繚闄╂柟妗堟棤娉曡繘琛屽姞淇�");
}
+ //楠岃瘉鏄惁瀛樺湪閲嶅鏁版嵁
+ List<String> idcarNo = addDetailList.stream().map(m->m.getIdcardNo()).collect(Collectors.toList());
+ Set<String> set = new HashSet<>(idcarNo);
+ if(idcarNo.size() != set.size()){
+ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝浜哄憳褰曞叆鏁版嵁瀛樺湪鐩稿悓鏁版嵁锛�");
+ }
+
//鍔犱繚鏄庣粏鏁版嵁 璁$畻閲戦 鏍规嵁鎵瑰崟鏃堕棿 璁$畻
applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(applyChange.getValidTime(),1));
CountCyclePriceVO countCyclePriceVO = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO);
@@ -921,6 +969,13 @@
//鍑忎繚鏁版嵁
List<ApplyChagneDetail> delDetailList = applyChange.getDelDetailList();
if (CollectionUtils.isNotEmpty(delDetailList)) {
+ //楠岃瘉鏄惁瀛樺湪閲嶅鏁版嵁
+ List<String> idcarNo = delDetailList.stream().map(m->m.getIdcardNo()).collect(Collectors.toList());
+ Set<String> set = new HashSet<>(idcarNo);
+ if(idcarNo.size() != set.size()){
+ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝浜哄憳褰曞叆鏁版嵁瀛樺湪鐩稿悓鏁版嵁锛�");
+ }
+
if(companySolution.getCanReduce().equals(Constants.ZERO)){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "璇ヤ紒涓氬垎閰嶄繚闄╂柟妗堟棤娉曡繘琛屽噺淇�");
}
@@ -928,7 +983,7 @@
applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(applyChange.getValidTime(),2));
CountCyclePriceVO countCyclePriceVO = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO);
BigDecimal detailFee = countCyclePriceVO.getCyclePrice();
- this.delChangeDetail(applyChange,delDetailList,insuranceApply,solutions,loginUserInfo,detailFee);
+ this.delChangeDetail(applyChange,delDetailList,insuranceApply,solutions,loginUserInfo,detailFee,applyChangeCyclePriceDTO.getValidTime());
fee = fee.add(delDetailList.stream().map(ApplyChagneDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add));
}
@@ -966,7 +1021,7 @@
* @param loginUserInfo
*/
public void delChangeDetail(ApplyChange applyChange ,List<ApplyChagneDetail> delDetailList,InsuranceApply insuranceApply,Solutions solutions,
- LoginUserInfo loginUserInfo,BigDecimal detailFee){
+ LoginUserInfo loginUserInfo,BigDecimal detailFee,Date endTime){
for (ApplyChagneDetail applyChagneDetail : delDetailList) {
if (Objects.isNull(applyChagneDetail.getMemberId())) {
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鍑忎繚浜哄憳銆�" + applyChagneDetail.getMemberName() + "銆戝繀濉」缂哄け");
@@ -1018,7 +1073,7 @@
applyChagneDetail.setType(Constants.ONE);
applyChagneDetail.setStartTime(applyDetail.getStartTime());
- applyChagneDetail.setEndTime(DateUtil.getMontageDate(applyChange.getApplyStartTime(),3));
+ applyChagneDetail.setEndTime(endTime);
member.setApplyId(insuranceApply.getId());
member.setDuId(applyChagneDetail.getDuId());
@@ -1512,6 +1567,8 @@
String info = applyLogType.getInfo();
if(StringUtils.isNotBlank(applyChangeOptDTO.getOptIllustration())){
info = info.replace("${param}", applyChangeOptDTO.getOptIllustration());
+ }else{
+ info = info.replace("${param}", "");
}
ApplyLog log = new ApplyLog(applyChange,applyLogType.getName(),info,applyChange.getId(),applyLogType.getKey(), null, null);
applyLogMapper.insert(log);
--
Gitblit v1.9.3