审批流通用方法优化
This commit is contained in:
parent
746b572d8e
commit
73b3c492ca
|
|
@ -18,7 +18,7 @@ public enum TmTaskTypeEnum {
|
||||||
TM_TASK_AGREEMENT_MANAGEMENT(10, "新增协议任务"),
|
TM_TASK_AGREEMENT_MANAGEMENT(10, "新增协议任务"),
|
||||||
TM_TASK_REPAIR_INPUT(11, "修饰后入库任务"),
|
TM_TASK_REPAIR_INPUT(11, "修饰后入库任务"),
|
||||||
TM_TASK_PART_LEASE(12, "配件领料任务"),
|
TM_TASK_PART_LEASE(12, "配件领料任务"),
|
||||||
TM_TASK_PART_TYPE(13, "配件新购"),
|
TM_TASK_PART_TYPE(13, "费用减免任务"),
|
||||||
TM_TASK_REPAIR_NUM(14, "数量维修人员信息附件"),
|
TM_TASK_REPAIR_NUM(14, "数量维修人员信息附件"),
|
||||||
//盘点报废
|
//盘点报废
|
||||||
TM_TASK_PART_SCRAP(15, "盘点报废");
|
TM_TASK_PART_SCRAP(15, "盘点报废");
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
package com.bonus.material.purchase.service.impl;
|
package com.bonus.material.purchase.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.bonus.common.biz.enums.PurchaseTaskStatusEnum;
|
import com.bonus.common.biz.enums.PurchaseTaskStatusEnum;
|
||||||
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
|
import com.bonus.common.core.utils.encryption.AesCbcUtils;
|
||||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||||
import com.bonus.common.core.utils.sms.SmsUtils;
|
import com.bonus.common.core.utils.sms.SmsUtils;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
|
@ -60,7 +63,14 @@ public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonSer
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<PurchaseNoticePerson> selectPurchaseNoticePersonList(PurchaseNoticePerson purchaseNoticePerson) {
|
public List<PurchaseNoticePerson> selectPurchaseNoticePersonList(PurchaseNoticePerson purchaseNoticePerson) {
|
||||||
return purchaseNoticePersonMapper.selectPurchaseNoticePersonList(purchaseNoticePerson);
|
List<PurchaseNoticePerson> list = purchaseNoticePersonMapper.selectPurchaseNoticePersonList(purchaseNoticePerson);
|
||||||
|
list.removeIf(Objects::isNull);
|
||||||
|
list.forEach(item -> {
|
||||||
|
if (null != item.getTelphone() && 11 < item.getTelphone().length()) {
|
||||||
|
item.setTelphone(Sm4Utils.decrypt(item.getTelphone()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -70,7 +80,13 @@ public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonSer
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<PurchaseNoticePerson> getUnSelectedUserList() {
|
public List<PurchaseNoticePerson> getUnSelectedUserList() {
|
||||||
return purchaseNoticePersonMapper.getUnSelectedUserList();
|
List<PurchaseNoticePerson> userList = purchaseNoticePersonMapper.getUnSelectedUserList();
|
||||||
|
for (PurchaseNoticePerson user : userList) {
|
||||||
|
if (null != user.getTelphone() && 11 < user.getTelphone().length()) {
|
||||||
|
user.setTelphone(Sm4Utils.decrypt(user.getTelphone()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return userList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -96,9 +96,9 @@ public class SltAgreementReduceController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询协议申请减免明细
|
* 新增申请减免数据
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "查询协议申请减免明细")
|
@ApiOperation(value = "新增申请减免数据")
|
||||||
// @RequiresPermissions("settlement:apply:list")
|
// @RequiresPermissions("settlement:apply:list")
|
||||||
@SysLog(title = "申请减免", businessType = OperaType.INSERT, logType = 1,module = "结算关联->申请减免")
|
@SysLog(title = "申请减免", businessType = OperaType.INSERT, logType = 1,module = "结算关联->申请减免")
|
||||||
@PostMapping("/addApply")
|
@PostMapping("/addApply")
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.material.settlement.service.impl;
|
package com.bonus.material.settlement.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
|
@ -7,6 +8,7 @@ import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
||||||
import com.bonus.material.settlement.domain.SltAgreementReduce;
|
import com.bonus.material.settlement.domain.SltAgreementReduce;
|
||||||
import com.bonus.material.settlement.mapper.SltAgreementReduceMapper;
|
import com.bonus.material.settlement.mapper.SltAgreementReduceMapper;
|
||||||
import com.bonus.material.settlement.service.ISltAgreementReduceService;
|
import com.bonus.material.settlement.service.ISltAgreementReduceService;
|
||||||
|
import com.bonus.material.work.service.SysWorkflowRecordService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
|
|
@ -33,9 +35,13 @@ import java.util.stream.Collectors;
|
||||||
public class SltAgreementReduceServiceImpl implements ISltAgreementReduceService {
|
public class SltAgreementReduceServiceImpl implements ISltAgreementReduceService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SltAgreementReduceMapper sltAgreementRecudceMapper;
|
private SltAgreementReduceMapper sltAgreementRecudceMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BmFileInfoMapper bmFileInfoMapper;
|
private BmFileInfoMapper bmFileInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysWorkflowRecordService workflowRecordService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SltAgreementReduce> selectSltAgreementReduceList(SltAgreementReduce sltAgreement) {
|
public List<SltAgreementReduce> selectSltAgreementReduceList(SltAgreementReduce sltAgreement) {
|
||||||
return sltAgreementRecudceMapper.selectSltAgreementReduceList(sltAgreement);
|
return sltAgreementRecudceMapper.selectSltAgreementReduceList(sltAgreement);
|
||||||
|
|
@ -49,40 +55,42 @@ public class SltAgreementReduceServiceImpl implements ISltAgreementReduceService
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class) // 对所有异常回滚
|
@Transactional(rollbackFor = Exception.class) // 对所有异常回滚
|
||||||
public AjaxResult addApply(SltAgreementReduce sltAgreement) {
|
public AjaxResult addApply(SltAgreementReduce sltAgreement) {
|
||||||
|
List<SltAgreementReduce> list;
|
||||||
try {
|
try {
|
||||||
List<SltAgreementReduce> list = sltAgreement.getDetailList();
|
|
||||||
//bmFileInfoMapper.insertBmFileInfo()
|
|
||||||
// 初始化 SltAgreementReduce 对象
|
// 初始化 SltAgreementReduce 对象
|
||||||
initSltAgreement(sltAgreement);
|
initSltAgreement(sltAgreement);
|
||||||
|
// 计算减免区间
|
||||||
List<SltAgreementReduce> applyReduction = applyReduction(sltAgreement);
|
List<SltAgreementReduce> applyReduction = applyReduction(sltAgreement);
|
||||||
|
|
||||||
if (applyReduction.size() > 0 && applyReduction!= null) {
|
if (!applyReduction.isEmpty()) {
|
||||||
list = applyReduction;
|
list = applyReduction;
|
||||||
} else {
|
} else {
|
||||||
list = null;
|
list = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(list != null){
|
if (null != list) {
|
||||||
sltAgreement.setCreator(SecurityUtils.getUserId().toString());
|
sltAgreement.setCreator(SecurityUtils.getUserId().toString());
|
||||||
|
// 插入外层任务信息
|
||||||
Long rs = sltAgreementRecudceMapper.insertReduce(sltAgreement);
|
Long rs = sltAgreementRecudceMapper.insertReduce(sltAgreement);
|
||||||
Long id = sltAgreement.getId();
|
Long taskId = sltAgreement.getId();
|
||||||
|
if (null != rs && rs > 0 && null != taskId && taskId > 0) {
|
||||||
|
workflowRecordService.addSysWorkflowRecord(Math.toIntExact(taskId), sltAgreement.getCode(), TmTaskTypeEnum.TM_TASK_PART_TYPE.getTaskTypeId());
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("新增失败");
|
||||||
|
}
|
||||||
AtomicBoolean addFileInfoResult = new AtomicBoolean(false);
|
AtomicBoolean addFileInfoResult = new AtomicBoolean(false);
|
||||||
|
|
||||||
if (sltAgreement.getBmFileInfos() != null) {
|
if (sltAgreement.getBmFileInfos() != null) {
|
||||||
sltAgreement.getBmFileInfos().forEach(bmFileInfo -> {
|
sltAgreement.getBmFileInfos().forEach(bmFileInfo -> {
|
||||||
bmFileInfo.setModelId(id);
|
bmFileInfo.setModelId(taskId);
|
||||||
bmFileInfo.setCreateTime(DateUtils.getNowDate());
|
bmFileInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
addFileInfoResult.set(bmFileInfoMapper.insertBmFileInfo(bmFileInfo) > 0);
|
addFileInfoResult.set(bmFileInfoMapper.insertBmFileInfo(bmFileInfo) > 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (rs > 0) {
|
||||||
|
|
||||||
if (rs > 0 && list != null) {
|
|
||||||
// 批量插入明细
|
// 批量插入明细
|
||||||
List<SltAgreementReduce> detailList = list.stream()
|
List<SltAgreementReduce> detailList = list.stream()
|
||||||
.peek(detail -> detail.setId(id))
|
.peek(detail -> detail.setId(taskId))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
sltAgreementRecudceMapper.insertBatchReduceDetail(detailList);
|
sltAgreementRecudceMapper.insertBatchReduceDetail(detailList);
|
||||||
}
|
}
|
||||||
|
|
@ -90,8 +98,6 @@ public class SltAgreementReduceServiceImpl implements ISltAgreementReduceService
|
||||||
return AjaxResult.warn("检索历史申请减免区间数据,已申请减免,请勿在提交申请单!");
|
return AjaxResult.warn("检索历史申请减免区间数据,已申请减免,请勿在提交申请单!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
} catch (DataAccessException e) {
|
} catch (DataAccessException e) {
|
||||||
// 记录详细的数据库操作异常日志
|
// 记录详细的数据库操作异常日志
|
||||||
|
|
@ -187,7 +193,7 @@ public class SltAgreementReduceServiceImpl implements ISltAgreementReduceService
|
||||||
// 查询与当前区间有重叠的历史减免记录
|
// 查询与当前区间有重叠的历史减免记录
|
||||||
List<SltAgreementReduce> historyReductions = sltAgreementRecudceMapper.findOverlappingReductions(current);
|
List<SltAgreementReduce> historyReductions = sltAgreementRecudceMapper.findOverlappingReductions(current);
|
||||||
|
|
||||||
if(historyReductions !=null && historyReductions.size()>0){
|
if (null != historyReductions && !historyReductions.isEmpty()) {
|
||||||
// 对比并去掉重叠部分
|
// 对比并去掉重叠部分
|
||||||
for (SltAgreementReduce history : historyReductions) {
|
for (SltAgreementReduce history : historyReductions) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,14 +41,14 @@ public class SysWorkflowRecordServiceImpl implements SysWorkflowRecordService {
|
||||||
sysWorkflowType.setTaskType(taskType);
|
sysWorkflowType.setTaskType(taskType);
|
||||||
sysWorkflowType.setIsEnable(1);
|
sysWorkflowType.setIsEnable(1);
|
||||||
List<SysWorkflowType> sysWorkflowTypeList =sysWorkflowTypeMapper.selectSysWorkflowTypeList(sysWorkflowType);
|
List<SysWorkflowType> sysWorkflowTypeList =sysWorkflowTypeMapper.selectSysWorkflowTypeList(sysWorkflowType);
|
||||||
if (sysWorkflowTypeList.size()<1){
|
if (sysWorkflowTypeList.isEmpty()){
|
||||||
throw new ServiceException("新增任务失败,请创建审核流程");
|
throw new ServiceException("新增任务失败,请创建审核流程");
|
||||||
}
|
}
|
||||||
sysWorkflowType = sysWorkflowTypeList.get(0);
|
sysWorkflowType = sysWorkflowTypeList.get(0);
|
||||||
SysWorkflowRecord sysWorkflowRecord = new SysWorkflowRecord();
|
SysWorkflowRecord sysWorkflowRecord = new SysWorkflowRecord();
|
||||||
sysWorkflowRecord.setWorkflowId(sysWorkflowType.getId());
|
sysWorkflowRecord.setWorkflowId(sysWorkflowType.getId());
|
||||||
sysWorkflowRecord.setTaskId(taskId);
|
sysWorkflowRecord.setTaskId(taskId);
|
||||||
sysWorkflowRecord.setTaskType(2);
|
sysWorkflowRecord.setTaskType(taskType);
|
||||||
sysWorkflowRecord.setTaskCode(taskCode);
|
sysWorkflowRecord.setTaskCode(taskCode);
|
||||||
//创建审批任务
|
//创建审批任务
|
||||||
int count = sysWorkflowRecordMapper.addSysWorkflowRecord(sysWorkflowRecord);
|
int count = sysWorkflowRecordMapper.addSysWorkflowRecord(sysWorkflowRecord);
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="nextNodeId != null">next_node_id,</if>
|
<if test="nextNodeId != null">next_node_id,</if>
|
||||||
<if test="isAccept != null">is_accept,</if>
|
<if test="isAccept != null">is_accept,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
create_time,
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
|
@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="nextNodeId != null">#{nextNodeId},</if>
|
<if test="nextNodeId != null">#{nextNodeId},</if>
|
||||||
<if test="isAccept != null">#{isAccept},</if>
|
<if test="isAccept != null">#{isAccept},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
now(),
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue