fix:十二分制-移动端接口;PC端接口补充
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package com.cool.store.dao.tp;
|
||||
|
||||
import cn.hutool.core.collection.CollStreamUtil;
|
||||
import com.alibaba.excel.util.CollectionUtils;
|
||||
import com.cool.store.entity.tp.TpApplyFormDO;
|
||||
import com.cool.store.enums.tp.TpFormStatusEnum;
|
||||
import com.cool.store.enums.tp.TpFormTypeEnum;
|
||||
import com.cool.store.enums.tp.TpPayStatusEnum;
|
||||
import com.cool.store.mapper.tp.TpApplyFormMapper;
|
||||
import com.cool.store.request.tp.TpApplyQueryRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -11,10 +13,7 @@ import org.springframework.stereotype.Repository;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -129,14 +128,47 @@ public class TpApplyFormDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据处罚单id查询申请单
|
||||
* 根据处罚单id查询复议申请单
|
||||
* @param penaltyId 处罚单id
|
||||
* @return 申请单
|
||||
*/
|
||||
public TpApplyFormDO getByPenaltyId(Long penaltyId) {
|
||||
public TpApplyFormDO getAppealByPenaltyId(Long penaltyId) {
|
||||
return tpApplyFormMapper.selectOne(TpApplyFormDO.builder().penaltyId(penaltyId).deleted(0).build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据处罚单id列表查询申请单
|
||||
* @param penaltyIds 处罚单id列表
|
||||
* @return 申请单列表
|
||||
*/
|
||||
public List<TpApplyFormDO> getByPenaltyIds(List<Long> penaltyIds) {
|
||||
if (CollectionUtils.isEmpty(penaltyIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Example example = new Example(TpApplyFormDO.class);
|
||||
example.createCriteria().andIn("penaltyId", penaltyIds).andEqualTo("deleted", 0);
|
||||
return tpApplyFormMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤存在正在复议的申请单
|
||||
* @param penaltyIds 处罚单id列表
|
||||
* @return 存在复议的处罚单id列表
|
||||
*/
|
||||
public Set<Long> filterExistAppeal(List<Long> penaltyIds) {
|
||||
if (CollectionUtils.isEmpty(penaltyIds)) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
Example example = new Example(TpApplyFormDO.class);
|
||||
example.createCriteria().andIn("penaltyId", penaltyIds)
|
||||
.andEqualTo("type", TpFormTypeEnum.APPEAL.getType())
|
||||
.andEqualTo("status", TpFormStatusEnum.PENDING.getStatus())
|
||||
.andEqualTo("deleted", 0);
|
||||
example.selectProperties("penaltyId");
|
||||
List<TpApplyFormDO> list = tpApplyFormMapper.selectByExample(example);
|
||||
return CollStreamUtil.toSet(list, TpApplyFormDO::getPenaltyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id列表查询
|
||||
*/
|
||||
@@ -150,12 +182,41 @@ public class TpApplyFormDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请单作废
|
||||
* @param applyId 申请单id
|
||||
* 修改申请单状态
|
||||
*/
|
||||
public void cancelApply(Long applyId) {
|
||||
public void updateStatus(Long applyId, TpFormStatusEnum status) {
|
||||
Example example = new Example(TpApplyFormDO.class);
|
||||
example.createCriteria().andEqualTo("id", applyId).andEqualTo("deleted", 0);
|
||||
tpApplyFormMapper.updateByExampleSelective(TpApplyFormDO.builder().status(TpFormStatusEnum.CANCEL.getStatus()).build(), example);
|
||||
tpApplyFormMapper.updateByExampleSelective(TpApplyFormDO.builder().status(status.getStatus()).build(), example);
|
||||
}
|
||||
|
||||
public void updateStatusBatch(List<Long> applyIds, TpFormStatusEnum status) {
|
||||
if (CollectionUtils.isEmpty(applyIds)) {
|
||||
return ;
|
||||
}
|
||||
Example example = new Example(TpApplyFormDO.class);
|
||||
example.createCriteria().andIn("id", applyIds).andEqualTo("deleted", 0);
|
||||
tpApplyFormMapper.updateByExampleSelective(TpApplyFormDO.builder().status(status.getStatus()).build(), example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改缴费状态
|
||||
*/
|
||||
public void updatePayStatus(Long applyId, TpPayStatusEnum payStatus) {
|
||||
Example example = new Example(TpApplyFormDO.class);
|
||||
example.createCriteria().andEqualTo("id", applyId).andEqualTo("deleted", 0);
|
||||
tpApplyFormMapper.updateByExampleSelective(TpApplyFormDO.builder().payStatus(payStatus.getStatus()).build(), example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id删除
|
||||
*/
|
||||
public void deleteByIds(List<Long> ids) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
Example example = new Example(TpApplyFormDO.class);
|
||||
example.createCriteria().andIn("id", ids).andEqualTo("deleted", 0);
|
||||
tpApplyFormMapper.updateByExampleSelective(TpApplyFormDO.builder().deleted(1).build(), example);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package com.cool.store.dao.tp;
|
||||
|
||||
import com.alibaba.excel.util.CollectionUtils;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.entity.tp.TpAuditRecordDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.OperationLogAuditEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.tp.TpAuditRecordMapper;
|
||||
import com.cool.store.response.AuditInfoResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -25,10 +29,11 @@ public class TpAuditRecordDAO {
|
||||
|
||||
/**
|
||||
* 新增提交记录
|
||||
* @param applyId 申请单id
|
||||
*
|
||||
* @param applyId 申请单id
|
||||
* @param applyType 单据类型,0加分单 1警告书 2处罚书
|
||||
* @param userId 申请人id
|
||||
* @param userName 申请人名称
|
||||
* @param userId 申请人id
|
||||
* @param userName 申请人名称
|
||||
*/
|
||||
public void addSubmitRecord(Long applyId, Integer applyType, String userId, String userName) {
|
||||
Date now = new Date();
|
||||
@@ -47,7 +52,8 @@ public class TpAuditRecordDAO {
|
||||
|
||||
/**
|
||||
* 新增审批记录
|
||||
* @param applyId 申请单id
|
||||
*
|
||||
* @param applyId 申请单id
|
||||
* @param applyType 单据类型,0加分单 1警告书 2处罚书
|
||||
*/
|
||||
public void addApproveRecord(Long applyId, Integer applyType) {
|
||||
@@ -65,10 +71,11 @@ public class TpAuditRecordDAO {
|
||||
|
||||
/**
|
||||
* 首次发起流程
|
||||
* @param applyId 申请单id
|
||||
*
|
||||
* @param applyId 申请单id
|
||||
* @param applyType 单据类型,0加分单 1警告书 2处罚书
|
||||
* @param userId 申请人id
|
||||
* @param userName 申请人名称
|
||||
* @param userId 申请人id
|
||||
* @param userName 申请人名称
|
||||
*/
|
||||
public void addRecord(Long applyId, Integer applyType, String userId, String userName) {
|
||||
addSubmitRecord(applyId, applyType, userId, userName);
|
||||
@@ -77,7 +84,8 @@ public class TpAuditRecordDAO {
|
||||
|
||||
/**
|
||||
* 根据申请单id查询待审批记录
|
||||
* @param applyId 申请单id
|
||||
*
|
||||
* @param applyId 申请单id
|
||||
* @param applyType 单据类型,0加分单 1警告书 2处罚书
|
||||
* @return 审批记录
|
||||
*/
|
||||
@@ -92,13 +100,14 @@ public class TpAuditRecordDAO {
|
||||
|
||||
/**
|
||||
* 根据申请单id审批待处理的审批记录
|
||||
* @param applyId 申请单id
|
||||
* @param applyType 单据类型,0加分单 1警告书 2处罚书
|
||||
* @param userId 审批人id
|
||||
* @param userName 审批人名称
|
||||
*
|
||||
* @param applyId 申请单id
|
||||
* @param applyType 单据类型,0加分单 1警告书 2处罚书
|
||||
* @param userId 审批人id
|
||||
* @param userName 审批人名称
|
||||
* @param auditStatus 审批状态
|
||||
* @param remark 备注
|
||||
* @param auditTime 审批时间
|
||||
* @param remark 备注
|
||||
* @param auditTime 审批时间
|
||||
*/
|
||||
public void auditPendingRecordByApplyId(Long applyId, Integer applyType, String userId, String userName, Integer auditStatus, String remark, Date auditTime) {
|
||||
TpAuditRecordDO auditRecordDO = getPendingRecordByApplyId(applyId, applyType);
|
||||
@@ -119,4 +128,64 @@ public class TpAuditRecordDAO {
|
||||
public void updateKeySelective(TpAuditRecordDO recordDO) {
|
||||
tpAuditRecordMapper.updateByPrimaryKeySelective(recordDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批记录
|
||||
* @param applyId 申请单id
|
||||
* @return 审批记录列表
|
||||
*/
|
||||
public List<AuditInfoResponse> getAuditRecordList(Long applyId) {
|
||||
Example example = new Example(TpAuditRecordDO.class);
|
||||
example.createCriteria()
|
||||
.andEqualTo("applyId", applyId)
|
||||
.andEqualTo("deleted", 0);
|
||||
example.setOrderByClause("createTime ASC");
|
||||
List<TpAuditRecordDO> recordList = tpAuditRecordMapper.selectByExample(example);
|
||||
List<AuditInfoResponse> result = new ArrayList<>();
|
||||
for (TpAuditRecordDO auditRecordDO : recordList) {
|
||||
AuditInfoResponse response = AuditInfoResponse.builder()
|
||||
.type(getAuditInfoType(auditRecordDO))
|
||||
.execute(auditRecordDO.getRecordType() - 1)
|
||||
.status(CommonConstants.INDEX_ZERO.equals(auditRecordDO.getAuditStatus()) ? 0 : 1)
|
||||
.createTime(auditRecordDO.getReceiveTaskTime())
|
||||
.remark(auditRecordDO.getRemark())
|
||||
.actualUserId(auditRecordDO.getHandlerUserId())
|
||||
.build();
|
||||
List<AuditInfoResponse.AuditUserInfoVO> auditUserList = Collections.singletonList(
|
||||
new AuditInfoResponse.AuditUserInfoVO(auditRecordDO.getHandlerUserId(), auditRecordDO.getHandlerUserName(), null)
|
||||
);
|
||||
response.setList(auditUserList);
|
||||
result.add(response);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Integer getAuditInfoType(TpAuditRecordDO auditRecordDO) {
|
||||
if (CommonConstants.INDEX_ONE.equals(auditRecordDO.getRecordType())) {
|
||||
return OperationLogAuditEnum.SUBMIT_AUDIT.getCode();
|
||||
} else {
|
||||
switch (auditRecordDO.getAuditStatus()) {
|
||||
case 0:
|
||||
return OperationLogAuditEnum.WAIT_AUDIT.getCode();
|
||||
case 1:
|
||||
return OperationLogAuditEnum.PASS.getCode();
|
||||
case 2:
|
||||
return OperationLogAuditEnum.REFUSE.getCode();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据申请单id删除
|
||||
*/
|
||||
public void deleteByApplyIds(List<Long> applyIds) {
|
||||
if (CollectionUtils.isEmpty(applyIds)) {
|
||||
return;
|
||||
}
|
||||
Example example = new Example(TpAuditRecordDO.class);
|
||||
example.createCriteria().andIn("applyId", applyIds).andEqualTo("deleted", 0);
|
||||
tpAuditRecordMapper.updateByExampleSelective(TpAuditRecordDO.builder().deleted(1).build(), example);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +61,11 @@
|
||||
<if test="ruleId != null and ruleId != ''">
|
||||
AND a.rule_id = #{ruleId}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND a.status = #{status}
|
||||
<if test="statusList != null and !statusList.isEmpty()">
|
||||
AND a.status IN
|
||||
<foreach collection="statusList" item="status" separator="," open="(" close=")">
|
||||
#{status}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="type != null">
|
||||
AND a.type = #{type}
|
||||
@@ -83,6 +86,9 @@
|
||||
<if test="appealReason != null and appealReason != ''">
|
||||
AND b.appeal_reason LIKE CONCAT('%', #{appealReason}, '%')
|
||||
</if>
|
||||
<if test="isDraft != null">
|
||||
AND b.is_draft = #{isDraft}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user