Browse Source

新增积分埋点

master
yujt 5 years ago
parent
commit
ec3575928a
  1. 15
      epdc-cloud-user/pom.xml
  2. 94
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/PointsGradeController.java
  3. 49
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserController.java
  4. 26
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserGridRelationController.java
  5. 33
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/dao/PointsGradeDao.java
  6. 18
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/dao/UserGridRelationDao.java
  7. 53
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/entity/PointsGradeEntity.java
  8. 5
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/entity/UserEntity.java
  9. 65
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/PointsGradeExcel.java
  10. 47
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/redis/PointsGradeRedis.java
  11. 95
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/PointsGradeService.java
  12. 15
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/UserGridRelationService.java
  13. 104
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/PointsGradeServiceImpl.java
  14. 8
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/UserGridRelationServiceImpl.java
  15. 4
      epdc-cloud-user/src/main/resources/application.yml
  16. 8
      epdc-cloud-user/src/main/resources/mapper/UserDao.xml
  17. 18
      epdc-cloud-user/src/main/resources/mapper/UserGridRelationDao.xml

15
epdc-cloud-user/pom.xml

@ -82,6 +82,12 @@
<version>${epdc-cloud-commons.version}</version> <version>${epdc-cloud-commons.version}</version>
</dependency> </dependency>
<!-- commons end --> <!-- commons end -->
<dependency>
<groupId>com.esua.epdc.yushan</groupId>
<artifactId>epdc-commons-points-tools</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -171,8 +177,10 @@
<nacos.ip></nacos.ip> <nacos.ip></nacos.ip>
<nacos.namespace>6a3577b4-7b79-43f6-aebb-9c3f31263f6a</nacos.namespace> <nacos.namespace>6a3577b4-7b79-43f6-aebb-9c3f31263f6a</nacos.namespace>
<!--RocketMQ--> <!--RocketMQ-->
<rocketmq.name.server>47.104.85.99:9876;114.215.125.123:9876</rocketmq.name.server> <rocketmq.name.server>47.104.85.99:9876</rocketmq.name.server>
<rocketmq.consumer.group>organizationGroup</rocketmq.consumer.group> <rocketmq.consumer.group>organizationGroup</rocketmq.consumer.group>
<rocketmq.producer.group>yushan-pointsGroup</rocketmq.producer.group>
<rocketmq.consumer.points.group>yushan-pointsGroup</rocketmq.consumer.points.group>
</properties> </properties>
</profile> </profile>
@ -209,6 +217,9 @@
<!--RocketMQ--> <!--RocketMQ-->
<rocketmq.name.server>47.104.85.99:9876</rocketmq.name.server> <rocketmq.name.server>47.104.85.99:9876</rocketmq.name.server>
<rocketmq.consumer.group>organizationGroup</rocketmq.consumer.group> <rocketmq.consumer.group>organizationGroup</rocketmq.consumer.group>
<rocketmq.producer.group>yushan-pointsGroup</rocketmq.producer.group>
<rocketmq.consumer.points.group>yushan-pointsGroup</rocketmq.consumer.points.group>
</properties> </properties>
</profile> </profile>
@ -244,6 +255,8 @@
<!--RocketMQ--> <!--RocketMQ-->
<rocketmq.name.server>172.16.1.242:9876;172.16.1.243:9876</rocketmq.name.server> <rocketmq.name.server>172.16.1.242:9876;172.16.1.243:9876</rocketmq.name.server>
<rocketmq.consumer.group>organizationGroup</rocketmq.consumer.group> <rocketmq.consumer.group>organizationGroup</rocketmq.consumer.group>
<rocketmq.producer.group>yushan-pointsGroup</rocketmq.producer.group>
<rocketmq.consumer.points.group>yushan-pointsGroup</rocketmq.consumer.points.group>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>

94
epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/PointsGradeController.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.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<PageData<PointsGradeDTO>> page(@RequestParam Map<String, Object> params){
PageData<PointsGradeDTO> page = pointsGradeService.page(params);
return new Result<PageData<PointsGradeDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<PointsGradeDTO> get(@PathVariable("id") String id){
PointsGradeDTO data = pointsGradeService.get(id);
return new Result<PointsGradeDTO>().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<String, Object> params, HttpServletResponse response) throws Exception {
List<PointsGradeDTO> list = pointsGradeService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, PointsGradeExcel.class);
}
}

49
epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserController.java

