瀏覽代碼

杰生迭代

home 2 年之前
父節點
當前提交
910d00d1bd

+ 32 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/controller/common/CommonFileController.java

@@ -2,12 +2,16 @@ package com.fjhx.controller.common;
 
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fjhx.entity.common.CommonFile;
+import com.fjhx.entity.example.ExampleInfo;
 import com.fjhx.service.common.CommonFileService;
+import com.fjhx.utils.ExampleAbstract;
+import com.fjhx.utils.FlowConstructor;
 import org.springblade.core.tool.api.R;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -39,5 +43,33 @@ public class CommonFileController {
         return R.success(list);
     }
 
+    @GetMapping("test")
+    public R test() {
+
+        ExampleAbstract exampleAbstract = new ExampleAbstract() {
+            @Override
+            public String getCode() {
+                return "test";
+            }
+
+            @Override
+            public void end() {
+//                ExampleInfo cacheData = getCacheData();
+//                System.out.println("缓存     " + cacheData);
+                System.out.println("流程结束了");
+            }
+
+        };
+
+//        HashMap<String, String> map = new HashMap<>();
+//        map.put("processInfoId", "1111111111111111111111");
+//        map.put("processTenantId", "222222222222222222222");
+//        exampleAbstract.setCacheData(map);
+
+        FlowConstructor.init(exampleAbstract).create(123456L);
+
+        return R.success();
+    }
+
 }
 

+ 23 - 1
hx-service/storage/src/main/java/com/fjhx/applet/controller/FabricStatisticsController.java

@@ -1,9 +1,13 @@
 package com.fjhx.applet.controller;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.applet.service.FabricStatisticsService;
 import org.springblade.core.tool.api.R;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
 import java.util.Map;
@@ -114,4 +118,22 @@ public class FabricStatisticsController {
         return R.success(map);
     }
 
+    /**
+     * 审批数量
+     */
+    @PostMapping("/flowNum")
+    public R flowNum(@RequestBody Map<String, String> condition) {
+        List<Map<String, Object>> map = fabricStatisticsService.flowNum(condition);
+        return R.success(map);
+    }
+
+    /**
+     * 审批数量
+     */
+    @PostMapping("/flowPage")
+    public R flowPage(@RequestBody Map<String, String> condition) {
+        Page<Map<String, Object>> map = fabricStatisticsService.flowPage(condition);
+        return R.success(map);
+    }
+
 }

+ 7 - 0
hx-service/storage/src/main/java/com/fjhx/applet/mapper/FabricStatisticsMapper.java

@@ -2,6 +2,7 @@ package com.fjhx.applet.mapper;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.base.BaseEntity;
 import org.apache.ibatis.annotations.Param;
 import org.springblade.core.tenant.annotation.TenantIgnore;
@@ -44,4 +45,10 @@ public interface FabricStatisticsMapper extends BaseMapper<BaseEntity> {
     @TenantIgnore
     List<Map<String, Object>> selectFabricW(@Param("ew") QueryWrapper<Object> wrapper);
 
+    @TenantIgnore
+    List<Map<String, Object>> flowNum(@Param("ew") QueryWrapper<?> wrapper);
+
+    @TenantIgnore
+    Page<Map<String, Object>> flowPage(@Param("page") Page<Map<String, Object>> page, @Param("ew") QueryWrapper<?> wrapper);
+
 }

+ 32 - 0
hx-service/storage/src/main/java/com/fjhx/applet/mapper/FabricStatisticsMapper.xml

@@ -154,4 +154,36 @@
             ${ew.customSqlSegment}
     </select>
 
