Browse Source

添加 热心居民审核历史

dev_shibei_match
zhaoqifeng 6 years ago
parent
commit
7045e178c1
  1. 23
      epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiWarmheartedController.java
  2. 31
      epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiPartymemberFeignClient.java
  3. 22
      epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiPartymemberFeignClientFallBack.java
  4. 12
      epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiWarmheartedService.java
  5. 14
      epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiWarmheartedServiceImpl.java
  6. 31
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedAuditedFromDTO.java
  7. 46
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/result/ResiWarmheartedAuditedResultDTO.java
  8. 20
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java
  9. 8
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java
  10. 131
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedApplyController.java
  11. 9
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/ResiWarmheartedApplyService.java
  12. 403
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java

23
epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiWarmheartedController.java

@ -1,8 +1,17 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditedFromDTO;
import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO;
import com.epmet.service.ResiWarmheartedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Description 政府端管理热心居民业务
* @ClassName ResiWarmheartedController
@ -13,4 +22,18 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("resi/warmhearted")
public class ResiWarmheartedController {
@Autowired
private ResiWarmheartedService resiWarmheartedService;
/**
* 热心居民审核历史列表
*
* @param formDTO 参数
* @return
*/
@PostMapping("audited")
public Result<List<ResiWarmheartedAuditedResultDTO>> audited(@RequestBody ResiWarmheartedAuditedFromDTO formDTO) {
return resiWarmheartedService.audited(formDTO);
}
}

31
epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiPartymemberFeignClient.java

@ -0,0 +1,31 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.feign.fallback.ResiPartymemberFeignClientFallBack;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditedFromDTO;
import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* 调用epmet-user服务
*
* @author 赵奇风
*/
@FeignClient(name = ServiceConstant.RESI_PARTYMEMBER_SERVER, fallback = ResiPartymemberFeignClientFallBack.class,
url = "http://localhost:8096")
public interface ResiPartymemberFeignClient {
/**
* 居民端-热心居民申请-提交申请数据
*
* @author zhaoqf
**/
@PostMapping(value = "resi/partymember/resiwarmheartedapply/audited")
Result<List<ResiWarmheartedAuditedResultDTO>> audited(@RequestBody ResiWarmheartedAuditedFromDTO formDTO);
}

22
epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiPartymemberFeignClientFallBack.java

@ -0,0 +1,22 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.utils.Result;
import com.epmet.feign.ResiPartymemberFeignClient;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditedFromDTO;
import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/4/16 17:01
*/
@Component
public class ResiPartymemberFeignClientFallBack implements ResiPartymemberFeignClient {
@Override
public Result<List<ResiWarmheartedAuditedResultDTO>> audited(ResiWarmheartedAuditedFromDTO formDTO) {
return null;
}
}

12
epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiWarmheartedService.java

@ -1,5 +1,11 @@
package com.epmet.service;
import com.epmet.commons.tools.utils.Result;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditedFromDTO;
import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO;
import java.util.List;
/**
* @Description
* @IntefaceName ResiWarmheartedService
@ -7,4 +13,10 @@ package com.epmet.service;
* @date 2020.04.16 15:37
*/
public interface ResiWarmheartedService {
/**
* 热心居民审核历史列表
* @param formDTO 参数
* @return ResiWarmheartedAuditedResultDTO
*/
Result<List<ResiWarmheartedAuditedResultDTO>> audited(ResiWarmheartedAuditedFromDTO formDTO);
}

14
epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiWarmheartedServiceImpl.java

@ -1,6 +1,13 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.utils.Result;
import com.epmet.feign.ResiPartymemberFeignClient;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditedFromDTO;
import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO;
import com.epmet.service.ResiWarmheartedService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* @Description
@ -9,4 +16,11 @@ import com.epmet.service.ResiWarmheartedService;
* @date 2020.04.16 15:41
*/
public class ResiWarmheartedServiceImpl implements ResiWarmheartedService {
@Autowired
private ResiPartymemberFeignClient resiPartymemberFeignClient;
@Override
public Result<List<ResiWarmheartedAuditedResultDTO>> audited(ResiWarmheartedAuditedFromDTO formDTO) {
return resiPartymemberFeignClient.audited(formDTO);
}
}

31
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedAuditedFromDTO.java

