From 91ef431d0dda430889b190f79afd9c0849b35b5e Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期一, 01 四月 2024 19:37:37 +0800
Subject: [PATCH] 提交一把
---
server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java | 138 ++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 126 insertions(+), 12 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
index 8126ff7..6f9436a 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
@@ -1,5 +1,6 @@
package com.doumee.service.business.impl;
+import com.alibaba.fastjson.JSONObject;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.annotation.excel.ExcelExporter;
import com.doumee.core.constants.ResponseStatus;
@@ -11,12 +12,11 @@
import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.*;
-import com.doumee.dao.business.dto.SaveUnionApplyDTO;
-import com.doumee.dao.business.dto.SaveUnionChangeDTO;
-import com.doumee.dao.business.dto.UnionChangeBXDDTO;
+import com.doumee.dao.business.dto.*;
import com.doumee.dao.business.join.*;
import com.doumee.dao.business.model.*;
import com.doumee.dao.business.vo.CountCyclePriceVO;
+import com.doumee.service.business.SmsEmailService;
import com.doumee.service.business.UnionChangeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -28,6 +28,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -82,6 +83,15 @@
@Autowired
private InsuranceApplyMapper insuranceApplyMapper;
+ @Value("${debug_model}")
+ private boolean debugModel;
+ @Autowired
+ private SmsEmailService smsEmailService;
+ @Autowired
+ private MultifileMapper multifileMapper;
+
+ @Autowired
+ private ApplyLogMapper applyLogMapper;
@Override
public Integer create(UnionChange unionChange) {
unionChangeMapper.insert(unionChange);
@@ -126,6 +136,31 @@
public UnionChange findById(Integer id) {
return unionChangeMapper.selectById(id);
}
+
+
+ @Override
+ public UnionChange getDetail(Integer id){
+ UnionChange unionChange = unionChangeJoinMapper.selectJoinOne(UnionChange.class,
+ new MPJLambdaWrapper<UnionChange>()
+ .selectAll(UnionChange.class)
+ .selectAs(UnionApply::getCode,UnionChange::getApplyCode)
+ .selectAs(Solutions::getName,UnionChange::getSolutionsName)
+ .selectAs(UnionApply::getStartTime,UnionChange::getStartTime)
+ .selectAs(UnionApply::getEndTime,UnionChange::getEndTime)
+ .selectAs(Company::getName,UnionChange::getShopName)
+ .select("( select count(1) from apply_chagne_detail ad where t.id = ad.UNION_CHANGE_ID and ad.TYPE = 0 )",UnionChange::getAddNum)
+ .select("( select count(1) from apply_chagne_detail ad where t.id = ad.UNION_CHANGE_ID and ad.TYPE = 1 )",UnionChange::getDelNum)
+ .select("( select count(1) from apply_chagne_detail ad where t.id = ad.UNION_CHANGE_ID and ad.TYPE = 2 )",UnionChange::getChangeNum)
+ .leftJoin(UnionApply.class,UnionApply::getId,UnionChange::getUnionApplyId)
+ .leftJoin(Solutions.class,Solutions::getId,UnionApply::getSolutionId)
+ .leftJoin(Company.class,Company::getId,UnionChange::getShopId)
+ .eq(UnionChange::getId,id)
+ .last(" limit 1 ")
+ );
+ return unionChange;
+ }
+
+
@Override
public UnionChange findOne(UnionChange unionChange) {
@@ -285,6 +320,13 @@
applyChagneDetailJoinMapper.update(null,new UpdateWrapper<ApplyChagneDetail>().lambda()
.set(ApplyChagneDetail::getUnionChangeId,unionChange.getId())
.in(ApplyChagneDetail::getApplyId,saveUnionChangeDTO.getApplyIds()));
+
+
+ Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_HBD_UPLOAD;
+ ApplyLog log = new ApplyLog(unionChange,applyLogType.getName(), null
+ ,unionChange.getId(),applyLogType.getKey(),null, JSONObject.toJSONString(unionChange));
+ applyLogMapper.insert(log);
+
return unionChange.getId();
}
@@ -295,16 +337,21 @@
/**
* 鍙栨秷淇濆崟鍚堝苟
- * @param id
+ * @param closeDTO
*/
@Override
@Transactional(rollbackFor = {Exception.class,BusinessException.class})
- public void cancelMerge(Integer id){
+ public void cancelMerge(CloseDTO closeDTO){
+ if(Objects.isNull(closeDTO)
+ ||Objects.isNull(closeDTO.getId())
+ ||StringUtils.isBlank(closeDTO.getReason())){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
if(user.getType().equals(Constants.TWO)){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣滐紒");
}
- UnionChange unionChange = unionChangeMapper.selectById(id);
+ UnionChange unionChange = unionChangeMapper.selectById(closeDTO.getId());
if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){
throw new BusinessException(ResponseStatus.DATA_EMPTY);
}
@@ -333,6 +380,14 @@
.set(UnionChange::getStatus,Constants.UnionApplyStatus.CLOSE.getKey())
.eq(UnionChange::getId,unionChange.getId())
);
+
+ Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_HBD_UPLOAD;
+ String info =applyLogType.getInfo();
+ info = info.replace("${param}", closeDTO.getReason());
+ ApplyLog log = new ApplyLog(unionChange,applyLogType.getName(), info
+ ,unionChange.getId(),applyLogType.getKey(),null, JSONObject.toJSONString(unionChange));
+ applyLogMapper.insert(log);
+
}
@@ -389,17 +444,24 @@
/**
* 鍚堝苟鍗曪紙鍔犲噺淇�/鎹㈠巶锛� - 鎶曚繚鐢宠绛剧讲
- * @param id
+ * @param smsCheckDTO
* @return
*/
@Override
@Transactional(rollbackFor = {Exception.class,BusinessException.class})
- public String getSignLink(Integer id) {
- if(id == null ){
+ public String getSignLink(SmsCheckDTO smsCheckDTO) {
+ if(Objects.isNull(smsCheckDTO)
+ || Objects.isNull(smsCheckDTO.getBusinessId())
+ || StringUtils.isBlank(smsCheckDTO.getCode())
+ ){
throw new BusinessException(ResponseStatus.BAD_REQUEST);
}
+ //楠岃瘉 楠岃瘉鐮�
+ if(!debugModel){
+ smsEmailService.validateCode(smsCheckDTO.getCode());
+ }
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
- UnionChange unionChange = this.unionChangeDetail(id);
+ UnionChange unionChange = this.unionChangeDetail(smsCheckDTO.getBusinessId());
if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){
throw new BusinessException(ResponseStatus.DATA_EMPTY);
}
@@ -454,8 +516,8 @@
if(Objects.isNull(unionChangeBXDDTO)
|| Objects.isNull(unionChangeBXDDTO.getId())
|| Objects.isNull(unionChangeBXDDTO.getApplyDate())
- || StringUtils.isBlank(unionChangeBXDDTO.getFileName())
- || StringUtils.isBlank(unionChangeBXDDTO.getFileUrl())
+ || StringUtils.isBlank(unionChangeBXDDTO.getName())
+ || StringUtils.isBlank(unionChangeBXDDTO.getFileurl())
|| StringUtils.isBlank(unionChangeBXDDTO.getCode())
){
throw new BusinessException(ResponseStatus.BAD_REQUEST);
@@ -485,14 +547,60 @@
.selectAs(InsuranceApply::getCode,ApplyChange::getApplyCode)
.leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
.eq(ApplyChange::getUnionChangeId,unionChange.getId()));
+
+ //瀛樺偍鍚堝苟鍗曚繚闄╁崟
+ Multifile multifile = new Multifile();
+ multifile.setIsdeleted(Constants.ZERO);
+ multifile.setCreator(user.getId());
+ multifile.setCreateDate(new Date());
+ multifile.setObjId(unionChangeBXDDTO.getId());
+ multifile.setCreateDate(new Date());
+ multifile.setObjType(Constants.MultiFile.WTB_CA_DONE_PDF.getKey());
+ multifile.setType(Constants.TWO);
+ multifile.setFileurl(unionChangeBXDDTO.getFileurl());
+ multifile.setName(unionChangeBXDDTO.getName());
+ multifileMapper.insert(multifile);
+
+ if(CollectionUtils.isNotEmpty(unionChangeBXDDTO.getApplyChangeBXDList())){
+ //鏌ヨ鏄惁涓嶅瓨鍦ㄥ綋鍓嶅悎骞跺崟鐨勬暟鎹�
+ if(applyChangeJoinMapper.selectCount(new QueryWrapper<ApplyChange>()
+ .lambda().ne(ApplyChange::getUnionChangeId,unionChangeBXDDTO.getId())
+ .in(ApplyChange::getId,
+ unionChangeBXDDTO.getApplyChangeBXDList().stream().map(m->m.getObjId()).collect(Collectors.toList())
+ )
+ )>Constants.ZERO){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鎵瑰崟鏄庣粏璁板綍瀛樺湪闈炴湰鍚堝苟鍗曟暟鎹�");
+ };
+ for (Multifile m:unionChangeBXDDTO.getApplyChangeBXDList()) {
+ if(Objects.isNull(m.getObjId())
+ ||StringUtils.isBlank(m.getFileurl())
+ ||StringUtils.isBlank(m.getName())
+ ){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鍔犲噺淇�/鎹㈠巶涓氬姟鎵瑰崟鏂囦欢淇℃伅缂哄け");
+ }
+ multifile.setIsdeleted(Constants.ZERO);
+ multifile.setCreator(user.getId());
+ multifile.setCreateDate(new Date());
+ multifile.setCreateDate(new Date());
+ multifile.setObjType(Constants.MultiFile.CA_PD_PDF.getKey());
+ multifile.setType(Constants.TWO);
+ multifileMapper.insert(multifile);
+ }
+ }
+
+
if(CollectionUtils.isNotEmpty(applyChangeList)){
for (ApplyChange applyChange:applyChangeList) {
applyChange.setApplyStartTime(unionChangeBXDDTO.getApplyDate());
applyChange.setValidTime(unionChangeBXDDTO.getApplyDate());
applyChange.setEditDate(new Date());
applyChange.setEditor(user.getId());
+ applyChange.setStatus(Constants.ApplyChangeStatus.APPROVE.getKey());
List<ApplyChagneDetail> allList = applyChagneDetailJoinMapper.selectList(new QueryWrapper<ApplyChagneDetail>().lambda().eq(ApplyChagneDetail::getApplyChangeId,applyChange.getId()));
this.dealApplyChangeDetail(applyChange,allList);
+ applyChange.setCode(unionChangeBXDDTO.getCode());
+ applyChange.setCheckUserId(user.getId());
+ applyChangeJoinMapper.updateById(applyChange);
}
}
unionChangeMapper.update(null,new UpdateWrapper<UnionChange>().lambda()
@@ -501,6 +609,12 @@
.set(UnionChange::getEditor,user.getId())
.eq(UnionChange::getId,unionChangeBXDDTO.getId())
);
+
+
+ Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_HBD_UPLOAD_INSURANCE;
+ ApplyLog log = new ApplyLog(unionChange,applyLogType.getName(), null
+ ,unionChange.getId(),applyLogType.getKey(),null, JSONObject.toJSONString(unionChange));
+ applyLogMapper.insert(log);
}
--
Gitblit v1.9.3