feat:十二分制-奖惩规则
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.cool.store.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 字典表填充字段
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface DictField {
|
||||
String sourceField() default "";
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.cool.store.utils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 十二分制 辅助工具类
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
public class TpHelper {
|
||||
private final static DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyMMddHHmmssSSS");
|
||||
|
||||
/**
|
||||
* 生成惩处单号
|
||||
*/
|
||||
public static String generatePenaltyRuleCode() {
|
||||
return "CC" + generateCode();
|
||||
}
|
||||
/**
|
||||
* 生成加分单号
|
||||
*/
|
||||
public static String generateRewardRuleCode() {
|
||||
return "JF" + generateCode();
|
||||
}
|
||||
|
||||
private static String generateCode() {
|
||||
return LocalDateTime.now().format(dtf) + (int) (Math.random() * 900) + 100;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -128,6 +128,19 @@ public class SysDictColumnDAO {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典列编码查询已启用字典项名称映射
|
||||
* @param columnCodes 字典列编码列表
|
||||
* @return <字典列编码, 字典项名称>
|
||||
*/
|
||||
public Map<String, String> getNameMapByCodes(List<String> columnCodes) {
|
||||
if (CollectionUtils.isEmpty(columnCodes)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
List<SysDictColumnDO> list = sysDictColumnMapper.selectOpenColumnByCodes(columnCodes);
|
||||
return CollStreamUtil.toMap(list, SysDictColumnDO::getColumnCode, SysDictColumnDO::getColumnName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典表编码查询启用状态的字典项
|
||||
* @param tableCodes 字典表编码列表
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.cool.store.dao.tp;
|
||||
|
||||
import com.cool.store.entity.tp.TpRuleDO;
|
||||
import com.cool.store.mapper.tp.TpRuleMapper;
|
||||
import com.cool.store.request.tp.TpRuleQueryRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 十二分制-奖惩规则DAO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class TpRuleDAO {
|
||||
private final TpRuleMapper tpRuleMapper;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public boolean insertSelective(TpRuleDO tpRuleDO) {
|
||||
return tpRuleMapper.insertSelective(tpRuleDO) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public boolean updateSelective(TpRuleDO tpRuleDO) {
|
||||
return tpRuleMapper.updateByPrimaryKeySelective(tpRuleDO) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public boolean deleteByIds(List<Long> ids) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return false;
|
||||
}
|
||||
Example example = new Example(TpRuleDO.class);
|
||||
example.createCriteria().andIn("id", ids);
|
||||
return tpRuleMapper.updateByExampleSelective(TpRuleDO.builder().deleted(1).build(), example) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*/
|
||||
public TpRuleDO getById(Long id) {
|
||||
return tpRuleMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public List<TpRuleDO> getList(TpRuleQueryRequest request) {
|
||||
Example example = new Example(TpRuleDO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
if (StringUtils.isNotBlank(request.getProblemClassification())) {
|
||||
criteria.andEqualTo("problemClassification", request.getProblemClassification());
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getProjectCategory())) {
|
||||
criteria.andEqualTo("projectCategory", request.getProjectCategory());
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getProjectName())) {
|
||||
criteria.andLike("projectName", request.getProjectName());
|
||||
}
|
||||
if (Objects.nonNull(request.getStatus())) {
|
||||
criteria.andEqualTo("status", request.getStatus());
|
||||
}
|
||||
example.setOrderByClause("create_time DESC");
|
||||
return tpRuleMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改启用状态
|
||||
* @param ids id列表
|
||||
* @param status 启用状态
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean updateStatus(List<Long> ids, Integer status) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return false;
|
||||
}
|
||||
Example example = new Example(TpRuleDO.class);
|
||||
example.createCriteria()
|
||||
.andIn("id", ids);
|
||||
return tpRuleMapper.updateByExampleSelective(TpRuleDO.builder().status(status).build(), example) > 0;
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,13 @@ public interface SysDictColumnMapper {
|
||||
*/
|
||||
SysDictColumnDO selectOpenColumnByCode(@Param("columnCode") String columnCode);
|
||||
|
||||
/**
|
||||
* 根据字典项编码查询字典项映射
|
||||
* @param columnCodes 字典项编码列表
|
||||
* @return 字典项列表
|
||||
*/
|
||||
List<SysDictColumnDO> selectOpenColumnByCodes(@Param("columnCodes") List<String> columnCodes);
|
||||
|
||||
/**
|
||||
* 根据字典表id查询
|
||||
* @param tableIds 字典表id列表
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.cool.store.mapper.tp;
|
||||
|
||||
import com.cool.store.entity.tp.TpAppealFormDO;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface TpAppealFormMapper extends Mapper<TpAppealFormDO> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.cool.store.mapper.tp;
|
||||
|
||||
import com.cool.store.entity.tp.TpApplyFormDO;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface TpApplyFormMapper extends Mapper<TpApplyFormDO> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.cool.store.mapper.tp;
|
||||
|
||||
import com.cool.store.entity.tp.TpAuditRecordDO;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface TpAuditRecordMapper extends Mapper<TpAuditRecordDO> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.cool.store.mapper.tp;
|
||||
|
||||
import com.cool.store.entity.tp.TpRuleDO;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface TpRuleMapper extends Mapper<TpRuleDO> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.cool.store.mapper.tp;
|
||||
|
||||
import com.cool.store.entity.tp.TpScoreJournalDO;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface TpScoreJournalMapper extends Mapper<TpScoreJournalDO> {
|
||||
}
|
||||
@@ -247,6 +247,16 @@
|
||||
WHERE column_code = #{columnCode} AND deleted = 0 AND open_status = 1 LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="selectOpenColumnByCodes" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
FROM sys_dict_column_${enterpriseId}
|
||||
WHERE column_code IN
|
||||
<foreach collection="columnCodes" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND deleted = 0 AND open_status = 1
|
||||
</select>
|
||||
|
||||
<select id="selectOpenColumnListByTableIds" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
FROM sys_dict_column_${enterpriseId}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cool.store.mapper.tp.TpAppealFormMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.tp.TpAppealFormDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="apply_no" jdbcType="VARCHAR" property="applyNo" />
|
||||
<result column="punish_id" jdbcType="BIGINT" property="punishId" />
|
||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||
<result column="applicant_name" jdbcType="VARCHAR" property="applicantName" />
|
||||
<result column="phone" jdbcType="VARCHAR" property="phone" />
|
||||
<result column="appeal_reason" jdbcType="VARCHAR" property="appealReason" />
|
||||
<result column="detail_reason" jdbcType="VARCHAR" property="detailReason" />
|
||||
<result column="status" jdbcType="BIT" property="status" />
|
||||
<result column="source" jdbcType="BIT" property="source" />
|
||||
<result column="approve_user_id" jdbcType="VARCHAR" property="approveUserId" />
|
||||
<result column="approve_time" jdbcType="TIMESTAMP" property="approveTime" />
|
||||
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||
<result column="proof_urls" jdbcType="LONGVARCHAR" property="proofUrls" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cool.store.mapper.tp.TpApplyFormMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.tp.TpApplyFormDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="type" jdbcType="BIT" property="type" />
|
||||
<result column="apply_no" jdbcType="VARCHAR" property="applyNo" />
|
||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||
<result column="project_category" jdbcType="VARCHAR" property="projectCategory" />
|
||||
<result column="rule_id" jdbcType="BIGINT" property="ruleId" />
|
||||
<result column="is_full" jdbcType="BIT" property="isFull" />
|
||||
<result column="point" jdbcType="DECIMAL" property="point" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="amount" jdbcType="DECIMAL" property="amount" />
|
||||
<result column="appeal_end_date" jdbcType="DATE" property="appealEndDate" />
|
||||
<result column="status" jdbcType="BIT" property="status" />
|
||||
<result column="pay_status" jdbcType="BIT" property="payStatus" />
|
||||
<result column="is_draft" jdbcType="BIT" property="isDraft" />
|
||||
<result column="apply_user_id" jdbcType="VARCHAR" property="applyUserId" />
|
||||
<result column="approve_user_id" jdbcType="VARCHAR" property="approveUserId" />
|
||||
<result column="approve_time" jdbcType="TIMESTAMP" property="approveTime" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||
<result column="proof_urls" jdbcType="LONGVARCHAR" property="proofUrls" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cool.store.mapper.tp.TpAuditRecordMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.tp.TpAuditRecordDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="apply_type" jdbcType="BIT" property="applyType" />
|
||||
<result column="apply_id" jdbcType="BIGINT" property="applyId" />
|
||||
<result column="record_type" jdbcType="BIT" property="recordType" />
|
||||
<result column="audit_status" jdbcType="BIT" property="auditStatus" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="handler_user_id" jdbcType="VARCHAR" property="handlerUserId" />
|
||||
<result column="receive_task_time" jdbcType="TIMESTAMP" property="receiveTaskTime" />
|
||||
<result column="finish_task_time" jdbcType="TIMESTAMP" property="finishTaskTime" />
|
||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cool.store.mapper.tp.TpRuleMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.tp.TpRuleDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="rule_code" jdbcType="VARCHAR" property="ruleCode" />
|
||||
<result column="type" jdbcType="BIT" property="type" />
|
||||
<result column="problem_classification" jdbcType="VARCHAR" property="problemClassification" />
|
||||
<result column="project_category" jdbcType="VARCHAR" property="projectCategory" />
|
||||
<result column="project_name" jdbcType="VARCHAR" property="projectName" />
|
||||
<result column="warning_limit" jdbcType="INTEGER" property="warningLimit" />
|
||||
<result column="point" jdbcType="DECIMAL" property="point" />
|
||||
<result column="amount" jdbcType="DECIMAL" property="amount" />
|
||||
<result column="review_deadline" jdbcType="INTEGER" property="reviewDeadline" />
|
||||
<result column="status" jdbcType="BIT" property="status" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="is_full" jdbcType="BIT" property="isFull" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cool.store.mapper.tp.TpScoreJournalMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.tp.TpScoreJournalDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="journal_no" jdbcType="VARCHAR" property="journalNo" />
|
||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||
<result column="store_num" jdbcType="VARCHAR" property="storeNum" />
|
||||
<result column="join_brand" jdbcType="BIT" property="joinBrand" />
|
||||
<result column="join_model" jdbcType="BIT" property="joinModel" />
|
||||
<result column="store_type" jdbcType="BIT" property="storeType" />
|
||||
<result column="store_name" jdbcType="VARCHAR" property="storeName" />
|
||||
<result column="occur_score" jdbcType="DECIMAL" property="occurScore" />
|
||||
<result column="occur_date" jdbcType="DATE" property="occurDate" />
|
||||
<result column="occur_before_score" jdbcType="DECIMAL" property="occurBeforeScore" />
|
||||
<result column="occur_after_score" jdbcType="DECIMAL" property="occurAfterScore" />
|
||||
<result column="apply_type" jdbcType="BIT" property="applyType" />
|
||||
<result column="apply_no" jdbcType="VARCHAR" property="applyNo" />
|
||||
<result column="project_category" jdbcType="VARCHAR" property="projectCategory" />
|
||||
<result column="project_name" jdbcType="VARCHAR" property="projectName" />
|
||||
<result column="rule_id" jdbcType="BIGINT" property="ruleId" />
|
||||
<result column="rule_no" jdbcType="VARCHAR" property="ruleNo" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.cool.store.entity.tp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 十二分制-复议申请单
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Table(name = "zxjp_tp_appeal_form")
|
||||
@Data
|
||||
public class TpAppealFormDO {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请单号
|
||||
*/
|
||||
@Column(name = "apply_no")
|
||||
private String applyNo;
|
||||
|
||||
/**
|
||||
* 处罚单id
|
||||
*/
|
||||
@Column(name = "punish_id")
|
||||
private Long punishId;
|
||||
|
||||
/**
|
||||
* 门店id
|
||||
*/
|
||||
@Column(name = "store_id")
|
||||
private String storeId;
|
||||
|
||||
/**
|
||||
* 申请人姓名
|
||||
*/
|
||||
@Column(name = "applicant_name")
|
||||
private String applicantName;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 复议理由
|
||||
*/
|
||||
@Column(name = "appeal_reason")
|
||||
private String appealReason;
|
||||
|
||||
/**
|
||||
* 详细理由
|
||||
*/
|
||||
@Column(name = "detail_reason")
|
||||
private String detailReason;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 来源,0crm 1小程序
|
||||
*/
|
||||
private Integer source;
|
||||
|
||||
/**
|
||||
* 审批人id
|
||||
*/
|
||||
@Column(name = "approve_user_id")
|
||||
private String approveUserId;
|
||||
|
||||
/**
|
||||
* 审批时间
|
||||
*/
|
||||
@Column(name = "approve_time")
|
||||
private Date approveTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@Column(name = "create_user_id")
|
||||
private String createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除 0否1是
|
||||
*/
|
||||
private Integer deleted;
|
||||
|
||||
/**
|
||||
* 证明图片列表
|
||||
*/
|
||||
@Column(name = "proof_urls")
|
||||
private String proofUrls;
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.cool.store.entity.tp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 十二分制-申请单
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Table(name = "zxjp_tp_apply_form")
|
||||
@Data
|
||||
public class TpApplyFormDO {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 单据类型,0加分单 1警告书 2处罚书
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 申请单号
|
||||
*/
|
||||
@Column(name = "apply_no")
|
||||
private String applyNo;
|
||||
|
||||
/**
|
||||
* 门店id
|
||||
*/
|
||||
@Column(name = "store_id")
|
||||
private String storeId;
|
||||
|
||||
/**
|
||||
* 项目大类
|
||||
*/
|
||||
@Column(name = "project_category")
|
||||
private String projectCategory;
|
||||
|
||||
/**
|
||||
* 规则id(项目类型)
|
||||
*/
|
||||
@Column(name = "rule_id")
|
||||
private Long ruleId;
|
||||
|
||||
/**
|
||||
* 是否加满
|
||||
*/
|
||||
@Column(name = "is_full")
|
||||
private Integer isFull;
|
||||
|
||||
/**
|
||||
* 分值
|
||||
*/
|
||||
private BigDecimal point;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 罚款金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 申请复议截止日期
|
||||
*/
|
||||
@Column(name = "appeal_end_date")
|
||||
private Date appealEndDate;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 缴费状态,0未缴费 1无需缴费 2已缴费
|
||||
*/
|
||||
@Column(name = "pay_status")
|
||||
private Integer payStatus;
|
||||
|
||||
/**
|
||||
* 是否为草稿 0否 1是
|
||||
*/
|
||||
@Column(name = "is_draft")
|
||||
private Integer isDraft;
|
||||
|
||||
/**
|
||||
* 申请人id
|
||||
*/
|
||||
@Column(name = "apply_user_id")
|
||||
private String applyUserId;
|
||||
|
||||
/**
|
||||
* 审批人id
|
||||
*/
|
||||
@Column(name = "approve_user_id")
|
||||
private String approveUserId;
|
||||
|
||||
/**
|
||||
* 审批时间
|
||||
*/
|
||||
@Column(name = "approve_time")
|
||||
private Date approveTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除 0否1是
|
||||
*/
|
||||
private Integer deleted;
|
||||
|
||||
/**
|
||||
* 证明图片列表
|
||||
*/
|
||||
@Column(name = "proof_urls")
|
||||
private String proofUrls;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.cool.store.entity.tp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 十二分制-审批记录
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Table(name = "zxjp_tp_audit_record")
|
||||
@Data
|
||||
public class TpAuditRecordDO {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 表单类型,0加分申请 1复议申请
|
||||
*/
|
||||
@Column(name = "apply_type")
|
||||
private Integer applyType;
|
||||
|
||||
/**
|
||||
* 申请单id
|
||||
*/
|
||||
@Column(name = "apply_id")
|
||||
private Long applyId;
|
||||
|
||||
/**
|
||||
* 记录类型,1申请提交 2审批操作
|
||||
*/
|
||||
@Column(name = "record_type")
|
||||
private Integer recordType;
|
||||
|
||||
/**
|
||||
* 审批状态,0待处理 1通过 2拒绝
|
||||
*/
|
||||
@Column(name = "audit_status")
|
||||
private Integer auditStatus;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 处理人
|
||||
*/
|
||||
@Column(name = "handler_user_id")
|
||||
private String handlerUserId;
|
||||
|
||||
/**
|
||||
* 收到任务时间
|
||||
*/
|
||||
@Column(name = "receive_task_time")
|
||||
private Date receiveTaskTime;
|
||||
|
||||
/**
|
||||
* 完成任务时间
|
||||
*/
|
||||
@Column(name = "finish_task_time")
|
||||
private Date finishTaskTime;
|
||||
|
||||
/**
|
||||
* 是否删除,0否1是
|
||||
*/
|
||||
private Integer deleted;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.cool.store.entity.tp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 十二分制-奖惩规则
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Table(name = "zxjp_tp_rule")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class TpRuleDO {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 规则编码
|
||||
*/
|
||||
@Column(name = "rule_code")
|
||||
private String ruleCode;
|
||||
|
||||
/**
|
||||
* 规则类型,0扣分 1加分
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 问题分类
|
||||
*/
|
||||
@Column(name = "problem_classification")
|
||||
private String problemClassification;
|
||||
|
||||
/**
|
||||
* 项目大类
|
||||
*/
|
||||
@Column(name = "project_category")
|
||||
private String projectCategory;
|
||||
|
||||
/**
|
||||
* 惩处项目名称
|
||||
*/
|
||||
@Column(name = "project_name")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 警告上限次数
|
||||
*/
|
||||
@Column(name = "warning_limit")
|
||||
private Integer warningLimit;
|
||||
|
||||
/**
|
||||
* 分值
|
||||
*/
|
||||
private BigDecimal point;
|
||||
|
||||
/**
|
||||
* 罚款金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 复议申请时效
|
||||
*/
|
||||
@Column(name = "review_deadline")
|
||||
private Integer reviewDeadline;
|
||||
|
||||
/**
|
||||
* 启用状态,0未启用 1启用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 项目描述
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否加满
|
||||
*/
|
||||
@Column(name = "is_full")
|
||||
private Integer isFull;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除 0否1是
|
||||
*/
|
||||
private Integer deleted;
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.cool.store.entity.tp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 十二分制-积分流水
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Table(name = "zxjp_tp_score_journal")
|
||||
@Data
|
||||
public class TpScoreJournalDO {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 流水号
|
||||
*/
|
||||
@Column(name = "journal_no")
|
||||
private String journalNo;
|
||||
|
||||
/**
|
||||
* 门店id
|
||||
*/
|
||||
@Column(name = "store_id")
|
||||
private String storeId;
|
||||
|
||||
/**
|
||||
* 门店编码
|
||||
*/
|
||||
@Column(name = "store_num")
|
||||
private String storeNum;
|
||||
|
||||
/**
|
||||
* 加盟品牌
|
||||
*/
|
||||
@Column(name = "join_brand")
|
||||
private Integer joinBrand;
|
||||
|
||||
/**
|
||||
* 加盟模式
|
||||
*/
|
||||
@Column(name = "join_model")
|
||||
private Integer joinModel;
|
||||
|
||||
/**
|
||||
* 门店类型
|
||||
*/
|
||||
@Column(name = "store_type")
|
||||
private Integer storeType;
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
@Column(name = "store_name")
|
||||
private String storeName;
|
||||
|
||||
/**
|
||||
* 发生分值
|
||||
*/
|
||||
@Column(name = "occur_score")
|
||||
private BigDecimal occurScore;
|
||||
|
||||
/**
|
||||
* 发生日期
|
||||
*/
|
||||
@Column(name = "occur_date")
|
||||
private Date occurDate;
|
||||
|
||||
/**
|
||||
* 发生前分值
|
||||
*/
|
||||
@Column(name = "occur_before_score")
|
||||
private BigDecimal occurBeforeScore;
|
||||
|
||||
/**
|
||||
* 发生后分值
|
||||
*/
|
||||
@Column(name = "occur_after_score")
|
||||
private BigDecimal occurAfterScore;
|
||||
|
||||
/**
|
||||
* 单据来源,0加分申请单 2惩处申请单
|
||||
*/
|
||||
@Column(name = "apply_type")
|
||||
private Integer applyType;
|
||||
|
||||
/**
|
||||
* 来源单号
|
||||
*/
|
||||
@Column(name = "apply_no")
|
||||
private String applyNo;
|
||||
|
||||
/**
|
||||
* 项目大类
|
||||
*/
|
||||
@Column(name = "project_category")
|
||||
private String projectCategory;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@Column(name = "project_name")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 规则id
|
||||
*/
|
||||
@Column(name = "rule_id")
|
||||
private Long ruleId;
|
||||
|
||||
/**
|
||||
* 规则编码
|
||||
*/
|
||||
@Column(name = "rule_no")
|
||||
private String ruleNo;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.cool.store.request.tp;
|
||||
|
||||
import com.cool.store.common.InsertGroup;
|
||||
import com.cool.store.common.UpdateGroup;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 惩处规则更新Request
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Data
|
||||
public class TpPenaltyRuleUpdateRequest {
|
||||
|
||||
@ApiModelProperty("id")
|
||||
@NotNull(message = "id不能为空", groups = {UpdateGroup.class})
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("问题分类")
|
||||
@NotBlank(message = "问题分类不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private String problemClassification;
|
||||
|
||||
@ApiModelProperty("项目大类")
|
||||
@NotBlank(message = "项目大类不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private String projectCategory;
|
||||
|
||||
@ApiModelProperty("惩处项目名称")
|
||||
@NotBlank(message = "惩处项目名称不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("警告上限次数")
|
||||
@NotNull(message = "警告上限次数不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private Integer warningLimit;
|
||||
|
||||
@ApiModelProperty("扣分值")
|
||||
@NotNull(message = "扣分值不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private BigDecimal point;
|
||||
|
||||
@ApiModelProperty("罚款金额")
|
||||
@NotNull(message = "罚款金额不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private BigDecimal amount;
|
||||
|
||||
@ApiModelProperty("复议申请时效")
|
||||
@NotNull(message = "复议申请时效不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private Integer reviewDeadline;
|
||||
|
||||
@ApiModelProperty("启用状态,0未启用 1启用")
|
||||
@NotNull(message = "启用状态不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("惩处项目描述")
|
||||
@NotBlank(message = "惩处项目描述不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.cool.store.request.tp;
|
||||
|
||||
import com.cool.store.common.InsertGroup;
|
||||
import com.cool.store.common.UpdateGroup;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 加分规则更新Request
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Data
|
||||
public class TpRewardRuleUpdateRequest {
|
||||
|
||||
@ApiModelProperty("id")
|
||||
@NotNull(message = "id不能为空", groups = {UpdateGroup.class})
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("项目大类")
|
||||
@NotBlank(message = "项目大类不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private String projectCategory;
|
||||
|
||||
@ApiModelProperty("加分项目名称")
|
||||
@NotBlank(message = "加分项目名称不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("是否加满,0否 1是")
|
||||
@NotNull(message = "是否加满不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private Integer isFull;
|
||||
|
||||
@ApiModelProperty("加分值")
|
||||
private BigDecimal point;
|
||||
|
||||
@ApiModelProperty("启用状态,0未启用 1启用")
|
||||
@NotNull(message = "启用状态不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("加分项目描述")
|
||||
@NotBlank(message = "加分项目描述不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.cool.store.request.tp;
|
||||
|
||||
import com.cool.store.common.PageBasicInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规则查询Request
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Data
|
||||
public class TpRuleQueryRequest extends PageBasicInfo {
|
||||
@ApiModelProperty("问题分类")
|
||||
private String problemClassification;
|
||||
|
||||
@ApiModelProperty("项目大类")
|
||||
private String projectCategory;
|
||||
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("启用状态,0未启用 1启用")
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.cool.store.vo.tp;
|
||||
|
||||
import com.cool.store.annotation.DictField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 惩处规则详情VO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Data
|
||||
public class TpPenaltyRuleDetailVO {
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("规则编码")
|
||||
private String ruleCode;
|
||||
|
||||
@ApiModelProperty("问题分类")
|
||||
private String problemClassification;
|
||||
|
||||
@ApiModelProperty("问题分类名称")
|
||||
@DictField
|
||||
private String problemClassificationName;
|
||||
|
||||
@ApiModelProperty("项目大类")
|
||||
private String projectCategory;
|
||||
|
||||
@ApiModelProperty("项目大类名称")
|
||||
@DictField
|
||||
private String projectCategoryName;
|
||||
|
||||
@ApiModelProperty("惩处项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("警告上限次数")
|
||||
private Integer warningLimit;
|
||||
|
||||
@ApiModelProperty("扣分值")
|
||||
private BigDecimal point;
|
||||
|
||||
@ApiModelProperty("罚款金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@ApiModelProperty("复议申请时效")
|
||||
private Integer reviewDeadline;
|
||||
|
||||
@ApiModelProperty("启用状态,0未启用 1启用")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("惩处项目描述")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.cool.store.vo.tp;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 惩处规则列表VO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Data
|
||||
public class TpPenaltyRuleListVO {
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("规则编码")
|
||||
private String ruleCode;
|
||||
|
||||
@ApiModelProperty("问题分类")
|
||||
private String problemClassification;
|
||||
|
||||
@ApiModelProperty("项目大类")
|
||||
private String projectCategory;
|
||||
|
||||
@ApiModelProperty("惩处项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("警告上限次数")
|
||||
private Integer warningLimit;
|
||||
|
||||
@ApiModelProperty("扣分值")
|
||||
private BigDecimal point;
|
||||
|
||||
@ApiModelProperty("罚款金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@ApiModelProperty("启用状态,0未启用 1启用")
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.cool.store.vo.tp;
|
||||
|
||||
import com.cool.store.annotation.DictField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 加分规则详情VO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Data
|
||||
public class TpRewardRuleDetailVO {
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("规则编码")
|
||||
private String ruleCode;
|
||||
|
||||
@ApiModelProperty("项目大类")
|
||||
private String projectCategory;
|
||||
|
||||
@ApiModelProperty("项目大类名称")
|
||||
@DictField
|
||||
private String projectCategoryName;
|
||||
|
||||
@ApiModelProperty("加分项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("是否加满,0否 1是")
|
||||
private Integer isFull;
|
||||
|
||||
@ApiModelProperty("加分值")
|
||||
private BigDecimal point;
|
||||
|
||||
@ApiModelProperty("启用状态,0未启用 1启用")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("加分项目描述")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.cool.store.service.dict.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollStreamUtil;
|
||||
import com.cool.store.annotation.DictField;
|
||||
import com.cool.store.dao.dict.SysDictColumnDAO;
|
||||
import javafx.util.Pair;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DictService {
|
||||
private final SysDictColumnDAO columnDAO;
|
||||
private final Map<Class<?>, List<Pair<Field, Field>>> dictFieldCache = new ConcurrentHashMap<>();
|
||||
|
||||
public <T> void fillDictField(T obj) {
|
||||
fillDictField(Collections.singletonList(obj));
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充字典字段
|
||||
*/
|
||||
public <T> void fillDictField(List<T> objs) {
|
||||
if (CollectionUtils.isEmpty(objs)) {
|
||||
return;
|
||||
}
|
||||
Class<?> clazz = objs.get(0).getClass();
|
||||
List<Pair<Field, Field>> dictFields = getDictField(clazz);
|
||||
if (CollectionUtils.isEmpty(dictFields)) {
|
||||
return;
|
||||
}
|
||||
Set<String> columnCodes = new HashSet<>();
|
||||
for (T obj : objs) {
|
||||
for (Pair<Field, Field> dictField : dictFields) {
|
||||
try {
|
||||
Object value = dictField.getValue().get(obj);
|
||||
if (value != null) {
|
||||
columnCodes.add((String) value);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
log.info("字典字段值获取失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (columnCodes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Map<String, String> nameMap = columnDAO.getNameMapByCodes(new ArrayList<>(columnCodes));
|
||||
for (T obj : objs) {
|
||||
for (Pair<Field, Field> dictField : dictFields) {
|
||||
try {
|
||||
dictField.getKey().set(obj, nameMap.get((String) dictField.getValue().get(obj)));
|
||||
} catch (IllegalAccessException e) {
|
||||
log.info("字典字段值填充失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private <T> List<Pair<Field, Field>> getDictField(Class<T> clazz) {
|
||||
return dictFieldCache.computeIfAbsent(clazz, this::computeDictFields);
|
||||
}
|
||||
|
||||
private <T> List<Pair<Field, Field>> computeDictFields(Class<T> clazz) {
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
Map<String, Field> fieldMap = CollStreamUtil.toMap(Arrays.asList(fields), Field::getName, v -> v);
|
||||
List<Pair<Field, Field>> dictFields = new ArrayList<>();
|
||||
for (Field field : fields) {
|
||||
DictField dictField = field.getAnnotation(DictField.class);
|
||||
if (Objects.nonNull(dictField)) {
|
||||
field.setAccessible(true);
|
||||
String fieldName = field.getName();
|
||||
String sourceFieldName = StringUtils.isBlank(dictField.sourceField()) && fieldName.endsWith("Name")
|
||||
? fieldName.substring(0, fieldName.length() - 4)
|
||||
: dictField.sourceField();
|
||||
if (StringUtils.isNotBlank(sourceFieldName) && fieldMap.containsKey(sourceFieldName)) {
|
||||
Field sourceField = fieldMap.get(sourceFieldName);
|
||||
sourceField.setAccessible(true);
|
||||
dictFields.add(new Pair<>(field, sourceField));
|
||||
}
|
||||
}
|
||||
}
|
||||
return dictFields;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.cool.store.service.tp;
|
||||
|
||||
import com.cool.store.request.tp.TpPenaltyRuleUpdateRequest;
|
||||
import com.cool.store.request.tp.TpRewardRuleUpdateRequest;
|
||||
import com.cool.store.request.tp.TpRuleQueryRequest;
|
||||
import com.cool.store.vo.tp.TpPenaltyRuleDetailVO;
|
||||
import com.cool.store.vo.tp.TpPenaltyRuleListVO;
|
||||
import com.cool.store.vo.tp.TpRewardRuleDetailVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 十二分制-奖惩规则
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
public interface TpRuleService {
|
||||
|
||||
/**
|
||||
* 新增惩处规则
|
||||
* @param request 惩处规则更新Request
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean insertPenaltyRule(TpPenaltyRuleUpdateRequest request);
|
||||
|
||||
/**
|
||||
* 修改惩处规则
|
||||
* @param request 惩处规则更新Request
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean updatePenaltyRule(TpPenaltyRuleUpdateRequest request);
|
||||
|
||||
/**
|
||||
* 惩处规则详情
|
||||
* @param ruleId 规则id
|
||||
* @return 惩处规则详情VO
|
||||
*/
|
||||
TpPenaltyRuleDetailVO penaltyRuleDetail(Long ruleId);
|
||||
|
||||
/**
|
||||
* 惩处规则分页查询
|
||||
* @param request 规则查询Request
|
||||
* @return 惩处规则列表
|
||||
*/
|
||||
PageInfo<TpPenaltyRuleListVO> penaltyRulePage(TpRuleQueryRequest request);
|
||||
|
||||
/**
|
||||
* 新增加分规则
|
||||
* @param request 加分规则更新Request
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean insertRewardRule(TpRewardRuleUpdateRequest request);
|
||||
|
||||
/**
|
||||
* 修改加分规则
|
||||
* @param request 加分规则更新Request
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean updateRewardRule(TpRewardRuleUpdateRequest request);
|
||||
|
||||
/**
|
||||
* 加分规则详情
|
||||
* @param ruleId 规则id
|
||||
* @return 加分规则详情VO
|
||||
*/
|
||||
TpRewardRuleDetailVO rewardRuleDetail(Long ruleId);
|
||||
|
||||
/**
|
||||
* 加分规则分页查询
|
||||
* @param request 规则查询Request
|
||||
* @return 加分规则详情列表
|
||||
*/
|
||||
PageInfo<TpRewardRuleDetailVO> rewardRulePage(TpRuleQueryRequest request);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ruleIds 规则id列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean deleteRuleByIds(List<Long> ruleIds);
|
||||
|
||||
/**
|
||||
* 批量启用
|
||||
* @param ruleIds 规则id列表
|
||||
* @param enable 启用状态,0未启用 1启用
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean enableRuleByIds(List<Long> ruleIds, Integer enable);
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.cool.store.service.tp.impl;
|
||||
|
||||
import com.cool.store.dao.tp.TpRuleDAO;
|
||||
import com.cool.store.entity.tp.TpRuleDO;
|
||||
import com.cool.store.request.tp.TpPenaltyRuleUpdateRequest;
|
||||
import com.cool.store.request.tp.TpRewardRuleUpdateRequest;
|
||||
import com.cool.store.request.tp.TpRuleQueryRequest;
|
||||
import com.cool.store.service.dict.impl.DictService;
|
||||
import com.cool.store.service.tp.TpRuleService;
|
||||
import com.cool.store.utils.BeanUtil;
|
||||
import com.cool.store.utils.TpHelper;
|
||||
import com.cool.store.vo.tp.TpPenaltyRuleDetailVO;
|
||||
import com.cool.store.vo.tp.TpPenaltyRuleListVO;
|
||||
import com.cool.store.vo.tp.TpRewardRuleDetailVO;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 十二分制-奖惩规则 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TpRuleServiceImpl implements TpRuleService {
|
||||
private final TpRuleDAO tpRuleDAO;
|
||||
private final DictService dictService;
|
||||
|
||||
@Override
|
||||
public Boolean insertPenaltyRule(TpPenaltyRuleUpdateRequest request) {
|
||||
TpRuleDO tpRuleDO = BeanUtil.toBean(request, TpRuleDO.class);
|
||||
tpRuleDO.setRuleCode(TpHelper.generatePenaltyRuleCode());
|
||||
tpRuleDO.setType(0);
|
||||
return tpRuleDAO.insertSelective(tpRuleDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updatePenaltyRule(TpPenaltyRuleUpdateRequest request) {
|
||||
TpRuleDO tpRuleDO = BeanUtil.toBean(request, TpRuleDO.class);
|
||||
return tpRuleDAO.updateSelective(tpRuleDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TpPenaltyRuleDetailVO penaltyRuleDetail(Long ruleId) {
|
||||
TpRuleDO tpRuleDO = tpRuleDAO.getById(ruleId);
|
||||
if (Objects.nonNull(tpRuleDO)) {
|
||||
TpPenaltyRuleDetailVO vo = BeanUtil.toBean(tpRuleDO, TpPenaltyRuleDetailVO.class);
|
||||
dictService.fillDictField(vo);
|
||||
return vo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<TpPenaltyRuleListVO> penaltyRulePage(TpRuleQueryRequest request) {
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
List<TpRuleDO> list = tpRuleDAO.getList(request);
|
||||
PageInfo<TpRuleDO> page = new PageInfo<>(list);
|
||||
PageInfo<TpPenaltyRuleListVO> newPage = BeanUtil.toPage(page, TpPenaltyRuleListVO.class);
|
||||
dictService.fillDictField(newPage.getList());
|
||||
return newPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertRewardRule(TpRewardRuleUpdateRequest request) {
|
||||
TpRuleDO tpRuleDO = BeanUtil.toBean(request, TpRuleDO.class);
|
||||
tpRuleDO.setRuleCode(TpHelper.generateRewardRuleCode());
|
||||
tpRuleDO.setType(1);
|
||||
return tpRuleDAO.insertSelective(tpRuleDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateRewardRule(TpRewardRuleUpdateRequest request) {
|
||||
TpRuleDO tpRuleDO = BeanUtil.toBean(request, TpRuleDO.class);
|
||||
return tpRuleDAO.updateSelective(tpRuleDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TpRewardRuleDetailVO rewardRuleDetail(Long ruleId) {
|
||||
TpRuleDO tpRuleDO = tpRuleDAO.getById(ruleId);
|
||||
if (Objects.nonNull(tpRuleDO)) {
|
||||
TpRewardRuleDetailVO vo = BeanUtil.toBean(tpRuleDO, TpRewardRuleDetailVO.class);
|
||||
dictService.fillDictField(vo);
|
||||
return vo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<TpRewardRuleDetailVO> rewardRulePage(TpRuleQueryRequest request) {
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
List<TpRuleDO> list = tpRuleDAO.getList(request);
|
||||
PageInfo<TpRuleDO> page = new PageInfo<>(list);
|
||||
PageInfo<TpRewardRuleDetailVO> newPage = BeanUtil.toPage(page, TpRewardRuleDetailVO.class);
|
||||
dictService.fillDictField(newPage.getList());
|
||||
return newPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteRuleByIds(List<Long> ruleIds) {
|
||||
return tpRuleDAO.deleteByIds(ruleIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean enableRuleByIds(List<Long> ruleIds, Integer enable) {
|
||||
return tpRuleDAO.updateStatus(ruleIds, enable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.cool.store.controller.webb;
|
||||
|
||||
import com.cool.store.common.InsertGroup;
|
||||
import com.cool.store.common.UpdateGroup;
|
||||
import com.cool.store.request.tp.TpPenaltyRuleUpdateRequest;
|
||||
import com.cool.store.request.tp.TpRewardRuleUpdateRequest;
|
||||
import com.cool.store.request.tp.TpRuleQueryRequest;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.tp.TpRuleService;
|
||||
import com.cool.store.vo.tp.TpPenaltyRuleDetailVO;
|
||||
import com.cool.store.vo.tp.TpPenaltyRuleListVO;
|
||||
import com.cool.store.vo.tp.TpRewardRuleDetailVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 十二分制-奖惩规则 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Api(tags = "十二分制-奖惩规则")
|
||||
@RestController
|
||||
@RequestMapping("/pc/tp/rule")
|
||||
@RequiredArgsConstructor
|
||||
public class TpRuleController {
|
||||
private final TpRuleService tpRuleService;
|
||||
|
||||
@ApiOperation("新增惩处规则")
|
||||
@PostMapping("/insertPenalty")
|
||||
public ResponseResult<Boolean> insertPenaltyRule(@RequestBody @Validated(InsertGroup.class) TpPenaltyRuleUpdateRequest request) {
|
||||
return ResponseResult.success(tpRuleService.insertPenaltyRule(request));
|
||||
}
|
||||
|
||||
@ApiOperation("修改惩处规则")
|
||||
@PostMapping("/updatePenalty")
|
||||
public ResponseResult<Boolean> updatePenaltyRule(@RequestBody @Validated(UpdateGroup.class) TpPenaltyRuleUpdateRequest request) {
|
||||
return ResponseResult.success(tpRuleService.updatePenaltyRule(request));
|
||||
}
|
||||
|
||||
@ApiOperation("惩处规则详情")
|
||||
@GetMapping("/penaltyDetail")
|
||||
@ApiImplicitParam(name = "ruleId", value = "规则id", required = true, dataType = "Long", paramType = "query")
|
||||
public ResponseResult<TpPenaltyRuleDetailVO> penaltyRuleDetail(@NotNull(message = "规则id不能为空") Long ruleId) {
|
||||
return ResponseResult.success(tpRuleService.penaltyRuleDetail(ruleId));
|
||||
}
|
||||
|
||||
@ApiOperation("惩处规则分页查询")
|
||||
@GetMapping("/penaltyPage")
|
||||
public ResponseResult<PageInfo<TpPenaltyRuleListVO>> penaltyRulePage(TpRuleQueryRequest request) {
|
||||
return ResponseResult.success(tpRuleService.penaltyRulePage(request));
|
||||
}
|
||||
|
||||
@ApiOperation("新增加分规则")
|
||||
@PostMapping("/insertReward")
|
||||
public ResponseResult<Boolean> insertRewardRule(@RequestBody @Validated(InsertGroup.class) TpRewardRuleUpdateRequest request) {
|
||||
return ResponseResult.success(tpRuleService.insertRewardRule(request));
|
||||
}
|
||||
|
||||
@ApiOperation("修改加分规则")
|
||||
@PostMapping("/updateReward")
|
||||
public ResponseResult<Boolean> updateRewardRule(@RequestBody @Validated(UpdateGroup.class) TpRewardRuleUpdateRequest request) {
|
||||
return ResponseResult.success(tpRuleService.updateRewardRule(request));
|
||||
}
|
||||
|
||||
@ApiOperation("加分规则详情")
|
||||
@GetMapping("/rewardDetail")
|
||||
@ApiImplicitParam(name = "ruleId", value = "规则id", required = true, dataType = "Long", paramType = "query")
|
||||
public ResponseResult<TpRewardRuleDetailVO> rewardRuleDetail(@NotNull(message = "规则id不能为空") Long ruleId) {
|
||||
return ResponseResult.success(tpRuleService.rewardRuleDetail(ruleId));
|
||||
}
|
||||
|
||||
@ApiOperation("加分规则分页查询")
|
||||
@GetMapping("/rewardPage")
|
||||
public ResponseResult<PageInfo<TpRewardRuleDetailVO>> rewardRulePage(TpRuleQueryRequest request) {
|
||||
return ResponseResult.success(tpRuleService.rewardRulePage(request));
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除规则")
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Boolean> deleteRuleByIds(@RequestBody List<Long> ruleIds) {
|
||||
return ResponseResult.success(tpRuleService.deleteRuleByIds(ruleIds));
|
||||
}
|
||||
|
||||
@ApiOperation("启用规则")
|
||||
@PostMapping("/enable")
|
||||
public ResponseResult<Boolean> enableRuleByIds(@RequestBody List<Long> ruleIds) {
|
||||
return ResponseResult.success(tpRuleService.enableRuleByIds(ruleIds, 1));
|
||||
}
|
||||
|
||||
@ApiOperation("禁用规则")
|
||||
@PostMapping("/disable")
|
||||
public ResponseResult<Boolean> disableRuleByIds(@RequestBody List<Long> ruleIds) {
|
||||
return ResponseResult.success(tpRuleService.enableRuleByIds(ruleIds, 0));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user