Browse Source

补充PC端接口

dev
Jackwang 3 years ago
parent
commit
629d62e6b9
  1. 2
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdditiveRuleDTO.java
  2. 63
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointModifyFormDTO.java
  3. 30
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointAdditiveRuleController.java
  4. 9
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdditiveRuleDao.java
  5. 23
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAdditiveRuleService.java
  6. 51
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdditiveRuleServiceImpl.java
  7. 13
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdditiveRuleDao.xml

2
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdditiveRuleDTO.java

@ -37,6 +37,8 @@ public class PointAdditiveRuleDTO implements Serializable {
*/
private String applyFlag;
private String applyFlagName;
/**
* 积分类别编码;德育积分moral_education党建积分party_building
*/

63
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointModifyFormDTO.java

@ -0,0 +1,63 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @program: epmet-cloud
* @description:
* @author: wangtong
* @create: 2022-06-17 17:48
**/
@Data
public class PointModifyFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@NotNull(message = "id不可为空")
private String id;
private String customerId;
/**
* 记录类型;分类:category规则:rule
*/
@NotNull(message = "类型不可为空")
private String type;
/**
* 允许申请标记;允许0type = category时强制赋值为0禁止1
*/
private String applyFlag;
/**
* 积分类别名称;type=category时必填
*/
private String categoryName;
/**
* 积分规则名称;type=rule时必填
*/
private String ruleName;
/**
* 上级节点ID;上级分类ID顶级分类的PID为0
*/
@NotNull(message = "pid不可为空")
private String pid;
/**
* 分值;正数加分负数减分type=rule时必填
*/
private Integer pointValue;
}

30
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointAdditiveRuleController.java

@ -13,10 +13,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.CategorydetailResultDTO;
import com.epmet.dto.PointAdditiveRuleDTO;
import com.epmet.dto.form.AddcategoryFormDTO;
import com.epmet.dto.form.AddruleFormDTO;
import com.epmet.dto.form.List4applyFormDTO;
import com.epmet.dto.form.List4treeFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.List4ApplyResultDTO;
import com.epmet.excel.PointAdditiveRuleExcel;
import com.epmet.service.PointAdditiveRuleService;
@ -163,4 +160,29 @@ public class PointAdditiveRuleController {
dto.setCustomerId(tokenDto.getCustomerId());
return pointAdditiveRuleService.list4apply(dto);
}
/**
* @describe: 查询积分规则详情
* @author wangtong
* @date 2022/6/17 17:36
* @params [categoryId]
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.PointAdditiveRuleDTO>
*/
@PostMapping("ruledetail/{ruleId}")
public Result<PointAdditiveRuleDTO> ruledetail(@PathVariable("ruleId") String ruleId){
return pointAdditiveRuleService.ruledetail(ruleId);
}
/**
* @describe: 修改积分分类/规则
* @author wangtong
* @date 2022/6/17 17:51
* @params [dto]
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("modify")
public Result modify(@LoginUser TokenDto tokenDto,@RequestBody PointModifyFormDTO dto){
dto.setCustomerId(tokenDto.getCustomerId());
return pointAdditiveRuleService.modify(dto);
}
}

9
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdditiveRuleDao.java

@ -77,4 +77,13 @@ public interface PointAdditiveRuleDao extends BaseDao<PointAdditiveRuleEntity> {
PointAdditiveRuleEntity selectEntityByName(@Param("customerId") String customerId,
@Param("categoryName") String categoryName,
@Param("ruleName") String ruleName);
/**
* @describe: 查询积分规则详情
* @author wangtong
* @date 2022/6/17 17:40
* @params [categoryId]
* @return com.epmet.dto.PointAdditiveRuleDTO
*/
PointAdditiveRuleDTO selectRuledetail(@Param("ruleId") String ruleId);
}

23
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAdditiveRuleService.java

