cy
2023-11-29 2b20f8284d8c59549ebcb9dabca36b5bd5b35702
consum-base/src/main/java/com/consum/base/service/LWhFormScrappedServiceImpl.java
@@ -26,10 +26,7 @@
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -59,7 +56,7 @@
    @Autowired
    private LWhFormScrappedCoreService lWhFormScrappedCoreService;
    private static String QUERY_LIST = "SELECT fs.* FROM l_wh_form_scrapped fs left join l_wh_form_scrapped_goods fsg on fs.id = fsg.FORM_SCRAPPED_ID WHERE 1 = 1 ";
    private static String QUERY_LIST = "SELECT DISTINCT fs.* FROM l_wh_form_scrapped fs left join l_wh_form_scrapped_goods fsg on fs.id = fsg.FORM_SCRAPPED_ID WHERE 1 = 1 ";
    private static final String QUERY_BF_DETAIL_LIST = "select fs.id,fs.BUSINESS_FORM_CODE,fsg.GOODS_TEMPLATE_NAME,fsg.BASE_GOODS_MODELS_NAME,fsg.COUNTS,"
        + "fs.AGENCY_NAME,OPERATOR_NAME,DEAL_TIME from l_wh_form_scrapped fs "
@@ -82,11 +79,12 @@
        lWhFormScrapped.setId(lWhFormScrappedId);
        lWhFormScrapped.setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.Scrapped));
        lWhFormScrapped.setWarehouseType(warehouseType);
        // 公用
        Long warehouseId = null;
        //仓库名称
        String wareHouseName = null;
        if (warehouseType == 0){
        if (warehouseType == 0) {
            warehouseId = param.getWarehouseId();
            //根据仓库id查询仓库
            BaseWarehouse warehouse = this.baseWarehouseService.getById(warehouseId);
@@ -113,6 +111,7 @@
        lWhFormScrapped.setOperatorName(sysInfo.getUserName());
        lWhFormScrapped.setDealTime(param.getDealTime());
        lWhFormScrapped.setStates(0);
        lWhFormScrapped.setUploadFiles(param.getUploadFiles());
        //根据部门id查询部门
        FinSysTenantDepartment department = this.departmentService.getById(sysInfo.getSysDeptId());
        if (department != null) {
@@ -181,7 +180,7 @@
                scrappedGoodsList.add(scrappedGoods);
            }
            int flag2 = this.scrappedGoodsService.insert(scrappedGoodsList);
            int flag2 = this.scrappedGoodsService.insertBatch(scrappedGoodsList);
            if (flag2 != scrappedGoodsList.size()) {
                log.error("新增报废单物品记录 失败");
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -264,6 +263,16 @@
            FormScrappedGoodsVO formScrappedGoodsVO = new FormScrappedGoodsVO();
            formScrappedGoodsVO.setBaseGoodsTemplateId(baseGoodsTemplateId);
            formScrappedGoodsVO.setGoodsName(lWhFormScrappedGoods.getGoodsTemplateName());
            String sql = "select CATEGORY_NAME from base_goods_template where id = :id";
            Map<String, Object> param = new HashMap<>();
            param.put("id", baseGoodsTemplateId);
            List<Map<String, Object>> goodTemplate = this.select(sql, param, new MapperUtil());
            if (!CollectionUtils.isEmpty(goodTemplate)) {
                Optional<Map<String, Object>> first = goodTemplate.stream().findFirst();
                Map<String, Object> objectMap = first.get();
                formScrappedGoodsVO.setCategoryName(objectMap.get("categoryName").toString());
            }
            List<GoodsModelVO> goodsModelList = Lists.newArrayList();
            goodsList.forEach(item -> {
@@ -377,4 +386,5 @@
//        }
//        return scrappedExtend;
//    }
}