From eea444a1d985ddd104565139c65e4b3921285e81 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 23 一月 2024 10:20:39 +0800
Subject: [PATCH] 开发业务接口
---
server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java | 167 +++++++++++++++++++++++++++++++++++++------------------
1 files changed, 111 insertions(+), 56 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 3b6ae79..847d831 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
@@ -1,5 +1,6 @@
package com.doumee.service.business.impl;
+import com.alibaba.fastjson.JSONObject;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
@@ -71,6 +72,87 @@
@Autowired
private SolutionsMapper solutionsMapper;
+
+ /**
+ * 骞冲彴閫�鍥炴姇淇�
+ * @param param
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+ public Integer back(ApplyChange param) {
+ if(param.getId() == null ||StringUtils.isBlank(param.getCheckInfo())){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ ApplyChange model = applyChangeMapper.selectById(param.getId());
+
+ 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.APPROVE.getKey())){
+ //宸叉彁浜ゅ拰宸插畬鎴愮姸鎬佷笉鏀寔瀹℃牳涓嶉�氳繃
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ ApplyChange update = new ApplyChange();
+ update.setEditDate(new Date());
+ update.setEditor(user.getId());
+ update.setStatus(Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey());
+ update.setCheckDate(update.getEditDate());
+ update.setCheckInfo(param.getCheckInfo());
+ update.setCheckUserId(user.getId());
+ update.setId(model.getId());
+ applyChangeMapper.updateById(update);
+
+ Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_PLATFORM_CHECK_PASS_NO;
+ String info =applyLogType.getInfo();
+ info = info.replace("${param}", update.getCheckInfo());
+ ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ applyLogMapper.insert(log);
+ return 1;
+
+ }
+ /**
+ * 骞冲彴閫�鍥炴姇淇�
+ * @param param
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+ public Integer dealBackApply(ApplyChange param) {
+ if(param.getId() == null ||StringUtils.isBlank(param.getCheckInfo())){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ ApplyChange model = applyChangeMapper.selectById(param.getId());
+
+ 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.APPROVE.getKey())){
+ //宸叉彁浜ゅ拰宸插畬鎴愮姸鎬佷笉鏀寔瀹℃牳涓嶉�氳繃
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ ApplyChange update = new ApplyChange();
+ update.setEditDate(new Date());
+ update.setEditor(user.getId());
+ update.setStatus(Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey());
+ update.setCheckDate(update.getEditDate());
+ update.setCheckInfo(param.getCheckInfo());
+ update.setCheckUserId(user.getId());
+ update.setId(model.getId());
+ applyChangeMapper.updateById(update);
+
+ Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_PLATFORM_CHECK_PASS_NO;
+ String info =applyLogType.getInfo();
+ info = info.replace("${param}", update.getCheckInfo());
+ ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ applyLogMapper.insert(log);
+ return 1;
+
+ }
@Override
@Transactional(rollbackFor = {Exception.class,BusinessException.class})
@@ -165,7 +247,7 @@
applyLog.setTitle(applyChangeLogStatus.getName());
applyLog.setContent(content);
applyLog.setObjType(applyChangeLogStatus.getKey());
- applyLog.setObjId(Integer.toString(applyChange.getId()));
+ applyLog.setObjId( applyChange.getId());
applyLog.setStatus(applyChange.getStatus());
applyLogMapper.insert(applyLog);
}
@@ -399,57 +481,25 @@
@Override
public PageData<ApplyChange> findPage(PageWrap<ApplyChange> pageWrap) {
IPage<ApplyChange> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
- QueryWrapper<ApplyChange> queryWrapper = new QueryWrapper<>();
+ MPJLambdaWrapper<ApplyChange> queryWrapper = new MPJLambdaWrapper<>();
Utils.MP.blankToNull(pageWrap.getModel());
- if (pageWrap.getModel().getId() != null) {
- queryWrapper.lambda().eq(ApplyChange::getId, pageWrap.getModel().getId());
- }
- if (pageWrap.getModel().getCreator() != null) {
- queryWrapper.lambda().eq(ApplyChange::getCreator, pageWrap.getModel().getCreator());
- }
- if (pageWrap.getModel().getCreateDate() != null) {
- queryWrapper.lambda().ge(ApplyChange::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
- queryWrapper.lambda().le(ApplyChange::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
- }
- if (pageWrap.getModel().getEditor() != null) {
- queryWrapper.lambda().eq(ApplyChange::getEditor, pageWrap.getModel().getEditor());
- }
- if (pageWrap.getModel().getEditDate() != null) {
- queryWrapper.lambda().ge(ApplyChange::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
- queryWrapper.lambda().le(ApplyChange::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
- }
- if (pageWrap.getModel().getIsdeleted() != null) {
- queryWrapper.lambda().eq(ApplyChange::getIsdeleted, pageWrap.getModel().getIsdeleted());
- }
- if (pageWrap.getModel().getRemark() != null) {
- queryWrapper.lambda().eq(ApplyChange::getRemark, pageWrap.getModel().getRemark());
- }
- if (pageWrap.getModel().getSortnum() != null) {
- queryWrapper.lambda().eq(ApplyChange::getSortnum, pageWrap.getModel().getSortnum());
- }
- if (pageWrap.getModel().getApplyId() != null) {
- queryWrapper.lambda().eq(ApplyChange::getApplyId, pageWrap.getModel().getApplyId());
- }
- if (pageWrap.getModel().getCode() != null) {
- queryWrapper.lambda().eq(ApplyChange::getCode, pageWrap.getModel().getCode());
- }
- if (pageWrap.getModel().getApplyStartTime() != null) {
- queryWrapper.lambda().ge(ApplyChange::getApplyStartTime, Utils.Date.getStart(pageWrap.getModel().getApplyStartTime()));
- queryWrapper.lambda().le(ApplyChange::getApplyStartTime, Utils.Date.getEnd(pageWrap.getModel().getApplyStartTime()));
- }
- if (pageWrap.getModel().getStatus() != null) {
- queryWrapper.lambda().eq(ApplyChange::getStatus, pageWrap.getModel().getStatus());
- }
- if (pageWrap.getModel().getValidTime() != null) {
- queryWrapper.lambda().ge(ApplyChange::getValidTime, Utils.Date.getStart(pageWrap.getModel().getValidTime()));
- queryWrapper.lambda().le(ApplyChange::getValidTime, Utils.Date.getEnd(pageWrap.getModel().getValidTime()));
- }
- if (pageWrap.getModel().getValidCode() != null) {
- queryWrapper.lambda().eq(ApplyChange::getValidCode, pageWrap.getModel().getValidCode());
- }
- if (pageWrap.getModel().getType() != null) {
- queryWrapper.lambda().eq(ApplyChange::getType, pageWrap.getModel().getType());
- }
+ ApplyChange model = pageWrap.getModel() ;
+ queryWrapper
+ .selectAll(ApplyChange.class)
+ .selectAs(InsuranceApply::getCode,ApplyChange::getApplyCode)
+ .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 0 )",ApplyChange::getAddNum)
+ .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 1 )",ApplyChange::getDelNum)
+ .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 2 )",ApplyChange::getChangeNum)
+ .select("( select ifnull(sum(ad.FEE),0) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID )",ApplyChange::getChangeMoney)
+ .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
+ .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
+ .eq(!Objects.isNull(model.getType()),ApplyChange::getType,model.getType())
+ .eq(!Objects.isNull(model.getStatus()),ApplyChange::getStatus,model.getStatus())
+ .eq(!Objects.isNull(model.getCompanyId()),InsuranceApply::getCompanyId,model.getCompanyId())
+ .eq(!Objects.isNull(model.getSolutionsId()),ApplyChange::getSolutionsId,model.getSolutionsId())
+ .ge(StringUtils.isNotBlank(model.getCreateDateS()),ApplyChange::getCreateDate, model.getCreateDateS()+" 00:00:00" )
+ .le(StringUtils.isNotBlank(model.getCreateDateE()),ApplyChange::getCreateDate, model.getCreateDateE()+" 23:59:59" );
+
for(PageWrap.SortData sortData: pageWrap.getSorts()) {
if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
queryWrapper.orderByDesc(sortData.getProperty());
@@ -457,7 +507,8 @@
queryWrapper.orderByAsc(sortData.getProperty());
}
}
- return PageData.from(applyChangeMapper.selectPage(page, queryWrapper));
+ PageData<ApplyChange> pageData = PageData.from(applyChangeJoinMapper.selectJoinPage(page,ApplyChange.class, queryWrapper));
+ return pageData;
}
@Override
@@ -524,8 +575,8 @@
throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"鏁版嵁宸插垹闄�,鏃犳硶杩涜璇ユ搷浣�");
}
Constants.ApplyChangeLogStatus applyChangeLogStatus = Constants.ApplyChangeLogStatus.RETURN_APPLY;
-
- if(applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY.getKey())){
+ if(applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey())
+ ||applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())){
//鍙戣捣閫�鍥炵敵璇�
if(loginUserInfo.getType().equals(Constants.ONE)){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氱鐢ㄦ埛鏃犳硶杩涜璇ユ搷浣�");
@@ -539,7 +590,9 @@
if(loginUserInfo.getType().equals(Constants.ZERO)){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲钩鍙扮鐢ㄦ埛鏃犳硶杩涜璇ユ搷浣�");
}
- if(!applyChange.getStatus().equals(Constants.ApplyChangeStatus.RETURN_APPLY.getKey())){
+ if(!(applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey())
+ ||applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())
+ )){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏁版嵁鐘舵�侀敊璇棤娉曡繘琛岃鎿嶄綔!");
}
}else if(applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.UPLOAD.getKey())){
@@ -548,7 +601,9 @@
if(loginUserInfo.getType().equals(Constants.ZERO)){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲钩鍙扮鐢ㄦ埛鏃犳硶杩涜璇ユ搷浣�");
}
- if(!applyChange.getStatus().equals(Constants.ApplyChangeStatus.RETURN_APPLY.getKey())){
+ if(!(applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey())
+ ||applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())
+ )){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏁版嵁鐘舵�侀敊璇棤娉曡繘琛岃鎿嶄綔!");
}
}else if(applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.CLOSE.getKey())){
--
Gitblit v1.9.3