Commit b2086a28 authored by 曹盼盼's avatar 曹盼盼

修改登录逻辑

parent a537c28a
......@@ -16,4 +16,7 @@ public interface RegUnitInfoMapper extends BaseMapper<RegUnitInfo> {
List<RegUnitInfo> userData(String phone);
RegUnitInfo userDataINfo(String adminLoginName,String adminLoginPwd);
RegUnitInfo userIdINfo(String userId);
}
......@@ -83,5 +83,44 @@
AND admin_login_pwd=#{adminLoginPwd}
</select>
<select id="userIdINfo" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.entity.RegUnitInfo">
SELECT
sequence_nbr,
name,
unit_code,
unit_code_type,
unit_type,
unit_type_code,
management_unit,
management_unit_id,
region_code,
country,
province,
city,
district,
stree,
community,
address,
longitude,
latitude,
industry_name,
legal_person,
legal_person_tel,
contact_person,
contact_person_tel,
admin_name,
admin_tel,
admin_id_number,
amos_company_seq,
unit_code_type_name,
admin_id_card_photo
FROM tz_flc_reg_unit_info WHERE
admin_user_id=#{userId}
</select>
</mapper>
......@@ -13,11 +13,15 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.tzs.api.service.ITzBaseEnterpriseInfoService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.EquipmentCategoryServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzsAppService;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.RegUnitInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.RegUnitInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.PermissionModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -36,6 +40,7 @@ import java.util.Map;
import java.util.stream.Collectors;
@RestController
@Slf4j
@Api(tags = "tzs小程序接口")
@RequestMapping(value = "/tzs-app")
public class TzsAppController {
......@@ -43,6 +48,9 @@ public class TzsAppController {
@Autowired
TzsAppService appService;
@Autowired
private RegUnitInfoMapper regUnitInfoMapper;
@Autowired
ITzBaseEnterpriseInfoService iTzBaseEnterpriseInfoService;
@Autowired
private EquipmentCategoryServiceImpl equipmentCategoryService;
......@@ -125,4 +133,51 @@ public class TzsAppController {
return app;
}
}
//修改密码
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{userId}/password", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改密码", notes = "修改密码")
public ResponseModel<Boolean> updatePassword( @PathVariable("userId") String userId ,@RequestBody AgencyUserModel AgencyUserModel) {
Boolean result =false;
if ( ValidationUtil.isEmpty(userId) ||
ValidationUtil.isEmpty(AgencyUserModel.getOriginalPassword()) ||
ValidationUtil.isEmpty(AgencyUserModel.getRePassword()) ||
ValidationUtil.isEmpty(AgencyUserModel.getPassword()) ) {
log.error("用户信息不能为空");
return ResponseHelper.buildResponse(result);
}
if (!AgencyUserModel.getRePassword().equals(AgencyUserModel.getPassword())) {
log.error("两次密码不一致");
return ResponseHelper.buildResponse(result);
}
//平台修改
AgencyUserModel.setUserId(userId);
FeignClientResult<AgencyUserModel> agencyUserModelFeignClientResult = Privilege.agencyUserClient.modifyPassword(userId, AgencyUserModel);
if ( agencyUserModelFeignClientResult.getStatus() !=200 ) {
log.error("Privilege远程调用失败");
return ResponseHelper.buildResponse(result);
}
if ( ValidationUtil.isEmpty(agencyUserModelFeignClientResult.getResult()) || ValidationUtil.isEmpty(agencyUserModelFeignClientResult.getResult().getUserId())) {
log.error("平台修改失败");
return ResponseHelper.buildResponse(result);
}
//走业务修改
LambdaQueryWrapper<RegUnitInfo> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
objectLambdaQueryWrapper.eq(RegUnitInfo::getAdminUserId,agencyUserModelFeignClientResult.getResult().getUserId());
RegUnitInfo regUnitInfo = new RegUnitInfo();
regUnitInfo.setAdminLoginPwd(AgencyUserModel.getRePassword());
int update = regUnitInfoMapper.update(regUnitInfo, objectLambdaQueryWrapper);
if (update == 0) {
log.error("业务更新失败");
return ResponseHelper.buildResponse(result);
}
result=true;
return ResponseHelper.buildResponse(result);
}
}
......@@ -348,13 +348,18 @@ public class TzsAppService {
}
if (idpassword.getStatus() != successsCode) {
log.error("调用平台手机号验证码登录失败:{}", idpassword.getDevMessage());
log.error("远程调用Privilege服务失败", idpassword.getDevMessage());
String message = idpassword.getMessage();
if (StringUtils.isEmpty(message)) {
message = "账号已被禁用,请联系管理员";
message = "账号或密码错误";
}
throw new CommonException(600001, message);
}
if (ValidationUtil.isEmpty(idpassword) || ValidationUtil.isEmpty(idpassword.getResult()) ||
ValidationUtil.isEmpty(idpassword.getResult().get("userId"))) {
log.error("未修改成功");
return new HashMap<String, Object>();
}
HashMap<Object, Object> authInfo = new HashMap<>();// 设置authInfo信息
authInfo.put("token", idpassword.getResult().get("token"));
......@@ -363,7 +368,7 @@ public class TzsAppService {
authInfo.put("product", product);
result.put("authInfo", authInfo);
//业务查询
RegUnitInfo userInfo = regUnitInfoMapper.userDataINfo(param.getPhoneNo(),param.getVerifyCode());
RegUnitInfo userInfo = regUnitInfoMapper.userIdINfo(idpassword.getResult().get("userId"));
result.put("userInfo", userInfo);
return result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment