Browse Source

群补建功能增加

hotfix/yujt_opt
zhangyuan 5 years ago
parent
commit
330a96203b
  1. 2
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/feign/AdminFeignClient.java
  2. 17
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/dao/GroupDao.java
  3. 18
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/police/controller/PoliceController.java
  4. 13
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/police/service/PoliceService.java
  5. 77
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/police/service/impl/PoliceServiceImpl.java
  6. 2
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/entity/PropertyProjectScoreEntity.java
  7. 17
      epdc-cloud-property/src/main/resources/mapper/group/GroupDao.xml

2
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/feign/AdminFeignClient.java

@ -50,6 +50,6 @@ public interface AdminFeignClient {
* @author work@yujt.net.cn
* @date 2020/5/22 08:57
*/
@GetMapping("optimize/deptlevel/listByParent/{typeKey}/{deptId}")
@GetMapping("sys/optimize/deptlevel/listByParent/{typeKey}/{deptId}")
Result<List<DeptLevelAndLeaderDTO>> listChildDeptLevelById(@PathVariable("typeKey") String typeKey, @PathVariable("deptId") Long deptId);
}

17
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/dao/GroupDao.java

@ -18,6 +18,7 @@
package com.elink.esua.epdc.modules.group.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.DeptLevelAndLeaderDTO;
import com.elink.esua.epdc.dto.group.*;
import com.elink.esua.epdc.dto.group.form.GroupDetailForMobileEndFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupsOfMineFormDTO;
@ -123,12 +124,22 @@ public interface GroupDao extends BaseDao<GroupEntity> {
/**
* 获取警群社区下所有社群
*
* @return java.util.List<com.elink.esua.epdc.dto.group.GroupListDTO>
* @return java.util.List<com.elink.esua.epdc.dto.DeptLevelAndLeaderDTO>
* @params [deptId]
* @author liuchuang
* @author zhangyuan
* @since 2019/11/12 9:35
*/
List<GroupListDTO> selectListOfGroupByDeptIds(List<DeptLevelAndLeaderDTO> list);
/**
* 获取社区下所有社群
*
* @return java.util.List<com.elink.esua.epdc.dto.DeptLevelAndLeaderDTO>
* @params [deptId]
* @author zhangyuan
* @since 2019/11/12 9:35
*/
List<GroupListDTO> selectListOfGroupByDeptId(Long deptId);
List<DeptLevelAndLeaderDTO> selectListOfGroupByDeptId(@Param("deptId") String deptId);
/**
* 排行榜-活跃度

18
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/police/controller/PoliceController.java

@ -50,19 +50,19 @@ public class PoliceController {
private PoliceService policeService;
@GetMapping("page")
public Result<PageData<PoliceDTO>> page(@RequestParam Map<String, Object> params){
public Result<PageData<PoliceDTO>> page(@RequestParam Map<String, Object> params) {
PageData<PoliceDTO> page = policeService.page(params);
return new Result<PageData<PoliceDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<PoliceDTO> get(@PathVariable("id") String id){
public Result<PoliceDTO> get(@PathVariable("id") String id) {
PoliceDTO data = policeService.get(id);
return new Result<PoliceDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody PoliceDTO dto){
public Result save(@RequestBody PoliceDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
policeService.save(dto);
@ -70,15 +70,23 @@ public class PoliceController {
}
@PutMapping
public Result update(@RequestBody PoliceDTO dto){
public Result update(@RequestBody PoliceDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
policeService.update(dto);
return new Result();
}
@PutMapping("supplement")
public Result supplement(@RequestBody PoliceDTO[] dtos) {
//效验数据
AssertUtils.isArrayEmpty(dtos, "dto");
policeService.supplement(dtos);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
policeService.delete(ids);

13
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/police/service/PoliceService.java

@ -19,6 +19,7 @@ package com.elink.esua.epdc.modules.police.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.police.PoliceDTO;
import com.elink.esua.epdc.modules.police.entity.PoliceEntity;
@ -71,7 +72,7 @@ public interface PoliceService extends BaseService<PoliceEntity> {
* @author generator
* @date 2020-05-21
*/
void save(PoliceDTO dto);
Result save(PoliceDTO dto);
/**
* 默认更新
@ -92,4 +93,14 @@ public interface PoliceService extends BaseService<PoliceEntity> {
* @date 2020-05-21
*/
void delete(String[] ids);
/**
* 群补建
*
* @param ids
* @return void
* @author zhangyuan
* @date 2020-05-21
*/
void supplement(PoliceDTO[] ids);
}

