瀏覽代碼

Merge remote-tracking branch 'origin/master'

hejiahui 2 年之前
父節點
當前提交
373cc9e854

+ 1 - 0
src/main/java/com/steerinfo/dil/controller/AmsSaleOrderController.java

@@ -764,6 +764,7 @@ public class AmsSaleOrderController extends BaseRESTfulController {
         try {
             result = amsSaleOrderService.dispatchSteelOrder(mapList);
         } catch (Exception e) {
+            e.printStackTrace();
             return failed(e.getMessage());
         }
         if (result == 0) {

+ 61 - 10
src/main/java/com/steerinfo/dil/controller/DilNoticeController.java

@@ -1,6 +1,5 @@
 package com.steerinfo.dil.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.steerinfo.dil.feign.ESFeign;
 import com.steerinfo.dil.model.DilNotice;
 import com.steerinfo.dil.service.IDilNoticeService;
@@ -15,9 +14,10 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.lang.reflect.Parameter;
-import java.util.*;
 import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * DilNotice RESTful接口:
@@ -85,9 +85,12 @@ public class DilNoticeController extends BaseRESTfulController {
     public RESTfulResult getMarketingNoticeList(@RequestBody(required = false) Map<String,Object> mapVal,
                                        Integer pageNum,
                                        Integer pageSize,
-                                       Integer apiId){
+                                       Integer apiId,String con){
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
+        if (con!=null&&!(con.equals("undefined"))){
+            mapVal.put("con", "%" + con + "%");
+        }
         List<Map<String, Object>> columnList = dilNoticeService.getMarketingNoticeList(mapVal);
         PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
         return success(data);
@@ -105,9 +108,13 @@ public class DilNoticeController extends BaseRESTfulController {
     public RESTfulResult getCarrierNoticeList(@RequestBody(required = false) Map<String,Object> mapVal,
                                               Integer pageNum,
                                               Integer pageSize,
-                                              Integer apiId){
+                                              Integer apiId,
+                                              String con){
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
+        if (con!=null&&!(con.equals("undefined"))){
+            mapVal.put("con", "%" + con + "%");
+        }
         List<Map<String, Object>> columnList = dilNoticeService.getCarrierNoticeList(mapVal);
         PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
         return success(data);
@@ -124,9 +131,13 @@ public class DilNoticeController extends BaseRESTfulController {
     public RESTfulResult getClientNoticeList(@RequestBody(required = false) Map<String,Object> mapVal,
                                                 Integer pageNum,
                                                 Integer pageSize,
-                                                Integer apiId){
+                                                Integer apiId,
+                                             String con){
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
+        if (con!=null&&!(con.equals("undefined"))){
+            mapVal.put("con", "%" + con + "%");
+        }
         List<Map<String, Object>> columnList = dilNoticeService.getClientNoticeList(mapVal);
         PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
         return success(data);
@@ -146,6 +157,22 @@ public class DilNoticeController extends BaseRESTfulController {
         return success(result);
     }
 
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-26
+     * @Description:发布通知
+    */
+    @ApiOperation(value="发布通知", notes="根据DilNotice对象发布通知")
+    @ApiImplicitParam(name = "dilNotice", value = "详细实体dilNotice", required = true, dataType = "DilNotice")
+    @PostMapping(value = "/releaseNotice")
+    public RESTfulResult releaseNotice(@RequestBody DilNotice dilNotice){
+        int result = dilNoticeService.releaseNotice(dilNotice);
+        if (result==0){
+            return failed("失败");
+        }
+        return success(result);
+    }
 
 
     /**
@@ -164,6 +191,12 @@ public class DilNoticeController extends BaseRESTfulController {
         return success(result);
     }
 
+    @PostMapping(value = "/updateNoticeStatus")
+    public RESTfulResult updateNoticeStatus(@RequestBody(required = false) Map<String, Object> map){
+        String userId = (String) map.get("userId");
+        int result = dilNoticeService.updateNoticeStatus(userId);
+        return success(result);
+    }
 
     /**
      * 根据id删除通知信息
@@ -177,6 +210,17 @@ public class DilNoticeController extends BaseRESTfulController {
         return success(dilNoticeService.deleteNotice(id));
     }
 
+    /**
+     * 根据userId获取用户名字
+     * @param userId
+     * @return
+     */
+    @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
+    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short")
+    @PostMapping(value = "/queryName/{userId}")
+    public RESTfulResult queryName(@PathVariable("userId") String userId){
+        return success(dilNoticeService.queryName(userId));
+    }
 
 
     /**
@@ -240,10 +284,17 @@ public class DilNoticeController extends BaseRESTfulController {
     @ApiOperation(value = "查询通知信息", notes = "根据传过来的orgcode查询")
     @PostMapping(value = "/getNotice")
     public RESTfulResult getNotice(@RequestBody(required = false) Map<String, Object> mapValue){
-        /*String orgcode= (String) mapValue.get("orgcodezs");
-        List<Map<String, Object>> noticeData = dilNoticeService.getNoticeData(orgcode);
-        return success(noticeData);*/
-        return null;
+        //String orgcode= (String) mapValue.get("orgcodezs");
+        String userId="";
+        if (mapValue!=null){
+            userId=(String) mapValue.get("userId");
+        }
+        if ("".equals(userId)){
+            return failed();
+        }
+        List<Map<String, Object>> noticeData = dilNoticeService.getNoticeData(userId);
+        return success(noticeData);
+        //return null;
     }
 
 

+ 18 - 0
src/main/java/com/steerinfo/dil/feign/OtmsFeign.java

@@ -0,0 +1,18 @@
+package com.steerinfo.dil.feign;
+
+import com.steerinfo.framework.controller.RESTfulResult;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@FeignClient(value = "DAL-OTMS-API-DEV", url = "${openfeign.OTMSFeign.url}")
+public interface OtmsFeign {
+
+    @GetMapping("/api/v1/otms/pathDisplay/getCurrentLocation")
+    RESTfulResult getCurrentLocation(@RequestParam("capcityNumber") String capcityNumber) throws Exception;
+
+}

+ 1 - 0
src/main/java/com/steerinfo/dil/mapper/AmsSaleOrderMapper.java

@@ -178,4 +178,5 @@ public interface AmsSaleOrderMapper extends IBaseMapper<AmsSaleOrder, BigDecimal
 
     int updateSaleOrderStatus(String saleNumber);
 
+    Integer getDispachSwitch();
 }

+ 73 - 1
src/main/java/com/steerinfo/dil/mapper/DilNoticeMapper.java

@@ -36,7 +36,7 @@ public interface DilNoticeMapper extends IBaseMapper<DilNotice, BigDecimal> {
      * @Date:
      * @Description: 根据不同的用户发放通知
     */
-    List<Map<String, Object>> getNoticeData(BigDecimal permission);
+    List<Map<String, Object>> getNoticeData(String userId);
     /**
      * @author:zyf
      * @version:1.0
@@ -44,4 +44,76 @@ public interface DilNoticeMapper extends IBaseMapper<DilNotice, BigDecimal> {
      * @Description: 根据不同的用户发放通知1
      */
     List<Map<String, Object>> getNoticeData1();
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-23
+     * @Description:新增通知(承运商,销售客户,收货客户)
+    */
+    int insertIntoNoticeUser(DilNotice dilNotice);
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-23
+     * @Description:新增通知(所有人)
+    */
+    int insertIntoNoticeUser1(DilNotice dilNotice);
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-23
+     * @Description:更新通知的相关信息
+    */
+    int updateNotice(DilNotice dilNotice);
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-23
+     * @Description:删除与该通知有关用户中间表的信息
+    */
+    int deleteNoticeUsers(BigDecimal id);
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-23
+     * @Description:删除与该通知表的信息
+     */
+    int deleteNotice(BigDecimal id);
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-24
+     * @Description:根据通知ID来查询orgcode
+    */
+    String getorgCode(BigDecimal noticeid);
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-26
+     * @Description:根据通知ID来查询历史orgcode
+     */
+    String gethistoryorgCode(BigDecimal noticeid);
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-24
+     * @Description:根据用户id来更新状态
+    */
+    int updatestatus(String userId);
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-26
+     * @Description:根据用户ID来查询名字
+    */
+    String queryName(String userId);
 }

+ 31 - 8
src/main/java/com/steerinfo/dil/model/DilNotice.java

@@ -68,7 +68,7 @@ public class DilNotice implements IBasePO<BigDecimal> {
      * 查看权限状态码(PERMISSION,DECIMAL,38)
      */
     @ApiModelProperty(value="查看权限状态码",required=false)
-    private BigDecimal permission;
+    private String permission;
 
     /**
      * 查看权限状态描述(PERMISSION,DECIMAL,38)
@@ -76,6 +76,28 @@ public class DilNotice implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="查看权限状态码描述",required=false)
     private String permissions;
 
+    @ApiModelProperty(value="存放用户名ID",required=false)
+    private String userId;
+
+    @ApiModelProperty(value="存放历史信息",required=false)
+    private String historicalChanges;
+
+    public String getHistoricalChanges() {
+        return historicalChanges;
+    }
+
+    public void setHistoricalChanges(String historicalChanges) {
+        this.historicalChanges = historicalChanges;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -112,6 +134,14 @@ public class DilNotice implements IBasePO<BigDecimal> {
         this.noticeContent = noticeContent == null ? null : noticeContent.trim();
     }
 
+    public String getPermission() {
+        return permission;
+    }
+
+    public void setPermission(String permission) {
+        this.permission = permission;
+    }
+
     public String getInsertUsername() {
         return insertUsername;
     }
@@ -160,13 +190,6 @@ public class DilNotice implements IBasePO<BigDecimal> {
         this.deleted = deleted;
     }
 
-    public BigDecimal getPermission() {
-        return permission;
-    }
-
-    public void setPermission(BigDecimal permission) {
-        this.permission = permission;
-    }
 
     public String getPermissions() {
         return permissions;

+ 6 - 0
src/main/java/com/steerinfo/dil/service/IDilNoticeService.java

@@ -25,10 +25,16 @@ public interface IDilNoticeService {
 
     int insertNotice(DilNotice dilNotice);
 
+    int releaseNotice(DilNotice dilNotice);
+
     int updateNotice(DilNotice dilNotice);
 
+    int updateNoticeStatus(String userId);
+
     int deleteNotice(BigDecimal id);
 
+    String queryName(String userId);
+
     List<Map<String, Object>> getNoticeById(BigDecimal id);
 
     List<Map<String, Object>> getCarrierNoticeList(Map<String, Object> mapVal);

+ 1 - 0
src/main/java/com/steerinfo/dil/service/impl/AmsContractTruckPriceServiceImpl.java

@@ -215,6 +215,7 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
         BigDecimal oilTypeId = DataChange.dataToBigDecimal(map.get("oilTypeId"));
         //获取预执行油价
         BigDecimal newOilPrice = DataChange.dataToBigDecimal(map.get("newOilPrice"));
+        BigDecimal type = new BigDecimal(1);
         //根据油品名称ID和非历史油价筛选出符合条件的运价合集
         List<Map<String, Object>> PriceValueList = amsContractTruckPriceMapper.getPriceValueList(oilTypeId);
         for (Map<String, Object> stringObjectMap : PriceValueList) {

+ 27 - 1
src/main/java/com/steerinfo/dil/service/impl/AmsSaleOrderServiceImpl.java

@@ -4,11 +4,13 @@ import com.alibaba.druid.support.json.JSONUtils;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.steerinfo.dil.feign.JoinFeign;
+import com.steerinfo.dil.feign.OtmsFeign;
 import com.steerinfo.dil.feign.TmsTruckFeign;
 import com.steerinfo.dil.mapper.*;
 import com.steerinfo.dil.model.*;
 import com.steerinfo.dil.service.IAmsSaleOrderService;
 import com.steerinfo.dil.util.*;
+import com.steerinfo.framework.controller.RESTfulResult;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -93,6 +95,8 @@ public class AmsSaleOrderServiceImpl implements IAmsSaleOrderService {
     @Resource
     EasSaleOrderStatusUtil easSaleOrderStatusUtil;
 
+    @Autowired
+    OtmsFeign otmsFeign;
 
     @Override
     public List<Map<String, Object>> getSaleOrderInfo(Map<String, Object> map) {
@@ -662,7 +666,7 @@ public class AmsSaleOrderServiceImpl implements IAmsSaleOrderService {
                         carrierCount = amsSaleOrderMapper.getMoreCarrier("%" + place + "%");
                     }
                     // 单一承运商才进行匹配
-                    if (carrierList != null && carrierList.size() == 1 && carrierCount.intValue() == 0) {
+                    if (carrierList != null && carrierList.size() == 1 && carrierList.get(0) != null  && carrierCount.intValue() == 0) {
                         List<Map<String, Object>> list = new ArrayList<>();
                         Map<String, Object> map1 = carrierList.get(0);
                         // 传入车序号主键和承运商id
@@ -817,6 +821,7 @@ public class AmsSaleOrderServiceImpl implements IAmsSaleOrderService {
     @Override
     public int dispatchSteelOrder(List<Map<String, Object>> mapList) throws Exception {
         Map<String, Object> stringObjectMap = mapList.get(0);
+        Integer isCheckGps = amsSaleOrderMapper.getDispachSwitch();
         Integer saleStatus = amsSaleOrderMapper.findStatus(DataChange.dataToBigDecimal(stringObjectMap.get("saleOrderMaterialId")));
         String selfMention = amsSaleOrderMapper.findSelfMention(DataChange.dataToBigDecimal(stringObjectMap.get("saleOrderMaterialId")));
         if (saleStatus == 1) {
@@ -829,8 +834,29 @@ public class AmsSaleOrderServiceImpl implements IAmsSaleOrderService {
             String capacityNumber = (String) map.get("capacityNumber");
             Map<String,Object> details = amsSaleOrderMapper.getOrderIdByCapacity(map);
             if(details!=null && details.get("orderId")!=null){
+                if(details.get("isEn")==null){
+                    throw new Exception(capacityNumber+"有未进厂的运输订单任务,无法派单");
+                }else if(details.get("isLeave")==null){
+                    throw new Exception(capacityNumber+"有未出厂的运输订单任务,无法派单");
+                }else if(details.get("isArrival")==null){
+                    throw new Exception(capacityNumber+"有未抵达的运输订单任务,无法派单");
+                }else if(details.get("isReceipt")==null){
+                    throw new Exception(capacityNumber+"有未签收的运输订单任务,无法派单");
+                }
                 throw new Exception(capacityNumber+"有未完成的运输订单任务,无法派单");
             }
+            if(isCheckGps!=null && isCheckGps==0){
+                Map<String,Object> locationResult = null;
+                try{
+                    Map<String,Object> data = (Map<String,Object>)otmsFeign.getCurrentLocation(capacityNumber).getData();
+                    locationResult = (Map<String,Object>)data.get("result");
+                }catch (Exception e){
+                  //出现任何异常不抛出,不终止程序
+                }
+                if(locationResult==null || locationResult.get("lon")==null || locationResult.get("lat")==null){
+                    throw new Exception("该车没有GPS定位信息,请联系销售公司物流部,申请是否可以派车。");
+                }
+            }
             // 得到车序号表主键
             BigDecimal saleOrderMaterialId = DataChange.dataToBigDecimal(map.get("saleOrderMaterialId"));
             // 得到承运商

+ 103 - 16
src/main/java/com/steerinfo/dil/service/impl/DilNoticeServiceImpl.java

@@ -78,27 +78,68 @@ public class DilNoticeServiceImpl  implements IDilNoticeService {
     @Override
     /*这里是解决前端毛病所妥协的结果,前端拿不到value值,只能拿到name也就是key值,这里在后端强行将key转为value值QAQ*/
     public int insertNotice(DilNotice dilNotice) {
+        int result=0;
         dilNotice.setDeleted(new BigDecimal(0));
         dilNotice.setInsertTime(new Date());
+        dilNotice.setNoticeId(dilNoticeMapper.selectNoticeId());
         if(dilNotice.getPermissions()!=null){
             if(dilNotice.getPermissions().equals("承运商")){
-                dilNotice.setPermission(BigDecimal.valueOf(1));
+                dilNotice.setPermission("chengyunshang");
             }
             else if(dilNotice.getPermissions().equals("销售商")){
-                dilNotice.setPermission(BigDecimal.valueOf(2));
+                dilNotice.setPermission("wuliuyunshubu");
             }
             else if(dilNotice.getPermissions().equals("收货客户")){
-                dilNotice.setPermission(BigDecimal.valueOf(3));
+                dilNotice.setPermission("shouhuokehu");
+            }else{
+                dilNotice.setPermission("qita");
+                /*dilNoticeMapper.insertSelective(dilNotice);
+                result +=dilNoticeMapper.insertIntoNoticeUser1(dilNotice);
+                return result;*/
             }
         }
-
-        {
-
-        }
         //需要手动设置发布人
         /*dilNotice.setInsertUsername("admin");*/
-        dilNotice.setNoticeId(dilNoticeMapper.selectNoticeId());
-        return dilNoticeMapper.insertSelective(dilNotice);
+        result+=dilNoticeMapper.insertSelective(dilNotice);
+        /*if (result==0){
+            dilNoticeMapper.insertIntoNoticeUser(dilNotice);
+        }*/
+        return result;
+    }
+
+    @Override
+    public int releaseNotice(DilNotice dilNotice) {
+        //发布通知
+        //1.先判断permission是否有值
+        //2.看notice有无历史的修改数据
+        //3.发布
+        int result=0;
+        if (dilNotice.getPermission()!=null){
+            //查询是否有历史修改数据
+            String code = dilNoticeMapper.gethistoryorgCode(dilNotice.getNoticeId());
+            //历史数据有值与否
+            if (code!=null&&!("".equals(code))){
+                if (!code.equals(dilNotice.getPermission())){
+                    dilNoticeMapper.deleteNoticeUsers(dilNotice.getNoticeId());
+                    if ("qita".equals(dilNotice.getPermission())){
+                        //全部要单独
+                        result+=dilNoticeMapper.insertIntoNoticeUser1(dilNotice);
+                    }else {
+                        result+=dilNoticeMapper.insertIntoNoticeUser(dilNotice);
+                    }
+                }
+            }else {
+                if ("qita".equals(dilNotice.getPermission())){
+                    //全部要单独
+                    result+=dilNoticeMapper.insertIntoNoticeUser1(dilNotice);
+                }else {
+                    result+=dilNoticeMapper.insertIntoNoticeUser(dilNotice);
+                }
+            }
+        }else {
+            return 0;
+        }
+        return result;
     }
 
     /**
@@ -106,11 +147,45 @@ public class DilNoticeServiceImpl  implements IDilNoticeService {
      * */
     @Override
     public int updateNotice(DilNotice dilNotice) {
-        /*dilNotice.setUpdateTime(new Date());*/
-        /*dilNotice.setUpdateUsername("admin");*/
+        dilNotice.setUpdateTime(new Date());
+        dilNotice.setUpdateUsername("admin");
+        if ("承运商".equals(dilNotice.getPermission())){
+            dilNotice.setPermission("chengyunshang");
+        }else if ("销售商".equals(dilNotice.getPermission())){
+            dilNotice.setPermission("wuliuyunshubu");
+        }else if ("收货客户".equals(dilNotice.getPermission())){
+            dilNotice.setPermission("shouhuokehu");
+        }else {
+            dilNotice.setPermission("qita");
+        }
+        String code = dilNoticeMapper.getorgCode(dilNotice.getNoticeId());
+        dilNotice.setHistoricalChanges(code);
+        //查询orgcode是否一致
+        /*String code = dilNoticeMapper.getorgCode(dilNotice.getNoticeId());
+        if (!code.equals(dilNotice.getPermission())){
+            dilNoticeMapper.deleteNotice(dilNotice.getNoticeId());
+            if ("qita".equals(dilNotice.getPermission())){
+                //全部要单独
+                dilNoticeMapper.insertIntoNoticeUser1(dilNotice);
+            }else {
+                dilNoticeMapper.insertIntoNoticeUser(dilNotice);
+            }
+        }*/
         return dilNoticeMapper.updateByPrimaryKeySelective(dilNotice);
     }
 
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-24
+     * @Description:修改用户通知的相关信息
+     */
+    @Override
+    public int updateNoticeStatus(String userId) {
+        return dilNoticeMapper.updatestatus(userId);
+    }
+
+
     /**
      * 删除通知信息
      * */
@@ -118,9 +193,21 @@ public class DilNoticeServiceImpl  implements IDilNoticeService {
     public int deleteNotice(BigDecimal id) {
         DilNotice dilNotice = dilNoticeMapper.selectByPrimaryKey(id);
         dilNotice.setDeleted(new BigDecimal(1));
-        return dilNoticeMapper.updateByPrimaryKeySelective(dilNotice);
+        //删除中间表信息
+        dilNoticeMapper.deleteNotice(id);
+        //删除通知表的数据
+        return dilNoticeMapper.deleteNotice(id);
     }
 
+    //根据用户ID获取用户名字
+    @Override
+    public String queryName(String userId) {
+        return dilNoticeMapper.queryName(userId);
+    }
+
+
+
+
     /**
      * 根据id获取运力信息
      * @param id
@@ -137,9 +224,9 @@ public class DilNoticeServiceImpl  implements IDilNoticeService {
      * @Date:
      * @Description: 获取通知信息数据
     */
-    public List<Map<String,Object>> getNoticeData(String orgcode){
+    public List<Map<String,Object>> getNoticeData(String userId){
         List<Map<String, Object>> noticeData=new ArrayList<>();
-        if ("chengyunshang".equals(orgcode)){
+        /*if ("chengyunshang".equals(orgcode)){
             BigDecimal permission=BigDecimal.valueOf(1);
             noticeData = dilNoticeMapper.getNoticeData(permission);
         }else if ("xiaoshougongsi".equals(orgcode)){
@@ -150,8 +237,8 @@ public class DilNoticeServiceImpl  implements IDilNoticeService {
             noticeData = dilNoticeMapper.getNoticeData(permission);
         }else {
             noticeData = dilNoticeMapper.getNoticeData1();
-        }
-        return noticeData;
+        }*/
+        return dilNoticeMapper.getNoticeData(userId);
     }
     /*
      * 获取下拉框

+ 5 - 4
src/main/java/com/steerinfo/dil/service/impl/ScheduledTasks.java

@@ -4,12 +4,9 @@ import com.steerinfo.dil.service.IAmsContractTruckPriceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.scheduling.TaskScheduler;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
 import org.springframework.stereotype.Component;
 
-import java.time.LocalDateTime;
-
 /***文档注释***********************************************
  * 作者            :hjh
  * 创建日期     :2022/9/23 14:37
@@ -34,7 +31,11 @@ public class ScheduledTasks {
         return taskScheduler;
     }
 
-    @Scheduled(cron = "0 0 0 26 9 ?")
+//<<<<<<< HEAD
+//    //@Scheduled(cron = "0 0 0 26 9 ? 2022-2022")
+//=======
+//    @Scheduled(cron = "0 0 0 26 9 ?")
+//>>>>>>> 9a0f6c590dbfacfea3d93a9d0823bd0cfebc4ad6
     public void updateDCPrice() {
         //修改吊车价格为最新运价
         amsContractTruckPriceService.updateDCodd();

+ 2 - 1
src/main/resources/application-prod.yml

@@ -20,7 +20,8 @@ openfeign:
       url: ${IMFEIGN_URL:172.16.33.166:8055}
    JoinFeign:
      url: ${JOINFEIGN_URL:172.16.33.166:8066}
-
+   OTMSFeign:
+     url: ${OTMSFEIGN_URL:172.16.33.166:8038}
  #正式环境端口
 
 server:

+ 1 - 0
src/main/resources/com/steerinfo/dil/mapper/AmsContractTruckPriceMapper.xml

@@ -933,6 +933,7 @@
     ON RRP.ADDRESS_ID=RRA.ADDRESS_ID
     LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
     ON ACTP.PLACE_ID=RRP.PLACE_ID
+    WHERE ACTP.DELETED = 0
     ) RRRA
     <if test="con != null" >
       WHERE RRRA."address" LIKE #{con}

+ 17 - 5
src/main/resources/com/steerinfo/dil/mapper/AmsSaleOrderMapper.xml

@@ -3389,6 +3389,7 @@
                      ON ASOM.SALE_SHIPPING_ADDRESS_ID = ACTP.PLACE_ID
     WHERE ACTP.CARRIER_ID = #{carrierId}
       AND ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
+    AND ACTP.DELETED = 0
     ORDER BY ACTP.INSERT_TIME DESC
     FETCH NEXT 1 ROWS ONLY
   </select>
@@ -4237,6 +4238,7 @@
            LEFT JOIN RMS_RECEIVE_PLACE RRP
                      ON RRP.PLACE_ID = ACTP.PLACE_ID
     WHERE RRP.ADDRESS_ID = #{addressId}
+    and  ACTP.DELETED = 0
   </select>
 
   <select id="getSaleCokeOrder" parameterType="java.util.Map" resultType="java.util.Map">
@@ -4428,6 +4430,7 @@
                      ON RRP.PLACE_ID = ACTP.PLACE_ID
     WHERE ACTP.CARRIER_ID = #{carrierId}
       AND RRP.ADDRESS_ID = #{addressId}
+      AND ACTP.DELETED = 0
       ORDER BY ACTP.OLD_DATE DESC
       NULLS LAST
   </select>
@@ -4572,13 +4575,18 @@
   <select id="getOrderIdByCapacity" resultType="java.util.Map">
     select OO.order_ID "orderId",
            RC.CAPACITY_NUMBER "capacityNumber",
-           OO.ORDER_STATUS "orderStatus",
-           OO.ORDER_LINE_SEQUENCE "orderLineSequence"
+           TTR.RESULT_TOTAL_ID "resultTotalId",
+           TER.RESULT_ENTRY_GATE_TIME "isEn",
+           TLFR.RESULT_OUT_GATE_TIME "isLeave",
+           TAR.RESULT_ID "isArrival",
+           TRR.RESULT_ID "isReceipt"
     from OMSTRUCK_ORDER OO
            LEFT JOIN RMS_CAPACITY RC ON OO.CAPACITY_ID =RC.CAPACITY_ID
-           LEFT JOIN RMS_CARRIER RCA ON OO.CARRIER_ID=RCA.CARRIER_ID
-           LEFT JOIN OMSTRAIN_ORDER_MATERIAL OOM ON OOM.ORDER_ID=OO.ORDER_ID
-           LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID=OOM.MATERIAL_ID
+           LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.ORDER_ID=OO.ORDER_ID
+           LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER ON TER.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
+           LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR ON TLFR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
+           LEFT JOIN TMSTRUCK_ARRIVAL_RESULT  TAR ON TAR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
+           LEFT JOIN TMSTRUCK_RECEIPT_RESULT TRR ON TRR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
     where RC.CAPACITY_NUMBER=#{capacityNumber} and OO.order_status=5
       fetch next 1 rows only
   </select>
@@ -4614,4 +4622,8 @@
       set aso.DELETED = 2
       WHERE ASO.SALE_NUMBER = #{saleNumber}
     </update>
+  <select id="getDispachSwitch" resultType="java.lang.Integer">
+    SELECT IS_OK "isOk" FROM AMS_DISPATCH_SWITCH
+    fetch NEXT 1 rows only
+  </select>
 </mapper>

+ 191 - 26
src/main/resources/com/steerinfo/dil/mapper/DilNoticeMapper.xml

@@ -11,16 +11,30 @@
     <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
     <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
     <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
-    <result column="PERMISSION" jdbcType="DECIMAL" property="permission" />
+    <result column="PERMISSION" jdbcType="VARCHAR" property="permission" />
+    <result column="HISTORICAL_CHANGES" jdbcType="VARCHAR" property="historicalChanges"></result>
   </resultMap>
   <sql id="columns">
     NOTICE_ID, NOTICE_TITLE, NOTICE_CONTENT, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, 
-    UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED, PERMISSION
+    UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED, PERMISSION,HISTORICAL_CHANGES
   </sql>
   <sql id="columns_alias">
     t.NOTICE_ID, t.NOTICE_TITLE, t.NOTICE_CONTENT, t.INSERT_USERNAME, t.INSERT_TIME, 
-    t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETED, t.PERMISSION
+    t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETED, t.PERMISSION,
+    t.HISTORICAL_CHANGES
   </sql>
+  <sql id="orderBy">
+    <if test="orderField != null and orderField != ''">
+      order by "${orderField}"
+      <if test="orderType != null and orderType != ''">
+        ${orderType}
+      </if>
+    </if>
+    <if test="orderField == null  ">
+      order by "insertTime" desc
+    </if>
+  </sql>
+
   <sql id="select">
     SELECT <include refid="columns"/> FROM DIL_NOTICE
   </sql>
@@ -250,6 +264,9 @@
       <if test="permission != null">
         PERMISSION = #{permission,jdbcType=DECIMAL},
       </if>
+      <if test="historicalChanges != null">
+        HISTORICAL_CHANGES = #{historicalChanges,jdbcType=DECIMAL},
+      </if>
     </set>
     where NOTICE_ID = #{noticeId,jdbcType=DECIMAL}
   </update>
@@ -401,9 +418,13 @@
     DN.NOTICE_TITLE AS "noticeTitle",
     DN.NOTICE_CONTENT AS "noticeContent",
     DN.INSERT_TIME AS "insertTime",
-    DN.INSERT_USERNAME AS "insertUsername"
+    DN.INSERT_USERNAME AS "insertUsername",
+    DN.PERMISSION AS "permission"
     FROM DIL_NOTICE DN
-    WHERE DN.DELETED !=1 and (DN.PERMISSION=0 or DN.PERMISSION=1)
+    WHERE DN.DELETED !=1 and (DN.PERMISSION='qita' or DN.PERMISSION='chengyunshang')
+    <if test="con!=null">
+    and DN.NOTICE_TITLE || DN.INSERT_USERNAME like #{con}
+    </if>
     ORDER BY DN.INSERT_TIME DESC
     )
     <where>
@@ -438,9 +459,8 @@
           "insertUsername" in #{item}
         </foreach>
       </if>
-
     </where>
-
+    <include refid="orderBy"></include>
   </select>
 
 
@@ -454,11 +474,49 @@
   DN.NOTICE_TITLE AS "noticeTitle",
   DN.NOTICE_CONTENT AS "noticeContent",
   DN.INSERT_TIME AS "insertTime",
-  DN.INSERT_USERNAME AS "insertUsername"
+  DN.INSERT_USERNAME AS "insertUsername",
+  DN.PERMISSION AS "permission"
   FROM DIL_NOTICE DN
-  WHERE DN.DELETED !=1 and (DN.PERMISSION=0 or DN.PERMISSION=2)
+  WHERE DN.DELETED !=1 and (DN.PERMISSION='qita' or DN.PERMISSION='wuliuyunshubu')
+  <if test="con!=null">
+    and DN.NOTICE_TITLE || DN.INSERT_USERNAME like #{con}
+  </if>
   ORDER BY DN.INSERT_TIME DESC
   )
+    <where>
+      <if test="noticeId!= null">
+        and
+        <foreach collection="noticeId" item="item" open="(" separator="," close=")">
+          "noticeId" in #{item}
+        </foreach>
+      </if>
+      <if test="noticeTitle!= null">
+        and
+        <foreach collection="noticeTitle" item="item" open="(" separator="," close=")">
+          "noticeTitle" in #{item}
+        </foreach>
+      </if>
+      <if test="noticeContent!= null">
+        and
+        <foreach collection="noticeContent" item="item" open="(" separator="," close=")">
+          "noticeContent" in #{item}
+        </foreach>
+      </if>
+      <if test="insertTime!= null">
+        and
+        <foreach collection="insertTime" item="item" open="(" separator="," close=")">
+          "insertTime" in #{item}
+        </foreach>
+      </if>
+
+      <if test="insertUsername!= null">
+        and
+        <foreach collection="insertUsername" item="item" open="(" separator="," close=")">
+          "insertUsername" in #{item}
+        </foreach>
+      </if>
+    </where>
+    <include refid="orderBy"></include>
   </select>
 
   <!--收货用户查询通知-->
@@ -471,11 +529,49 @@
           DN.NOTICE_TITLE AS "noticeTitle",
           DN.NOTICE_CONTENT AS "noticeContent",
           DN.INSERT_TIME AS "insertTime",
-          DN.INSERT_USERNAME AS "insertUsername"
+          DN.INSERT_USERNAME AS "insertUsername",
+          DN.PERMISSION AS "permission"
         FROM DIL_NOTICE DN
-        WHERE DN.DELETED !=1 and (DN.PERMISSION=0 or DN.PERMISSION=3)
+        WHERE DN.DELETED !=1 and (DN.PERMISSION='qita' or DN.PERMISSION='shouhuokehu')
+        <if test="con!=null">
+         and DN.NOTICE_TITLE || DN.INSERT_USERNAME like #{con}
+        </if>
         ORDER BY DN.INSERT_TIME DESC
       )
+    <where>
+      <if test="noticeId!= null">
+        and
+        <foreach collection="noticeId" item="item" open="(" separator="," close=")">
+          "noticeId" in #{item}
+        </foreach>
+      </if>
+      <if test="noticeTitle!= null">
+        and
+        <foreach collection="noticeTitle" item="item" open="(" separator="," close=")">
+          "noticeTitle" in #{item}
+        </foreach>
+      </if>
+      <if test="noticeContent!= null">
+        and
+        <foreach collection="noticeContent" item="item" open="(" separator="," close=")">
+          "noticeContent" in #{item}
+        </foreach>
+      </if>
+      <if test="insertTime!= null">
+        and
+        <foreach collection="insertTime" item="item" open="(" separator="," close=")">
+          "insertTime" in #{item}
+        </foreach>
+      </if>
+
+      <if test="insertUsername!= null">
+        and
+        <foreach collection="insertUsername" item="item" open="(" separator="," close=")">
+          "insertUsername" in #{item}
+        </foreach>
+      </if>
+    </where>
+    <include refid="orderBy"></include>
   </select>
 
 
@@ -486,8 +582,11 @@
       DN.NOTICE_TITLE AS "noticeTitle",
       DN.NOTICE_CONTENT AS "noticeContent",
       DN.INSERT_TIME AS "insertTime",
-      DN.INSERT_USERNAME AS "insertUsername"
-
+      DN.INSERT_USERNAME AS "insertUsername",
+      decode(DN.PERMISSION,'qita','全部可见',
+      'chengyunshang','承运商',
+      'wuliuyunshubu','销售商',
+      'shouhuokehu','收货客户') "permission"
     FROM DIL_NOTICE DN
     WHERE DN.NOTICE_ID=#{id}
 
@@ -510,17 +609,19 @@
 <!--  /*   DN.INSERT_TIME =  DN.PERMISSION =#{permission} OR DN.PERMISSION =0 AND*/-->
 
   <!--获取信息-->
-  <select id="getNoticeData" parameterType="java.math.BigDecimal" resultType="java.util.Map">
-    select t.NOTICE_TITLE AS "noticetitle",
-    t.NOTICE_CONTENT AS "noticecontent",
-    t.INSERT_USERNAME AS "insertusername",
-    t.INSERT_TIME AS "inserttime",
-    (select count(*) INSERT_USERNAME from DIL_NOTICE
-    where PERMISSION=#{permission} and Deleted =0 or PERMISSION is null) AS "taskAllNum"
-    from DIL_NOTICE t
-    where t.PERMISSION=#{permission}
-    and t.Deleted =0
-    or t.PERMISSION is null
+  <select id="getNoticeData" parameterType="java.lang.String" resultType="java.util.Map">
+    SELECT DN.NOTICE_TITLE AS "noticetitle",
+    DN.NOTICE_CONTENT AS "noticecontent",
+    DN.INSERT_USERNAME AS "insertusername",
+    DN.INSERT_TIME AS "inserttime",
+    (select count(*) from DIL_NOTICE_USERS where STATUS =0
+    and USER_ID=#{userId}) "taskAllNum"
+    FROM DIL_NOTICE_USERS DNU
+    LEFT JOIN DIL_NOTICE DN
+    ON DN.NOTICE_ID=DNU.NOTICE_ID
+    WHERE DNU.USER_ID=#{userId}
+    and sysdate > DN.INSERT_TIME
+    order by DN.INSERT_TIME DESC
   </select>
 
   <!--获取信息-->
@@ -530,9 +631,73 @@
     t.NOTICE_CONTENT AS "noticecontent",
     t.INSERT_USERNAME AS "insertusername",
     t.INSERT_TIME AS "inserttime",
-    (select count(*) INSERT_USERNAME from DIL_NOTICE where PERMISSION is null) AS "taskAllNum"
+    (select count(*) INSERT_USERNAME from DIL_NOTICE where PERMISSION = 0) AS "taskAllNum"
     from DIL_NOTICE t
-    where t.PERMISSION is null
+    where t.PERMISSION = 0
     and t.Deleted =0
   </select>
+
+  <!--向通知与用户中间表存储数据-->
+  <insert id="insertIntoNoticeUser">
+      INSERT INTO DIL_NOTICE_USERS
+      (select DN.NOTICE_ID ,
+              SU.USER_ID,
+              SU.USER_NAME,
+              SU.ORG_CODE,
+              0 "STATUS"
+              from DIL_NOTICE DN ,"SSO".SYS_USER SU
+              WHERE DN.NOTICE_ID=#{noticeId}
+              AND SU.ORG_CODE=#{permission})
+  </insert>
+
+  <insert id="insertIntoNoticeUser1">
+    INSERT INTO DIL_NOTICE_USERS
+      (select DN.NOTICE_ID ,
+              SU.USER_ID,
+              SU.USER_NAME,
+              SU.ORG_CODE,
+              0 "STATUS"
+              from DIL_NOTICE DN ,"SSO".SYS_USER SU
+              WHERE DN.NOTICE_ID=#{noticeId}
+              AND SU.ORG_CODE != 'yunli')
+  </insert>
+  <update id="updateNotice">
+    update DIL_NOTICE
+    set NOTICE_TITLE= #{noticeTitle},
+        NOTICE_CONTENT=#{noticeContent},
+        INSERT_USERNAME=#{insertUsername},
+        PERMISSION=#{permission},
+        UPDATE_USERNAME=#{updateUsername},
+        UPDATE_TIME=#{updateTime}
+        where NOTICE_ID=#{noticeId}
+  </update>
+  <delete id="deleteNotice">
+    delete from DIL_NOTICE DN
+    where DN.notice_id=#{noticeId}
+  </delete>
+  <delete id="deleteNoticeUsers">
+    delete from DIL_NOTICE_USERS DNU
+    where DNU.notice_id=#{noticeId}
+  </delete>
+  <update id="updatestatus">
+    update DIL_NOTICE_USERS DNU
+    SET STATUS=1
+    WHERE DNU.USER_ID=#{userId}
+  </update>
+  <select id="queryName" resultType="java.lang.String">
+    select SU.USER_NAME "userName"
+    from "SSO".SYS_USER SU
+    where SU.USER_ID=#{userId}
+  </select>
+  <select id="getorgCode" resultType="java.lang.String">
+    select DN.PERMISSION "permission"
+    from DIL_NOTICE DN
+    where  DN.NOTICE_ID=#{noticeid}
+  </select>
+
+  <select id="gethistoryorgCode" resultType="java.lang.String">
+    select DN.HISTORICAL_CHANGES "historicalChanges"
+    from DIL_NOTICE DN
+    where  DN.NOTICE_ID=#{noticeid}
+  </select>
 </mapper>