作者 王勇

结合前端,简单修改

@@ -5,7 +5,7 @@ server: @@ -5,7 +5,7 @@ server:
5 spring: 5 spring:
6 servlet: 6 servlet:
7 multipart: 7 multipart:
8 - max-file-size: 100MB 8 + max-file-size: 1000MB
9 security: 9 security:
10 user: 10 user:
11 name: admin 11 name: admin
@@ -21,8 +21,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; @@ -21,8 +21,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
21 * 下次再次访问的话,就是读取缓存。 21 * 下次再次访问的话,就是读取缓存。
22 * <p> 22 * <p>
23 * 缓存雪崩:是指在某一特殊时刻,缓存中的缓存全部失效,然后这一时刻又有大量的数据库访问,导致数据库不堪重负。 23 * 缓存雪崩:是指在某一特殊时刻,缓存中的缓存全部失效,然后这一时刻又有大量的数据库访问,导致数据库不堪重负。
24 - * 解决方案:根据业务的不同设置不同的缓存失效时间。  
25 - * 比如:这个项目,做了3个namespace的缓存,其中一个namespace,共有5个Mapper指向它。所以选择使用范围内的随机值,来做缓存失效时间 24 + * 解决方案:根据业务的不同设置不同的缓存失效时间。故,选择使用范围内的随机值,来做缓存失效时间
26 * <p> 25 * <p>
27 * 时间:2020/8/6 9:37 26 * 时间:2020/8/6 9:37
28 */ 27 */
@@ -7,4 +7,6 @@ package com.sunyo.wlpt.vehicle.manage.common; @@ -7,4 +7,6 @@ package com.sunyo.wlpt.vehicle.manage.common;
7 */ 7 */
8 public class Common { 8 public class Common {
9 public static final String RESULT_SUCCESS = "200"; 9 public static final String RESULT_SUCCESS = "200";
  10 + public static final String RETURN_MESSAGE_UNEXAMINED = "备案未审核";
  11 + public static final String RETURN_MESSAGE_EXAMINED = "备案成功";
10 } 12 }
@@ -34,7 +34,7 @@ public class SwaggerConfig { @@ -34,7 +34,7 @@ public class SwaggerConfig {
34 return new ApiInfoBuilder() 34 return new ApiInfoBuilder()
35 .title("车辆管理服务") 35 .title("车辆管理服务")
36 .description("车辆管理服务") 36 .description("车辆管理服务")
37 - .termsOfServiceUrl("http://localhost:10001/") 37 + .termsOfServiceUrl("http://localhost:8678/")
38 .contact("子诚") 38 .contact("子诚")
39 .version("1.0.0") 39 .version("1.0.0")
40 .build(); 40 .build();
@@ -23,6 +23,14 @@ public class CorporationController { @@ -23,6 +23,14 @@ public class CorporationController {
23 @Resource 23 @Resource
24 private LandCorporationInfoService landCorporationInfoService; 24 private LandCorporationInfoService landCorporationInfoService;
25 25
  26 + /**
  27 + * 分页查询
  28 + *
  29 + * @param coCode 企业代码
  30 + * @param pageNum 当前页数
  31 + * @param pageSize 每页大小
  32 + * @return
  33 + */
26 @ApiOperation(value = "企业信息,分页查询") 34 @ApiOperation(value = "企业信息,分页查询")
27 @GetMapping("/page") 35 @GetMapping("/page")
28 public ResultJson selectListByPage(@RequestParam(value = "coCode", required = false) String coCode, 36 public ResultJson selectListByPage(@RequestParam(value = "coCode", required = false) String coCode,
@@ -61,7 +69,8 @@ public class CorporationController { @@ -61,7 +69,8 @@ public class CorporationController {
61 public ResultJson batchRemoveCorporation(@RequestBody LandCorporationInfo landCorporationInfo) 69 public ResultJson batchRemoveCorporation(@RequestBody LandCorporationInfo landCorporationInfo)
62 { 70 {
63 String id = landCorporationInfo.getId(); 71 String id = landCorporationInfo.getId();
64 - return id.contains(",") ? landCorporationInfoService.batchRemoveByIds(id) 72 + return id.contains(",")
  73 + ? landCorporationInfoService.batchRemoveByIds(id)
65 : landCorporationInfoService.deleteByPrimaryKey(id); 74 : landCorporationInfoService.deleteByPrimaryKey(id);
66 } 75 }
67 76
@@ -90,5 +99,4 @@ public class CorporationController { @@ -90,5 +99,4 @@ public class CorporationController {
90 { 99 {
91 return landCorporationInfoService.insertSelective(landCorporationInfo); 100 return landCorporationInfoService.insertSelective(landCorporationInfo);
92 } 101 }
93 -  
94 } 102 }
@@ -107,6 +107,7 @@ public class TrailerController { @@ -107,6 +107,7 @@ public class TrailerController {
107 } 107 }
108 108
109 /** 109 /**
  110 + * 该接口,目前就是个Demo,仅提供样式
110 * 上传图片,以后有了文件管理系统,接口弃用 111 * 上传图片,以后有了文件管理系统,接口弃用
111 * 112 *
112 * @param file 文件 113 * @param file 文件
@@ -106,4 +106,18 @@ public class VehicleController { @@ -106,4 +106,18 @@ public class VehicleController {
106 { 106 {
107 return landRoadVeRecordService.updateByPrimaryKeySelective(landRoadVeRecord); 107 return landRoadVeRecordService.updateByPrimaryKeySelective(landRoadVeRecord);
108 } 108 }
  109 +
  110 + /**
  111 + * 审批车辆
  112 + * 新增 or 修改之后的车辆信息,都需被审批之后,才能设置为备案成功
  113 + *
  114 + * @param landRoadVeRecord 已备案但未审批通过的车辆
  115 + * @return
  116 + */
  117 + @ApiOperation(value = "车辆信息,审批")
  118 + @PutMapping("/approval")
  119 + public ResultJson approvalLandRoadVeRecord(@RequestBody LandRoadVeRecord landRoadVeRecord)
  120 + {
  121 + return landRoadVeRecordService.approvalLandRoadVeRecord(landRoadVeRecord);
  122 + }
109 } 123 }
1 package com.sunyo.wlpt.vehicle.manage.domain; 1 package com.sunyo.wlpt.vehicle.manage.domain;
2 2
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
3 import io.swagger.annotations.ApiModel; 4 import io.swagger.annotations.ApiModel;
4 import io.swagger.annotations.ApiModelProperty; 5 import io.swagger.annotations.ApiModelProperty;
5 6
@@ -65,6 +66,7 @@ public class LandCorporationInfo implements Serializable { @@ -65,6 +66,7 @@ public class LandCorporationInfo implements Serializable {
65 * 批准/许可批文有效期 66 * 批准/许可批文有效期
66 */ 67 */
67 @ApiModelProperty(value = "批准/许可批文有效期") 68 @ApiModelProperty(value = "批准/许可批文有效期")
  69 + @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
68 private Date apprValidTime; 70 private Date apprValidTime;
69 71
70 /** 72 /**
1 package com.sunyo.wlpt.vehicle.manage.domain; 1 package com.sunyo.wlpt.vehicle.manage.domain;
2 2
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
3 import io.swagger.annotations.ApiModel; 4 import io.swagger.annotations.ApiModel;
4 import io.swagger.annotations.ApiModelProperty; 5 import io.swagger.annotations.ApiModelProperty;
5 6
@@ -68,6 +69,7 @@ public class LandRoadDrRecord implements Serializable { @@ -68,6 +69,7 @@ public class LandRoadDrRecord implements Serializable {
68 * 出生日期 69 * 出生日期
69 */ 70 */
70 @ApiModelProperty(value = "出生日期") 71 @ApiModelProperty(value = "出生日期")
  72 + @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
71 private Date birthday; 73 private Date birthday;
72 74
73 /** 75 /**
@@ -92,6 +94,7 @@ public class LandRoadDrRecord implements Serializable { @@ -92,6 +94,7 @@ public class LandRoadDrRecord implements Serializable {
92 * 申请时间 94 * 申请时间
93 */ 95 */
94 @ApiModelProperty(value = "申请时间") 96 @ApiModelProperty(value = "申请时间")
  97 + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
95 private Date proposeTime; 98 private Date proposeTime;
96 99
97 /** 100 /**
@@ -77,4 +77,13 @@ public interface LandRoadVeRecordService { @@ -77,4 +77,13 @@ public interface LandRoadVeRecordService {
77 * @return 77 * @return
78 */ 78 */
79 ResultJson batchRemoveByIds(String ids); 79 ResultJson batchRemoveByIds(String ids);
  80 +
  81 + /**
  82 + * 审批车辆
  83 + * 新增 or 修改之后的车辆信息,都需被审批之后,才能设置为备案成功
  84 + *
  85 + * @param landRoadVeRecord 已备案但未审批通过的车辆
  86 + * @return 成功 or 失败
  87 + */
  88 + ResultJson approvalLandRoadVeRecord(LandRoadVeRecord landRoadVeRecord);
80 } 89 }
@@ -12,6 +12,7 @@ import com.sunyo.wlpt.vehicle.manage.mapper.LandCorporationInfoMapper; @@ -12,6 +12,7 @@ import com.sunyo.wlpt.vehicle.manage.mapper.LandCorporationInfoMapper;
12 import com.sunyo.wlpt.vehicle.manage.domain.LandCorporationInfo; 12 import com.sunyo.wlpt.vehicle.manage.domain.LandCorporationInfo;
13 import com.sunyo.wlpt.vehicle.manage.service.LandCorporationInfoService; 13 import com.sunyo.wlpt.vehicle.manage.service.LandCorporationInfoService;
14 14
  15 +import java.util.Date;
15 import java.util.List; 16 import java.util.List;
16 17
17 /** 18 /**
@@ -75,9 +76,10 @@ public class LandCorporationInfoServiceImpl implements LandCorporationInfoServic @@ -75,9 +76,10 @@ public class LandCorporationInfoServiceImpl implements LandCorporationInfoServic
75 } 76 }
76 77
77 @Override 78 @Override
78 - public ResultJson updateByPrimaryKeySelective(LandCorporationInfo record) 79 + public ResultJson updateByPrimaryKeySelective(LandCorporationInfo corporationInfo)
79 { 80 {
80 - return landCorporationInfoMapper.updateByPrimaryKeySelective(record) > 0 81 + corporationInfo.setUpdateDate(new Date());
  82 + return landCorporationInfoMapper.updateByPrimaryKeySelective(corporationInfo) > 0
81 ? ResultJson.success("200", "编辑企业信息,成功") 83 ? ResultJson.success("200", "编辑企业信息,成功")
82 : ResultJson.error("500", "编辑企业信息,失败"); 84 : ResultJson.error("500", "编辑企业信息,失败");
83 } 85 }
@@ -14,6 +14,7 @@ import com.sunyo.wlpt.vehicle.manage.mapper.LandRoadDrRecordMapper; @@ -14,6 +14,7 @@ import com.sunyo.wlpt.vehicle.manage.mapper.LandRoadDrRecordMapper;
14 import com.sunyo.wlpt.vehicle.manage.domain.LandRoadDrRecord; 14 import com.sunyo.wlpt.vehicle.manage.domain.LandRoadDrRecord;
15 import com.sunyo.wlpt.vehicle.manage.service.LandRoadDrRecordService; 15 import com.sunyo.wlpt.vehicle.manage.service.LandRoadDrRecordService;
16 16
  17 +import java.util.Date;
17 import java.util.List; 18 import java.util.List;
18 19
19 /** 20 /**
@@ -101,6 +102,7 @@ public class LandRoadDrRecordServiceImpl implements LandRoadDrRecordService { @@ -101,6 +102,7 @@ public class LandRoadDrRecordServiceImpl implements LandRoadDrRecordService {
101 if (!Common.RESULT_SUCCESS.equals(validate.getCode())) { 102 if (!Common.RESULT_SUCCESS.equals(validate.getCode())) {
102 return validate; 103 return validate;
103 } 104 }
  105 + landRoadDrRecord.setUpdateDate(new Date());
104 106
105 return landRoadDrRecordMapper.updateByPrimaryKeySelective(landRoadDrRecord) > 0 107 return landRoadDrRecordMapper.updateByPrimaryKeySelective(landRoadDrRecord) > 0
106 ? ResultJson.success("200", "编辑驾驶员信息,成功") 108 ? ResultJson.success("200", "编辑驾驶员信息,成功")
@@ -15,6 +15,7 @@ import com.sunyo.wlpt.vehicle.manage.domain.LandRoadTrailerRecord; @@ -15,6 +15,7 @@ import com.sunyo.wlpt.vehicle.manage.domain.LandRoadTrailerRecord;
15 import com.sunyo.wlpt.vehicle.manage.mapper.LandRoadTrailerRecordMapper; 15 import com.sunyo.wlpt.vehicle.manage.mapper.LandRoadTrailerRecordMapper;
16 import com.sunyo.wlpt.vehicle.manage.service.LandRoadTrailerRecordService; 16 import com.sunyo.wlpt.vehicle.manage.service.LandRoadTrailerRecordService;
17 17
  18 +import java.util.Date;
18 import java.util.List; 19 import java.util.List;
19 20
20 /** 21 /**
@@ -77,6 +78,9 @@ public class LandRoadTrailerRecordServiceImpl implements LandRoadTrailerRecordSe @@ -77,6 +78,9 @@ public class LandRoadTrailerRecordServiceImpl implements LandRoadTrailerRecordSe
77 return validate; 78 return validate;
78 } 79 }
79 landRoadTrailerRecord.setId(IdUtils.generateId()); 80 landRoadTrailerRecord.setId(IdUtils.generateId());
  81 + // TODO:需要备案审核,每次更新,都需要备案审核
  82 +
  83 +
80 return landRoadTrailerRecordMapper.insertSelective(landRoadTrailerRecord) > 0 84 return landRoadTrailerRecordMapper.insertSelective(landRoadTrailerRecord) > 0
81 ? ResultJson.success("200", "新增挂车信息,成功") 85 ? ResultJson.success("200", "新增挂车信息,成功")
82 : ResultJson.error("500", "新增挂车信息失败"); 86 : ResultJson.error("500", "新增挂车信息失败");
@@ -107,6 +111,7 @@ public class LandRoadTrailerRecordServiceImpl implements LandRoadTrailerRecordSe @@ -107,6 +111,7 @@ public class LandRoadTrailerRecordServiceImpl implements LandRoadTrailerRecordSe
107 if (!Common.RESULT_SUCCESS.equals(validate.getCode())) { 111 if (!Common.RESULT_SUCCESS.equals(validate.getCode())) {
108 return validate; 112 return validate;
109 } 113 }
  114 + landRoadTrailerRecord.setUpdateDate(new Date());
110 115
111 return landRoadTrailerRecordMapper.updateByPrimaryKeySelective(landRoadTrailerRecord) > 0 116 return landRoadTrailerRecordMapper.updateByPrimaryKeySelective(landRoadTrailerRecord) > 0
112 ? ResultJson.success("200", "编辑挂车信息,成功") 117 ? ResultJson.success("200", "编辑挂车信息,成功")
@@ -16,6 +16,7 @@ import com.sunyo.wlpt.vehicle.manage.mapper.LandRoadVeRecordMapper; @@ -16,6 +16,7 @@ import com.sunyo.wlpt.vehicle.manage.mapper.LandRoadVeRecordMapper;
16 import com.sunyo.wlpt.vehicle.manage.domain.LandRoadVeRecord; 16 import com.sunyo.wlpt.vehicle.manage.domain.LandRoadVeRecord;
17 import com.sunyo.wlpt.vehicle.manage.service.LandRoadVeRecordService; 17 import com.sunyo.wlpt.vehicle.manage.service.LandRoadVeRecordService;
18 18
  19 +import java.util.Date;
19 import java.util.List; 20 import java.util.List;
20 21
21 /** 22 /**
@@ -63,21 +64,23 @@ public class LandRoadVeRecordServiceImpl implements LandRoadVeRecordService { @@ -63,21 +64,23 @@ public class LandRoadVeRecordServiceImpl implements LandRoadVeRecordService {
63 64
64 /** 65 /**
65 * 新增 66 * 新增
  67 + * <p>
  68 + * 新增 or 修改,车辆信息,设置为 备案未审核。需被审批之后,才能设置为 备案成功
66 * 69 *
67 - * @param record the record 70 + * @param landRoadVeRecord 车辆信息
68 * @return 71 * @return
69 */ 72 */
70 @Override 73 @Override
71 - public ResultJson insertSelective(LandRoadVeRecord record) 74 + public ResultJson insertSelective(LandRoadVeRecord landRoadVeRecord)
72 { 75 {
73 - ResultJson validateInsert = validate(record); 76 + ResultJson validateInsert = validate(landRoadVeRecord);
74 if (!Common.RESULT_SUCCESS.equals(validateInsert.getCode())) { 77 if (!Common.RESULT_SUCCESS.equals(validateInsert.getCode())) {
75 return validateInsert; 78 return validateInsert;
76 } 79 }
77 - record.setId(IdUtils.generateId());  
78 - // TODO: 添加车辆信息的具体逻辑 80 + landRoadVeRecord.setId(IdUtils.generateId());
  81 + landRoadVeRecord.setReturnmessage(Common.RETURN_MESSAGE_UNEXAMINED);
79 82
80 - return landRoadVeRecordMapper.insertSelective(record) > 0 83 + return landRoadVeRecordMapper.insertSelective(landRoadVeRecord) > 0
81 ? ResultJson.success("200", "添加车辆信息,成功") 84 ? ResultJson.success("200", "添加车辆信息,成功")
82 : ResultJson.error("500", "添加车辆信息,失败"); 85 : ResultJson.error("500", "添加车辆信息,失败");
83 } 86 }
@@ -90,18 +93,25 @@ public class LandRoadVeRecordServiceImpl implements LandRoadVeRecordService { @@ -90,18 +93,25 @@ public class LandRoadVeRecordServiceImpl implements LandRoadVeRecordService {
90 93
91 /** 94 /**
92 * 选择性编辑,By 主键 95 * 选择性编辑,By 主键
  96 + * <p>
  97 + * 新增 or 修改,车辆信息,设置为 备案未审核。需被审批之后,才能设置为 备案成功
  98 + * <p>
  99 + * 数据库中明明设置了更新操作,会自动更新,修改时间。但是竟然没有生效
93 * 100 *
94 - * @param record the updated record 101 + * @param landRoadVeRecord 车辆信息
95 * @return 102 * @return
96 */ 103 */
97 @Override 104 @Override
98 - public ResultJson updateByPrimaryKeySelective(LandRoadVeRecord record) 105 + public ResultJson updateByPrimaryKeySelective(LandRoadVeRecord landRoadVeRecord)
99 { 106 {
100 - ResultJson validateEdit = validate(record); 107 + ResultJson validateEdit = validate(landRoadVeRecord);
101 if (!Common.RESULT_SUCCESS.equals(validateEdit.getCode())) { 108 if (!Common.RESULT_SUCCESS.equals(validateEdit.getCode())) {
102 return validateEdit; 109 return validateEdit;
103 } 110 }
104 - return landRoadVeRecordMapper.updateByPrimaryKeySelective(record) > 0 111 + landRoadVeRecord.setReturnmessage(Common.RETURN_MESSAGE_UNEXAMINED);
  112 + landRoadVeRecord.setUpdateDate(new Date());
  113 +
  114 + return landRoadVeRecordMapper.updateByPrimaryKeySelective(landRoadVeRecord) > 0
105 ? ResultJson.success("200", "编辑车辆信息,成功") 115 ? ResultJson.success("200", "编辑车辆信息,成功")
106 : ResultJson.error("500", "编辑车辆信息,失败"); 116 : ResultJson.error("500", "编辑车辆信息,失败");
107 } 117 }
@@ -181,6 +191,10 @@ public class LandRoadVeRecordServiceImpl implements LandRoadVeRecordService { @@ -181,6 +191,10 @@ public class LandRoadVeRecordServiceImpl implements LandRoadVeRecordService {
181 } 191 }
182 } 192 }
183 } 193 }
  194 + if (!StringUtil.isNullOrEmpty(trailerLicenseNo) && landRoadTrailerRecordMapper.selectByTrailerLicenseNo(trailerLicenseNo).size() == 0) {
  195 + return ResultJson.error("400", "该挂车信息不存在,请仔细检查");
  196 + }
  197 +
184 if (!domesticLisenceNo.equals(oldVe.getDomesticLisenceNo())) { 198 if (!domesticLisenceNo.equals(oldVe.getDomesticLisenceNo())) {
185 if (landRoadVeRecordMapper.selectByDomesticLisenceNo(domesticLisenceNo).size() > 0) { 199 if (landRoadVeRecordMapper.selectByDomesticLisenceNo(domesticLisenceNo).size() > 0) {
186 return ResultJson.error("400", "该车辆信息(车牌号),已存在"); 200 return ResultJson.error("400", "该车辆信息(车牌号),已存在");
@@ -208,8 +222,35 @@ public class LandRoadVeRecordServiceImpl implements LandRoadVeRecordService { @@ -208,8 +222,35 @@ public class LandRoadVeRecordServiceImpl implements LandRoadVeRecordService {
208 return ResultJson.error("400", "该挂车已经被使用,请仔细检查"); 222 return ResultJson.error("400", "该挂车已经被使用,请仔细检查");
209 } 223 }
210 } 224 }
  225 + if (!StringUtil.isNullOrEmpty(trailerLicenseNo) &&
  226 + landRoadTrailerRecordMapper.selectByTrailerLicenseNo(trailerLicenseNo).size() == 0) {
  227 + return ResultJson.error("400", "该挂车信息不存在,请仔细检查");
  228 + }
211 return landRoadVeRecordMapper.selectByDomesticLisenceNo(domesticLisenceNo).size() > 0 229 return landRoadVeRecordMapper.selectByDomesticLisenceNo(domesticLisenceNo).size() > 0
212 ? ResultJson.error("400", "校验失败,该国内车牌号已存在") 230 ? ResultJson.error("400", "校验失败,该国内车牌号已存在")
213 : ResultJson.success("校验通过"); 231 : ResultJson.success("校验通过");
214 } 232 }
  233 +
  234 + /**
  235 + * 审批车辆
  236 + * <p>
  237 + * 已备案成功的车辆信息,无需再次备案
  238 + *
  239 + * @param landRoadVeRecord 已备案但未审批通过的车辆
  240 + * @return
  241 + */
  242 + @Override
  243 + public ResultJson approvalLandRoadVeRecord(LandRoadVeRecord landRoadVeRecord)
  244 + {
  245 + if (Common.RETURN_MESSAGE_EXAMINED.equals(landRoadVeRecord.getReturnmessage())) {
  246 + return ResultJson.error("400", "该车辆已备案成功,无需再次审批!");
  247 + }
  248 +
  249 + landRoadVeRecord.setReturnmessage(Common.RETURN_MESSAGE_EXAMINED);
  250 + landRoadVeRecord.setUpdateDate(new Date());
  251 +
  252 + return landRoadVeRecordMapper.updateByPrimaryKeySelective(landRoadVeRecord) > 0
  253 + ? ResultJson.success("200", "车辆信息,审批通过,备案成功!")
  254 + : ResultJson.error("500", "车辆信息,审批失败,请稍后重试!");
  255 + }
215 } 256 }