77
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/police/service/impl/PoliceServiceImpl.java

@ -21,11 +21,13 @@ 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.mybatis.utils.DeptEntityUtils;
import com.elink.esua.epdc.commons.tools.constant.OrganizationTypeConstant;
import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.DeptLevelAndLeaderDTO;
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO;
import com.elink.esua.epdc.dto.constant.GroupConstant;
import com.elink.esua.epdc.dto.enums.GroupStateEnum;
@ -48,6 +50,8 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import static java.util.stream.Collectors.toList;
/**
* 民警表
*
@ -98,9 +102,12 @@ public class PoliceServiceImpl extends BaseServiceImpl<PoliceDao, PoliceEntity>
@Override
@Transactional(rollbackFor = Exception.class)
public void save(PoliceDTO dto) {
public Result save(PoliceDTO dto) {
PoliceEntity entity = ConvertUtils.sourceToTarget(dto, PoliceEntity.class);
// 先查询该社区下有没有网格群,没有就同时创建民警和群,有就表示已经创建过。
List<DeptLevelAndLeaderDTO> deptList = adminFeignClient.listChildDeptLevelById(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY, entity.getDeptId()).getData();
List<GroupListDTO> groupList = groupDao.selectListOfGroupByDeptIds(deptList);
if (groupList.size() == 0) {
ParentAndAllDeptDTO parentAndAllDeptDTO = getParentAndAllDeptDTO(dto.getDeptId() + "");
// 保存机构,及其他冗余字段。
@ -111,12 +118,12 @@ public class PoliceServiceImpl extends BaseServiceImpl<PoliceDao, PoliceEntity>
entity.setDeptName(parentAndAllDeptDTO.getGrid());
insert(entity);
List<GroupListDTO> groupList = groupDao.selectListOfGroupByDeptId(entity.getDeptId());
if (groupList.size() == 0) {
// 创民警的同时创建群
deptList.forEach(dept -> {
ParentAndAllDeptDTO parentAndAllDeptDTOChild = getParentAndAllDeptDTO(dept.getDeptId() + "");
GroupEntity groupEntity = new GroupEntity();
DeptEntityUtils.loadDeptInfo(
ConvertUtils.sourceToTarget(parentAndAllDeptDTO, DeptEntityUtils.DeptDto.class),
ConvertUtils.sourceToTarget(parentAndAllDeptDTOChild, DeptEntityUtils.DeptDto.class),
groupEntity
);
groupEntity.setReferenceBusinessId(entity.getId());
@ -124,9 +131,13 @@ public class PoliceServiceImpl extends BaseServiceImpl<PoliceDao, PoliceEntity>
groupEntity.setGroupAvatar(GroupConstant.PROPERTY_GROUP_AVATAR);
groupEntity.setGroupName(entity.getDeptName() + "警民群");
groupEntity.setGroupCategory(GroupConstant.POLICE_GROUP_CATEGORY);
groupEntity.setGrid(entity.getDeptName());
groupEntity.setGridId(entity.getDeptId());
groupEntity.setGrid(dept.getDeptName());
groupEntity.setGridId(dept.getDeptId());
groupDao.insert(groupEntity);
});
return new Result();
} else {
return new Result().error();
}
}
@ -134,40 +145,46 @@ public class PoliceServiceImpl extends BaseServiceImpl<PoliceDao, PoliceEntity>
@Transactional(rollbackFor = Exception.class)
public void update(PoliceDTO dto) {
PoliceEntity entity = ConvertUtils.sourceToTarget(dto, PoliceEntity.class);
ParentAndAllDeptDTO parentAndAllDeptDTO = getParentAndAllDeptDTO(dto.getDeptId()+"");
// 保存机构,及其他冗余字段。
DeptEntityUtils.loadDeptInfo(
ConvertUtils.sourceToTarget(parentAndAllDeptDTO, DeptEntityUtils.DeptDto.class),
entity
);
entity.setDeptName(parentAndAllDeptDTO.getGrid());
updateById(entity);
}
List<GroupListDTO> groupList = groupDao.selectListOfGroupByDeptId(entity.getDeptId());
if (groupList.size() == 0) {
// 创民警的同时创建群
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void supplement(PoliceDTO[] ids) {
for (PoliceDTO dto : ids) {
// 社区ID下有多少个网格信息
List<DeptLevelAndLeaderDTO> deptList = adminFeignClient.listChildDeptLevelById(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY, dto.getDeptId()).getData();
// 现有的群的网格信息
List<DeptLevelAndLeaderDTO> existedDeptList = groupDao.selectListOfGroupByDeptId(dto.getDeptId() + "");
// 求差集,即为还没有创建过群的网格ID
List<DeptLevelAndLeaderDTO> reduce = deptList.stream().filter(item -> !existedDeptList.contains(item)).collect(toList());
// 补建群
reduce.forEach(dept -> {
ParentAndAllDeptDTO parentAndAllDeptDTOChild = getParentAndAllDeptDTO(dept.getDeptId() + "");
GroupEntity groupEntity = new GroupEntity();
//保存用户居住地所在网格,及其他冗余字段。
DeptEntityUtils.loadDeptInfo(
ConvertUtils.sourceToTarget(parentAndAllDeptDTO, DeptEntityUtils.DeptDto.class),
ConvertUtils.sourceToTarget(parentAndAllDeptDTOChild, DeptEntityUtils.DeptDto.class),
groupEntity
);
groupEntity.setReferenceBusinessId(entity.getId());
groupEntity.setReferenceBusinessId(dto.getId());
groupEntity.setState(GroupStateEnum.GROUP_STATE_EXAMINATION_PASSED.getValue());
groupEntity.setGroupAvatar(GroupConstant.PROPERTY_GROUP_AVATAR);
groupEntity.setGroupName(entity.getDeptName() + "警民群");
groupEntity.setGroupName(dto.getDeptName() + "警民群");
groupEntity.setGroupCategory(GroupConstant.POLICE_GROUP_CATEGORY);
groupEntity.setGrid(entity.getDeptName());
groupEntity.setGridId(entity.getDeptId());
groupEntity.setGrid(dept.getDeptName());
groupEntity.setGridId(dept.getDeptId());
groupDao.insert(groupEntity);
});
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}

2
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/entity/PropertyProjectScoreEntity.java

@ -57,6 +57,6 @@ public class PropertyProjectScoreEntity extends BaseEpdcEntity {
/**
* 得分
*/
private BigDecimal score;
private Integer score;
}

