From e74241a0043eed1b6ce3dd022095fa5d5b700382 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 03 四月 2024 18:04:36 +0800
Subject: [PATCH] git ch
---
server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java | 43 +++++++++++++++++++++++++++++++++++--------
1 files changed, 35 insertions(+), 8 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 6f9436a..134d350 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
@@ -16,6 +16,7 @@
import com.doumee.dao.business.join.*;
import com.doumee.dao.business.model.*;
import com.doumee.dao.business.vo.CountCyclePriceVO;
+import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.SmsEmailService;
import com.doumee.service.business.UnionChangeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -92,6 +93,9 @@
@Autowired
private ApplyLogMapper applyLogMapper;
+
+ @Autowired
+ private ApplyLogJoinMapper applyLogJoinMapper;
@Override
public Integer create(UnionChange unionChange) {
unionChangeMapper.insert(unionChange);
@@ -150,13 +154,30 @@
.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)
+ .select("( select count(1) from apply_chagne_detail ad where t.id = ad.UNION_CHANGE_ID and ad.TYPE = 2 )",UnionChange::getChangeNum).select("( select ifnull(sum(ac.FEE),0) from apply_change ac where t.id = ac.UNION_CHANGE_ID )",UnionChange::getFee)
.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 ")
);
+
+ if(!Objects.isNull(unionChange)){
+ //鏌ヨ鎿嶄綔璁板綍
+ List<ApplyLog> applyLogList = applyLogJoinMapper.selectJoinList(ApplyLog.class,
+ new MPJLambdaWrapper<ApplyLog>()
+ .selectAll(ApplyLog.class)
+ .selectAs(SystemUser::getRealname,ApplyLog::getCreatorName)
+ .selectAs(Company::getName,ApplyLog::getCompanyName)
+ .selectAs(SystemUser::getType,ApplyLog::getCreatorType)
+ .leftJoin(SystemUser.class,SystemUser::getId,ApplyLog::getCreator)
+ .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId)
+ .in(ApplyLog::getObjType,Constants.ApplyLogType.getTypeList(Constants.THREE))
+ .eq(ApplyLog::getApplyId,unionChange.getId())
+ .orderByAsc(ApplyLog::getCreateDate)
+ );
+ unionChange.setApplyLogList(applyLogList);
+ }
return unionChange;
}
@@ -179,15 +200,17 @@
IPage<UnionChange> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
MPJLambdaWrapper<UnionChange> queryWrapper = new MPJLambdaWrapper<>();
queryWrapper.selectAll(UnionChange.class);
- queryWrapper.selectAs(UnionApply::getCode,UnionChange::getApplyCode)
+ pageWrap.getModel().setIsdeleted(Constants.ZERO);
+ queryWrapper.selectAs(UnionApply::getCode,UnionChange::getApplyCode);
+ queryWrapper.selectAs(Solutions::getName,UnionChange::getSolutionsName)
.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);
queryWrapper.leftJoin(UnionApply.class,UnionApply::getId,UnionChange::getUnionApplyId);
queryWrapper.leftJoin(Solutions.class,Solutions::getId,UnionApply::getSolutionId);
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
- if(user.getType().equals(Constants.TWO)){
- queryWrapper.eq(UnionChange::getShopId, pageWrap.getModel().getShopId());
+ if(Constants.equalsInteger(user.getType(),Constants.TWO)){
+ queryWrapper.eq(UnionChange::getShopId, user.getCompanyId());
}
Utils.MP.blankToNull(pageWrap.getModel());
if (pageWrap.getModel().getId() != null) {
@@ -270,9 +293,10 @@
@Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
public Integer merge(SaveUnionChangeDTO saveUnionChangeDTO){
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
- if(user.getType().equals(Constants.TWO)){
+ if(!user.getType().equals(Constants.TWO)){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣�");
}
if(Objects.isNull(saveUnionChangeDTO)
@@ -289,8 +313,8 @@
.leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
.eq(ApplyChange::getIsdeleted, Constants.ZERO)
.eq(InsuranceApply::getUnionApplyId,saveUnionChangeDTO.getUnionApplyId())
- .eq(ApplyChange::getStatus,Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS.getKey())
- .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())
+ .eq(ApplyChange::getStatus,Constants.ApplyChangeStatus.CHECHED_PASSED.getKey())
+ .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WTB_DONE.getKey())
.eq(ApplyChange::getType,saveUnionChangeDTO.getBusinessType())
.in(ApplyChange::getId,saveUnionChangeDTO.getApplyIds())
.isNull(ApplyChange::getUnionChangeId)
@@ -304,6 +328,7 @@
unionChange.setCreateDate(new Date());
unionChange.setCreator(user.getId());
unionChange.setShopId(user.getCompanyId());
+ unionChange.setIsdeleted(Constants.ZERO);
unionChange.setUnionApplyId(saveUnionChangeDTO.getUnionApplyId());
unionChange.setApplyStartTime(saveUnionChangeDTO.getApplyDate());
unionChange.setType(saveUnionChangeDTO.getBusinessType());
@@ -314,12 +339,13 @@
.set(ApplyChange::getUnionChangeId,unionChange.getId())
.set(ApplyChange::getCheckDate,new Date())
.set(ApplyChange::getCheckUserId,user.getId())
+ .set(ApplyChange::getStatus,Constants.ApplyChangeStatus.WTB_TOUBAOING.getKey())
.in(ApplyChange::getId,saveUnionChangeDTO.getApplyIds())
);
applyChagneDetailJoinMapper.update(null,new UpdateWrapper<ApplyChagneDetail>().lambda()
.set(ApplyChagneDetail::getUnionChangeId,unionChange.getId())
- .in(ApplyChagneDetail::getApplyId,saveUnionChangeDTO.getApplyIds()));
+ .in(ApplyChagneDetail::getApplyChangeId,saveUnionChangeDTO.getApplyIds()));
Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_HBD_UPLOAD;
@@ -369,6 +395,7 @@
.set(ApplyChange::getUnionChangeId,null)
.set(ApplyChange::getCheckDate,new Date())
.set(ApplyChange::getCheckUserId,user.getId())
+ .set(ApplyChange::getStatus,Constants.ApplyChangeStatus.CHECHED_PASSED.getKey())
.in(ApplyChange::getUnionChangeId,unionChange.getId())
);
--
Gitblit v1.9.3