futian.liu
2023-11-27 df34fa79f9616167babe07b0f63da6e9ddcc9620
consum-base/src/main/java/com/consum/base/service/LWhFormScrappedServiceImpl.java
@@ -14,23 +14,30 @@
import com.consum.base.pojo.response.FormScrappedGoodsVO;
import com.consum.base.pojo.response.GoodsModelVO;
import com.consum.base.pojo.response.LWhFormScrappedExtendVO;
import com.consum.model.po.*;
import com.consum.model.po.BaseGoodsModels;
import com.consum.model.po.BaseGoodsTemplate;
import com.consum.model.po.BaseWarehouse;
import com.consum.model.po.FinSysTenantDepartment;
import com.consum.model.po.FinSysTenantUser;
import com.consum.model.po.LWhFormScrapped;
import com.consum.model.po.LWhFormScrappedGoods;
import com.consum.model.po.SDictData;
import com.iplatform.model.po.S_user_core;
import com.walker.db.page.GenericPager;
import com.walker.infrastructure.utils.StringUtils;
import com.walker.jdbc.service.BaseServiceImpl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
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.stream.Collectors;
/**
 * @Description 报废单
@@ -59,7 +66,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 +89,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 +121,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) {
@@ -265,6 +274,16 @@
            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 -> {
                GoodsModelVO goodsModelVO = new GoodsModelVO();