+    <select id="flowNum" resultType="java.util.Map">
+        select f.ID id, f.FlowName flowName, count(0) count
+        from flow f
+                 left join
+             (
+                 SELECT t.FlowId, t.LinkId, t.CreatedTime, t.CheckState
+                 FROM (SELECT FlowId, LinkId, CreatedTime, CheckState
+                       FROM flow_applycheck
+                       ORDER BY CreatedTime DESC) t
+                 GROUP BY t.LinkId
+             ) fa on f.ID = fa.FlowId
+            ${ew.customSqlSegment}
+    </select>
+
+    <select id="flowPage" resultType="java.util.Map">
+        select fa.ID           id,
+               f.FlowName      flowName,
+               fa.ApprovalItem approvalItem,
+               fa.CreatedTime  createdTime,
+               fa.CheckState   checkState
+        from flow f
+                 left join
+             (
+                 SELECT t.FlowId, t.LinkId, t.CreatedTime, t.CheckState, t.ApprovalItem, t.ID
+                 FROM (SELECT FlowId, LinkId, CreatedTime, CheckState, ApprovalItem, ID
+                       FROM flow_applycheck
+                       ORDER BY CreatedTime DESC) t
+                 GROUP BY t.LinkId
+             ) fa on f.ID = fa.FlowId
+            ${ew.customSqlSegment}
+    </select>
+
 </mapper>

+ 5 - 0
hx-service/storage/src/main/java/com/fjhx/applet/service/FabricStatisticsService.java

@@ -1,5 +1,6 @@
 package com.fjhx.applet.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.base.BaseEntity;
 import com.fjhx.base.BaseService;
 import com.fjhx.entity.stock.StockInoutbill;
@@ -25,4 +26,8 @@ public interface FabricStatisticsService extends BaseService<BaseEntity> {
 
     Map<String, Object> selectFabricW(Map<String, Object> condition);
 
+    List<Map<String, Object>> flowNum(Map<String, String> condition);
+
+    Page<Map<String, Object>> flowPage(Map<String, String> condition);
+
 }

+ 38 - 2
hx-service/storage/src/main/java/com/fjhx/applet/service/impl/FabricStatisticsServiceImpl.java

@@ -4,12 +4,13 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.applet.mapper.FabricStatisticsMapper;
 import com.fjhx.applet.service.FabricStatisticsService;
 import com.fjhx.base.BaseEntity;
-import com.fjhx.entity.stock.StockInoutbill;
 import com.fjhx.utils.Assert;
+import com.fjhx.utils.WrapperUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springframework.stereotype.Service;
 
@@ -362,6 +363,41 @@ public class FabricStatisticsServiceImpl extends ServiceImpl<FabricStatisticsMap
         return detailsMap;
     }
 
+    @Override
+    public List<Map<String, Object>> flowNum(Map<String, String> condition) {
+
+        WrapperUtil flowWrapper = getFlowWrapper(condition);
+
+        QueryWrapper<?> wrapper = flowWrapper.getWrapper();
+        if (ObjectUtil.isEmpty(condition.get("checkState"))) {
+            wrapper.in("fa.CheckState", 0, 1, 2, 3);
+        }
+
+        wrapper.groupBy("f.ID");
+
+        return baseMapper.flowNum(wrapper);
+    }
+
+    @Override
+    public Page<Map<String, Object>> flowPage(Map<String, String> condition) {
+        WrapperUtil flowWrapper = getFlowWrapper(condition);
+        flowWrapper.eq("fa.ID", "id");
+
+        QueryWrapper<?> wrapper = flowWrapper.getWrapper();
+
+        if (ObjectUtil.isEmpty(condition.get("checkState"))) {
+            wrapper.in("fa.CheckState", 0, 1, 2, 3);
+        }
+
+        return baseMapper.flowPage(createPageMap(condition), wrapper);
+    }
+
+    private WrapperUtil getFlowWrapper(Map<String, String> condition) {
+        return WrapperUtil.init(condition)
+                .periodOfTime("fa.CreatedTime")
+                .eq("fa.CheckState", "checkState");
+    }
+
     /**
      * 获取时间段查询
      *
@@ -369,7 +405,7 @@ public class FabricStatisticsServiceImpl extends ServiceImpl<FabricStatisticsMap
      * @param condition 条件
      * @return
      */
