Commit 20620d53 authored by zhangzc's avatar zhangzc

修改账号密码接口

parent c283210c
...@@ -47,4 +47,12 @@ public interface DriverInterface { ...@@ -47,4 +47,12 @@ public interface DriverInterface {
*/ */
@PostMapping(value = "/customer/carrier/driver/edit") @PostMapping(value = "/customer/carrier/driver/edit")
JSONObject edit(JSONObject bodyJson); JSONObject edit(JSONObject bodyJson);
/**
* 更改司机密码
* @param bodyJson
* @return
*/
@PostMapping(value = "/customer/carrier/driver/account/password/reset")
JSONObject resetDriverPwd(JSONObject bodyJson);
} }
...@@ -47,4 +47,12 @@ public interface GoodsOwnerInterface { ...@@ -47,4 +47,12 @@ public interface GoodsOwnerInterface {
*/ */
@PostMapping(value = "/customer/goodsowner/account/edit") @PostMapping(value = "/customer/goodsowner/account/edit")
JSONObject updateAccountInfo(JSONObject bodyJson); JSONObject updateAccountInfo(JSONObject bodyJson);
/**
* 更改货主密码
* @param bodyJson
* @return
*/
@PostMapping(value = "/customer/goodsowner/account/password/reset")
JSONObject resetAccountPwd(JSONObject bodyJson);
} }
...@@ -217,7 +217,8 @@ public class DriverAccountController { ...@@ -217,7 +217,8 @@ public class DriverAccountController {
} }
AccountExistVO vo = new AccountExistVO(); AccountExistVO vo = new AccountExistVO();
vo.setAccountStatus(1); vo.setAccountStatus(result.getJSONObject("data").getInteger("accountStatus"));
vo.setId(result.getJSONObject("data").getLong("id"));
vo.setCarrierId(result.getJSONObject("data").getLong("carrierId")); vo.setCarrierId(result.getJSONObject("data").getLong("carrierId"));
vo.setCarrierName(result.getJSONObject("data").getString("carrierName")); vo.setCarrierName(result.getJSONObject("data").getString("carrierName"));
return EResponse.ok(vo); return EResponse.ok(vo);
...@@ -274,9 +275,7 @@ public class DriverAccountController { ...@@ -274,9 +275,7 @@ public class DriverAccountController {
return EResponse.error(result.getInteger("code"), result.getString("message")); return EResponse.error(result.getInteger("code"), result.getString("message"));
} }
DriverAccountDetailVO detailVO = new DriverAccountDetailVO();
DriverAccountDetailVO detailVO = JSONObject.toJavaObject(FeignUtils.getFeignDataJson(result), DriverAccountDetailVO.class);
/*
detailVO.setId(String.valueOf(result.getJSONObject("data").getLong("id"))); detailVO.setId(String.valueOf(result.getJSONObject("data").getLong("id")));
detailVO.setCarrierId(result.getJSONObject("data").getLong("carrierId")); detailVO.setCarrierId(result.getJSONObject("data").getLong("carrierId"));
detailVO.setCarrierName(result.getJSONObject("data").getString("carrierName")); detailVO.setCarrierName(result.getJSONObject("data").getString("carrierName"));
...@@ -308,7 +307,7 @@ public class DriverAccountController { ...@@ -308,7 +307,7 @@ public class DriverAccountController {
detailVO.setCertificateVehicle(result.getJSONObject("data").getInteger("certificateVehicle")); detailVO.setCertificateVehicle(result.getJSONObject("data").getInteger("certificateVehicle"));
detailVO.setCertificateEndDate(result.getJSONObject("data").getString("certificateEndDate")); detailVO.setCertificateEndDate(result.getJSONObject("data").getString("certificateEndDate"));
detailVO.setCertificateNumber(result.getJSONObject("data").getString("certificateNumber")); detailVO.setCertificateNumber(result.getJSONObject("data").getString("certificateNumber"));
detailVO.setCertificateUrl(result.getJSONObject("data").getString("certificateUrl"));*/ detailVO.setCertificateUrl(result.getJSONObject("data").getString("certificateUrl"));
return EResponse.ok(detailVO); return EResponse.ok(detailVO);
} }
......
...@@ -6,6 +6,7 @@ import com.esv.freight.app.common.response.ECode; ...@@ -6,6 +6,7 @@ import com.esv.freight.app.common.response.ECode;
import com.esv.freight.app.common.response.EResponse; import com.esv.freight.app.common.response.EResponse;
import com.esv.freight.app.common.util.ReqUtils; import com.esv.freight.app.common.util.ReqUtils;
import com.esv.freight.app.common.validator.groups.ValidatorInsert; import com.esv.freight.app.common.validator.groups.ValidatorInsert;
import com.esv.freight.app.common.validator.groups.ValidatorUpdate;
import com.esv.freight.app.feign.CarrierInterface; import com.esv.freight.app.feign.CarrierInterface;
import com.esv.freight.app.feign.DriverInterface; import com.esv.freight.app.feign.DriverInterface;
import com.esv.freight.app.feign.NoticeInterface; import com.esv.freight.app.feign.NoticeInterface;
...@@ -90,7 +91,7 @@ public class DriverPasswordController { ...@@ -90,7 +91,7 @@ public class DriverPasswordController {
reqJson.put("id", id); reqJson.put("id", id);
reqJson.put("password", loginForm.getPwd()); reqJson.put("password", loginForm.getPwd());
log.info(reqJson.toJSONString()); log.info(reqJson.toJSONString());
result = driverInterface.edit(reqJson); result = driverInterface.resetDriverPwd(reqJson);
log.info(result.toJSONString()); log.info(result.toJSONString());
if(result.getInteger("code") != 200) { if(result.getInteger("code") != 200) {
...@@ -108,7 +109,7 @@ public class DriverPasswordController { ...@@ -108,7 +109,7 @@ public class DriverPasswordController {
* createTime 2020/04/14 16:00 * createTime 2020/04/14 16:00
**/ **/
@PostMapping("/edit") @PostMapping("/edit")
public EResponse edit(@RequestBody(required=false) @Validated(ValidatorInsert.class) ModifyPasswordForm modifyPasswordFrom) { public EResponse edit(@RequestBody(required=false) @Validated(ValidatorUpdate.class) ModifyPasswordForm modifyPasswordFrom) {
TokenInfoPojo tokenInfoPojo = tokenComponent.getTokenInfo(); TokenInfoPojo tokenInfoPojo = tokenComponent.getTokenInfo();
String phone = tokenInfoPojo.getAccount(); String phone = tokenInfoPojo.getAccount();
...@@ -136,7 +137,7 @@ public class DriverPasswordController { ...@@ -136,7 +137,7 @@ public class DriverPasswordController {
reqJson.put("id", id); reqJson.put("id", id);
reqJson.put("password", modifyPasswordFrom.getNewPwd()); reqJson.put("password", modifyPasswordFrom.getNewPwd());
log.info(reqJson.toJSONString()); log.info(reqJson.toJSONString());
result = driverInterface.edit(reqJson); result = driverInterface.resetDriverPwd(reqJson);
log.info(result.toJSONString()); log.info(result.toJSONString());
if(result.getInteger("code") != 200) { if(result.getInteger("code") != 200) {
......
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.esv.freight.app.common.component.TokenComponent; import com.esv.freight.app.common.component.TokenComponent;
import com.esv.freight.app.common.response.ECode; import com.esv.freight.app.common.response.ECode;
import com.esv.freight.app.common.util.ReqUtils; import com.esv.freight.app.common.util.ReqUtils;
import com.esv.freight.app.common.validator.groups.ValidatorUpdate;
import com.esv.freight.app.feign.GoodsOwnerInterface; import com.esv.freight.app.feign.GoodsOwnerInterface;
import com.esv.freight.app.feign.NoticeInterface; import com.esv.freight.app.feign.NoticeInterface;
import com.esv.freight.app.module.account.form.LoginForm; import com.esv.freight.app.module.account.form.LoginForm;
...@@ -88,9 +89,8 @@ public class OwnerPasswordController { ...@@ -88,9 +89,8 @@ public class OwnerPasswordController {
reqJson.clear(); reqJson.clear();
reqJson.put("id", id); reqJson.put("id", id);
reqJson.put("password", loginForm.getPwd()); reqJson.put("password", loginForm.getPwd());
reqJson.put("ownerType", "1"); //修改密码,此处传1或2都可
log.info(reqJson.toJSONString()); log.info(reqJson.toJSONString());
result = goodsOwnerInterface.updateAccountInfo(reqJson); result = goodsOwnerInterface.resetAccountPwd(reqJson);
log.info(result.toJSONString()); log.info(result.toJSONString());
if(result.getInteger("code") != 200) { if(result.getInteger("code") != 200) {
...@@ -108,7 +108,7 @@ public class OwnerPasswordController { ...@@ -108,7 +108,7 @@ public class OwnerPasswordController {
* createTime 2020/04/13 10:00 * createTime 2020/04/13 10:00
**/ **/
@PostMapping("/edit") @PostMapping("/edit")
public EResponse edit(@RequestBody(required=false) @Validated(ValidatorInsert.class) ModifyPasswordForm modifyPasswordFrom) { public EResponse edit(@RequestBody(required=false) @Validated(ValidatorUpdate.class) ModifyPasswordForm modifyPasswordFrom) {
TokenInfoPojo tokenInfoPojo = tokenComponent.getTokenInfo(); TokenInfoPojo tokenInfoPojo = tokenComponent.getTokenInfo();
String phone = tokenInfoPojo.getAccount(); String phone = tokenInfoPojo.getAccount();
...@@ -135,9 +135,8 @@ public class OwnerPasswordController { ...@@ -135,9 +135,8 @@ public class OwnerPasswordController {
reqJson.clear(); reqJson.clear();
reqJson.put("id", id); reqJson.put("id", id);
reqJson.put("password", modifyPasswordFrom.getNewPwd()); reqJson.put("password", modifyPasswordFrom.getNewPwd());
reqJson.put("ownerType", "1"); //修改密码,此处传1或2都可
log.info(reqJson.toJSONString()); log.info(reqJson.toJSONString());
result = goodsOwnerInterface.updateAccountInfo(reqJson); result = goodsOwnerInterface.resetAccountPwd(reqJson);
log.info(result.toJSONString()); log.info(result.toJSONString());
if(result.getInteger("code") != 200) { if(result.getInteger("code") != 200) {
......
package com.esv.freight.app.module.account.form; package com.esv.freight.app.module.account.form;
import com.esv.freight.app.common.validator.groups.ValidatorDelete;
import com.esv.freight.app.common.validator.groups.ValidatorInsert;
import com.esv.freight.app.common.validator.groups.ValidatorUpdate; import com.esv.freight.app.common.validator.groups.ValidatorUpdate;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
...@@ -9,6 +7,8 @@ import org.apache.commons.lang3.builder.ToStringStyle; ...@@ -9,6 +7,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/** /**
* @description: 重置密码验证类 * @description: 重置密码验证类
* @project: freight-app-service * @project: freight-app-service
...@@ -24,15 +24,15 @@ public class ModifyPasswordForm { ...@@ -24,15 +24,15 @@ public class ModifyPasswordForm {
/** /**
* 原密码 * 原密码
*/ */
@Length(min = 32, max = 32, message = "参数oldPwdd长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class}) @Length(min = 32, max = 32, message = "参数oldPwdd长度不合法", groups = {ValidatorUpdate.class})
@NotBlank(message = "参数pwd不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class}) @NotBlank(message = "参数pwd不能为空", groups = {ValidatorUpdate.class})
private String oldPwd; private String oldPwd;
/** /**
* 新密码 * 新密码
*/ */
@Length(min = 32, max = 32, message = "参数newPwd长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class}) @Length(min = 32, max = 32, message = "参数newPwd长度不合法", groups = {ValidatorUpdate.class})
@NotBlank(message = "参数pwd不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class}) @NotBlank(message = "参数pwd不能为空", groups = {ValidatorUpdate.class})
private String newPwd; private String newPwd;
@Override @Override
......
...@@ -16,6 +16,10 @@ import org.apache.commons.lang3.builder.ToStringStyle; ...@@ -16,6 +16,10 @@ import org.apache.commons.lang3.builder.ToStringStyle;
@Data @Data
public class AccountExistVO { public class AccountExistVO {
/**
*
*/
private Long id;
/** /**
* 帐号状态:1-账号已存在、2-账号不存在 * 帐号状态:1-账号已存在、2-账号不存在
*/ */
......
package com.esv.freight.app.module.account.vo; package com.esv.freight.app.module.account.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
......
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