Przeglądaj źródła

修改运力和线路

txf 3 lat temu
rodzic
commit
5b4d76552e

+ 4 - 33
src/main/java/com/steerinfo/dil/controller/RmsCapacityController.java

@@ -128,46 +128,17 @@ public class RmsCapacityController extends BaseRESTfulController {
                                                Integer pageSize,
                                                String con,
                                                String carrierSSOId) {
-        int count = 0;
-        if (mapValue==null){
-            mapValue=new HashMap<>();
-        }
         if(carrierSSOId != null){
             if(!"null".equals(carrierSSOId)) {
                 mapValue.put("carrierSSOId", carrierSSOId);
-                count++;
             }
         }
-        //框计算
-        if (con != null) {
-            if (!"undefined".equals(con)) {
-                //设置要查询的索引名称
-                String index = "get_capacity_list";
-                //获取查询结果
-                return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con));
+        if(con != null){
+            if(!"".equals(con)){
+                mapValue.put("index", con);
             }
         }
-        //初始化过滤
-        List<Map<String, Object>> listTotal = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if (mapValue.size() == count) {
-            //将查询结果存入索引中
-            listTotal = rmsCapacityService.getCapacityList(null);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index", "get_capacity_list");
-            //添加id
-            map.put("indexId", "capacityId");
-            listTotal.add(map);
-            //新建索引
-            String s = JSON.toJSONString(listTotal);
-            esFeign.insertIndex(listTotal);
-            //删除
-            listTotal.remove(listTotal.size() - 1);
-        }
-        if (listTotal == null) {
-            listTotal = rmsCapacityService.getCapacityList(mapValue);
-        }
+        List<Map<String, Object>> listTotal = rmsCapacityService.getCapacityList(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = rmsCapacityService.getCapacityList(mapValue);

+ 8 - 42
src/main/java/com/steerinfo/dil/controller/RmsLineController.java

@@ -10,6 +10,7 @@ import com.steerinfo.dil.service.IRmsLineService;
 
 import com.steerinfo.dil.util.BaseRESTfulController;
 import com.steerinfo.dil.util.ColumnDataUtil;
+import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.dil.util.PageListAdd;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageHelper;
@@ -20,6 +21,7 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.models.auth.In;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
@@ -72,32 +74,13 @@ public class RmsLineController extends BaseRESTfulController {
                                         Integer pageSize,
                                         Integer apiId,
                                         String con){
-        //框计算
+
         if(con != null){
-            if(!"undefined".equals(con)){
-                String index="get_line_list";    //设置要查询的索引名称
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
+            if(!"".equals(con)){
+                mapValue.put("index", con);
             }
         }
-        List<Map<String,Object>> list = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == 0){
-            //将查询结果存入索引中
-            list = rmsLineMapper.getAllLineDesk(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_line_list");
-            //添加id
-            map.put("indexId","lineId");
-            list.add(map);
-            //新建索引
-            esFeign.insertIndex(list);
-            //删除
-            list.remove(list.size()-1);
-        }
-        if(list == null) {
-            list = rmsLineMapper.getAllLineDesk(mapValue);
-        }
+        List<Map<String, Object>>  list = rmsLineMapper.getAllLineDesk(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = rmsLineMapper.getAllLineDesk(mapValue);
@@ -115,6 +98,7 @@ public class RmsLineController extends BaseRESTfulController {
             @ApiImplicitParam(name = "mapValue", value = "运输路线", required = false, dataType = "Map"),
     })
     @PostMapping("/insertSelective")
+    @Transactional
     public RESTfulResult insertSelective(@RequestBody(required = false) Map<String,Object> mapVal){
         // 创建运输路线主表实体
         RmsLine rmsLine = new RmsLine();
@@ -136,24 +120,7 @@ public class RmsLineController extends BaseRESTfulController {
         //存放到运输路线主表实体中
         rmsLine.setLineEndNodeId(new BigDecimal(lineEndNodeId));
         //生成运输线路编号
-        String lineNo = "";
-        if(lineId < 10){
-            lineNo = "YSXL0000000"+lineId;
-        }else if(lineId >= 10 || lineId <100){
-            lineNo = "YSXL000000"+lineId;
-        }else if(lineId >= 100 || lineId <1000){
-            lineNo = "YSXL00000"+lineId;
-        }else if(lineId >= 1000 || lineId <10000){
-            lineNo = "YSXL0000"+lineId;
-        }else if(lineId >= 10000 || lineId <100000){
-            lineNo = "YSXL000"+lineId;
-        }else if(lineId >= 100000 || lineId <1000000){
-            lineNo = "YSXL00"+lineId;
-        }else if(lineId >= 1000000 || lineId <10000000){
-            lineNo = "YSXL0"+lineId;
-        }else if(lineId >= 10000000 || lineId <100000000){
-            lineNo = "YSXL"+lineId;
-        }
+        String lineNo = DataChange.generateEightDigitsNumber("YSXL", lineId);
         //将运输线路存放进运输线路主表实体中
         rmsLine.setLineNo(lineNo);
         //逻辑删除(0为未删除,1为删除)
@@ -205,7 +172,6 @@ public class RmsLineController extends BaseRESTfulController {
     @ApiOperation(value = "修改运输线路信息")
     @PostMapping("/updateByPrimaryKeySelective")
     public RESTfulResult updateByPrimaryKeySelective(@RequestBody(required = false) Map<String,Object> mapVal) {
-        //创建一个运输线路主表实体
         RmsLine rmsLine = new RmsLine();
         //拿到前端传递的运输线路主表id
         Integer lineId = (Integer) mapVal.get("lineId");

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -1,7 +1,7 @@
 api.version: api/v1/rms
 spring:
   profiles:
-    include: ${SPRING_PROFILES:prod}
+    include: ${SPRING_PROFILES:dev}
   jackson:
       date-format: yyyy-MM-dd HH:mm:ss
       time-zone: GMT+8

+ 3 - 0
src/main/resources/com/steerinfo/dil/mapper/RmsCapacityMapper.xml

@@ -725,6 +725,9 @@
       <if test="carrierSSOId != null">
         and RCA.CARRIER_SSO_ID = #{carrierSSOId}
       </if>
+      <if test="index != null">
+        and instr(RC.CAPACITY_NUMBER, #{index}) > 0
+      </if>
     ORDER BY RC.INSERT_TIME DESC
     )
     <where>

+ 3 - 1
src/main/resources/com/steerinfo/dil/mapper/RmsLineMapper.xml

@@ -578,10 +578,12 @@
     FROM
       RMS_LINE RL
     WHERE RL.DELETED = 0
+        <if test="index != null">
+          and instr(RL.LINE_NAME, #{index}) > 0
+        </if>
         )
     <where>
       <if test="lineNo != null">
-        and
         <foreach collection="lineNo" item="item" open="(" separator="or" close=")">
           "lineNo" like '%${item}%'
         </foreach>