Browse Source

Merge remote-tracking branch 'remotes/origin/dev_fegin_concurrent' into pingyin_master

master
jianjun 3 years ago
parent
commit
ac2a1a3d30
  1. 2
      epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java
  2. 23
      epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgByAccountFormDTO.java
  3. 12
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  4. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  5. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml

2
epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java

@ -110,7 +110,7 @@ public class ThirdLoginController {
**/
@PostMapping(value = "/getmyorgbyaccount")
public Result<List<StaffOrgsResultDTO>> getMyOrgByAccount(@RequestBody ThirdStaffOrgByAccountFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, StaffOrgByAccountFormDTO.AddUserShowGroup.class, StaffOrgByAccountFormDTO.GetMyOrgByPassWordGroup.class);
ValidatorUtils.validateEntity(formDTO);
List<StaffOrgsResultDTO> staffOrgs = thirdLoginService.getMyOrgByAccount(formDTO);
return new Result<List<StaffOrgsResultDTO>>().ok(staffOrgs);
}

23
epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgByAccountFormDTO.java

@ -1,6 +1,5 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@ -13,36 +12,20 @@ import java.io.Serializable;
@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})
@NotBlank(message = "appId不能为空")
private String appId;
/**
* 手机号
*/
@NotBlank(message = "账号不能为空", groups = {AddUserShowGroup.class})
@NotBlank(message = "账号不能为空")
private String userAccount;
/**
* 验证码
*/
@NotBlank(message="验证码不能为空", groups = {GetMyOrgByLoginWxmp.class})
private String smsCode;
@NotBlank(message = "密码不能为空",groups ={GetMyOrgByPassWordGroup.class})
@NotBlank(message = "密码不能为空")
private String password;
}

12
epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

@ -14,6 +14,8 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.password.PasswordUtils;
@ -73,6 +75,8 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
private EpmetMessageOpenFeignClient messageOpenFeignClient;
@Autowired
private LoginUserUtil loginUserUtil;
@Autowired
private RedisUtils redisUtils;
/**
* @param formDTO
@ -669,6 +673,11 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
* @author zxc
*/
public PaCustomerDTO getCustomerInfo(String appId){
String redisKey = RedisKeys.getThirdCustomerInfoByAppId(appId);
PaCustomerDTO customer = (PaCustomerDTO) redisUtils.get(redisKey);
if (customer != null && StringUtils.isNotBlank(customer.getId())){
return customer;
}
JSONObject jsonObject = new JSONObject();
String data = HttpClientManager.getInstance().sendPostByJSON(AuthHttpUrlConstant.CUSTOMER_MSG_URL + appId, JSON.toJSONString(jsonObject)).getData();
logger.info("ThirdLoginServiceImpl.getCustomerInfo:httpclient->url:"+AuthHttpUrlConstant.CUSTOMER_MSG_URL+",结果->"+data);
@ -684,8 +693,9 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
Object PublicCustomerResultDTO = mapToResult.getData();
JSONObject json = JSON.parseObject(PublicCustomerResultDTO.toString());
Map<String,Object> map = (Map)json.get("customer");
PaCustomerDTO customer = ConvertUtils.mapToEntity(map, PaCustomerDTO.class);
customer = ConvertUtils.mapToEntity(map, PaCustomerDTO.class);
logger.info("小程序登陆third服务获取客户用户信息PaCustomerDTO->"+customer);
redisUtils.set(redisKey,customer);
return customer;
}

12
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -871,4 +871,16 @@ public class RedisKeys {
public static String getDhToken() {
return rootPrefix.concat("dh:token");
}
/**
* desc:根据appId 获取 客户信息key
* @param appId
* @return
*/
public static String getThirdCustomerInfoByAppId(String appId) {
if (StringUtils.isBlank(appId)){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误");
}
return rootPrefix.concat("third:customerInfo:appId:")+appId;
}
}

3
epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml

@ -142,6 +142,9 @@
<if test='null != isolatedState and "" != isolatedState'>
AND a.isolated_state = #{isolatedState}
</if>
<if test='null == isolatedState or "" == isolatedState'>
AND a.isolated_state is not null
</if>
<if test='null != isHistory and "" != isHistory and isHistory == "0"'>
AND a.IS_ATTENTION = 1
</if>

Loading…
Cancel
Save