forked from rongchao/epmet-cloud-rizhao
30 changed files with 788 additions and 328 deletions
@ -0,0 +1,42 @@ |
|||
package com.epmet.commons.tools.enums; |
|||
|
|||
/** |
|||
* 通用操作类型 枚举类 |
|||
* dev|test|prod |
|||
* |
|||
* @author jianjun liu |
|||
* @date 2020-07-03 11:14 |
|||
**/ |
|||
public enum CommonOperateTypeEnum { |
|||
ADD("add", "添加"), |
|||
EDIT("edit", "编辑"), |
|||
DEL("del", "删除"), |
|||
; |
|||
|
|||
private String code; |
|||
private String desc; |
|||
|
|||
|
|||
CommonOperateTypeEnum(String code, String name) { |
|||
this.code = code; |
|||
this.desc = name; |
|||
} |
|||
|
|||
public static CommonOperateTypeEnum getEnum(String code) { |
|||
CommonOperateTypeEnum[] values = CommonOperateTypeEnum.values(); |
|||
for (CommonOperateTypeEnum value : values) { |
|||
if (code != null && value.getCode().equals(code)) { |
|||
return value; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public String getDesc() { |
|||
return desc; |
|||
} |
|||
} |
@ -1,126 +0,0 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 积分规则表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-07-20 |
|||
*/ |
|||
@Data |
|||
public class PointRuleDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 规则名称 与事件名称保持一致即可 |
|||
*/ |
|||
private String ruleName; |
|||
|
|||
/** |
|||
* 规则说明 事件说明 |
|||
*/ |
|||
private String ruleDesc; |
|||
|
|||
/** |
|||
* 事件CODE 来自事件表 |
|||
*/ |
|||
private String eventCode; |
|||
|
|||
/** |
|||
* 事件名称 来自事件表 |
|||
*/ |
|||
private String eventName; |
|||
|
|||
/** |
|||
* 操作类型 加积分:add;减积分:subtract |
|||
*/ |
|||
private String operateType; |
|||
|
|||
/** |
|||
* 积分上限 |
|||
*/ |
|||
private Integer upLimit; |
|||
|
|||
/** |
|||
* 积分上限描述 |
|||
*/ |
|||
private String upLimitDesc; |
|||
|
|||
/** |
|||
* 获得积分值 |
|||
*/ |
|||
private Integer pointNum; |
|||
|
|||
/** |
|||
* 获得积分单位 次:time;分钟:minute;小时:hour |
|||
*/ |
|||
private String pointUnit; |
|||
|
|||
/** |
|||
* 是否启用 0-否,1-是 |
|||
*/ |
|||
private String enabledFlag; |
|||
|
|||
/** |
|||
* 删除标识 0-否,1-是 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc:积分规则Id详情获取 规则列表 |
|||
* @author jianjun liu |
|||
* @date 2020-07-22 15:28 |
|||
**/ |
|||
@Data |
|||
public class PointDetailFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 7587939716742608164L; |
|||
/** |
|||
* 积分规则Id |
|||
*/ |
|||
@NotBlank(message = "积分规则Id不能为空") |
|||
private String ruleId; |
|||
} |
@ -0,0 +1,71 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc:积分规则保存/修改 规则列表 |
|||
* |
|||
* @author jianjun liu |
|||
* @date 2020-07-22 15:28 |
|||
**/ |
|||
@Data |
|||
public class PointRuleFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -3228252683629912008L; |
|||
/** |
|||
* 积分规则Id |
|||
*/ |
|||
@NotBlank(message = "积分规则Id不能为空", groups = UpdateGroup.class) |
|||
private String ruleId; |
|||
/** |
|||
* 积分 |
|||
*/ |
|||
@NotBlank(message = "积分不能为空", groups = {AddGroup.class, UpdateGroup.class}) |
|||
private String point; |
|||
|
|||
/** |
|||
* 是否开启 |
|||
*/ |
|||
@NotBlank(message = "是否开启不能为空", groups = {AddGroup.class, UpdateGroup.class}) |
|||
private String enabledFlag; |
|||
/** |
|||
* 上限开启 |
|||
*/ |
|||
@NotBlank(message = "积分上限不能为空", groups = {AddGroup.class, UpdateGroup.class}) |
|||
private String upLimit; |
|||
|
|||
/** |
|||
* 积分规则Id |
|||
*/ |
|||
@NotBlank(message = "客户Id不能为空", groups = {AddGroup.class, UpdateGroup.class}) |
|||
private String customerId; |
|||
|
|||
//=======系统添加时的属性======
|
|||
/** |
|||
* 规则说明 事件说明 |
|||
*/ |
|||
@NotBlank(message = "规则描述不能为空", groups = AddGroup.class) |
|||
private String ruleDesc; |
|||
|
|||
/** |
|||
* 事件CODE 来自事件表 |
|||
*/ |
|||
@NotBlank(message = "事件code不能为空", groups = AddGroup.class) |
|||
private String eventCode; |
|||
|
|||
/** |
|||
* 操作类型 加积分:add;减积分:subtract |
|||
*/ |
|||
@NotBlank(message = "操作类型不能为空", groups = AddGroup.class) |
|||
private String operateType; |
|||
/** |
|||
* 获得积分单位 次:time;分钟:minute;小时:hour |
|||
*/ |
|||
@NotBlank(message = "积分单位不能为空", groups = AddGroup.class) |
|||
private String pointUnit; |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc:根据功能Id获取 规则列表 |
|||
* @author jianjun liu |
|||
* @date 2020-07-22 15:28 |
|||
**/ |
|||
@Data |
|||
public class PointRuleListFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -1918653281170340608L; |
|||
/** |
|||
* 功能Id |
|||
*/ |
|||
@NotBlank(message = "功能Id不能为空") |
|||
private String functionId; |
|||
@NotBlank(message = "客户Id不能为空") |
|||
private String customerId; |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc:积分规则-获取客户功能列表 result |
|||
* @author jianjun liu |
|||
* @date 2020-07-22 14:43 |
|||
**/ |
|||
@Data |
|||
public class CustomerFunctionResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -3761765064811136295L; |
|||
|
|||
private String functionId; |
|||
private String functionName; |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc:积分规则-详情 result |
|||
* @author jianjun liu |
|||
* @date 2020-07-22 14:43 |
|||
**/ |
|||
@Data |
|||
public class PointDetailResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 2426172750860788081L; |
|||
private String ruleId; |
|||
private String ruleName; |
|||
private String ruleDesc; |
|||
private Integer point; |
|||
private String pointUnit; |
|||
private String upLimit; |
|||
private String enabledFlag; |
|||
private String upLimitDesc; |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc:积分规则-列表 result |
|||
* @author jianjun liu |
|||
* @date 2020-07-22 14:43 |
|||
**/ |
|||
@Data |
|||
public class PointRuleResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -2327977101138032573L; |
|||
private String ruleId; |
|||
private String ruleName; |
|||
private String ruleDesc; |
|||
/** |
|||
* 拼接好的 积分值/单位 |
|||
*/ |
|||
private String pointValue; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.epmet.common.enu; |
|||
|
|||
/** |
|||
* 系积分系统-积分单位枚举类 |
|||
* dev|test|prod |
|||
* |
|||
* @author jianjun liu |
|||
* @date 2020-07-03 11:14 |
|||
**/ |
|||
public enum PointUnitEnum { |
|||
TIME("time", "次"), |
|||
MINUTE("minute", "分种"), |
|||
HOUR("hour", "小时"), |
|||
; |
|||
|
|||
private String code; |
|||
private String name; |
|||
|
|||
|
|||
PointUnitEnum(String code, String name) { |
|||
this.code = code; |
|||
this.name = name; |
|||
} |
|||
|
|||
public static PointUnitEnum getEnum(String code) { |
|||
PointUnitEnum[] values = PointUnitEnum.values(); |
|||
for (PointUnitEnum value : values) { |
|||
if (code != null && value.getCode().equals(code)) { |
|||
return value; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
} |
@ -0,0 +1,43 @@ |
|||
package com.epmet.common.enu; |
|||
|
|||
/** |
|||
* @author jianjun liu |
|||
* @date 2020-06-04 21:39 |
|||
**/ |
|||
public enum SysResponseEnum { |
|||
/** |
|||
* |
|||
* 业务代码枚举类 |
|||
* |
|||
* 编码样式:【CCCBBOOXX】 |
|||
* 编码示例说明: |
|||
* CCC 中心编码&业务系统 (112(与端口号一致)-积分系统服务) |
|||
* BB 业务类型(00-默认 ) |
|||
* OO 操作类型(00-默认) |
|||
* XX 具体编码(00-成功,01-失败,02-参数错误,10-异常 99-系统错误) |
|||
* |
|||
*/ |
|||
/*通用枚举 */ |
|||
EXCEPTION(10001,"系统异常"), |
|||
|
|||
|
|||
/*积分规则 业务 01*/ |
|||
THIRD_SERVICE_ERROR(112010001,"调用第三方接口异常"), |
|||
POINT_RULE_IS_NOT_EXIST(112010002,"积分规则不存在"), |
|||
; |
|||
|
|||
private Integer code; |
|||
private String msg; |
|||
SysResponseEnum(Integer code, String msg){ |
|||
this.code = code; |
|||
this.msg = msg; |
|||
} |
|||
|
|||
public Integer getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public String getMsg() { |
|||
return msg; |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.dto.form.PointRuleFormDTO; |
|||
import com.epmet.service.PointRuleService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @author jianjun liu |
|||
* @date 2020-06-04 20:39 |
|||
**/ |
|||
@RestController |
|||
@RequestMapping("opback") |
|||
public class BackDoorController { |
|||
@Autowired |
|||
private PointRuleService pointRuleService; |
|||
|
|||
/** |
|||
* desc:添加规则 |
|||
* |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "sysadd") |
|||
public Result<Boolean> add(@RequestBody PointRuleFormDTO formDTO) { |
|||
TokenDto tokenDTO = new TokenDto(); |
|||
tokenDTO.setUserId("default"); |
|||
formDTO.setCustomerId(tokenDTO.getCustomerId()); |
|||
ValidatorUtils.validateEntity(formDTO, AddGroup.class); |
|||
pointRuleService.add(tokenDTO, formDTO); |
|||
return new Result<Boolean>().ok(true); |
|||
} |
|||
} |
@ -0,0 +1,100 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.dto.form.PointDetailFormDTO; |
|||
import com.epmet.dto.form.PointRuleFormDTO; |
|||
import com.epmet.dto.form.PointRuleListFormDTO; |
|||
import com.epmet.dto.result.CustomerFunctionResultDTO; |
|||
import com.epmet.dto.result.PointDetailResultDTO; |
|||
import com.epmet.dto.result.PointRuleResultDTO; |
|||
import com.epmet.service.PointRuleService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 积分规则controller |
|||
* |
|||
* @author jianjun liu |
|||
* @date 2020-07-22 14:39 |
|||
**/ |
|||
@RestController |
|||
@RequestMapping("rule") |
|||
public class PointRuleController { |
|||
@Autowired |
|||
private PointRuleService pointRuleService; |
|||
|
|||
/** |
|||
* desc:积分规则-获取客户有积分规则的功能列表 |
|||
* |
|||
* @param tokenDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "functionlist") |
|||
public Result<List<CustomerFunctionResultDTO>> getFunctionList(@LoginUser TokenDto tokenDTO) { |
|||
return new Result<List<CustomerFunctionResultDTO>>().ok(pointRuleService.getFunctionList(tokenDTO.getCustomerId())); |
|||
} |
|||
|
|||
/** |
|||
* desc:根据功能id获取积分规则 |
|||
* |
|||
* @param tokenDTO |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "list") |
|||
public Result<List<PointRuleResultDTO>> list(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleListFormDTO formDTO) { |
|||
formDTO.setCustomerId(tokenDTO.getCustomerId()); |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
return new Result<List<PointRuleResultDTO>>().ok(pointRuleService.list(formDTO)); |
|||
} |
|||
|
|||
/** |
|||
* desc:根据规则id获取积分规则 |
|||
* |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "detail") |
|||
public Result<PointDetailResultDTO> detail(@RequestBody PointDetailFormDTO formDTO) { |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
return new Result<PointDetailResultDTO>().ok(pointRuleService.detail(formDTO)); |
|||
} |
|||
|
|||
/** |
|||
* desc:根据功能id获取积分规则 |
|||
* |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
public Result<Boolean> update(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleFormDTO formDTO) { |
|||
formDTO.setCustomerId(tokenDTO.getCustomerId()); |
|||
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); |
|||
pointRuleService.update(tokenDTO,formDTO); |
|||
return new Result<Boolean>().ok(true); |
|||
} |
|||
|
|||
/** |
|||
* desc:添加规则 |
|||
* |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "add") |
|||
public Result<Boolean> add(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleFormDTO formDTO) { |
|||
formDTO.setCustomerId(tokenDTO.getCustomerId()); |
|||
ValidatorUtils.validateEntity(formDTO, AddGroup.class); |
|||
pointRuleService.add(tokenDTO,formDTO); |
|||
return new Result<Boolean>().ok(true); |
|||
} |
|||
} |
@ -1,9 +1,9 @@ |
|||
<?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.epmet.dao.SysOperateLogDao"> |
|||
<mapper namespace="com.epmet.dao.RuleOperateLogDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.SysOperateLogEntity" id="sysOperateLogMap"> |
|||
<resultMap type="com.epmet.entity.RuleOperateLogEntity" id="sysOperateLogMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="objectId" column="OBJECT_ID"/> |
Loading…
Reference in new issue