@ -18,6 +18,7 @@
package com.elink.esua.epdc.controller; package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.mybatis.annotation.DataFilter; 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.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; 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.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.dto.epdc.form.EpdcUserPointsFormDTO;
import com.elink.esua.epdc.enums.AppUserStatesEnum; import com.elink.esua.epdc.enums.AppUserStatesEnum;
import com.elink.esua.epdc.excel.*; import com.elink.esua.epdc.excel.*;
import com.elink.esua.epdc.pointcommons.tools.annotation.RecordUserBehavior;
import com.elink.esua.epdc.service.UserService; import com.elink.esua.epdc.service.UserService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -128,6 +130,40 @@ public class UserController {
return new Result(); 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 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 @DeleteMapping
public Result delete(@RequestBody String[] ids) { public Result delete(@RequestBody String[] ids) {
//效验数据 //效验数据

26
epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserGridRelationController.java

@ -102,4 +102,30 @@ public class UserGridRelationController {
return new Result(); return new Result();
} }
/**
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.UserGridRelationDTO>
* @Description 获取用户最后一次切换网格信息
* @Author songyunpeng
* @Date 2020/5/14
* @Param [userId]
**/
@GetMapping("getUserLastSwitchGird/{userId}")
public Result<UserGridRelationDTO> getUserLastSwitchGird(@PathVariable("userId") String userId) {
UserGridRelationDTO data = userGridRelationService.getUserLastSwitchGird(userId);
return new Result<UserGridRelationDTO>().ok(data);
}
/**
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.UserGridRelationDTO>
* @Description 获取用户第一次扫码网格的信息
* @Author songyunpeng
* @Date 2020/6/2
* @Param [userId]
**/
@GetMapping("getUserFirstScanGird/{userId}")
public Result<UserGridRelationDTO> getUserFirstScanGird(@PathVariable("userId") String userId) {
UserGridRelationDTO data = userGridRelationService.getUserFirstScanGird(userId);
return new Result<UserGridRelationDTO>().ok(data);
}
} }

33
epdc-cloud-user/src/main/java/com/elink/esua/epdc/dao/PointsGradeDao.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.PointsGradeEntity;
import org.apache.ibatis.annotations.Mapper;
/**
*
*
* @author zhangyong
* @since v1.0.0 2020-04-29
*/
@Mapper
public interface PointsGradeDao extends BaseDao<PointsGradeEntity> {
}

18
epdc-cloud-user/src/main/java/com/elink/esua/epdc/dao/UserGridRelationDao.java

@ -35,33 +35,39 @@ public interface UserGridRelationDao extends BaseDao<UserGridRelationEntity> {
/** /**
*
* 获取用户最后一次切换的网格信息 * 获取用户最后一次切换的网格信息
* *
* @params [userId]
* @return com.elink.esua.epdc.dto.UserGridRelationDTO * @return com.elink.esua.epdc.dto.UserGridRelationDTO
* @params [userId]
* @author liuchuang * @author liuchuang
* @since 2019/12/6 10:45 * @since 2019/12/6 10:45
*/ */
UserGridRelationDTO selectOneOfGird(String userId); 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<com.elink.esua.epdc.dto.UserGridRelationDTO> * @return java.util.List<com.elink.esua.epdc.dto.UserGridRelationDTO>
* @params [deptId]
* @author liuchuang * @author liuchuang
* @since 2020/3/7 15:31 * @since 2020/3/7 15:31
*/ */
List<UserGridRelationDTO> selectListOfOrganizationInfo(String deptId); List<UserGridRelationDTO> selectListOfOrganizationInfo(String deptId);
/** /**
*
* 更新网格名称 * 更新网格名称
* *
* @params [newDeptName, deptId]
* @return void * @return void
* @params [newDeptName, deptId]
* @author liuchuang * @author liuchuang
* @since 2020/3/7 1:20 * @since 2020/3/7 1:20
*/ */

53
epdc-cloud-user/src/main/java/com/elink/esua/epdc/entity/PointsGradeEntity.java

@ -0,0 +1,53 @@
/**
* 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;
/**
*
*
* @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;
}

5
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 points;
/**
* 用户累计积分
*/
private Integer pointsTotle;
/** /**
* 邀请人ID * 邀请人ID
*/ */

65
epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/PointsGradeExcel.java

@ -0,0 +1,65 @@
/**
* 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-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;
}

47
epdc-cloud-user/src/main/java/com/elink/esua/epdc/redis/PointsGradeRedis.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-29
*/
@Component
public class PointsGradeRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

95
epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/PointsGradeService.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.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<PointsGradeEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<PointsGradeDTO>
* @author generator
* @date 2020-04-29
*/
PageData<PointsGradeDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<PointsGradeDTO>
* @author generator
* @date 2020-04-29
*/
List<PointsGradeDTO> list(Map<String, Object> 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);
}

15
epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/UserGridRelationService.java

