diff --git a/esua-epdc/epdc-gateway/pom.xml b/esua-epdc/epdc-gateway/pom.xml index 77dd36d7..07ad9277 100644 --- a/esua-epdc/epdc-gateway/pom.xml +++ b/esua-epdc/epdc-gateway/pom.xml @@ -131,6 +131,8 @@ lb://epdc-kpi-server lb://epdc-custom-server + + http://127.0.0.1:9070 false 47.104.224.45:8848 diff --git a/esua-epdc/epdc-gateway/src/main/resources/application.yml b/esua-epdc/epdc-gateway/src/main/resources/application.yml index a0e3c6dc..f9f48baa 100644 --- a/esua-epdc/epdc-gateway/src/main/resources/application.yml +++ b/esua-epdc/epdc-gateway/src/main/resources/application.yml @@ -165,6 +165,14 @@ spring: - Path=${server.servlet.context-path}/custom/** filters: - 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: discovery: server-addr: @nacos.server-addr@ diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/dto/PointsRuleDTO.java b/esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/dto/PointsRuleDTO.java new file mode 100644 index 00000000..e17bed62 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/pom.xml b/esua-epdc/epdc-module/epdc-points/epdc-points-server/pom.xml index 26417c77..023782fd 100644 --- a/esua-epdc/epdc-module/epdc-points/epdc-points-server/pom.xml +++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/pom.xml @@ -91,6 +91,120 @@ dockerfile-maven-plugin + + + ${project.basedir}/src/main/java + + + true + ${basedir}/src/main/resources + + **/application*.yml + **/*.properties + logback-spring.xml + registry.conf + + + + ${basedir}/src/main/resources + + **/application*.yml + **/*.properties + logback-spring.xml + registry.conf + + + + + + dev + + true + + + dev + + 9070 + + 2 + 114.215.125.123 + 9603 + epdc!redis@master1405 + + + + + jinshui + jinshui@833066 + + false + 47.104.224.45:8848 + + fa5bf520-09c1-410c-a876-28e98c0534d3 + + 47.104.85.99:9876;114.215.125.123:9876 + jinshui-organizationGroup + + + + + test + + test + + 11011 + + 2 + 114.215.125.123 + 9603 + epdc!redis@master1405 + + + + + jinshui + jinshui@833066 + + true + 47.104.224.45:8848 + 219.146.91.110 + fa5bf520-09c1-410c-a876-28e98c0534d3 + + 47.104.85.99:9876;114.215.125.123:9876 + jinshui-organizationGroup + + + + + prod + + prod + prod + + 9070 + + + 0 + 172.19.0.11 + 6379 + epdc!redis@master1405 + + + true + 172.20.0.4:80 + + + + + epdc + Elink@833066 + + + 172.16.0.7:9876;172.16.0.8:9876 + jinshui-organizationGroup + + + diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/PointsApplication.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/PointsApplication.java new file mode 100644 index 00000000..0fcc2e9a --- /dev/null +++ b/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. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +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); + } + +} diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java new file mode 100644 index 00000000..845bde19 --- /dev/null +++ b/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. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +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"; + } +} diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/controller/PointsRuleController.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/controller/PointsRuleController.java new file mode 100644 index 00000000..cb35026c --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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> page(@RequestParam Map params){ + PageData page = pointsRuleService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PointsRuleDTO data = pointsRuleService.get(id); + return new Result().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 params, HttpServletResponse response) throws Exception { + List list = pointsRuleService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PointsRuleExcel.class); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/dao/PointsRuleDao.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/dao/PointsRuleDao.java new file mode 100644 index 00000000..9daa4f2b --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/entity/PointsRuleEntity.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/entity/PointsRuleEntity.java new file mode 100644 index 00000000..aaa32d2d --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/excel/PointsRuleExcel.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/excel/PointsRuleExcel.java new file mode 100644 index 00000000..4bae61df --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/redis/PointsRuleRedis.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/redis/PointsRuleRedis.java new file mode 100644 index 00000000..4488fd27 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/service/PointsRuleService.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/service/PointsRuleService.java new file mode 100644 index 00000000..edbbb319 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-28 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-28 + */ + List list(Map 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); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/service/impl/PointsRuleServiceImpl.java b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/service/impl/PointsRuleServiceImpl.java new file mode 100644 index 00000000..2f03fca6 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 implements PointsRuleService { + + @Autowired + private PointsRuleRedis pointsRuleRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PointsRuleDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PointsRuleDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper 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)); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/application.yml b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/application.yml index ac723019..f8b73686 100644 --- a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/application.yml +++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/application.yml @@ -4,6 +4,8 @@ server: context-path: /points spring: + main: + allow-bean-definition-overriding: true application: name: epdc-points-server # 环境 dev|test|prod @@ -16,13 +18,12 @@ spring: time-zone: GMT+8 date-format: yyyy-MM-dd HH:mm:ss redis: - database: @spring.redis.index@ + database: @spring.redis.index@ host: @spring.redis.host@ timeout: 30s port: @spring.redis.port@ password: @spring.redis.password@ datasource: - type: com.alibaba.druid.pool.DruidDataSource druid: driver-class-name: com.mysql.cj.jdbc.Driver url: @spring.datasource.druid.url@ @@ -35,14 +36,7 @@ spring: register-enabled: @nacos.register-enabled@ alibaba: seata: - tx-service-group: epdc-demo-server-fescar-service-group - zipkin: - # 指定了 zipkin 服务器的地址 - base-url: http://localhost:9411 - sleuth: - sampler: - # 将采样比例设置为 1.0,也就是全部都需要。默认是 0.1 - probability: 1.0 + tx-service-group: epdc-points-server-fescar-service-group management: endpoints: @@ -53,6 +47,24 @@ management: health: 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: mapper-locations: classpath:/mapper/**/*.xml #实体扫描,多个package用逗号或者分号分隔 diff --git a/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/mapper/PointsRuleDao.xml b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/mapper/PointsRuleDao.xml new file mode 100644 index 00000000..eaa69db8 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/mapper/PointsRuleDao.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file