@ -5,10 +5,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CategorydetailResultDTO;
import com.epmet.dto.PointAdditiveRuleDTO;
import com.epmet.dto.form.AddcategoryFormDTO;
import com.epmet.dto.form.AddruleFormDTO;
import com.epmet.dto.form.List4applyFormDTO;
import com.epmet.dto.form.List4treeFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.List4ApplyResultDTO;
import com.epmet.entity.PointAdditiveRuleEntity;
@ -136,4 +133,22 @@ public interface PointAdditiveRuleService extends BaseService<PointAdditiveRuleE
* @return com.epmet.commons.tools.utils.Result
*/
Result<List<PointAdditiveRuleDTO>> list4tree(List4treeFormDTO dto);
/**
* @describe: 查询积分规则详情
* @author wangtong
* @date 2022/6/17 17:36
* @params [categoryId]
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.PointAdditiveRuleDTO>
*/
Result<PointAdditiveRuleDTO> ruledetail(String ruleId);
/**
* @describe: 修改积分分类/规则
* @author wangtong
* @date 2022/6/17 17:51
* @params [dto]
* @return com.epmet.commons.tools.utils.Result
*/
Result modify(PointModifyFormDTO dto);
}

51
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdditiveRuleServiceImpl.java

@ -14,10 +14,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.PointAdditiveRuleDao;
import com.epmet.dto.CategorydetailResultDTO;
import com.epmet.dto.PointAdditiveRuleDTO;
import com.epmet.dto.form.AddcategoryFormDTO;
import com.epmet.dto.form.AddruleFormDTO;
import com.epmet.dto.form.List4applyFormDTO;
import com.epmet.dto.form.List4treeFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.List4ApplyResultDTO;
import com.epmet.entity.PointAdditiveRuleEntity;
import com.epmet.redis.PointAdditiveRuleRedis;
@ -202,4 +199,50 @@ public class PointAdditiveRuleServiceImpl extends BaseServiceImpl<PointAdditiveR
return new Result<List<PointAdditiveRuleDTO>>().ok(result);
}
@Override
public Result<PointAdditiveRuleDTO> ruledetail(String ruleId) {
PointAdditiveRuleDTO result = baseDao.selectRuledetail(ruleId);
return new Result<PointAdditiveRuleDTO>().ok(result);
}
@Override
public Result modify(PointModifyFormDTO dto) {
PointAdditiveRuleEntity entity = baseDao.selectById(dto.getId());
if(PointAddRuleEnum.CATEGORY_TYPE.getCode().equals(dto.getType())){
//类别
PointAdditiveRuleEntity isExist = baseDao.selectEntityByName(dto.getCustomerId(),dto.getCategoryName(),null);
if(isExist != null){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "该名称已存在","该名称已存在");
}
entity.setCategoryName(dto.getCategoryName());
}else if(PointAddRuleEnum.RULE_TYPE.getCode().equals(dto.getType())){
//规则
PointAdditiveRuleEntity isExist = baseDao.selectEntityByName(dto.getCustomerId(),null,dto.getRuleName());
if(isExist != null){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "该名称已存在","该名称已存在");
}
entity.setRuleName(dto.getRuleName());
entity.setPointValue(dto.getPointValue());
entity.setApplyFlag(dto.getApplyFlag());
}else{
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "type类型有误","type类型有误");
}
if(!NumConstant.ZERO_STR.equals(dto.getPid())){
PointAdditiveRuleEntity parentEntity = baseDao.selectById(dto.getPid());
if(null == parentEntity){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到父节点信息","未查到父节点信息");
}
entity.setPid(dto.getPid());
if(StringUtils.isBlank(parentEntity.getPids())){
entity.setPids(parentEntity.getId());
}else{
entity.setPids(parentEntity.getPids()+":"+parentEntity.getId());
}
}
updateById(entity);
return new Result().ok("修改成功!");
}
}

13
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdditiveRuleDao.xml

@ -106,6 +106,19 @@
and RULE_NAME= #{ruleName}
</if>
</select>
<select id="selectRuledetail" resultType="com.epmet.dto.PointAdditiveRuleDTO">
SELECT id,
pid,
RULE_NAME,
POINT_VALUE,
APPLY_FLAG,
if(APPLY_FLAG='0','允许','禁止') as applyFlagName,
CREATED_TIME,
UPDATED_TIME
FROM point_additive_rule
WHERE DEL_FLAG='0'
AND ID=#{ruleId}
</select>
</mapper>

Loading…
Cancel
Save