diff --git a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java index 386e162c02..3ed824f33f 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java @@ -83,6 +83,20 @@ public class GovLoginController { return new Result().ok(userTokenResultDTO); } + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhy + * @Description 4、选择组织,进入首页 + * @Date 2020/4/20 13:07 + **/ + @PostMapping(value = "/loginwxmp/enterorgbyaccount") + public Result enterOrgByAccount(@RequestBody GovWxmpEnteOrgByAccountFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO,GovWxmpEnteOrgByAccountFormDTO.AddUserShowGroup.class,GovWxmpEnteOrgByAccountFormDTO.AddUserInternalGroup.class); + UserTokenResultDTO userTokenResultDTO=govLoginService.enterOrgByAccount(formDTO); + return new Result().ok(userTokenResultDTO); + } + /** * @param tokenDto * @return com.epmet.commons.tools.utils.Result @@ -121,5 +135,19 @@ public class GovLoginController { List staffOrgs = govLoginService.getMyOrgByPassword(formDTO); return new Result>().ok(staffOrgs); } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author zhy + * @description 6、账户密码获取组织 + * @Date 2020/6/30 22:43 + **/ + @PostMapping(value = "/getmyorgbyaccount") + public Result> getMyOrgByAccount(@RequestBody StaffOrgByAccountFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, StaffOrgByAccountFormDTO.AddUserShowGroup.class, StaffOrgByAccountFormDTO.GetMyOrgByPassWordGroup.class); + List staffOrgs = govLoginService.getMyOrgByAccount(formDTO); + return new Result>().ok(staffOrgs); + } } diff --git a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java index 56b97fa2c6..0bb11c468a 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java @@ -61,6 +61,19 @@ public class ThirdLoginController { return new Result().ok(userTokenResultDTO); } + /** + * @param formDTO + * @return + * @Author zhy + * @Description 单客户-选择组织,进入首页 + **/ + @PostMapping(value = "enterorgbyaccount") + public Result enterOrgByAccount(@RequestBody ThirdWxmpEnteOrgByAccountFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO,ThirdWxmpEnteOrgFormDTO.AddUserShowGroup.class,ThirdWxmpEnteOrgFormDTO.AddUserInternalGroup.class); + UserTokenResultDTO userTokenResultDTO=thirdLoginService.enterOrgByAccount(formDTO); + return new Result().ok(userTokenResultDTO); + } + /** * @param formDTO * @return @@ -87,6 +100,19 @@ public class ThirdLoginController { return new Result>().ok(staffOrgs); } + /** + * @param formDTO + * @return + * @author zhy + * @description 单客户-账号密码获取组织 + **/ + @PostMapping(value = "/getmyorgbyaccount") + public Result> getMyOrgByAccount(@RequestBody ThirdStaffOrgByAccountFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, StaffOrgByAccountFormDTO.AddUserShowGroup.class, StaffOrgByAccountFormDTO.GetMyOrgByPassWordGroup.class); + List staffOrgs = thirdLoginService.getMyOrgByAccount(formDTO); + return new Result>().ok(staffOrgs); + } + /** * @param formDTO * @return diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgByAccountFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgByAccountFormDTO.java new file mode 100644 index 0000000000..4996c0cd50 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgByAccountFormDTO.java @@ -0,0 +1,48 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 选择组织,进入首页入参Dto + * @Author yinzuomei + * @Date 2020/4/20 13:03 + */ +@Data +public class GovWxmpEnteOrgByAccountFormDTO implements Serializable { + public interface AddUserInternalGroup {} + public interface AddUserShowGroup extends CustomerClientShowGroup {} + /** + * wxCode + */ + @NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class}) + private String wxCode; + + /** + * 手机号 + */ + @NotBlank(message = "账号不能为空",groups = {AddUserShowGroup.class}) + private String userAccount; + + /** + * 选择的组织所属的id + */ + @NotBlank(message = "客户id不能为空",groups = {AddUserInternalGroup.class}) + private String customerId; + + /** + * 选择的要进入的组织(根组织id) + */ + @NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class}) + private String rootAgencyId; + + /** + * desc:小程序appId + */ + private String appId; + +} + diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/StaffOrgByAccountFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/StaffOrgByAccountFormDTO.java new file mode 100644 index 0000000000..669a0e7998 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/StaffOrgByAccountFormDTO.java @@ -0,0 +1,43 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 手机验证码获取组织接口入参 + * @Author zhy + * @Date 2020/4/18 10:38 + */ +@Data +public class StaffOrgByAccountFormDTO implements Serializable { + private static final long serialVersionUID = 4193133227120225342L; + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + public interface GetMyOrgByPassWordGroup extends CustomerClientShowGroup { + } + public interface GetMyOrgByLoginWxmp extends CustomerClientShowGroup{} + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空", groups = {AddUserShowGroup.class}) + private String userAccount; + + /** + * 验证码 + */ + @NotBlank(message="验证码不能为空", groups = {GetMyOrgByLoginWxmp.class}) + private String smsCode; + + @NotBlank(message = "密码不能为空",groups ={GetMyOrgByPassWordGroup.class}) + private String password; +} + diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgByAccountFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgByAccountFormDTO.java new file mode 100644 index 0000000000..3cad308ab6 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgByAccountFormDTO.java @@ -0,0 +1,48 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description appId、账号、验证码获取组织-接口入参 + * @Author zhy + */ +@Data +public class ThirdStaffOrgByAccountFormDTO implements Serializable { + private static final long serialVersionUID = 4193133227120225342L; + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + public interface GetMyOrgByPassWordGroup extends CustomerClientShowGroup { + } + public interface GetMyOrgByLoginWxmp extends CustomerClientShowGroup{} + /** + * 小程序appId + */ + @NotBlank(message = "appId不能为空", groups = {AddUserShowGroup.class}) + private String appId; + + /** + * 手机号 + */ + @NotBlank(message = "账号不能为空", groups = {AddUserShowGroup.class}) + private String userAccount; + + /** + * 验证码 + */ + @NotBlank(message="验证码不能为空", groups = {GetMyOrgByLoginWxmp.class}) + private String smsCode; + + @NotBlank(message = "密码不能为空",groups ={GetMyOrgByPassWordGroup.class}) + private String password; +} + diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgByAccountFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgByAccountFormDTO.java new file mode 100644 index 0000000000..e89028eb4c --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgByAccountFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 单客户-选择组织,进入首页入参Dto + * @Author sun + */ +@Data +public class ThirdWxmpEnteOrgByAccountFormDTO implements Serializable { + public interface AddUserInternalGroup {} + public interface AddUserShowGroup extends CustomerClientShowGroup {} + /** + * wxCode + */ + @NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class}) + private String wxCode; + + /** + * 手机号 + */ + @NotBlank(message = "账号不能为空",groups = {AddUserShowGroup.class}) + private String userAccount; + + /** + * 选择的组织所属的id + */ + @NotBlank(message = "客户id不能为空",groups = {AddUserInternalGroup.class}) + private String customerId; + + /** + * 选择的要进入的组织(根组织id) + */ + @NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class}) + private String rootAgencyId; + + /** + * 客户appId(exJson文件中获取) + */ + @NotBlank(message = "appId不能为空",groups = {AddUserInternalGroup.class}) + private String appId; +} + diff --git a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index 44c7d9d3ab..af33d8c632 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -70,6 +70,17 @@ public interface EpmetUserFeignClient { @GetMapping(value = "epmetuser/customerstaff/getcustsomerstaffbyphone/{mobile}") Result> checkCustomerStaff(@PathVariable("mobile") String mobile); + /** + * @param account + * @return com.epmet.commons.tools.utils.Result + * @Author zhy + * @Description 根据账户查询政府端工作人员基本信息,校验用户是否存在 + * @Date 2020/4/18 14:03 + **/ + @GetMapping(value = "epmetuser/customerstaff/getcustsomerstaffbyaccount/{account}") + Result> checkCustomerStaffByAccount(@PathVariable("account") String account); + + /** * @param staffWechatFormDTO * @return com.epmet.commons.tools.utils.Result @@ -100,6 +111,17 @@ public interface EpmetUserFeignClient { @PostMapping(value = "epmetuser/customerstaff/getcustomerstaffinfo", consumes = MediaType.APPLICATION_JSON_VALUE) Result getCustomerStaffInfo(@RequestBody CustomerStaffFormDTO customerStaffFormDTO); + /** + * @param customerStaffFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhy + * @Description 根据手机号+客户id获取工作人员基本信息 + * @Date 2020/4/20 14:16 + **/ + @PostMapping(value = "epmetuser/customerstaff/getcustomerstaffinfobyaccount", consumes = MediaType.APPLICATION_JSON_VALUE) + Result getCustomerStaffInfoByAccount(@RequestBody CustomerStaffByAccountFormDTO customerStaffFormDTO); + + /** * @param staffLoginHistoryFormDTO * @return com.epmet.commons.tools.utils.Result diff --git a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java index 59623a7dc7..d0ce30ab99 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ b/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -44,6 +44,10 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustsomerStaffByPhone", phone); } + @Override + public Result> checkCustomerStaffByAccount(String account) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustsomerStaffByAccount", account); + } @Override public Result saveStaffWechat(StaffWechatFormDTO staffWechatFormDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffWechat", staffWechatFormDTO); @@ -59,6 +63,11 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfo", customerStaffFormDTO); } + @Override + public Result getCustomerStaffInfoByAccount(CustomerStaffByAccountFormDTO customerStaffFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByAccount", customerStaffFormDTO); + } + @Override public Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO staffLoginHistoryFormDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffLoginRecord", staffLoginHistoryFormDTO); diff --git a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java index ea6329ceda..8ec5697a60 100644 --- a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java @@ -1,10 +1,7 @@ package com.epmet.service; import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.dto.form.GovWxmpEnteOrgFormDTO; -import com.epmet.dto.form.GovWxmpFormDTO; -import com.epmet.dto.form.SendSmsCodeFormDTO; -import com.epmet.dto.form.StaffOrgsFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.dto.result.UserTokenResultDTO; @@ -52,6 +49,15 @@ public interface GovLoginService { **/ UserTokenResultDTO enterOrg(GovWxmpEnteOrgFormDTO formDTO); + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhy + * @Description 4、选择组织,进入首页 + * @Date 2020/4/20 13:08 + **/ + UserTokenResultDTO enterOrgByAccount(GovWxmpEnteOrgByAccountFormDTO formDTO); + /** * @return com.epmet.commons.tools.utils.Result * @param tokenDto @@ -76,4 +82,13 @@ public interface GovLoginService { * @Date 2020/6/30 22:43 **/ List getMyOrgByPassword(StaffOrgsFormDTO formDTO); + + /** + * @return java.util.List + * @param formDTO + * @author zhy + * @description 6、账户密码获取组织 + * @Date 2020/6/30 22:43 + **/ + List getMyOrgByAccount(StaffOrgByAccountFormDTO formDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java index 19b0e0dc91..70bcc92338 100644 --- a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java @@ -37,6 +37,15 @@ public interface ThirdLoginService { **/ UserTokenResultDTO enterOrg(ThirdWxmpEnteOrgFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author zhy + * @Description 单客户-选择组织,进入首页 + **/ + UserTokenResultDTO enterOrgByAccount(ThirdWxmpEnteOrgByAccountFormDTO formDTO); + /** * @param formDTO * @return @@ -53,6 +62,15 @@ public interface ThirdLoginService { **/ List getMyOrgByPassword(ThirdStaffOrgsFormDTO formDTO); + /** + * @param formDTO + * @return + * @author zhy + * @description 单客户-手机号密码获取组织 + **/ + List getMyOrgByAccount(ThirdStaffOrgByAccountFormDTO formDTO); + + /** * @param formDTO * @return diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index cbc46e33f1..24267debd1 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -289,6 +289,36 @@ public class GovLoginServiceImpl implements GovLoginService, ResultDataResolver return userTokenResultDTO; } + @Override + public UserTokenResultDTO enterOrgByAccount(GovWxmpEnteOrgByAccountFormDTO formDTO) { + //1、需要校验要登录的客户,是否被禁用 + CustomerStaffByAccountFormDTO customerStaffFormDTO = new CustomerStaffByAccountFormDTO(); + customerStaffFormDTO.setCustomerId(formDTO.getCustomerId()); + customerStaffFormDTO.setUserAccount(formDTO.getUserAccount()); + Result customerStaffDTOResult = epmetUserFeignClient.getCustomerStaffInfoByAccount(customerStaffFormDTO); + if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) { + logger.warn(String.format("获取工作人员信息失败,账户[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getUserAccount(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg())); + throw new RenException(customerStaffDTOResult.getCode()); + } + CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); + //2、解析微信用户 + WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode(), formDTO.getAppId()); + + //3、记录staff_wechat,并记录用户激活状态,激活时间 + this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid(), formDTO.getCustomerId()); + //4、记录登录日志 + GovWxmpEnteOrgFormDTO orgDTO = ConvertUtils.sourceToTarget(formDTO, GovWxmpEnteOrgFormDTO.class); + orgDTO.setMobile(customerStaff.getMobile()); + this.saveStaffLoginRecord(orgDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); + //5.1、获取用户token + String token = this.generateGovWxmpToken(customerStaff.getUserId()); + //5.2、保存到redis + this.saveGovTokenDto(formDTO.getRootAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token); + UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setToken(token); + return userTokenResultDTO; + } + @Override public void loginOut(TokenDto tokenDto) { if(null == tokenDto){ @@ -381,6 +411,63 @@ public class GovLoginServiceImpl implements GovLoginService, ResultDataResolver return new ArrayList<>(); } + @Override + public List getMyOrgByAccount(StaffOrgByAccountFormDTO formDTO) { + //1、根据手机号查询到用户信息 + Result> customerStaffResult = epmetUserFeignClient.checkCustomerStaffByAccount(formDTO.getUserAccount()); + if (!customerStaffResult.success()) { + logger.warn(String.format("账户密码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getUserAccount(), customerStaffResult.getCode(), customerStaffResult.getMsg())); + throw new RenException(customerStaffResult.getCode()); + } + //2、密码是否正确 + List customerStaffList=customerStaffResult.getData(); + //3、查询用户所有的组织信息 + List customerIdList = new ArrayList<>(); + //是否设置过密码 + boolean havePasswordFlag=false; + //密码是否正确 + boolean passwordRightFlag=false; + for (CustomerStaffDTO customerStaffDTO : customerStaffList) { + if(StringUtils.isNotBlank(customerStaffDTO.getPassword())){ + havePasswordFlag=true; + }else{ + logger.warn(String.format("当前用户:账户%s,客户Id%s下未设置密码.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId())); + continue; + } + if (!PasswordUtils.matches(formDTO.getPassword(), customerStaffDTO.getPassword())) { + logger.warn(String.format("当前用户:账户%s,客户Id%s密码匹配错误.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId())); + + }else{ + logger.warn(String.format("当前用户:账户%s,客户Id%s密码匹配正确.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId())); + passwordRightFlag=true; + customerIdList.add(customerStaffDTO.getCustomerId()); + } + } + //根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码 + if(!havePasswordFlag){ + logger.warn(String.format("当前账户(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getUserAccount())); + throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode()); + } + //密码错误 + if(!passwordRightFlag){ + logger.warn(String.format("根据当前账户(%s)密码未找到所属组织,密码错误",formDTO.getUserAccount())); + throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode()); + } + StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO(); + staffOrgFormDTO.setCustomerIdList(customerIdList); + Result> result = govOrgFeignClient.getStaffOrgList(staffOrgFormDTO); + if(result.success()&&null!=result.getData()){ + return result.getData(); + } + logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参账户%s,密码%s,返回错误码%s,错误提示信息%s", + ServiceConstant.GOV_ORG_SERVER, + formDTO.getUserAccount(), + formDTO.getPassword(), + result.getCode(), + result.getMsg())); + return new ArrayList<>(); + } + //保存登录日志 private Result saveStaffLoginRecord(GovWxmpEnteOrgFormDTO formDTO, String staffId, String openId) { StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO(); diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java index 70c253d2c3..91812aaeda 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java @@ -442,6 +442,68 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol return userTokenResultDTO; } + /** + * @param formDTO + * @return + * @Author sun + * @Description 单客户-选择组织,进入首页 + **/ + @Override + public UserTokenResultDTO enterOrgByAccount(ThirdWxmpEnteOrgByAccountFormDTO formDTO) { + //1、需要校验要登录的客户,是否被禁用 + CustomerStaffByAccountFormDTO customerStaffFormDTO = new CustomerStaffByAccountFormDTO(); + customerStaffFormDTO.setCustomerId(formDTO.getCustomerId()); + customerStaffFormDTO.setUserAccount(formDTO.getUserAccount()); + Result customerStaffDTOResult = epmetUserOpenFeignClient.getCustomerStaffInfoByAccount(customerStaffFormDTO); + if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) { + logger.error(String.format("获取工作人员信息失败,账户[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getUserAccount(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg())); + throw new RenException(customerStaffDTOResult.getCode()); + } + CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); + //2020.7.24 获取微信信息接口调整,改调用微信api的方式 sun start + //2.调用epmet_third服务,校验appId是否有效以及是否授权,校验通过的调用微信API获取用户基本信息 + WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO(); + resiLoginFormDTO.setAppId(formDTO.getAppId()); + resiLoginFormDTO.setWxCode(formDTO.getWxCode()); + UserWechatDTO userWechatDTO = this.getUserWeChat(resiLoginFormDTO); + WxMaJscode2SessionResult wxMaJscode2SessionResult = new WxMaJscode2SessionResult(); + wxMaJscode2SessionResult.setOpenid(userWechatDTO.getWxOpenId()); + wxMaJscode2SessionResult.setSessionKey(userWechatDTO.getSessionKey()); + wxMaJscode2SessionResult.setUnionid(""); + // end + //3、记录staff_wechat,并记录用户激活状态,激活时间 + this.savestaffwechat(customerStaff.getUserId(), userWechatDTO.getWxOpenId(), formDTO.getCustomerId()); + //4、记录登录日志 + StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = new StaffLatestAgencyResultDTO(); + staffLatestAgencyResultDTO.setCustomerId(formDTO.getCustomerId()); + staffLatestAgencyResultDTO.setStaffId(customerStaff.getUserId()); + staffLatestAgencyResultDTO.setWxOpenId(userWechatDTO.getWxOpenId()); + staffLatestAgencyResultDTO.setMobile(customerStaff.getMobile()); + staffLatestAgencyResultDTO.setAgencyId(formDTO.getRootAgencyId()); + this.saveStaffLoginRecord(staffLatestAgencyResultDTO); + //5.1、获取用户token + String token = this.generateGovWxmpToken(customerStaff.getUserId()); + //5.2、保存到redis + StaffLatestAgencyResultDTO staffLatestAgency = new StaffLatestAgencyResultDTO(); + staffLatestAgency.setAgencyId(formDTO.getRootAgencyId()); + staffLatestAgency.setCustomerId(formDTO.getCustomerId()); + staffLatestAgency.setStaffId(customerStaff.getUserId()); + this.saveLatestGovTokenDto(staffLatestAgency, userWechatDTO, token); + + UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setToken(token); + + //6.发送登录事件 + try { + sendLoginEvent(customerStaff.getUserId(), formDTO.getAppId(), AppClientConstant.APP_GOV, AppClientConstant.CLIENT_WXMP); + } catch (RenException e) { + log.error(e.getInternalMsg()); + } catch (Exception e) { + log.error("【工作端enterOrg登录】发送登录事件失败,程序继续执行。错误信息"); + } + return userTokenResultDTO; + } + /** * @param formDTO * @return @@ -555,6 +617,69 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol return new ArrayList<>(); } + @Override + public List getMyOrgByAccount(ThirdStaffOrgByAccountFormDTO formDTO) { + //0.根据appId查询对应客户Id + PaCustomerDTO customer = this.getCustomerInfo(formDTO.getAppId()); + //7.28 上边根据appId只能锁定一条客户id,后边的批量循环操作暂不做调整,还是使用之前的代码 sun + //1、根据手机号查询到用户信息 + ThirdCustomerStaffByAccountFormDTO dto = new ThirdCustomerStaffByAccountFormDTO(); + dto.setCustomerId(customer.getId()); + dto.setUserAccount(formDTO.getUserAccount()); + Result> customerStaffResult = epmetUserOpenFeignClient.getCustsomerStaffByIdAndAccount(dto); + if (!customerStaffResult.success()) { + logger.warn(String.format("账户密码登录异常,账户[%s],code[%s],msg[%s]", formDTO.getUserAccount(), customerStaffResult.getCode(), customerStaffResult.getMsg())); + throw new RenException(customerStaffResult.getCode()); + } + //2、密码是否正确 + List customerStaffList=customerStaffResult.getData(); + //3、查询用户所有的组织信息 + List customerIdList = new ArrayList<>(); + //是否设置过密码 + boolean havePasswordFlag=false; + //密码是否正确 + boolean passwordRightFlag=false; + for (CustomerStaffDTO customerStaffDTO : customerStaffList) { + if(StringUtils.isNotBlank(customerStaffDTO.getPassword())){ + havePasswordFlag=true; + }else{ + logger.warn(String.format("当前用户:账户%s,客户Id%s下未设置密码.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId())); + continue; + } + if (!PasswordUtils.matches(formDTO.getPassword(), customerStaffDTO.getPassword())) { + logger.warn(String.format("当前用户:账户%s,客户Id%s密码匹配错误.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId())); + + }else{ + logger.warn(String.format("当前用户:账户%s,客户Id%s密码匹配正确.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId())); + passwordRightFlag=true; + customerIdList.add(customerStaffDTO.getCustomerId()); + } + } + //根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码 + if(!havePasswordFlag){ + logger.warn(String.format("当前账户(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getUserAccount())); + throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode()); + } + //密码错误 + if(!passwordRightFlag){ + logger.warn(String.format("根据当前账户(%s)密码未找到所属组织,密码错误",formDTO.getUserAccount())); + throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode()); + } + StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO(); + staffOrgFormDTO.setCustomerIdList(customerIdList); + Result> result = govOrgOpenFeignClient.getStaffOrgList(staffOrgFormDTO); + if(result.success()&&null!=result.getData()){ + return result.getData(); + } + logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参账户%s,密码%s,返回错误码%s,错误提示信息%s", + ServiceConstant.GOV_ORG_SERVER, + formDTO.getUserAccount(), + formDTO.getPassword(), + result.getCode(), + result.getMsg())); + return new ArrayList<>(); + } + /** * @Description 获取客户信息 * @param appId diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 1f0d76e14f..d3e34b119d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -85,6 +85,7 @@ public interface NumConstant { String POSITIVE_EIGHT_STR = "+8"; String EMPTY_STR = ""; String ONE_NEG_STR = "-1"; + String ONE_HUNDRED_STR = "100"; String FIFTY_STR="50"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 405d84d4ae..64688c8990 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -40,6 +40,7 @@ public enum EpmetErrorCode { PASSWORD_NOT_FIT(8010,"两次填写的密码不一致"), PASSWORD_OUT_OF_ORDER(8011,"密码必须8-20个字符,而且同时包含大小写字母和数字"), PASSWORD_UPDATE_FAILED(8012,"密码修改失败"), + GOV_STAFF_ACCOUNT_NOT_EXISTS(8013,"账户未注册,请联系贵单位管理员"), MOBILE_HAS_BEEN_USED(8101, "该手机号已注册,请更换手机号或使用原绑定的微信账号登录"), MOBILE_CODE_ERROR(8102, "验证码错误"), AUTO_CONFIRM_FAILED(8103, "党员注册失败"), @@ -100,6 +101,7 @@ public enum EpmetErrorCode { EXIT_PEND_PROJECT(8408,"该工作人员有项目尚在处理,处理完毕方可操作"), EXIT_PUBLISHED_ACTIVITY(8409,"该工作人员有活动尚在进行,等活动完成方可操作"), CAN_NOT_SELF(8410,"无法对自己进行操作"), + ACCOUNT_USED(8411,"该账号已注册"), PATROL_IS_NOT_OVER(8520,"巡查尚未结束"), ALREADY_EVALUATE(8501,"您已评价"), diff --git a/epmet-module/epmet-job/epmet-job-server/pom.xml b/epmet-module/epmet-job/epmet-job-server/pom.xml index 0aaf92db4a..1e0d00c9ba 100644 --- a/epmet-module/epmet-job/epmet-job-server/pom.xml +++ b/epmet-module/epmet-job/epmet-job-server/pom.xml @@ -43,11 +43,6 @@ epmet-message-client 2.0.0 - - com.epmet - pli-power-base-client - 2.0.0 - org.springframework.boot spring-boot-starter-web diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/PliPowerService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/PliPowerService.java deleted file mode 100644 index 4fb990d033..0000000000 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/PliPowerService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.epmet.service; - -import com.epmet.commons.tools.utils.Result; -import com.epmet.plugin.power.dto.visit.form.VisitorLogoutFormDTO; - -public interface PliPowerService { - - /** - * 访客登出 - * - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @author zhy - * @date 2022/5/30 10:25 - */ - Result visitorLogout(VisitorLogoutFormDTO formDTO); -} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/PliPowerServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/PliPowerServiceImpl.java deleted file mode 100644 index ed54b7e6d9..0000000000 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/PliPowerServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.epmet.service.impl; - -import com.epmet.commons.tools.utils.Result; -import com.epmet.plugin.power.dto.visit.form.VisitorLogoutFormDTO; -import com.epmet.plugin.power.feign.PliPowerFeignClient; -import com.epmet.service.PliPowerService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - - -/** - * @Description - * @ClassName StatsUserServiceImpl - * @Auth wangc - * @Date 2020-06-29 09:41 - */ -@Service -public class PliPowerServiceImpl implements PliPowerService { - - private Logger logger = LoggerFactory.getLogger(getClass()); - - @Autowired - private PliPowerFeignClient pliPowerFeignClient; - - @Override - public Result visitorLogout(VisitorLogoutFormDTO formDTO) { - return pliPowerFeignClient.visitorLogout(formDTO); - } -} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PliVisitorLogoutTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PliVisitorLogoutTask.java deleted file mode 100644 index 41ffa19ecc..0000000000 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PliVisitorLogoutTask.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.epmet.task; - -import com.alibaba.fastjson.JSON; -import com.epmet.commons.tools.utils.Result; -import com.epmet.plugin.power.dto.visit.form.VisitorLogoutFormDTO; -import com.epmet.service.PliPowerService; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * 访客登出 - * - * @author zhy - * @date 2022/5/30 10:23 - */ -@Component("pliVisitorLogoutTask") -public class PliVisitorLogoutTask implements ITask { - - private Logger logger = LoggerFactory.getLogger(getClass()); - - @Autowired - private PliPowerService pliPowerService; - - @Override - public void run(String params) { - logger.info("VisitorLogoutTask定时任务正在执行,参数为:{}", params); - VisitorLogoutFormDTO formDTO = new VisitorLogoutFormDTO(); - if (StringUtils.isNotBlank(params)) { - formDTO = JSON.parseObject(params, VisitorLogoutFormDTO.class); - } - Result result = pliPowerService.visitorLogout(formDTO); - if (result.success()) { - logger.info("VisitorLogoutTask定时任务执行成功"); - } else { - logger.error("VisitorLogoutTask定时任务执行失败:" + result.getMsg()); - } - } -} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddStaffPyFromDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddStaffPyFromDTO.java new file mode 100644 index 0000000000..9aa774bd31 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddStaffPyFromDTO.java @@ -0,0 +1,87 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import java.io.Serializable; +import java.util.List; + +/** + * @author sun + * @dscription + */ +@NoArgsConstructor +@Data +public class AddStaffPyFromDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 新增人员所属类型Id + */ + private String orgId; + /** + * 客户ID + */ + private String customerId; + /** + * 新增人员所属类型【组织:agency;部门:dept;网格:grid】】 + */ + private String orgType; + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空", groups = AddStaffPyFromDTO.AddStaff.class) + @Length(max = 15, message = "姓名仅允许输入15个字符", groups = AddStaffPyFromDTO.AddStaff.class) + private String name; + /** + * 人员ID + */ + private String staffId; + /** + * 手机 + */ + @NotBlank(message = "手机号不能为空", groups = AddStaffPyFromDTO.AddStaff.class) + @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "请输入正确的手机号", groups = AddStaffPyFromDTO.AddStaff.class) + private String mobile; + /** + * 性别 + */ + @NotNull(message = "性别不能为空", groups = AddStaffPyFromDTO.AddStaff.class) + private Integer gender; + /** + * 专兼职 + */ + @NotBlank(message = "专兼职不能为空", groups = AddStaffPyFromDTO.AddStaff.class) + private String workType; + + /** + * 账户 + */ + @NotBlank(message = "账号不能为空", groups = AddStaffPyFromDTO.AddStaff.class) + private String userAccount; + + /** + * 密码 + */ + @NotBlank(message = "密码不能为空", groups = AddStaffPyFromDTO.AddStaff.class) + private String pwd; + + /** + * 角色id列表 + */ + @NotNull(message = "角色不能为空", groups = AddStaffPyFromDTO.AddStaff.class) + private List roles; + public interface AddStaff extends CustomerClientShowGroup {} + /** + * 来源app(政府端:gov、居民端:resi、运营端:oper) + */ + private String app; + /** + * 来源client(PC端:web、微信小程序:wxmp) + */ + private String client; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitAccountFromDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitAccountFromDTO.java new file mode 100644 index 0000000000..7e0bf7e36c --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitAccountFromDTO.java @@ -0,0 +1,82 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import java.io.Serializable; +import java.util.List; + +/** + * @author zhy + * @dscription + * @date 2020/4/24 10:43 + */ +@NoArgsConstructor +@Data +public class StaffSubmitAccountFromDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 客户ID + */ + private String customerId; + /** + * 机关ID + */ + private String agencyId; + /** + * 人员ID + */ + private String staffId; + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空") + @Length(max = 15, message = "姓名仅允许输入15个字符") + private String name; + /** + * 手机 + */ + @NotBlank(message = "手机号不能为空") + @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "请输入正确的手机号") + private String mobile; + /** + * 性别 + */ + @NotNull(message = "性别不能为空") + private Integer gender; + /** + * 性别 + */ + @NotNull(message = "账号不能为空") + private String userAccount; + /** + * 密码 + */ + private String pwd; + /** + * 专兼职 + */ + @NotBlank(message = "专兼职不能为空") + private String workType; + /** + * 角色id列表 + */ + @NotNull(message = "角色不能为空") + private List roles; + /** + * 来源app(政府端:gov、居民端:resi、运营端:oper) + */ + private String app; + /** + * 来源client(PC端:web、微信小程序:wxmp) + */ + private String client; + /** + * 身份证号 + */ + private String idCard; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBulidingDetailDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBulidingDetailDTO.java index 910044f9cb..10e8e09477 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBulidingDetailDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBulidingDetailDTO.java @@ -57,6 +57,10 @@ public class IcBulidingDetailDTO implements Serializable { */ private String type; + /** + * --楼栋类型,1商品房,2自建房,3别墅 + */ + private String typeName; /** * 排序 diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodDetailDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodDetailDTO.java new file mode 100644 index 0000000000..2ed20afbfa --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodDetailDTO.java @@ -0,0 +1,111 @@ +package com.epmet.dto.result; + +import com.epmet.dto.IcPropertyManagementDTO; +import lombok.Data; + +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/9/21 9:19 + */ +@Data +public class IcNeighborHoodDetailDTO { + private String id; + /** + * 客户id + */ + private String customerId; + + /** + * 小区名称 + */ + private String neighborHoodName; + + /** + * 组织id + */ + private String agencyId; + + /** + * 组织名称--新版详情页面用于显示 + */ + private String agencyName; + + /** + * 上级组织id + */ + private String parentAgencyId; + + /** + * 组织的所有上级组织id + */ + private String agencyPids; + + /** + * 网格id + */ + private String gridId; + + /** + * 详细地址 + */ + private String address; + + /** + * 备注 + */ + private String remark; + + /** + * 中心点位:经度 + */ + private String longitude; + + /** + * 中心点位:纬度 + */ + private String latitude; + + /** + * 坐标区域 + */ + private String coordinates; + + /** + * 坐标位置 + */ + private String location; + + /** + * 网格名称--新版详情页面用于显示 + */ + private String gridName; + + /** + * 物业名称--新版详情页面用于显示 + */ + private List propertyList; + + /** + * 小区编码 + */ + private String coding; + + /** + * 小区系统编码 + */ + private String sysCoding; + + /** + * 实有楼栋数 + */ + private Integer realBuilding; + + /** + * 二维码地址 + */ + private String qrcodeUrl; +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInitResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInitResultDTO.java index c3d0f85a22..36cc283268 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInitResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInitResultDTO.java @@ -25,6 +25,10 @@ public class StaffInitResultDTO implements Serializable { * 手机号 */ private String mobile; + /** + * 手机号 + */ + private String userAccount; /** * 性别 */ @@ -33,6 +37,10 @@ public class StaffInitResultDTO implements Serializable { * 专兼职 */ private String workType; + /** + * 身份证号 + */ + private String idCard; /** * 职责列表 */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseInformationController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseInformationController.java index 21ca6fb933..21cddd9951 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseInformationController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseInformationController.java @@ -23,7 +23,6 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.HouseInformationFormDTO; import com.epmet.dto.result.*; -import com.epmet.entity.IcNeighborHoodEntity; import com.epmet.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -64,7 +63,7 @@ public class HouseInformationController { * @return com.epmet.commons.tools.utils.Result */ @PostMapping("neighborhoodDetail/{neighborhoodId}") - public Result neighborhoodDetail(@PathVariable("neighborhoodId") String neighborhoodId){ + public Result neighborhoodDetail(@PathVariable("neighborhoodId") String neighborhoodId){ return icNeighborHoodService.neighborhoodDetail(neighborhoodId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java index 6d3b50b408..939f740fc1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java @@ -101,6 +101,19 @@ public class StaffController { return staffService.editStaff(tokenDto, fromDTO); } + /** + * 人员编辑 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("editstaffpy") + @RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_UPDATE) + public Result editStaffPy(@LoginUser TokenDto tokenDto, @RequestBody StaffSubmitAccountFromDTO fromDTO){ + ValidatorUtils.validateEntity(fromDTO); + return staffService.editStaffByAccount(tokenDto, fromDTO); + } + /** * 人员详情 * @@ -195,6 +208,20 @@ public class StaffController { return staffService.addStaffV2(fromDTO); } + /** + * 【通讯录】人员添加-平阴 + * @author zhy + */ + + @PostMapping("addstaffpy") + @RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_CREATE) + public Result addStaffPy(@RequestBody StaffSubmitAccountFromDTO fromDTO){ + fromDTO.setApp("gov"); + fromDTO.setClient("wxmp"); + ValidatorUtils.validateEntity(fromDTO); + return staffService.addStaffByAccount(fromDTO); + } + /** * @Description 用户所属组织 * @Param tokenDto diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java index 4d5c986eff..1f3ceacfe5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java @@ -211,4 +211,6 @@ public interface IcHouseDao extends BaseDao { IcHouseEntity getHouseInfoByName(CheckHouseInfoFormDTO formDTO); List houseStatisListDetail(HouseChartFormDTO formDTO); + + List selectListForRenFangStats(@Param("buildingId") String buildingId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java index 24bd9b22e2..52a038ab3b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcPropertyManagementDTO; import com.epmet.entity.IcPropertyManagementEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -50,4 +51,11 @@ public interface IcPropertyManagementDao extends BaseDao selectIdByName(@Param("names")List names); + + /** + * 查询小区关联物业id,name + * @param neighborhoodId + * @return + */ + List selectPropertyNameList(String neighborhoodId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index 8190c9418d..9f2c94e49c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -91,6 +91,16 @@ public interface EpmetUserFeignClient { @PostMapping("/epmetuser/customerstaff/addstaff") Result addStaff(@RequestBody StaffSubmitFromDTO fromDTO); + /** + * 人员添加 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/addstaffaccount") + Result addStaffByAccount(@RequestBody StaffSubmitAccountFromDTO fromDTO); + + /** * 人员编辑 * @@ -100,6 +110,16 @@ public interface EpmetUserFeignClient { @PostMapping("/epmetuser/customerstaff/editstaff") Result editStaff(@RequestBody StaffSubmitFromDTO fromDTO); + /** + * 人员编辑 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/editstaffaccount") + Result editStaffByAccount(@RequestBody StaffSubmitAccountFromDTO fromDTO); + + /** * 人员详情 * diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java index 4594d36a60..5b5e7fc04e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -62,11 +62,21 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "addStaff", fromDTO); } + @Override + public Result addStaffByAccount(StaffSubmitAccountFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "addStaffByAccount", fromDTO); + } + @Override public Result editStaff(StaffSubmitFromDTO fromDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editStaff", fromDTO); } + @Override + public Result editStaffByAccount(StaffSubmitAccountFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editStaffByAccount", fromDTO); + } + @Override public Result getStaffDetail(StaffInfoFromDTO fromDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffDetail", fromDTO); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java index 913b4496c4..266d0f9b41 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java @@ -28,11 +28,11 @@ import com.epmet.dto.NeighborHoodAndManagementDTO; import com.epmet.dto.form.IcNeighborHoodAddFormDTO; import com.epmet.dto.form.ImportInfoFormDTO; import com.epmet.dto.result.BuildingResultDTO; +import com.epmet.dto.result.IcNeighborHoodDetailDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.entity.IcNeighborHoodEntity; import com.epmet.entity.IcNeighborHoodPropertyEntity; import com.epmet.entity.IcPropertyManagementEntity; -import org.springframework.web.bind.annotation.RequestBody; import java.io.IOException; import java.io.InputStream; @@ -194,5 +194,5 @@ public interface IcNeighborHoodService extends BaseService * @params [neighborhoodId] * @return com.epmet.commons.tools.utils.Result */ - Result neighborhoodDetail(String neighborhoodId); + Result neighborhoodDetail(String neighborhoodId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java index 2c11cd6444..fc2f954b02 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java @@ -64,6 +64,14 @@ public interface StaffService { */ Result editStaff(TokenDto tokenDto,StaffSubmitFromDTO fromDTO); + /** + * 人员编辑 + * + * @param fromDTO 参数 + * @return Result + */ + Result editStaffByAccount(TokenDto tokenDto, StaffSubmitAccountFromDTO fromDTO); + /** * 人员详情 * @@ -130,6 +138,13 @@ public interface StaffService { */ Result addStaffV2(AddStaffV2FromDTO fromDTO); + + /** + * 【通讯录】人员添加-平阴 + * @author zhy + */ + Result addStaffByAccount(StaffSubmitAccountFromDTO fromDTO); + /** * @Description 工作人员所属组织 * @Param tokenDto diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index bea7a77501..de8806a781 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -210,7 +210,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { IcBuildingUnitDTO icBuildingUnit = icBuildingUnitService.get(formDTO.getBuildingUnitId()); String doorName = formDTO.getDoorName(); String buildingName = Optional.ofNullable(icBuilding).map(u -> u.getBuildingName()).orElse(""); - String unitName = Optional.ofNullable(icBuildingUnit).map(u -> u.getUnitNum()).orElse(""); + String unitName = Optional.ofNullable(icBuildingUnit).map(u -> u.getUnitName()).orElse(""); return new StringBuilder().append(buildingName).append("-").append(unitName).append("-").append(doorName).toString(); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java index 76df21476b..0f69fc8816 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java @@ -9,6 +9,8 @@ import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; +import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; @@ -160,10 +162,13 @@ public class IcHouseServiceImpl extends BaseServiceImpl getHouseList(TokenDto tokenDto, HouseFormDTO formDTO) { //查询楼栋下房屋列表 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId()); - wrapper.last("ORDER BY CONVERT ( HOUSE_NAME USING gbk ) ASC"); - List list = baseDao.selectList(wrapper); +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId()); +// wrapper.last("ORDER BY CONVERT ( HOUSE_NAME USING gbk ) ASC"); +// List list = baseDao.selectList(wrapper); + + List list = baseDao.selectListForRenFangStats(formDTO.getBuildingId()); + if (CollectionUtils.isEmpty(list)) { return Collections.emptyList(); } @@ -220,6 +225,13 @@ public class IcHouseServiceImpl extends BaseServiceImpl neighborhoodDetail(String neighborhoodId) { - IcNeighborHoodEntity result = baseDao.selectById(neighborhoodId); - if(null != result && null == result.getRemark()){ - result.setRemark(""); + public Result neighborhoodDetail(String neighborhoodId) { + IcNeighborHoodEntity icNeighborHoodEntity = baseDao.selectById(neighborhoodId); + if (null == icNeighborHoodEntity) { + return new Result<>(); } - return new Result().ok(result); + IcNeighborHoodDetailDTO result = ConvertUtils.sourceToTarget(icNeighborHoodEntity, IcNeighborHoodDetailDTO.class); + if(null == result.getRemark()){ + result.setRemark(StrConstant.EPMETY_STR); + } + GridInfoCache gridInfoCache=CustomerOrgRedis.getGridInfo(result.getGridId()); + if (null != gridInfoCache) { + result.setAgencyName(gridInfoCache.getAgencyName()); + result.setGridName(gridInfoCache.getGridName()); + } + result.setPropertyList(propertyManagementDao.selectPropertyNameList(neighborhoodId)); + return new Result().ok(result); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java index e62100cf8d..6950cbcc3c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java @@ -204,6 +204,25 @@ public class StaffServiceImpl implements StaffService { return result; } + @Override + public Result editStaffByAccount(TokenDto tokenDto, StaffSubmitAccountFromDTO fromDTO) { + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + fromDTO.setApp(tokenDto.getApp()); + fromDTO.setClient(tokenDto.getClient()); + + Result result = epmetUserFeignClient.editStaffByAccount(fromDTO); + if (!result.success()) { + if (result.getCode() != EpmetErrorCode.SERVER_ERROR.getCode()) { + return new Result().error(result.getCode(), result.getMsg()); + } + return new Result().error(EpmetErrorCode.STAFF_EDIT_FAILED.getCode(), EpmetErrorCode.STAFF_EDIT_FAILED.getMsg()); + } + //2021.8.24 sun 人员信息编辑时删除工作人员的缓存信息 + CustomerStaffRedis.delStaffInfoFormCache(fromDTO.getCustomerId(), fromDTO.getStaffId()); + return result; + } + @Override public Result getStaffDetail(StaffInfoFromDTO fromDTO) { CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); @@ -597,6 +616,45 @@ public class StaffServiceImpl implements StaffService { return new Result(); } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result addStaffByAccount(StaffSubmitAccountFromDTO fromDTO) { + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + //fromDTO.setApp(tokenDto.getApp()); + //fromDTO.setClient(tokenDto.getClient()); + fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + Result result = epmetUserFeignClient.addStaffByAccount(fromDTO); + + if (!result.success()) { + if (result.getCode() != EpmetErrorCode.SERVER_ERROR.getCode()) { + return new Result().error(result.getCode(), result.getMsg()); + } + return new Result().error(EpmetErrorCode.STAFF_ADD_FAILED.getCode(), EpmetErrorCode.STAFF_ADD_FAILED.getMsg()); + } + //人员机关关系表 + CustomerStaffAgencyEntity customerStaffAgencyEntity = new CustomerStaffAgencyEntity(); + customerStaffAgencyEntity.setCustomerId(customerAgencyEntity.getCustomerId()); + customerStaffAgencyEntity.setUserId(result.getData().getUserId()); + customerStaffAgencyEntity.setAgencyId(customerAgencyEntity.getId()); + customerStaffAgencyService.insert(customerStaffAgencyEntity); + //机关总人数加一 + customerAgencyEntity.setTotalUser(customerAgencyEntity.getTotalUser() + 1); + customerAgencyService.updateById(customerAgencyEntity); + + //2021.8.25 sun 新增一张工作人员注册组织关系表,所以旧接口新增人员时关系表赋值关系数据 + //工作人员注册组织关系表新增数据 + StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity(); + staffOrgRelationEntity.setCustomerId(fromDTO.getCustomerId()); + staffOrgRelationEntity.setPids(("".equals(customerAgencyEntity.getPids()) ? "" : customerAgencyEntity.getPids())); + staffOrgRelationEntity.setStaffId(result.getData().getUserId()); + staffOrgRelationEntity.setOrgId(customerAgencyEntity.getId()); + staffOrgRelationEntity.setOrgType("agency"); + staffOrgRelationService.insert(staffOrgRelationEntity); + + return new Result(); + } + /** * @param tokenDto * @Description 工作人员所属组织 diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml index 1512e7b23e..a825c2538a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml @@ -235,6 +235,12 @@ LEFT JOIN ic_neighbor_hood nh ON (nh.ID = b.NEIGHBOR_HOOD_ID AND nh.DEL_FLAG = '0') WHERE b.DEL_FLAG = '0' AND b.NEIGHBOR_HOOD_ID = #{neighborHoodId} + ORDER BY + b.SORT ASC, + CAST( nh.NEIGHBOR_HOOD_NAME AS SIGNED ), + CONVERT ( nh.NEIGHBOR_HOOD_NAME USING gbk ), + CAST( b.BUILDING_NAME AS SIGNED ), + CONVERT ( b.BUILDING_NAME USING gbk) - + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml index 5a5cf172a3..0b0aba046c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml @@ -48,4 +48,21 @@ ) + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java index 0408211603..24f8e387d0 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java @@ -16,4 +16,5 @@ public class IcEventResultDTO { private String reportUserName; private String mobile; private String address; + private String happenTime; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml index ec9ff0745f..dd94828eb2 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml @@ -43,7 +43,8 @@ e.REPORT_USER_ID reportUserId, e.NAME reportUserName, e.MOBILE mobile, - e.STATUS processStatus + e.STATUS processStatus, + e.happen_time happenTime from ic_event e @@ -71,7 +72,7 @@ and c.CATEGORY_CODE like CONCAT(#{categoryCode},'%') - order by e.CREATED_TIME desc + order by e.happen_time desc diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java index 5f6e2685a3..9f697c584e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java @@ -44,6 +44,11 @@ public class CustomerStaffDTO implements Serializable { */ private String userId; + /** + * 账户 + */ + private String userAccount; + /** * 真实姓名 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcBirthRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcBirthRecordDTO.java index 9215512142..46bee9f321 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcBirthRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcBirthRecordDTO.java @@ -71,7 +71,11 @@ public class IcBirthRecordDTO implements Serializable { @NotBlank(message = "所属家庭不能为空", groups = {AddGroup.class}) private String homeId; private String home; - + /** + * 所属房屋全路径名称 + * 详情回显 + */ + private String homeAllName; /** * 姓名 */ @@ -84,10 +88,9 @@ public class IcBirthRecordDTO implements Serializable { private String mobile; /** - * 性别 + * 性别 1男2女 */ private String gender; - /** * 身份证号 */ @@ -139,6 +142,12 @@ public class IcBirthRecordDTO implements Serializable { */ private String householderRelation; + /** + * 与户主关系【字典表】 + * 详情回显 + */ + private String householderRelationName; + /** * 是否勾选补充居民信息0否 1是 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java index 9b2a5274b6..fddaa92fc9 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java @@ -28,7 +28,8 @@ public class IcEpidemicSpecialAttentionDTO implements Serializable { /** * ID */ - private String id; + @NotBlank(message = "id不能为空",groups = {IcEpidemicSpecialAttentionUpdate.class}) + private String id; /** * 客户ID @@ -55,6 +56,17 @@ public class IcEpidemicSpecialAttentionDTO implements Serializable { */ private Integer isAttention; + /** + * 是否历史关注,1是0否 + */ + private String isHistory; + + /** + * 隔离类型,来自字典表 + */ + // @NotBlank(message = "isolatedState不能为空",groups = {IcEpidemicSpecialAttentionAdd.class,IcEpidemicSpecialAttentionUpdate.class}) + private String isolatedState; + /** * 关注类型,核酸检测:2,疫苗接种:1,行程上报:0 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffByAccountFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffByAccountFormDTO.java new file mode 100644 index 0000000000..75153c3305 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffByAccountFormDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 根据手机号+客户id获取工作人员基本信息 + * @Author yinzuomei + * @Date 2020/4/20 14:02 + */ +@Data +public class CustomerStaffByAccountFormDTO implements Serializable { + private static final long serialVersionUID = 7619815083427853431L; + + // 根据手机号+客户id获取工作人员基本信息 + public interface GetCustomerStaffInfo {} + + @NotBlank(message = "账号不能为空", groups = { GetCustomerStaffInfo.class }) + private String userAccount; + @NotBlank(message = "客户id不能为空", groups = { GetCustomerStaffInfo.class }) + private String customerId; + + /** + * 姓名 + */ + private String realName; + + /** + * 用户id集合 + */ + private List userIds; +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ThirdCustomerStaffByAccountFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ThirdCustomerStaffByAccountFormDTO.java new file mode 100644 index 0000000000..72eacbd9a1 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ThirdCustomerStaffByAccountFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 根据客户ID、手机号查询政府端工作人员基本信息 + * @Author zhy + */ +@Data +public class ThirdCustomerStaffByAccountFormDTO implements Serializable{ + private static final long serialVersionUID = -7994579456530273809L; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 账号 + * */ + private String userAccount; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java index c50649b4a9..66742465ad 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java @@ -24,6 +24,9 @@ public class VaccinationListFormDTO extends PageFormDTO implements Serializable @NotNull(message = "attentionType不能为空",groups = VaccinationListForm.class) private Integer attentionType; + private String isolatedState; + private String isHistory; + /** * 手机号 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatPieResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatPieResultDTO.java new file mode 100644 index 0000000000..084599de93 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatPieResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.result; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/9/19 15:47 + * @DESC + */ +@Data +public class NatPieResultDTO implements Serializable { + + private static final long serialVersionUID = -1617454069928624020L; + + private List isolatedList = new ArrayList<>(); + private List historyList = new ArrayList<>(); + + @Data + public static class IsolatedList{ + private Integer total = NumConstant.ZERO; + private String categoryCode; + private String categoryName; + private String color; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java index 5e739016b3..e9873965b7 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java @@ -95,4 +95,7 @@ public class PersonDataResultDTO implements Serializable { @JsonIgnore private String gridId; + + @JsonIgnore + private String homeId; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java index 29ebb13231..636fc5d3c2 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java @@ -1,6 +1,7 @@ package com.epmet.dto.result; import com.epmet.commons.tools.constant.NumConstant; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import org.apache.commons.lang3.StringUtils; @@ -57,6 +58,7 @@ public class VaccinationListResultDTO implements Serializable { * 最后一次通知时间 */ private String lastInformTime; + private String lastNatTime; /** * 所属小区ID @@ -72,6 +74,8 @@ public class VaccinationListResultDTO implements Serializable { * 所属楼宇Id */ private String buildId; + private String gridId; + private String gridName; /** * 所属楼宇名称 @@ -102,7 +106,12 @@ public class VaccinationListResultDTO implements Serializable { * 小区名+楼栋名+单元名+房屋名 */ private String allName; + private String isolatedState; private String id; + private String userId; + + @JsonIgnore + private String customerId; public VaccinationListResultDTO() { this.vaccinationCount = NumConstant.ZERO; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/NatPieColorEnum.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/NatPieColorEnum.java new file mode 100644 index 0000000000..6f6b58f854 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/NatPieColorEnum.java @@ -0,0 +1,47 @@ +package com.epmet.enums; + +import com.epmet.commons.tools.constant.NumConstant; +import org.apache.commons.lang3.StringUtils; + +/** + * @Author zxc + * @DateTime 2022/3/29 16:17 + * @DESC + */ +public enum NatPieColorEnum { + + REd("0","#ee6666"), + YELLOW("2","#fac858"), + ORANGE("1","#fc8452"), + THREE("3","#73c0de"), + GREEN("100","#91cc75"), + ; + + private String key; + private String value; + + NatPieColorEnum(String key, String value) { + this.key = key; + this.value = value; + } + + public static String getValueByKey(String key){ + if (StringUtils.isBlank(key)){ + return NumConstant.ZERO_STR; + } + for (NatPieColorEnum a : NatPieColorEnum.values()) { + if (a.getKey().equals(key)){ + return a.getValue(); + } + } + return NumConstant.ZERO_STR; + } + + public String getKey() { + return key; + } + + public String getValue() { + return value; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 3c6f82398f..84b6d77d5e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -153,6 +153,16 @@ public interface EpmetUserOpenFeignClient { @PostMapping(value = "epmetuser/customerstaff/getcustomerstaffinfo", consumes = MediaType.APPLICATION_JSON_VALUE) Result getCustomerStaffInfo(@RequestBody CustomerStaffFormDTO customerStaffFormDTO); + /** + * @param customerStaffFormDTO + * @return + * @Author sun + * @Description 根据账户+客户id获取工作人员基本信息 + **/ + @PostMapping(value = "epmetuser/customerstaff/getcustomerstaffinfobyaccount", consumes = MediaType.APPLICATION_JSON_VALUE) + Result getCustomerStaffInfoByAccount(@RequestBody CustomerStaffByAccountFormDTO customerStaffFormDTO); + + /** * @param userIdList * @return com.epmet.commons.tools.utils.Result> @@ -234,6 +244,16 @@ public interface EpmetUserOpenFeignClient { @GetMapping(value = "epmetuser/customerstaff/getCustsomerStaffByIdAndPhone") Result> getCustsomerStaffByIdAndPhone(@RequestBody ThirdCustomerStaffFormDTO formDTO); + /** + * @param formDTO + * @return + * @Author zhy + * @Description 根据客户ID、手机号查询政府端工作人员基本信息,校验用户是否存在 + **/ + @GetMapping(value = "epmetuser/customerstaff/getCustsomerStaffByIdAndAccount") + Result> getCustsomerStaffByIdAndAccount(@RequestBody ThirdCustomerStaffByAccountFormDTO formDTO); + + /** * 获取用户基础信息 * diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 88abc4b4f8..5726a772cd 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -99,6 +99,11 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfo", customerStaffFormDTO); } + @Override + public Result getCustomerStaffInfoByAccount(CustomerStaffByAccountFormDTO customerStaffFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByAccount", customerStaffFormDTO); + } + /** * @param userIdList * @return com.epmet.commons.tools.utils.Result> @@ -174,6 +179,10 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustsomerStaffByIdAndPhone", formDTO); } + @Override + public Result> getCustsomerStaffByIdAndAccount(ThirdCustomerStaffByAccountFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustsomerStaffByIdAndAccount", formDTO); + } @Override public Result selectUserBaseInfo(TokenDto tokenDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectUserBaseInfo", tokenDTO); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index 215af4eab1..293b925353 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -119,6 +119,18 @@ public class CustomerStaffController { return customerStaffService.getCustsomerStaffByPhone(mobile); } + /** + * @param account 账户 + * @return com.epmet.commons.tools.utils.Result + * @Author zhy + * @Description 根据账户查询政府端工作人员基本信息,校验用户是否存在 + * @Date 2020/4/18 14:07 + **/ + @GetMapping(value = "getcustsomerstaffbyaccount/{account}") + public Result> getCustsomerStaffByAccount(@PathVariable("account") String account) { + return customerStaffService.getCustsomerStaffByAccount(account); + } + /** * @param formDTO * @return com.epmet.commons.tools.utils.Result @@ -132,6 +144,19 @@ public class CustomerStaffController { return customerStaffService.getCustomerStaffInfo(formDTO); } + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhy + * @Description 根据账户+客户id获取工作人员基本信息 + * @Date 2020/4/20 14:04 + **/ + @PostMapping(value = "getcustomerstaffinfobyaccount") + public Result getCustomerStaffInfoByAccount(@RequestBody CustomerStaffByAccountFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, CustomerStaffFormDTO.GetCustomerStaffInfo.class); + return customerStaffService.getCustomerStaffInfoByAccount(formDTO); + } + /** * 根据userId查询网格下用户信息 * @param customerStaffGridDTOS @@ -234,6 +259,31 @@ public class CustomerStaffController { return result; } + + /** + * 人员添加 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("addstaffaccount") + public Result addStaffByAccount(@RequestBody StaffSubmitAccountFromDTO fromDTO){ + Result result = customerStaffService.addStaffByAccount(fromDTO); + + //2021-10-18 推送mq,数据同步到中介库 start + if (result.success()) { + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(fromDTO.getCustomerId()); + mq.setOrgId(result.getData().getUserId()); + mq.setOrgType("staff"); + mq.setType("staff_create"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + } + //2021-10-18 end + + return result; + } + /** * 人员编辑 * @@ -260,6 +310,30 @@ public class CustomerStaffController { return result; } + /** + * 人员编辑 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("editstaffaccount") + public Result editStaffByAccount(@RequestBody StaffSubmitAccountFromDTO fromDTO){ + Result result = customerStaffService.editStaffByAccount(fromDTO); + + //2021-10-18 推送mq,数据同步到中介库 start + if (result.success()) { + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(fromDTO.getCustomerId()); + mq.setOrgId(fromDTO.getStaffId()); + mq.setOrgType("staff"); + mq.setType("staff_change"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + } + //2021-10-18 end + + return result; + } + /** * 人员详情 * @@ -366,6 +440,17 @@ public class CustomerStaffController { return new Result>().ok(customerStaffService.getCustsomerStaffByIdAndPhone(formDTO)); } + /** + * @param formDTO + * @return + * @Author zhy + * @Description 根据客户ID、账户查询政府端工作人员基本信息,校验用户是否存在 + **/ + @GetMapping(value = "getCustsomerStaffByIdAndAccount") + public Result> getCustsomerStaffByIdAndAccount(@RequestBody ThirdCustomerStaffByAccountFormDTO formDTO) { + return new Result>().ok(customerStaffService.getCustsomerStaffByIdAndAccount(formDTO)); + } + /** * @Description 查询工作人员的信息 * @param formDTO diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java index e2e046a047..3ebd6d4f84 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java @@ -15,13 +15,13 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcEpidemicSpecialAttentionDTO; +import com.epmet.dto.SysDictDataDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.ImportTaskCommonResultDTO; +import com.epmet.dto.result.NatPieResultDTO; import com.epmet.dto.result.VaccinationListResultDTO; -import com.epmet.excel.NatExportExcel; -import com.epmet.excel.NatImportExcel; -import com.epmet.excel.VaccinationExportExcel; -import com.epmet.excel.VaccinationImportExcel; +import com.epmet.excel.*; +import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.IcEpidemicSpecialAttentionService; import lombok.extern.slf4j.Slf4j; @@ -34,7 +34,9 @@ import javax.servlet.http.HttpServletResponse; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** @@ -52,6 +54,8 @@ public class IcEpidemicSpecialAttentionController { private IcEpidemicSpecialAttentionService icEpidemicSpecialAttentionService; @Autowired private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + @Autowired + private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient; /** * Desc: 【疫苗接种关注名单,疫苗接种关注名单】列表 @@ -68,6 +72,15 @@ public class IcEpidemicSpecialAttentionController { return new Result().ok(icEpidemicSpecialAttentionService.vaccinationList(formDTO)); } + @PostMapping("historyList") + @MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) + public Result historyList(@RequestBody VaccinationListFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class, VaccinationListFormDTO.VaccinationListForm.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result().ok(icEpidemicSpecialAttentionService.historyList(formDTO)); + } + /** * Desc: 【疫苗接种关注名单,疫苗接种关注名单】详情 * @param formDTO @@ -185,12 +198,24 @@ public class IcEpidemicSpecialAttentionController { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); formDTO.setIsPage(false); - PageData pageData = icEpidemicSpecialAttentionService.vaccinationList(formDTO); - // 关注类型,核酸检测:2,疫苗接种:1,行程上报:0 + PageData pageData = icEpidemicSpecialAttentionService.vaccinationList(formDTO); + // 关注类型,核酸检测:2,疫苗接种:1,行程上报:0,历史核酸检测关注:99 if (formDTO.getAttentionType().equals(NumConstant.ONE)){ ExcelUtils.exportExcelToTarget(response, null, pageData.getList(), VaccinationExportExcel.class); }else { - ExcelUtils.exportExcelToTarget(response, null, pageData.getList(), NatExportExcel.class); + Result> isolatedState = epmetAdminOpenFeignClient.dictDataList("isolatedState"); + if (!isolatedState.success()){ + throw new EpmetException("查询字典表数据失败..."+"isolatedState"); + } + Map dictMap = isolatedState.getData().stream().collect(Collectors.toMap(SysDictDataDTO::getDictValue, SysDictDataDTO::getDictLabel)); + pageData.getList().forEach(l -> { + l.setIsolatedState(dictMap.get(l.getIsolatedState())); + }); + if (formDTO.getIsHistory().equals(NumConstant.ONE_STR)){ + ExcelUtils.exportExcelToTarget(response, null, pageData.getList(), NatHistoryExportExcel.class); + }else { + ExcelUtils.exportExcelToTarget(response, null, pageData.getList(), NatExportExcel.class); + } } } @@ -213,4 +238,9 @@ public class IcEpidemicSpecialAttentionController { ExcelPoiUtils.exportExcel(templatePath ,map,fileName,response); } + @PostMapping("pie") + public Result pie(@LoginUser TokenDto tokenDto){ + return new Result().ok(icEpidemicSpecialAttentionService.pie(tokenDto)); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index d24e66db07..c70bf78c83 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -584,9 +584,9 @@ public class IcResiUserController implements ResultDataResolver { @RequestMapping(value = "/exportExcelCustomData") public Map exportExcelCustomData(@LoginUser TokenDto tokenDto, @RequestParam("templateId") String templateId, @RequestBody ExportResiUserFormDTO pageFormDTO) throws Exception { - log.warn("templateId=【"+templateId+"】"); log.warn("pageFormDTO入参【"+JSON.toJSONString(pageFormDTO)+"】"); - pageFormDTO.setTemplateId(templateId); + // pageFormDTO.setTemplateId(templateId); + pageFormDTO.setTemplateId(tokenDto.getCustomerId().concat("_").concat(templateId)); if (null == pageFormDTO.getSearchForm()) { IcResiUserPageFormDTO searchForm = new IcResiUserPageFormDTO(); searchForm.setFormCode("resi_base_info"); @@ -613,7 +613,8 @@ public class IcResiUserController implements ResultDataResolver { pageFormDTO.setExportConfig(exportTemplateSaveFormDTO); } //固定通用客户Id - pageFormDTO.setCustomerId("jmreport_resi_default"); + // pageFormDTO.setCustomerId("jmreport_resi_default"); + pageFormDTO.setCustomerId(tokenDto.getCustomerId()); Page> maps = icResiUserExportService.exportIcResiUser(tokenDto, pageFormDTO, null, true); Map result = new HashMap<>(); result.put("total",maps.getPages()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index b34065223f..1c127d7aa5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java @@ -45,6 +45,8 @@ public interface CustomerStaffDao extends BaseDao { **/ List selectListCustomerStaffDTO(String mobile); + List listCustomerStaffByAccount(@Param("userAccount") String userAccount); + /** * @param formDTO * @return com.epmet.dto.CustomerStaffDTO @@ -54,6 +56,15 @@ public interface CustomerStaffDao extends BaseDao { **/ CustomerStaffDTO selectListCustomerStaffInfo(CustomerStaffFormDTO formDTO); + /** + * @param formDTO + * @return com.epmet.dto.CustomerStaffDTO + * @Author zhy + * @Description 根据账户+客户id获取工作人员基本信息 + * @Date 2020/4/20 14:08 + **/ + CustomerStaffDTO selectListCustomerStaffInfoByAccount(CustomerStaffByAccountFormDTO formDTO); + CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO); /** @@ -147,6 +158,14 @@ public interface CustomerStaffDao extends BaseDao { **/ List selectStaff(ThirdCustomerStaffFormDTO formDTO); + /** + * @param formDTO + * @return + * @Author zhy + * @Description 根据客户ID、账户查询政府端工作人员基本信息 + **/ + List selectStaffByAccount(ThirdCustomerStaffByAccountFormDTO formDTO); + /** * @Description 查询工作人员的信息 * @param userIds diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java index 0fb3e579d1..d57e5b7f94 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java @@ -3,6 +3,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.AttentionDetailFormDTO; import com.epmet.dto.form.VaccinationListFormDTO; +import com.epmet.dto.result.NatPieResultDTO; import com.epmet.dto.result.VaccinationListResultDTO; import com.epmet.entity.IcEpidemicSpecialAttentionEntity; import org.apache.ibatis.annotations.Mapper; @@ -51,6 +52,8 @@ public interface IcEpidemicSpecialAttentionDao extends BaseDao list,@Param("attentionType")Integer attentionType); + void addAttention(@Param("list")List list,@Param("attentionType")Integer attentionType); + void addExistAttention(@Param("list") List list,@Param("attentionType")Integer attentionType); /** * Desc: 查询已经存在的关注 @@ -69,4 +72,8 @@ public interface IcEpidemicSpecialAttentionDao extends BaseDao getIdCardList(@Param("customerId") String customerId,@Param("idCardSet") List idCardSet, @Param("attentionType") Integer attentionType); + + List isolatedList(@Param("agencyId")String agencyId); + + Integer getHistoryCount(@Param("agencyId")String agencyId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerStaffEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerStaffEntity.java index 690bf326c2..aa19464f9e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerStaffEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerStaffEntity.java @@ -42,6 +42,11 @@ public class CustomerStaffEntity extends BaseEpmetEntity { */ private String userId; + /** + * 账户 + */ + private String userAccount; + /** * 真实姓名 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java index 25a853dd55..b4eb253957 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java @@ -43,6 +43,16 @@ public class IcEpidemicSpecialAttentionEntity extends BaseEpmetEntity { */ private Integer isAttention; + /** + * 是否历史关注,1是0否 + */ + private String isHistory; + + /** + * 隔离类型,来自字典表 + */ + private String isolatedState; + /** * 关注类型,核酸检测:2,疫苗接种:1,行程上报:0 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ImportEpidemicSpecialAttention.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ImportEpidemicSpecialAttention.java index 2f690d2d7c..52135be6e5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ImportEpidemicSpecialAttention.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ImportEpidemicSpecialAttention.java @@ -45,6 +45,9 @@ public class ImportEpidemicSpecialAttention extends ExcelVerifyInfo { @Excel(name = "备注") private String remark; + @Excel(name = "隔离状态") + private String isolatedState; + @ExcelIgnore private Integer attentionType; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatExportExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatExportExcel.java index cc3d827af0..fd404ca278 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatExportExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatExportExcel.java @@ -29,7 +29,10 @@ public class NatExportExcel { @Excel(name = "关注原因",width = 40) private String reason; - @Excel(name = "最近一次通知时间",width = 20) - private String lastInformTime; + @Excel(name = "最后一次核酸时间",width = 20) + private String lastNatTime; + + @Excel(name = "隔离状态",width = 20) + private String isolatedState; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatHistoryExportExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatHistoryExportExcel.java new file mode 100644 index 0000000000..74bbd41676 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatHistoryExportExcel.java @@ -0,0 +1,40 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + * @Author zxc + * @DateTime 2022/3/29 10:24 + * @DESC + */ +@Data +public class NatHistoryExportExcel { + + @Excel(name = "排序",width = 10) + private Integer sort; + + @Excel(name = "姓名",width = 20) + private String name; + + @Excel(name = "电话",width = 20) + private String mobile; + @Excel(name = "所属房屋",width = 20) + private String allName; + + @Excel(name = "身份证",width = 30) + private String idCard; + + @Excel(name = "备注",width = 40) + private String remark; + + @Excel(name = "关注原因",width = 40) + private String reason; + + @Excel(name = "最后一次核酸时间",width = 20) + private String lastNatTime; + + @Excel(name = "隔离状态",width = 20) + private String isolatedState; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java index f6ca859101..b2a3442172 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java @@ -105,6 +105,15 @@ public interface CustomerStaffService extends BaseService { **/ Result> getCustsomerStaffByPhone(String mobile); + /** + * @param account 账户 + * @return com.epmet.commons.tools.utils.Result + * @Author zhy + * @Description 根据账户查询政府端工作人员基本信息,校验用户是否存在 + * @Date 2020/4/18 14:07 + **/ + Result> getCustsomerStaffByAccount(String account); + /** * @param formDTO * @return com.epmet.commons.tools.utils.Result @@ -114,6 +123,15 @@ public interface CustomerStaffService extends BaseService { **/ Result getCustomerStaffInfo(CustomerStaffFormDTO formDTO); + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhy + * @Description 根据账户+客户id获取工作人员基本信息 + * @Date 2020/4/20 14:05 + **/ + Result getCustomerStaffInfoByAccount(CustomerStaffByAccountFormDTO formDTO); + /** * 根据用户ID获取工作人员基本信息 * @@ -169,6 +187,15 @@ public interface CustomerStaffService extends BaseService { */ Result addStaff(StaffSubmitFromDTO fromDTO); + /** + * 人员添加 + * + * @param fromDTO 参数 + * @return Result + */ + Result addStaffByAccount(StaffSubmitAccountFromDTO fromDTO); + + /** * 人员编辑 * @@ -177,6 +204,14 @@ public interface CustomerStaffService extends BaseService { */ Result editStaff(StaffSubmitFromDTO fromDTO); + /** + * 人员编辑 + * + * @param fromDTO 参数 + * @return Result + */ + Result editStaffByAccount(StaffSubmitAccountFromDTO fromDTO); + /** * 人员详情 * @@ -259,6 +294,14 @@ public interface CustomerStaffService extends BaseService { **/ List getCustsomerStaffByIdAndPhone(ThirdCustomerStaffFormDTO formDTO); + /** + * @param formDTO + * @return + * @Author zhy + * @Description 根据客户ID、手机号查询政府端工作人员基本信息,校验用户是否存在 + **/ + List getCustsomerStaffByIdAndAccount(ThirdCustomerStaffByAccountFormDTO formDTO); + /** * @Description 查询工作人员的信息 * @param formDTO diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java index 5391f1c1ae..8986660ec2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java @@ -8,6 +8,7 @@ import com.epmet.dto.form.AttentionDetailFormDTO; import com.epmet.dto.form.CancelAttentionPackageFormDTO; import com.epmet.dto.form.VaccinationAddFormDTO; import com.epmet.dto.form.VaccinationListFormDTO; +import com.epmet.dto.result.NatPieResultDTO; import com.epmet.dto.result.VaccinationListResultDTO; import com.epmet.entity.IcEpidemicSpecialAttentionEntity; @@ -90,6 +91,7 @@ public interface IcEpidemicSpecialAttentionService extends BaseService>().ok(customerStaffDTOList); } + @Override + public Result> getCustsomerStaffByAccount(String userAccount) { + //判断用户是否存在 + List customerStaffDTOList = baseDao.listCustomerStaffByAccount(userAccount); + if (null == customerStaffDTOList || customerStaffDTOList.size() == 0) { + logger.warn(String.format("根据账户查询用户异常,账户:[%s],code[%s],msg[%s]", userAccount, EpmetErrorCode.GOV_STAFF_ACCOUNT_NOT_EXISTS.getCode(), EpmetErrorCode.GOV_STAFF_ACCOUNT_NOT_EXISTS.getMsg())); + return new Result().error(EpmetErrorCode.GOV_STAFF_ACCOUNT_NOT_EXISTS.getCode()); + } + return new Result>().ok(customerStaffDTOList); + } @Override public Result getCustomerStaffInfo(CustomerStaffFormDTO formDTO) { @@ -186,6 +196,21 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl().ok(customerStaffDTO); } + @Override + public Result getCustomerStaffInfoByAccount(CustomerStaffByAccountFormDTO formDTO) { + CustomerStaffDTO customerStaffDTO = baseDao.selectListCustomerStaffInfoByAccount(formDTO); + if (null == customerStaffDTO) { + logger.warn(String.format("根据账户查询用户异常,账户:[%s],code[%s],msg[%s]", formDTO.getUserAccount(), EpmetErrorCode.GOV_STAFF_ACCOUNT_NOT_EXISTS.getCode(), EpmetErrorCode.GOV_STAFF_ACCOUNT_NOT_EXISTS.getMsg())); + return new Result().error(EpmetErrorCode.GOV_STAFF_ACCOUNT_NOT_EXISTS.getCode()); + } + //判断用户是否已被禁用 + if (null != customerStaffDTO && UserConstant.DISABLED.equals(customerStaffDTO.getEnableFlag())) { + logger.warn(String.format("根据账户查询用户异常,账户:[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getUserAccount(), formDTO.getCustomerId(), EpmetErrorCode.GOV_STAFF_DISABLED.getCode(), EpmetErrorCode.GOV_STAFF_DISABLED.getMsg())); + return new Result().error(EpmetErrorCode.GOV_STAFF_DISABLED.getCode()); + } + return new Result().ok(customerStaffDTO); + } + @Override public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { CustomerStaffDTO customerStaffDTO = baseDao.selectStaffInfoByUserId(formDTO); @@ -265,11 +290,16 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl().ok(ConvertUtils.sourceToTarget(staffEntity, CustomerStaffDTO.class)); } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result addStaffByAccount(StaffSubmitAccountFromDTO fromDTO) { + CustomerStaffFormDTO customerStaffFormDTO = new CustomerStaffFormDTO(); + customerStaffFormDTO.setCustomerId(fromDTO.getCustomerId()); + customerStaffFormDTO.setMobile(fromDTO.getMobile()); + CustomerStaffDTO customerStaffDTO = baseDao.selectListCustomerStaffInfo(customerStaffFormDTO); + if (null != customerStaffDTO) { + return new Result().error(EpmetErrorCode.MOBILE_USED.getCode(), EpmetErrorCode.MOBILE_USED.getMsg()); + } + CustomerStaffByAccountFormDTO customerStaffAccountFormDTO = new CustomerStaffByAccountFormDTO(); + customerStaffAccountFormDTO.setCustomerId(fromDTO.getCustomerId()); + customerStaffAccountFormDTO.setUserAccount(fromDTO.getUserAccount()); + customerStaffDTO = baseDao.selectListCustomerStaffInfoByAccount(customerStaffAccountFormDTO); + if (null != customerStaffDTO) { + return new Result().error(EpmetErrorCode.ACCOUNT_USED.getCode(), EpmetErrorCode.ACCOUNT_USED.getMsg()); + } + //USER表插入数据 + UserEntity userEntity = new UserEntity(); + userEntity.setFromApp(fromDTO.getApp()); + userEntity.setFromClient(fromDTO.getClient()); + userEntity.setCustomerId(fromDTO.getCustomerId()); + userService.insert(userEntity); + //Customer_Staff表插入数据 + CustomerStaffEntity staffEntity = new CustomerStaffEntity(); + staffEntity.setCustomerId(fromDTO.getCustomerId()); + staffEntity.setUserId(userEntity.getId()); + staffEntity.setUserAccount(fromDTO.getUserAccount()); + staffEntity.setRealName(fromDTO.getName()); + staffEntity.setMobile(fromDTO.getMobile()); + staffEntity.setActiveFlag(CustomerStaffConstant.INACTIVE); + staffEntity.setGender(fromDTO.getGender()); + staffEntity.setWorkType(fromDTO.getWorkType()); + staffEntity.setEnableFlag(CustomerStaffConstant.ENABLE); + staffEntity.setPassword(PasswordUtils.encode(fromDTO.getPwd())); + staffEntity.setIdCard(fromDTO.getIdCard()); + baseDao.insert(staffEntity); + + //工作人员角色关联表 + fromDTO.getRoles().forEach(role -> { + StaffRoleEntity staffRoleEntity = new StaffRoleEntity(); + staffRoleEntity.setStaffId(userEntity.getId()); + staffRoleEntity.setRoleId(role); + staffRoleEntity.setOrgId(fromDTO.getAgencyId()); + staffRoleEntity.setCustomerId(fromDTO.getCustomerId()); + staffRoleService.insert(staffRoleEntity); + }); + + // 角色放缓存 + CustomerAgencyUserRoleDTO dto = new CustomerAgencyUserRoleDTO(); + List roleKeyValue = govStaffRoleDao.selectRoleKeyName(fromDTO.getRoles()); + dto.setCustomerId(fromDTO.getCustomerId()); + dto.setStaffId(userEntity.getId()); + dto.setAgencyId(fromDTO.getAgencyId()); + Map m = new HashMap(16); + roleKeyValue.forEach(r -> { + m.put(r.getRoleKey(), r.getRoleName()); + }); + dto.setRoles(m); + CustomerStaffRedis.delStaffInfoFormCache(dto.getCustomerId(), dto.getStaffId()); + + return new Result().ok(ConvertUtils.sourceToTarget(staffEntity, CustomerStaffDTO.class)); + } + @Override @Transactional(rollbackFor = Exception.class) public Result editStaff(StaffSubmitFromDTO fromDTO) { @@ -437,11 +532,99 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl().error(EpmetErrorCode.MOBILE_USED.getCode(), EpmetErrorCode.MOBILE_USED.getMsg()); + } + CustomerStaffByAccountFormDTO customerStaffAccountFormDTO = new CustomerStaffByAccountFormDTO(); + customerStaffAccountFormDTO.setCustomerId(fromDTO.getCustomerId()); + customerStaffAccountFormDTO.setUserAccount(fromDTO.getUserAccount()); + customerStaffDTO = baseDao.selectListCustomerStaffInfoByAccount(customerStaffAccountFormDTO); + if (null != customerStaffDTO && !fromDTO.getStaffId().equals(customerStaffDTO.getUserId())) { + return new Result().error(EpmetErrorCode.ACCOUNT_USED.getCode(), EpmetErrorCode.ACCOUNT_USED.getMsg()); + } + CustomerStaffEntity customerStaffEntity = baseDao.selectByUserId(fromDTO.getStaffId()); + //Customer_Staff表插入数据 + CustomerStaffEntity staffEntity = new CustomerStaffEntity(); + staffEntity.setId(customerStaffEntity.getId()); + staffEntity.setRealName(fromDTO.getName()); + staffEntity.setMobile(fromDTO.getMobile()); + staffEntity.setGender(fromDTO.getGender()); + staffEntity.setUserAccount(fromDTO.getUserAccount()); + staffEntity.setWorkType(fromDTO.getWorkType()); + if (StringUtils.isNotBlank(fromDTO.getPwd())){ + staffEntity.setPassword(PasswordUtils.encode(fromDTO.getPwd())); + } + staffEntity.setIdCard(fromDTO.getIdCard()); + baseDao.updateById(staffEntity); + + //清空权限关联 + StaffRoleDTO staffRoleDTO = new StaffRoleDTO(); + staffRoleDTO.setStaffId(fromDTO.getStaffId()); + staffRoleDTO.setOrgId(fromDTO.getAgencyId()); + staffRoleService.clearStaffRoles(staffRoleDTO); + //重新添加角色关联 + fromDTO.getRoles().forEach(role -> { + StaffRoleEntity staffRoleEntity = new StaffRoleEntity(); + staffRoleEntity.setStaffId(fromDTO.getStaffId()); + staffRoleEntity.setRoleId(role); + staffRoleEntity.setOrgId(fromDTO.getAgencyId()); + staffRoleService.insert(staffRoleEntity); + }); + + // 重新查询用户的角色列表(可以取到前端没有传过来的角色,例如根管理员) + List staffRoleEntytiesByStaffIdAndOrgId = staffRoleService.getStaffRoleEntytiesByStaffIdAndOrgId(fromDTO.getAgencyId(), fromDTO.getStaffId()); + List roleIds = new ArrayList<>(); + if (!CollectionUtils.isEmpty(staffRoleEntytiesByStaffIdAndOrgId)) { + roleIds = staffRoleEntytiesByStaffIdAndOrgId.stream().map(sr -> sr.getRoleId()).collect(Collectors.toList()); + } + + // redis缓存角色修改 + UpdateCachedRolesFormDTO updateRolesForm = new UpdateCachedRolesFormDTO(); + updateRolesForm.setOrgId(fromDTO.getAgencyId()); + updateRolesForm.setStaffId(fromDTO.getStaffId()); + updateRolesForm.setRoleIds(roleIds); + try { + Result result = authFeignClient.updateCachedRoles(updateRolesForm); + if (!result.success()) { + logger.error("修改用户信息:修改用户已缓存的角色列表失败:{}", result.getInternalMsg()); + } + logger.info("修改用户信息:修改用户已缓存的角色列表成功"); + } catch (Exception e) { + log.error("method exception", e); + logger.error("修改用户信息:修改用户已缓存的角色列表异常:{}", ExceptionUtils.getErrorStackTrace(e)); + } + + // 角色放缓存 + CustomerAgencyUserRoleDTO dto = new CustomerAgencyUserRoleDTO(); + List roleKeyValue = govStaffRoleDao.selectRoleKeyName(fromDTO.getRoles()); + dto.setCustomerId(fromDTO.getCustomerId()); + dto.setStaffId(fromDTO.getStaffId()); + dto.setAgencyId(fromDTO.getAgencyId()); + Map m = new HashMap(16); + roleKeyValue.forEach(r -> { + m.put(r.getRoleKey(), r.getRoleName()); + }); + dto.setRoles(m); + CustomerStaffRedis.delStaffInfoFormCache(dto.getCustomerId(), dto.getStaffId()); + + return new Result(); + } + @Override public Result getStaffDetail(StaffInfoFromDTO fromDTO) { StaffDetailResultDTO resultDTO = new StaffDetailResultDTO(); //获取工作人员信息 CustomerStaffDTO customerStaffDTO = baseDao.selectStaffInfo(fromDTO); + if (StringUtils.isBlank(customerStaffDTO.getHeadPhoto())) { + customerStaffDTO.setHeadPhoto(""); + } resultDTO.setStaffId(customerStaffDTO.getUserId()); resultDTO.setName(customerStaffDTO.getRealName()); resultDTO.setMobile(customerStaffDTO.getMobile()); @@ -604,6 +787,19 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl getCustsomerStaffByIdAndAccount(ThirdCustomerStaffByAccountFormDTO formDTO) { + //根据客户Id和手机号查询工作人员信息 + List customerStaffDTOList = baseDao.selectStaffByAccount(formDTO); + if (null == customerStaffDTOList || customerStaffDTOList.size() < NumConstant.ONE) { + logger.warn(String.format("根据客户Id和账户查询用户异常,客户Id:[%s],账户:[%s],code[%s],msg[%s]", + formDTO.getCustomerId(), formDTO.getUserAccount(), EpmetErrorCode.GOV_STAFF_ACCOUNT_NOT_EXISTS.getCode(), + EpmetErrorCode.GOV_STAFF_ACCOUNT_NOT_EXISTS.getMsg())); + throw new RenException(EpmetErrorCode.GOV_STAFF_ACCOUNT_NOT_EXISTS.getCode()); + } + return customerStaffDTOList; + } + /** * @param formDTO * @Description 查询工作人员的信息 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcBirthRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcBirthRecordServiceImpl.java index 37a65965d7..dc737eed05 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcBirthRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcBirthRecordServiceImpl.java @@ -5,14 +5,15 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; -import com.epmet.commons.tools.enums.GenderEnum; -import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum; -import com.epmet.commons.tools.enums.IdCardTypeEnum; -import com.epmet.commons.tools.enums.RelationshipEnum; +import com.epmet.commons.tools.enums.*; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; +import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.IdCardRegexUtils; @@ -29,6 +30,7 @@ import com.epmet.dto.result.HouseInfoDTO; import com.epmet.dto.result.SyncResiResDTO; import com.epmet.entity.IcBirthRecordEntity; import com.epmet.entity.IcResiUserEntity; +import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.ChangeWelfareService; import com.epmet.service.IcBirthRecordService; @@ -37,6 +39,7 @@ import com.epmet.service.IcUserTransferRecordService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import org.springframework.stereotype.Service; @@ -65,6 +68,8 @@ public class IcBirthRecordServiceImpl extends BaseServiceImpl page(BirthRecordFormDTO formDTO) { @@ -118,7 +123,24 @@ public class IcBirthRecordServiceImpl extends BaseServiceImpl> relationshipRes = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.RELATIONSHIP.getCode()); + if (relationshipRes.success() && MapUtils.isNotEmpty(relationshipRes.getData())) { + String householderRelationName = relationshipRes.getData().containsKey(recordDTO.getHouseholderRelation()) ? relationshipRes.getData().get(recordDTO.getHouseholderRelation()) : StrConstant.EPMETY_STR; + recordDTO.setHouseholderRelationName(householderRelationName); + } + return recordDTO; } @Override diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java index 0258f583ad..25a3a82403 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java @@ -15,6 +15,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ExcelPoiUtils; @@ -22,14 +23,18 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.IcEpidemicSpecialAttentionDao; import com.epmet.dto.IcEpidemicSpecialAttentionDTO; +import com.epmet.dto.SysDictDataDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.HouseInfoDTO; +import com.epmet.dto.result.NatPieResultDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.dto.result.VaccinationListResultDTO; import com.epmet.entity.IcEpidemicSpecialAttentionEntity; import com.epmet.enums.ChannelEnum; +import com.epmet.enums.NatPieColorEnum; import com.epmet.excel.ImportEpidemicSpecialAttention; import com.epmet.excel.error.EpidemicSpecialAttentionErrorModel; +import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.OssFeignClient; @@ -76,6 +81,8 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl page(Map params) { @@ -155,6 +162,9 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.natList(formDTO)); result.setList(pageInfo.getList()); @@ -164,6 +174,65 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl { + if (StringUtils.isNotBlank(r.getGridId())){ + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(r.getGridId()); + if (null == gridInfo){ + throw new EpmetException("查询网格失败:"+r.getGridId()); + } + r.setGridName(gridInfo.getGridNamePath()); + } + }); + } + } + if (CollectionUtils.isNotEmpty(result.getList())){ + result.getList().forEach(v -> { + v.setSex(); + }); + } + //需求调整 列表和导出增加所属房屋(小区+楼栋+单元+房间)一列值 sun + Map houseInfoMap = new HashMap<>(); + //查询房屋信息 + if (result.getList().size() > NumConstant.ZERO) { + Set houseIds = result.getList().stream().filter(l -> StringUtils.isNotBlank(l.getHomeId())).map(m -> m.getHomeId()).collect(Collectors.toSet()); + Result> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, formDTO.getCustomerId()); + List houseInfoDTOList = houseInfoRes.success() && !CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>(); + houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); + } + + int i = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + for (VaccinationListResultDTO v : result.getList()) { + i += 1; + v.setSort(i); + if (null != houseInfoMap && houseInfoMap.containsKey(v.getHomeId())) { + v.setVillageName(houseInfoMap.get(v.getHomeId()).getNeighborHoodName()); + v.setBuildName(houseInfoMap.get(v.getHomeId()).getBuildingName()); + v.setUnitName(houseInfoMap.get(v.getHomeId()).getUnitName()); + v.setHomeName(houseInfoMap.get(v.getHomeId()).getDoorName()); + v.setAllName(houseInfoMap.get(v.getHomeId()).getAllName()); + } + } + return result; + } + + @Override + public PageData historyList(VaccinationListFormDTO formDTO) { + PageData result = new PageData(new ArrayList(), NumConstant.ZERO_L); + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo){ + throw new EpmetException("未查询到工作人员信息"+formDTO.getUserId()); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setIsHistory(NumConstant.ONE_STR); + if (formDTO.getIsPage()){ + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.natList(formDTO)); + result.setList(pageInfo.getList()); + result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal()))); + }else { + List list = baseDao.natList(formDTO); + result.setList(list); + result.setTotal(list.size()); } if (CollectionUtils.isNotEmpty(result.getList())){ result.getList().forEach(v -> { @@ -212,19 +281,26 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl entities = ConvertUtils.sourceToTarget(formDTO.getList(), IcEpidemicSpecialAttentionEntity.class); List idCards = entities.stream().map(m -> m.getIdCard()).collect(Collectors.toList()); Integer attentionType = entities.get(NumConstant.ZERO).getAttentionType(); List existList = baseDao.getExistList(attentionType, idCards); + List existsEntities = new ArrayList<>(); if (CollectionUtils.isNotEmpty(existList)){ for (String s : existList) { for (int i = NumConstant.ZERO; i < entities.size(); i++) { if (s.equals(entities.get(i).getIdCard())){ + existsEntities.add(entities.get(i)); entities.remove(i); continue; } } } + baseDao.addExistAttention(existsEntities,attentionType); } entities.forEach(e -> { e.setIsAttention(NumConstant.ONE); @@ -232,9 +308,7 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl w = new LambdaQueryWrapper<>(); IcEpidemicSpecialAttentionEntity e = new IcEpidemicSpecialAttentionEntity(); - w.eq(IcEpidemicSpecialAttentionEntity::getIdCard,formDTO.getIdCard()) + w.eq(IcEpidemicSpecialAttentionEntity::getId,formDTO.getId()) .eq(IcEpidemicSpecialAttentionEntity::getAttentionType,formDTO.getAttentionType()); e.setMobile(formDTO.getMobile()); e.setReason(formDTO.getReason()); e.setRemark(formDTO.getRemark()); + e.setIsolatedState(formDTO.getIsolatedState()); update(e,w); if (CollectionUtils.isNotEmpty(formDTO.getChannel())){ SendNoticeFormDTO dto = new SendNoticeFormDTO(); @@ -311,7 +386,6 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl errorInfo = new ArrayList<>(); - try { List list = ExcelPoiUtils.importExcel(inputStream, 0,1,ImportEpidemicSpecialAttention.class); if (CollectionUtils.isEmpty(list)){ @@ -336,7 +410,7 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl> isolatedState = epmetAdminOpenFeignClient.dictDataList("isolatedState"); + if (!isolatedState.success()){ + throw new EpmetException("查询字典表数据失败..."+"isolatedState"); + } + Map dictMap = isolatedState.getData().stream().collect(Collectors.toMap(SysDictDataDTO::getDictLabel, SysDictDataDTO::getDictValue)); if (list.size() > errorInfo.size()){ - Map groupByIdCard = list.stream().collect(Collectors.groupingBy(ImportEpidemicSpecialAttention::getIdCard, Collectors.counting())); + Map groupByIdCard = list.stream().filter(l -> StringUtils.isNotBlank(l.getIdCard())).collect(Collectors.groupingBy(ImportEpidemicSpecialAttention::getIdCard, Collectors.counting())); groupByIdCard.forEach((idCard,count) -> { if (Integer.valueOf(count.toString()).compareTo(1) != 0){ for (ImportEpidemicSpecialAttention i : list) { @@ -359,6 +443,7 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl idCards = list.stream().map(m -> m.getIdCard()).collect(Collectors.toList()); + List existsEntities = new ArrayList<>(); List existList = baseDao.getExistList(attentionType, idCards); if (CollectionUtils.isNotEmpty(existList)){ for (String s : existList) { @@ -367,10 +452,17 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl> groupByStatus = list.stream().collect(Collectors.groupingBy(ImportEpidemicSpecialAttention::getAddStatus)); @@ -378,6 +470,9 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl entities = ConvertUtils.sourceToTarget(needInsert, IcEpidemicSpecialAttentionEntity.class); entities.forEach(e -> { + if (attentionType.compareTo(NumConstant.TWO) == NumConstant.ZERO){ + e.setIsolatedState(dictMap.get(e.getIsolatedState())); + } e.setIsAttention(NumConstant.ONE); e.setOrgId(agencyInfo.getId()); e.setPid(agencyInfo.getPid()); @@ -482,6 +577,41 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl> isolatedState = epmetAdminOpenFeignClient.dictDataList("isolatedState"); + if (!isolatedState.success()){ + throw new EpmetException("查询字典表数据失败..."+"isolatedState"); + } + List data = isolatedState.getData(); + if (CollectionUtils.isEmpty(data)){ + return result; + } + List conResult = new ArrayList<>(); + data.forEach(d -> { + NatPieResultDTO.IsolatedList dto = new NatPieResultDTO.IsolatedList(); + dto.setCategoryCode(d.getDictValue()); + dto.setCategoryName(d.getDictLabel()); + dto.setColor(NatPieColorEnum.getValueByKey(d.getDictValue())); + conResult.add(dto); + }); + List isolatedLists = baseDao.isolatedList(staffInfo.getAgencyId()); + conResult.forEach(c -> isolatedLists.stream().filter(i -> i.getCategoryCode().equals(c.getCategoryCode())).forEach(i -> c.setTotal(i.getTotal()))); + NatPieResultDTO.IsolatedList dto = new NatPieResultDTO.IsolatedList(); + dto.setCategoryCode(""); + dto.setCategoryName("历史关注人数"); + dto.setColor(NatPieColorEnum.getValueByKey(NumConstant.ONE_HUNDRED_STR)); + dto.setTotal(baseDao.getHistoryCount(staffInfo.getAgencyId())); + result.setIsolatedList(conResult); + result.setHistoryList(Arrays.asList(dto)); + return result; + } + /** * Desc: 文件上传并返回url * @param errorRows diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java index ce8441c1a1..599f9e81f8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java @@ -189,16 +189,21 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl { - if (StringUtils.isNotBlank(item.getFaceImg())) { - VisitVisitorFormDTO visitor = new VisitVisitorFormDTO(); - visitor.setIdCard(item.getIdNum()); - visitor.setMobile(item.getMobile()); - visitor.setName(item.getName()); - visitor.setFaceImg(item.getFaceImg()); - dhDeviceUtil.sendAuth(visitor); - } - }); + try { + formDTO.getMemberList().forEach(item -> { + if (StringUtils.isNotBlank(item.getFaceImg())) { + VisitVisitorFormDTO visitor = new VisitVisitorFormDTO(); + visitor.setIdCard(item.getIdNum()); + visitor.setMobile(item.getMobile()); + visitor.setName(item.getName()); + visitor.setFaceImg(item.getFaceImg()); + dhDeviceUtil.sendAuth(visitor); + } + }); + return new Result().ok("今日您可通过人脸设备便捷出入小区,明天及后续进入请再次登记,谢谢!"); + } catch (Exception e) { + return new Result().ok("访客信息登记成功"); + } } return new Result().ok("提交成功"); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectVisitorServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectVisitorServiceImpl.java index a73d022548..34c56f8928 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectVisitorServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectVisitorServiceImpl.java @@ -165,7 +165,12 @@ public class IcResiCollectVisitorServiceImpl extends BaseServiceImpl> listResult = govOrgOpenFeignClient.selectHouseInfoByIdCard(personData.getIdCard(), formDTO.getCustomerId()); + //2022.9.14 应产品要求之前返的是这个人是房东的房屋信息,现在改成返回这个人当前居住的房屋信息 syc + /*Result> listResult = govOrgOpenFeignClient.selectHouseInfoByIdCard(personData.getIdCard(), formDTO.getCustomerId()); if (!listResult.success()) { throw new RenException("查询房屋信息失败"); } personData.setHouseInfo(listResult.getData()); + */ + Set houseIds = new HashSet<>(); + houseIds.add(personData.getHomeId()); + Result> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, formDTO.getCustomerId()); + if (!houseInfoRes.success()) { + throw new RenException("查询房屋信息失败"); + } + List houseInfo = new ArrayList<>(); + if(null!=houseInfoRes.getData()&& !CollectionUtils.isEmpty(houseInfoRes.getData())){ + houseInfo.add(houseInfoRes.getData().get(0).getAllName()); + } + //2022.9.14 end + personData.setHouseInfo(houseInfo); // 志愿者处理 if (personData.getIsVolunteer().equals(NumConstant.ONE_STR)) { diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.62__alter_customer_staff.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.62__alter_customer_staff.sql new file mode 100644 index 0000000000..c8a15854eb --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.62__alter_customer_staff.sql @@ -0,0 +1,2 @@ +ALTER TABLE epmet_user.customer_staff ADD USER_ACCOUNT varchar(32) NULL COMMENT '登录账户'; +ALTER TABLE epmet_user.customer_staff CHANGE USER_ACCOUNT USER_ACCOUNT varchar(32) NULL COMMENT '登录账户' AFTER USER_ID; diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.69__alter_ic_epidemic_special_attention.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.69__alter_ic_epidemic_special_attention.sql new file mode 100644 index 0000000000..24111f66ce --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.69__alter_ic_epidemic_special_attention.sql @@ -0,0 +1,3 @@ +ALTER TABLE ic_epidemic_special_attention ADD COLUMN IS_HISTORY tinyint not null DEFAULT '0' COMMENT '是否历史关注,1是0否' AFTER ATTENTION_TYPE; + +ALTER TABLE ic_epidemic_special_attention ADD COLUMN ISOLATED_STATE VARCHAR(20) COMMENT '隔离类型,来自字典表' AFTER IS_HISTORY; diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.70__default_ic_epidemic_special_attention.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.70__default_ic_epidemic_special_attention.sql new file mode 100644 index 0000000000..99e215885a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.70__default_ic_epidemic_special_attention.sql @@ -0,0 +1,5 @@ +UPDATE ic_epidemic_special_attention +SET UPDATED_TIME = NOW(), + ISOLATED_STATE = '1' +WHERE ISOLATED_STATE IS NULL + AND ATTENTION_TYPE = 2; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/attention_nat_template.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/attention_nat_template.xlsx index e41ebaf0a7..de79811f24 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/attention_nat_template.xlsx and b/epmet-user/epmet-user-server/src/main/resources/excel/attention_nat_template.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls index 88b2dcd8e1..f93667a3bd 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls differ diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index 5250d48a0a..60b32c4d32 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -11,6 +11,14 @@ order by cs.ACTIVE_TIME desc,cs.CREATED_TIME asc + + + + + + + + SELECT a.id, @@ -75,6 +123,7 @@ + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index fe17400279..caba921430 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -300,6 +300,7 @@ + @@ -316,7 +317,8 @@ IS_TENANT as isTenant, IFNULL(IS_VOLUNTEER,'0') AS isVolunteer, CUSTOMER_ID, - GRID_ID + GRID_ID, + HOME_ID FROM ic_resi_user WHERE DEL_FLAG = '0' AND ID = #{userId} @@ -372,7 +374,7 @@ and ${columnName}='1' AND `STATUS`='0' - ORDER BY `NAME` + ORDER BY `CREATED_TIME` DESC, `NAME`