懒羊羊
2023-09-19 a2805ec01e3a639713a418544dc65cb38a555fdd
大屏优化
已修改6个文件
56 ■■■■ 文件已修改
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/controller/ProductionOrdeInfoController.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/mapper/ProductionOrdeInfoMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/mapper/mapping/ProductionOrdeInfoMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/model/result/ProductionOrdeInfoResult.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/service/ProductionOrdeInfoService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/service/impl/ProductionOrdeInfoServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/controller/ProductionOrdeInfoController.java
@@ -42,6 +42,7 @@
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -362,16 +363,17 @@
    @CrossOrigin
    @RequestMapping("/lineChart")
    public ResponseData lineChart(ProductionOrdeInfoParam productionOrdeInfoParam) {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        List<String> list = new ArrayList();
        List<Integer> planQtyList = new ArrayList();
        List<Integer> actualQtyList = new ArrayList();
        Map map = new HashMap<String,String>();
//        for (int i = 0; i < 7; i++) {
//            String str = LocalDate.now().minusDays(i).toString();
        for (Object o : getWeek()) {
        List<ProductionOrdeInfoResult> ColumnarDateList = productionOrdeInfoService.getColumnarDate();
        for (ProductionOrdeInfoResult result : ColumnarDateList) {
            String s = format.format(result.getActualStartTime());
            QueryWrapper<ProductionOrdeInfo> queryWrapper = new QueryWrapper<ProductionOrdeInfo>();
            queryWrapper.select("SUM(plan_qty) as planQty,SUM(actual_qty) as actualQty");
            queryWrapper.apply("CONVERT ( VARCHAR ( 100 ), plan_start_time, 23 ) = {0}",o.toString() );
            queryWrapper.apply("CONVERT ( VARCHAR ( 100 ), actual_start_time, 23 ) = {0}",s);
            ProductionOrdeInfo one = productionOrdeInfoService.getOne(queryWrapper);
            if(one!=null){
                if(one.getPlanQty()!=null){
@@ -388,37 +390,14 @@
                planQtyList.add(0);
                actualQtyList.add(0);
            }
            list.add(o.toString());
            list.add(s);
        }
//        }
        map.put("category",list);
        map.put("lineData",planQtyList);
        map.put("barData",actualQtyList);
        return ResponseData.success(map);
    }
    public static void main(String[] args) {
//        List<String> weeks = getFormatDate("month");
//        System.out.println(JSONObject.toJSONString(weeks));
//        for (int i = 0; i < 7; i++) {
//            System.out.println(LocalDate.now().minusDays(i));
//        }
        System.out.println(getWeek());
    }
    public static List getWeek(){
        List<String> list = new ArrayList<>();
        list.add(LocalDate.now().minusDays(6).toString());
        list.add(LocalDate.now().minusDays(5).toString());
        list.add(LocalDate.now().minusDays(4).toString());
        list.add(LocalDate.now().minusDays(3).toString());
        list.add(LocalDate.now().minusDays(2).toString());
        list.add(LocalDate.now().minusDays(1).toString());
        list.add(LocalDate.now().minusDays(0).toString());
        return list;
    }
    /**
     * 下载excel导入模板
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/mapper/ProductionOrdeInfoMapper.java
@@ -62,4 +62,6 @@
    Integer getActualQtyByDate(@Param("testdateset") String str);
    List<ProductionOrdeInfoResult> getListMonth();
    List<ProductionOrdeInfoResult> getColumnarDate();
}
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/mapper/mapping/ProductionOrdeInfoMapper.xml
@@ -133,4 +133,13 @@
        ]]>
    </select>
    <select id="getColumnarDate" resultType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult">
        SELECT DISTINCT
            FORMAT ( actual_start_time, 'yyyy-MM-dd' ) AS actual_start_time
        FROM
            om_production_orde_info
        ORDER BY
            actual_start_time DESC OFFSET 0 ROWS FETCH NEXT 7 ROWS ONLY;
    </select>
</mapper>
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/model/result/ProductionOrdeInfoResult.java
@@ -139,6 +139,9 @@
     */
    private Date actualStartTime;
    private String actual_start_time;
    /**
     * 实际结束时间
     */
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/service/ProductionOrdeInfoService.java
@@ -79,4 +79,6 @@
    Integer getActualQtyByDate(String str);
    List<ProductionOrdeInfoResult> getListMonth();
    List<ProductionOrdeInfoResult> getColumnarDate();
}
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/service/impl/ProductionOrdeInfoServiceImpl.java
@@ -161,6 +161,11 @@
        return baseMapper.getListMonth();
    }
    @Override
    public List<ProductionOrdeInfoResult> getColumnarDate() {
        return baseMapper.getColumnarDate();
    }
    private Serializable getKey(ProductionOrdeInfoParam param){
        return param.getId();
    }