Browse Source

Merge branch 'dev_sentryPost' into dev_analysis

dev
yujintao 6 years ago
parent
commit
7d7168a6dc
  1. 40
      esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/result/EpdcSentryPostInfoResultDTO.java
  2. 95
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiCustomController.java
  3. 8
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/CustomFeignClient.java
  4. 23
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java
  5. 6
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/CustomFeignClientFallback.java
  6. 5
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java
  7. 21
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/CustomService.java
  8. 79
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/CustomServiceImpl.java
  9. 116
      esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/EpidemicSentryPostDTO.java
  10. 26
      esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/CreateCodeFormDTO.java
  11. 32
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/pom.xml
  12. 56
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/config/StreamUtils.java
  13. 175
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/controller/EpidemicSentryPostController.java
  14. 59
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/dao/EpidemicSentryPostDao.java
  15. 86
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/entity/EpidemicSentryPostEntity.java
  16. 83
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/excel/EpidemicSentryPostExcel.java
  17. 31
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/feign/OssFeignClient.java
  18. 22
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/feign/fallback/OssFeignClientFallback.java
  19. 47
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/redis/EpidemicSentryPostRedis.java
  20. 153
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/service/EpidemicSentryPostService.java
  21. 301
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/EpidemicSentryPostServiceImpl.java
  22. 19
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/application.yml
  23. 66
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/epidemic/EpidemicSentryPostDao.xml
  24. 10
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/UserDTO.java
  25. 81
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/UserCarInfoDTO.java
  26. 47
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcAppPidemicCompleteInfoFromDTO.java
  27. 12
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppUserController.java
  28. 94
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/UserCarInfoController.java
  29. 33
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/UserCarInfoDao.java
  30. 51
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/UserCarInfoEntity.java
  31. 10
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/UserEntity.java
  32. 62
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/UserCarInfoExcel.java
  33. 47
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/UserCarInfoRedis.java
  34. 104
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserCarInfoService.java
  35. 11
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserService.java
  36. 112
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserCarInfoServiceImpl.java
  37. 36
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java
  38. 19
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/UserCarInfoDao.xml

40
esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/result/EpdcSentryPostInfoResultDTO.java

@ -0,0 +1,40 @@
package com.elink.esua.epdc.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @author songyunpeng
* @Description 根据小程序码内的字符串解析机构名称和第三方哨卡id接口 返回结果集
* @create 2020-02-14
*/
@Data
public class EpdcSentryPostInfoResultDTO implements Serializable {
/**
* 街道名
*/
private String streetName;
/**
* 社区名
*/
private String communityName;
/**
* 网格ID
*/
private Long gridId;
/**
* 网格名
*/
private String gridName;
/**
* 哨卡名称
*/
private String sentryPostName;
/**
* 第三方哨卡ID
*/
private String thirdSentryPostId;
}

95
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiCustomController.java

@ -1,9 +1,13 @@
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.annotation.LoginUser;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.dto.DeptOption;
import com.elink.esua.epdc.dto.epdc.form.EpdcAppPidemicCompleteInfoFromDTO;
import com.elink.esua.epdc.dto.form.EpiDemicReportFormDTO;
import com.elink.esua.epdc.dto.result.EpdcSentryPostInfoResultDTO;
import com.elink.esua.epdc.service.CustomService;
import com.elink.esua.epdc.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
@ -18,47 +22,64 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("custom/epidemic")
public class ApiCustomController {
@Autowired
private CustomService customService;
@Autowired
private CustomService customService;
@Autowired
private MessageService messageService;
@Autowired
private MessageService messageService;
/**
* @param
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @Author yinzuomei
* @Description 获取所有组织机构信息
* @Date 2020/1/28 11:50
**/
@GetMapping("getDeptTree")
public Result<DeptOption> getDeptTree() {
return customService.getDeptTree();
}
/**
* @param
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @Author yinzuomei
* @Description 获取所有组织机构信息
* @Date 2020/1/28 11:50
**/
@GetMapping("getDeptTree")
public Result<DeptOption> getDeptTree() {
return customService.getDeptTree();
}
/**
* @param mobile 手机号码
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @Author yinzuomei
* @Description 发送短信验证码
* @Date 2020/1/28 11:55
**/
@GetMapping("sendCode")
public Result sendCode(String mobile) {
return messageService.sendSmsCode(mobile);
}
/**
* @param mobile 手机号码
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @Author yinzuomei
* @Description 发送短信验证码
* @Date 2020/1/28 11:55
**/
@GetMapping("sendCode")
public Result sendCode(String mobile) {
return messageService.sendSmsCode(mobile);
}
/**
* @param formDTO
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @Author yinzuomei
* @Description 疫情上报
* @Date 2020/1/28 13:23
**/
@PostMapping("report")
public Result report(@RequestBody EpiDemicReportFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return customService.report(formDTO);
/**
* @param formDTO
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @Author yinzuomei
* @Description 疫情上报
* @Date 2020/1/28 13:23
**/
@PostMapping("report")
public Result report(@RequestBody EpiDemicReportFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return customService.report(formDTO);
}
@GetMapping("sentryPost/getDeptInfoByMaCode")
public Result<EpdcSentryPostInfoResultDTO> getDeptInfoByMaCode(String code) {
return customService.getDeptInfoByMaCode(code);
}
/***
* 居民在防疫哨卡进行登记时上送数据并完善党群系统个人信息
* @param completeInfoFromDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author qushutong
* @date 2020/2/15 10:53
*/
@PostMapping("sentryPost/completeInfo")
public Result completeInfo(@RequestBody EpdcAppPidemicCompleteInfoFromDTO completeInfoFromDto, @LoginUser TokenDto userDetail) {
return customService.createPidemicInfo(completeInfoFromDto,userDetail);
}
}

8
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/CustomFeignClient.java

@ -2,10 +2,14 @@ package com.elink.esua.epdc.feign;
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.EpidemicSentryPostDTO;
import com.elink.esua.epdc.dto.form.EpiDemicReportFormDTO;
import com.elink.esua.epdc.dto.result.EpdcSentryPostInfoResultDTO;
import com.elink.esua.epdc.feign.fallback.CustomFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
/**
@ -24,4 +28,8 @@ public interface CustomFeignClient {
**/
@PostMapping(value = "custom/epidemic/report", consumes = MediaType.APPLICATION_JSON_VALUE)
Result report(EpiDemicReportFormDTO formDTO);
@GetMapping(value = "custom/epidemicSentryPost/getEpidemicSentryBySentryPostCode/{sentryPostCode}", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<EpidemicSentryPostDTO> getEpidemicSentryBySentryPostCode(@PathVariable("sentryPostCode") String sentryPostCode);
}

23
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java

@ -186,7 +186,7 @@ public interface UserFeignClient {
* 获取网格长管理的网格列表
*
* @param userId
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcUserGridResultDTO>>
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcUserGridResultDTO>>
* @author work@yujt.net.cn
* @date 2019/10/23 13:34
*/
@ -237,11 +237,10 @@ public interface UserFeignClient {
Result<EpdcResidentDetailResultDTO> residentDetail(@PathVariable("userId") String userId);
/**
*
* 获取用户最后一次切换的网格信息
*
* @params [openId]
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.epdc.result.EpdcUserRegisterInfoResultDTO>
* @params [openId]
* @author liuchuang
* @since 2019/12/6 11:04
*/
@ -289,7 +288,7 @@ public interface UserFeignClient {
/**
* @param formDTO
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcAuthenticateHistoryResultDTO>>
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcAuthenticateHistoryResultDTO>>
* @Author yinzuomei
* @Description 用户认证审核历史
* @Date 2019/11/22 13:17
@ -305,12 +304,12 @@ public interface UserFeignClient {
* @Date 2019/11/22 14:22
**/
@PostMapping("app-user/epdc-app/usergrid/removeGrid")
Result removeGrid(EpdcAppRemoveGridFormDTO formDto);
Result removeGrid(EpdcAppRemoveGridFormDTO formDto);
/**
* 获取邀请记录
*
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List.UserInvitationRecordResultDTO < com.elink.esua.epdc.dto.epdc.result.EpdcUserGridResultDTO>>
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List.UserInvitationRecordResultDTO < com.elink.esua.epdc.dto.epdc.result.EpdcUserGridResultDTO>>
* @author work@yujt.net.cn
* @date 2019/10/23 13:34
*/
@ -324,6 +323,16 @@ public interface UserFeignClient {
* @Description 根据openId或者unionId查询用户信息
* @Date 2019/12/7 14:11
**/
@PostMapping(value="app-user/epdc-app/user/queryUserDto", consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "app-user/epdc-app/user/queryUserDto", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<UserDTO> queryUserDto(EpdcAppQueryUserInfoFormDTO formDTO);
/***
* 居民在防疫哨卡进行登记时上送数据并完善党群系统个人信息
* @param formDTO
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author qushutong
* @date 2020/2/15 11:02
*/
@PostMapping(value = "app-user/epdc-app/user/sentryPost/completeInfo", consumes = MediaType.APPLICATION_JSON_VALUE)
Result createPidemicInfo(EpdcAppPidemicCompleteInfoFromDTO formDTO);
}

6
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/CustomFeignClientFallback.java

@ -3,6 +3,7 @@ package com.elink.esua.epdc.feign.fallback;
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.EpidemicSentryPostDTO;
import com.elink.esua.epdc.dto.form.EpiDemicReportFormDTO;
import com.elink.esua.epdc.feign.CustomFeignClient;
import org.springframework.stereotype.Component;
@ -19,4 +20,9 @@ public class CustomFeignClientFallback implements CustomFeignClient {
public Result report(EpiDemicReportFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_CUSTOM_SERVER, "report", formDTO);
}
@Override
public Result<EpidemicSentryPostDTO> getEpidemicSentryBySentryPostCode(String sentryPostCode) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_CUSTOM_SERVER, "getEpidemicSentryBySentryPostCode", sentryPostCode);
}
}

5
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java

@ -159,4 +159,9 @@ public class UserFeignClientFallback implements UserFeignClient {
public Result<UserDTO> queryUserDto(EpdcAppQueryUserInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "queryUserDto",formDTO);
}
@Override
public Result createPidemicInfo(EpdcAppPidemicCompleteInfoFromDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "createPidemicInfo",formDTO);
}
}