@ -0,0 +1,31 @@
package com.epmet.resi.partymember.dto.warmhearted.form;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription 热心居民-审核历史请求参数
* @date 2020/4/16 13:51
*/
@Data
public class ResiWarmheartedAuditedFromDTO implements Serializable {
private static final long serialVersionUID = -7290137219142856024L;
/**
* 客户id
*/
private String customerId;
/**
* 网格id
*/
private String gridId;
/**
* 页码
*/
private Integer pageNo;
/**
* 每页显示数量
*/
private Integer pageSize;
}

46
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/result/ResiWarmheartedAuditedResultDTO.java

@ -0,0 +1,46 @@
package com.epmet.resi.partymember.dto.warmhearted.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @author zhaoqifeng
* @dscription 热心居民-审核历史返回值
* @date 2020/4/16 13:52
*/
@Data
public class ResiWarmheartedAuditedResultDTO implements Serializable {
private static final long serialVersionUID = 4109086860497055842L;
/**
* 申请单id
*/
private String applyId;
/**
* 申请用户id
*/
private String userId;
/**
* 申请用户头像
*/
private String userHeadPhoto;
/**
* 申请用户显示昵称
*/
private String userNickName;
/**
* 申请时间HH:mm
*/
private Date applyTime;
/**
* 已驳回rejected 已通过approved
*/
private String status;
/**
* 消息通知内容
*/
private String messageText;
}

20
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java

@ -5,22 +5,27 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.UserRoleDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.modules.feign.fallback.EpmetUserFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/3/30 14:51
*/
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class)
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class, url = "http" +
"://localhost:8087")
public interface EpmetUserFeignClient {
/**
* 查询用户注册信息
*
* @param userResiInfoFormDTO 参数
* @return Result<UserResiInfoDTO>
*/
@ -29,11 +34,12 @@ public interface EpmetUserFeignClient {
/**
* 党员认证时如果没有注册居民则注册居民信息
*
* @param userResiInfoDTO
* @author zhaoqifeng
**/
@PostMapping("/epmetuser/userresiinfo/saveResiInfo")
Result saveResiInfo (@RequestBody UserResiInfoDTO userResiInfoDTO);
Result saveResiInfo(@RequestBody UserResiInfoDTO userResiInfoDTO);
/**
* 添加用户角色关系
@ -44,4 +50,14 @@ public interface EpmetUserFeignClient {
@PostMapping("/epmetuser/userrole/saveUserRole")
Result saveUserRole(@RequestBody UserRoleDTO userRoleDTO);
/**
* 根据userId集合查询用户注册信息
*
* @param userResiInfoListFormDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.UserResiInfoDTO>>
* @Date 2020/4/7 18:24
**/
@PostMapping("getuserresiinfolist")
Result<List<UserResiInfoResultDTO>> getUserResiInfoList(@RequestBody UserResiInfoListFormDTO userResiInfoListFormDTO);
}

8
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java

@ -6,10 +6,13 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.UserRoleDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.modules.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
@ -31,4 +34,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
public Result saveUserRole(UserRoleDTO userRoleDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveUserRole", userRoleDTO);
}
@Override
public Result<List<UserResiInfoResultDTO>> getUserResiInfoList(UserResiInfoListFormDTO userResiInfoListFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserResiInfoList", userResiInfoListFormDTO);
}
}

131
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedApplyController.java

