diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/result/EpdcSentryPostInfoResultDTO.java b/esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/result/EpdcSentryPostInfoResultDTO.java new file mode 100644 index 000000000..857a137bb --- /dev/null +++ b/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; + +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiCustomController.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiCustomController.java index 57ff781d0..4b472d8f0 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiCustomController.java +++ b/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 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 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 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); + } } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/CustomFeignClient.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/CustomFeignClient.java index 6e978b543..5521eac8b 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/CustomFeignClient.java +++ b/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 getEpidemicSentryBySentryPostCode(@PathVariable("sentryPostCode") String sentryPostCode); + } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java index b9854986c..963b22a2b 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java +++ b/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> + * @return com.elink.esua.epdc.commons.tools.utils.Result> * @author work@yujt.net.cn * @date 2019/10/23 13:34 */ @@ -237,11 +237,10 @@ public interface UserFeignClient { Result residentDetail(@PathVariable("userId") String userId); /** - * * 获取用户最后一次切换的网格信息 * - * @params [openId] * @return com.elink.esua.epdc.commons.tools.utils.Result + * @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> + * @return com.elink.esua.epdc.commons.tools.utils.Result> * @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> + * @return com.elink.esua.epdc.commons.tools.utils.Result> * @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 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); } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/CustomFeignClientFallback.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/CustomFeignClientFallback.java index ea4baba25..06353df79 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/CustomFeignClientFallback.java +++ b/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 getEpidemicSentryBySentryPostCode(String sentryPostCode) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_CUSTOM_SERVER, "getEpidemicSentryBySentryPostCode", sentryPostCode); + } } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java index 962b5f70b..868ba6117 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java +++ b/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 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); + } } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/CustomService.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/CustomService.java index dac29a359..e7cd236af 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/CustomService.java +++ b/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 + **/ + Result 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); } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/CustomServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/CustomServiceImpl.java index fda539882..5ba059026 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/CustomServiceImpl.java +++ b/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 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 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 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); + } } diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/EpidemicSentryPostDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/EpidemicSentryPostDTO.java new file mode 100644 index 000000000..d8378be45 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + + /** + * 删除标识 0:否,1:是 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/CreateCodeFormDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/CreateCodeFormDTO.java new file mode 100644 index 000000000..fd50d318c --- /dev/null +++ b/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; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/pom.xml b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/pom.xml index d167c5b5d..8c16300f7 100644 --- a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/pom.xml +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/pom.xml @@ -63,6 +63,24 @@ orika-spring-boot-starter 1.8.0 + + com.esua.epdc + epdc-admin-client + 1.0.0 + compile + + + + + + + + + + com.esua.epdc + epdc-commons-tools-wx-ma + ${project.version} + @@ -133,6 +151,13 @@ 6379 elink@888 + + wxdd8530c5f4926766 + 5bf4fb813145431b3493a10aa7e041e9 + + wx29b074840ef4bfd9 + 4adb1afccc69f205cdf5b521d74e2aca + @@ -163,6 +188,13 @@ epdc elink833066 + + wxdd8530c5f4926766 + 5bf4fb813145431b3493a10aa7e041e9 + + wx29b074840ef4bfd9 + 4adb1afccc69f205cdf5b521d74e2aca + true 47.104.224.45:8848 diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/config/StreamUtils.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/config/StreamUtils.java new file mode 100644 index 000000000..1caef31ae --- /dev/null +++ b/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(); + } + } +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/controller/EpidemicSentryPostController.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/controller/EpidemicSentryPostController.java new file mode 100644 index 000000000..135c3fe62 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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> page(@RequestParam Map params){ + PageData page = epidemicSentryPostService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + EpidemicSentryPostDTO data = epidemicSentryPostService.get(id); + return new Result().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 params, HttpServletResponse response) throws Exception { + List list = epidemicSentryPostService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, EpidemicSentryPostExcel.class); + } + + @GetMapping("getEpidemicSentryBySentryPostCode/{sentryPostCode}") + public Result getEpidemicSentryBySentryPostCode(@PathVariable String sentryPostCode){ + EpidemicSentryPostDTO data = epidemicSentryPostService.getEpidemicSentryBySentryPostCode(sentryPostCode); + return new Result().ok(data); + } + + + /** + * @Description: 哨卡名称查询(未绑定网格id的) + * @Param: [] + * @return: com.elink.esua.epdc.commons.tools.utils.Result>> + * @Author: zy + * @Date: 2020-02-14 + */ + @GetMapping("selectListSentryPostName") + public Result>> selectListSentryPostName(){ + List> data = epidemicSentryPostService.listSentryPostName(); + return new Result>>().ok(data); + } + + + /** + * @Description: 查询哨卡名称是否重复 + * @Param: [sentryPostCode] + * @return: java.lang.Integer + * @Author: zy + * @Date: 2020-02-15 + */ + @GetMapping("sentryPostCodeIsRepeat/{sentryPostCode}") + public Result sentryPostCodeIsRepeat(@PathVariable("sentryPostCode") String sentryPostCode){ + Integer data = epidemicSentryPostService.countSentryPostCode(sentryPostCode); + return new Result().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); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/dao/EpidemicSentryPostDao.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/dao/EpidemicSentryPostDao.java new file mode 100644 index 000000000..bc0bb200b --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 selectOneOfEpidemicSentryBySentryPostCode(String sentryPostCode); + + + /** + * @Description: 哨卡名称查询(未绑定网格id的) + * @Param: [] + * @return: com.elink.esua.epdc.commons.tools.utils.Result>> + * @Author: zy + * @Date: 2020-02-14 + */ + List> selectListSentryPostName(); + + /** + * @Description: 查询哨卡名称是否重复 + * @Param: [sentryPostCode] + * @return: java.lang.Integer + * @Author: zy + * @Date: 2020-02-15 + */ + Integer selectCountSentryPostCode(String sentryPostCode); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/entity/EpidemicSentryPostEntity.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/entity/EpidemicSentryPostEntity.java new file mode 100644 index 000000000..1a01ec8ef --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/excel/EpidemicSentryPostExcel.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/excel/EpidemicSentryPostExcel.java new file mode 100644 index 000000000..29d0cc5b2 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/feign/OssFeignClient.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/feign/OssFeignClient.java new file mode 100644 index 000000000..ea678737a --- /dev/null +++ b/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 + * @author work@yujt.net.cn + * @date 2019/9/19 10:15 + */ + @PostMapping(value = "oss/file/uploadFile", consumes = MediaType.APPLICATION_JSON_VALUE) + Result uploadFile(UploadToOssDTO dto); + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/feign/fallback/OssFeignClientFallback.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/feign/fallback/OssFeignClientFallback.java new file mode 100644 index 000000000..ac7f8779e --- /dev/null +++ b/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 uploadFile(UploadToOssDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_OSS_SERVER, "uploadFile", dto.getFileName()); + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/redis/EpidemicSentryPostRedis.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/redis/EpidemicSentryPostRedis.java new file mode 100644 index 000000000..01089dcb1 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/service/EpidemicSentryPostService.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/service/EpidemicSentryPostService.java new file mode 100644 index 000000000..a83d65916 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-02-14 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-02-14 + */ + List list(Map 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>> + * @Author: zy + * @Date: 2020-02-14 + */ + List> 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); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/EpidemicSentryPostServiceImpl.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/EpidemicSentryPostServiceImpl.java new file mode 100644 index 000000000..5f4ef413e --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 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 page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, EpidemicSentryPostDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, EpidemicSentryPostDTO.class); + } + + private QueryWrapper getWrapper(Map 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 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> 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 oldEntityList = baseDao.selectList(new QueryWrapper<>()); + List epidemicExcelList = ExcelImportUtil.importExcel(f, EpidemicSentryPostExcel.class, importParams); + // third_sentry_post_id 已存在更新 不存在插入 + List newEpidemicList = this.updataOrSaveExcel(epidemicExcelList, oldEntityList); + List epidemicList = ConvertUtils.sourceToTarget(newEpidemicList, EpidemicSentryPostEntity.class); + boolean b = insertBatch(epidemicList); + return new Result(); + } + + private List updataOrSaveExcel(List epidemicExcelList, List oldEntityList) { + List newEpidemicList = new ArrayList<>(); + newEpidemicList.addAll(epidemicExcelList); + QueryWrapper 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 wrapper = new QueryWrapper<>(data); + List 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 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; + } +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/application.yml b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/application.yml index a2323c50c..ce56ceb88 100644 --- a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/application.yml +++ b/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@ \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/epidemic/EpidemicSentryPostDao.xml b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/epidemic/EpidemicSentryPostDao.xml new file mode 100644 index 000000000..b05f2ab98 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/epidemic/EpidemicSentryPostDao.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/UserDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/UserDTO.java index 076cc8f66..f69f216a2 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/UserDTO.java +++ b/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; } diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/UserCarInfoDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/UserCarInfoDTO.java new file mode 100644 index 000000000..43cad7dbc --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcAppPidemicCompleteInfoFromDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcAppPidemicCompleteInfoFromDTO.java new file mode 100644 index 000000000..792283966 --- /dev/null +++ b/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; + +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppUserController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppUserController.java index 2550651a4..e60b1c027 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppUserController.java +++ b/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> queryGroupUsers(@RequestBody List gridIdList) { return userService.listGridUserResultDTO(gridIdList); } + + /*** + * 居民在防疫哨卡进行登记时,上送数据并完善党群系统个人信息 + * @param formDTO + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author qushutong + * @date 2020/2/15 11:06 + */ + @PostMapping("sentryPost/completeInfo") + public Result> sentPidemicInfo(@RequestBody EpdcAppPidemicCompleteInfoFromDTO formDTO) { + return userService.createPidemicInfo(formDTO); + } } diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/UserCarInfoController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/UserCarInfoController.java new file mode 100644 index 000000000..34358f25c --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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> page(@RequestParam Map params){ + PageData page = userCarInfoService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + UserCarInfoDTO data = userCarInfoService.get(id); + return new Result().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 params, HttpServletResponse response) throws Exception { + List list = userCarInfoService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, UserCarInfoExcel.class); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/UserCarInfoDao.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/UserCarInfoDao.java new file mode 100644 index 000000000..6cecfa184 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/UserCarInfoEntity.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/UserCarInfoEntity.java new file mode 100644 index 000000000..d59419950 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/UserEntity.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/UserEntity.java index c1ae65855..d2e7f5da7 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/UserEntity.java +++ b/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; } diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/UserCarInfoExcel.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/UserCarInfoExcel.java new file mode 100644 index 000000000..f20c86c75 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/UserCarInfoRedis.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/UserCarInfoRedis.java new file mode 100644 index 000000000..4dd4a6b2f --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserCarInfoService.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserCarInfoService.java new file mode 100644 index 000000000..78e06a08a --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-02-15 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-02-15 + */ + List list(Map 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); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserService.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserService.java index 1df248fcc..280fd757d 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserService.java +++ b/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 { * @Date 2019/12/19 15:03 **/ Result> listGridUserResultDTO(List gridIdList); + + + + /*** + * 居民在防疫哨卡进行登记时,上送数据并完善党群系统个人信息 + * @param completeInfoFromDto + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author qushutong + * @date 2020/2/15 10:58 + */ + Result createPidemicInfo(EpdcAppPidemicCompleteInfoFromDTO completeInfoFromDto); } diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserCarInfoServiceImpl.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserCarInfoServiceImpl.java new file mode 100644 index 000000000..fb301bb6c --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 implements UserCarInfoService { + + @Autowired + private UserCarInfoRedis userCarInfoRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, UserCarInfoDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, UserCarInfoDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper 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); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java index e0a61a7ef..81db7e44a 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java +++ b/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 implements UserService { + @Autowired + private UserCarInfoService userCarInfoService; + @Autowired private PartyMembersDao partyMembersDao; @@ -849,7 +854,7 @@ public class UserServiceImpl extends BaseServiceImpl implem /** * @param gridIdList - * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @return com.elink.esua.epdc.commons.tools.utils.Result> * @Author yinzuomei * @Description 根据网格id查询网格下所有的用户 * @Date 2019/12/19 15:03 @@ -859,6 +864,7 @@ public class UserServiceImpl extends BaseServiceImpl implem return new Result>().ok(baseDao.selectListGridUserResultDTO(gridIdList)); } + /** * 根据微信信息查询用户 * @@ -887,4 +893,32 @@ public class UserServiceImpl extends BaseServiceImpl 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(); + } } diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/UserCarInfoDao.xml b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/UserCarInfoDao.xml new file mode 100644 index 000000000..d67f0e94a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/UserCarInfoDao.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file