Browse Source

points模块增加,积分规则管理表代码生成

feature/syp_points
zhangyongzhangyong 5 years ago
parent
commit
36d0d1dda9
  1. 2
      esua-epdc/epdc-gateway/pom.xml
  2. 8
      esua-epdc/epdc-gateway/src/main/resources/application.yml
  3. 121
      esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/dto/PointsRuleDTO.java
  4. 114
      esua-epdc/epdc-module/epdc-points/epdc-points-server/pom.xml
  5. 31
      esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/PointsApplication.java
  6. 26
      esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java
  7. 94
      esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/controller/PointsRuleController.java
  8. 33
      esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/dao/PointsRuleDao.java
  9. 91
      esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/entity/PointsRuleEntity.java
  10. 86
      esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/excel/PointsRuleExcel.java
  11. 47
      esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/redis/PointsRuleRedis.java
  12. 95
      esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/service/PointsRuleService.java
  13. 104
      esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/service/impl/PointsRuleServiceImpl.java
  14. 32
      esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/application.yml
  15. 27
      esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/mapper/PointsRuleDao.xml

2
esua-epdc/epdc-gateway/pom.xml

@ -131,6 +131,8 @@
<gateway.routes.epdc-kpi-server.uri>lb://epdc-kpi-server</gateway.routes.epdc-kpi-server.uri> <gateway.routes.epdc-kpi-server.uri>lb://epdc-kpi-server</gateway.routes.epdc-kpi-server.uri>
<!-- <gateway.routes.epdc-custom-server.uri>http://127.0.0.1:9076</gateway.routes.epdc-kpi-server.uri>--> <!-- <gateway.routes.epdc-custom-server.uri>http://127.0.0.1:9076</gateway.routes.epdc-kpi-server.uri>-->
<gateway.routes.epdc-custom-server.uri>lb://epdc-custom-server</gateway.routes.epdc-custom-server.uri> <gateway.routes.epdc-custom-server.uri>lb://epdc-custom-server</gateway.routes.epdc-custom-server.uri>
<!--<gateway.routes.epdc-points-server.uri>lb://epdc-user-server</gateway.routes.epdc-points-server.uri>-->
<gateway.routes.epdc-points-server.uri>http://127.0.0.1:9070</gateway.routes.epdc-points-server.uri>
<!-- nacos --> <!-- nacos -->
<nacos.register-enabled>false</nacos.register-enabled> <nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr> <nacos.server-addr>47.104.224.45:8848</nacos.server-addr>

8
esua-epdc/epdc-gateway/src/main/resources/application.yml

@ -165,6 +165,14 @@ spring:
- Path=${server.servlet.context-path}/custom/** - Path=${server.servlet.context-path}/custom/**
filters: filters:
- StripPrefix=1 - StripPrefix=1
#积分模块
- id: epdc-points-server
uri: @gateway.routes.epdc-points-server.uri@
order: 18
predicates:
- Path=${server.servlet.context-path}/points/**
filters:
- StripPrefix=1
nacos: nacos:
discovery: discovery:
server-addr: @nacos.server-addr@ server-addr: @nacos.server-addr@

121
esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/dto/PointsRuleDTO.java

@ -0,0 +1,121 @@
/**
* 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.elink.esua.epdc.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 积分规则管理表 积分规则管理表
*
* @author zhangyong
* @since v1.0.0 2020-04-28
*/
@Data
public class PointsRuleDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 积分规则编码
*/
private String ruleCode;
/**
* 动作编码
*/
private String behaviorCode;
/**
* 积分规则描述
*/
private String ruleDesc;
/**
* 规则操作类型 0-减积分1-加积分
*/
private String operationType;
/**
* 积分规则值
*/
private Integer points;
/**
* 上线统计指标 0-分钟1-小时2-3-4-
*/
private String limitType;
/**
* 积分上限值
*/
private Integer upperLimitVal;
/**
* 启用标识 0-1-
*/
private String enableFlag;
/**
* 附加值
*/
private String addedVal;
/**
* 备注
*/
private String remark;
/**
* 乐观锁
*/
private Integer revision;
/**
* 删除标识 0-1-
*/
private String delFlag;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

114
esua-epdc/epdc-module/epdc-points/epdc-points-server/pom.xml

@ -91,6 +91,120 @@
<artifactId>dockerfile-maven-plugin</artifactId> <artifactId>dockerfile-maven-plugin</artifactId>
</plugin> </plugin>
</plugins> </plugins>
<!--新增配置-->
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/application*.yml</include>
<include>**/*.properties</include>
<include>logback-spring.xml</include>
<include>registry.conf</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<excludes>
<exclude>**/application*.yml</exclude>
<exclude>**/*.properties</exclude>
<exclude>logback-spring.xml</exclude>
<exclude>registry.conf</exclude>
</excludes>
</resource>
</resources>
</build> </build>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<spring.profiles.active>dev</spring.profiles.active>
<server.port>9070</server.port>
<spring.redis.index>2</spring.redis.index>
<spring.redis.host>114.215.125.123</spring.redis.host>
<spring.redis.port>9603</spring.redis.port>
<spring.redis.password>epdc!redis@master1405</spring.redis.password>
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://47.104.224.45:3308/js_esua_epdc_points?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>jinshui</spring.datasource.druid.username>
<spring.datasource.druid.password>jinshui@833066</spring.datasource.druid.password>
<nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip></nacos.ip>
<nacos.namespace>fa5bf520-09c1-410c-a876-28e98c0534d3</nacos.namespace>
<!--RocketMQ-->
<rocketmq.name.server>47.104.85.99:9876;114.215.125.123:9876</rocketmq.name.server>
<rocketmq.consumer.group>jinshui-organizationGroup</rocketmq.consumer.group>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<spring.profiles.active>test</spring.profiles.active>
<server.port>11011</server.port>
<spring.redis.index>2</spring.redis.index>
<spring.redis.host>114.215.125.123</spring.redis.host>
<spring.redis.port>9603</spring.redis.port>
<spring.redis.password>epdc!redis@master1405</spring.redis.password>
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://47.104.224.45:3308/js_esua_epdc_points?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>jinshui</spring.datasource.druid.username>
<spring.datasource.druid.password>jinshui@833066</spring.datasource.druid.password>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>219.146.91.110</nacos.ip>
<nacos.namespace>fa5bf520-09c1-410c-a876-28e98c0534d3</nacos.namespace>
<!--RocketMQ-->
<rocketmq.name.server>47.104.85.99:9876;114.215.125.123:9876</rocketmq.name.server>
<rocketmq.consumer.group>jinshui-organizationGroup</rocketmq.consumer.group>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<spring.profiles.active>prod</spring.profiles.active>
<docker.tag>prod</docker.tag>
<server.port>9070</server.port>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>172.19.0.11</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>epdc!redis@master1405</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>172.20.0.4:80</nacos.server-addr>
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://172.19.0.2:3306/esua_epdc_points?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epdc</spring.datasource.druid.username>
<spring.datasource.druid.password>Elink@833066</spring.datasource.druid.password>
<!--RocketMQ-->
<rocketmq.name.server>172.16.0.7:9876;172.16.0.8:9876</rocketmq.name.server>
<rocketmq.consumer.group>jinshui-organizationGroup</rocketmq.consumer.group>
</properties>
</profile>
</profiles>
</project> </project>

31
esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/PointsApplication.java

@ -0,0 +1,31 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.elink.esua.epdc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* 积分模块
*
* @author zhangyong
* @date 2020/4/28
*/
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class PointsApplication {
public static void main(String[] args) {
SpringApplication.run(PointsApplication.class, args);
}
}

26
esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java

@ -0,0 +1,26 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.elink.esua.epdc.config;
import com.elink.esua.epdc.commons.tools.config.ModuleConfig;
import org.springframework.stereotype.Service;
/**
* 模块配置信息-积分模块
*
* @author zhangyong
* @since 1.0.0
*/
@Service
public class ModuleConfigImpl implements ModuleConfig {
@Override
public String getName() {
return "points";
}
}

94
esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/controller/PointsRuleController.java