@ -29,8 +29,10 @@ import com.epmet.modules.warmhearted.excel.ResiWarmheartedApplyExcel;
import com.epmet.modules.warmhearted.service.ResiWarmheartedApplyService;
import com.epmet.resi.partymember.dto.warmhearted.ResiWarmheartedApplyDTO;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditFormDTO;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditedFromDTO;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedFormDTO;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedSubmitFormDTO;
import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO;
import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -50,64 +52,75 @@ import java.util.Map;
@RequestMapping("resiwarmheartedapply")
public class ResiWarmheartedApplyController {
@Autowired
private ResiWarmheartedApplyService resiWarmheartedApplyService;
@GetMapping("page")
public Result<PageData<ResiWarmheartedApplyDTO>> page(@RequestParam Map<String, Object> params) {
PageData<ResiWarmheartedApplyDTO> page = resiWarmheartedApplyService.page(params);
return new Result<PageData<ResiWarmheartedApplyDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ResiWarmheartedApplyDTO> get(@PathVariable("id") String id) {
ResiWarmheartedApplyDTO data = resiWarmheartedApplyService.get(id);
return new Result<ResiWarmheartedApplyDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ResiWarmheartedApplyDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
resiWarmheartedApplyService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ResiWarmheartedApplyDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
resiWarmheartedApplyService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
resiWarmheartedApplyService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ResiWarmheartedApplyDTO> list = resiWarmheartedApplyService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ResiWarmheartedApplyExcel.class);
}
@PostMapping("init")
public Result<ResiWarmheartedResultDTO> init(@RequestBody ResiWarmheartedFormDTO formDTO) {
return resiWarmheartedApplyService.init(formDTO);
}
@PostMapping("submit")
public Result submit(@RequestBody ResiWarmheartedSubmitFormDTO formDTO) {
return resiWarmheartedApplyService.submit(formDTO);
}
@PostMapping("manageaudit")
public Result manageAudit(@RequestBody ResiWarmheartedAuditFormDTO formDTO) {
return resiWarmheartedApplyService.manageAudit(formDTO);
}
@Autowired
private ResiWarmheartedApplyService resiWarmheartedApplyService;
@GetMapping("page")
public Result<PageData<ResiWarmheartedApplyDTO>> page(@RequestParam Map<String, Object> params) {
PageData<ResiWarmheartedApplyDTO> page = resiWarmheartedApplyService.page(params);
return new Result<PageData<ResiWarmheartedApplyDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ResiWarmheartedApplyDTO> get(@PathVariable("id") String id) {
ResiWarmheartedApplyDTO data = resiWarmheartedApplyService.get(id);
return new Result<ResiWarmheartedApplyDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ResiWarmheartedApplyDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
resiWarmheartedApplyService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ResiWarmheartedApplyDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
resiWarmheartedApplyService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
resiWarmheartedApplyService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ResiWarmheartedApplyDTO> list = resiWarmheartedApplyService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ResiWarmheartedApplyExcel.class);
}
@PostMapping("init")
public Result<ResiWarmheartedResultDTO> init(@RequestBody ResiWarmheartedFormDTO formDTO) {
return resiWarmheartedApplyService.init(formDTO);
}
@PostMapping("submit")
public Result submit(@RequestBody ResiWarmheartedSubmitFormDTO formDTO) {
return resiWarmheartedApplyService.submit(formDTO);
}
@PostMapping("manageaudit")
public Result manageAudit(@RequestBody ResiWarmheartedAuditFormDTO formDTO) {
return resiWarmheartedApplyService.manageAudit(formDTO);
}
/**
* 热心居民审核历史列表
*
* @param formDTO 参数
* @return
*/
@PostMapping("audited")
public Result<List<ResiWarmheartedAuditedResultDTO>> audited(@RequestBody ResiWarmheartedAuditedFromDTO formDTO) {
return resiWarmheartedApplyService.audited(formDTO);
}
}

9
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/ResiWarmheartedApplyService.java

@ -23,8 +23,10 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.modules.warmhearted.entity.ResiWarmheartedApplyEntity;
import com.epmet.resi.partymember.dto.warmhearted.ResiWarmheartedApplyDTO;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditFormDTO;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditedFromDTO;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedFormDTO;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedSubmitFormDTO;
import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO;
import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedResultDTO;
import java.util.List;
@ -124,4 +126,11 @@ public interface ResiWarmheartedApplyService extends BaseService<ResiWarmhearted
* @author sun
*/
Result manageAudit(ResiWarmheartedAuditFormDTO formDTO);
/**
* 热心居民审核历史列表
* @param formDTO 参数
* @return ResiWarmheartedAuditedResultDTO
*/
Result<List<ResiWarmheartedAuditedResultDTO>> audited(ResiWarmheartedAuditedFromDTO formDTO);
}

403
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java

