From 8980ccc88c4cc4f67c925e6e1dc2c748daf04f5c Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 28 Jun 2021 10:41:26 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E8=BF=90=E8=90=A5=E7=AB=AF=E6=9D=83?= =?UTF-8?q?=E9=99=90=E9=85=8D=E7=BD=AE=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=88=9D=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/epmetuser/GovStaffRoleDTO.java | 5 ++ .../epmetuser/GovStaffRoleTemplateDTO.java | 10 +++ .../entity/epmetuser/GovStaffRoleEntity.java | 5 ++ .../epmetuser/GovStaffRoleTemplateEntity.java | 10 +++ .../java/com/epmet/dto/GovStaffRoleDTO.java | 5 ++ .../com/epmet/dto/form/UpGovRoleFormDTO.java | 30 +++++++++ .../dto/result/GovStaffRoleResultDTO.java | 17 +++++ .../dto/result/GovStaffRoleTemplateDTO.java | 10 +++ .../controller/GovStaffRoleController.java | 42 +++++++++--- .../java/com/epmet/dao/GovStaffRoleDao.java | 10 ++- .../epmet/dao/GovStaffRoleTemplateDao.java | 22 +++++++ .../com/epmet/entity/GovStaffRoleEntity.java | 5 ++ .../entity/GovStaffRoleTemplateEntity.java | 10 +++ .../epmet/service/GovStaffRoleService.java | 23 ++++++- .../service/impl/GovStaffRoleServiceImpl.java | 65 +++++++++++++++++-- .../V0.0.13__alter_gov_staff_role.sql | 9 +++ .../main/resources/mapper/GovStaffRoleDao.xml | 29 +++++++-- .../mapper/GovStaffRoleTemplateDao.xml | 48 +++++++++++++- 18 files changed, 332 insertions(+), 23 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpGovRoleFormDTO.java create mode 100644 epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.13__alter_gov_staff_role.sql diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleDTO.java index 9e569488d2..b6d866eda6 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleDTO.java @@ -93,6 +93,11 @@ public class GovStaffRoleDTO implements Serializable { */ private Integer fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + /** * 排序 */ diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleTemplateDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleTemplateDTO.java index 5c38ca8a2c..731a3de81d 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleTemplateDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleTemplateDTO.java @@ -58,6 +58,16 @@ public class GovStaffRoleTemplateDTO implements Serializable { */ private Integer fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + + /** + * 排序 + */ + private String sort; + /** * */ diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleEntity.java index d10c281e10..be03ad7913 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleEntity.java @@ -63,6 +63,11 @@ public class GovStaffRoleEntity extends BaseEpmetEntity { */ private Integer fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + /** * 排序 */ diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleTemplateEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleTemplateEntity.java index 24e77d5ef3..aa6b1e6db9 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleTemplateEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleTemplateEntity.java @@ -58,4 +58,14 @@ public class GovStaffRoleTemplateEntity extends BaseEpmetEntity { */ private Integer fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + + /** + * 排序 + */ + private String sort; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java index 7021efac58..44845e753f 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java @@ -63,6 +63,11 @@ public class GovStaffRoleDTO implements Serializable { * */ private Boolean fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + /** * 排序 * */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpGovRoleFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpGovRoleFormDTO.java new file mode 100644 index 0000000000..62dcf50a26 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpGovRoleFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; + +@Data +public class UpGovRoleFormDTO { + + /** + * 角色表id + */ + @NotEmpty(message = "角色Id不能为空", groups = {Update.class}) + private String roleId; + /** + * 角色名称 + */ + private String roleName; + /** + * 职责描述 + */ + private String description; + /** + * token中userId + */ + private String userId; + + public interface Update extends CustomerClientShowGroup {} +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java index 1708d17f32..3d29b9d75e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java @@ -64,4 +64,21 @@ public class GovStaffRoleResultDTO implements Serializable { private String mobile; private String gender; + + /** + * 职责描述 + */ + private String description; + /** + * 角色key[默认值] + */ + private String defRoleKey; + /** + * 角色名称[默认值] + */ + private String defRoleName; + /** + * 职责描述[默认值] + */ + private String defDescription; } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java index fa17be450f..6a83a0b552 100755 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java @@ -58,6 +58,16 @@ public class GovStaffRoleTemplateDTO implements Serializable { * */ private Boolean fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + + /** + * 排序 + */ + private String sort; + /** * */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java index 37df7c9140..01bb8ca3f3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.GovStaffRoleFormDTO; +import com.epmet.dto.form.UpGovRoleFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.ResiGovRoleListResultDTO; @@ -76,15 +77,14 @@ public class GovStaffRoleController { /** * 更新客户的指定角色 - * @param form + * @param formDTO * @return */ @PostMapping("update-role") - public Result updateRole(@RequestBody GovStaffRoleFormDTO form) { - ValidatorUtils.validateEntity(form, GovStaffRoleFormDTO.UpdateRoleGroup.class); - if (govStaffRoleService.updateRole(form.getRoleId(), form.getRoleName()) == 0) { - throw new RenException("修改角色信息失败"); - } + public Result updateRole(@LoginUser TokenDto tokenDTO, @RequestBody UpGovRoleFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, UpGovRoleFormDTO.Update.class); + formDTO.setUserId(tokenDTO.getUserId()); + govStaffRoleService.updateCustomerRole(formDTO); return new Result(); } @@ -94,10 +94,9 @@ public class GovStaffRoleController { * @return */ @PostMapping("save-sortorder") - public Result saveSortOrder(@RequestBody GovStaffRoleFormDTO form) { + public Result saveSortOrder(@LoginUser TokenDto tokenDTO, @RequestBody GovStaffRoleFormDTO form) { ValidatorUtils.validateEntity(form, GovStaffRoleFormDTO.SaveRoleOrderGroup.class); - List roleIdList = form.getRoleIdList(); - govStaffRoleService.saveSortOrder(roleIdList); + govStaffRoleService.saveSortOrder(tokenDTO.getUserId(), form.getRoleIdList()); return new Result(); } @@ -124,4 +123,29 @@ public class GovStaffRoleController { Result> queryCustomerGovRoleList(@PathVariable("customerId") String customerId){ return new Result>().ok(govStaffRoleService.queryCustomerGovRoleList(customerId)); } + + /** + * @param formDTO + * @Description 默认权限保存排序 + * @Author sun + **/ + @PostMapping("savedefaultsort") + public Result saveDefaultSort(@LoginUser TokenDto tokenDTO, @RequestBody GovStaffRoleFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GovStaffRoleFormDTO.SaveRoleOrderGroup.class); + govStaffRoleService.saveDefaultSort(tokenDTO.getUserId(), formDTO.getRoleIdList()); + return new Result(); + } + + /** + * @param formDTO + * @Description 修改角色名称或职责描述 + * @Author sun + **/ + @PostMapping("updatedefaultrole") + public Result updateDefaultRole(@LoginUser TokenDto tokenDTO, @RequestBody UpGovRoleFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, UpGovRoleFormDTO.Update.class); + formDTO.setUserId(tokenDTO.getUserId()); + govStaffRoleService.updateDefaultRole(formDTO); + return new Result(); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java index f717b678c8..c757e6d3d3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java @@ -19,6 +19,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.form.UpGovRoleFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.RoleInfoResultDTO; import com.epmet.dto.result.RoleKeyValueResultDTO; @@ -75,7 +76,7 @@ public interface GovStaffRoleDao extends BaseDao { int updateColumnsById(@Param("roleId") String roleId, @Param("roleName") String roleName); - int updateSortById(@Param("roleId") String roleId, @Param("sort") int sort); + int updateSortById(@Param("roleId") String roleId, @Param("sort") int sort, @Param("userId") String userId); List listRolesByRoleKey(@Param("roleKey") String roleKey); @@ -88,4 +89,11 @@ public interface GovStaffRoleDao extends BaseDao { * @date 2021/6/15 2:35 下午 */ List selectRoleKeyName(@Param("roleIds")List roleIds); + + /** + * @param formDTO + * @Description 修改客户角色名称或职责描述 + * @Author sun + **/ + int upNameOrDescription(UpGovRoleFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java index 62af0e097c..974a358e17 100755 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java @@ -18,10 +18,13 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.UpGovRoleFormDTO; +import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.ResiGovRoleResultDTO; import com.epmet.entity.GovStaffRoleTemplateEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -45,4 +48,23 @@ public interface GovStaffRoleTemplateDao extends BaseDao selectGovRoleList(); + + /** + * @author sun + * @Description 获取工作端默认角色列表 + */ + List defaultRoleList(); + + /** + * @author sun + * @Description 修改默认权限排序 + */ + int updateSortById(@Param("roleId") String roleId, @Param("sort") int sort, @Param("userId") String userId); + + /** + * @param formDTO + * @Description 修改角色名称或职责描述 + * @Author sun + **/ + int upNameOrDescription(UpGovRoleFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java index 6950c65256..6ac107e80a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java @@ -63,6 +63,11 @@ public class GovStaffRoleEntity extends BaseEpmetEntity { * */ private Boolean fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + /** * 排序 * */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java index 34a4844ad9..cd87413736 100755 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java @@ -58,4 +58,14 @@ public class GovStaffRoleTemplateEntity extends BaseEpmetEntity { * */ private Boolean fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + + /** + * 排序 + */ + private String sort; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java index 6ee17905c2..ba76c21ab3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -20,6 +20,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.form.UpGovRoleFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.ResiGovRoleListResultDTO; @@ -138,7 +139,7 @@ public interface GovStaffRoleService extends BaseService { int updateRole(String roleId, String roleName); - void saveSortOrder(List roleIdList); + void saveSortOrder(String userId, List roleIdList); List listRolesByRoleKey(String roleKey); @@ -150,4 +151,24 @@ public interface GovStaffRoleService extends BaseService { * @Date 2021/3/29 15:37 **/ List queryCustomerGovRoleList(String customerId); + + /** + * @Description 默认权限保存排序 + * @Author sun + **/ + void saveDefaultSort(String userId, List roleIdList); + + /** + * @param formDTO + * @Description 修改角色名称或职责描述 + * @Author sun + **/ + void updateDefaultRole(UpGovRoleFormDTO formDTO); + + /** + * @param formDTO + * @Description 修改客户角色名称或职责描述 + * @Author sun + **/ + void updateCustomerRole(UpGovRoleFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index 6be3f08be4..391696e92b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; @@ -30,6 +31,7 @@ import com.epmet.dao.GovStaffRoleTemplateDao; import com.epmet.dao.RoleDao; import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.form.InitDefaultOperationsFormDTO; +import com.epmet.dto.form.UpGovRoleFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.feign.GovAccessFeignClient; @@ -182,7 +184,24 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl listRolesByCustomer(String customerId) { - return govStaffRoleDao.listRolesByCustomer(customerId); + List resultList = new ArrayList<>(); + //1.查询系统默认角色列表数据 + resultList = govStaffRoleTemplateDao.defaultRoleList(); + //2.查询客户角色权限列表数据 + List cuList = govStaffRoleDao.listRolesByCustomer(customerId); + //3.封装数据并返回 + resultList.forEach(re -> { + cuList.forEach(cu -> { + if (re.getDefRoleKey().equals(cu.getRoleKey())) { + re.setCustomerId(cu.getCustomerId()); + re.setRoleId(cu.getRoleId()); + re.setRoleKey(cu.getRoleKey()); + re.setRoleName(cu.getRoleName()); + re.setDescription(cu.getDescription()); + } + }); + }); + return resultList; } @Override @@ -221,12 +240,11 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl roleIdList) { + @Transactional(rollbackFor = Exception.class) + public void saveSortOrder(String userId, List roleIdList) { for (int i = 0 ; i < roleIdList.size() ; i++) { - int r = govStaffRoleDao.updateSortById(roleIdList.get(i), i); - System.out.println(r); + int r = govStaffRoleDao.updateSortById(roleIdList.get(i), i, userId); } } @@ -264,4 +282,41 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl roleIdList) { + for (int i = 0; i < roleIdList.size(); i++) { + govStaffRoleTemplateDao.updateSortById(roleIdList.get(i), i, userId); + } + } + + /** + * @param formDTO + * @Description 修改角色名称或职责描述 + * @Author sun + **/ + @Override + public void updateDefaultRole(UpGovRoleFormDTO formDTO) { + if (govStaffRoleTemplateDao.upNameOrDescription(formDTO) < NumConstant.ONE) { + throw new RenException("修改角色信息失败"); + } + } + + /** + * @param formDTO + * @Description 修改客户角色名称或职责描述 + * @Author sun + **/ + @Override + public void updateCustomerRole(UpGovRoleFormDTO formDTO) { + if (govStaffRoleDao.upNameOrDescription(formDTO) < NumConstant.ONE) { + throw new RenException("修改角色信息失败"); + } + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.13__alter_gov_staff_role.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.13__alter_gov_staff_role.sql new file mode 100644 index 0000000000..40aed783d8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.13__alter_gov_staff_role.sql @@ -0,0 +1,9 @@ +ALTER TABLE `gov_staff_role_template` +ADD COLUMN `DESCRIPTION` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色对应的职责说明' AFTER `FULL_TIME_ONLY`, +ADD COLUMN `SORT` int(11) NULL DEFAULT NULL COMMENT '排序' AFTER `DESCRIPTION`; + + +ALTER TABLE `gov_staff_role` +MODIFY COLUMN `FULL_TIME_ONLY` tinyint(1) NULL DEFAULT 1 COMMENT '是否只有全职 1对应true 0对应false' AFTER `ORG_TYPE`, +MODIFY COLUMN `SORT` int(11) NULL DEFAULT NULL COMMENT '排序' AFTER `FULL_TIME_ONLY`, +ADD COLUMN `DESCRIPTION` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色对应的职责说明' AFTER `FULL_TIME_ONLY`; diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index be9203602e..7c35e8500b 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -25,9 +25,12 @@ - update gov_staff_role - set SORT = #{sort} - where ID = #{roleId} + UPDATE gov_staff_role + SET sort = #{sort}, + updated_by = #{userId}, + updated_time = NOW() + WHERE + id = #{roleId} @@ -69,7 +72,8 @@ r.CUSTOMER_ID AS customerId, r.ROLE_KEY AS roleKey, r.ROLE_NAME AS roleName, - r.ORG_TYPE AS orgType + r.ORG_TYPE AS orgType, + r.DESCRIPTION AS description FROM gov_staff_role r WHERE r.CUSTOMER_ID = #{customerId} ORDER BY r.SORT asc @@ -133,4 +137,21 @@ ) + + + UPDATE gov_staff_role + + + role_name = #{roleName}, + + + description = #{description}, + + updated_by = #{userId}, + updated_time = NOW() + + WHERE + id = #{roleId} + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml index a06b408917..9e2cf5d596 100755 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml @@ -18,9 +18,14 @@ + + + + UPDATE gov_staff_role_template + SET sort = #{sort}, + updated_by = #{userId}, + updated_time = NOW() + WHERE + id = #{roleId} + + + + UPDATE gov_staff_role_template + + + role_name = #{roleName}, + + + description = #{description}, + + updated_by = #{userId}, + updated_time = NOW() + + WHERE + id = #{roleId} + \ No newline at end of file From ae1fa066d5ae99b126f305a3ceecc089aab748d2 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 30 Jun 2021 15:27:20 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=9D=83=E9=99=90?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=92=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/result/GovStaffRoleResultDTO.java | 6 ++++++ .../service/impl/GovStaffRoleServiceImpl.java | 15 +++++++++++---- .../src/main/resources/mapper/GovStaffRoleDao.xml | 3 ++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java index 3d29b9d75e..3302c18b97 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java @@ -17,6 +17,7 @@ package com.epmet.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -81,4 +82,9 @@ public class GovStaffRoleResultDTO implements Serializable { * 职责描述[默认值] */ private String defDescription; + /** + * 排序 + */ + @JsonIgnore + private Integer sort; } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index 391696e92b..423920a84a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -44,10 +44,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 政府端角色表 @@ -198,9 +195,19 @@ public class GovStaffRoleServiceImpl extends BaseServiceImplNumConstant.ZERO){ + Collections.sort(resultList, new Comparator() { + @Override + public int compare(GovStaffRoleResultDTO o1, GovStaffRoleResultDTO o2) { + return o1.getSort().compareTo(o2.getSort()); + } + }); + } return resultList; } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index 7c35e8500b..da79b4be3b 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -73,7 +73,8 @@ r.ROLE_KEY AS roleKey, r.ROLE_NAME AS roleName, r.ORG_TYPE AS orgType, - r.DESCRIPTION AS description + r.DESCRIPTION AS description, + r.SORT AS sort FROM gov_staff_role r WHERE r.CUSTOMER_ID = #{customerId} ORDER BY r.SORT asc From d23f55b08779959e0ffbe9068a5296f8c1c13357 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 1 Jul 2021 09:56:59 +0800 Subject: [PATCH 03/15] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=B7=BB=E5=8A=A0=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java | 2 ++ .../src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java | 2 ++ .../java/com/epmet/service/impl/CustomerStaffServiceImpl.java | 2 ++ 3 files changed, 6 insertions(+) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java index 81498e5586..b26db57327 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java @@ -31,4 +31,6 @@ public class RoleInfoResultDTO implements Serializable{ private Boolean fullTimeOnly = false; private String roleKey; + + private String description; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java index 9d596bca43..b39085d40c 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java @@ -30,4 +30,6 @@ public class StaffRoleResultDTO implements Serializable { */ @JsonInclude(JsonInclude.Include.NON_NULL) private Boolean selected; + + private String description; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index aea728c458..b2a7d02d32 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -245,6 +245,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl>().ok(staffRoleList); @@ -277,6 +278,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl Date: Thu, 1 Jul 2021 15:51:45 +0800 Subject: [PATCH 04/15] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=B7=BB=E5=8A=A0=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/result/StaffInfoResultDTO.java | 3 +++ .../java/com/epmet/dao/GovStaffRoleDao.java | 8 ++++++++ .../epmet/service/GovStaffRoleService.java | 10 ++++++++++ .../impl/CustomerStaffServiceImpl.java | 6 ++++++ .../service/impl/GovStaffRoleServiceImpl.java | 19 +++++++++++++++++++ .../main/resources/mapper/GovStaffRoleDao.xml | 17 +++++++++++++++++ 6 files changed, 63 insertions(+) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java index 3e6647a9a0..7828cc0bad 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * @author zhaoqifeng @@ -37,4 +38,6 @@ public class StaffInfoResultDTO implements Serializable { */ @JsonInclude(JsonInclude.Include.NON_NULL) private String roleName; + + List roles; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java index c757e6d3d3..9753829066 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java @@ -47,6 +47,14 @@ public interface GovStaffRoleDao extends BaseDao { */ List listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId); + /** + * 根据staffId查询具有的角色列表 + * @param staffId + * @param orgId + * @return + */ + List getStaffRoles(@Param("staffIds") List staffId, @Param("orgId") String orgId); + /** * 获取客户机关角色列表 * @param params diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java index ba76c21ab3..58ebf19e6f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -105,6 +105,16 @@ public interface GovStaffRoleService extends BaseService { */ List listRolesByStaffId(String staffId, String orgId); + /** + * 查询用户角色 + * @author zhaoqifeng + * @date 2021/7/1 15:30 + * @param staffIds + * @param orgId + * @return java.util.Map> + */ + Map> getStaffRoles(List staffIds, String orgId); + /** * 获取当前机关下的角色列表 * @param dto diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index b2a7d02d32..8a8764e5b0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -226,6 +226,12 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl(); } + if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) { + Map> map = govStaffRoleService.getStaffRoles(fromDTO.getStaffList(), fromDTO.getAgencyId()); + list.forEach(item -> { + item.setRoles(map.get(item.getStaffId())); + }); + } return new Result>().ok(list); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index 423920a84a..b359f60058 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -45,6 +45,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; +import java.util.stream.Collectors; /** * 政府端角色表 @@ -134,6 +137,22 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl> + * @author zhaoqifeng + * @date 2021/7/1 15:30 + */ + @Override + public Map> getStaffRoles(List staffIds, String orgId) { + List staffRoleList = baseDao.getStaffRoles(staffIds, orgId); + return staffRoleList.stream().collect(Collectors.groupingBy(GovStaffRoleEntity::getCustomerId, + Collectors.mapping(GovStaffRoleEntity :: getId, Collectors.toList()))); + } + @Override public List getGovStaffRoleList(GovStaffRoleDTO dto) { return baseDao.selectGovStaffRoleList(dto); diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index da79b4be3b..319c6a46ff 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -138,6 +138,23 @@ ) + UPDATE gov_staff_role From 13375eba123b6e6c9a8d136f9014263be6e83a3d Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 9 Jul 2021 10:00:45 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=E6=A6=82=E6=8B=AC=E6=8A=BD=E5=8F=96=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=88=86=E5=AD=90=E5=88=86=E6=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/screencoll/form/UserJoinFormDTO.java | 20 +++++++++++++++++++ .../screen/ScreenUserJoinEntity.java | 20 +++++++++++++++++++ .../impl/PublicPartExtractServiceImpl.java | 2 +- .../screen/ScreenUserJoinDao.xml | 8 ++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java index b160224471..ce78cc21ca 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java @@ -50,6 +50,16 @@ public class UserJoinFormDTO implements Serializable { */ private BigDecimal avgIssue; + /** + * 人均议题分子 + */ + private Integer avgIssueFz; + + /** + * 人均议题分母 + */ + private Integer avgIssueFm; + /** * 总的参与次数 */ @@ -59,4 +69,14 @@ public class UserJoinFormDTO implements Serializable { * 平均参与度 */ private BigDecimal avgJoin; + + /** + * 平均参与度分子 + */ + private Integer avgJoinFz; + + /** + * 平均参与度分母 + */ + private Integer avgJoinFm; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java index 138e19cd30..a0fc71b676 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java @@ -92,6 +92,16 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity { */ private BigDecimal avgIssue; + /** + * 人均议题分子 + */ + private Integer avgIssueFz; + + /** + * 人均议题分母 + */ + private Integer avgIssueFm; + /** * 人均议题较上月增长率(采集的时候后台自己计算) */ @@ -107,6 +117,16 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity { */ private BigDecimal avgJoin; + /** + * 平均参与度分子 + */ + private Integer avgJoinFz; + + /** + * 平均参与度分母 + */ + private Integer avgJoinFm; + /** * 平均参与度较上月增长率(采集的时候后台自己计算) */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index a6a916602d..cc97b96fab 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -219,7 +219,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { List voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.AGENCY_ID); Map orgMemberCount = new HashMap<>(); if (!CollectionUtils.isEmpty(issueTotal)) { - //获取每个网格的应表决人数 + //获取每个网格的应表决人数 (组成员数去重) List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID); if (CollectionUtils.isEmpty(memberCountList)) { log.warn("抽取【公众参与-人均议题】,获取应表决人数为空,customerId:{}", formDTO.getCustomerId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml index e4e5b7ac0f..862a31464c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml @@ -41,9 +41,13 @@ JOIN_TOTAL_UP_RATE, JOIN_TOTAL_UP_FLAG, AVG_ISSUE, + AVG_ISSUE_FZ, + AVG_ISSUE_FM, AVG_ISSUE_UP_RATE, AVG_ISSUE_UP_FLAG, AVG_JOIN, + AVG_JOIN_FZ, + AVG_JOIN_FM, AGVG_JOIN_UP_RATE, AGVG_JOIN_UP_FLAG, DEL_FLAG, @@ -69,10 +73,14 @@ #{item.joinTotalUpFlag}, #{item.avgIssue}, + #{item.avgIssueFz}, + #{item.avgIssueFm}, #{item.avgIssueUpRate}, #{item.avgIssueUpFlag}, #{item.avgJoin}, + #{item.avgIssueFz}, + #{item.avgIssueFm}, #{item.agvgJoinUpRate}, #{item.agvgJoinUpFlag}, 0, From b7ebeb3da7d5b266d20d80eb73eaeeede7fac809 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 9 Jul 2021 10:35:57 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=E6=A6=82=E5=86=B5publicpartiprofile=E6=8E=A5=E5=8F=A3=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/dto/form/AgencyFormDTO.java | 5 ++ .../UserJoinIndicatorGrowthRateResultDTO.java | 24 +++++-- .../impl/GrassRootsGovernServiceImpl.java | 67 +++++++++++++------ .../com/epmet/datareport/utils/DateUtils.java | 8 +-- .../mapper/screen/ScreenUserJoinDao.xml | 42 ++++-------- 5 files changed, 89 insertions(+), 57 deletions(-) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyFormDTO.java index 166c9c2aa9..fcba02911c 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyFormDTO.java @@ -21,4 +21,9 @@ public class AgencyFormDTO implements Serializable { @NotBlank(message = "机关Id不能为空" , groups = CommonAgencyIdGroup.class) private String agencyId; + + /** + * 平阴县默认穿370124,跟随8个街道点击事件,传入街道的areaCode + * */ + private String areaCode; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java index 94e4f20546..3e02aa4e96 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java @@ -8,7 +8,7 @@ import java.math.BigDecimal; /** * @Description 用户参与各项指标以及增长查询结果dto * @ClassName UserJoinIndicatorGrowthRateResultDTO - * @Auth wangc + * @author wangc * @Date 2020-08-21 16:07 */ @Data @@ -16,25 +16,33 @@ public class UserJoinIndicatorGrowthRateResultDTO implements Serializable { private static final long serialVersionUID = -8830240350298414599L; private String id; - + /** + * 总参与数 + * */ private Integer total; + /** + * 总参与数:月增长 + * */ private BigDecimal monthIncr; /** - * incr上升, decr下降 + * 总参与数:incr上升, decr下降 * */ private String monthTrend; + /** + * 人均议题 + * */ private BigDecimal averageIssue; /** - * 较上月百分比 + * 人均议题:较上月百分比 * */ private BigDecimal issueCompareLatestMonth; /** - * 较上月趋势:incr上升,decr下降 + * 人均议题:较上月趋势:incr上升,decr下降 * */ private String issueCompareLatestTrend; @@ -43,7 +51,13 @@ public class UserJoinIndicatorGrowthRateResultDTO implements Serializable { */ private BigDecimal averageJoin; + /** + * 平均参与度: 较上月百分比 + */ private BigDecimal joinCompareLatestMonth; + /** + * 平均参与度:较上月趋势:incr上升,decr下降 + */ private String joinCompareLatestTrend; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java index 0cdb93a9c7..a048bf2c3e 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java @@ -133,30 +133,57 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { * @author wangc * @date 2020.08.20 14:37 **/ - @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override public PublicPartiProfileResultDTO publicPartiProfile(AgencyFormDTO param) { - ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId()); - Result> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId()); - List subCustomers; - if(null == crmResp || !crmResp.success()|| org.apache.commons.collections4.CollectionUtils.isEmpty(crmResp.getData())) {subCustomers = null ;} - else {subCustomers = crmResp.getData();} + String monthId = dateUtils.getPreviousMonthId(NumConstant.ONE); + UserJoinIndicatorGrowthRateResultDTO latest = new UserJoinIndicatorGrowthRateResultDTO(); + if (StringUtils.isNotBlank(param.getAreaCode()) && "370124".equals(param.getAreaCode())) { + latest= screenUserJoinDao.selectUserJoinDataByAreaCode(param.getAreaCode(), monthId); + if (null == latest) { + log.warn(String.format("平阴县查询screen_user_join表为空,monthId:%s", monthId)); + return new PublicPartiProfileResultDTO(); + } + UserJoinIndicatorGrowthRateResultDTO beforeTwoMonth = screenUserJoinDao.selectUserJoinDataByAreaCode(param.getAreaCode(), dateUtils.getPreviousMonthId(NumConstant.TWO)); + if (null == beforeTwoMonth) { + log.warn(String.format("平阴县查询screen_user_join表为空,monthId:%s",dateUtils.getPreviousMonthId(NumConstant.TWO))); + }else{ + //举例,today is 20210707 , latest是06月份的数据,beforeTwoMonth是05月份的数据 - String monthId = dateUtils.getCurrentMonthId(); - UserJoinIndicatorGrowthRateResultDTO latest = CollectionUtils.isEmpty(subCustomers) ||StringUtils.isBlank(agencyInfo.getAreaCode())? - screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) : - screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId); - //保证获取公众参与概率数据的最大可能性 - int time = NumConstant.TWELVE; - while ((null == latest || latest.getId() == null) && time > NumConstant.ONE) { - time--; - monthId = dateUtils.getPreviousMonthIdByDest(null, monthId); - latest = CollectionUtils.isEmpty(subCustomers)||StringUtils.isBlank(agencyInfo.getAreaCode()) ? - screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) : - screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId); - } + // 总参与数6月份比5月份增加了? + int incrTotal = latest.getTotal() - beforeTwoMonth.getTotal(); + // 总参与数月增长:增加的占5月份的占比??? + BigDecimal monthIncr = BigDecimal.valueOf(incrTotal / beforeTwoMonth.getTotal()); + latest.setMonthIncr(monthIncr); + latest.setMonthTrend(monthIncr.compareTo(BigDecimal.ZERO) > 0 ? "incr" : "decr"); + + //人均议题数6月份比五月份增加了? + BigDecimal issueIncrTotal = latest.getAverageIssue().subtract(beforeTwoMonth.getAverageIssue()); + //人均议题数月增长:增加的占5月份的占比??? + BigDecimal issueCompareLatestMonth = issueIncrTotal.divide(beforeTwoMonth.getAverageIssue()); + latest.setIssueCompareLatestMonth(issueCompareLatestMonth); + latest.setIssueCompareLatestTrend(issueCompareLatestMonth.compareTo(BigDecimal.ZERO) > 0 ? "incr" : "decr"); - if (null == latest) return new PublicPartiProfileResultDTO(); + // 平均参与度6月份比5月份增加了? + BigDecimal incrJoinCompareLatestMonth=latest.getJoinCompareLatestMonth().subtract(beforeTwoMonth.getJoinCompareLatestMonth()); + //平均参与度月增长:增加的占5月份的占比??? + BigDecimal joinCompareLatestMonth=incrJoinCompareLatestMonth.divide(beforeTwoMonth.getJoinCompareLatestMonth()); + latest.setJoinCompareLatestMonth(joinCompareLatestMonth); + latest.setJoinCompareLatestTrend(joinCompareLatestMonth.compareTo(BigDecimal.ZERO) > 0 ? "incr" : "decr"); + } + } else { + latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); + //保证获取公众参与概率数据的最大可能性 + int time = NumConstant.TWELVE; + while ((null == latest || latest.getId() == null) && time > NumConstant.ONE) { + time--; + monthId = dateUtils.getPreviousMonthIdByDest(null, monthId); + latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); + } + } + if (null == latest) { + return new PublicPartiProfileResultDTO(); + } PublicPartiProfileResultDTO result = ConvertUtils.sourceToTarget(latest, PublicPartiProfileResultDTO.class); result.setMonthIncr(convertPercentStr(latest.getMonthIncr(), NumConstant.ZERO)); result.setJoinCompareLatestMonth(convertPercentStr(latest.getJoinCompareLatestMonth().abs(), NumConstant.ZERO)); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java index bfc46d03bd..a087e1c3c6 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java @@ -107,17 +107,17 @@ public class DateUtils { } /** - * @Description 得到上个月的monthId - * @param + * @Description 前n个月 + * @param beforeMonthNum * @return * @author wangc * @date 2020.08.20 10:19 **/ - public String getPreviousMonthId(){ + public String getPreviousMonthId(int beforeMonthNum){ SimpleDateFormat format = new SimpleDateFormat("yyyyMM"); Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); // 设置为当前时间 - calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1); // 设置为上一个月 + calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - beforeMonthNum); // 设置为上一个月 return format.format(calendar.getTime()); } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml index de0473571e..2818ea0714 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml @@ -28,36 +28,22 @@ From ee09c5a9140bee3d900669415b9a48f1a3452b00 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 9 Jul 2021 11:07:50 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=99=9A=E4=B8=8A?= =?UTF-8?q?=E7=BA=BF=EF=BC=8C=E5=88=A0=E9=99=A4=E8=84=9A=E6=9C=AC=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V0.0.13__alter_gov_staff_role.sql | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.13__alter_gov_staff_role.sql diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.13__alter_gov_staff_role.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.13__alter_gov_staff_role.sql deleted file mode 100644 index 40aed783d8..0000000000 --- a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.13__alter_gov_staff_role.sql +++ /dev/null @@ -1,9 +0,0 @@ -ALTER TABLE `gov_staff_role_template` -ADD COLUMN `DESCRIPTION` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色对应的职责说明' AFTER `FULL_TIME_ONLY`, -ADD COLUMN `SORT` int(11) NULL DEFAULT NULL COMMENT '排序' AFTER `DESCRIPTION`; - - -ALTER TABLE `gov_staff_role` -MODIFY COLUMN `FULL_TIME_ONLY` tinyint(1) NULL DEFAULT 1 COMMENT '是否只有全职 1对应true 0对应false' AFTER `ORG_TYPE`, -MODIFY COLUMN `SORT` int(11) NULL DEFAULT NULL COMMENT '排序' AFTER `FULL_TIME_ONLY`, -ADD COLUMN `DESCRIPTION` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色对应的职责说明' AFTER `FULL_TIME_ONLY`; From 9b443911db86109ede07c1a40a9042374890f6c5 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 9 Jul 2021 13:13:26 +0800 Subject: [PATCH 08/15] =?UTF-8?q?screen=5Fproject=5Fdata=E8=A1=A8=E9=87=87?= =?UTF-8?q?=E9=9B=86projectCreateTime=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java index da4781f803..8130319662 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.screen.form; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serializable; @@ -47,6 +48,7 @@ public class ScreenProjectDataInfoFormDTO implements Serializable { /** * 事件时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") private String projectCreateTime; /** From 8059011ffb14a27c65638b66c63bf29b78bbda20 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 9 Jul 2021 13:31:14 +0800 Subject: [PATCH 09/15] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=E6=A6=82=E6=8B=AC=E6=8A=BD=E5=8F=96=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=88=86=E5=AD=90=E5=88=86=E6=AF=8D=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/db/migration/V0.0.22__pulic_party.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.22__pulic_party.sql diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.22__pulic_party.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.22__pulic_party.sql new file mode 100644 index 0000000000..7c9f7a9e3d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.22__pulic_party.sql @@ -0,0 +1,7 @@ +ALTER TABLE `epmet_evaluation_index`.`screen_user_join` + ADD COLUMN `AVG_ISSUE_FZ` int(11) NULL DEFAULT 0 COMMENT '人均议题分子' AFTER `AVG_ISSUE`, + ADD COLUMN `AVG_ISSUE_FM` int(11) NULL DEFAULT 0 COMMENT '人均议题分母' AFTER `AVG_ISSUE_FZ`, + ADD COLUMN `AVG_JOIN_FZ` int(11) NULL DEFAULT 0 COMMENT '平均参与度分子' AFTER `AVG_JOIN`, + ADD COLUMN `AVG_JOIN_FM` int(11) NULL DEFAULT 0 COMMENT '平均参与度分母' AFTER `AVG_JOIN_FZ`, + DROP PRIMARY KEY, + ADD PRIMARY KEY (`ID`) USING BTREE; From 1a1c0c8f10ea97016f8950fe84fc992d43587fe3 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 9 Jul 2021 13:32:38 +0800 Subject: [PATCH 10/15] =?UTF-8?q?screen=5Fproject=5Fdata=E8=A1=A8=E9=87=87?= =?UTF-8?q?=E9=9B=86projectCreateTime=E4=BF=AE=E6=94=B92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/ScreenProjectDataInfoFormDTO.java | 3 ++- .../impl/ScreenProjectDataServiceImpl.java | 26 ++++++++----------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java index 8130319662..aca9d358ce 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java @@ -5,6 +5,7 @@ import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; +import java.util.Date; /** * @description: @@ -49,7 +50,7 @@ public class ScreenProjectDataInfoFormDTO implements Serializable { * 事件时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - private String projectCreateTime; + private Date projectCreateTime; /** * 上报人 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java index bf8c212f6b..40888aced8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java @@ -140,7 +140,7 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl Date: Fri, 9 Jul 2021 14:25:54 +0800 Subject: [PATCH 11/15] =?UTF-8?q?=E8=BF=90=E8=90=A5=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=9D=83=E9=99=90=E5=92=8C=E5=AE=A2=E6=88=B7=E6=9D=83=E9=99=90?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=90=8D=E7=A7=B0=E4=BF=9D=E6=8C=81=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E6=8E=92=E5=BA=8F=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/RoleOperationDefaultDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDefaultDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDefaultDao.xml index 98cd9f675b..6d45ab19f7 100755 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDefaultDao.xml +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDefaultDao.xml @@ -48,6 +48,6 @@ LEFT JOIN role_operation_default d ON (o.OPERATION_KEY = d.OPERATION_KEY AND d.DEL_FLAG = '0' AND d.ROLE_KEY = #{roleKey}) WHERE o.DEL_FLAG = '0' - ORDER BY o.OPERATION_KEY ASC + ORDER BY o.OPERATION_NAME ASC \ No newline at end of file From d8268745e586e66c321659b04bab38825b7d09b4 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 9 Jul 2021 14:34:39 +0800 Subject: [PATCH 12/15] =?UTF-8?q?screen=5Fuser=5Fjoin=E8=A1=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=8A=BD=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/ScreenUserJoinDao.java | 11 + .../impl/PublicPartExtractServiceImpl.java | 213 +++++++++++++++++- .../screen/ScreenUserJoinService.java | 3 +- .../impl/ScreenUserJoinServiceImpl.java | 4 +- .../screen/ScreenUserJoinDao.xml | 7 + 5 files changed, 224 insertions(+), 14 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java index b63726e8ac..ba45d011da 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java @@ -62,6 +62,17 @@ public interface ScreenUserJoinDao extends BaseDao { Integer deleteUserJoin(@Param("customerId") String customerId, @Param("monthId") String monthId); + /** + * @Description 根据类别删除 + * @Param customerId + * @Param monthId + * @Param delFlag + * @author zxc + * @date 2021/7/9 2:21 下午 + */ + Integer deleteUserJoinByCategory(@Param("customerId") String customerId,@Param("monthId") String monthId, + @Param("delFlag") String delFlag); + /** * 11、基层治理-公众参与 * 2) 在批量新增 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index cc97b96fab..5e96035ae9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -76,6 +76,14 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { *

* 不考虑市北:人均议题:统计周期内议题总数/发过议题的人数 参与度:各个行为(表决)的总数/发生行为的人数 * + * + * ================================================================================================================ + * ================================================================================================================ + * 2021-07-09 新注释 + * 公众参与里的指标含义说明: + * 总参与:议题参与的次数(比如 表决 等行为,产品只有表决行为,其他三个街道 包含评论数、点赞数、点踩数) + * 人均议题:议题总数/组织内的总人数(项目:绑定网格的总用户数,产品:组织内的小组成员数去重) + * 平均参与度:议题参与的总人数(每个议题参与人数的和)/(应参与人数(项目:组织内的人数不去重;产品:组织内的小组成员数去重)* 议题个数) * @return java.lang.Boolean * @author LiuJanJun * @date 2020/9/25 10:24 上午 @@ -86,9 +94,9 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { log.warn("extractTotalDataMonthly param is error,param:{}", JSON.toJSONString(formDTO)); return false; } - extractGridUserJoin(formDTO); - extractAgencyUserJoin(formDTO); - return null; + gridUserJoinCal(formDTO); + agencyUserJoinCal(formDTO); + return true; } private void extractGridUserJoin(ExtractScreenFormDTO formDTO) { @@ -178,7 +186,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { entity.setAvgJoin(bigDecimal.divide(votedByIssueCount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); } } - screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values())); + screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.GRID); } private void extractAgencyUserJoin(ExtractScreenFormDTO formDTO) { @@ -253,12 +261,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { } }); } - screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values())); - } - - public static void main(String[] args) { - BigDecimal bigDecimal = new BigDecimal(0); - bigDecimal = bigDecimal.add(new BigDecimal(0 / (1 * 1.0))); + screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.GRID); } private void buildUserJoinEntity(ExtractScreenFormDTO formDTO, Object org, Map result) { @@ -274,7 +277,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { } else if (org instanceof DimAgencyEntity) { DimAgencyEntity agency = (DimAgencyEntity) org; entity.setCustomerId(agency.getCustomerId()); - entity.setOrgType(agency.getLevel()); + entity.setOrgType(OrgTypeConstant.AGENCY); entity.setOrgId(agency.getId()); entity.setParentId(agency.getPid()); entity.setOrgName(agency.getAgencyName()); @@ -289,6 +292,10 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { entity.setAvgJoin(new BigDecimal(0)); entity.setAgvgJoinUpRate(new BigDecimal("0")); entity.setAgvgJoinUpFlag(""); + entity.setAvgIssueFz(NumConstant.ZERO); + entity.setAvgIssueFm(NumConstant.ZERO); + entity.setAvgJoinFz(NumConstant.ZERO); + entity.setAvgJoinFm(NumConstant.ZERO); result.put(entity.getOrgId(), entity); } @@ -304,4 +311,188 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { public Boolean extractPerTotalDataDaily(ExtractScreenFormDTO formDTO) { return null; } + + /** + * @Description 基层治理-公众参与【网格-月】 + * @Param formDTO + * @author zxc + * @date 2021/7/9 9:20 上午 + */ + public void gridUserJoinCal(ExtractScreenFormDTO formDTO){ + // 查询客户下所有网格 + List orgList = dimGridService.getGridListByCustomerId(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(orgList)) { + log.warn("抽取【公众参与-人均议题】,获取组织数据失败,customerId:{}", formDTO.getCustomerId()); + return; + } + //构建组织数据 + Map insertMap = new HashMap<>(16); + orgList.forEach(org -> buildUserJoinEntity(formDTO, org, insertMap)); + //获取议题月份增量 + List issueTotal = factIssueGridMonthlyService.getIssueIncCountAndTotalByMonthId(formDTO.getCustomerId(), formDTO.getMonthId()); + if (CollectionUtils.isEmpty(issueTotal)) { + return; + } + // 查询 注册居民本月增量 党员认证本月增量 截止本月底居民总数 + List userCountList = factRegUserGridMonthlyService.selectGridUserCount(formDTO.getCustomerId(), formDTO.getMonthId()); + if (CollectionUtils.isEmpty(userCountList)) { + return; + } + // list 转 map 以orgId为key + Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o)); + for (FactIssueGridMonthlyEntity issue : issueTotal) { + String gridId = issue.getGridId(); + ScreenUserJoinEntity entity = insertMap.get(gridId); + if (entity == null) { + continue; + } + // 议题本月增长 + entity.setJoinTotal(issue.getIssueIncr()); + // 网格下 注册居民本月增量,党员认证本月增量,截止本月底居民总数 + GridUserCountResultDTO user = userCountMap.get(gridId); + if (user == null) { + continue; + } + // 议题总数/组织内的总人数(项目:绑定网格的总用户数,产品:组织内的小组成员数去重) + log.debug("issue:{}", JSON.toJSONString(issue)); + log.debug("user:{}", JSON.toJSONString(user)); + if (!user.getRegTotal().equals(0)) { + BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()),NumConstant.FOUR, BigDecimal.ROUND_HALF_UP); + entity.setAvgIssueFz(issue.getIssueIncr()); + entity.setAvgIssueFm(user.getRegTotal()); + // 人均议题 + entity.setAvgIssue(avgIssueCount); + } + } + //获取该月 表决的人数 + List voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.GRID_ID); + Map gridMemberCount = new HashMap<>(16); + // 议题月份增量不为空 + if (!CollectionUtils.isEmpty(issueTotal)) { + //获取每个网格的应表决人数 + List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.GRID_ID); + if (CollectionUtils.isEmpty(memberCountList)) { + return; + } + // 网格下的组员 + gridMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount())); + } + /** + * 平均参与度:议题参与的总人数(每个议题参与人数的和)/(应参与人数(项目:网格内的人数不去重;产品:组织内的小组成员数去重)* 议题个数) + */ + // 根据网格ID分组 + Map> voteMap = voteCountList.stream().collect(Collectors.groupingBy(IssueVoteUserCountResultDTO::getOrgId)); + //遍历实际参与人数 + for (Map.Entry> entry : voteMap.entrySet()) { + String gridId = entry.getKey(); + ScreenUserJoinEntity entity = insertMap.get(gridId); + if (entity == null) { + continue; + } + List issueList = entry.getValue(); + BigDecimal realJoinCount = new BigDecimal(0); + // 网格下 议题个数 + BigDecimal votedByIssueCount = new BigDecimal(issueList.get(0).getIssueCount()); + // 网格下 组员人数 + Integer memberCount = gridMemberCount.get(gridId); + for (IssueVoteUserCountResultDTO vote : issueList) { + // 每个议题参与人数求和 + realJoinCount = realJoinCount.add(new BigDecimal(vote.getVoteCount())); + } + if (votedByIssueCount.intValue() != NumConstant.ZERO) { + // 平均参与度 = 议题参与的总人数 / (应参与人数 * 议题个数) + BigDecimal avgFz = votedByIssueCount.multiply(new BigDecimal(memberCount)); + entity.setAvgJoinFz(Integer.valueOf(avgFz.toString())); + entity.setAvgJoinFm(Integer.valueOf(realJoinCount.toString())); + entity.setAvgJoin(realJoinCount.divide(avgFz, NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } + screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.GRID); + } + + /** + * @Description 基层治理-公众参与【组织-月】 + * @Param formDTO + * @author zxc + * @date 2021/7/9 9:20 上午 + */ + public void agencyUserJoinCal(ExtractScreenFormDTO formDTO){ + // 查询客户下的所有组织 + List agencyList = dimAgencyService.getAgencyListByCustomerId(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(agencyList)) { + log.warn("抽取【公众参与-人均议题】,获取组织数据失败,customerId:{}", formDTO.getCustomerId()); + return; + } + //构建组织数据 + Map insertMap = new HashMap<>(16); + agencyList.forEach(org -> buildUserJoinEntity(formDTO, org, insertMap)); + // 查询组织下 议题月增长,截止本月议题总数 + List issueTotal = factIssueAgencyMonthlyService.getIssueIncCountAndTotalByMonthId(formDTO.getCustomerId(), formDTO.getMonthId()); + // 查询 注册居民本月增量 党员认证本月增量 截止本月底居民总数 + List userCountList = factRegUserAgencyMonthlyService.selectAgencyUserCount(formDTO.getCustomerId(), formDTO.getMonthId()); + // 以agencyId为key + Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o)); + Set agencyIdSet = new HashSet<>(); + if (!CollectionUtils.isEmpty(issueTotal)) { + issueTotal.forEach(issue -> { + String agencyId = issue.getAgencyId(); + agencyIdSet.add(agencyId); + ScreenUserJoinEntity entity = insertMap.get(agencyId); + if (entity == null){ + return; + } + entity.setJoinTotal(issue.getIssueIncr()); + GridUserCountResultDTO user = userCountMap.get(agencyId); + // 人均议题:议题总数/组织内的总人数(项目:绑定网格的总用户数,产品:组织内的小组成员数去重) + if (!user.getRegTotal().equals(NumConstant.ZERO)) { + BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()), NumConstant.FOUR, BigDecimal.ROUND_HALF_UP); + entity.setAvgIssueFz(issue.getIssueIncr()); + entity.setAvgIssueFm(user.getRegTotal()); + entity.setAvgIssue(avgIssueCount); + } + }); + List> partition = ListUtils.partition(new ArrayList<>(agencyIdSet), NumConstant.THIRTY); + partition.forEach(list -> { + //获取该月 表决的人数 + List voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.AGENCY_ID); + Map orgMemberCount = new HashMap<>(16); + if (!CollectionUtils.isEmpty(issueTotal)) { + //获取每个组织的应表决人数 + List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID); + if (CollectionUtils.isEmpty(memberCountList)) { + log.warn("抽取【公众参与-人均议题】,获取应表决人数为空,customerId:{}", formDTO.getCustomerId()); + return; + } + // (k,v) = (agencyId,组织下的人) + orgMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount())); + } + // 平均参与度:议题参与的总人数(每个议题参与人数的和)/(应参与人数(项目:组织内的人数不去重;产品:组织内的小组成员数去重)* 议题个数) + // 根据组织ID分组 + Map> voteMap = voteCountList.stream().collect(Collectors.groupingBy(IssueVoteUserCountResultDTO::getOrgId)); + for (Map.Entry> entry : voteMap.entrySet()) { + String orgId = entry.getKey(); + ScreenUserJoinEntity entity = insertMap.get(orgId); + List issueList = entry.getValue(); + // 实际参与人数 + BigDecimal realJoinCount = new BigDecimal(NumConstant.ZERO); + // 组织下 的议题数 + BigDecimal votedByIssueCount = new BigDecimal(issueList.get(NumConstant.ZERO).getIssueCount()); + // 组织下应参与人数 + Integer memberCount = orgMemberCount.get(orgId); + for (IssueVoteUserCountResultDTO vote : issueList) { + realJoinCount = realJoinCount.add(new BigDecimal(vote.getVoteCount())); + } + if (votedByIssueCount.intValue() != 0) { + // 平均参与度 = 议题参与的总人数 / (应参与人数 * 议题个数) + BigDecimal avgFz = votedByIssueCount.multiply(new BigDecimal(memberCount)); + entity.setAvgJoin(realJoinCount.divide(votedByIssueCount, NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + entity.setAvgJoinFz(Integer.valueOf(realJoinCount.toString())); + entity.setAvgJoinFm(Integer.valueOf(avgFz.toString())); + } + } + }); + } + screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.AGENCY); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java index 0a42c758a4..dcdf848174 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java @@ -36,9 +36,10 @@ public interface ScreenUserJoinService extends BaseService * * @param formDTO * @param list + * @param delFlag 删除标志 agency,grid * @return java.lang.Boolean * @author LiuJanJun * @date 2020/9/27 4:40 下午 */ - Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list); + Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list,String delFlag); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java index 328a3d1a1c..978ce14992 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java @@ -54,14 +54,14 @@ public class ScreenUserJoinServiceImpl extends BaseServiceImpl list) { + public Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list, String delFlag) { if (formDTO == null || StringUtils.isBlank(formDTO.getCustomerId()) || StringUtils.isBlank(formDTO.getMonthId()) || CollectionUtils.isEmpty(list)) { log.error("deleteAndInsertBatch param is error"); return false; } int deleteNum; do { - deleteNum = baseDao.deleteUserJoin(formDTO.getCustomerId(), formDTO.getMonthId()); + deleteNum = baseDao.deleteUserJoinByCategory(formDTO.getCustomerId(), formDTO.getMonthId(),delFlag); } while (deleteNum != NumConstant.ZERO); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml index 862a31464c..0fc7db5b18 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml @@ -26,6 +26,13 @@ limit 1000; + + + delete from screen_user_join + where CUSTOMER_ID = #{customerId} AND MONTH_ID = #{monthId} AND ORG_TYPE = #{delFlag} + limit 1000 + + insert into screen_user_join ( From f5f6ce54726ad90f1150408178c56387d6435481 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 9 Jul 2021 15:08:00 +0800 Subject: [PATCH 13/15] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=8C=87=E5=AE=9A=20?= =?UTF-8?q?=E6=9C=88=E4=BB=BD=E7=9A=84=E5=89=8Dn=E6=9C=88=20=E8=BF=94?= =?UTF-8?q?=E5=9B=9EyyyyMM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/utils/DateUtils.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index b47d56574c..c2988b67f9 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -446,6 +446,22 @@ public class DateUtils { return DateUtils.format(date,DateUtils.DATE_PATTERN_YYYYMM); } + /** + * @Description 获取指定 月份的前n月 返回yyyyMM + * @Param beforeMonth + * @Param monthId + * @author zxc + * @date 2021/7/9 2:44 下午 + */ + public static String getBeforeNMonthByMonth(int beforeMonth, String monthId){ + StringBuilder builder = new StringBuilder(monthId); + builder.insert(NumConstant.FOUR,"-"); + builder.insert(builder.length(),"-01"); + LocalDate parse = LocalDate.parse(builder.toString()); + LocalDate localDate = parse.minusMonths(beforeMonth); + return localDate.toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX); + } + /** * @return java.util.List 返回yyyyMMdd * @param startTime yyyyMMdd From 67ee6c6560319abbbdbfed8d2b9323730a80c2c0 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 9 Jul 2021 16:40:02 +0800 Subject: [PATCH 14/15] =?UTF-8?q?=E5=A2=9E=E9=95=BF=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/constant/GovernConstant.java | 16 ++++ .../screen/ScreenUserJoinDao.java | 10 +++ .../impl/PublicPartExtractServiceImpl.java | 83 ++++++++++++++++++- .../screen/ScreenUserJoinService.java | 10 +++ .../impl/ScreenUserJoinServiceImpl.java | 13 +++ .../screen/ScreenUserJoinDao.xml | 10 +++ 6 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/GovernConstant.java diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/GovernConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/GovernConstant.java new file mode 100644 index 0000000000..9219f505a1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/GovernConstant.java @@ -0,0 +1,16 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @DateTime 2021/7/9 3:24 下午 + * @DESC + */ +public interface GovernConstant { + + /** + * 增长:incr;下降:decr; 相等 :eq; + */ + String INCR = "incr"; + String DECR = "decr"; + String EQ = "eq"; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java index ba45d011da..ada3123821 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java @@ -83,4 +83,14 @@ public interface ScreenUserJoinDao extends BaseDao { * @Date 10:52 2020-08-18 **/ void batchInsertUserJoin(@Param("list") List list, @Param("customerId")String customerId); + + /** + * @Description 根据月份查询screenUserJoin + * @Param customerId + * @Param monthId + * @Param flag :agency : grid + * @author zxc + * @date 2021/7/9 3:13 下午 + */ + List selectScreenUserJoin(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("flag")String flag); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index 5e96035ae9..9260f204e5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.constant.GovernConstant; import com.epmet.constant.OrgTypeConstant; import com.epmet.constant.ProjectConstant; import com.epmet.dto.extract.form.ExtractScreenFormDTO; @@ -407,7 +408,8 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { entity.setAvgJoin(realJoinCount.divide(avgFz, NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); } } - screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.GRID); + ArrayList dispose = dispose(formDTO, insertMap, OrgTypeConstant.GRID); + screenUserJoinService.deleteAndInsertBatch(formDTO, dispose,OrgTypeConstant.GRID); } /** @@ -492,7 +494,84 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { } }); } - screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.AGENCY); + ArrayList dispose = dispose(formDTO, insertMap, OrgTypeConstant.AGENCY); + screenUserJoinService.deleteAndInsertBatch(formDTO, dispose,OrgTypeConstant.AGENCY); } + public ArrayList dispose(ExtractScreenFormDTO formDTO,Map insertMap,String flag) { + String beforeNMonthByMonth = DateUtils.getBeforeNMonthByMonth(NumConstant.ONE, formDTO.getMonthId()); + List screenUserJoinEntities = screenUserJoinService.selectScreenUserJoin(formDTO.getCustomerId(), beforeNMonthByMonth, flag); + ArrayList insertList = new ArrayList<>(insertMap.values()); + if (CollectionUtils.isEmpty(screenUserJoinEntities)) { + insertList.forEach(l -> { + // 总的参与次数较上月增长率 + if (l.getJoinTotal().equals(NumConstant.ZERO)) { + l.setJoinTotalUpFlag(GovernConstant.EQ); + l.setJoinTotalUpRate(NumConstant.ZERO_DECIMAL); + } else if (l.getJoinTotal() > NumConstant.ZERO) { + l.setJoinTotalUpFlag(GovernConstant.INCR); + l.setJoinTotalUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + } + // 人均议题较上月增长率 + if (l.getAvgIssue().equals(NumConstant.ZERO_DECIMAL)) { + l.setAvgIssueUpFlag(GovernConstant.EQ); + l.setAvgIssueUpRate(NumConstant.ZERO_DECIMAL); + } else { + l.setAvgIssueUpFlag(GovernConstant.INCR); + l.setAvgIssueUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + } + // 平均参与度较上月增长率 + if (l.getAvgJoin().equals(NumConstant.ZERO_DECIMAL)) { + l.setAgvgJoinUpFlag(GovernConstant.EQ); + l.setAgvgJoinUpRate(NumConstant.ZERO_DECIMAL); + } else { + l.setAgvgJoinUpFlag(GovernConstant.INCR); + l.setAgvgJoinUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + } + }); + } else { + insertList.forEach(l -> { + screenUserJoinEntities.forEach(s -> { + if (l.getOrgId().equals(s.getOrgId())) { + // 总的参与次数较上月增长率 + if (l.getJoinTotal() > s.getJoinTotal()) { + l.setJoinTotalUpFlag(GovernConstant.INCR); + l.setJoinTotalUpRate(new BigDecimal(((l.getJoinTotal() - s.getJoinTotal()) / s.getJoinTotal()) * NumConstant.ONE_HUNDRED).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } else if (l.getJoinTotal() < s.getJoinTotal()) { + l.setJoinTotalUpFlag(GovernConstant.DECR); + l.setJoinTotalUpRate(new BigDecimal(((l.getJoinTotal() - s.getJoinTotal()) / s.getJoinTotal()) * NumConstant.ONE_HUNDRED).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } else { + l.setJoinTotalUpFlag(GovernConstant.EQ); + l.setJoinTotalUpRate(NumConstant.ZERO_DECIMAL); + } + // 人均议题较上月增长率 + Integer re = l.getAvgIssue().compareTo(s.getAvgIssue()); + if (re.equals(NumConstant.ONE)) { + l.setAvgIssueUpFlag(GovernConstant.INCR); + l.setAvgIssueUpRate(l.getAvgIssue().subtract(s.getAvgIssue()).divide(s.getAvgIssue()).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } else if (re.equals(NumConstant.ONE_NEG)) { + l.setAvgIssueUpFlag(GovernConstant.DECR); + l.setAvgIssueUpRate(l.getAvgIssue().subtract(s.getAvgIssue()).divide(s.getAvgIssue()).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } else { + l.setAvgIssueUpFlag(GovernConstant.EQ); + l.setAvgIssueUpRate(NumConstant.ZERO_DECIMAL); + } + // 平均参与度较上月增长率 + Integer avgJoinRe = l.getAvgJoin().compareTo(s.getAvgJoin()); + if (avgJoinRe.equals(NumConstant.ONE)) { + l.setAgvgJoinUpFlag(GovernConstant.INCR); + l.setAgvgJoinUpRate(l.getAvgJoin().subtract(s.getAvgJoin()).divide(s.getAvgJoin()).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } else if (avgJoinRe.equals(NumConstant.ONE_NEG)) { + l.setAvgIssueUpFlag(GovernConstant.DECR); + l.setAgvgJoinUpRate(l.getAvgJoin().subtract(s.getAvgJoin()).divide(s.getAvgJoin()).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } else { + l.setAvgIssueUpFlag(GovernConstant.EQ); + l.setAgvgJoinUpRate(NumConstant.ZERO_DECIMAL); + } + } + }); + }); + } + return insertList; + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java index dcdf848174..e3574393e8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java @@ -42,4 +42,14 @@ public interface ScreenUserJoinService extends BaseService * @date 2020/9/27 4:40 下午 */ Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list,String delFlag); + + /** + * @Description 根据月份查询screenUserJoin + * @Param customerId + * @Param monthId + * @Param flag :agency : grid + * @author zxc + * @date 2021/7/9 3:13 下午 + */ + List selectScreenUserJoin(String customerId,String monthId,String flag); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java index 978ce14992..97b976e475 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java @@ -124,6 +124,19 @@ public class ScreenUserJoinServiceImpl extends BaseServiceImpl selectScreenUserJoin(String customerId, String monthId, String flag) { + return baseDao.selectScreenUserJoin(customerId, monthId, flag); + } + /** * 计算 本月数值 相较于 上月数值,的增长率 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml index 0fc7db5b18..42cc5ffba3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml @@ -100,4 +100,14 @@ + + + + From c429247428620c4b9f721e1aee653c6e46436190 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 9 Jul 2021 16:49:35 +0800 Subject: [PATCH 15/15] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=8C=87?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java index 97b976e475..a402ac4370 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java @@ -48,11 +48,11 @@ import java.util.List; */ @Slf4j @Service +@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) public class ScreenUserJoinServiceImpl extends BaseServiceImpl implements ScreenUserJoinService { @Override - @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Transactional(rollbackFor = Exception.class) public Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list, String delFlag) { if (formDTO == null || StringUtils.isBlank(formDTO.getCustomerId()) || StringUtils.isBlank(formDTO.getMonthId()) || CollectionUtils.isEmpty(list)) {