Jelajahi Sumber

问题修改

zhs 2 tahun lalu
induk
melakukan
b8084c9361

+ 10 - 1
src/main/java/com/tld/controller/QueryListController.java

@@ -1,5 +1,6 @@
 package com.tld.controller;
 
+import com.tld.model.Access;
 import com.tld.model.Inventory;
 import com.tld.service.QueryListService;
 import lombok.RequiredArgsConstructor;
@@ -61,6 +62,14 @@ public class QueryListController {
         queryListService.exportStorageLocation(inventory,response);
     }
 
-
+    /**
+     * 查询接入信息
+     * @param access 参数
+     * @return 返回结果
+     */
+    @GetMapping("getAccess")
+    public Map<String, Object> getAccess(Access access){
+        return queryListService.getAccess(access);
+    }
 }
 

+ 3 - 0
src/main/java/com/tld/mapper/DictionaryMapper.java

@@ -1,5 +1,6 @@
 package com.tld.mapper;
 
+import com.tld.model.Access;
 import com.tld.model.Delivery;
 import com.tld.model.Dictionary;
 import com.tld.model.WarehouseTransfer;
@@ -37,4 +38,6 @@ public interface DictionaryMapper {
     void updateDictionary(Dictionary dictionary);
 
     void deleteDictionary(Dictionary dictionary);
+
+    void addAccess(Access access);
 }

+ 2 - 0
src/main/java/com/tld/mapper/QueryListMapper.java

@@ -1,5 +1,6 @@
 package com.tld.mapper;
 
+import com.tld.model.Access;
 import com.tld.model.Inventory;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -19,4 +20,5 @@ public interface QueryListMapper {
 
     List<Map<String, Object>> getStorageLocation(Inventory inventory);
 
+    List<Access> getAccess(Access access);
 }

+ 4 - 0
src/main/java/com/tld/model/StorageLocation.java

@@ -72,6 +72,10 @@ public class StorageLocation implements Serializable {
      * 修改时间
      */
     private String modifyTime;
+    /**
+     * 物料类型id
+     */
+    private String materialTypeId;
     /**
      * 页数
      */

+ 2 - 0
src/main/java/com/tld/service/QueryListService.java

@@ -1,5 +1,6 @@
 package com.tld.service;
 
+import com.tld.model.Access;
 import com.tld.model.Inventory;
 
 import javax.servlet.http.HttpServletResponse;
@@ -14,4 +15,5 @@ public interface QueryListService {
 
     void exportStorageLocation(Inventory inventory, HttpServletResponse response);
 
+    Map<String, Object> getAccess(Access access);
 }

+ 6 - 4
src/main/java/com/tld/service/impl/AskGoodsServiceImpl.java

@@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.tld.excel.ExcelUtils;
-import com.tld.mapper.AskGoodsMapper;
-import com.tld.mapper.DeliveryMapper;
-import com.tld.mapper.ErrorMapper;
-import com.tld.mapper.WarehousingMapper;
+import com.tld.mapper.*;
 import com.tld.model.*;
 import com.tld.model.Error;
 import com.tld.service.AskGoodsService;
@@ -39,6 +36,8 @@ public class AskGoodsServiceImpl implements AskGoodsService {
     private ErrorMapper errorMapper;
     @Autowired
     private DeliveryMapper deliveryMapper;
+    @Autowired
+    private DictionaryMapper dictionaryMapper;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -84,6 +83,9 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 }
                 askGoodsMapper.addAskGoodsLog(askGoods);
             }
+            //新增日志
+            Access access = new Access().setType("生产领料信息").setData(JSON.toJSONString(mapList)).setAccessType("0");
+            dictionaryMapper.addAccess(access);
             map.put("status", "0000");
             map.put("msg","成功");
         }catch (Exception e){

+ 5 - 0
src/main/java/com/tld/service/impl/DictionaryServiceImpl.java

@@ -1,8 +1,10 @@
 package com.tld.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.tld.mapper.DictionaryMapper;
+import com.tld.model.Access;
 import com.tld.model.Goods;
 import com.tld.service.DictionaryService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,6 +46,9 @@ public class DictionaryServiceImpl implements DictionaryService {
                     dictionaryMapper.addDictionary(dictionary);
                 }
             }