@ -19,7 +19,6 @@ package com.epmet.modules.warmhearted.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
@ -33,9 +32,9 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.PartyMemberConstant;
import com.epmet.dto.UserRoleDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.utils.ModuleConstant;
import com.epmet.modules.warmhearted.constant.ResiWarmheartedVisitConstant;
import com.epmet.modules.warmhearted.dao.ResiWarmheartedApplyDao;
import com.epmet.modules.warmhearted.entity.ResiWarmheartedApplyEntity;
@ -44,21 +43,23 @@ import com.epmet.modules.warmhearted.service.ResiWarmheartedApplyService;
import com.epmet.modules.warmhearted.service.ResiWarmheartedVisitService;
import com.epmet.resi.partymember.dto.warmhearted.ResiWarmheartedApplyDTO;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditFormDTO;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditedFromDTO;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedFormDTO;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedSubmitFormDTO;
import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO;
import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedResultDTO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.Date;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.stream.Collectors;
/**
* 热心居民申请表
@ -69,174 +70,226 @@ import org.slf4j.LoggerFactory;
@Service
public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmheartedApplyDao, ResiWarmheartedApplyEntity> implements ResiWarmheartedApplyService {
private static final Logger logger = LoggerFactory.getLogger(ResiWarmheartedApplyServiceImpl.class);
@Autowired
private ResiWarmheartedApplyRedis resiWarmheartedApplyRedis;
@Autowired
private ResiWarmheartedVisitService resiWarmheartedVisitService;
@Autowired
private ResiWarmheartedApplyDao resiWarmheartedApplyDao;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Override
public PageData<ResiWarmheartedApplyDTO> page(Map<String, Object> params) {
IPage<ResiWarmheartedApplyEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ResiWarmheartedApplyDTO.class);
}
@Override
public List<ResiWarmheartedApplyDTO> list(Map<String, Object> params) {
List<ResiWarmheartedApplyEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ResiWarmheartedApplyDTO.class);
}
private QueryWrapper<ResiWarmheartedApplyEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<ResiWarmheartedApplyEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public ResiWarmheartedApplyDTO get(String id) {
ResiWarmheartedApplyEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ResiWarmheartedApplyDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ResiWarmheartedApplyDTO dto) {
ResiWarmheartedApplyEntity entity = ConvertUtils.sourceToTarget(dto, ResiWarmheartedApplyEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ResiWarmheartedApplyDTO dto) {
ResiWarmheartedApplyEntity entity = ConvertUtils.sourceToTarget(dto, ResiWarmheartedApplyEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result<ResiWarmheartedResultDTO> init(ResiWarmheartedFormDTO formDTO) {
Result<ResiWarmheartedResultDTO> result = new Result<ResiWarmheartedResultDTO>();
//0:先判断该用户是否是已注册居民
UserResiInfoFormDTO userResiInfoFormDTO = new UserResiInfoFormDTO();
userResiInfoFormDTO.setCustomerId(formDTO.getCustomerId());
userResiInfoFormDTO.setUserId(formDTO.getUserId());
Result<UserResiInfoResultDTO> result1 = epmetUserFeignClient.getUserResiInfoDTO(userResiInfoFormDTO);
if (!result1.success() || null == result1.getData()) {
result.setCode(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode());
result.setMsg(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg());
return result;
}
//1:热心居民申请行为记录表新增数据
result = resiWarmheartedVisitService.saveResiWarmheartedVisit(formDTO);
if (!result.success()) {
logger.error(ResiWarmheartedVisitConstant.OPERATION_EXCEPTION);
}
ResiWarmheartedResultDTO resiWarmheartedResultDTO = result.getData();
//2:查询是否已申请热心居民(不查询审核未通过的)
formDTO.setAuditStatus(ResiWarmheartedVisitConstant.REJECTED);
ResiWarmheartedApplyDTO resiWarmheartedApplyDTO = resiWarmheartedApplyDao.selectResiWarmheartedApply(formDTO);
if (null == resiWarmheartedApplyDTO || StringUtils.isEmpty(resiWarmheartedApplyDTO.getId())) {
//是否已申请热心居民 0:否, 1:是
resiWarmheartedResultDTO.setIsApplied(NumConstant.ZERO_STR);
} else {
resiWarmheartedResultDTO.setIsApplied(NumConstant.ONE_STR);
result.setCode(NumConstant.ZERO);
result.setMsg(ResiWarmheartedVisitConstant.RESI_WARM_INIT);
}
return result.ok(resiWarmheartedResultDTO);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result submit(ResiWarmheartedSubmitFormDTO formDTO) {
Result result = new Result();
//0:为防止前台点击多次提交 先查询一下是否有已提交数据
ResiWarmheartedFormDTO ResiWarmheartedFormDTO = ConvertUtils.sourceToTarget(formDTO, ResiWarmheartedFormDTO.class);
ResiWarmheartedFormDTO.setAuditStatus(ResiWarmheartedVisitConstant.REJECTED);
ResiWarmheartedApplyDTO resiWarmheartedApplyDTO = resiWarmheartedApplyDao.selectResiWarmheartedApply(ResiWarmheartedFormDTO);
if (null != resiWarmheartedApplyDTO) {
logger.error(ResiWarmheartedVisitConstant.REPEAT_EXCEPTION);
throw new RenException(ResiWarmheartedVisitConstant.REPEAT_EXCEPTION);
}else{
//1:将申请记录存入热心居民申请表中
saveResiWarmApply(formDTO);
//2:将最后一次操作行为更新到热心居民申请行为记录表中
resiWarmheartedVisitService.updateResiWarmVisit(formDTO);
result.setCode(NumConstant.ZERO);
result.setMsg(ResiWarmheartedVisitConstant.RESI_WARM_SUBMIT);
}
return result;
}
/**
* 热心居民申请表新增数据
*
* @param formDTO
* @return
*/
public void saveResiWarmApply(ResiWarmheartedSubmitFormDTO formDTO) {
ResiWarmheartedApplyEntity entity = new ResiWarmheartedApplyEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setGridId(formDTO.getGridId());
entity.setUserId(formDTO.getUserId());
entity.setReason(formDTO.getReason());
entity.setResiWarmVisitId(formDTO.getResiWarmVisitId());
entity.setAuditStatus(ResiWarmheartedVisitConstant.UNDER_AUDITTING);
baseDao.insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result manageAudit(ResiWarmheartedAuditFormDTO formDTO) {
Result result = new Result();
//1:更新热心居民申请表数据
ResiWarmheartedApplyEntity entity = new ResiWarmheartedApplyEntity();
entity.setId(formDTO.getResiWarmApplyId());
if (NumConstant.ZERO_STR.equals(formDTO.getAuditStatus())) {
//审核状态-未通过
entity.setAuditStatus(PartyMemberConstant.REJECTED);
} else {
//审核状态-通过
entity.setAuditStatus(PartyMemberConstant.APPROVED);
}
if (!StringUtils.isBlank(formDTO.getRefuseReason())) {
entity.setRefuseReason(formDTO.getRefuseReason());
}
int num = baseDao.updateById(entity);
//2:审核通过的添加热心居民的角色
if (num > NumConstant.ZERO && NumConstant.ONE_STR.equals(formDTO.getAuditStatus())) {
//查询需要添加热心居民角色的userId
ResiWarmheartedApplyEntity resiWarmheartedApplyEntity = baseDao.selectById(formDTO.getResiWarmApplyId());
UserRoleDTO dto = new UserRoleDTO();
dto.setCustomerId(formDTO.getCustomerId());
dto.setUserId(resiWarmheartedApplyEntity.getUserId());
//所属端-居民端
dto.setApp(AppClientConstant.APP_RESI);
//角色-热心居民
dto.setRoleKey(EpmetRoleKeyConstant.WARMHEARTED);
//角色表新增网格Id
dto.setGridId(resiWarmheartedApplyEntity.getGridId());
result = epmetUserFeignClient.saveUserRole(dto);
private static final Logger logger = LoggerFactory.getLogger(ResiWarmheartedApplyServiceImpl.class);
@Autowired
private ResiWarmheartedApplyRedis resiWarmheartedApplyRedis;
@Autowired
private ResiWarmheartedVisitService resiWarmheartedVisitService;
@Autowired
private ResiWarmheartedApplyDao resiWarmheartedApplyDao;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Override
public PageData<ResiWarmheartedApplyDTO> page(Map<String, Object> params) {
IPage<ResiWarmheartedApplyEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ResiWarmheartedApplyDTO.class);
}
@Override
public List<ResiWarmheartedApplyDTO> list(Map<String, Object> params) {
List<ResiWarmheartedApplyEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ResiWarmheartedApplyDTO.class);
}
private QueryWrapper<ResiWarmheartedApplyEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<ResiWarmheartedApplyEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public ResiWarmheartedApplyDTO get(String id) {
ResiWarmheartedApplyEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ResiWarmheartedApplyDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ResiWarmheartedApplyDTO dto) {
ResiWarmheartedApplyEntity entity = ConvertUtils.sourceToTarget(dto, ResiWarmheartedApplyEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ResiWarmheartedApplyDTO dto) {
ResiWarmheartedApplyEntity entity = ConvertUtils.sourceToTarget(dto, ResiWarmheartedApplyEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result<ResiWarmheartedResultDTO> init(ResiWarmheartedFormDTO formDTO) {
Result<ResiWarmheartedResultDTO> result = new Result<ResiWarmheartedResultDTO>();
//0:先判断该用户是否是已注册居民
UserResiInfoFormDTO userResiInfoFormDTO = new UserResiInfoFormDTO();
userResiInfoFormDTO.setCustomerId(formDTO.getCustomerId());
userResiInfoFormDTO.setUserId(formDTO.getUserId());
Result<UserResiInfoResultDTO> result1 = epmetUserFeignClient.getUserResiInfoDTO(userResiInfoFormDTO);
if (!result1.success() || null == result1.getData()) {
result.setCode(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode());
result.setMsg(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg());
return result;
}
//1:热心居民申请行为记录表新增数据
result = resiWarmheartedVisitService.saveResiWarmheartedVisit(formDTO);
if (!result.success()) {
logger.error(ResiWarmheartedVisitConstant.OPERATION_EXCEPTION);
}
ResiWarmheartedResultDTO resiWarmheartedResultDTO = result.getData();
//2:查询是否已申请热心居民(不查询审核未通过的)
formDTO.setAuditStatus(ResiWarmheartedVisitConstant.REJECTED);
ResiWarmheartedApplyDTO resiWarmheartedApplyDTO = resiWarmheartedApplyDao.selectResiWarmheartedApply(formDTO);
if (null == resiWarmheartedApplyDTO || StringUtils.isEmpty(resiWarmheartedApplyDTO.getId())) {
//是否已申请热心居民 0:否, 1:是
resiWarmheartedResultDTO.setIsApplied(NumConstant.ZERO_STR);
} else {
resiWarmheartedResultDTO.setIsApplied(NumConstant.ONE_STR);
result.setCode(NumConstant.ZERO);
result.setMsg(ResiWarmheartedVisitConstant.RESI_WARM_INIT);
}
return result.ok(resiWarmheartedResultDTO);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result submit(ResiWarmheartedSubmitFormDTO formDTO) {
Result result = new Result();
//0:为防止前台点击多次提交 先查询一下是否有已提交数据
ResiWarmheartedFormDTO ResiWarmheartedFormDTO = ConvertUtils.sourceToTarget(formDTO, ResiWarmheartedFormDTO.class);
ResiWarmheartedFormDTO.setAuditStatus(ResiWarmheartedVisitConstant.REJECTED);
ResiWarmheartedApplyDTO resiWarmheartedApplyDTO = resiWarmheartedApplyDao.selectResiWarmheartedApply(ResiWarmheartedFormDTO);
if (null != resiWarmheartedApplyDTO) {
logger.error(ResiWarmheartedVisitConstant.REPEAT_EXCEPTION);
throw new RenException(ResiWarmheartedVisitConstant.REPEAT_EXCEPTION);
} else {
//1:将申请记录存入热心居民申请表中
saveResiWarmApply(formDTO);
//2:将最后一次操作行为更新到热心居民申请行为记录表中
resiWarmheartedVisitService.updateResiWarmVisit(formDTO);
result.setCode(NumConstant.ZERO);
result.setMsg(ResiWarmheartedVisitConstant.RESI_WARM_SUBMIT);
}
return result;
}
/**
* 热心居民申请表新增数据
*
* @param formDTO
* @return
*/
public void saveResiWarmApply(ResiWarmheartedSubmitFormDTO formDTO) {
ResiWarmheartedApplyEntity entity = new ResiWarmheartedApplyEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setGridId(formDTO.getGridId());
entity.setUserId(formDTO.getUserId());
entity.setReason(formDTO.getReason());
entity.setResiWarmVisitId(formDTO.getResiWarmVisitId());
entity.setAuditStatus(ResiWarmheartedVisitConstant.UNDER_AUDITTING);
baseDao.insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result manageAudit(ResiWarmheartedAuditFormDTO formDTO) {
Result result = new Result();
//1:更新热心居民申请表数据
ResiWarmheartedApplyEntity entity = new ResiWarmheartedApplyEntity();
entity.setId(formDTO.getResiWarmApplyId());
if (NumConstant.ZERO_STR.equals(formDTO.getAuditStatus())) {
//审核状态-未通过
entity.setAuditStatus(PartyMemberConstant.REJECTED);
} else {
//审核状态-通过
entity.setAuditStatus(PartyMemberConstant.APPROVED);
}
if (!StringUtils.isBlank(formDTO.getRefuseReason())) {
entity.setRefuseReason(formDTO.getRefuseReason());
}
int num = baseDao.updateById(entity);
//2:审核通过的添加热心居民的角色
if (num > NumConstant.ZERO && NumConstant.ONE_STR.equals(formDTO.getAuditStatus())) {
//查询需要添加热心居民角色的userId
ResiWarmheartedApplyEntity resiWarmheartedApplyEntity = baseDao.selectById(formDTO.getResiWarmApplyId());
UserRoleDTO dto = new UserRoleDTO();
dto.setCustomerId(formDTO.getCustomerId());
dto.setUserId(resiWarmheartedApplyEntity.getUserId());
//所属端-居民端
dto.setApp(AppClientConstant.APP_RESI);
//角色-热心居民
dto.setRoleKey(EpmetRoleKeyConstant.WARMHEARTED);
//角色表新增网格Id
dto.setGridId(resiWarmheartedApplyEntity.getGridId());
result = epmetUserFeignClient.saveUserRole(dto);
}
return result;
}
@Override
public Result<List<ResiWarmheartedAuditedResultDTO>> audited(ResiWarmheartedAuditedFromDTO formDTO) {
Result<List<ResiWarmheartedAuditedResultDTO>> result = new Result<>();
List<ResiWarmheartedAuditedResultDTO> resultList = new ArrayList<>();
//查询条件
ResiWarmheartedApplyDTO applyDTO = ConvertUtils.sourceToTarget(formDTO, ResiWarmheartedApplyDTO.class);
applyDTO.setAuditStatus(PartyMemberConstant.UNDER_AUDITTING);
//获取审核列表
List<ResiWarmheartedApplyEntity> applyList =
baseDao.selectList(getWrapper(applyDTO).orderByDesc("UPDATED_TIME"));
if (null == applyList || applyList.size() == 0) {
return result.ok(resultList);
}
//提取所有userID
List<String> userIds =
applyList.stream().map(ResiWarmheartedApplyEntity::getUserId).collect(Collectors.toList());
//获取用户昵称,头像
UserResiInfoListFormDTO userResiInfoListFormDTO = new UserResiInfoListFormDTO();
userResiInfoListFormDTO.setUserIdList(userIds);
List<UserResiInfoResultDTO> userResiInfoList =
epmetUserFeignClient.getUserResiInfoList(userResiInfoListFormDTO).getData();
if (null == userResiInfoList || userResiInfoList.size() == 0) {
return result.ok(resultList);
}
return result;
}
resultList = applyList.stream().flatMap(apply -> userResiInfoList.stream().filter(user ->
apply.getUserId().equals(user.getUserId())).map(userInfo -> {
ResiWarmheartedAuditedResultDTO resultDTO = new ResiWarmheartedAuditedResultDTO();
resultDTO.setApplyId(apply.getId());
resultDTO.setUserId(apply.getUserId());
resultDTO.setStatus(apply.getAuditStatus());
resultDTO.setApplyTime(apply.getUpdatedTime());
resultDTO.setMessageText(apply.getMessageText());
resultDTO.setUserNickName(userInfo.getShowName());
resultDTO.setUserHeadPhoto(userInfo.getHeadPhoto());
return resultDTO;
})).collect(Collectors.toList());
return result.ok(resultList);
}
private QueryWrapper<ResiWarmheartedApplyEntity> getWrapper(ResiWarmheartedApplyDTO params) {
String customerId = params.getCustomerId();
String gridId = params.getGridId();
String auditStatus = params.getAuditStatus();
QueryWrapper<ResiWarmheartedApplyEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(customerId), "CUSTOMER_ID", customerId)
.eq(StringUtils.isNotBlank(gridId), "GRID_ID", gridId)
.ne(StringUtils.isNotBlank(auditStatus), "AUDIT_STATUS", auditStatus);
return wrapper;
}
}

Loading…
Cancel
Save