-    private static QueryWrapper<Object> getDateWrapper(String field, Map<String, ?> condition) {
+    private QueryWrapper<Object> getDateWrapper(String field, Map<String, ?> condition) {
         if (ObjectUtil.isAllEmpty(condition.get("type"), condition.get("beginTime"), condition.get("endTime"))) {
             throw new ServiceException("日期不能为空");
         }

+ 21 - 2
hx-service/storage/src/main/java/com/fjhx/supplier/controller/SupplierController.java

@@ -84,8 +84,11 @@ public class SupplierController {
      */
     @GetMapping("/statisticsClassify")
     public R statisticsClassify(@RequestParam(required = false) String Purpose,
-                                @RequestParam(required = false) String search) {
-        List<Supplier> list = supplierService.statisticsClassify(Purpose, search);
+                                @RequestParam(required = false) String search,
+                                @RequestParam(required = false) Integer accountDate,
+                                @RequestParam(required = false) Integer type
+    ) {
+        List<Supplier> list = supplierService.statisticsClassify(Purpose, search, accountDate, type);
         return R.success(list);
     }
 
@@ -234,17 +237,33 @@ public class SupplierController {
         return R.success(list);
     }
 
+    /**
+     * 账期统计
+     */
     @PostMapping("getAccountDateList")
     public R getAccountDate() {
         List<Map<String, Object>> result = supplierService.getAccountDate();
         return R.success(result);
     }
 
+    /**
+     * 账期数量
+     */
     @PostMapping("getSafetyWarnDayList")
     public R getSafetyWarnDayList() {
         List<Map<String, Object>> result = supplierService.getSafetyWarnDayList();
         return R.success(result);
     }
 
+    /**
+     * 查看供应商采购周期
+     */
+    @PostMapping("getSafetyWarnDayBySupplier")
+    public R getSafetyWarnDayBySupplier(@RequestBody Map<String, String> condition) {
+        String supplierId = condition.get("supplierId");
+        List<Map<String, Object>> result = supplierService.getSafetyWarnDayBySupplier(supplierId);
+        return R.success(result);
+    }
+
 }
 

+ 18 - 8
hx-service/storage/src/main/java/com/fjhx/supplier/mapper/SupplierMapper.java

@@ -1,10 +1,7 @@
 package com.fjhx.supplier.mapper;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.entity.stock.StockWater;
-import com.fjhx.entity.supplier.Supplier;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fjhx.entity.supplier.Supplier;
 import org.apache.ibatis.annotations.Param;
 import org.springblade.core.tenant.annotation.TenantIgnore;
 
@@ -77,13 +74,18 @@ public interface SupplierMapper extends BaseMapper<Supplier> {
 
     /**
      * 物料分类分组查询
+     *
      * @return
      */
     @TenantIgnore
-    List<Supplier> getGroupByCategory(@Param("Purpose")String Purpose,@Param("search")String search);
+    List<Supplier> getGroupByCategory(@Param("Purpose") String Purpose,
+                                      @Param("search") String search,
+                                      @Param("accountDate") Integer accountDate,
+                                      @Param("type") Integer type);
 
     /**
      * 供应商详情
+     *
      * @return
      */
     @TenantIgnore
@@ -91,6 +93,7 @@ public interface SupplierMapper extends BaseMapper<Supplier> {
 
     /**
      * 获取采购物料款数
+     *
      * @param id
      * @return
      */
@@ -99,6 +102,7 @@ public interface SupplierMapper extends BaseMapper<Supplier> {
 
     /**
      * 获取供应商退货次数
+     *
      * @param id
      * @return
      */
@@ -107,6 +111,7 @@ public interface SupplierMapper extends BaseMapper<Supplier> {
 
     /**
      * 供应商采购物料分析 列表
+     *
      * @param condition
      * @return
      */
@@ -115,6 +120,7 @@ public interface SupplierMapper extends BaseMapper<Supplier> {
 
     /**
      * 供应商采购物料分析 条数
+     *
      * @param condition
      * @return
      */
@@ -123,28 +129,31 @@ public interface SupplierMapper extends BaseMapper<Supplier> {
 
     /**
      * 月度退货记录分析
+     *
      * @param id
      * @return
      */
     @TenantIgnore
-    List<Supplier> getBackSumMoneyAndCount(@Param("id") String id,@Param("date")String date);
+    List<Supplier> getBackSumMoneyAndCount(@Param("id") String id, @Param("date") String date);
 
     /**
      * 退货记录总数和总金额
+     *
      * @param id
      * @return
      */
     @TenantIgnore
-    Map<String,Object> getAllSumMoneyAndCount(@Param("id") String id,@Param("date")String date);
+    Map<String, Object> getAllSumMoneyAndCount(@Param("id") String id, @Param("date") String date);
 
     /**
      * 月度采购分析
+     *
      * @param id
      * @param date
      * @return
      */
     @TenantIgnore
-    List<Supplier> getMonthSumPurMoney(@Param("id") String id,@Param("date")String date);
+    List<Supplier> getMonthSumPurMoney(@Param("id") String id, @Param("date") String date);
 
 
     /**
@@ -159,4 +168,5 @@ public interface SupplierMapper extends BaseMapper<Supplier> {
     @TenantIgnore
     List<Map<String, Object>> getSafetyWarnDayList();
 
+    List<Map<String, Object>> getSafetyWarnDayBySupplier(@Param("supplierId") String supplierId);
 }

+ 53 - 6
hx-service/storage/src/main/java/com/fjhx/supplier/mapper/SupplierMapper.xml

@@ -4,6 +4,7 @@
 
     <select id="getSumList" resultType="com.fjhx.entity.supplier.Supplier">
         SELECT
+
         t1.*,
         t3.TechnologyType AS TechnologyType,
         (
@@ -18,10 +19,11 @@
         FORMAT(IFNULL((<include refid="yearMoney_filed"/>),0),2)AS yearMoney,
         FORMAT(IFNULL((<include refid="lastMonthMoney_filed"/>),0),2)AS lastMonthMoney,
         FORMAT(IFNULL((<include refid="monthMoney_filed"/>),0),2)AS monthMoney
+
         FROM
         supplier t1
-        LEFT JOIN supplier_price sp ON t1.ID = sp.FactoryId
-        LEFT JOIN material t3 ON t3.`Code` = sp.MaterialCode
+        INNER JOIN supplier_price sp ON t1.ID = sp.FactoryId
+        INNER JOIN material t3 ON t3.`Code` = sp.MaterialCode
         <include refid="list_condition"/>
         GROUP BY t1.ID
         ORDER BY t1.CreatedTime DESC
@@ -134,13 +136,11 @@
         FROM
         (
         SELECT
-        t1.ID,
-        t1.`Name`,
         t3.TechnologyType AS TechnologyType
         FROM
         material t3
-        LEFT JOIN supplier_price sp ON t3.`Code` = sp.MaterialCode
-        LEFT JOIN supplier t1 ON sp.FactoryId = t1.ID
+        INNER JOIN supplier_price sp ON t3.`Code` = sp.MaterialCode
+        INNER JOIN supplier t1 ON sp.FactoryId = t1.ID
         <where>
             t1.IsDelete = 0
             AND t3.IsDelete = 0
@@ -150,6 +150,24 @@
             <if test="Purpose neq null and Purpose neq '' ">
                 AND INSTR( t3.Purpose, #{Purpose} ) > 0
             </if>
+            <if test="accountDate neq null">
+                AND t1.AccountDate = #{accountDate}
+            </if>
+            <if test="type eq 1 ">
+                and t3.SafetyWarnDay between 0 and 5
+            </if>
+            <if test="type eq 2 ">
+                and t3.SafetyWarnDay between 6 and 15
+            </if>
+            <if test="type eq 3 ">
+                and t3.SafetyWarnDay between 16 and 30
+            </if>
+            <if test="type eq 4 ">
+                and t3.SafetyWarnDay between 31 and 45
+            </if>
+            <if test="type eq 5 ">
+                and t3.SafetyWarnDay &gt; 45
+            </if>
         </where>
         GROUP BY t1.ID,t3.TechnologyType
         ) detail
@@ -306,6 +324,16 @@
                sp.FactoryId    factoryId
         from material m
                  inner join supplier_price sp on sp.FactoryId is not null and sp.MaterialCode = m.Code
+        where m.IsDelete = 0
+          and sp.IsDelete = 0
+    </select>
+    <select id="getSafetyWarnDayBySupplier" resultType="java.util.Map">
+        select m.Name          materialName,
+               m.Code          materialCode,
+               m.SafetyWarnDay safetyWarnDay
+        from supplier_price sp
+                 inner join material m on sp.MaterialCode = m.code
+        where sp.FactoryId = #{supplierId}
     </select>
 
 
@@ -370,6 +398,25 @@
                 AND t1.ID in ( select sp.FactoryId from supplier_price sp where sp.MaterialCode = #{materialCode} )
             </if>
 
+            <if test="accountDate neq null">
+                AND t1.AccountDate = #{accountDate}
+            </if>
+            <if test="type eq 1 ">
+                and t3.SafetyWarnDay between 0 and 5
+            </if>
+            <if test="type eq 2 ">
+                and t3.SafetyWarnDay between 6 and 15
+            </if>
+            <if test="type eq 3 ">
+                and t3.SafetyWarnDay between 16 and 30
+            </if>
+            <if test="type eq 4 ">
+                and t3.SafetyWarnDay between 31 and 45
+            </if>
+            <if test="type eq 5 ">
+                and t3.SafetyWarnDay &gt; 45
+            </if>
+
         </where>
     </sql>
     <sql id="sql_limit">

+ 2 - 1
hx-service/storage/src/main/java/com/fjhx/supplier/service/SupplierService.java

@@ -54,7 +54,7 @@ public interface SupplierService extends BaseService<Supplier> {
      *
      * @return
      */
-    List<Supplier> statisticsClassify(String Purpose, String search);
+    List<Supplier> statisticsClassify(String Purpose, String search, Integer accountDate, Integer type);
 
     /**
      * 添加
@@ -154,4 +154,5 @@ public interface SupplierService extends BaseService<Supplier> {
 
     List<Map<String, Object>> getSafetyWarnDayList();
 
+    List<Map<String, Object>> getSafetyWarnDayBySupplier(String supplierId);
 }

+ 10 - 2
hx-service/storage/src/main/java/com/fjhx/supplier/service/impl/SupplierServiceImpl.java

@@ -50,11 +50,13 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
      */
     @Override
     public List<Supplier> getList(Map<String, Object> condition) {
+
         if (ObjectUtil.isNotEmpty(condition.get("TechnologyType")) &&
                 StringUtil.equals(condition.get("TechnologyType").toString(), "99")) {
             condition.put("TechnologyType", null);
             return baseMapper.getSumList(condition);
         }
+
         return baseMapper.getList(condition);
     }
 
@@ -112,14 +114,14 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
      * @return
      */
     @Override
-    public List<Supplier> statisticsClassify(String Purpose, String search) {
+    public List<Supplier> statisticsClassify(String Purpose, String search, Integer accountDate, Integer type) {
         if (StringUtil.equals("null", Purpose)) {
             Purpose = null;
         }
         if (StringUtil.equals("null", search)) {
             search = null;
         }
-        return baseMapper.getGroupByCategory(Purpose, search);
+        return baseMapper.getGroupByCategory(Purpose, search, accountDate, type);
     }
 
     /**
@@ -327,6 +329,7 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
                 Wrappers.<Supplier>query()
                         .select("count(0) count", "AccountDate accountDate")
                         .lambda()
+                        .eq(Supplier::getIsDelete, 0)
                         .orderByAsc(Supplier::getAccountDate)
                         .groupBy(Supplier::getAccountDate)
         );
@@ -392,4 +395,9 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
         return result.stream().sorted(Comparator.comparing(item -> Integer.valueOf(item.get("type").toString()))).collect(Collectors.toList());
     }
 
+    @Override
+    public List<Map<String, Object>> getSafetyWarnDayBySupplier(String supplierId) {
+        return baseMapper.getSafetyWarnDayBySupplier(supplierId);
+    }
+
 }

+ 2 - 1
hx-service/syringe-production/src/main/java/com/fjhx/mapper/tda/TdaDeviceMapper.xml

@@ -8,7 +8,8 @@
                td.device_name,
                td.node_id,
                td.device_id,
-               td.device_name
+               td.device_name,
+               td.secret
         from tda_device td
                  left join tda_product tp on td.tda_product_id = tp.id
                  left join tda_application ta on tp.tda_application_id = ta.id