@ -0,0 +1,94 @@
/**
* 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.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.PointsRuleDTO;
import com.elink.esua.epdc.excel.PointsRuleExcel;
import com.elink.esua.epdc.service.PointsRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 积分规则管理表 积分规则管理表
*
* @author zhangyong
* @since v1.0.0 2020-04-28
*/
@RestController
@RequestMapping("pointsrule")
public class PointsRuleController {
@Autowired
private PointsRuleService pointsRuleService;
@GetMapping("page")
public Result<PageData<PointsRuleDTO>> page(@RequestParam Map<String, Object> params){
PageData<PointsRuleDTO> page = pointsRuleService.page(params);
return new Result<PageData<PointsRuleDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<PointsRuleDTO> get(@PathVariable("id") String id){
PointsRuleDTO data = pointsRuleService.get(id);
return new Result<PointsRuleDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody PointsRuleDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
pointsRuleService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody PointsRuleDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
pointsRuleService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
pointsRuleService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<PointsRuleDTO> list = pointsRuleService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, PointsRuleExcel.class);
}
}

33
esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/dao/PointsRuleDao.java

@ -0,0 +1,33 @@
/**
* 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.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.PointsRuleEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 积分规则管理表 积分规则管理表
*
* @author zhangyong
* @since v1.0.0 2020-04-28
*/
@Mapper
public interface PointsRuleDao extends BaseDao<PointsRuleEntity> {
}

91
esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/entity/PointsRuleEntity.java

@ -0,0 +1,91 @@
/**
* 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.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 积分规则管理表 积分规则管理表
*
* @author zhangyong
* @since v1.0.0 2020-04-28
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_points_rule")
public class PointsRuleEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 积分规则编码
*/
private String ruleCode;
/**
* 动作编码
*/
private String behaviorCode;
/**
* 积分规则描述
*/
private String ruleDesc;
/**
* 规则操作类型 0-减积分1-加积分
*/
private String operationType;
/**
* 积分规则值
*/
private Integer points;
/**
* 上线统计指标 0-分钟1-小时2-3-4-
*/
private String limitType;
/**
* 积分上限值
*/
private Integer upperLimitVal;
/**
* 启用标识 0-1-
*/
private String enableFlag;
/**
* 附加值
*/
private String addedVal;
/**
* 备注
*/
private String remark;
}

86
esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/excel/PointsRuleExcel.java

@ -0,0 +1,86 @@
/**
* 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.elink.esua.epdc.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 积分规则管理表 积分规则管理表
*
* @author zhangyong
* @since v1.0.0 2020-04-28
*/
@Data
public class PointsRuleExcel {
@Excel(name = "ID")
private String id;
@Excel(name = "积分规则编码")
private String ruleCode;
@Excel(name = "动作编码")
private String behaviorCode;
@Excel(name = "积分规则描述")
private String ruleDesc;
@Excel(name = "规则操作类型 0-减积分,1-加积分")
private String operationType;
@Excel(name = "积分规则值")
private Integer points;
@Excel(name = "上线统计指标 0-分钟,1-小时,2-日,3-月,4-年")
private String limitType;
@Excel(name = "积分上限值")
private Integer upperLimitVal;
@Excel(name = "启用标识 0-否,1-是")
private String enableFlag;
@Excel(name = "附加值")
private String addedVal;
@Excel(name = "备注")
private String remark;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "删除标识 0-否,1-是")
private String delFlag;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

47
esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/redis/PointsRuleRedis.java

@ -0,0 +1,47 @@
/**
* 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.elink.esua.epdc.redis;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 积分规则管理表 积分规则管理表
*
* @author zhangyong
* @since v1.0.0 2020-04-28
*/
@Component
public class PointsRuleRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

95
esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/service/PointsRuleService.java