17
epdc-cloud-property/src/main/resources/mapper/group/GroupDao.xml

@ -315,7 +315,7 @@ ORDER BY
AND GRID_ID = #{deptId}
</select>
<select id="selectListOfGroupByDeptId" resultType="com.elink.esua.epdc.dto.group.GroupListDTO">
<select id="selectListOfGroupByDeptIds" resultType="com.elink.esua.epdc.dto.group.GroupListDTO">
SELECT
ID AS groupId,
GROUP_NAME AS groupName
@ -324,7 +324,20 @@ ORDER BY
WHERE
DEL_FLAG = '0'
AND STATE IN ( 10, 15 )
AND GRID_ID = #{deptId}
AND GRID_ID IN
<foreach collection="deptList" item="dept" open="(" separator="," close=")">#{dept.groupId}</foreach>
</select>
<select id="selectListOfGroupByDeptId" resultType="com.elink.esua.epdc.dto.DeptLevelAndLeaderDTO">
SELECT
DEPT_ID,
DEPT_NAME
FROM
epdc_group
WHERE
DEL_FLAG = '0'
AND STATE IN ( 10, 15 )
AND PARENT_DEPT_IDS LIKE CONCAT( '%', #{deptId} )
</select>
<select id="selectListOfGroupOrderByActivity" resultType="com.elink.esua.epdc.dto.group.GroupActivityDTO">

Loading…
Cancel
Save