Commit 99ffcd77 authored by zhangzc's avatar zhangzc

优化运单功能

parent de4f3007
...@@ -86,11 +86,6 @@ public class AuthFilter implements Filter { ...@@ -86,11 +86,6 @@ public class AuthFilter implements Filter {
String url = requestWrapper.getRequestURI(); String url = requestWrapper.getRequestURI();
CheckCustomToken.check(customToken, url); CheckCustomToken.check(customToken, url);
request.setAttribute("tokenInfo", customToken); request.setAttribute("tokenInfo", customToken);
// TODO 如果租户ID正确,进行设置操作,网关请求头
String userId = customToken.getUserId();
// TODO 将userId进行设置操作,网关请求头
filterChain.doFilter(servletRequest, servletResponse); filterChain.doFilter(servletRequest, servletResponse);
} }
......
package com.esv.freight.app.config; package com.esv.freight.app.config;
import com.esv.freight.app.common.util.ReqUtils; import com.esv.freight.app.common.util.ReqUtils;
import com.esv.freight.app.module.account.CustomToken;
import com.esv.gateway.common.GatewayHeaders; import com.esv.gateway.common.GatewayHeaders;
import feign.RequestInterceptor; import feign.RequestInterceptor;
import org.slf4j.MDC; import org.slf4j.MDC;
...@@ -38,16 +39,16 @@ public class FeignConfigure { ...@@ -38,16 +39,16 @@ public class FeignConfigure {
RequestInterceptor requestInterceptor = ((requestTemplate -> { RequestInterceptor requestInterceptor = ((requestTemplate -> {
requestTemplate.header("trace_id", MDC.get("traceId")); requestTemplate.header("trace_id", MDC.get("traceId"));
requestTemplate.header("application_name", applicationName); requestTemplate.header("application_name", applicationName);
requestTemplate.header("Source-Type", "2"); requestTemplate.header("Source-Type", "4");
requestTemplate.header("esv_data_perm", "0"); requestTemplate.header("esv_data_perm", "0");
requestTemplate.header("esv_tenant", "1");
requestTemplate.header("gateway_traceid", "1"); requestTemplate.header("gateway_traceid", "1");
requestTemplate.header("esv_system", "app"); requestTemplate.header("esv_system", "app");
requestTemplate.header("esv_tenant", "2");
requestTemplate.header("esv_department", "5"); requestTemplate.header("esv_department", "5");
requestTemplate.header("esv_department_children", "5,6,7"); requestTemplate.header("esv_department_children", "5,6,7");
requestTemplate.header("esv_user", "1"); CustomToken customToken = ReqUtils.getTokenInfo();
requestTemplate.header("esv_account", "18524431581"); requestTemplate.header("esv_user", customToken.getUserId());
requestTemplate.header("esv_account", customToken.getAccount());
requestTemplate.header("esv_tenant", String.valueOf(customToken.getTenantId()));
})); }));
return requestInterceptor; 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.DriverInterface
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/28 20:00
* @version:1.0
*/
@FeignClient(value = "freight-customer-service")
public interface DriverInterface {
/**
* 校验司机账号密码
* @param bodyJson
* @return
*/
@PostMapping(value = "/customer/carrier/driver/password/check")
JSONObject checkAccountPwd(JSONObject bodyJson);
/**
* 注册司机账号
* @param bodyJson
* @return
*/
@PostMapping(value = "/customer/goodsowner/account/register")
JSONObject accountRegister(JSONObject bodyJson);
/**
* 获取司机账号详情
* @param bodyJson
* @return
*/
@PostMapping(value = "/customer/goodsowner/account/detail")
JSONObject getAccountDetail(JSONObject bodyJson);
/**
* 更改司机账号信息
* @param bodyJson
* @return
*/
@PostMapping(value = "/customer/goodsowner/account/edit")
JSONObject updateAccountInfo(JSONObject bodyJson);
}
...@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.PostMapping;
public interface FileInterface { public interface FileInterface {
/** /**
* 校验短信验证码 * 文件上传
* @param bodyJson * @param bodyJson
* @return * @return
*/ */
......
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.TmsGrabInterface
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/29 10:00
* @version:1.0
*/
@FeignClient(value = "freight-tms-service")
public interface TmsGrabInterface {
/**
* 查询抢单信息列表
* @param bodyJson
* @return
*/
@PostMapping(value = "tms/order/grabbing/list")
JSONObject getOrderGrabbingList(JSONObject bodyJson);
/**
* 司机抢单
* @param bodyJson
* @return
*/
@PostMapping(value = "tms/order/grabbing/grab")
JSONObject grabOrder(JSONObject bodyJson);
}
...@@ -7,14 +7,14 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -7,14 +7,14 @@ import org.springframework.web.bind.annotation.PostMapping;
/** /**
* @description: * @description:
* @project: Freight * @project: Freight
* @name: com.esv.freight.app.feign.TmsInterface * @name: com.esv.freight.app.feign.TmsOrderInterface
* @author: 张志臣 * @author: 张志臣
* @email: zhangzhichen@esvtek.com * @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/21 10:00 * @createTime: 2020/04/21 10:00
* @version:1.0 * @version:1.0
*/ */
@FeignClient(value = "freight-tms-service") @FeignClient(value = "freight-tms-service")
public interface TmsInterface { public interface TmsOrderInterface {
/** /**
* 发布订单 * 发布订单
...@@ -45,8 +45,8 @@ public interface TmsInterface { ...@@ -45,8 +45,8 @@ public interface TmsInterface {
* @param bodyJson * @param bodyJson
* @return * @return
*/ */
@PostMapping(value = "tms/order/edit") @PostMapping(value = "tms/order/edit/owner")
JSONObject editOrder(JSONObject bodyJson); JSONObject editOrderOwner(JSONObject bodyJson);
/** /**
* 查询订单详情 * 查询订单详情
...@@ -57,18 +57,9 @@ public interface TmsInterface { ...@@ -57,18 +57,9 @@ public interface TmsInterface {
JSONObject getOrderDetail(JSONObject bodyJson); JSONObject getOrderDetail(JSONObject bodyJson);
/** /**
* 查询抢单信息列表 * 货主查询不同状态的订单数
* @param bodyJson
* @return
*/
@PostMapping(value = "tms/order/grabbing/list")
JSONObject getOrderGrabbingList(JSONObject bodyJson);
/**
* 司机抢单
* @param bodyJson
* @return * @return
*/ */
@PostMapping(value = "tms/order/grabbing/grab") @PostMapping(value = "tms/order/get/count")
JSONObject grabOrder(JSONObject bodyJson); JSONObject getOrderCount();
} }
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.TmsWaybillInterface
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/29 10:00
* @version:1.0
*/
@FeignClient(value = "freight-tms-service")
public interface TmsWaybillInterface {
/**
* 运单列表
* @param bodyJson
* @return
*/
@PostMapping(value = "tms/waybill/list")
JSONObject listWaybills(JSONObject bodyJson);
/**
* 运单详情
* @param bodyJson
* @return
*/
@PostMapping(value = "tms/waybill/detail")
JSONObject getWaybillDetail(JSONObject bodyJson);
/**
* 上传发货单据
* @param bodyJson
* @return
*/
@PostMapping(value = "tms/waybill/delivery/evidence/upload")
JSONObject uploadDeliveryEvidence(JSONObject bodyJson);
/**
* 上传收货单据
* @param bodyJson
* @return
*/
@PostMapping(value = "tms/waybill/receive/evidence/upload")
JSONObject uploadReceiveEvidence(JSONObject bodyJson);
/**
* 运单签收
* @param bodyJson
* @return
*/
@PostMapping(value = "tms/waybill/sign")
JSONObject sign(JSONObject bodyJson);
}
...@@ -5,9 +5,12 @@ import com.esv.freight.app.common.response.ECode; ...@@ -5,9 +5,12 @@ 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.feign.DictInterface; import com.esv.freight.app.feign.DriverInterface;
import com.esv.freight.app.feign.NoticeInterface; import com.esv.freight.app.feign.NoticeInterface;
import com.esv.freight.app.module.account.CustomToken;
import com.esv.freight.app.module.account.form.DriverAuthForm;
import com.esv.freight.app.module.account.form.LoginForm; import com.esv.freight.app.module.account.form.LoginForm;
import com.esv.freight.app.module.account.form.OwnerAuthForm;
import com.esv.freight.app.module.account.form.RefreshTokenForm; 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.service.AppLoginService;
import com.esv.freight.app.module.account.validator.groups.ValidatorLoginByPwd; import com.esv.freight.app.module.account.validator.groups.ValidatorLoginByPwd;
...@@ -34,15 +37,15 @@ import org.springframework.web.bind.annotation.*; ...@@ -34,15 +37,15 @@ import org.springframework.web.bind.annotation.*;
@Validated @Validated
public class DriverAccountController { public class DriverAccountController {
private DictInterface dictInterface; private DriverInterface driverInterface;
private NoticeInterface noticeInterface; private NoticeInterface noticeInterface;
private AppLoginService appLoginService; private AppLoginService appLoginService;
@Autowired @Autowired
public DriverAccountController(DictInterface dictInterface, NoticeInterface noticeInterface, AppLoginService appLoginService) { public DriverAccountController(DriverInterface driverInterface, NoticeInterface noticeInterface, AppLoginService appLoginService) {
this.dictInterface = dictInterface;
this.noticeInterface = noticeInterface; this.noticeInterface = noticeInterface;
this.appLoginService = appLoginService; this.appLoginService = appLoginService;
this.appLoginService = appLoginService;
} }
/** /**
...@@ -68,7 +71,15 @@ public class DriverAccountController { ...@@ -68,7 +71,15 @@ public class DriverAccountController {
return EResponse.error(resultCheck.getInteger("code"), resultCheck.getString("message")); return EResponse.error(resultCheck.getInteger("code"), resultCheck.getString("message"));
} }
// todo 调用注册帐号接口,等待司机管理服务接口 // 调用注册帐号接口
reqJson.clear();
reqJson.put("account", loginForm.getPhone());
JSONObject resultRegister = driverInterface.accountRegister(reqJson);
// 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()); LoginVO loginByPwdVO = appLoginService.login(loginForm.getPhone());
return EResponse.ok(loginByPwdVO); return EResponse.ok(loginByPwdVO);
...@@ -84,7 +95,15 @@ public class DriverAccountController { ...@@ -84,7 +95,15 @@ public class DriverAccountController {
@PostMapping("/login/loginByPwd") @PostMapping("/login/loginByPwd")
public EResponse loginByPwd(@RequestBody(required=false) @Validated(ValidatorLoginByPwd.class) LoginForm loginForm) { public EResponse loginByPwd(@RequestBody(required=false) @Validated(ValidatorLoginByPwd.class) LoginForm loginForm) {
// todo 调用帐号密码校验接口,等待司机管理服务接口 // 调用帐号密码校验接口
JSONObject reqJson = new JSONObject();
reqJson.put("account", loginForm.getPhone());
reqJson.put("password", loginForm.getPwd());
JSONObject result = driverInterface.checkAccountPwd(reqJson);
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
LoginVO loginByPwdVO = appLoginService.login(loginForm.getPhone()); LoginVO loginByPwdVO = appLoginService.login(loginForm.getPhone());
return EResponse.ok(loginByPwdVO); return EResponse.ok(loginByPwdVO);
...@@ -99,8 +118,8 @@ public class DriverAccountController { ...@@ -99,8 +118,8 @@ public class DriverAccountController {
**/ **/
@PostMapping("/logout") @PostMapping("/logout")
public EResponse logout() { public EResponse logout() {
String accessToken = ReqUtils.getTokenInfo().getAccessToken(); CustomToken customToken = ReqUtils.getTokenInfo();
appLoginService.logout(accessToken); appLoginService.logout(customToken.getAccessToken());
return EResponse.ok(); return EResponse.ok();
} }
...@@ -114,8 +133,8 @@ public class DriverAccountController { ...@@ -114,8 +133,8 @@ public class DriverAccountController {
@PostMapping("/token/refresh") @PostMapping("/token/refresh")
public EResponse refresh(@RequestBody(required=false) @Validated(ValidatorInsert.class) RefreshTokenForm refreshTokenForm) { public EResponse refresh(@RequestBody(required=false) @Validated(ValidatorInsert.class) RefreshTokenForm refreshTokenForm) {
String accessToken = ReqUtils.getTokenInfo().getAccessToken(); CustomToken customToken = ReqUtils.getTokenInfo();
LoginVO loginByPwdVO = appLoginService.refreshToken(accessToken, refreshTokenForm); LoginVO loginByPwdVO = appLoginService.refreshToken(customToken.getAccessToken(), refreshTokenForm);
return EResponse.ok(loginByPwdVO); return EResponse.ok(loginByPwdVO);
} }
...@@ -133,20 +152,81 @@ public class DriverAccountController { ...@@ -133,20 +152,81 @@ public class DriverAccountController {
return EResponse.error(ECode.TOKEN_EXPIRED); return EResponse.error(ECode.TOKEN_EXPIRED);
} }
String phone = ReqUtils.getTokenInfo().getAccount();
// 调用帐号密码校验接口
JSONObject reqJsonDetail = new JSONObject();
reqJsonDetail.put("account", phone);
log.info(reqJsonDetail.toJSONString());
JSONObject result = driverInterface.getAccountDetail(reqJsonDetail);
log.info(result.toJSONString());
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
DriverAccountDetailVO detailVO = new DriverAccountDetailVO(); DriverAccountDetailVO detailVO = new DriverAccountDetailVO();
detailVO.setId("12345678"); detailVO.setId(String.valueOf(result.getJSONObject("data").getLong("id")));
detailVO.setAccount("15040196726"); detailVO.setCarrierId(result.getJSONObject("data").getLong("carrierId"));
detailVO.setAuditStatus(1); detailVO.setAccount(result.getJSONObject("data").getString("account"));
detailVO.setSourceType("2"); detailVO.setSourceType(result.getJSONObject("data").getString("sourceType"));
detailVO.setName("测试666"); detailVO.setAuditStatus(result.getJSONObject("data").getInteger("auditStatus"));
detailVO.setIdCard("210112198707070023"); detailVO.setAuthenticateStatus(result.getJSONObject("data").getInteger("authenticateStatus"));
detailVO.setIdCardExpireDate("2030.02.05"); detailVO.setName(result.getJSONObject("data").getString("name"));
detailVO.setIdCardFileBackId("111"); detailVO.setIdCard(result.getJSONObject("data").getString("idCard"));
detailVO.setIdCardFileFrontId("222"); detailVO.setIdCardExpireDate(result.getJSONObject("data").getString("idCardExpireDate"));
detailVO.setProvinceCode("210000"); detailVO.setIdCardFrontUrl(result.getJSONObject("data").getString("idCardFrontUrl"));
detailVO.setCityCode("210100"); detailVO.setIdCardBackUrl(result.getJSONObject("data").getString("idCardBackUrl"));
detailVO.setDistrictCode("210104"); detailVO.setSettlementType(result.getJSONObject("data").getInteger("settlementType"));
detailVO.setDetailAddress("惠工街206号卓展中心"); detailVO.setSex(result.getJSONObject("data").getInteger("sex"));
detailVO.setBirthDate(result.getJSONObject("data").getString("birthDate"));
detailVO.setNation(result.getJSONObject("data").getString("nation"));
detailVO.setNativePlace(result.getJSONObject("data").getString("nativePlace"));
detailVO.setProvinceCode(result.getJSONObject("data").getString("provinceCode"));
detailVO.setCityCode(result.getJSONObject("data").getString("cityCode"));
detailVO.setDistrictCode(result.getJSONObject("data").getString("districtCode"));
detailVO.setDetailAddress(result.getJSONObject("data").getString("detailAddress"));
detailVO.setDrivingLicense(result.getJSONObject("data").getString("drivingLicense"));
detailVO.setDrivingLicenseType(result.getJSONObject("data").getInteger("drivingLicenseType"));
detailVO.setDrivingLicenseStartDate(result.getJSONObject("data").getString("drivingLicenseStartDate"));
detailVO.setDrivingLicenseEndDate(result.getJSONObject("data").getString("drivingLicenseEndDate"));
detailVO.setDrivingLicenseIssueDepartment(result.getJSONObject("data").getString("drivingLicenseIssueDepartment"));
detailVO.setDrivingLicenseInitDate(result.getJSONObject("data").getString("drivingLicenseInitDate"));
detailVO.setDrivingLicenseUrl(result.getJSONObject("data").getString("drivingLicenseUrl"));
detailVO.setCertificateVehicle(result.getJSONObject("data").getInteger("certificateVehicle"));
detailVO.setCertificateEndDate(result.getJSONObject("data").getString("certificateEndDate"));
detailVO.setCertificateNumber(result.getJSONObject("data").getString("certificateNumber"));
detailVO.setCertificateUrl(result.getJSONObject("data").getString("certificateUrl"));
return EResponse.ok(detailVO); return EResponse.ok(detailVO);
} }
/**
* description 帐号实名认证
* param [RealNameAuthForm]
* return com.esv.freight.common.response.EResponse
* author 张志臣
* createTime 2020/04/13 10:00
**/
@PostMapping("/realNameAuth")
public EResponse realNameAuth(@RequestBody(required=false) @Validated(ValidatorInsert.class) DriverAuthForm driverAuthForm) {
String accessToken = ReqUtils.getTokenInfo().getAccessToken();
if(appLoginService.isInvalidAccessToken(accessToken)) {
return EResponse.error(ECode.TOKEN_EXPIRED);
}
// 调用编辑帐号信息接口
JSONObject reqJson = new JSONObject();
reqJson.put("id", driverAuthForm.getId());
log.info(reqJson.toJSONString());
JSONObject result = driverInterface.updateAccountInfo(reqJson);
log.info(result.toJSONString());
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
return EResponse.ok();
}
} }
...@@ -2,9 +2,6 @@ package com.esv.freight.app.module.account.controller; ...@@ -2,9 +2,6 @@ package com.esv.freight.app.module.account.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.esv.freight.app.common.util.ReqUtils; import com.esv.freight.app.common.util.ReqUtils;
import com.esv.freight.app.common.util.SecurityUtils;
import com.esv.freight.app.feign.DictInterface;
import com.esv.freight.app.feign.FileInterface;
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.CustomToken; import com.esv.freight.app.module.account.CustomToken;
...@@ -37,19 +34,15 @@ import org.springframework.web.bind.annotation.*; ...@@ -37,19 +34,15 @@ import org.springframework.web.bind.annotation.*;
@Validated @Validated
public class OwnerAccountController { public class OwnerAccountController {
private DictInterface dictInterface;
private NoticeInterface noticeInterface;
private GoodsOwnerInterface goodsOwnerInterface; private GoodsOwnerInterface goodsOwnerInterface;
private NoticeInterface noticeInterface;
private AppLoginService appLoginService; private AppLoginService appLoginService;
private FileInterface fileInterface;
@Autowired @Autowired
public OwnerAccountController(FileInterface fileInterface, GoodsOwnerInterface goodsOwnerInterface, DictInterface dictInterface, NoticeInterface noticeInterface, AppLoginService appLoginService) { public OwnerAccountController(GoodsOwnerInterface goodsOwnerInterface, NoticeInterface noticeInterface, AppLoginService appLoginService) {
this.dictInterface = dictInterface;
this.goodsOwnerInterface = goodsOwnerInterface; this.goodsOwnerInterface = goodsOwnerInterface;
this.noticeInterface = noticeInterface; this.noticeInterface = noticeInterface;
this.appLoginService = appLoginService; this.appLoginService = appLoginService;
this.fileInterface = fileInterface;
} }
/** /**
...@@ -201,7 +194,7 @@ public class OwnerAccountController { ...@@ -201,7 +194,7 @@ public class OwnerAccountController {
* createTime 2020/04/13 10:00 * createTime 2020/04/13 10:00
**/ **/
@PostMapping("/realNameAuth") @PostMapping("/realNameAuth")
public EResponse realNameAuth(@RequestBody(required=false) @Validated(ValidatorInsert.class) RealNameAuthForm realNameAuthForm) { public EResponse realNameAuth(@RequestBody(required=false) @Validated(ValidatorInsert.class) OwnerAuthForm ownerAuthForm) {
String accessToken = ReqUtils.getTokenInfo().getAccessToken(); String accessToken = ReqUtils.getTokenInfo().getAccessToken();
if(appLoginService.isInvalidAccessToken(accessToken)) { if(appLoginService.isInvalidAccessToken(accessToken)) {
...@@ -210,27 +203,27 @@ public class OwnerAccountController { ...@@ -210,27 +203,27 @@ public class OwnerAccountController {
// 调用编辑帐号信息接口 // 调用编辑帐号信息接口
JSONObject reqJson = new JSONObject(); JSONObject reqJson = new JSONObject();
reqJson.put("id", realNameAuthForm.getId()); reqJson.put("id", ownerAuthForm.getId());
reqJson.put("ownerType", realNameAuthForm.getOwnerType()); reqJson.put("ownerType", ownerAuthForm.getOwnerType());
reqJson.put("contactor", realNameAuthForm.getName()); reqJson.put("contactor", ownerAuthForm.getName());
reqJson.put("idCard", realNameAuthForm.getIdCard()); reqJson.put("idCard", ownerAuthForm.getIdCard());
reqJson.put("idCardExpireDate", realNameAuthForm.getIdCardExpireDate()); reqJson.put("idCardExpireDate", ownerAuthForm.getIdCardExpireDate());
reqJson.put("idCardFrontUrl", realNameAuthForm.getIdCardFileFrontUrl()); reqJson.put("idCardFrontUrl", ownerAuthForm.getIdCardFileFrontUrl());
reqJson.put("idCardBackUrl", realNameAuthForm.getIdCardFileBackUrl()); reqJson.put("idCardBackUrl", ownerAuthForm.getIdCardFileBackUrl());
reqJson.put("detailAddress", realNameAuthForm.getDetailAddress()); reqJson.put("detailAddress", ownerAuthForm.getDetailAddress());
reqJson.put("provinceCode", realNameAuthForm.getProvinceCode()); reqJson.put("provinceCode", ownerAuthForm.getProvinceCode());
reqJson.put("cityCode", realNameAuthForm.getCityCode()); reqJson.put("cityCode", ownerAuthForm.getCityCode());
reqJson.put("districtCode", realNameAuthForm.getDistrictCode()); reqJson.put("districtCode", ownerAuthForm.getDistrictCode());
if("2".equals(realNameAuthForm.getOwnerType())) { if("2".equals(ownerAuthForm.getOwnerType())) {
reqJson.put("ownerFullName", realNameAuthForm.getOwnerFullName()); reqJson.put("ownerFullName", ownerAuthForm.getOwnerFullName());
reqJson.put("ownerBriefName", realNameAuthForm.getOwnerBriefName()); reqJson.put("ownerBriefName", ownerAuthForm.getOwnerBriefName());
reqJson.put("uniCreditCode", realNameAuthForm.getUniCreditCode()); reqJson.put("uniCreditCode", ownerAuthForm.getUniCreditCode());
reqJson.put("creditExpireDate", realNameAuthForm.getCreditExpireDate()); reqJson.put("creditExpireDate", ownerAuthForm.getCreditExpireDate());
reqJson.put("creditOriginalUrl", realNameAuthForm.getCreditOriginalUrl()); reqJson.put("creditOriginalUrl", ownerAuthForm.getCreditOriginalUrl());
reqJson.put("creditCopyUrl", realNameAuthForm.getCreditCopyUrl()); reqJson.put("creditCopyUrl", ownerAuthForm.getCreditCopyUrl());
reqJson.put("legalPerson", realNameAuthForm.getLegalPerson()); reqJson.put("legalPerson", ownerAuthForm.getLegalPerson());
reqJson.put("legalPhone", realNameAuthForm.getLegalPhone()); reqJson.put("legalPhone", ownerAuthForm.getLegalPhone());
} }
log.info(reqJson.toJSONString()); log.info(reqJson.toJSONString());
......
package com.esv.freight.app.module.account.form;
import com.esv.freight.app.common.validator.groups.ValidatorUpdate;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @description: 司机实名认证验证类
* @project: Freight
* @name: com.esv.freight.module.ownerBackend.account.form.DriverAuthForm
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/28 20:00
* @version:1.0
*/
@Data
public class DriverAuthForm {
/**
* 司机ID
*/
@NotNull(message = "参数id不能为空", groups = {ValidatorUpdate.class})
private Long id;
}
...@@ -13,16 +13,16 @@ import javax.validation.constraints.NotNull; ...@@ -13,16 +13,16 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
/** /**
* @description: 账号实名认证验证类 * @description: 货主实名认证验证类
* @project: Freight * @project: Freight
* @name: com.esv.freight.module.ownerBackend.account.form.RealNameAuthForm * @name: com.esv.freight.module.ownerBackend.account.form.OwnerAuthForm
* @author: 张志臣 * @author: 张志臣
* @email: zhangzhichen@esvtek.com * @email: zhangzhichen@esvtek.com
* @createTime: 2020/04/13 10:00 * @createTime: 2020/04/13 10:00
* @version:1.0 * @version:1.0
*/ */
@Data @Data
public class RealNameAuthForm { public class OwnerAuthForm {
/** /**
* 货主ID * 货主ID
......
...@@ -17,15 +17,21 @@ public class DriverAccountDetailVO { ...@@ -17,15 +17,21 @@ public class DriverAccountDetailVO {
// 账号ID // 账号ID
private String id; private String id;
// 登录帐号,货主手机号 // 承运商帐号ID
private Long carrierId;
// 登录帐号,司机手机号
private String account; private String account;
// 创建来源:1-平台创建、2-自行注册 // 创建来源:1-平台创建、2-自行注册
private String sourceType; private String sourceType;
// 货主帐号审核状态:0-待审核、1-审核成功,2-审核失败,APP自行注册需要平台审核 // 货主帐号审核状态:0-待审核、1-审核成功,2-审核失败
private Integer auditStatus; private Integer auditStatus;
// 认证状态:1-未认证、2-已认证
private Integer authenticateStatus;
// 姓名 // 姓名
private String name; private String name;
...@@ -35,21 +41,69 @@ public class DriverAccountDetailVO { ...@@ -35,21 +41,69 @@ public class DriverAccountDetailVO {
// 身份证有效期 格式yyyy.MM.dd,或长期 // 身份证有效期 格式yyyy.MM.dd,或长期
private String idCardExpireDate; private String idCardExpireDate;
// 身份证正面图片ID // 身份证正面图片URL
private String idCardFileFrontId; private String idCardFrontUrl;
// 身份证反面图片URL
private String idCardBackUrl;
// 结算对象(字典表):1-个人、2-所属承运商
private Integer settlementType;
// 性别(字典表):1-男、2-女、3-未知
private Integer sex;
// 身份证反面图片ID // 出生日期
private String idCardFileBackId; private String birthDate;
// 省份代码 // 民族
private String nation;
// 籍贯
private String nativePlace;
// 住址-省份代码
private String provinceCode; private String provinceCode;
// 市代码 // 住址-市代码
private String cityCode; private String cityCode;
// 区县代码 // 住址-区县代码
private String districtCode; private String districtCode;
// 详细地址 // 住址-详细地址
private String detailAddress; private String detailAddress;
// 驾驶证号码
private String drivingLicense;
// 驾驶证类型(字典表):1-A1、2-A2、3-A3、4-A1A2、5-A2E、6-A2D、7-B1、8-B2、9-C1、0-其他
private Integer drivingLicenseType;
// 驾驶证有效期起
private String drivingLicenseStartDate;
// 驾驶证有效期止
private String drivingLicenseEndDate;
// 发证机关
private String drivingLicenseIssueDepartment;
// 初次获得驾驶证日期
private String drivingLicenseInitDate;
// 驾驶证正面图片URL
private String drivingLicenseUrl;
// 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
private Integer certificateVehicle;
// 道路运输从业资格证-有效期止
private String certificateEndDate;
// 道路运输从业资格证-从业资格证号
private String certificateNumber;
// 道路运输从业资格证-正面图片URL
private String certificateUrl;
} }
...@@ -6,12 +6,12 @@ import com.esv.freight.app.common.response.ECode; ...@@ -6,12 +6,12 @@ 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.validator.groups.ValidatorList; import com.esv.freight.app.common.validator.groups.ValidatorList;
import com.esv.freight.app.common.validator.groups.ValidatorUpdate; import com.esv.freight.app.common.validator.groups.ValidatorUpdate;
import com.esv.freight.app.feign.TmsInterface; import com.esv.freight.app.feign.TmsGrabInterface;
import com.esv.freight.app.feign.TmsOrderInterface;
import com.esv.freight.app.module.account.service.AppLoginService; import com.esv.freight.app.module.account.service.AppLoginService;
import com.esv.freight.app.module.grabbing.form.OrderGrabbingQueryForm; import com.esv.freight.app.module.grabbing.form.OrderGrabbingQueryForm;
import com.esv.freight.app.module.grabbing.vo.GrabListItemVO; import com.esv.freight.app.module.grabbing.vo.GrabListItemVO;
import com.esv.freight.app.module.grabbing.vo.GrabListVO; import com.esv.freight.app.module.grabbing.vo.GrabListVO;
import com.esv.freight.app.module.order.vo.OrderStatisticsVO;
import com.mysql.cj.util.StringUtils; import com.mysql.cj.util.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -37,12 +37,12 @@ import java.util.List; ...@@ -37,12 +37,12 @@ import java.util.List;
public class GrabController { public class GrabController {
private AppLoginService appLoginService; private AppLoginService appLoginService;
private TmsInterface tmsInterface; private TmsGrabInterface tmsGrabInterface;
@Autowired @Autowired
public GrabController(TmsInterface tmsInterface, AppLoginService appLoginService) { public GrabController(TmsGrabInterface tmsGrabInterface, AppLoginService appLoginService) {
this.appLoginService = appLoginService; this.appLoginService = appLoginService;
this.tmsInterface = tmsInterface; this.tmsGrabInterface = tmsGrabInterface;
} }
/** /**
...@@ -83,7 +83,7 @@ public class GrabController { ...@@ -83,7 +83,7 @@ public class GrabController {
reqJson.put("pageNum", orderGrabbingQueryForm.getPageNum()); reqJson.put("pageNum", orderGrabbingQueryForm.getPageNum());
reqJson.put("pageSize", orderGrabbingQueryForm.getPageSize()); reqJson.put("pageSize", orderGrabbingQueryForm.getPageSize());
log.info(reqJson.toJSONString()); log.info(reqJson.toJSONString());
JSONObject result = tmsInterface.getOrderGrabbingList(reqJson); JSONObject result = tmsGrabInterface.getOrderGrabbingList(reqJson);
log.info(result.toJSONString()); log.info(result.toJSONString());
if(result.getInteger("code") != 200) { if(result.getInteger("code") != 200) {
...@@ -134,7 +134,7 @@ public class GrabController { ...@@ -134,7 +134,7 @@ public class GrabController {
JSONObject reqJson = new JSONObject(); JSONObject reqJson = new JSONObject();
reqJson.put("orderGrabbingId", orderGrabbingQueryForm.getOrderId()); reqJson.put("orderGrabbingId", orderGrabbingQueryForm.getOrderId());
log.info(reqJson.toJSONString()); log.info(reqJson.toJSONString());
JSONObject result = tmsInterface.grabOrder(reqJson); JSONObject result = tmsGrabInterface.grabOrder(reqJson);
log.info(result.toJSONString()); log.info(result.toJSONString());
if(result.getInteger("code") != 200) { if(result.getInteger("code") != 200) {
......
...@@ -9,7 +9,7 @@ import com.esv.freight.app.common.validator.groups.ValidatorDetail; ...@@ -9,7 +9,7 @@ import com.esv.freight.app.common.validator.groups.ValidatorDetail;
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.ValidatorList; import com.esv.freight.app.common.validator.groups.ValidatorList;
import com.esv.freight.app.common.validator.groups.ValidatorUpdate; import com.esv.freight.app.common.validator.groups.ValidatorUpdate;
import com.esv.freight.app.feign.TmsInterface; import com.esv.freight.app.feign.TmsOrderInterface;
import com.esv.freight.app.module.account.service.AppLoginService; import com.esv.freight.app.module.account.service.AppLoginService;
import com.esv.freight.app.module.order.form.OrderForm; 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.form.OrderQueryForm;
...@@ -41,10 +41,10 @@ import java.util.List; ...@@ -41,10 +41,10 @@ import java.util.List;
public class OrderController { public class OrderController {
private AppLoginService appLoginService; private AppLoginService appLoginService;
private TmsInterface tmsInterface; private TmsOrderInterface tmsInterface;
@Autowired @Autowired
public OrderController(TmsInterface tmsInterface, AppLoginService appLoginService) { public OrderController(TmsOrderInterface tmsInterface, AppLoginService appLoginService) {
this.appLoginService = appLoginService; this.appLoginService = appLoginService;
this.tmsInterface = tmsInterface; this.tmsInterface = tmsInterface;
} }
...@@ -64,12 +64,21 @@ public class OrderController { ...@@ -64,12 +64,21 @@ public class OrderController {
return EResponse.error(ECode.TOKEN_EXPIRED); return EResponse.error(ECode.TOKEN_EXPIRED);
} }
// 调用货主查询不同状态的订单数接口
JSONObject result = tmsInterface.getOrderCount();
log.info(result.toJSONString());
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
OrderStatisticsVO orderStatisticsVO = new OrderStatisticsVO(); OrderStatisticsVO orderStatisticsVO = new OrderStatisticsVO();
orderStatisticsVO.setCancelled(6); JSONObject data = result.getJSONObject("data");
orderStatisticsVO.setComplete(5); orderStatisticsVO.setCancelled(data.getInteger("cancelledCount"));
orderStatisticsVO.setExecuting(3); orderStatisticsVO.setComplete(data.getInteger("finishedCount"));
orderStatisticsVO.setPending(6); orderStatisticsVO.setExecuting(data.getInteger("executingCount"));
orderStatisticsVO.setPublished(10); orderStatisticsVO.setPending(data.getInteger("auditPendingCount"));
orderStatisticsVO.setPublished(data.getInteger("addedCount"));
return EResponse.ok(orderStatisticsVO); return EResponse.ok(orderStatisticsVO);
} }
...@@ -160,7 +169,7 @@ public class OrderController { ...@@ -160,7 +169,7 @@ public class OrderController {
reqJson.put("goodsType", orderForm.getGoodsType()); reqJson.put("goodsType", orderForm.getGoodsType());
reqJson.put("goodsNameCode", orderForm.getGoodsNameCode()); reqJson.put("goodsNameCode", orderForm.getGoodsNameCode());
reqJson.put("goodsDetail", orderForm.getGoodsDetail()); reqJson.put("goodsDetail", orderForm.getGoodsDetail());
reqJson.put("goodsTotalAmount", orderForm.getGoodsTotalAmount()); reqJson.put("totalGoodsAmount", orderForm.getGoodsTotalAmount());
reqJson.put("goodsUnit", orderForm.getGoodsUnit()); reqJson.put("goodsUnit", orderForm.getGoodsUnit());
reqJson.put("goodsUnitPrice", orderForm.getGoodsUnitPrice()); reqJson.put("goodsUnitPrice", orderForm.getGoodsUnitPrice());
reqJson.put("freightUnitPriceInput", orderForm.getFreightUnitPriceInput()); reqJson.put("freightUnitPriceInput", orderForm.getFreightUnitPriceInput());
...@@ -250,7 +259,7 @@ public class OrderController { ...@@ -250,7 +259,7 @@ public class OrderController {
orderDetailVO.setGoodsNameCode(data.getInteger("goodsNameCode")); orderDetailVO.setGoodsNameCode(data.getInteger("goodsNameCode"));
orderDetailVO.setGoodsNameCode(data.getInteger("goodsNameCode")); orderDetailVO.setGoodsNameCode(data.getInteger("goodsNameCode"));
orderDetailVO.setGoodsDetail(data.getString("goodsDetail")); orderDetailVO.setGoodsDetail(data.getString("goodsDetail"));
orderDetailVO.setGoodsTotalAmount(data.getBigDecimal("goodsTotalAmount")); orderDetailVO.setGoodsTotalAmount(data.getBigDecimal("totalGoodsAmount"));
orderDetailVO.setGoodsUnit(data.getInteger("goodsUnit")); orderDetailVO.setGoodsUnit(data.getInteger("goodsUnit"));
orderDetailVO.setGoodsUnitPrice(data.getBigDecimal("goodsUnitPrice")); orderDetailVO.setGoodsUnitPrice(data.getBigDecimal("goodsUnitPrice"));
orderDetailVO.setFreightUnitPriceInput(data.getBigDecimal("freightUnitPriceInput")); orderDetailVO.setFreightUnitPriceInput(data.getBigDecimal("freightUnitPriceInput"));
...@@ -288,7 +297,7 @@ public class OrderController { ...@@ -288,7 +297,7 @@ public class OrderController {
reqJson.put("goodsType", orderForm.getGoodsType()); reqJson.put("goodsType", orderForm.getGoodsType());
reqJson.put("goodsNameCode", orderForm.getGoodsNameCode()); reqJson.put("goodsNameCode", orderForm.getGoodsNameCode());
reqJson.put("goodsDetail", orderForm.getGoodsDetail()); reqJson.put("goodsDetail", orderForm.getGoodsDetail());
reqJson.put("goodsTotalAmount", orderForm.getGoodsTotalAmount()); reqJson.put("totalGoodsAmount", orderForm.getGoodsTotalAmount());
reqJson.put("goodsUnit", orderForm.getGoodsUnit()); reqJson.put("goodsUnit", orderForm.getGoodsUnit());
reqJson.put("goodsUnitPrice", orderForm.getGoodsUnitPrice()); reqJson.put("goodsUnitPrice", orderForm.getGoodsUnitPrice());
reqJson.put("freightUnitPriceInput", orderForm.getFreightUnitPriceInput()); reqJson.put("freightUnitPriceInput", orderForm.getFreightUnitPriceInput());
...@@ -301,7 +310,7 @@ public class OrderController { ...@@ -301,7 +310,7 @@ public class OrderController {
reqJson.put("vehicleLength", orderForm.getVehicleLength()); reqJson.put("vehicleLength", orderForm.getVehicleLength());
reqJson.put("remark", orderForm.getRemark()); reqJson.put("remark", orderForm.getRemark());
log.info(reqJson.toJSONString()); log.info(reqJson.toJSONString());
JSONObject result = tmsInterface.editOrder(reqJson); JSONObject result = tmsInterface.editOrderOwner(reqJson);
log.info(result.toJSONString()); log.info(result.toJSONString());
if(result.getInteger("code") != 200) { if(result.getInteger("code") != 200) {
......
...@@ -79,12 +79,6 @@ public class VehicleForm { ...@@ -79,12 +79,6 @@ public class VehicleForm {
@Range(min = 1000, max = 5000, message = "参数vehicleHeight不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class}) @Range(min = 1000, max = 5000, message = "参数vehicleHeight不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数vehicleHeight不能为空", groups = {ValidatorInsert.class}) @NotNull(message = "参数vehicleHeight不能为空", groups = {ValidatorInsert.class})
private Integer vehicleHeight; private Integer vehicleHeight;
/**
* 车辆所属(字典表):1-自有车、2-外协车
*/
@Range(min = 1, max = 2, message = "参数vehicleBelong不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数vehicleBelong不能为空", groups = {ValidatorInsert.class})
private Integer vehicleBelong;
/** /**
* 年审日期 * 年审日期
*/ */
......
...@@ -21,14 +21,12 @@ public class VehicleListItemVO { ...@@ -21,14 +21,12 @@ public class VehicleListItemVO {
* *
*/ */
private Long id; private Long id;
/** /**
* 车牌号 * 车牌号
*/ */
private String licenseNumber; private String licenseNumber;
/**
* 车辆状态:1-正常、2-停用
*/
private String vehicleStatus;
/** /**
* 审核状态(字典表):0-待审核、1-审核成功,2-审核失败 * 审核状态(字典表):0-待审核、1-审核成功,2-审核失败
*/ */
...@@ -41,30 +39,10 @@ public class VehicleListItemVO { ...@@ -41,30 +39,10 @@ public class VehicleListItemVO {
* 二级车辆类型(字典表) * 二级车辆类型(字典表)
*/ */
private Integer vehicleType2; private Integer vehicleType2;
/**
* 行驶证档案编号
*/
private String vehicleLicenseNumber;
/**
* 道路运输证号
*/
private String roadCertificateNumber;
/** /**
* 核定载质量(吨) * 核定载质量(吨)
*/ */
private BigDecimal loadCapacity; private BigDecimal loadCapacity;
/**
* 创建来源:1-平台创建、2-司机创建
*/
private String sourceType;
/**
* 创建者
*/
private String createUser;
/**
* 创建时间
*/
private Long createTime;
@Override @Override
public String toString() { public String toString() {
......
...@@ -4,7 +4,7 @@ import com.esv.freight.app.common.response.ECode; ...@@ -4,7 +4,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.validator.groups.ValidatorDetail; import com.esv.freight.app.common.validator.groups.ValidatorDetail;
import com.esv.freight.app.common.validator.groups.ValidatorList; import com.esv.freight.app.common.validator.groups.ValidatorList;
import com.esv.freight.app.feign.TmsInterface; import com.esv.freight.app.feign.TmsOrderInterface;
import com.esv.freight.app.module.account.service.AppLoginService; import com.esv.freight.app.module.account.service.AppLoginService;
import com.esv.freight.app.module.waybill.form.WaybillQueryForm; import com.esv.freight.app.module.waybill.form.WaybillQueryForm;
import com.esv.freight.app.module.waybill.vo.WaybillListItemVO; import com.esv.freight.app.module.waybill.vo.WaybillListItemVO;
...@@ -35,7 +35,7 @@ import java.util.List; ...@@ -35,7 +35,7 @@ import java.util.List;
public class DriverWaybillController { public class DriverWaybillController {
private AppLoginService appLoginService; private AppLoginService appLoginService;
private TmsInterface tmsInterface; private TmsOrderInterface tmsInterface;
private WaybillListVO mWaybillListVO; private WaybillListVO mWaybillListVO;
...@@ -53,8 +53,6 @@ public class DriverWaybillController { ...@@ -53,8 +53,6 @@ public class DriverWaybillController {
itemVO.setGoodsTotalAmount(new BigDecimal(26)); itemVO.setGoodsTotalAmount(new BigDecimal(26));
itemVO.setGoodsUnit("吨"); itemVO.setGoodsUnit("吨");
itemVO.setCreateTime(new Date()); itemVO.setCreateTime(new Date());
itemVO.setRequiredReceiveTime(new Date());
itemVO.setRequiredDeliveryTime(new Date());
itemVO.setVehicleNum("辽A12345"); itemVO.setVehicleNum("辽A12345");
verifyList.add(itemVO); verifyList.add(itemVO);
...@@ -66,7 +64,7 @@ public class DriverWaybillController { ...@@ -66,7 +64,7 @@ public class DriverWaybillController {
} }
@Autowired @Autowired
public DriverWaybillController(TmsInterface tmsInterface, AppLoginService appLoginService) { public DriverWaybillController(TmsOrderInterface tmsInterface, AppLoginService appLoginService) {
this.appLoginService = appLoginService; this.appLoginService = appLoginService;
this.tmsInterface = tmsInterface; this.tmsInterface = tmsInterface;
createTestData(); createTestData();
......
package com.esv.freight.app.module.waybill.controller; package com.esv.freight.app.module.waybill.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.esv.freight.app.common.response.ECode; 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.validator.groups.ValidatorInsert; import com.esv.freight.app.common.util.ReqUtils;
import com.esv.freight.app.common.validator.groups.ValidatorList; import com.esv.freight.app.common.validator.groups.ValidatorList;
import com.esv.freight.app.feign.TmsInterface; import com.esv.freight.app.feign.TmsOrderInterface;
import com.esv.freight.app.feign.TmsWaybillInterface;
import com.esv.freight.app.module.account.service.AppLoginService; import com.esv.freight.app.module.account.service.AppLoginService;
import com.esv.freight.app.module.order.form.OrderQueryForm;
import com.esv.freight.app.module.waybill.form.WaybillQueryForm; import com.esv.freight.app.module.waybill.form.WaybillQueryForm;
import com.esv.freight.app.module.waybill.vo.WaybillListItemVO; import com.esv.freight.app.module.waybill.vo.WaybillListItemVO;
import com.esv.freight.app.module.waybill.vo.WaybillListVO; import com.esv.freight.app.module.waybill.vo.WaybillListVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -37,41 +39,12 @@ import java.util.List; ...@@ -37,41 +39,12 @@ import java.util.List;
public class OwnerWaybillController { public class OwnerWaybillController {
private AppLoginService appLoginService; private AppLoginService appLoginService;
private TmsInterface tmsInterface; private TmsWaybillInterface tmsWaybillInterface;
private WaybillListVO mWaybillListVO;
private void createTestData() {
mWaybillListVO = new WaybillListVO();
List<WaybillListItemVO> verifyList = new ArrayList<>();
WaybillListItemVO itemVO = new WaybillListItemVO();
itemVO.setId(10056L);
itemVO.setWaybillNO("YD202004221300002");
itemVO.setOrderNO("D2020042109300101");
itemVO.setWaybillState(5);
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.setVehicleNum("辽A12345");
verifyList.add(itemVO);
mWaybillListVO.setPageNum(1L);
mWaybillListVO.setPageSize(20L);
mWaybillListVO.setTotal(1L);
mWaybillListVO.setRecordSize(1L);
mWaybillListVO.setRecord(verifyList);
}
@Autowired @Autowired
public OwnerWaybillController(TmsInterface tmsInterface, AppLoginService appLoginService) { public OwnerWaybillController(TmsWaybillInterface tmsWaybillInterface, AppLoginService appLoginService) {
this.appLoginService = appLoginService; this.appLoginService = appLoginService;
this.tmsInterface = tmsInterface; this.tmsWaybillInterface = tmsWaybillInterface;
createTestData();
} }
/** /**
...@@ -82,12 +55,58 @@ public class OwnerWaybillController { ...@@ -82,12 +55,58 @@ public class OwnerWaybillController {
* createTime 2020/04/22 15:00 * createTime 2020/04/22 15:00
**/ **/
@PostMapping("/list") @PostMapping("/list")
public EResponse list(@RequestHeader("Union-Authorization") String accessToken, @RequestBody(required=false) @Validated(ValidatorList.class) WaybillQueryForm waybillQueryForm) { public EResponse list(@RequestBody(required=false) @Validated(ValidatorList.class) WaybillQueryForm waybillQueryForm) {
String accessToken = ReqUtils.getTokenInfo().getAccessToken();
if(appLoginService.isInvalidAccessToken(accessToken)) { if(appLoginService.isInvalidAccessToken(accessToken)) {
return EResponse.error(ECode.TOKEN_EXPIRED); return EResponse.error(ECode.TOKEN_EXPIRED);
} }
return EResponse.ok(mWaybillListVO); // 调用运单列表分页查询接口
JSONObject reqJson = new JSONObject();
reqJson.put("goodsOwnerId", waybillQueryForm.getUserId());
reqJson.put("pageNum", waybillQueryForm.getPageNum());
reqJson.put("pageSize", waybillQueryForm.getPageSize());
if(!StringUtils.isEmpty(waybillQueryForm.getOrderNo())) {
reqJson.put("orderNo", waybillQueryForm.getOrderNo());
}
log.info(reqJson.toJSONString());
JSONObject result = tmsWaybillInterface.listWaybills(reqJson);
log.info(result.toJSONString());
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
WaybillListVO pageResultVO = new WaybillListVO();
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<WaybillListItemVO> records = new ArrayList<>();
for(int i=0; i<items.size(); ++i) {
WaybillListItemVO vo = new WaybillListItemVO();
JSONObject object = items.getJSONObject(i);
vo.setId(object.getLong("id"));
vo.setWaybillNO(object.getString("waybillNO"));
vo.setOrderNO(object.getString("orderNo"));
vo.setWaybillState(object.getInteger("waybillState"));
vo.setDeliveryCity(object.getString("deliveryCityCode"));
vo.setReceiveCity(object.getString("receiveCityCode"));
vo.setGoodsName(object.getInteger("goodsNameCode"));
vo.setGoodsTotalAmount(object.getBigDecimal("goodsAmount"));
vo.setGoodsUnit(object.getString("goodsUnit"));
vo.setCreateTime(object.getDate("createTime"));
vo.setVehicleId(object.getString("vehicleId"));
vo.setVehicleNum(object.getString("vehicleLicenseNo"));
records.add(vo);
}
pageResultVO.setRecord(records);
}
return EResponse.ok(pageResultVO);
} }
} }
...@@ -10,6 +10,7 @@ import org.hibernate.validator.constraints.Range; ...@@ -10,6 +10,7 @@ import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive; import javax.validation.constraints.Positive;
import java.util.List;
/** /**
* @description: * @description:
...@@ -49,11 +50,9 @@ public class WaybillQueryForm { ...@@ -49,11 +50,9 @@ public class WaybillQueryForm {
private String orderNo; private String orderNo;
/** /**
* 运单状态 * 运单状态:1-装货中、2-运输中、3-已交货、4-已签收、5-已回单、6-已作废
*/ */
@Positive(message = "参数运单状态不合法", groups = {ValidatorList.class}) private List<Integer> waybillStateList;
@Range(min = 1, max = 100, message = "无效的运单状态", groups = {ValidatorList.class})
private Integer waybillState;
/** /**
* 当前页数 * 当前页数
......
...@@ -23,7 +23,7 @@ public class WaybillListItemVO { ...@@ -23,7 +23,7 @@ public class WaybillListItemVO {
private Long id; private Long id;
/** /**
* 运单号 * 运单号,YD+”8位日期“+”6位序号“
*/ */
private String waybillNO; private String waybillNO;
...@@ -33,7 +33,7 @@ public class WaybillListItemVO { ...@@ -33,7 +33,7 @@ public class WaybillListItemVO {
private String orderNO; private String orderNO;
/** /**
* 运单状态 * 运单状态 1-装货中;2-运输中;3-已交货;4-已签收;5-已回单;6-已作废
*/ */
private Integer waybillState; private Integer waybillState;
...@@ -63,22 +63,17 @@ public class WaybillListItemVO { ...@@ -63,22 +63,17 @@ public class WaybillListItemVO {
private String goodsUnit; private String goodsUnit;
/** /**
* 要求发货时间 * 运单生成时间
*/
private Date requiredDeliveryTime;
/**
* 要求交货时间
*/ */
private Date requiredReceiveTime; private Date createTime;
/** /**
* 运单生成时间 * 执行车辆ID
*/ */
private Date createTime; private String vehicleId;
/** /**
* 执行车辆 * 执行车辆车牌号
*/ */
private String vehicleNum; private String vehicleNum;
} }
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