@ -0,0 +1,95 @@
/**
* 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.elink.esua.epdc.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.PointsRuleDTO;
import com.elink.esua.epdc.entity.PointsRuleEntity;
import java.util.List;
import java.util.Map;
/**
* 积分规则管理表 积分规则管理表
*
* @author zhangyong
* @since v1.0.0 2020-04-28
*/
public interface PointsRuleService extends BaseService<PointsRuleEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<PointsRuleDTO>
* @author generator
* @date 2020-04-28
*/
PageData<PointsRuleDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<PointsRuleDTO>
* @author generator
* @date 2020-04-28
*/
List<PointsRuleDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return PointsRuleDTO
* @author generator
* @date 2020-04-28
*/
PointsRuleDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-04-28
*/
void save(PointsRuleDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-04-28
*/
void update(PointsRuleDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-04-28
*/
void delete(String[] ids);
}

104
esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/service/impl/PointsRuleServiceImpl.java

@ -0,0 +1,104 @@
/**
* 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.elink.esua.epdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.dao.PointsRuleDao;
import com.elink.esua.epdc.dto.PointsRuleDTO;
import com.elink.esua.epdc.entity.PointsRuleEntity;
import com.elink.esua.epdc.redis.PointsRuleRedis;
import com.elink.esua.epdc.service.PointsRuleService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 积分规则管理表 积分规则管理表
*
* @author zhangyong
* @since v1.0.0 2020-04-28
*/
@Service
public class PointsRuleServiceImpl extends BaseServiceImpl<PointsRuleDao, PointsRuleEntity> implements PointsRuleService {
@Autowired
private PointsRuleRedis pointsRuleRedis;
@Override
public PageData<PointsRuleDTO> page(Map<String, Object> params) {
IPage<PointsRuleEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, PointsRuleDTO.class);
}
@Override
public List<PointsRuleDTO> list(Map<String, Object> params) {
List<PointsRuleEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, PointsRuleDTO.class);
}
private QueryWrapper<PointsRuleEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<PointsRuleEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public PointsRuleDTO get(String id) {
PointsRuleEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, PointsRuleDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(PointsRuleDTO dto) {
PointsRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointsRuleEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(PointsRuleDTO dto) {
PointsRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointsRuleEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

32
esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/application.yml

@ -4,6 +4,8 @@ server:
context-path: /points context-path: /points
spring: spring:
main:
allow-bean-definition-overriding: true
application: application:
name: epdc-points-server name: epdc-points-server
# 环境 dev|test|prod # 环境 dev|test|prod
@ -16,13 +18,12 @@ spring:
time-zone: GMT+8 time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
redis: redis:
database: @spring.redis.index@ database: @spring.redis.index@
host: @spring.redis.host@ host: @spring.redis.host@
timeout: 30s timeout: 30s
port: @spring.redis.port@ port: @spring.redis.port@
password: @spring.redis.password@ password: @spring.redis.password@
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid: druid:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: @spring.datasource.druid.url@ url: @spring.datasource.druid.url@
@ -35,14 +36,7 @@ spring:
register-enabled: @nacos.register-enabled@ register-enabled: @nacos.register-enabled@
alibaba: alibaba:
seata: seata:
tx-service-group: epdc-demo-server-fescar-service-group tx-service-group: epdc-points-server-fescar-service-group
zipkin:
# 指定了 zipkin 服务器的地址
base-url: http://localhost:9411
sleuth:
sampler:
# 将采样比例设置为 1.0,也就是全部都需要。默认是 0.1
probability: 1.0
management: management:
endpoints: endpoints:
@ -53,6 +47,24 @@ management:
health: health:
show-details: ALWAYS show-details: ALWAYS
feign:
hystrix:
enabled: true
httpclient:
enabled: true
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 60000 #缺省为1000
ribbon:
ReadTimeout: 300000
ConnectTimeout: 300000
mybatis-plus: mybatis-plus:
mapper-locations: classpath:/mapper/**/*.xml mapper-locations: classpath:/mapper/**/*.xml
#实体扫描,多个package用逗号或者分号分隔 #实体扫描,多个package用逗号或者分号分隔

27
esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/mapper/PointsRuleDao.xml

@ -0,0 +1,27 @@
<?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.elink.esua.epdc.dao.PointsRuleDao">
<resultMap type="com.elink.esua.epdc.entity.PointsRuleEntity" id="pointsRuleMap">
<result property="id" column="ID"/>
<result property="ruleCode" column="RULE_CODE"/>
<result property="behaviorCode" column="BEHAVIOR_CODE"/>
<result property="ruleDesc" column="RULE_DESC"/>
<result property="operationType" column="OPERATION_TYPE"/>
<result property="points" column="POINTS"/>
<result property="limitType" column="LIMIT_TYPE"/>
<result property="upperLimitVal" column="UPPER_LIMIT_VAL"/>
<result property="enableFlag" column="ENABLE_FLAG"/>
<result property="addedVal" column="ADDED_VAL"/>
<result property="remark" column="REMARK"/>
<result property="revision" column="REVISION"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>
Loading…
Cancel
Save