diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/controller/PdmProductSpecController.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/controller/PdmProductSpecController.java index a7b7895dd..eca342d54 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/controller/PdmProductSpecController.java +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/controller/PdmProductSpecController.java @@ -1,6 +1,8 @@ package org.nl.b_lms.pdm.productSpec.controller; import cn.dev33.satoken.annotation.SaIgnore; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import lombok.RequiredArgsConstructor; @@ -19,8 +21,10 @@ import org.nl.common.domain.query.PageQuery; import org.nl.common.enums.PackageInfoIvtEnum; import org.nl.common.enums.SpecEnum; import org.nl.common.utils.CopyUtil; +import org.nl.common.utils.MapOf; import org.nl.common.utils.RedissonUtils; import org.nl.modules.common.exception.BadRequestException; +import org.nl.modules.common.utils.FileUtil; import org.nl.modules.logging.annotation.Log; import org.nl.modules.wql.util.SpringContextHolder; import org.redisson.api.RLock; @@ -29,13 +33,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; +import javax.servlet.http.HttpServletResponse; +import java.util.*; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; /** @@ -67,5 +71,32 @@ public class PdmProductSpecController { return new ResponseEntity<>(result, HttpStatus.OK); } + @GetMapping("/querySpec/{code}") + @SaIgnore + public void querySpec(@PathVariable int code,HttpServletResponse response) { + DateTime dateTime = DateUtil.offsetDay(new Date(), -code); + List pdmProductSpecs = ipdmProductSpecService.querySubSepc(dateTime.toString()); + String[] col = {"子卷","子卷下线","质检","包装","包装解除","装箱入库","验箱","入库"}; + if (!CollectionUtils.isEmpty(pdmProductSpecs)){ + Map> collect = pdmProductSpecs.stream().collect(Collectors.groupingBy(PdmProductSpec::getContainer_name)); + List> data = new ArrayList<>(); + PdmProductSpec pdmProductSpec = new PdmProductSpec(); + + for (String sub : collect.keySet()) { + List item = collect.get(sub); + //2,3,4,5,7,9,10 + String 子卷下线 = DateUtil.format((item.stream().filter(a -> 2 == a.getSpec()).findFirst().orElse(pdmProductSpec).getCreate_time()),"yyyy-MM-dd HH:mm:ss.SSS"); + String 质检 = DateUtil.format((item.stream().filter(a -> 3 == a.getSpec()).findFirst().orElse(pdmProductSpec).getCreate_time()),"yyyy-MM-dd HH:mm:ss.SSS"); + String 包装 = DateUtil.format((item.stream().filter(a -> 4 == a.getSpec()).findFirst().orElse(pdmProductSpec).getCreate_time()),"yyyy-MM-dd HH:mm:ss.SSS"); + String 包装解除 = DateUtil.format((item.stream().filter(a -> 5 == a.getSpec()).findFirst().orElse(pdmProductSpec).getCreate_time()),"yyyy-MM-dd HH:mm:ss.SSS"); + String 装箱入库 = DateUtil.format((item.stream().filter(a -> 6 == a.getSpec()).findFirst().orElse(pdmProductSpec).getCreate_time()),"yyyy-MM-dd HH:mm:ss.SSS"); + String 验箱 = DateUtil.format((item.stream().filter(a -> 9 == a.getSpec()).findFirst().orElse(pdmProductSpec).getCreate_time()),"yyyy-MM-dd HH:mm:ss.SSS"); + String 入库 = DateUtil.format((item.stream().filter(a -> 10 == a.getSpec()).findFirst().orElse(pdmProductSpec).getCreate_time()),"yyyy-MM-dd HH:mm:ss.SSS"); + data.add(MapOf.of("子卷",sub,"子卷下线",子卷下线,"质检",质检,"包装",包装,"包装解除",包装解除,"装箱入库",装箱入库,"验箱",验箱,"入库",入库)); + } + new FileUtil().downloadExcelIO(data,col, response); + } + } + } diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/dao/mapper/PdmProductSpecMapper.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/dao/mapper/PdmProductSpecMapper.java index 8475f7f25..4cf8beb5b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/dao/mapper/PdmProductSpecMapper.java +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/dao/mapper/PdmProductSpecMapper.java @@ -1,8 +1,11 @@ package org.nl.b_lms.pdm.productSpec.dao.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Select; import org.nl.b_lms.pdm.productSpec.dao.PdmProductSpec; +import java.io.Serializable; +import java.util.Collection; import java.util.List; import java.util.Map; @@ -14,5 +17,6 @@ import java.util.Map; */ public interface PdmProductSpecMapper extends BaseMapper { - + @Select("select * from pdm_product_spec where create_time > #{date} and spec in (2,3,4,5,7,9,10)") + List querySpec(String date); } diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/service/IpdmProductSpecService.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/service/IpdmProductSpecService.java index 5a9bfe873..4c80c8ff8 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/service/IpdmProductSpecService.java +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/service/IpdmProductSpecService.java @@ -21,6 +21,8 @@ import java.util.Set; */ public interface IpdmProductSpecService extends IService { public void record(SpecEnum spec, Map param, Boolean sucess,String msg, List container_name); + + public List querySubSepc(String date); } diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/service/impl/PdmProductSpecServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/service/impl/PdmProductSpecServiceImpl.java index a9ba7cb21..b1e11a152 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/service/impl/PdmProductSpecServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/productSpec/service/impl/PdmProductSpecServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.extern.log4j.Log4j; +import org.apache.commons.lang3.StringUtils; import org.nl.b_lms.pdm.productSpec.dao.PdmProductSpec; import org.nl.b_lms.pdm.productSpec.dao.mapper.PdmProductSpecMapper; import org.nl.b_lms.pdm.productSpec.service.IpdmProductSpecService; @@ -58,5 +59,14 @@ public class PdmProductSpecServiceImpl extends ServiceImpl querySubSepc(String date) { + if (StringUtils.isEmpty(date)){ + return null; + } + List pdmProductSpecs = this.baseMapper.querySpec(date); + return pdmProductSpecs; + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/common/enums/SpecEnum.java b/lms/nladmin-system/src/main/java/org/nl/common/enums/SpecEnum.java index 8871b6601..8aa9d234f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/common/enums/SpecEnum.java +++ b/lms/nladmin-system/src/main/java/org/nl/common/enums/SpecEnum.java @@ -40,4 +40,15 @@ public enum SpecEnum { } return ""; } + public static String converName(Integer value){ + if (value != null){ + for (SpecEnum specEnum : SpecEnum.values()) { + if (specEnum.getValue().equals(value)){ + return specEnum.getDesc(); + } + } + + } + return ""; + } } diff --git a/lms/nladmin-system/src/main/resources/config/application.yml b/lms/nladmin-system/src/main/resources/config/application.yml index a435e1108..a9fc87884 100644 --- a/lms/nladmin-system/src/main/resources/config/application.yml +++ b/lms/nladmin-system/src/main/resources/config/application.yml @@ -6,7 +6,7 @@ spring: freemarker: check-template-location: false profiles: - active: dev + active: prod jackson: time-zone: GMT+8 data: