Commit 00717d86 authored by zhangzc's avatar zhangzc

提交修改

parent b9743359
package com.esv.freight.app.config;
import com.esv.freight.app.common.util.ReqUtils;
import com.esv.gateway.common.GatewayHeaders;
import feign.RequestInterceptor;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Value;
......@@ -8,6 +10,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import java.lang.reflect.Field;
/**
* @description: Feign接口配置
* @project: Spring-Cloud-Single-Template
......@@ -34,6 +38,16 @@ public class FeignConfigure {
RequestInterceptor requestInterceptor = ((requestTemplate -> {
requestTemplate.header("trace_id", MDC.get("traceId"));
requestTemplate.header("application_name", applicationName);
requestTemplate.header("Source-Type", "2");
requestTemplate.header("esv_data_perm", "0");
requestTemplate.header("esv_tenant", "1");
requestTemplate.header("gateway_traceid", "1");
requestTemplate.header("esv_system", "app");
requestTemplate.header("esv_tenant", "2");
requestTemplate.header("esv_department", "5");
requestTemplate.header("esv_department_children", "5,6,7");
requestTemplate.header("esv_user", "1");
requestTemplate.header("esv_account", "18524431581");
}));
return requestInterceptor;
}
......
package com.esv.freight.app.feign;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @description:
* @project: Freight
* @name: com.esv.freight.app.feign.GoodsOwnerInterface
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/20 18:00
* @version:1.0
*/
@FeignClient(value = "freight-customer-service")
public interface GoodsOwnerInterface {
@PostMapping(value = "/customer/goodsowner/account/password/check")
JSONObject checkAccountPwd(JSONObject bodyJson);
@PostMapping(value = "/customer/goodsowner/account/register")
JSONObject accountRegister(JSONObject bodyJson);
@PostMapping(value = "/customer/goodsowner/account/detail")
JSONObject getAccountDetail(JSONObject bodyJson);
@PostMapping(value = "/customer/goodsowner/account/edit")
JSONObject updateAccountInfo(JSONObject bodyJson);
}
package com.esv.freight.app.feign;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @description:
* @project: Freight
* @name: com.esv.freight.app.feign.TmsInterface
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/21 10:00
* @version:1.0
*/
@FeignClient(value = "freight-tms-service")
public interface TmsInterface {
@PostMapping(value = "tms/order/add")
JSONObject addOrder(JSONObject bodyJson);
@PostMapping(value = "tms/order/list")
JSONObject listOrders(JSONObject bodyJson);
}
......@@ -6,11 +6,9 @@ import com.esv.freight.app.common.response.EResponse;
import com.esv.freight.app.common.validator.groups.ValidatorInsert;
import com.esv.freight.app.feign.DictInterface;
import com.esv.freight.app.feign.NoticeInterface;
import com.esv.freight.app.module.account.form.LoginByPwdForm;
import com.esv.freight.app.module.account.form.LoginBySmsForm;
import com.esv.freight.app.module.account.form.LoginForm;
import com.esv.freight.app.module.account.form.RefreshTokenForm;
import com.esv.freight.app.module.account.service.AppLoginService;
import com.esv.freight.app.module.account.vo.AccountDetailVO;
import com.esv.freight.app.module.account.vo.LoginVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -51,23 +49,23 @@ public class DriverAccountController {
* createTime 2020/04/14 14:00
**/
@PostMapping("/login/loginBySms")
public EResponse loginBySms(@RequestBody(required=false) @Validated(ValidatorInsert.class) LoginBySmsForm loginBySmsForm) {
public EResponse loginBySms(@RequestBody(required=false) @Validated(ValidatorInsert.class) LoginForm loginForm) {
if(loginBySmsForm == null) {
if(loginForm == null) {
return EResponse.error(ECode.PARAM_ERROR);
}
// 调用通知服务验证短信接口
JSONObject reqJson = new JSONObject();
reqJson.put("phone", loginBySmsForm.getPhone());
reqJson.put("phone", loginForm.getPhone());
reqJson.put("type", "login");
reqJson.put("captcha", loginBySmsForm.getSmsCode());
reqJson.put("captcha", loginForm.getSmsCode());
log.info(reqJson.toJSONString());
JSONObject result = noticeInterface.checkSmsCaptcha(reqJson);
log.info(result.toJSONString());
if(result.getInteger("code") == 200) {
LoginVO loginByPwdVO = appLoginService.loginBySms(loginBySmsForm.getPhone());
LoginVO loginByPwdVO = appLoginService.login(loginForm.getPhone());
return EResponse.ok(loginByPwdVO);
}
......@@ -82,11 +80,12 @@ public class DriverAccountController {
* createTime 2020/04/14 14:00
**/
@PostMapping("/login/loginByPwd")
public EResponse loginByPwd(@RequestBody(required=false) @Validated(ValidatorInsert.class) LoginByPwdForm loginByPwdForm) {
public EResponse loginByPwd(@RequestBody(required=false) @Validated(ValidatorInsert.class) LoginForm loginForm) {
if(loginByPwdForm == null) {
if(loginForm == null) {
return EResponse.error(ECode.PARAM_ERROR);
}
/*
if(!appLoginService.isExistAccount(loginByPwdForm.getPhone())) {
return EResponse.error(1001, "账号不存在");
......@@ -95,9 +94,9 @@ public class DriverAccountController {
// TODO,Feign调用货主账号密码,目前暂时先假定密码为1234qwer(MD5加密)
if(!"62c8ad0a15d9d1ca38d5dee762a16e01".equals(loginByPwdForm.getPwd())) {
return EResponse.error(1003, "密码错误");
}
}*/
LoginVO loginByPwdVO = appLoginService.loginByPwd(loginByPwdForm.getPhone());
LoginVO loginByPwdVO = appLoginService.login(loginForm.getPhone());
return EResponse.ok(loginByPwdVO);
}
......@@ -138,7 +137,7 @@ public class DriverAccountController {
@PostMapping("/detail")
public EResponse detail(@RequestHeader("Union-Authorization") String accessToken) {
AccountDetailVO accountDetailVO = appLoginService.getAccountDetailInfo(accessToken);
return EResponse.ok(accountDetailVO);
// AccountDetailVO accountDetailVO = appLoginService.getAccountDetailInfo(accessToken);
return EResponse.ok();
}
}
package com.esv.freight.app.module.account.controller;
import com.alibaba.fastjson.JSONObject;
import com.esv.freight.app.common.response.ECode;
import com.esv.freight.app.common.response.EResponse;
import com.esv.freight.app.common.validator.groups.ValidatorInsert;
import com.esv.freight.app.feign.NoticeInterface;
import com.esv.freight.app.module.account.form.ResetPasswordForm;
import com.esv.freight.app.module.account.form.LoginForm;
import com.esv.freight.app.module.account.form.ModifyPasswordForm;
import com.esv.freight.app.module.account.service.AppLoginService;
import com.esv.freight.app.module.account.vo.LoginVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
......@@ -46,8 +44,8 @@ public class DriverPasswordController {
* createTime 2020/04/14 16:00
**/
@PostMapping("/reset")
public EResponse reset(@RequestBody(required=false) @Validated(ValidatorInsert.class) ResetPasswordForm resetPasswordForm) {
public EResponse reset(@RequestBody(required=false) @Validated(ValidatorInsert.class) LoginForm loginForm) {
/*
if(resetPasswordForm == null) {
return EResponse.error(ECode.PARAM_ERROR);
}
......@@ -68,7 +66,7 @@ public class DriverPasswordController {
if(result.getInteger("code") == 200) {
LoginVO loginByPwdVO = appLoginService.loginBySms(resetPasswordForm.getPhone());
return EResponse.ok(loginByPwdVO);
}
}*/
return EResponse.error(1001, "短信验证码错误或已失效");
}
......
......@@ -2,9 +2,12 @@ package com.esv.freight.app.module.account.controller;
import com.alibaba.fastjson.JSONObject;
import com.esv.freight.app.feign.DictInterface;
import com.esv.freight.app.feign.GoodsOwnerInterface;
import com.esv.freight.app.feign.NoticeInterface;
import com.esv.freight.app.module.account.form.*;
import com.esv.freight.app.module.account.service.AppLoginService;
import com.esv.freight.app.module.account.validator.groups.ValidatorLoginByPwd;
import com.esv.freight.app.module.account.validator.groups.ValidatorLoginBySms;
import com.esv.freight.app.module.account.vo.AccountDetailVO;
import com.esv.freight.app.common.response.ECode;
import com.esv.freight.app.common.response.EResponse;
......@@ -15,9 +18,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
import java.util.UUID;
/**
* @description: 账号Controller
* @project: Freight
......@@ -35,11 +35,13 @@ public class OwnerAccountController {
private DictInterface dictInterface;
private NoticeInterface noticeInterface;
private GoodsOwnerInterface goodsOwnerInterface;
private AppLoginService appLoginService;
@Autowired
public OwnerAccountController(DictInterface dictInterface, NoticeInterface noticeInterface, AppLoginService appLoginService) {
public OwnerAccountController(GoodsOwnerInterface goodsOwnerInterface, DictInterface dictInterface, NoticeInterface noticeInterface, AppLoginService appLoginService) {
this.dictInterface = dictInterface;
this.goodsOwnerInterface = goodsOwnerInterface;
this.noticeInterface = noticeInterface;
this.appLoginService = appLoginService;
}
......@@ -52,33 +54,35 @@ public class OwnerAccountController {
* createTime 2020/04/10 16:00
**/
@PostMapping("/login/loginBySms")
public EResponse loginBySms(@RequestBody(required=false) @Validated(ValidatorInsert.class) LoginBySmsForm loginBySmsForm) {
if(loginBySmsForm == null) {
return EResponse.error(ECode.PARAM_ERROR);
}
public EResponse loginBySms(@RequestBody(required=false) @Validated(ValidatorLoginBySms.class) LoginForm loginForm) {
// 调用通知服务验证短信接口
JSONObject reqJson = new JSONObject();
reqJson.put("phone", loginBySmsForm.getPhone());
reqJson.put("phone", loginForm.getPhone());
reqJson.put("type", "login");
reqJson.put("captcha", loginBySmsForm.getSmsCode());
reqJson.put("captcha", loginForm.getSmsCode());
log.info(reqJson.toJSONString());
JSONObject result = noticeInterface.checkSmsCaptcha(reqJson);
log.info(result.toJSONString());
/*
JSONObject reqJson1 = new JSONObject();
reqJson1.put("type", "conse");
log.info(reqJson1.toJSONString());
JSONObject result1 = dictInterface.getDictByTypes(reqJson1);
log.info(result1.toJSONString());
*/
if(result.getInteger("code") == 200) {
LoginVO loginByPwdVO = appLoginService.loginBySms(loginBySmsForm.getPhone());
return EResponse.ok(loginByPwdVO);
JSONObject resultCheck = noticeInterface.checkSmsCaptcha(reqJson);
log.info(resultCheck.toJSONString());
if(resultCheck.getInteger("code") != 200) {
return EResponse.error(resultCheck.getInteger("code"), resultCheck.getString("message"));
}
return EResponse.error(result.getInteger("code"), result.getString("message"));
// 调用注册帐号接口
reqJson.clear();
reqJson.put("account", loginForm.getPhone());
log.info(reqJson.toJSONString());
JSONObject resultRegister = goodsOwnerInterface.accountRegister(reqJson);
log.info(resultRegister.toJSONString());
// 1001表示 帐号已存在
if(resultRegister.getInteger("code") != 200 && resultRegister.getInteger("code") != 1001) {
return EResponse.error(resultRegister.getInteger("code"), resultRegister.getString("message"));
}
LoginVO loginByPwdVO = appLoginService.login(loginForm.getPhone());
return EResponse.ok(loginByPwdVO);
}
/**
......@@ -89,22 +93,21 @@ public class OwnerAccountController {
* createTime 2020/04/10 16:00
**/
@PostMapping("/login/loginByPwd")
public EResponse loginByPwd(@RequestBody(required=false) @Validated(ValidatorInsert.class) LoginByPwdForm loginByPwdForm) {
public EResponse loginByPwd(@RequestBody(required=false) @Validated(ValidatorLoginByPwd.class) LoginForm loginForm) {
if(loginByPwdForm == null) {
return EResponse.error(ECode.PARAM_ERROR);
}
if(!appLoginService.isExistAccount(loginByPwdForm.getPhone())) {
return EResponse.error(1001, "账号不存在");
}
// 调用帐号密码校验接口
JSONObject reqJson = new JSONObject();
reqJson.put("account", loginForm.getPhone());
reqJson.put("password", loginForm.getPwd());
log.info(reqJson.toJSONString());
JSONObject result = goodsOwnerInterface.checkAccountPwd(reqJson);
log.info(result.toJSONString());
// TODO,Feign调用货主账号密码,目前暂时先假定密码为1234qwer(MD5加密)
if(!"62c8ad0a15d9d1ca38d5dee762a16e01".equals(loginByPwdForm.getPwd())) {
return EResponse.error(1003, "密码错误");
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
LoginVO loginByPwdVO = appLoginService.loginByPwd(loginByPwdForm.getPhone());
LoginVO loginByPwdVO = appLoginService.login(loginForm.getPhone());
return EResponse.ok(loginByPwdVO);
}
......@@ -149,7 +152,43 @@ public class OwnerAccountController {
return EResponse.error(ECode.TOKEN_EXPIRED);
}
AccountDetailVO accountDetailVO = appLoginService.getAccountDetailInfo(accessToken);
String phone = appLoginService.getPhoneByAccessToken(accessToken);
// 调用帐号密码校验接口
JSONObject reqJsonDetail = new JSONObject();
reqJsonDetail.put("account", phone);
log.info(reqJsonDetail.toJSONString());
JSONObject result = goodsOwnerInterface.getAccountDetail(reqJsonDetail);
log.info(result.toJSONString());
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
AccountDetailVO accountDetailVO = new AccountDetailVO();
accountDetailVO.setId(String.valueOf(result.getJSONObject("data").getLong("id")));
accountDetailVO.setAccount(result.getJSONObject("data").getString("account"));
accountDetailVO.setSourceType(result.getJSONObject("data").getString("sourceType"));
accountDetailVO.setAuditStatus(result.getJSONObject("data").getInteger("auditStatus"));
accountDetailVO.setOwnerType(result.getJSONObject("data").getInteger("ownerType"));
accountDetailVO.setOwnerFullName(result.getJSONObject("data").getString("ownerFullName"));
accountDetailVO.setIdCard(result.getJSONObject("data").getString("idCard"));
accountDetailVO.setIdCardExpireDate(result.getJSONObject("data").getString("idCardExpireDate"));
accountDetailVO.setIdCardFileFrontURL(result.getJSONObject("data").getString("idCardFrontUrl"));
accountDetailVO.setIdCardFileBackURL(result.getJSONObject("data").getString("idCardBackUrl"));
/*
AccountDetailVO accountDetailVO = new AccountDetailVO();
accountDetailVO.setId("12345678");
accountDetailVO.setAccount("15040196733");
accountDetailVO.setSourceType("2");
accountDetailVO.setAuditStatus(1);
accountDetailVO.setOwnerType(1);
accountDetailVO.setOwnerFullName("测试123");
accountDetailVO.setIdCard("210112198707070023");
accountDetailVO.setIdCardExpireDate("2030-02-05");
accountDetailVO.setIdCardFileFrontURL("1123");
accountDetailVO.setIdCardFileBackURL("4456");
*/
return EResponse.ok(accountDetailVO);
}
......
package com.esv.freight.app.module.account.controller;
import com.alibaba.fastjson.JSONObject;
import com.esv.freight.app.feign.DictInterface;
import com.esv.freight.app.common.response.ECode;
import com.esv.freight.app.feign.GoodsOwnerInterface;
import com.esv.freight.app.feign.NoticeInterface;
import com.esv.freight.app.module.account.form.ResetPasswordForm;
import com.esv.freight.app.module.account.form.LoginForm;
import com.esv.freight.app.module.account.form.ModifyPasswordForm;
import com.esv.freight.app.module.account.service.AppLoginService;
import com.esv.freight.app.module.account.vo.LoginVO;
import com.esv.freight.app.common.response.ECode;
import com.esv.freight.app.common.response.EResponse;
import com.esv.freight.app.common.validator.groups.ValidatorInsert;
import lombok.extern.slf4j.Slf4j;
......@@ -32,11 +31,13 @@ public class OwnerPasswordController {
private NoticeInterface noticeInterface;
private AppLoginService appLoginService;
private GoodsOwnerInterface goodsOwnerInterface;
@Autowired
public OwnerPasswordController(NoticeInterface noticeInterface, AppLoginService appLoginService) {
public OwnerPasswordController(GoodsOwnerInterface goodsOwnerInterface, NoticeInterface noticeInterface, AppLoginService appLoginService) {
this.noticeInterface = noticeInterface;
this.appLoginService = appLoginService;
this.goodsOwnerInterface = goodsOwnerInterface;
}
/**
......@@ -47,31 +48,52 @@ public class OwnerPasswordController {
* createTime 2020/04/13 10:00
**/
@PostMapping("/reset")
public EResponse reset(@RequestBody(required=false) @Validated(ValidatorInsert.class) ResetPasswordForm resetPasswordForm) {
public EResponse reset(@RequestBody(required=false) @Validated(ValidatorInsert.class) LoginForm loginForm) {
if(resetPasswordForm == null) {
return EResponse.error(ECode.PARAM_ERROR);
}
// 调用查询帐号详情接口
JSONObject reqJson = new JSONObject();
reqJson.put("account", loginForm.getPhone());
log.info(reqJson.toJSONString());
JSONObject result = goodsOwnerInterface.getAccountDetail(reqJson);
log.info(result.toJSONString());
if(!appLoginService.isExistAccount(resetPasswordForm.getPhone())) {
if(result.getInteger("code") == 1002) {
return EResponse.error(1002, "手机号未注册");
}
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
Long id = result.getJSONObject("data").getLong("id");
// 调用通知服务验证短信接口
JSONObject reqJson = new JSONObject();
reqJson.put("phone", resetPasswordForm.getPhone());
reqJson.clear();
reqJson.put("phone", loginForm.getPhone());
reqJson.put("type", "reset_pwd");
reqJson.put("captcha", resetPasswordForm.getSmsCode());
reqJson.put("captcha", loginForm.getSmsCode());
log.info(reqJson.toJSONString());
result = noticeInterface.checkSmsCaptcha(reqJson);
log.info(result.toJSONString());
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
// 调用编辑帐号信息接口
reqJson.clear();
reqJson.put("id", id);
reqJson.put("password", loginForm.getPwd());
reqJson.put("ownerType", "1"); //修改密码,此处传1或2都可
log.info(reqJson.toJSONString());
JSONObject result = noticeInterface.checkSmsCaptcha(reqJson);
result = goodsOwnerInterface.updateAccountInfo(reqJson);
log.info(result.toJSONString());
if(result.getInteger("code") == 200) {
LoginVO loginByPwdVO = appLoginService.loginBySms(resetPasswordForm.getPhone());
return EResponse.ok(loginByPwdVO);
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
return EResponse.error(1001, "短信验证码错误或已失效");
return EResponse.ok();
}
/**
......@@ -84,14 +106,43 @@ public class OwnerPasswordController {
@PostMapping("/edit")
public EResponse edit(@RequestHeader("Union-Authorization") String accessToken, @RequestBody(required=false) @Validated(ValidatorInsert.class) ModifyPasswordForm modifyPasswordFrom) {
if(modifyPasswordFrom == null) {
return EResponse.error(ECode.PARAM_ERROR);
if(appLoginService.isInvalidAccessToken(accessToken)) {
return EResponse.error(ECode.TOKEN_EXPIRED);
}
if("1234qwer".equals(modifyPasswordFrom.getOldPwd())) {
String phone = appLoginService.getPhoneByAccessToken(accessToken);
// 调用帐号密码校验接口
JSONObject reqJson = new JSONObject();
reqJson.put("account", phone);
reqJson.put("password", modifyPasswordFrom.getOldPwd());
log.info(reqJson.toJSONString());
JSONObject result = goodsOwnerInterface.checkAccountPwd(reqJson);
log.info(result.toJSONString());
if(result.getInteger("code") == 1002) {
return EResponse.error(1001, "原密码错误");
}
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
Long id = result.getJSONObject("data").getLong("id");
// 调用编辑帐号信息接口
reqJson.clear();
reqJson.put("id", id);
reqJson.put("password", modifyPasswordFrom.getNewPwd());
reqJson.put("ownerType", "1"); //修改密码,此处传1或2都可
log.info(reqJson.toJSONString());
result = goodsOwnerInterface.updateAccountInfo(reqJson);
log.info(result.toJSONString());
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
return EResponse.ok();
}
}
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 lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* @description: 短信验证码登录验证类
* @project: Freight
* @name: com.esv.freight.module.ownerBackend.account.form.LoginBySmsForm
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/11 10:00
* @version:1.0
*/
@Data
public class LoginBySmsForm {
/**
* 手机号
*/
@Length(min = 11, max = 11, message = "参数phone长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
@NotBlank(message = "参数phone不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private String phone;
/**
* 短信验证码
*/
@Length(min = 6, max = 6, message = "参数pwd长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
@NotBlank(message = "参数smsCode不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private String smsCode;
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
}
......@@ -2,42 +2,45 @@ 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.ValidatorList;
import com.esv.freight.app.common.validator.groups.ValidatorUpdate;
import com.esv.freight.app.module.account.validator.groups.ValidatorLoginByPwd;
import com.esv.freight.app.module.account.validator.groups.ValidatorLoginBySms;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* @description: 账号密码登录验证类
* @description:
* @project: Freight
* @name: com.esv.freight.module.ownerBackend.account.form.LoginByPwdForm
* @name: com.esv.freight.module.ownerBackend.account.form.LoginForm
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/10 16:00
* @version:1.0
*/
@Data
public class LoginByPwdForm {
public class LoginForm {
/**
* 手机号
*/
@Length(min = 11, max = 11, message = "参数phone长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
@NotBlank(message = "参数phone不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
@Length(min = 11, max = 11, message = "参数phone长度不合法", groups = {ValidatorInsert.class, ValidatorLoginByPwd.class, ValidatorLoginBySms.class})
@NotBlank(message = "参数phone不能为空", groups = {ValidatorInsert.class, ValidatorLoginByPwd.class, ValidatorLoginBySms.class})
private String phone;
/**
* 短信验证码
*/
@Length(min = 6, max = 6, message = "参数smsCode长度不合法", groups = {ValidatorInsert.class, ValidatorLoginBySms.class})
@NotBlank(message = "参数smsCode不能为空", groups = {ValidatorInsert.class, ValidatorLoginBySms.class})
private String smsCode;
/**
* 密码
*/
@Length(min = 32, max = 32, message = "参数pwd长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
@NotBlank(message = "参数pwd不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
@Length(min = 32, max = 32, message = "参数pwd长度不合法", groups = {ValidatorInsert.class, ValidatorLoginByPwd.class})
@NotBlank(message = "参数pwd不能为空", groups = {ValidatorInsert.class, ValidatorLoginByPwd.class})
private String pwd;
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
}
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.ValidatorList;
import com.esv.freight.app.common.validator.groups.ValidatorUpdate;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* @description: 账号注册验证类
* @project: Freight
* @name: com.esv.freight.module.ownerBackend.account.form.AccountRegisterForm
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/13 09:00
* @version:1.0
*/
@Data
public class ResetPasswordForm {
/**
* 手机号
*/
@Length(max = 17, message = "参数phone长度不合法", groups = {ValidatorList.class})
@Length(min = 11, max = 11, message = "参数phone长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
@NotBlank(message = "参数phone不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private String phone;
/**
* 短信验证码
*/
@Length(min = 6, max = 6, message = "参数pwd长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
@NotBlank(message = "参数smsCode不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private String smsCode;
/**
* 密码
*/
@Length(min = 32, max = 32, message = "参数pwd长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
@NotBlank(message = "参数pwd不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private String pwd;
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
}
......@@ -15,19 +15,15 @@ import com.esv.freight.app.module.account.vo.LoginVO;
*/
public interface AppLoginService extends IService<AppLoginEntity> {
LoginVO loginByPwd(String phone);
LoginVO loginBySms(String phone);
LoginVO login(String phone);
void logout(String accessToken);
LoginVO refreshToken(String accessToken, RefreshTokenForm refreshTokenForm);
boolean isExistAccount(String phone);
boolean isInvalidAccessToken(String accessToken);
boolean isInvalidRefreshToken(String refreshToken);
AccountDetailVO getAccountDetailInfo(String accessToken);
String getPhoneByAccessToken(String accessToken);
}
\ No newline at end of file
......@@ -27,11 +27,10 @@ public class AppLoginImpl extends ServiceImpl<AppLoginDao, AppLoginEntity> imple
entity.setAccessToken(UUID.randomUUID().toString().replaceAll("-", ""));
entity.setRefreshToken(UUID.randomUUID().toString().replaceAll("-", ""));
}
@Override
public LoginVO loginBySms(String phone) {
public LoginVO login(String phone) {
AppLoginEntity appLoginEntity = this.getAccountByPhone(phone);
if(null == appLoginEntity) {
......@@ -71,24 +70,6 @@ public class AppLoginImpl extends ServiceImpl<AppLoginDao, AppLoginEntity> imple
return loginByPwdVO;
}
@Override
public LoginVO loginByPwd(String phone) {
AppLoginEntity appLoginEntity = this.getAccountByPhone(phone);
createToken(appLoginEntity);
appLoginEntity.setLoginStatus("1");
appLoginEntity.setLoginTime(new Date());
appLoginEntity.setRefreshTime(new Date());
appLoginEntity.setAccessTokenValidTime(getFuture(1));
appLoginEntity.setRefreshTokenValidTime(getFuture(30));
this.baseMapper.updateById(appLoginEntity);
//数据转换
LoginVO loginByPwdVO = new LoginVO();
loginByPwdVO.setAccessToken(appLoginEntity.getAccessToken());
loginByPwdVO.setRefreshToken(appLoginEntity.getRefreshToken());
return loginByPwdVO;
}
@Override
public void logout(String accessToken) {
AppLoginEntity entity = this.getAccountByAccessToken(accessToken);
......@@ -128,33 +109,6 @@ public class AppLoginImpl extends ServiceImpl<AppLoginDao, AppLoginEntity> imple
return loginByPwdVO;
}
@Override
public boolean isExistAccount(String phone) {
AppLoginEntity entity = this.getAccountByPhone(phone);
if(null == entity) {
return false;
}
return true;
}
@Override
public AccountDetailVO getAccountDetailInfo(String accessToken) {
AppLoginEntity entity = this.getAccountByAccessToken(accessToken);
if(entity == null) {
throw new EException(602, "Token已过期,请重新登录");
}
AccountDetailVO accountDetailVO = new AccountDetailVO();
accountDetailVO.setAccount(entity.getPhone());
accountDetailVO.setContactor("赵龙");
accountDetailVO.setId("testownerid123");
accountDetailVO.setAuthenticateStatus(1);
accountDetailVO.setOwnerType(1);
return accountDetailVO;
}
@Override
public boolean isInvalidAccessToken(String accessToken) {
......@@ -190,6 +144,16 @@ public class AppLoginImpl extends ServiceImpl<AppLoginDao, AppLoginEntity> imple
return false;
}
@Override
public String getPhoneByAccessToken(String accessToken) {
AppLoginEntity entity = this.getAccountByAccessToken(accessToken);
if(entity == null) {
throw new EException(602, "Token已过期,请重新登录");
}
return entity.getPhone();
}
private AppLoginEntity getAccountByPhone(String phone) {
QueryWrapper<AppLoginEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("phone", phone);
......
package com.esv.freight.app.module.account.validator.groups;
public interface ValidatorLoginByPwd {
}
package com.esv.freight.app.module.account.validator.groups;
public interface ValidatorLoginBySms {
}
......@@ -17,17 +17,20 @@ public class AccountDetailVO {
// 账号ID
private String id;
// 认证状态:1-未认证、2-已认证
private Integer authenticateStatus;
// 登录帐号,货主手机号
private String account;
// 创建来源:1-平台创建、2-自行注册
private String sourceType;
// 货主帐号审核状态:0-待审核、1-审核成功,2-审核失败,APP自行注册需要平台审核
private Integer auditStatus;
// 货主类型:1-个人、2-企业
private Integer ownerType;
// 帐号
private String account;
// 姓名
private String contactor;
private String ownerFullName;
// 身份证号码
private String idCard;
......
......@@ -45,6 +45,28 @@ public class DeliveryAddressController {
deliveryAddressListVO = new DeliveryAddressListVO();
listDeliveryAddressVO = new ArrayList<>();
deliveryAddressListVO.setRecords(listDeliveryAddressVO);
DeliveryAddressItemVO vo1 = new DeliveryAddressItemVO();
vo1.setAddressName("华新国际大厦");
vo1.setCityCode("130700");
vo1.setDeliverer("赵云");
vo1.setDelivererPhone("13512345678");
vo1.setDetailAddress("青年大街219号");
vo1.setDistrictCode("130705");
vo1.setProvinceCode("130000");
vo1.setId(101);
listDeliveryAddressVO.add(vo1);
DeliveryAddressItemVO vo2 = new DeliveryAddressItemVO();
vo2.setAddressName("卓越大厦");
vo2.setCityCode("210100");
vo2.setDeliverer("关羽");
vo2.setDelivererPhone("13605050606");
vo2.setDetailAddress("惠工街12号");
vo2.setDistrictCode("210103");
vo2.setProvinceCode("210000");
vo2.setId(102);
listDeliveryAddressVO.add(vo2);
}
/**
......
......@@ -45,6 +45,28 @@ public class ReceiveAddressController {
receiveAddressListVO = new ReceiveAddressListVO();
listReceiveAddressVO = new ArrayList<>();
receiveAddressListVO.setRecords(listReceiveAddressVO);
ReceiveAddressItemVO vo1 = new ReceiveAddressItemVO();
vo1.setAddressName("恒隆广场");
vo1.setCityCode("210100");
vo1.setReceiver("刘备");
vo1.setReceiverPhone("13745218524");
vo1.setDetailAddress("青年大街1号");
vo1.setDistrictCode("210103");
vo1.setProvinceCode("210000");
vo1.setId(103);
listReceiveAddressVO.add(vo1);
ReceiveAddressItemVO vo2 = new ReceiveAddressItemVO();
vo2.setAddressName("国际软件园");
vo2.setCityCode("210100");
vo2.setReceiver("张飞");
vo2.setReceiverPhone("13452415874");
vo2.setDetailAddress("惠工街12号");
vo2.setDistrictCode("210112");
vo2.setProvinceCode("210000");
vo2.setId(104);
listReceiveAddressVO.add(vo2);
}
/**
......
package com.esv.freight.app.module.order.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.esv.freight.app.common.response.ECode;
import com.esv.freight.app.common.response.EResponse;
import com.esv.freight.app.common.validator.groups.ValidatorInsert;
import com.esv.freight.app.feign.DictInterface;
import com.esv.freight.app.feign.NoticeInterface;
import com.esv.freight.app.common.vo.PageResultVO;
import com.esv.freight.app.feign.TmsInterface;
import com.esv.freight.app.module.account.service.AppLoginService;
import com.esv.freight.app.module.order.form.OrderListForm;
import com.esv.freight.app.module.order.form.OrderForm;
import com.esv.freight.app.module.order.form.OrderQueryForm;
import com.esv.freight.app.module.order.vo.OrderListItemVO;
import com.esv.freight.app.module.order.vo.OrderListVO;
import com.esv.freight.app.module.order.vo.OrderStatisticsVO;
import com.esv.freight.app.module.order.form.AddOrderForm;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @description: 订单Controller
* @project: Freight
......@@ -30,10 +41,42 @@ import org.springframework.web.bind.annotation.*;
public class OrderController {
private AppLoginService appLoginService;
private TmsInterface tmsInterface;
private OrderListVO pageResultVerify,pageResultNew,pageResultExecute;
private void createTestData() {
pageResultVerify = new OrderListVO();
List<OrderListItemVO> verifyList = new ArrayList<>();
OrderListItemVO itemVO = new OrderListItemVO();
itemVO.setId(10056L);
itemVO.setOrderNO("2020042109300101");
itemVO.setOrderState(1);
itemVO.setAuditState(2);
itemVO.setDeliveryCity("210100");
itemVO.setReceiveCity("210100");
itemVO.setGoodsName(1101);
itemVO.setGoodsTotalAmount(new BigDecimal(26));
itemVO.setGoodsUnit("吨");
itemVO.setCreateTime(new Date());
itemVO.setRequiredReceiveTime(new Date());
itemVO.setRequiredDeliveryTime(new Date());
itemVO.setOrderSource("1");
verifyList.add(itemVO);
pageResultVerify.setPageNum(1L);
pageResultVerify.setPageSize(20L);
pageResultVerify.setTotal(1L);
pageResultVerify.setRecordSize(1L);
pageResultVerify.setRecord(verifyList);
}
@Autowired
public OrderController(AppLoginService appLoginService) {
public OrderController(TmsInterface tmsInterface, AppLoginService appLoginService) {
this.appLoginService = appLoginService;
this.tmsInterface = tmsInterface;
createTestData();
}
/**
......@@ -67,14 +110,60 @@ public class OrderController {
* createTime 2020/04/18 11:00
**/
@PostMapping("/list")
public EResponse list(@RequestHeader("Union-Authorization") String accessToken, @RequestBody(required=false) @Validated(ValidatorInsert.class) OrderListForm orderListForm) {
public EResponse list(@RequestHeader("Union-Authorization") String accessToken, @RequestBody(required=false) @Validated(ValidatorInsert.class) OrderQueryForm orderQueryForm) {
if(appLoginService.isInvalidAccessToken(accessToken)) {
return EResponse.error(ECode.TOKEN_EXPIRED);
}
// 调用订单列表分页查询接口
JSONObject reqJson = new JSONObject();
reqJson.put("goodsOwnerId", orderQueryForm.getGoodsOwnerId());
reqJson.put("pageNum", orderQueryForm.getPageNum());
reqJson.put("pageSize", orderQueryForm.getPageSize());
if(orderQueryForm.getOrderState() != null){
reqJson.put("orderState", orderQueryForm.getOrderState());
}
log.info(reqJson.toJSONString());
JSONObject result = tmsInterface.listOrders(reqJson);
log.info(result.toJSONString());
return EResponse.ok();
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
/*
OrderListVO pageResultVO = new OrderListVO();
JSONObject data = result.getJSONObject("data");
pageResultVO.setPageSize(data.getLong("pageSize"));
pageResultVO.setPageNum(data.getLong("pageNum"));
pageResultVO.setTotal(data.getLong("total"));
pageResultVO.setRecordSize(data.getLong("recordSize"));
if(pageResultVO.getRecordSize() > 0) {
JSONArray items = data.getJSONArray("records");
List<OrderListItemVO> records = new ArrayList<>();
for(int i=0; i<items.size(); ++i) {
OrderListItemVO vo = new OrderListItemVO();
JSONObject object = items.getJSONObject(i);
vo.setId(object.getLong("id"));
vo.setOrderNO(object.getString("orderNo"));
vo.setOrderState(object.getInteger("orderState"));
vo.setDeliveryCity(object.getString("deliveryCity"));
vo.setReceiveCity(object.getString("receiveCity"));
vo.setGoodsName(object.getInteger("goodsName"));
vo.setGoodsTotalAmount(object.getBigDecimal("goodsTotalAmount"));
vo.setGoodsUnit(object.getString("goodsUnit"));
vo.setRequiredDeliveryTime(object.getDate("requiredDeliveryTime"));
vo.setRequiredReceiveTime(object.getDate("requiredReceiveTime"));
vo.setCreateTime(object.getDate("createTime"));
records.add(vo);
}
pageResultVO.setRecord(records);
}
return EResponse.ok(pageResultVO);
*/
return EResponse.ok(pageResultVerify);
}
/**
......@@ -84,13 +173,41 @@ public class OrderController {
* author 张志臣
* createTime 2020/04/13 14:00
**/
@PostMapping("/platform/add")
public EResponse add(@RequestHeader("Union-Authorization") String accessToken, @RequestBody(required=false) @Validated(ValidatorInsert.class) AddOrderForm addOrderForm) {
@PostMapping("/add")
public EResponse add(@RequestHeader("Union-Authorization") String accessToken, @RequestBody(required=false) @Validated(ValidatorInsert.class) OrderForm orderForm) {
if(appLoginService.isInvalidAccessToken(accessToken)) {
return EResponse.error(ECode.TOKEN_EXPIRED);
}
// 调用订单新增接口
JSONObject reqJson = new JSONObject();
reqJson.put("goodsOwnerId", orderForm.getGoodsOwnerId());
reqJson.put("businessType", orderForm.getBusinessType());
reqJson.put("goodsType", orderForm.getGoodsType());
reqJson.put("goodsNameCode", orderForm.getGoodsNameCode());
reqJson.put("goodsDetail", orderForm.getGoodsDetail());
reqJson.put("goodsTotalAmount", orderForm.getGoodsTotalAmount());
reqJson.put("goodsUnit", orderForm.getGoodsUnit());
reqJson.put("goodsUnitPrice", orderForm.getGoodsUnitPrice());
reqJson.put("freightUnitPriceInput", orderForm.getFreightUnitPriceInput());
reqJson.put("deliveryAddressId", orderForm.getDeliveryAddressId());
reqJson.put("receiveAddressId", orderForm.getReceiveAddressId());
reqJson.put("requiredDeliveryTime", orderForm.getRequiredDeliveryTime());
reqJson.put("requiredReceiveTime", orderForm.getRequiredReceiveTime());
reqJson.put("vehicleTypeMain", orderForm.getVehicleTypeMain());
reqJson.put("vehicleTypeSub", orderForm.getVehicleTypeSub());
reqJson.put("vehicleLength", orderForm.getVehicleLength());
reqJson.put("orderSource", 2);
reqJson.put("remark", orderForm.getRemark());
log.info(reqJson.toJSONString());
JSONObject result = tmsInterface.addOrder(reqJson);
log.info(result.toJSONString());
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
return EResponse.ok();
}
}
package com.esv.freight.app.module.order.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 lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* @description: 发布订单验证类
* @project: Freight
* @name: com.esv.freight.module.ownerBackend.order.form.AddOrderForm
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/13 13:00
* @version:1.0
*/
@Data
public class AddOrderForm {
/**
* 发货地址ID
*/
@NotBlank(message = "参数deliveryAddressId不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private Integer deliveryAddressId;
/**
* 收货地址ID
*/
@NotBlank(message = "参数receiveAddressId不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private Integer receiveAddressId;
/**
* 货物类型
*/
@NotBlank(message = "参数goodsType不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private Integer goodsType;
/**
* 货物名称编码
*/
@NotBlank(message = "参数goodsNameCode不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private Integer goodsNameCode;
/**
* 货物名称内容
*/
@NotBlank(message = "参数goodsName不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private String goodsName;
/**
* 货物明细
*/
@NotBlank(message = "参数goodsDetail不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
@Length(max = 200, message = "货物明细长度不合法")
private String goodsDetail;
/**
* 货物单位
*/
@NotBlank(message = "参数goodsUnit不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private Integer goodsUnit;
/**
* 货物单价
*/
@NotBlank(message = "参数goodsUnitPrice不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private Number goodsUnitPrice;
/**
* 要求发货时间
*/
@NotBlank(message = "参数requiredDeliveryTime不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private String requiredDeliveryTime;
/**
* 要求交货时间
*/
@NotBlank(message = "参数requiredReceiveTime不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private String requiredReceiveTime;
/**
* 车辆类型,主类型
*/
private String vehicleTypeMain;
/**
* 车辆类型,子类型
*/
private String vehicleTypeSub;
/**
* 车长
*/
private String vehicleLength;
/**
* 备注
*/
@Length(max = 200, message = "备注长度不合法")
private String remark;
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
}
package com.esv.freight.app.module.order.form;
import com.esv.freight.app.common.util.DateUtils;
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.ValidatorList;
import com.esv.freight.app.common.validator.groups.ValidatorUpdate;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.validation.constraints.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.math.BigDecimal;
import java.util.Date;
/**
* @description:
* @project: Freight
* @name: com.esv.freight.module.ownerBackend.order.form.OrderForm
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/21 13:00
* @version:1.0
*/
@Data
public class OrderForm {
/**
* 主键
*/
@Positive(message = "参数id不合法", groups = {ValidatorUpdate.class})
@NotNull(message = "参数id不能为空", groups = {ValidatorUpdate.class, ValidatorDelete.class})
private Long id;
/**
* 货主id
*/
@Positive(message = "参数货主ID不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数货主ID不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Long goodsOwnerId;
/**
* 业务类型
*/
@Positive(message = "参数业务类型不合法", groups = {ValidatorUpdate.class})
@Range(min = 1, max = 5, message = "无效的业务类型", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorList.class})
@NotNull(message = "参数业务类型不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Integer businessType;
/**
* 货物类型
*/
@Positive(message = "参数货物类型不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@Range(min = 1, max = 19, message = "无效的货物类型", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorList.class})
@NotNull(message = "参数货物类型不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Integer goodsType;
/**
* 货物名称编码
*/
@Positive(message = "参数货物名称不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数货物名称不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Integer goodsNameCode;
/**
* 货物明细
*/
@Length(max = 300, message = "参数货物明细长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class,})
private String goodsDetail;
/**
* 货物订单量
*/
@Positive(message = "参数货物订单量不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@DecimalMax(value = "99999999.999", message = "货物订单量不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@DecimalMin(value = "0.000", message = "货物订单量不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数货物订单量不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private BigDecimal goodsTotalAmount;
/**
* 货物单位
*/
@Range(min = 1, max = 4, message = "无效的货物单位", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数货物单位不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Integer goodsUnit;
/**
* 货物单价
*/
@DecimalMax(value = "999999999.999999", message = "货物单价不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@DecimalMin(value = "0.000000", message = "货物单价不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数货物单价不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private BigDecimal goodsUnitPrice;
/**
* 运费单价(收入)
*/
@DecimalMax(value = "999999999.999999", message = "运费单价(收入)不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@DecimalMin(value = "0.000000", message = "运费单价(收入)不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数运费单价(收入)不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class,})
private BigDecimal freightUnitPriceInput;
/**
* 发货地址ID
*/
@NotNull(message = "参数发货地址ID不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Long deliveryAddressId;
/**
* 收货地址ID
*/
@NotNull(message = "参数收货地址ID不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Long receiveAddressId;
/**
* 要求发货时间
*/
@NotNull(message = "参数要求发货时间不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Long requiredDeliveryTime;
/**
* 要求交货时间
*/
@NotNull(message = "参数要求交货时间不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Long requiredReceiveTime;
/**
* 车辆类型,主类型
*/
@Positive(message = "参数车辆类型(主)不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorList.class})
private Integer vehicleTypeMain;
/**
* 车辆类型,子类型
*/
@Positive(message = "参数车辆类型(子)不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorList.class})
private Integer vehicleTypeSub;
/**
* 车长
*/
@DecimalMax(value = "999.99", message = "车长不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@DecimalMin(value = "0.00", message = "车长不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private BigDecimal vehicleLength;
/**
* 备注
*/
@Length(max = 300, message = "参数备注长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private String remark;
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
}
package com.esv.freight.app.module.order.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.*;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
/**
* @description: 订单列表验证类
......@@ -19,25 +21,40 @@ import javax.validation.constraints.NotBlank;
* @version:1.0
*/
@Data
public class OrderListForm {
public class OrderQueryForm {
/**
* 订单ID
*/
@NotNull(message = "参数订单ID不能为空", groups = {ValidatorDetail.class})
private Long id;
/**
* 货主id
*/
@Positive(message = "参数货主ID不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Long goodsOwnerId;
/**
* 订单类型:1-待审核、2-新增、3-执行中
* 订单类型:1-待审核、2-已取消、3-新增、4-执行中、5-已完结
*/
@NotBlank(message = "参数type不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private Integer type;
@Positive(message = "参数订单状态不合法", groups = {ValidatorList.class})
@Range(min = 1, max = 5, message = "无效的订单状态", groups = {ValidatorList.class})
private Integer orderState;
/**
* 当前页数
*/
@NotBlank(message = "参数pageNum不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private Integer pageNum;
@Range(min = 1, max = 1000, message = "无效的pageNum", groups = {ValidatorList.class})
@NotNull(message = "参数pageNum不能为空", groups = {ValidatorList.class})
private Long pageNum;
/**
* 每页显示记录数
*/
@NotBlank(message = "参数pageSize不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class, ValidatorDelete.class})
private Integer pageSize;
@Range(min = 1, max = 1000, message = "pageSize", groups = {ValidatorList.class})
@NotNull(message = "参数pageSize不能为空", groups = {ValidatorList.class})
private Long pageSize;
@Override
public String toString() {
......
......@@ -2,6 +2,9 @@ package com.esv.freight.app.module.order.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @description: 订单列表VO
* @project: Freight
......@@ -17,49 +20,65 @@ public class OrderListItemVO {
/**
* 订单ID
*/
private Integer id;
private Long id;
/**
* 订单号
*/
private String orderNO;
/**
* 发货地址省份
* 订单状态.
*/
private String deliveryProviceCode;
private Integer orderState;
/**
* 发货地址城市
* 审核状态
*/
private String deliveryCityCode;
private Integer auditState;
/**
* 收货地址省份
* 发货城市编码
*/
private String receiveProviceCode;
private String deliveryCity;
/**
* 收货地址城市
* 收货城市编码
*/
private String receiveCityCode;
private String receiveCity;
/**
* 货物类型,字典表
* 货物名称编码
*/
private Integer goodType;
private Integer goodsName;
/**
* 货物订单量
* 货物订单量
*/
private String goodsTotalAmount;
private BigDecimal goodsTotalAmount;
/**
* 货物单位,字典表
* 货物单位
*/
private Integer goodsUnit;
private String goodsUnit;
/**
* 发布时间
* 要求发货时间
*/
private Integer publishTime;
private Date requiredDeliveryTime;
/**
* 货时间
* 要求交货时间
*/
private Integer deliveryTime;
private Date requiredReceiveTime;
/**
* 订单创建时间
*/
private Date createTime;
/**
* 订单来源,字典表
* 订单来源
*/
private String orderSource;
}
package com.esv.freight.app.module.order.vo;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.List;
/**
* @description: 订单列表VO
* @project: Freight
* @name: com.esv.freight.module.ownerBackend.order.vo.OrderListVO
* @name: com.esv.freight.app.module.order.vo.OrderListVO
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/18 11:00
......@@ -19,32 +16,27 @@ import java.util.List;
public class OrderListVO {
/**
* 当前页
*/
private Integer pageNum;
* 每页记录条
**/
private Long pageSize;
/**
* 每页显示记录数
*/
private Integer pageSize;
* 当前页码
**/
private Long pageNum;
/**
* 总记录
*/
private Integer totalSize;
* 总记录条
**/
private Long total;
/**
* 当前页的记录
*/
private Integer recordSize;
* 当前页的记录条
**/
private Long recordSize;
/**
* 记录列表
* 数据
**/
private List<OrderListItemVO> records;
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
private List<OrderListItemVO> record;
}
......@@ -33,6 +33,13 @@ spring:
max-wait: -1
max-idle: 8
min-idle: 0
feign:
client:
config:
default:
connectTimeout: 10000
readTimeout: 10000
#mybatis
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*Dao.xml
......@@ -52,4 +59,9 @@ mybatis-plus:
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
id-type: AUTO
logic-delete-value: 1
logic-not-delete-value: 0
\ No newline at end of file
logic-not-delete-value: 0
ribbon:
eager-load:
enabled: true
clients: freight-base-service,freight-bill,freight-tms-service
\ No newline at end of file
server:
port: 1004
servlet:
context-path: /app
nacos:
url: 192.168.31.248:8848
namespace: aad5aa26-5351-4e7a-a65e-ecb332f3c52c
......
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