21
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/CustomService.java

@ -1,8 +1,11 @@
package com.elink.esua.epdc.service;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.DeptOption;
import com.elink.esua.epdc.dto.epdc.form.EpdcAppPidemicCompleteInfoFromDTO;
import com.elink.esua.epdc.dto.form.EpiDemicReportFormDTO;
import com.elink.esua.epdc.dto.result.EpdcSentryPostInfoResultDTO;
/**
* @Description 疫情管理
@ -27,4 +30,22 @@ public interface CustomService {
* @Date 2020/1/28 13:23
**/
Result report(EpiDemicReportFormDTO formDTO);
/** 根据小程序码内的字符串解析机构名称和第三方哨卡id
* @Description
* @Author songyunpeng
* @Date 2020/2/14
* @Param [maCode]
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.result.EpdcSentryPostInfoResultDTO>
**/
Result<EpdcSentryPostInfoResultDTO> getDeptInfoByMaCode(String maCode);
/***
* 居民在防疫哨卡进行登记时上送数据并完善党群系统个人信息
* @param completeInfoFromDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author qushutong
* @date 2020/2/15 10:58
*/
Result createPidemicInfo(EpdcAppPidemicCompleteInfoFromDTO completeInfoFromDto, TokenDto userDetail);
}

79
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/CustomServiceImpl.java

@ -1,12 +1,19 @@
package com.elink.esua.epdc.service.impl;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.CompleteDeptDTO;
import com.elink.esua.epdc.dto.DeptOption;
import com.elink.esua.epdc.dto.EpidemicSentryPostDTO;
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcAppPidemicCompleteInfoFromDTO;
import com.elink.esua.epdc.dto.form.EpiDemicReportFormDTO;
import com.elink.esua.epdc.dto.result.EpdcSentryPostInfoResultDTO;
import com.elink.esua.epdc.feign.AdminFeignClient;
import com.elink.esua.epdc.feign.CustomFeignClient;
import com.elink.esua.epdc.feign.UserFeignClient;
import com.elink.esua.epdc.redis.AppUserRedis;
import com.elink.esua.epdc.service.CustomService;
import org.apache.commons.lang3.StringUtils;
@ -21,12 +28,63 @@ import org.springframework.stereotype.Service;
@Service
public class CustomServiceImpl implements CustomService {
@Autowired
private AdminFeignClient adminFeignClient;
@Autowired
private CustomFeignClient customFeignClient;
@Autowired
private AppUserRedis appUserRedis;
@Autowired
private AdminFeignClient adminFeignClient;
@Autowired
private CustomFeignClient customFeignClient;
@Autowired
private AppUserRedis appUserRedis;
@Autowired
private UserFeignClient userFeignClient;
@Override
public Result<EpdcSentryPostInfoResultDTO> getDeptInfoByMaCode(String code) {
String combine = "-";
if (StringUtils.isBlank(code) || code.indexOf(combine) == NumConstant.ONE_NEG) {
return new Result().error("不是规范的哨卡小程序码");
}
EpdcSentryPostInfoResultDTO epdcSentryPostInfoResultDTO = new EpdcSentryPostInfoResultDTO();
String[] grididAndPostId = code.split(combine);
if (grididAndPostId.length < NumConstant.TWO) {
return new Result().error("哨卡小程序码信息异常");
}
// 网格id
String gridId = grididAndPostId[NumConstant.ZERO];
// 哨卡编码
String postCode = grididAndPostId[NumConstant.ONE];
//拿取网格信息
CompleteDeptDTO completeDept = getCompleteDeptDTOByGridId(gridId);
epdcSentryPostInfoResultDTO.setStreetName(completeDept.getStreet());
epdcSentryPostInfoResultDTO.setCommunityName(completeDept.getCommunity());
epdcSentryPostInfoResultDTO.setGridId(completeDept.getGridId());
epdcSentryPostInfoResultDTO.setGridName(completeDept.getGrid());
//拿取哨卡信息
Result<EpidemicSentryPostDTO> epidemicSentryResult = customFeignClient.getEpidemicSentryBySentryPostCode(postCode);
if (!epidemicSentryResult.success() || null == epidemicSentryResult.getData()) {
return new Result().error("查询哨卡信息失败");
}
EpidemicSentryPostDTO epidemicSentryPostDTO = epidemicSentryResult.getData();
epdcSentryPostInfoResultDTO.setSentryPostName(epidemicSentryPostDTO.getSentryPostName());
epdcSentryPostInfoResultDTO.setThirdSentryPostId(epidemicSentryPostDTO.getThirdSentryPostId());
return new Result().ok(epdcSentryPostInfoResultDTO);
}
private CompleteDeptDTO getCompleteDeptDTOByGridId(String gridId) {
Result<CompleteDeptDTO> adminResult = adminFeignClient.getCompleteDept(Long.parseLong(gridId));
if (!adminResult.success() || null == adminResult.getData()) {
throw new RenException("查询网格信息失败");
}
return adminResult.getData();
}
/**
* @param
@ -64,6 +122,8 @@ public class CustomServiceImpl implements CustomService {
return customFeignClient.report(formDTO);
}
/**
* @param mobile 手机号
* @param smsCode 用户输入的验证码
@ -77,4 +137,11 @@ public class CustomServiceImpl implements CustomService {
throw new RenException("手机验证码错误");
}
}
@Override
public Result createPidemicInfo(EpdcAppPidemicCompleteInfoFromDTO completeInfoFromDto, TokenDto userDetail) {
completeInfoFromDto.setUserId(userDetail.getUserId());
return userFeignClient.createPidemicInfo(completeInfoFromDto);
}
}

116
esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/EpidemicSentryPostDTO.java

@ -0,0 +1,116 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 疫情防控哨卡表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-14
*/
@Data
public class EpidemicSentryPostDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 哨卡编码
*/
private String sentryPostCode;
/**
* 哨卡名称
*/
private String sentryPostName;
/**
* 第三方哨卡id
*/
private String thirdSentryPostId;
/**
* 哨卡所在网格id
*/
private String gridId;
/**
* 哨卡小程序码访问地址
*/
private String maCodeUrl;
/**
* 父所有部门ID
*/
private String parentDeptIds;
/**
* 父所有部门名称
*/
private String parentDeptNames;
/**
* 所有部门ID
*/
private String allDeptIds;
/**
* 所有部门名称
*/
private String allDeptNames;
/**
* 删除标识 01
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

26
esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/CreateCodeFormDTO.java

@ -0,0 +1,26 @@
package com.elink.esua.epdc.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @program: esua-epdc-cloud
* @description: 生成小程序码
* @author: wangtong
* @create: 2020-02-14 17:38
**/
@Data
public class CreateCodeFormDTO implements Serializable {
/**
* 网格id
*/
private String gridId;
/**
* 哨卡id
*/
private String postId;
}

32
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/pom.xml

@ -63,6 +63,24 @@
<artifactId>orika-spring-boot-starter</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>com.esua.epdc</groupId>
<artifactId>epdc-admin-client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.esua.epdc</groupId>-->
<!-- <artifactId>epdc-commons-tools-wx-ma</artifactId>-->
<!-- <version>1.0.0</version>-->
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
<!--微信小程序-->
<dependency>
<groupId>com.esua.epdc</groupId>
<artifactId>epdc-commons-tools-wx-ma</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
@ -133,6 +151,13 @@
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>elink@888</spring.redis.password>
<!--小程序配置-->
<wx.ma.appId>wxdd8530c5f4926766</wx.ma.appId>
<wx.ma.secret>5bf4fb813145431b3493a10aa7e041e9</wx.ma.secret>
<!--工作端小程序-->
<work.wx.ma.appId>wx29b074840ef4bfd9</work.wx.ma.appId>
<work.wx.ma.secret>4adb1afccc69f205cdf5b521d74e2aca</work.wx.ma.secret>
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://47.104.224.45:3308/esua_epdc_custom?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
@ -163,6 +188,13 @@
<spring.datasource.druid.username>epdc</spring.datasource.druid.username>
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<!--小程序配置-->
<wx.ma.appId>wxdd8530c5f4926766</wx.ma.appId>
<wx.ma.secret>5bf4fb813145431b3493a10aa7e041e9</wx.ma.secret>
<!--工作端小程序-->
<work.wx.ma.appId>wx29b074840ef4bfd9</work.wx.ma.appId>
<work.wx.ma.secret>4adb1afccc69f205cdf5b521d74e2aca</work.wx.ma.secret>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
</properties>

56
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/config/StreamUtils.java

@ -0,0 +1,56 @@
package com.elink.esua.epdc.config;
import com.elink.esua.epdc.commons.tools.exception.RenException;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
/**
* 接收文件转化File
* Created by liuhongwei on 2019/6/21.
*/
public class StreamUtils {
public static File conversionFile(MultipartFile file){
File toFile =null;
InputStream ins = null;
try {
// 转化字节流
ins = file.getInputStream();
// 获取文件名字
toFile = new File(file.getOriginalFilename());
// 字节转化文件
inputStreamToFile(ins, toFile);
ins.close();
} catch (IOException e) {
new RenException(500,"文件转化失败");
}
return toFile;
}
/**
* 流转化
* @param ins file
* @return
* @author liuhongwei
* @date 2019/6/14 14:07
*/
public static void inputStreamToFile(InputStream ins, File file) {
try {
OutputStream os = new FileOutputStream(file);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
os.close();
ins.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}

175
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/controller/EpidemicSentryPostController.java

@ -0,0 +1,175 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.epidemic.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.dto.EpidemicSentryPostDTO;
import com.elink.esua.epdc.dto.form.CreateCodeFormDTO;
import com.elink.esua.epdc.modules.epidemic.excel.EpidemicSentryPostExcel;
import com.elink.esua.epdc.modules.epidemic.service.EpidemicSentryPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 疫情防控哨卡表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-14
*/
@RestController
@RequestMapping("epidemicSentryPost")
public class EpidemicSentryPostController {
@Autowired
private EpidemicSentryPostService epidemicSentryPostService;
@GetMapping("page")
public Result<PageData<EpidemicSentryPostDTO>> page(@RequestParam Map<String, Object> params){
PageData<EpidemicSentryPostDTO> page = epidemicSentryPostService.page(params);
return new Result<PageData<EpidemicSentryPostDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<EpidemicSentryPostDTO> get(@PathVariable("id") String id){
EpidemicSentryPostDTO data = epidemicSentryPostService.get(id);
return new Result<EpidemicSentryPostDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody EpidemicSentryPostDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
epidemicSentryPostService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody EpidemicSentryPostDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
String sentryPostCode = dto.getSentryPostCode().toUpperCase();
//编号是否重复判断
Integer data = epidemicSentryPostService.countSentryPostCode(sentryPostCode);
if (data > 0){
return new Result().error("哨卡编码编号重复");
}
dto.setSentryPostCode(sentryPostCode);
epidemicSentryPostService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
epidemicSentryPostService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<EpidemicSentryPostDTO> list = epidemicSentryPostService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, EpidemicSentryPostExcel.class);
}
@GetMapping("getEpidemicSentryBySentryPostCode/{sentryPostCode}")
public Result<EpidemicSentryPostDTO> getEpidemicSentryBySentryPostCode(@PathVariable String sentryPostCode){
EpidemicSentryPostDTO data = epidemicSentryPostService.getEpidemicSentryBySentryPostCode(sentryPostCode);
return new Result<EpidemicSentryPostDTO>().ok(data);
}
/**
* @Description: 哨卡名称查询(未绑定网格id的)
* @Param: []
* @return: com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<java.util.Map<java.lang.String,java.lang.String>>>
* @Author: zy
* @Date: 2020-02-14
*/
@GetMapping("selectListSentryPostName")
public Result<List<Map<String,String>>> selectListSentryPostName(){
List<Map<String,String>> data = epidemicSentryPostService.listSentryPostName();
return new Result<List<Map<String,String>>>().ok(data);
}
/**
* @Description: 查询哨卡名称是否重复
* @Param: [sentryPostCode]
* @return: java.lang.Integer
* @Author: zy
* @Date: 2020-02-15
*/
@GetMapping("sentryPostCodeIsRepeat/{sentryPostCode}")
public Result<Integer> sentryPostCodeIsRepeat(@PathVariable("sentryPostCode") String sentryPostCode){
Integer data = epidemicSentryPostService.countSentryPostCode(sentryPostCode);
return new Result<Integer>().ok(data);
}
/***
* 导入
* @param file
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author qushutong
* @date 2020/2/14 12:34
*/
@PostMapping("importExcel")
public Result importExcel(@RequestParam("file") MultipartFile file) {
return epidemicSentryPostService.insertEpidemicList(file);
}
/**
*生成哨卡单个小程序码
*
* @author wangtong
* @date 2020/2/14 17:46
* @param [formDto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
*/
@PostMapping("createCode")
public Result createPostsCode(@RequestBody CreateCodeFormDTO formDto){
return this.epidemicSentryPostService.createPostsCode(formDto);
}
/**
*生成哨卡多个小程序码
*
* @author wangtong
* @date 2020/2/14 17:46
* @param [formDto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
*/
@PostMapping("createCodes")
public Result createPostsCodes(@RequestBody CreateCodeFormDTO formDto){
return this.epidemicSentryPostService.createPostsCodes(formDto);
}
}

59
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/dao/EpidemicSentryPostDao.java

@ -0,0 +1,59 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.epidemic.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.EpidemicSentryPostDTO;
import com.elink.esua.epdc.modules.epidemic.entity.EpidemicSentryPostEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.List;
import java.util.Map;
/**
* 疫情防控哨卡表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-14
*/
@Mapper
public interface EpidemicSentryPostDao extends BaseDao<EpidemicSentryPostEntity> {
EpidemicSentryPostEntity selectOneOfEpidemicSentryBySentryPostCode(String sentryPostCode);
/**
* @Description: 哨卡名称查询(未绑定网格id的)
* @Param: []
* @return: com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<java.util.Map<java.lang.String,java.lang.String>>>
* @Author: zy
* @Date: 2020-02-14
*/
List<Map<String,String>> selectListSentryPostName();
/**
* @Description: 查询哨卡名称是否重复
* @Param: [sentryPostCode]
* @return: java.lang.Integer
* @Author: zy
* @Date: 2020-02-15
*/
Integer selectCountSentryPostCode(String sentryPostCode);
}

86
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/entity/EpidemicSentryPostEntity.java

@ -0,0 +1,86 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.epidemic.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 疫情防控哨卡表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_epidemic_sentry_post")
public class EpidemicSentryPostEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 哨卡编码
*/
private String sentryPostCode;
/**
* 哨卡名称
*/
private String sentryPostName;
/**
* 第三方哨卡id
*/
private String thirdSentryPostId;
/**
* 哨卡所在网格id
*/
private String gridId;
/**
* 哨卡小程序码访问地址
*/
private String maCodeUrl;
/**
* 父所有部门ID
*/
private String parentDeptIds;
/**
* 父所有部门名称
*/
private String parentDeptNames;
/**
* 所有部门ID
*/
private String allDeptIds;
/**
* 所有部门名称
*/
private String allDeptNames;
}

83
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/excel/EpidemicSentryPostExcel.java

@ -0,0 +1,83 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.epidemic.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 疫情防控哨卡表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-14
*/
@Data
public class EpidemicSentryPostExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "哨卡编码")
private String sentryPostCode;
@Excel(name = "哨卡名称")
private String sentryPostName;
@Excel(name = "第三方哨卡id")
private String thirdSentryPostId;
@Excel(name = "哨卡所在网格id")
private String gridId;
@Excel(name = "哨卡小程序码访问地址")
private String maCodeUrl;
@Excel(name = "父所有部门ID")
private String parentDeptIds;
@Excel(name = "父所有部门名称")
private String parentDeptNames;
@Excel(name = "所有部门ID")
private String allDeptIds;
@Excel(name = "所有部门名称")
private String allDeptNames;
@Excel(name = "删除标识 0:否,1:是")
private String delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

31
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/feign/OssFeignClient.java

@ -0,0 +1,31 @@
package com.elink.esua.epdc.modules.epidemic.feign;
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.UploadToOssDTO;
import com.elink.esua.epdc.modules.epidemic.feign.fallback.OssFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @author work@yujt.net.cn
* @date 19/9/19 10:12
*/
@FeignClient(name = ServiceConstant.EPDC_OSS_SERVER, fallback = OssFeignClientFallback.class)
public interface OssFeignClient {
//,url = "http://127.0.0.1:9095"
/**
* File文件上传到文件服务器
*
* @param dto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.lang.String>
* @author work@yujt.net.cn
* @date 2019/9/19 10:15
*/
@PostMapping(value = "oss/file/uploadFile", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<String> uploadFile(UploadToOssDTO dto);
}

22
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/feign/fallback/OssFeignClientFallback.java

@ -0,0 +1,22 @@
package com.elink.esua.epdc.modules.epidemic.feign.fallback;
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.UploadToOssDTO;
import com.elink.esua.epdc.modules.epidemic.feign.OssFeignClient;
import org.springframework.stereotype.Component;
/**
* @author work@yujt.net.cn
* @date 19/9/19 10:12
*/
@Component
public class OssFeignClientFallback implements OssFeignClient {
@Override
public Result<String> uploadFile(UploadToOssDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_OSS_SERVER, "uploadFile", dto.getFileName());
}
}

47
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/redis/EpidemicSentryPostRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.epidemic.redis;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 疫情防控哨卡表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-14
*/
@Component
public class EpidemicSentryPostRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

153
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/service/EpidemicSentryPostService.java

@ -0,0 +1,153 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.epidemic.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.EpidemicSentryPostDTO;
import com.elink.esua.epdc.dto.form.CreateCodeFormDTO;
import com.elink.esua.epdc.modules.epidemic.entity.EpidemicSentryPostEntity;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
* 疫情防控哨卡表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-14
*/
public interface EpidemicSentryPostService extends BaseService<EpidemicSentryPostEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<EpidemicSentryPostDTO>
* @author generator
* @date 2020-02-14
*/
PageData<EpidemicSentryPostDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<EpidemicSentryPostDTO>
* @author generator
* @date 2020-02-14
*/
List<EpidemicSentryPostDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return EpidemicSentryPostDTO
* @author generator
* @date 2020-02-14
*/
EpidemicSentryPostDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-02-14
*/
void save(EpidemicSentryPostDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-02-14
*/
void update(EpidemicSentryPostDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-02-14
*/
void delete(String[] ids);
/**
* @Description 根据哨卡编码获取疫情防控哨卡表数据
* @Author songyunpeng
* @Date 2020/2/14
* @Param [sentryPostCode]
* @return com.elink.esua.epdc.dto.EpidemicSentryPostDTO
**/
EpidemicSentryPostDTO getEpidemicSentryBySentryPostCode(String sentryPostCode);
/**
* @Description: 哨卡名称查询(未绑定网格id的)
* @Param: []
* @return: com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<java.util.Map<java.lang.String,java.lang.String>>>
* @Author: zy
* @Date: 2020-02-14
*/
List<Map<String,String>> listSentryPostName();
/**
* @Description: 查询哨卡名称是否重复
* @Param: [sentryPostCode]
* @return: java.lang.Integer
* @Author: zy
* @Date: 2020-02-15
*/
Integer countSentryPostCode(String sentryPostCode);;
/***
* 导入表格
* @param
* @return void
* @author qushutong
* @date 2020/2/14 12:38
*/
Result insertEpidemicList(MultipartFile file);
/**
*生成单个哨卡小程序码
*
* @author wangtong
* @date 2020/2/14 17:57
* @param [formDto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
*/
Result createPostsCode(CreateCodeFormDTO formDto);
/**
*生成多个哨卡小程序码
* @author wangtong
* @date 2020/2/14 20:58
* @param [formDto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
*/
Result createPostsCodes(CreateCodeFormDTO formDto);
}

301
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/EpidemicSentryPostServiceImpl.java

@ -0,0 +1,301 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.epidemic.service.impl;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
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.utils.Result;
import com.elink.esua.epdc.config.StreamUtils;
import com.elink.esua.epdc.dto.EpidemicSentryPostDTO;
import com.elink.esua.epdc.dto.UploadToOssDTO;
import com.elink.esua.epdc.dto.form.CreateCodeFormDTO;
import com.elink.esua.epdc.modules.epidemic.dao.EpidemicSentryPostDao;
import com.elink.esua.epdc.modules.epidemic.entity.EpidemicSentryPostEntity;
import com.elink.esua.epdc.modules.epidemic.excel.EpidemicSentryPostExcel;
import com.elink.esua.epdc.modules.epidemic.feign.OssFeignClient;
import com.elink.esua.epdc.modules.epidemic.redis.EpidemicSentryPostRedis;
import com.elink.esua.epdc.modules.epidemic.service.EpidemicSentryPostService;
import com.elink.esua.epdc.utils.WxMaServiceUtils;
import me.chanjar.weixin.common.error.WxErrorException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 疫情防控哨卡表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-14
*/
@Service
public class EpidemicSentryPostServiceImpl extends BaseServiceImpl<EpidemicSentryPostDao, EpidemicSentryPostEntity> implements EpidemicSentryPostService {
@Autowired
private EpidemicSentryPostRedis epidemicSentryPostRedis;
@Autowired
private WxMaServiceUtils wxMaServiceUtils;
@Autowired
private OssFeignClient ossFeignClient;
/**
* 小程序首页
*/
private static String MA_FRONT_PAGE_URL = "pages/fromVirus/fromVirus";
@Override
public PageData<EpidemicSentryPostDTO> page(Map<String, Object> params) {
IPage<EpidemicSentryPostEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, EpidemicSentryPostDTO.class);
}
@Override
public List<EpidemicSentryPostDTO> list(Map<String, Object> params) {
List<EpidemicSentryPostEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, EpidemicSentryPostDTO.class);
}
private QueryWrapper<EpidemicSentryPostEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
String gridId = (String) params.get(FieldConstant.GRID_ID_HUMP);
String sentryPostCode = (String) params.get("sentryPostCode");
QueryWrapper<EpidemicSentryPostEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
wrapper.eq(StringUtils.isNotBlank(gridId), "grid_id", gridId);
wrapper.like(StringUtils.isNotBlank(sentryPostCode), "sentry_post_code", sentryPostCode);
return wrapper;
}
@Override
public EpidemicSentryPostDTO get(String id) {
EpidemicSentryPostEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, EpidemicSentryPostDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(EpidemicSentryPostDTO dto) {
EpidemicSentryPostEntity entity = ConvertUtils.sourceToTarget(dto, EpidemicSentryPostEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(EpidemicSentryPostDTO dto) {
EpidemicSentryPostEntity entity = ConvertUtils.sourceToTarget(dto, EpidemicSentryPostEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public EpidemicSentryPostDTO getEpidemicSentryBySentryPostCode(String sentryPostCode) {
EpidemicSentryPostEntity entity = baseDao.selectOneOfEpidemicSentryBySentryPostCode(sentryPostCode);
return ConvertUtils.sourceToTarget(entity, EpidemicSentryPostDTO.class);
}
@Override
public List<Map<String, String>> listSentryPostName() {
return baseDao.selectListSentryPostName();
}
@Override
public Integer countSentryPostCode(String sentryPostCode) {
//字母转大写
sentryPostCode = sentryPostCode.toUpperCase();
return baseDao.selectCountSentryPostCode(sentryPostCode);
}
@Override
public Result insertEpidemicList(MultipartFile file) {
File f = StreamUtils.conversionFile(file);
ImportParams importParams = new ImportParams();
List<EpidemicSentryPostEntity> oldEntityList = baseDao.selectList(new QueryWrapper<>());
List<EpidemicSentryPostExcel> epidemicExcelList = ExcelImportUtil.importExcel(f, EpidemicSentryPostExcel.class, importParams);
// third_sentry_post_id 已存在更新 不存在插入
List<EpidemicSentryPostDTO> newEpidemicList = this.updataOrSaveExcel(epidemicExcelList, oldEntityList);
List<EpidemicSentryPostEntity> epidemicList = ConvertUtils.sourceToTarget(newEpidemicList, EpidemicSentryPostEntity.class);
boolean b = insertBatch(epidemicList);
return new Result();
}
private List<EpidemicSentryPostDTO> updataOrSaveExcel(List<EpidemicSentryPostExcel> epidemicExcelList, List<EpidemicSentryPostEntity> oldEntityList) {
List<EpidemicSentryPostExcel> newEpidemicList = new ArrayList<>();
newEpidemicList.addAll(epidemicExcelList);
QueryWrapper<EpidemicSentryPostEntity> wrapper;
for (EpidemicSentryPostExcel item : epidemicExcelList) {
if (StringUtils.isNotBlank(item.getThirdSentryPostId())) {
item.setThirdSentryPostId(item.getThirdSentryPostId().trim());
}
for (EpidemicSentryPostEntity oldItem : oldEntityList) {
if (StringUtils.isNotBlank(item.getThirdSentryPostId()) && item.getThirdSentryPostId().equals(oldItem.getThirdSentryPostId())) {
//三方哨卡Id相同时 更新
EpidemicSentryPostEntity epidemicSentryPostEntity = ConvertUtils.sourceToTarget(item, EpidemicSentryPostEntity.class);
wrapper = new QueryWrapper<>();
wrapper.eq("third_sentry_post_id", epidemicSentryPostEntity.getThirdSentryPostId());
update(epidemicSentryPostEntity, wrapper);
newEpidemicList.remove(item);
}
}
}
return ConvertUtils.sourceToTarget(newEpidemicList, EpidemicSentryPostDTO.class);
}
@Transactional
@Override
public Result createPostsCode(CreateCodeFormDTO formDto) {
if (!StringUtils.isNotBlank(formDto.getPostId())) {
throw new RenException("哨卡id不可为空!");
}
EpidemicSentryPostEntity entity = baseDao.selectById(formDto.getPostId());
if (entity == null) {
throw new RenException("根据哨卡id未查到哨卡信息!");
}
if (!StringUtils.isNotBlank(entity.getGridId())) {
throw new RenException("根据哨卡id未查到网格id信息!");
}
if (StringUtils.isNotBlank(entity.getMaCodeUrl())) {
throw new RenException("该小程序码已经存在!");
}
String param = entity.getGridId().concat("-").concat(entity.getSentryPostCode());
entity.setMaCodeUrl(this.createMaCode(param, MA_FRONT_PAGE_URL));
baseDao.updateById(entity);
return new Result().ok("生成单个小程序码成功。");
}
@Transactional
@Override
public Result createPostsCodes(CreateCodeFormDTO formDto) {
if (!StringUtils.isNotBlank(formDto.getGridId())) {
throw new RenException("网格id不可为空!");
}
EpidemicSentryPostEntity data = new EpidemicSentryPostEntity();
data.setGridId(formDto.getGridId());
QueryWrapper<EpidemicSentryPostEntity> wrapper = new QueryWrapper<>(data);
List<EpidemicSentryPostEntity> categoryEntityList = baseDao.selectList(wrapper);
if (CollUtil.isEmpty(categoryEntityList)) {
throw new RenException("根据网格id未查到哨卡信息!");
}
Boolean isHave = false;
for (EpidemicSentryPostEntity entity : categoryEntityList) {
if (StringUtils.isNotBlank(entity.getMaCodeUrl())) {
continue;
}
String param = entity.getGridId().concat("-").concat(entity.getSentryPostCode());
entity.setMaCodeUrl(this.createMaCode(param, MA_FRONT_PAGE_URL));
baseDao.updateById(entity);
isHave = true;
}
if(!isHave){
throw new RenException("该网格下的哨卡编码已经全部存在,不可重复生成!");
}
return new Result().ok("批量生成小程序码成功。");
}
/**
* 创建微信小程序码并上传到oss
*
* @param param 小程序码的参数
* @param pageUrl 小程序码的跳转链接
* @return java.lang.String 小程序码的下载抵制
* @author work@yujt.net.cn
* @date 2019/10/22 10:14
*/
private String createMaCode(String param, String pageUrl) {
File wxaCodeUnlimit;
try {
wxaCodeUnlimit = wxMaServiceUtils.normalWxMaService().getQrcodeService()
.createWxaCodeUnlimit(param, pageUrl, 1280, true, null, false);
} catch (WxErrorException e) {
throw new RenException("请求微信接口失败");
}
UploadToOssDTO dto = new UploadToOssDTO();
dto.setFileByte(this.fileToByteArray(wxaCodeUnlimit));
dto.setFileName(wxaCodeUnlimit.getName());
Result<String> ossResult = ossFeignClient.uploadFile(dto);
if (null == ossResult || !ossResult.success() || null == ossResult.getData()) {
throw new RenException("小程序码上传失败");
}
return ossResult.getData();
}
/**
* File文件转为byte[]
*
* @param file
* @return byte[]
* @author work@yujt.net.cn
* @date 2019/9/19 15:56
*/
private byte[] fileToByteArray(File file) {
try {
//获取输入流
FileInputStream fis = new FileInputStream(file);
//新的 byte 数组输出流,缓冲区容量1024byte
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
//缓存
byte[] b = new byte[1024];
int n;
while ((n = fis.read(b)) != NumConstant.ONE_NEG) {
bos.write(b, NumConstant.ZERO, n);
}
fis.close();
//改变为byte[]
byte[] data = bos.toByteArray();
bos.close();
return data;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

19
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/application.yml

@ -64,3 +64,22 @@ mybatis-plus:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
wx:
ma:
configs:
- appid: @wx.ma.appId@
secret: @wx.ma.secret@
token: #微信小程序消息服务器配置的token
aesKey: #微信小程序消息服务器配置的EncodingAESKey
msgDataFormat: JSON
- appid: @work.wx.ma.appId@
secret: @work.wx.ma.secret@
token: #微信小程序消息服务器配置的token
aesKey: #微信小程序消息服务器配置的EncodingAESKey
msgDataFormat: JSON
appId:
# 普通居民端的appId
normal: @wx.ma.appId@
# 工作端的appId
work: @work.wx.ma.appId@

66
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/epidemic/EpidemicSentryPostDao.xml

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.modules.epidemic.dao.EpidemicSentryPostDao">
<resultMap type="com.elink.esua.epdc.modules.epidemic.entity.EpidemicSentryPostEntity" id="epidemicSentryPostMap">
<result property="id" column="ID"/>
<result property="sentryPostCode" column="sentry_post_code"/>
<result property="sentryPostName" column="sentry_post_name"/>
<result property="thirdSentryPostId" column="third_sentry_post_id"/>
<result property="gridId" column="grid_id"/>
<result property="maCodeUrl" column="ma_code_url"/>
<result property="parentDeptIds" column="PARENT_DEPT_IDS"/>
<result property="parentDeptNames" column="PARENT_DEPT_NAMES"/>
<result property="allDeptIds" column="ALL_DEPT_IDS"/>
<result property="allDeptNames" column="ALL_DEPT_NAMES"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectOneOfEpidemicSentryBySentryPostCode" resultMap="epidemicSentryPostMap">
select
ID,
sentry_post_code,
sentry_post_name,
third_sentry_post_id,
grid_id,
ma_code_url,
PARENT_DEPT_IDS,
PARENT_DEPT_NAMES,
DEL_FLAG,
REVISION,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME
from epdc_epidemic_sentry_post
where sentry_post_code = #{sentryPostCode}
</select>
<select id="selectListSentryPostName" resultType="Map">
SELECT
p.ID id,
p.sentry_post_name sentryPostName
FROM
epdc_epidemic_sentry_post p
WHERE
p.DEL_FLAG = 0
AND p.grid_id IS NULL
ORDER BY
p.CREATED_TIME desc
</select>
<select id="selectCountSentryPostCode" resultType="Integer" parameterType="String">
SELECT
count(1)
FROM
epdc_epidemic_sentry_post p
WHERE
p.DEL_FLAG = 0
AND p.sentry_post_code = #{sentryPostCode}
</select>
</mapper>

10
esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/UserDTO.java

@ -352,4 +352,14 @@ public class UserDTO implements Serializable {
* 所有部门名称
*/
private String allDeptNames;
/**
* 是否有车
*/
private String rentFlag;
/**
* 是否租房
*/
private String driverFlag;
}

81
esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/UserCarInfoDTO.java

@ -0,0 +1,81 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto.epdc;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 用户车辆信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-15
*/
@Data
public class UserCarInfoDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 昵称
*/
private String userId;
/**
* 手机号
*/
private String carNumber;
/**
* 删除标记
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 注册时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

47
esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcAppPidemicCompleteInfoFromDTO.java

@ -0,0 +1,47 @@
package com.elink.esua.epdc.dto.epdc.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author: qushutong
* @Date: 2020/2/15 10:49
* @Description: 居民在防疫哨卡进行登记时上送数据并完善党群系统个人信息
*/
@Data
public class EpdcAppPidemicCompleteInfoFromDTO implements Serializable {
private static final long serialVersionUID = -582216042705118851L;
/**
* postId : 79829
* name : AcIr6xcOZ0
* idcard : IYG4MnDCs1
* phone : OZQRjNMqXk
* habitationDetail : C5zuxTv9mx
* isRent : VlInKevtSy
* isDriver : zW3ek3AUpm
* carNum : 6oOeXKemVl
*/
@NotBlank(message = "第三方哨卡ID")
private String postId;
@NotBlank(message = "姓名")
private String name;
@NotBlank(message = "身份证号")
private String idcard;
@NotBlank(message = "手机号")
private String phone;
@NotBlank(message = "居住地址")
private String habitationDetail;
@NotBlank(message = "是否租房")
private String isRent;
@NotBlank(message = "是否有车")
private String isDriver;
@NotBlank(message = "车牌号码")
private String carNum;
private String userId;
}

12
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppUserController.java

@ -372,4 +372,16 @@ public class EpdcAppUserController {
public Result<List<EpdcGridUserResultDTO>> queryGroupUsers(@RequestBody List<Long> gridIdList) {
return userService.listGridUserResultDTO(gridIdList);
}
/***
* 居民在防疫哨卡进行登记时上送数据并完善党群系统个人信息
* @param formDTO
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcGridUserResultDTO>>
* @author qushutong
* @date 2020/2/15 11:06
*/
@PostMapping("sentryPost/completeInfo")
public Result<List<EpdcGridUserResultDTO>> sentPidemicInfo(@RequestBody EpdcAppPidemicCompleteInfoFromDTO formDTO) {
return userService.createPidemicInfo(formDTO);
}
}

94
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/UserCarInfoController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.epdc.UserCarInfoDTO;
import com.elink.esua.epdc.excel.UserCarInfoExcel;
import com.elink.esua.epdc.service.UserCarInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 用户车辆信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-15
*/
@RestController
@RequestMapping("usercarinfo")
public class UserCarInfoController {
@Autowired
private UserCarInfoService userCarInfoService;
@GetMapping("page")
public Result<PageData<UserCarInfoDTO>> page(@RequestParam Map<String, Object> params){
PageData<UserCarInfoDTO> page = userCarInfoService.page(params);
return new Result<PageData<UserCarInfoDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<UserCarInfoDTO> get(@PathVariable("id") String id){
UserCarInfoDTO data = userCarInfoService.get(id);
return new Result<UserCarInfoDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody UserCarInfoDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
userCarInfoService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody UserCarInfoDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
userCarInfoService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
userCarInfoService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<UserCarInfoDTO> list = userCarInfoService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, UserCarInfoExcel.class);
}
}

33
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/UserCarInfoDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.UserCarInfoEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 用户车辆信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-15
*/
@Mapper
public interface UserCarInfoDao extends BaseDao<UserCarInfoEntity> {
}

51
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/UserCarInfoEntity.java

@ -0,0 +1,51 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 用户车辆信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-15
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_user_car_info")
public class UserCarInfoEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 昵称
*/
private String userId;
/**
* 手机号
*/
private String carNumber;
}

10
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/UserEntity.java

@ -253,4 +253,14 @@ public class UserEntity extends BaseEpdcEntity {
* 所有部门名称
*/
private String allDeptNames;
/**
* 是否有车
*/
private String rentFlag;
/**
* 是否租房
*/
private String driverFlag;
}

62
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/UserCarInfoExcel.java

@ -0,0 +1,62 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 用户车辆信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-15
*/
@Data
public class UserCarInfoExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "昵称")
private String userId;
@Excel(name = "手机号")
private String carNumber;
@Excel(name = "删除标记")
private String delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "注册时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

47
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/UserCarInfoRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.redis;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 用户车辆信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-15
*/
@Component
public class UserCarInfoRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

104
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserCarInfoService.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.epdc.UserCarInfoDTO;
import com.elink.esua.epdc.entity.UserCarInfoEntity;
import java.util.List;
import java.util.Map;
/**
* 用户车辆信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-15
*/
public interface UserCarInfoService extends BaseService<UserCarInfoEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<UserCarInfoDTO>
* @author generator
* @date 2020-02-15
*/
PageData<UserCarInfoDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<UserCarInfoDTO>
* @author generator
* @date 2020-02-15
*/
List<UserCarInfoDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return UserCarInfoDTO
* @author generator
* @date 2020-02-15
*/
UserCarInfoDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-02-15
*/
void save(UserCarInfoDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-02-15
*/
void update(UserCarInfoDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-02-15
*/
void delete(String[] ids);
/***
* 根据carNumber
* @param carNumber
* @return com.elink.esua.epdc.dto.epdc.UserCarInfoDTO
* @author qushutong
* @date 2020/2/15 18:42
*/
UserCarInfoDTO selectOneByCarNumber(String carNumber);
}

11
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserService.java

@ -267,4 +267,15 @@ public interface UserService extends BaseService<UserEntity> {
* @Date 2019/12/19 15:03
**/
Result<List<EpdcGridUserResultDTO>> listGridUserResultDTO(List<Long> gridIdList);
/***
* 居民在防疫哨卡进行登记时上送数据并完善党群系统个人信息
* @param completeInfoFromDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author qushutong
* @date 2020/2/15 10:58
*/
Result createPidemicInfo(EpdcAppPidemicCompleteInfoFromDTO completeInfoFromDto);
}

112
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserCarInfoServiceImpl.java

@ -0,0 +1,112 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.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.dao.UserCarInfoDao;
import com.elink.esua.epdc.dto.epdc.UserCarInfoDTO;
import com.elink.esua.epdc.entity.UserCarInfoEntity;
import com.elink.esua.epdc.redis.UserCarInfoRedis;
import com.elink.esua.epdc.service.UserCarInfoService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 用户车辆信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-15
*/
@Service
public class UserCarInfoServiceImpl extends BaseServiceImpl<UserCarInfoDao, UserCarInfoEntity> implements UserCarInfoService {
@Autowired
private UserCarInfoRedis userCarInfoRedis;
@Override
public PageData<UserCarInfoDTO> page(Map<String, Object> params) {
IPage<UserCarInfoEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, UserCarInfoDTO.class);
}
@Override
public List<UserCarInfoDTO> list(Map<String, Object> params) {
List<UserCarInfoEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, UserCarInfoDTO.class);
}
private QueryWrapper<UserCarInfoEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<UserCarInfoEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public UserCarInfoDTO get(String id) {
UserCarInfoEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, UserCarInfoDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(UserCarInfoDTO dto) {
UserCarInfoEntity entity = ConvertUtils.sourceToTarget(dto, UserCarInfoEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(UserCarInfoDTO dto) {
UserCarInfoEntity entity = ConvertUtils.sourceToTarget(dto, UserCarInfoEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public UserCarInfoDTO selectOneByCarNumber(String carNumber) {
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("CAR_NUMBER",carNumber);
UserCarInfoEntity userCarInfoEntity = baseDao.selectOne(wrapper);
return ConvertUtils.sourceToTarget(userCarInfoEntity,UserCarInfoDTO.class);
}
}

36
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java

@ -42,6 +42,7 @@ import com.elink.esua.epdc.dao.UserAuthenticateHistoryDao;
import com.elink.esua.epdc.dao.UserDao;
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO;
import com.elink.esua.epdc.dto.UserDTO;
import com.elink.esua.epdc.dto.epdc.UserCarInfoDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcUserGroupInviteFormDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcUserRegistFormDTO;
import com.elink.esua.epdc.dto.epdc.result.*;
@ -60,6 +61,7 @@ import com.elink.esua.epdc.enums.AppUserStatesEnum;
import com.elink.esua.epdc.enums.PartyMemberRegFlagEnum;
import com.elink.esua.epdc.exception.UserModuleErrorCode;
import com.elink.esua.epdc.feign.AdminFeignClient;
import com.elink.esua.epdc.service.UserCarInfoService;
import com.elink.esua.epdc.service.UserGridRelationService;
import com.elink.esua.epdc.service.UserInvitationRecordService;
import com.elink.esua.epdc.service.UserService;
@ -79,6 +81,9 @@ import java.util.*;
@Service
public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implements UserService {
@Autowired
private UserCarInfoService userCarInfoService;
@Autowired
private PartyMembersDao partyMembersDao;
@ -849,7 +854,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
/**
* @param gridIdList
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcGridUserResultDTO>>
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcGridUserResultDTO>>
* @Author yinzuomei
* @Description 根据网格id查询网格下所有的用户
* @Date 2019/12/19 15:03
@ -859,6 +864,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
return new Result<List<EpdcGridUserResultDTO>>().ok(baseDao.selectListGridUserResultDTO(gridIdList));
}
/**
* 根据微信信息查询用户
*
@ -887,4 +893,32 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
return ConvertUtils.sourceToTarget(userEntity, UserDTO.class);
}
@Override
public Result createPidemicInfo(EpdcAppPidemicCompleteInfoFromDTO completeInfoFromDto) {
// 更新用户信息
UserEntity userEntity = selectById(completeInfoFromDto.getUserId());
UserDTO userDTO = ConvertUtils.sourceToTarget(userEntity, UserDTO.class);
userDTO.setRealName(completeInfoFromDto.getName());
userDTO.setIdentityNo(completeInfoFromDto.getIdcard());
userDTO.setMobile(completeInfoFromDto.getPhone());
userDTO.setAddress(completeInfoFromDto.getHabitationDetail());
userDTO.setRentFlag(completeInfoFromDto.getIsRent());
userDTO.setDriverFlag(completeInfoFromDto.getIsDriver());
userDTO.setId(completeInfoFromDto.getUserId());
update(userDTO);
// 更新或存储用户车辆信息表
UserCarInfoDTO userCarInfoDTO = userCarInfoService.selectOneByCarNumber(completeInfoFromDto.getCarNum());
if (userCarInfoDTO == null) {
UserCarInfoDTO dto = new UserCarInfoDTO();
dto.setUserId(userDTO.getId());
dto.setCarNumber(completeInfoFromDto.getCarNum());
userCarInfoService.save(dto);
} else {
// 库里存的车牌号与该用户不相符
if (!userCarInfoDTO.getUserId().equals(userDTO.getId())) {
throw new RenException("保存失败,此车牌已被注册");
}
}
return new Result();
}
}

19
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/UserCarInfoDao.xml

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.UserCarInfoDao">
<resultMap type="com.elink.esua.epdc.entity.UserCarInfoEntity" id="userCarInfoMap">
<result property="id" column="ID"/>
<result property="userId" column="USER_ID"/>
<result property="carNumber" column="CAR_NUMBER"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>
Loading…
Cancel
Save