Przeglądaj źródła

省市区接口修改,工单补录参数校验修改

别傲 5 lat temu
rodzic
commit
65b93647bf

+ 6 - 7
lift-business-service/src/main/java/cn/com/ty/lift/business/common/CommonController.java

@@ -7,8 +7,9 @@ import cn.com.ty.lift.business.framework.conf.SystemConfiguration;
 import cn.com.ty.lift.business.framework.util.MessageUtils;
 import cn.com.ty.lift.business.library.dao.entity.LiftBrand;
 import cn.com.ty.lift.business.maintenance.service.MaintenancePlanService;
+import cn.com.ty.lift.business.project.dao.entity.model.AreaCodeDTO;
+import cn.com.ty.lift.business.project.dao.mapper.AreaCodeMapper;
 import cn.com.ty.lift.common.constants.RedisConstants;
-import cn.com.ty.lift.common.model.AreaCode;
 import cn.com.ty.lift.common.utils.ValuePool;
 import cn.com.ty.lift.common.verify.Validate;
 import cn.com.ty.lift.common.verify.Validation;
@@ -47,6 +48,7 @@ public class CommonController {
     private EmergencyRepairService        emergencyRepairService;
     private CapitalRepairLiftRelevanceService capitalRepairLiftRelevanceService;
     private MaintenancePlanService maintenancePlanService;
+    private AreaCodeMapper codeMapper;
 
     /**
      * @return RestResponse 省、市、区树形结构列表
@@ -54,12 +56,9 @@ public class CommonController {
      * @date 2019/12/4 10:23 AM
      */
     @PostMapping("area/list")
-    @SuppressWarnings("unchecked")
-    public RestResponse areaList() {
-        List<AreaCode> areaCodeList = (List<AreaCode>) redisTemplate.opsForValue().get(RedisConstants.RK_AREA_LIST);
-        if (ObjectUtil.isEmpty(areaCodeList)) {
-            return RestResponse.success();
-        }
+    @Validation(fields = {"code"})
+    public RestResponse areaList(@Val @RequestBody CommonRequest commonRequest) {
+        List<AreaCodeDTO> areaCodeList = codeMapper.queryAreaList(commonRequest.getCode());
         return RestResponse.success(areaCodeList, MessageUtils.get("msg.query.success"));
     }
 

+ 7 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/common/CommonRequest.java

@@ -3,6 +3,7 @@ package cn.com.ty.lift.business.common;
 import lombok.Data;
 
 import javax.validation.constraints.Min;
+import javax.validation.constraints.NotEmpty;
 
 /**
  * TODO
@@ -26,4 +27,10 @@ public class CommonRequest {
      * 当前用户角色code
      */
     private String currentRoleCode;
+
+    /**
+     * 省市区编码
+     */
+    @NotEmpty(message = "省市区编码不能为空")
+    private String code;
 }

+ 1 - 2
lift-business-service/src/main/java/cn/com/ty/lift/business/contract/controller/PaymentController.java

@@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import javax.validation.Valid;
 
 /**
  * @author bieao
@@ -113,7 +112,7 @@ public class PaymentController {
      */
     @PostMapping("history/list")
     @Validation(fields = {"contractId"})
-    public RestResponse historyList(@Valid @RequestBody PaymentRequest request) {
+    public RestResponse historyList(@Val @RequestBody PaymentRequest request) {
         IPage<PaymentHistoryResponse> page = paymentHistoryService.list(request);
         return RestResponse.success(page, MessageUtils.get("msg.query.success"));
     }

+ 2 - 1
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/controller/MaintenanceRecordController.java

@@ -226,7 +226,8 @@ public class MaintenanceRecordController {
      * @return RestResponse
      */
     @PostMapping("tofill")
-    public RestResponse tofill(@Valid @RequestBody MaintenanceRecord entity) {
+    @Validation(fields = {"mtCompanyId", "mtPlanId", "liftId", "liftType", "type", "workDate", "stopDate", "mtRecordCosts", "sparepart", "partsCost"})
+    public RestResponse tofill(@Val @RequestBody MaintenanceRecord entity) {
         MaintenancePlan plan = maintenancePlanService.getById(entity.getMtPlanId());
         Validate.notNull(plan, ValuePool.MAINTENANCE_PLAN_NOT_EXIST);
         entity.setWorkerId(plan.getWorkerId());

+ 22 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/project/dao/entity/model/AreaCodeDTO.java

@@ -0,0 +1,22 @@
+package cn.com.ty.lift.business.project.dao.entity.model;
+
+import lombok.Data;
+
+/**
+ * @author bieao
+ * @date 2020/5/19
+ * @description 省市区返回实体
+ */
+@Data
+public class AreaCodeDTO {
+
+    /**
+     * 编码
+     */
+    private String code;
+
+    /**
+     * 名称
+     */
+    private String name;
+}

+ 6 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/project/dao/mapper/AreaCodeMapper.java

@@ -1,7 +1,11 @@
 package cn.com.ty.lift.business.project.dao.mapper;
 
 import cn.com.ty.lift.business.project.dao.entity.AreaCode;
+import cn.com.ty.lift.business.project.dao.entity.model.AreaCodeDTO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +17,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface AreaCodeMapper extends BaseMapper<AreaCode> {
 
+    @Select("SELECT code,name FROM area_code WHERE parent = #{code}")
+    List<AreaCodeDTO> queryAreaList(String code);
 }

+ 1 - 1
lift-system-service/src/main/java/cn/com/ty/lift/system/framework/runner/SystemServiceRunner.java

@@ -43,7 +43,7 @@ public class SystemServiceRunner implements ApplicationRunner {
     @Override
     public void run(ApplicationArguments args) {
         //初始化省、市、区信息列表
-        initAreaList();
+        //initAreaList();
         //初始化全局设置到redis
         initGlobalSet();
     }