+            //新增日志
+            Access access = new Access().setType("字典信息").setData(JSON.toJSONString(dictionarys)).setAccessType("0");
+            dictionaryMapper.addAccess(access);
             map.put("msg", "200");
         }  catch (Exception e){
             e.printStackTrace();

+ 17 - 4
src/main/java/com/tld/service/impl/InviteServiceImpl.java

@@ -1,10 +1,9 @@
 package com.tld.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.tld.mapper.DictionaryMapper;
 import com.tld.mapper.InviteMapper;
-import com.tld.model.AskGoods;
-import com.tld.model.Inventory;
-import com.tld.model.Notice;
-import com.tld.model.ReturRemoval;
+import com.tld.model.*;
 import com.tld.service.InviteService;
 import org.redisson.api.RLock;
 import org.redisson.api.RedissonClient;
@@ -23,6 +22,8 @@ public class InviteServiceImpl implements InviteService {
     //redis锁
     @Autowired
     private RedissonClient redissonClient;
+    @Autowired
+    private DictionaryMapper dictionaryMapper;
 
     @Override
     public Map<String, Object> getAskGoodsfList(AskGoods askGoods) {
@@ -188,6 +189,9 @@ public class InviteServiceImpl implements InviteService {
         Map<String, Object> map = new HashMap<>();
         try {
             inviteMapper.addNotice(mapList);
+            //新增日志
+            Access access = new Access().setType("报工单").setData(JSON.toJSONString(mapList)).setAccessType("0");
+            dictionaryMapper.addAccess(access);
             map.put("status", "0000");
             map.put("msg","成功");
         }catch (Exception e){
@@ -207,6 +211,9 @@ public class InviteServiceImpl implements InviteService {
         Map<String, Object> map = new HashMap<>();
         try {
             inviteMapper.addDelivery(mapList);
+            //新增日志
+            Access access = new Access().setType("交货单").setData(JSON.toJSONString(mapList)).setAccessType("0");
+            dictionaryMapper.addAccess(access);
             map.put("status", "0000");
             map.put("msg","成功");
         }catch (Exception e){
@@ -226,6 +233,9 @@ public class InviteServiceImpl implements InviteService {
         Map<String, Object> map = new HashMap<>();
         try {
             inviteMapper.addWarehouseTransfer(mapList);
+            //新增日志
+            Access access = new Access().setType("移库单").setData(JSON.toJSONString(mapList)).setAccessType("0");
+            dictionaryMapper.addAccess(access);
             map.put("status", "0000");
             map.put("msg","成功");
         }catch (Exception e){
@@ -297,6 +307,9 @@ public class InviteServiceImpl implements InviteService {
                 }
                 inviteMapper.addAskGoodsLog(askGoods);
             }
+            //新增日志
+            Access access = new Access().setType("非生产领料信息").setData(JSON.toJSONString(mapList)).setAccessType("0");
+            dictionaryMapper.addAccess(access);
             map.put("status", "0000");
             map.put("msg","成功");
         }catch (Exception e){

+ 17 - 0
src/main/java/com/tld/service/impl/QueryListServiceImpl.java

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.tld.excel.ExcelUtils;
 import com.tld.mapper.QueryListMapper;
+import com.tld.model.Access;
 import com.tld.model.Inventory;
 import com.tld.model.Notice;
 import com.tld.service.QueryListService;
@@ -107,4 +108,20 @@ public class QueryListServiceImpl implements QueryListService {
             e.printStackTrace();
         }
     }
+
+    @Override
+    public Map<String, Object> getAccess(Access access) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            PageHelper.startPage(access.getPage(), access.getLimit());
+            PageInfo<Access> list = new PageInfo<>(queryListMapper.getAccess(access));
+            map.put("data", list);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
 }

+ 11 - 0
src/main/java/com/tld/service/impl/ReceiveGoodsSerivceImpl.java

@@ -1,8 +1,11 @@
 package com.tld.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.tld.mapper.DictionaryMapper;
 import com.tld.mapper.ReceiveGoodsMapper;
+import com.tld.model.Access;
 import com.tld.model.ReceiveGoods;
 import com.tld.service.ReceiveGoodsSerivce;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,6 +19,8 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
 
     @Autowired
     private ReceiveGoodsMapper receiveGoodsMapper;
+    @Autowired
+    private DictionaryMapper dictionaryMapper;
 
 
     @Override
@@ -105,6 +110,9 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
                    //采购单日志
                    receiveGoodsMapper.addReceiveGoodsLog(receiveGoods);
                }
+               //新增日志
+               Access access = new Access().setType("质检信息").setData(JSON.toJSONString(jsonData)).setAccessType("0");
+               dictionaryMapper.addAccess(access);
            }
            map.put("status", "0000");
            map.put("msg","成功");
@@ -137,6 +145,9 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
         Map<String, Object> map = new HashMap<>();
         try{
             receiveGoodsMapper.addPurchase(jsonData);
+            //新增日志
+            Access access = new Access().setType("采购信息").setData(JSON.toJSONString(jsonData)).setAccessType("0");
+            dictionaryMapper.addAccess(access);
             map.put("status", "0000");
             map.put("msg","成功");
         } catch (Exception e) {

+ 4 - 0
src/main/resources/mapper/DictionaryMapper.xml

@@ -175,4 +175,8 @@
     <delete id="deleteDictionary">
         delete from ${tableName} where id = #{id}
     </delete>
+    <!-- 新增日志 -->
+    <insert id="addAccess">
+        insert into tld_access(type,data,scrq) value(#{type},#{data},now())
+    </insert>
 </mapper>

+ 12 - 0
src/main/resources/mapper/QueryListMappeer.xml

@@ -103,4 +103,16 @@
         a.storage_location_code,
         a.material_id
     </select>
+    <!-- 查询接入信息 -->
+    <select id="getAccess" resultType="com.tld.model.Access">
+        select id,type,data,scrq from tld_access
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="type != null and type != ''">
+                and type = #{type}
+            </if>
+            <if test="accessType != null and accessType != ''">
+                and access_type = #{accessType}
+            </if>
+        </trim>
+    </select>
 </mapper>