fix:问题修复
This commit is contained in:
@@ -184,4 +184,9 @@ public class CoolDateUtils {
|
||||
Duration duration = Duration.between(start, end);
|
||||
return duration.toMinutes();
|
||||
}
|
||||
|
||||
public static Date localDate2Date(LocalDate localDate) {
|
||||
ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
|
||||
return Date.from(zonedDateTime.toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class StoreDao {
|
||||
* @return 门店id->门店
|
||||
*/
|
||||
public Map<String, StoreDO> getStoreMapByStoreIds(List<String> storeIds) {
|
||||
if (CollectionUtils.isNotEmpty(storeIds)) {
|
||||
if (CollectionUtils.isEmpty(storeIds)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
List<StoreDO> storeList = storeMapper.getStoreByStoreIds(storeIds);
|
||||
|
||||
@@ -101,8 +101,9 @@ public class TpApplyFormDAO {
|
||||
example.createCriteria()
|
||||
.andEqualTo("storeId", storeId)
|
||||
.andEqualTo("ruleId", ruleId)
|
||||
.andIn("status", Arrays.asList(TpFormStatusEnum.PASS.getStatus(), TpFormStatusEnum.EFFECTIVE.getStatus()))
|
||||
.andNotEqualTo("type", TpFormTypeEnum.REWARD.getType());
|
||||
.andNotEqualTo("status", TpFormStatusEnum.CANCEL.getStatus())
|
||||
.andIn("type", Arrays.asList(TpFormTypeEnum.WARNING.getType(), TpFormTypeEnum.PENALTY.getType()))
|
||||
.andEqualTo("deleted", 0);
|
||||
return tpApplyFormMapper.selectCountByExample(example);
|
||||
}
|
||||
|
||||
@@ -118,7 +119,9 @@ public class TpApplyFormDAO {
|
||||
Example.Criteria criteria = example.createCriteria()
|
||||
.andEqualTo("storeId", storeId)
|
||||
.andEqualTo("ruleId", ruleId)
|
||||
.andEqualTo("status", TpFormStatusEnum.PENDING.getStatus());
|
||||
.andEqualTo("status", TpFormStatusEnum.PENDING.getStatus())
|
||||
.andEqualTo("isDraft", 0)
|
||||
.andEqualTo("deleted", 0);
|
||||
if (isReward) {
|
||||
criteria.andEqualTo("type", TpFormTypeEnum.REWARD.getType());
|
||||
} else {
|
||||
|
||||
@@ -77,9 +77,12 @@ public class TpAuditRecordDAO {
|
||||
* @param userId 申请人id
|
||||
* @param userName 申请人名称
|
||||
*/
|
||||
public void addRecord(Long applyId, Integer applyType, String userId, String userName) {
|
||||
addSubmitRecord(applyId, applyType, userId, userName);
|
||||
addApproveRecord(applyId, applyType);
|
||||
public void firstAddRecord(Long applyId, Integer applyType, String userId, String userName) {
|
||||
TpAuditRecordDO auditRecordDO = getPendingRecordByApplyId(applyId, applyType);
|
||||
if (Objects.isNull(auditRecordDO)) {
|
||||
addSubmitRecord(applyId, applyType, userId, userName);
|
||||
addApproveRecord(applyId, applyType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
INNER JOIN store_${enterpriseId} b ON a.store_id = b.store_id AND b.is_delete = 'effective'
|
||||
</if>
|
||||
<where>
|
||||
deleted = 0
|
||||
<if test="applyNo != null and applyNo != ''">
|
||||
AND a.apply_no LIKE CONCAT('%', #{applyNo}, '%')
|
||||
</if>
|
||||
@@ -90,6 +91,7 @@
|
||||
AND b.is_draft = #{isDraft}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -103,7 +103,7 @@ public class TpApplyFormDO {
|
||||
* 申请复议截止日期
|
||||
*/
|
||||
@Column(name = "appeal_end_date")
|
||||
private LocalDate appealEndDate;
|
||||
private Date appealEndDate;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
|
||||
@@ -58,7 +58,7 @@ public class TpApplyQueryRequest extends PageBasicInfo {
|
||||
private Integer isDraft;
|
||||
|
||||
public List<String> getStatusList() {
|
||||
if (StringUtils.isNotBlank(this.status)) {
|
||||
if (StringUtils.isBlank(this.status)) {
|
||||
return null;
|
||||
}
|
||||
return Arrays.stream(this.status.split(CommonConstants.COMMA))
|
||||
|
||||
@@ -6,7 +6,7 @@ import lombok.Data;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -56,5 +56,5 @@ public class TpApplyRequest {
|
||||
private BigDecimal amount;
|
||||
|
||||
@ApiModelProperty("申请复议截止日期,yyyy-MM-dd")
|
||||
private LocalDate appealEndDate;
|
||||
private Date appealEndDate;
|
||||
}
|
||||
|
||||
@@ -76,6 +76,9 @@ public class TpApplyListBaseVO {
|
||||
@ApiModelProperty("审核时间")
|
||||
private Date approveTime;
|
||||
|
||||
@ApiModelProperty("是否为草稿 0否 1是")
|
||||
private Integer isDraft;
|
||||
|
||||
public String getStatusName() {
|
||||
return TpFormStatusEnum.getMsgByStatus(this.status);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -59,7 +59,7 @@ public class TpPenaltyApplyDetailVO {
|
||||
private BigDecimal amount;
|
||||
|
||||
@ApiModelProperty("申请复议截止日期")
|
||||
private LocalDate appealEndDate;
|
||||
private Date appealEndDate;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -29,7 +29,7 @@ public class TpPenaltyApplyListVO extends TpApplyListBaseVO {
|
||||
private BigDecimal amount;
|
||||
|
||||
@ApiModelProperty("申请复议截止日期")
|
||||
private LocalDate appealEndDate;
|
||||
private Date appealEndDate;
|
||||
|
||||
@ApiModelProperty("缴费状态")
|
||||
private Integer payStatus;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MiniTpPenaltyApplyVO {
|
||||
private BigDecimal score;
|
||||
|
||||
@ApiModelProperty("复议截止日期")
|
||||
private LocalDate appealEndDate;
|
||||
private Date appealEndDate;
|
||||
|
||||
@ApiModelProperty("证明图片列表")
|
||||
private String proofUrls;
|
||||
|
||||
@@ -134,7 +134,16 @@ public class DictService {
|
||||
}
|
||||
|
||||
private Field[] getFieldCache(Class<?> clazz) {
|
||||
return fieldCache.computeIfAbsent(clazz, Class::getDeclaredFields);
|
||||
return fieldCache.computeIfAbsent(clazz, this::getAllFields);
|
||||
}
|
||||
|
||||
private Field[] getAllFields(Class<?> clazz) {
|
||||
List<Field> fields = new ArrayList<>();
|
||||
while (clazz != null && !clazz.equals(Object.class)) {
|
||||
Collections.addAll(fields, clazz.getDeclaredFields());
|
||||
clazz = clazz.getSuperclass();
|
||||
}
|
||||
return fields.toArray(new Field[0]);
|
||||
}
|
||||
|
||||
private <T> List<Pair<Field, Field>> getDictField(Class<T> clazz) {
|
||||
@@ -142,7 +151,7 @@ public class DictService {
|
||||
}
|
||||
|
||||
private <T> List<Pair<Field, Field>> computeDictFields(Class<T> clazz) {
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
Field[] fields = getFieldCache(clazz);
|
||||
Map<String, Field> fieldMap = CollStreamUtil.toMap(Arrays.asList(fields), Field::getName, v -> v);
|
||||
List<Pair<Field, Field>> dictFields = new ArrayList<>();
|
||||
for (Field field : fields) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.cool.store.response.AuditInfoResponse;
|
||||
import com.cool.store.service.dict.impl.DictService;
|
||||
import com.cool.store.service.tp.TpApplyService;
|
||||
import com.cool.store.utils.BeanUtil;
|
||||
import com.cool.store.utils.CoolDateUtils;
|
||||
import com.cool.store.utils.TpHelper;
|
||||
import com.cool.store.vo.tp.*;
|
||||
import com.cool.store.vo.tp.mini.*;
|
||||
@@ -75,8 +76,7 @@ public class TpApplyServiceImpl implements TpApplyService {
|
||||
throw new ServiceException(ErrorCodeEnum.TP_SCORE_EQUAL_TWELVE);
|
||||
}
|
||||
TpApplyFormDO formDO = BeanUtil.toBean(request, TpApplyFormDO.class);
|
||||
boolean isInsert = Objects.isNull(request.getId());
|
||||
if (isInsert) {
|
||||
if (Objects.isNull(request.getId())) {
|
||||
formDO.setApplyNo(TpHelper.generateApplyNo(TpFormTypeEnum.REWARD.getType()));
|
||||
formDO.setType(TpFormTypeEnum.REWARD.getType());
|
||||
formDO.setPayStatus(TpPayStatusEnum.NO_NEED_PAY.getStatus());
|
||||
@@ -84,8 +84,8 @@ public class TpApplyServiceImpl implements TpApplyService {
|
||||
fillRuleFields(formDO);
|
||||
tpApplyFormDAO.insertOrUpdate(formDO);
|
||||
// 第一次提交后添加审批记录
|
||||
if (isInsert && !isDraft) {
|
||||
tpAuditRecordDAO.addRecord(formDO.getId(), TpFormTypeEnum.REWARD.getType(), request.getApplyUserId(), request.getApplyUserName());
|
||||
if (!isDraft) {
|
||||
tpAuditRecordDAO.firstAddRecord(formDO.getId(), formDO.getType(), request.getApplyUserId(), request.getApplyUserName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -126,12 +126,13 @@ public class TpApplyServiceImpl implements TpApplyService {
|
||||
throw new ServiceException(ErrorCodeEnum.TP_EXISTS_PENDING_APPLY);
|
||||
}
|
||||
boolean isInsert = Objects.isNull(request.getId());
|
||||
formDO.setType(isInsert ? TpFormTypeEnum.PENALTY.getType() : null);
|
||||
formDO.setApplyNo(isInsert ? TpHelper.generateApplyNo(formDO.getType()) : null);
|
||||
fillRuleFields(formDO);
|
||||
tpApplyFormDAO.insertOrUpdate(formDO);
|
||||
// 第一次提交后添加审批记录
|
||||
if (isInsert && !isDraft) {
|
||||
tpAuditRecordDAO.addRecord(formDO.getId(), TpFormTypeEnum.PENALTY.getType(), request.getApplyUserId(), request.getApplyUserName());
|
||||
if (!isDraft) {
|
||||
tpAuditRecordDAO.firstAddRecord(formDO.getId(), formDO.getType(), request.getApplyUserId(), request.getApplyUserName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -225,8 +226,8 @@ public class TpApplyServiceImpl implements TpApplyService {
|
||||
fillRuleFields(formDO);
|
||||
tpApplyFormDAO.insertOrUpdate(formDO);
|
||||
// 第一次提交后添加审批记录
|
||||
if (isInsert && !isDraft) {
|
||||
tpAuditRecordDAO.addRecord(formDO.getId(), TpFormTypeEnum.APPEAL.getType(), request.getApplyUserId(), request.getApplyUserName());
|
||||
if (!isDraft) {
|
||||
tpAuditRecordDAO.firstAddRecord(formDO.getId(), formDO.getType(), request.getApplyUserId(), request.getApplyUserName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -452,11 +453,16 @@ public class TpApplyServiceImpl implements TpApplyService {
|
||||
// 扣分
|
||||
if (CommonConstants.INDEX_ZERO.equals(ruleDO.getType())) {
|
||||
if (Objects.isNull(formDO.getAppealEndDate())) {
|
||||
formDO.setAppealEndDate(LocalDate.now().plusDays(ruleDO.getAppealDeadline()));
|
||||
formDO.setAppealEndDate(CoolDateUtils.localDate2Date(LocalDate.now().plusDays(ruleDO.getAppealDeadline())));
|
||||
}
|
||||
// 超过警告次数的为处罚单,否则警告单
|
||||
int penaltyCount = tpApplyFormDAO.getPenaltyCount(formDO.getStoreId(), formDO.getRuleId());
|
||||
formDO.setType(ruleDO.getWarningLimit().compareTo(penaltyCount) <= 0 ? TpFormTypeEnum.PENALTY.getType() : TpFormTypeEnum.WARNING.getType());
|
||||
Integer type = ruleDO.getWarningLimit().compareTo(penaltyCount) <= 0 ? TpFormTypeEnum.PENALTY.getType() : TpFormTypeEnum.WARNING.getType();
|
||||
formDO.setType(type);
|
||||
if (TpFormTypeEnum.WARNING.getType().equals(type)) {
|
||||
formDO.setAmount(null);
|
||||
formDO.setScore(null);
|
||||
}
|
||||
// 是否缴费
|
||||
formDO.setPayStatus(Objects.nonNull(ruleDO.getAmount()) && BigDecimal.ZERO.compareTo(ruleDO.getAmount()) < 0 ? TpPayStatusEnum.UNPAID.getStatus() : TpPayStatusEnum.NO_NEED_PAY.getStatus());
|
||||
}
|
||||
@@ -466,7 +472,7 @@ public class TpApplyServiceImpl implements TpApplyService {
|
||||
* 填充列表相关字段
|
||||
*/
|
||||
private void fillListFields(List<? extends TpApplyListBaseVO> list) {
|
||||
if (CollectionUtils.isNotEmpty(list)) return;
|
||||
if (CollectionUtils.isEmpty(list)) return;
|
||||
dictService.fillDictField(list);
|
||||
Set<String> storeIds = CollStreamUtil.toSet(list, TpApplyListBaseVO::getStoreId);
|
||||
Set<String> approveUserIds = CollStreamUtil.toSet(list, TpApplyListBaseVO::getApproveUserId);
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.List;
|
||||
* @author wangff
|
||||
* @since 2025/11/10
|
||||
*/
|
||||
@Api(tags = "十二分制-申请单")
|
||||
@Api(tags = "Mini十二分制-申请单")
|
||||
@RestController
|
||||
@RequestMapping("/mini/tp/apply")
|
||||
@RequiredArgsConstructor
|
||||
|
||||
Reference in New Issue
Block a user