@ -168,24 +168,31 @@ public interface UserGridRelationService extends BaseService<UserGridRelationEnt
Result removeGrid(EpdcAppRemoveGridFormDTO formDto); Result removeGrid(EpdcAppRemoveGridFormDTO formDto);
/** /**
*
* 获取用户最后一次切换的网格信息 * 获取用户最后一次切换的网格信息
* *
* @params [userId]
* @return com.elink.esua.epdc.dto.UserGridRelationDTO * @return com.elink.esua.epdc.dto.UserGridRelationDTO
* @params [userId]
* @author liuchuang * @author liuchuang
* @since 2019/12/6 10:47 * @since 2019/12/6 10:47
*/ */
UserGridRelationDTO getUserLastSwitchGird(String userId); UserGridRelationDTO getUserLastSwitchGird(String userId);
/** /**
*
* 事件修改组织机构信息 * 事件修改组织机构信息
* *
* @params [dto]
* @return void * @return void
* @params [dto]
* @author liuchuang * @author liuchuang
* @since 2020/3/7 1:23 * @since 2020/3/7 1:23
*/ */
void modifyOrganizationInfo(OrganizationModifyDTO dto); void modifyOrganizationInfo(OrganizationModifyDTO dto);
/**
* @return com.elink.esua.epdc.dto.UserGridRelationDTO
* @Description 获取用户第一次扫码网格的信息
* @Author songyunpeng
* @Date 2020/6/2
* @Param [userId]
**/
UserGridRelationDTO getUserFirstScanGird(String userId);
} }

104
epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/PointsGradeServiceImpl.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.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<PointsGradeDao, PointsGradeEntity> implements PointsGradeService {
@Autowired
private PointsGradeRedis pointsGradeRedis;
@Override
public PageData<PointsGradeDTO> page(Map<String, Object> params) {
IPage<PointsGradeEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, PointsGradeDTO.class);
}
@Override
public List<PointsGradeDTO> list(Map<String, Object> params) {
List<PointsGradeEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, PointsGradeDTO.class);
}
private QueryWrapper<PointsGradeEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<PointsGradeEntity> 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));
}
}

8
epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/UserGridRelationServiceImpl.java

@ -217,6 +217,11 @@ public class UserGridRelationServiceImpl extends BaseServiceImpl<UserGridRelatio
return baseDao.selectOneOfGird(userId); return baseDao.selectOneOfGird(userId);
} }
@Override
public UserGridRelationDTO getUserFirstScanGird(String userId) {
return baseDao.getUserFirstScanGrid(userId);
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void modifyOrganizationInfo(OrganizationModifyDTO dto) { public void modifyOrganizationInfo(OrganizationModifyDTO dto) {
@ -234,11 +239,10 @@ public class UserGridRelationServiceImpl extends BaseServiceImpl<UserGridRelatio
} }
/** /**
*
* 组织机构信息处理 * 组织机构信息处理
* *
* @params [dto, gridList]
* @return java.util.List<com.elink.esua.epdc.entity.UserGridRelationEntity> * @return java.util.List<com.elink.esua.epdc.entity.UserGridRelationEntity>
* @params [dto, gridList]
* @author liuchuang * @author liuchuang
* @since 2020/3/7 15:25 * @since 2020/3/7 15:25
*/ */

4
epdc-cloud-user/src/main/resources/application.yml

@ -118,3 +118,7 @@ rocketmq:
name-server: @rocketmq.name.server@ name-server: @rocketmq.name.server@
consumer: consumer:
group: @rocketmq.consumer.group@ group: @rocketmq.consumer.group@
points-group: @rocketmq.consumer.points.group@
producer:
group: @rocketmq.producer.group@

8
epdc-cloud-user/src/main/resources/mapper/UserDao.xml

@ -19,7 +19,13 @@
eu.ROAD AS road, eu.ROAD AS road,
eu.VILLAGE_NAME AS villageName, eu.VILLAGE_NAME AS villageName,
eu.DWELLING_PLACE AS dwellingPlace, 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) &lt;= 0 THEN 0
ELSE
IFNULL(FLOOR(IFNULL(eu.POINTS_TOTLE,0) / IFNULL(g.POINTS,0) * IFNULL(g.GRADE,0)),0)
END grade
FROM FROM
epdc_user eu epdc_user eu
Left Join (select * from epdc_user_grid_relation where USER_ID = #{id} order by UPDATED_TIME desc limit 0,1) eugr Left Join (select * from epdc_user_grid_relation where USER_ID = #{id} order by UPDATED_TIME desc limit 0,1) eugr

18
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} UPDATE epdc_user_grid_relation SET GRID = #{newDeptName}, UPDATED_TIME = NOW() WHERE GRID_ID = #{deptId}
</update> </update>
<select id="getUserFirstScanGrid" resultType="com.elink.esua.epdc.dto.UserGridRelationDTO">
SELECT
ID,
GRID,
GRID_ID,
PARENT_DEPT_IDS,
PARENT_DEPT_NAMES,
ALL_DEPT_IDS,
ALL_DEPT_NAMES
FROM
`epdc_user_grid_relation`
WHERE
USER_ID = #{userId}
AND DEL_FLAG = '0'
ORDER BY
CREATED_TIME
LIMIT 1
</select>
</mapper> </mapper>
Loading…
Cancel
Save