From ec3575928a883b000a75750a6895679333c8f99f Mon Sep 17 00:00:00 2001 From: yujt Date: Wed, 9 Sep 2020 09:23:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=A7=AF=E5=88=86=E5=9F=8B?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epdc-cloud-user/pom.xml | 15 ++- .../controller/PointsGradeController.java | 94 ++++++++++++++++ .../esua/epdc/controller/UserController.java | 49 +++++++++ .../UserGridRelationController.java | 38 ++++++- .../elink/esua/epdc/dao/PointsGradeDao.java | 33 ++++++ .../esua/epdc/dao/UserGridRelationDao.java | 20 ++-- .../esua/epdc/entity/PointsGradeEntity.java | 53 +++++++++ .../elink/esua/epdc/entity/UserEntity.java | 5 + .../esua/epdc/excel/PointsGradeExcel.java | 65 +++++++++++ .../esua/epdc/redis/PointsGradeRedis.java | 47 ++++++++ .../esua/epdc/service/PointsGradeService.java | 95 ++++++++++++++++ .../epdc/service/UserGridRelationService.java | 15 ++- .../service/impl/PointsGradeServiceImpl.java | 104 ++++++++++++++++++ .../impl/UserGridRelationServiceImpl.java | 12 +- .../src/main/resources/application.yml | 4 + .../src/main/resources/mapper/UserDao.xml | 8 +- .../resources/mapper/UserGridRelationDao.xml | 18 +++ 17 files changed, 652 insertions(+), 23 deletions(-) create mode 100644 epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/PointsGradeController.java create mode 100644 epdc-cloud-user/src/main/java/com/elink/esua/epdc/dao/PointsGradeDao.java create mode 100644 epdc-cloud-user/src/main/java/com/elink/esua/epdc/entity/PointsGradeEntity.java create mode 100644 epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/PointsGradeExcel.java create mode 100644 epdc-cloud-user/src/main/java/com/elink/esua/epdc/redis/PointsGradeRedis.java create mode 100644 epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/PointsGradeService.java create mode 100644 epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/PointsGradeServiceImpl.java diff --git a/epdc-cloud-user/pom.xml b/epdc-cloud-user/pom.xml index f362e7b..42e363c 100644 --- a/epdc-cloud-user/pom.xml +++ b/epdc-cloud-user/pom.xml @@ -82,6 +82,12 @@ ${epdc-cloud-commons.version} + + + com.esua.epdc.yushan + epdc-commons-points-tools + 1.0.0 + @@ -171,8 +177,10 @@ 6a3577b4-7b79-43f6-aebb-9c3f31263f6a - 47.104.85.99:9876;114.215.125.123:9876 + 47.104.85.99:9876 organizationGroup + yushan-pointsGroup + yushan-pointsGroup @@ -209,6 +217,9 @@ 47.104.85.99:9876 organizationGroup + yushan-pointsGroup + yushan-pointsGroup + @@ -244,6 +255,8 @@ 172.16.1.242:9876;172.16.1.243:9876 organizationGroup + yushan-pointsGroup + yushan-pointsGroup diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/PointsGradeController.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/PointsGradeController.java new file mode 100644 index 0000000..c52e97a --- /dev/null +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/PointsGradeController.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.DefaultGroup; +import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.dto.PointsGradeDTO; +import com.elink.esua.epdc.excel.PointsGradeExcel; +import com.elink.esua.epdc.service.PointsGradeService; +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-29 + */ +@RestController +@RequestMapping("pointsgrade") +public class PointsGradeController { + + @Autowired + private PointsGradeService pointsGradeService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = pointsGradeService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PointsGradeDTO data = pointsGradeService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody PointsGradeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + pointsGradeService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody PointsGradeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + pointsGradeService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + pointsGradeService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = pointsGradeService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PointsGradeExcel.class); + } + +} diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserController.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserController.java index f479fea..bf38abb 100644 --- a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserController.java +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserController.java @@ -18,6 +18,7 @@ package com.elink.esua.epdc.controller; import com.elink.esua.epdc.commons.mybatis.annotation.DataFilter; +import com.elink.esua.epdc.commons.tools.enums.BehaviorEnum; 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; @@ -31,6 +32,7 @@ import com.elink.esua.epdc.dto.UserDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcUserPointsFormDTO; import com.elink.esua.epdc.enums.AppUserStatesEnum; import com.elink.esua.epdc.excel.*; +import com.elink.esua.epdc.pointcommons.tools.annotation.RecordUserBehavior; import com.elink.esua.epdc.service.UserService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -128,6 +130,40 @@ public class UserController { return new Result(); } + /** + * 审核 - 通过 + * + * @param dto + * @return + */ + @PostMapping("auditPass") + @RecordUserBehavior(behavior = BehaviorEnum.RESIDENT_AUDIT_PASS, referenceId = "#{dto.getId}", userId = "#{dto.getId}") + public Result auditPass(@RequestBody UserDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + + userService.audit(dto); + + return new Result(); + } + + /** + * 审核 - 不通过 + * + * @param dto + * @return + */ + @PostMapping("auditNoPass") + @RecordUserBehavior(behavior = BehaviorEnum.RESIDENT_AUDIT_NO_PASS, referenceId = "#{dto.getId}", userId = "#{dto.getId}") + public Result auditNoPass(@RequestBody UserDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + + userService.audit(dto); + + return new Result(); + } + /** * 党员认证 * @@ -176,6 +212,19 @@ public class UserController { return userService.addPartyInfo(dto); } + /** + * @return void + * @Description 完善党员信息加积分 + * @Author songyunpeng + * @Date 2020/6/24 + * @Param [dto] + **/ + @PostMapping("addPerfectPoints") + @RecordUserBehavior(behavior = BehaviorEnum.PERFECT_PARTY_INFO, referenceId = "#{dto.getUserId}", userId = "#{dto.getUserId}") + public Result addPerfectPoints(@RequestBody UserDTO dto) { + return new Result(); + } + @DeleteMapping public Result delete(@RequestBody String[] ids) { //效验数据 diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserGridRelationController.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserGridRelationController.java index a4ca83a..b04c8d1 100644 --- a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserGridRelationController.java +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserGridRelationController.java @@ -47,19 +47,19 @@ public class UserGridRelationController { private UserGridRelationService userGridRelationService; @GetMapping("page") - public Result> page(@RequestParam Map params){ + public Result> page(@RequestParam Map params) { PageData page = userGridRelationService.page(params); return new Result>().ok(page); } @GetMapping("{id}") - public Result get(@PathVariable("id") String id){ + public Result get(@PathVariable("id") String id) { UserGridRelationDTO data = userGridRelationService.get(id); return new Result().ok(data); } @PostMapping - public Result save(@RequestBody UserGridRelationDTO dto){ + public Result save(@RequestBody UserGridRelationDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); userGridRelationService.save(dto); @@ -67,7 +67,7 @@ public class UserGridRelationController { } @PutMapping - public Result update(@RequestBody UserGridRelationDTO dto){ + public Result update(@RequestBody UserGridRelationDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); userGridRelationService.update(dto); @@ -75,7 +75,7 @@ public class UserGridRelationController { } @DeleteMapping - public Result delete(@RequestBody String[] ids){ + public Result delete(@RequestBody String[] ids) { //效验数据 AssertUtils.isArrayEmpty(ids, "id"); userGridRelationService.delete(ids); @@ -84,7 +84,7 @@ public class UserGridRelationController { @GetMapping("listUserGrid/{userId}") - public Result> listUserGrid(@PathVariable("userId") String userId){ + public Result> listUserGrid(@PathVariable("userId") String userId) { List data = userGridRelationService.listUserGrid(userId); return new Result>().ok(data); } @@ -102,4 +102,30 @@ public class UserGridRelationController { return new Result(); } + /** + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @Description 获取用户最后一次切换网格信息 + * @Author songyunpeng + * @Date 2020/5/14 + * @Param [userId] + **/ + @GetMapping("getUserLastSwitchGird/{userId}") + public Result getUserLastSwitchGird(@PathVariable("userId") String userId) { + UserGridRelationDTO data = userGridRelationService.getUserLastSwitchGird(userId); + return new Result().ok(data); + } + + /** + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @Description 获取用户第一次扫码网格的信息 + * @Author songyunpeng + * @Date 2020/6/2 + * @Param [userId] + **/ + @GetMapping("getUserFirstScanGird/{userId}") + public Result getUserFirstScanGird(@PathVariable("userId") String userId) { + UserGridRelationDTO data = userGridRelationService.getUserFirstScanGird(userId); + return new Result().ok(data); + } + } diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/dao/PointsGradeDao.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/dao/PointsGradeDao.java new file mode 100644 index 0000000..e781c8c --- /dev/null +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/dao/PointsGradeDao.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.PointsGradeEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * + * + * @author zhangyong + * @since v1.0.0 2020-04-29 + */ +@Mapper +public interface PointsGradeDao extends BaseDao { + +} \ No newline at end of file diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/dao/UserGridRelationDao.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/dao/UserGridRelationDao.java index cb3a404..c390766 100644 --- a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/dao/UserGridRelationDao.java +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/dao/UserGridRelationDao.java @@ -27,7 +27,7 @@ import java.util.List; /** * 网格长与网格关系表 * - * @author work@yujt.net.cn + * @author work@yujt.net.cn * @since v1.0.0 2019-10-23 */ @Mapper @@ -35,33 +35,39 @@ public interface UserGridRelationDao extends BaseDao { /** - * * 获取用户最后一次切换的网格信息 * - * @params [userId] * @return com.elink.esua.epdc.dto.UserGridRelationDTO + * @params [userId] * @author liuchuang * @since 2019/12/6 10:45 */ UserGridRelationDTO selectOneOfGird(String userId); /** - * + * @return com.elink.esua.epdc.dto.UserGridRelationDTO + * @Description 获取用户第一次扫码网格的信息 + * @Author songyunpeng + * @Date 2020/6/2 + * @Param [userId] + **/ + UserGridRelationDTO getUserFirstScanGrid(String userId); + + /** * 查询需要修改的组织机构信息 * - * @params [deptId] * @return java.util.List + * @params [deptId] * @author liuchuang * @since 2020/3/7 15:31 */ List selectListOfOrganizationInfo(String deptId); /** - * * 更新网格名称 * - * @params [newDeptName, deptId] * @return void + * @params [newDeptName, deptId] * @author liuchuang * @since 2020/3/7 1:20 */ diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/entity/PointsGradeEntity.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/entity/PointsGradeEntity.java new file mode 100644 index 0000000..5318c91 --- /dev/null +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/entity/PointsGradeEntity.java @@ -0,0 +1,53 @@ +/** + * 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; + +/** + * + * + * @author zhangyong + * @since v1.0.0 2020-04-29 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_points_grade") +public class PointsGradeEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 等级系数 + */ + private Integer grade; + + /** + * 积分系数 + */ + private Integer points; + + /** + * 备注 + */ + private String remark; + +} \ No newline at end of file diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/entity/UserEntity.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/entity/UserEntity.java index c239e7c..88c023e 100644 --- a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/entity/UserEntity.java +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/entity/UserEntity.java @@ -204,6 +204,11 @@ public class UserEntity extends DeptScope { */ private Integer points; + /** + * 用户累计积分 + */ + private Integer pointsTotle; + /** * 邀请人ID */ diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/PointsGradeExcel.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/PointsGradeExcel.java new file mode 100644 index 0000000..921aed6 --- /dev/null +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/PointsGradeExcel.java @@ -0,0 +1,65 @@ +/** + * 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-29 + */ +@Data +public class PointsGradeExcel { + + @Excel(name = "ID") + private String id; + + @Excel(name = "等级系数") + private Integer grade; + + @Excel(name = "积分系数") + private Integer points; + + @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/epdc-cloud-user/src/main/java/com/elink/esua/epdc/redis/PointsGradeRedis.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/redis/PointsGradeRedis.java new file mode 100644 index 0000000..87807f7 --- /dev/null +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/redis/PointsGradeRedis.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-29 + */ +@Component +public class PointsGradeRedis { + @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/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/PointsGradeService.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/PointsGradeService.java new file mode 100644 index 0000000..d8e4933 --- /dev/null +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/PointsGradeService.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.PointsGradeDTO; +import com.elink.esua.epdc.entity.PointsGradeEntity; + +import java.util.List; +import java.util.Map; + +/** + * + * + * @author zhangyong + * @since v1.0.0 2020-04-29 + */ +public interface PointsGradeService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-29 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-29 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PointsGradeDTO + * @author generator + * @date 2020-04-29 + */ + PointsGradeDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-29 + */ + void save(PointsGradeDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-29 + */ + void update(PointsGradeDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-29 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/UserGridRelationService.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/UserGridRelationService.java index c400974..591c438 100644 --- a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/UserGridRelationService.java +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/UserGridRelationService.java @@ -168,24 +168,31 @@ public interface UserGridRelationService extends BaseService + * 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.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.dao.PointsGradeDao; +import com.elink.esua.epdc.dto.PointsGradeDTO; +import com.elink.esua.epdc.entity.PointsGradeEntity; +import com.elink.esua.epdc.redis.PointsGradeRedis; +import com.elink.esua.epdc.service.PointsGradeService; +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-29 + */ +@Service +public class PointsGradeServiceImpl extends BaseServiceImpl implements PointsGradeService { + + @Autowired + private PointsGradeRedis pointsGradeRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PointsGradeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PointsGradeDTO.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 PointsGradeDTO get(String id) { + PointsGradeEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PointsGradeDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PointsGradeDTO dto) { + PointsGradeEntity entity = ConvertUtils.sourceToTarget(dto, PointsGradeEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PointsGradeDTO dto) { + PointsGradeEntity entity = ConvertUtils.sourceToTarget(dto, PointsGradeEntity.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/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/UserGridRelationServiceImpl.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/UserGridRelationServiceImpl.java index 76a9763..5d61cc3 100644 --- a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/UserGridRelationServiceImpl.java +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/UserGridRelationServiceImpl.java @@ -134,7 +134,7 @@ public class UserGridRelationServiceImpl extends BaseServiceImpl> listUserGridForApi(String userId) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq(UserFieldConsant.USER_ID, userId) - .orderByDesc(UserFieldConsant.SWITCHED_TIME); + .orderByDesc(UserFieldConsant.SWITCHED_TIME); List entityList = this.baseDao.selectList(queryWrapper); for (UserGridRelationEntity userGridRelationEntity : entityList) { String allDeptNames = userGridRelationEntity.getAllDeptNames(); @@ -217,6 +217,11 @@ public class UserGridRelationServiceImpl extends BaseServiceImpl + * @params [dto, gridList] * @author liuchuang * @since 2020/3/7 15:25 */ private List handleOrganizationInfo(OrganizationModifyDTO dto, List gridList) { List entities = new ArrayList<>(); - for (UserGridRelationDTO grid: gridList) { + for (UserGridRelationDTO grid : gridList) { UserGridRelationEntity entity = new UserGridRelationEntity(); if (StringUtils.isNotEmpty(grid.getParentDeptIds()) && StringUtils.isNotEmpty(grid.getParentDeptNames())) { List parentDeptIds = Arrays.asList(grid.getParentDeptIds().split(",")); diff --git a/epdc-cloud-user/src/main/resources/application.yml b/epdc-cloud-user/src/main/resources/application.yml index d973bb3..577ac1a 100644 --- a/epdc-cloud-user/src/main/resources/application.yml +++ b/epdc-cloud-user/src/main/resources/application.yml @@ -118,3 +118,7 @@ rocketmq: name-server: @rocketmq.name.server@ consumer: group: @rocketmq.consumer.group@ + points-group: @rocketmq.consumer.points.group@ + producer: + group: @rocketmq.producer.group@ + diff --git a/epdc-cloud-user/src/main/resources/mapper/UserDao.xml b/epdc-cloud-user/src/main/resources/mapper/UserDao.xml index b9f9a3d..0f639e1 100644 --- a/epdc-cloud-user/src/main/resources/mapper/UserDao.xml +++ b/epdc-cloud-user/src/main/resources/mapper/UserDao.xml @@ -19,7 +19,13 @@ eu.ROAD AS road, eu.VILLAGE_NAME AS villageName, eu.DWELLING_PLACE AS dwellingPlace, - eu.PARTY_FLAG AS partyFlag + eu.PARTY_FLAG AS partyFlag, + eu.POINTS as points, + CASE + WHEN IFNULL(eu.POINTS_TOTLE,0) <= 0 THEN 0 + ELSE + IFNULL(FLOOR(IFNULL(eu.POINTS_TOTLE,0) / IFNULL(g.POINTS,0) * IFNULL(g.GRADE,0)),0) + END grade FROM epdc_user eu Left Join (select * from epdc_user_grid_relation where USER_ID = #{id} order by UPDATED_TIME desc limit 0,1) eugr diff --git a/epdc-cloud-user/src/main/resources/mapper/UserGridRelationDao.xml b/epdc-cloud-user/src/main/resources/mapper/UserGridRelationDao.xml index 722d56e..43049cb 100644 --- a/epdc-cloud-user/src/main/resources/mapper/UserGridRelationDao.xml +++ b/epdc-cloud-user/src/main/resources/mapper/UserGridRelationDao.xml @@ -33,4 +33,22 @@ UPDATE epdc_user_grid_relation SET GRID = #{newDeptName}, UPDATED_TIME = NOW() WHERE GRID_ID = #{deptId} + \ No newline at end of file