File was renamed from consum-base/src/main/java/com/consum/base/service/DepFormScrappedServiceImpl.java |
| | |
| | | package com.consum.base.service; |
| | | package com.consum.base.service.impl; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.DepFormScrappedCoreServiceImpl; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.pojo.DepFormScrappedGoodsParam; |
| | |
| | | import com.consum.base.pojo.LDeptFormScrappedParam; |
| | | import com.consum.base.pojo.query.LDeptFormScrappedQry; |
| | | import com.consum.base.pojo.response.DepFormScrappedExtendVo; |
| | | import com.consum.model.po.*; |
| | | import com.consum.base.service.BaseCategoryService; |
| | | import com.consum.base.service.BaseGoodsModelsService; |
| | | import com.consum.base.service.DepFormScrappedService; |
| | | import com.consum.base.service.FinSysTenantDepartmentService; |
| | | import com.consum.base.service.LWhFormTransferService; |
| | | import com.consum.base.service.SDictDataService; |
| | | import com.consum.base.service.core.DepFormScrappedCoreService; |
| | | import com.consum.model.po.BaseCategory; |
| | | import com.consum.model.po.DepFormScrapped; |
| | | import com.consum.model.po.DepFormScrappedGoods; |
| | | import com.consum.model.po.DepFormScrappedModel; |
| | | import com.consum.model.po.FinSysTenantDepartment; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormTransfer; |
| | | import com.consum.model.po.SDictData; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import com.walker.web.ResponseValue; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import cn.hutool.core.convert.Convert; |
| | | |
| | | /** |
| | | * @ClassName DepFormScrappedServiceImpl |
| | |
| | | * @Version 1.0 |
| | | **/ |
| | | @Service |
| | | public class DepFormScrappedServiceImpl extends BaseServiceImpl { |
| | | public class DepFormScrappedServiceImpl extends BaseServiceImpl implements DepFormScrappedService { |
| | | |
| | | @Resource |
| | | private CodeGeneratorService codeGeneratorService; |
| | |
| | | @Resource |
| | | private BaseCategoryService baseCategoryService; |
| | | @Resource |
| | | private SDictDataServiceImpl sDictDataService; |
| | | private SDictDataService sDictDataService; |
| | | @Resource |
| | | private BaseGoodsModelsService baseGoodsModelsService; |
| | | |
| | | @Resource |
| | | private DepFormScrappedCoreServiceImpl depFormScrappedCoreService; |
| | | private DepFormScrappedCoreService depFormScrappedCoreService; |
| | | |
| | | @Transactional |
| | | public ResponseValue add(LDeptFormScrappedParam param, S_user_core currentUser, FinSysTenantUser sysInfo) { |
| | | @Override |
| | | public void add(LDeptFormScrappedParam param, S_user_core currentUser, FinSysTenantUser sysInfo) throws Exception { |
| | | long dealTime = DateUtils.getDateTimeNumber(System.currentTimeMillis()); |
| | | |
| | | //1.新增报废单记录 |
| | | // 1.新增报废单记录 |
| | | DepFormScrapped lDeptFormScrapped = new DepFormScrapped(); |
| | | //报废单id |
| | | // 报废单id |
| | | long lWhFormScrappedId = IdUtil.generateId(); |
| | | lDeptFormScrapped.setId(lWhFormScrappedId); |
| | | lDeptFormScrapped.setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.Scrapped)); |
| | |
| | | FinSysTenantDepartment sysTenantDepartment = departmentService.getById(param.getDepartmentId()); |
| | | if (sysTenantDepartment == null) { |
| | | log.error("部门不存在"); |
| | | return ResponseValue.error("部门不存在"); |
| | | throw new RuntimeException("部门不存在"); |
| | | } |
| | | lDeptFormScrapped.setOutWarehouseName(sysTenantDepartment.getName()); |
| | | |
| | |
| | | lDeptFormScrapped.setDealTime(param.getDealTime()); |
| | | lDeptFormScrapped.setAgencyId(Long.valueOf(sysInfo.getTenantId())); |
| | | lDeptFormScrapped.setAgencyName(sysInfo.getTenantName()); |
| | | //根据部门id查询部门 |
| | | // 根据部门id查询部门 |
| | | FinSysTenantDepartment department = this.departmentService.getById(sysInfo.getSysDeptId()); |
| | | if (department != null) { |
| | | lDeptFormScrapped.setDepartmentId(sysInfo.getSysDeptId()); |
| | |
| | | lDeptFormScrapped.setCreateTime(dealTime); |
| | | lDeptFormScrapped.setStates(1); |
| | | |
| | | //2.报废单物品【DEP_FORM_SCRAPPED_GOODS】 |
| | | // 2.报废单物品【DEP_FORM_SCRAPPED_GOODS】 |
| | | List<DepFormScrappedGoodsParam> scrappedGoodsInfo = param.getGoods(); |
| | | if (CollectionUtils.isEmpty(scrappedGoodsInfo)) { |
| | | return ResponseValue.error("报废单物品不能为空"); |
| | | throw new RuntimeException("报废单物品不能为空"); |
| | | } |
| | | ArrayList<DepFormScrappedGoods> scrappedGoodsArrayList = new ArrayList<>(); |
| | | ArrayList<DepFormScrappedModel> modelArrayList = new ArrayList<>(); |
| | |
| | | Long transBusinessId = depFormScrappedGoodsParam.getTransBusinessId(); |
| | | LWhFormTransfer lWhFormTransfer = lWhFormTransferService.get(new LWhFormTransfer(transBusinessId)); |
| | | if (lWhFormTransfer == null) { |
| | | return ResponseValue.error("报废单物品不能为空"); |
| | | throw new RuntimeException("报废单物品不能为空"); |
| | | |
| | | } |
| | | depFormScrappedGoods.setTransBusinessId(transBusinessId); |
| | |
| | | // 型号信息 |
| | | List<DepFormScrappedModelParam> modelList = depFormScrappedGoodsParam.getModels(); |
| | | if (CollectionUtils.isEmpty(modelList)) { |
| | | return ResponseValue.error("报废单物品型号不能为空"); |
| | | throw new RuntimeException("报废单物品型号不能为空"); |
| | | |
| | | } |
| | | //获取报废原因code |
| | | List<Long> scrappedCodeList = modelList.stream().map(params -> params.getScrappedCode()).collect(Collectors.toList()); |
| | | //根据报废原因code查询数据字典 |
| | | // 获取报废原因code |
| | | List<Long> scrappedCodeList = |
| | | modelList.stream().map(params -> params.getScrappedCode()).collect(Collectors.toList()); |
| | | // 根据报废原因code查询数据字典 |
| | | List<SDictData> SDictDataList = sDictDataService.selectByScrappedCodeList(scrappedCodeList); |
| | | Map<Long, String> scrappedNameMap = SDictDataList.stream().collect(Collectors.toMap(s -> s.getDict_code(), s -> s.getDict_label())); |
| | | Map<Long, String> scrappedNameMap = |
| | | SDictDataList.stream().collect(Collectors.toMap(s -> s.getDict_code(), s -> s.getDict_label())); |
| | | |
| | | for (DepFormScrappedModelParam depFormScrappedModelParam : modelList) { |
| | | DepFormScrappedModel depFormScrappedModel = new DepFormScrappedModel(); |
| | | depFormScrappedModel.setId(IdUtil.generateId()); |
| | | depFormScrappedModel.setDepFormScrappedId(lWhFormScrappedId); |
| | | depFormScrappedModel.setDepFormScrappedGoodsId(depFormScrappedGoods.getId()); |
| | | //报废原因 |
| | | // 报废原因 |
| | | depFormScrappedModel.setScrappedCode(depFormScrappedModelParam.getScrappedCode()); |
| | | depFormScrappedModel.setScrappedName(scrappedNameMap.get(depFormScrappedModel.getScrappedCode())); |
| | | |
| | | // 物品 及 型号 信息 |
| | | Long baseGoodsModelsId = depFormScrappedModelParam.getBaseGoodsModelsId(); |
| | | if (baseGoodsModelsId == null) { |
| | | return ResponseValue.error("报废单物品型号不能为空"); |
| | | throw new RuntimeException("报废单物品型号不能为空"); |
| | | } |
| | | List<Map<String, Object>> modelInfoList = baseGoodsModelsService.queryGoodsModelInfo(baseGoodsModelsId); |
| | | if (CollectionUtils.isEmpty(modelInfoList)) { |
| | | return ResponseValue.error("未查询到报废单物品型号"); |
| | | throw new RuntimeException("未查询到报废单物品型号"); |
| | | } |
| | | Map<String, Object> modelInfo = modelInfoList.get(0); |
| | | depFormScrappedModel.setBaseGoodsTemplateId(Convert.toLong(modelInfo.get("goodsId"))); |
| | |
| | | depFormScrappedModel.setBaseGoodsModelsId(baseGoodsModelsId); |
| | | depFormScrappedModel.setBaseGoodsModelsName(Convert.toStr(modelInfo.get("modelName"))); |
| | | |
| | | //调拨单信息 |
| | | // 调拨单信息 |
| | | depFormScrappedModel.setProcureModelUserId(depFormScrappedModelParam.getModelUserId()); |
| | | depFormScrappedModel.setGoodsUserName(depFormScrappedModelParam.getNowUserName()); |
| | | depFormScrappedModel.setInitialCount(depFormScrappedModelParam.getGoodsNum()); |
| | | depFormScrappedModel.setUseCount(depFormScrappedModelParam.getUserUseCount()); |
| | | depFormScrappedModel.setCounts(depFormScrappedModelParam.getCounts()); |
| | | |
| | | //增加到批量插入list |
| | | // 增加到批量插入list |
| | | modelArrayList.add(depFormScrappedModel); |
| | | } |
| | | //增加到批量插入list |
| | | // 增加到批量插入list |
| | | scrappedGoodsArrayList.add(depFormScrappedGoods); |
| | | } |
| | | |
| | | int flag1 = this.insert(lDeptFormScrapped); |
| | | if (flag1 == 0) { |
| | | log.error("新增报废单失败"); |
| | | return ResponseValue.error("新增报废单失败"); |
| | | throw new RuntimeException("新增报废单失败"); |
| | | } |
| | | int i = insertBatch(scrappedGoodsArrayList); |
| | | int i2 = insertBatch(modelArrayList); |
| | | depFormScrappedCoreService.updateScrapped(lWhFormScrappedId,currentUser,dealTime); |
| | | return ResponseValue.success(); |
| | | insertBatch(scrappedGoodsArrayList); |
| | | insertBatch(modelArrayList); |
| | | depFormScrappedCoreService.updateScrapped(lWhFormScrappedId, currentUser, dealTime); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description 列表查询 |
| | | */ |
| | | private static String QUERY_LIST = "SELECT scrap.id,scrap.BUSINESS_FORM_CODE,scrap.AGENCY_NAME,scrap.DEPARTMENT_NAME,scrap.OPERATOR_NAME,scrap.DEAL_TIME,model.BASE_GOODS_TEMPLATE_ID,model.BASE_GOODS_TEMPLATE_NAME,SUM(model.COUNTS) total_Count,model.unit FROM DEP_FORM_SCRAPPED scrap LEFT JOIN DEP_FORM_SCRAPPED_MODEL model ON scrap.id=model.DEP_FORM_SCRAPPED_ID where 1=1"; |
| | | private static String QUERY_LIST_END = " GROUP BY scrap.id,scrap.BUSINESS_FORM_CODE,scrap.DEPARTMENT_NAME,scrap.OPERATOR_NAME,scrap.DEAL_TIME,model.BASE_GOODS_TEMPLATE_ID,model.BASE_GOODS_TEMPLATE_NAME ORDER BY scrap.DEAL_TIME DESC"; |
| | | private static String QUERY_LIST = |
| | | "SELECT scrap.id,scrap.BUSINESS_FORM_CODE,scrap.AGENCY_NAME,scrap.DEPARTMENT_NAME,scrap.OPERATOR_NAME,scrap.DEAL_TIME,model.BASE_GOODS_TEMPLATE_ID,model.BASE_GOODS_TEMPLATE_NAME,SUM(model.COUNTS) total_Count,model.unit FROM DEP_FORM_SCRAPPED scrap LEFT JOIN DEP_FORM_SCRAPPED_MODEL model ON scrap.id=model.DEP_FORM_SCRAPPED_ID where 1=1"; |
| | | private static String QUERY_LIST_END = |
| | | " GROUP BY scrap.id,scrap.BUSINESS_FORM_CODE,scrap.DEPARTMENT_NAME,scrap.OPERATOR_NAME,scrap.DEAL_TIME,model.BASE_GOODS_TEMPLATE_ID,model.BASE_GOODS_TEMPLATE_NAME ORDER BY scrap.DEAL_TIME DESC"; |
| | | |
| | | @Override |
| | | public GenericPager<Map<String, Object>> queryList(LDeptFormScrappedQry param) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder(QUERY_LIST); |
| | | //报废单号 |
| | | // 报废单号 |
| | | if (!StringUtils.isEmpty(param.getBusinessFormCode())) { |
| | | sql.append(" and scrap.BUSINESS_FORM_CODE = :businessFormCode "); |
| | | paramts.put("businessFormCode", param.getBusinessFormCode()); |
| | | } |
| | | //机构 |
| | | // 机构 |
| | | if (param.getAgencyId() != null) { |
| | | sql.append(" and scrap.AGENCY_ID = :agencyId "); |
| | | paramts.put("agencyId", param.getAgencyId()); |
| | | } |
| | | //物品名称 |
| | | // 物品名称 |
| | | if (!StringUtils.isEmpty(param.getGoodsTemplateName())) { |
| | | sql.append(" and model.BASE_GOODS_TEMPLATE_NAME LIKE :goodsTemplateName "); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("goodsTemplateName", |
| | | StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //创建人 |
| | | // 创建人 |
| | | if (!StringUtils.isEmpty(param.getOperatorName())) { |
| | | sql.append(" and scrap.OPERATOR_NAME LIKE :operatorName "); |
| | | paramts.put("operatorName", StringUtils.CHAR_PERCENT + param.getOperatorName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //报废时间 |
| | | // 报废时间 |
| | | if (param.getStartTime() != null) { |
| | | sql.append(" and scrap.DEAL_TIME >=:dealTimeStart "); |
| | | paramts.put("dealTimeStart", param.getStartTime() * 1000000); |
| | |
| | | return selectSplit(sql.toString(), paramts, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description 根据id查询详情 |
| | | */ |
| | | @Override |
| | | public DepFormScrappedExtendVo getById(Long id) { |
| | | DepFormScrappedExtendVo scrappedExtend = new DepFormScrappedExtendVo(); |
| | | //1.查询报废单 |
| | | // 1.查询报废单 |
| | | DepFormScrapped lWhFormScrapped = this.get(new DepFormScrapped(id)); |
| | | if (lWhFormScrapped != null) { |
| | | BeanUtils.copyProperties(lWhFormScrapped, scrappedExtend); |
| | | } |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | |
| | | //2.查询报废单物品 |
| | | // 2.查询报废单物品 |
| | | DepFormScrappedGoods goodsQuery = new DepFormScrappedGoods(); |
| | | goodsQuery.setDepFormScrappedId(id); |
| | | List<DepFormScrappedGoods> formScrappedGoodsList = select(goodsQuery); |
| | |
| | | depFormScrappedModel.setDepFormScrappedGoodsId(scrappedGoodsId); |
| | | List<DepFormScrappedModel> scrappedModelList = select(depFormScrappedModel); |
| | | List<List<DepFormScrappedModel>> modelList = scrappedModelList.stream() |
| | | .collect(Collectors.groupingBy(DepFormScrappedModel::getBaseGoodsModelsId)) |
| | | .values().stream() |
| | | .map(list -> list.stream().collect(Collectors.toList())) |
| | | .collect(Collectors.toList()); |
| | | .collect(Collectors.groupingBy(DepFormScrappedModel::getBaseGoodsModelsId)).values().stream() |
| | | .map(list -> list.stream().collect(Collectors.toList())).collect(Collectors.toList()); |
| | | |
| | | scrappedGoodsMap.put("models", modelList); |
| | | goodsList.add(scrappedGoodsMap); |
| | |
| | | return scrappedExtend; |
| | | } |
| | | |
| | | private static String EXPORT_SQL = "SELECT scrap.id,scrap.BUSINESS_FORM_CODE,model.BASE_GOODS_TEMPLATE_NAME,model.BASE_GOODS_MODELS_NAME,model.COUNTS,scrap.AGENCY_NAME,scrap.DEPARTMENT_NAME,scrap.OPERATOR_NAME,scrap.DEAL_TIME,scrap.OUT_WAREHOUSE_NAME,ROUND( IFNULL( TOTAL_AMOUNT, 0 )/ 100, 2 ) AS TOTAL_PRICE,model.SCRAPPED_NAME,NULL AS bz FROM DEP_FORM_SCRAPPED scrap LEFT JOIN DEP_FORM_SCRAPPED_MODEL model ON scrap.id=model.DEP_FORM_SCRAPPED_ID WHERE 1=1 "; |
| | | private static String EXPORT_SQL = |
| | | "SELECT scrap.id,scrap.BUSINESS_FORM_CODE,model.BASE_GOODS_TEMPLATE_NAME,model.BASE_GOODS_MODELS_NAME,model.COUNTS,scrap.AGENCY_NAME,scrap.DEPARTMENT_NAME,scrap.OPERATOR_NAME,scrap.DEAL_TIME,scrap.OUT_WAREHOUSE_NAME,ROUND( IFNULL( TOTAL_AMOUNT, 0 )/ 100, 2 ) AS TOTAL_PRICE,model.SCRAPPED_NAME,NULL AS bz FROM DEP_FORM_SCRAPPED scrap LEFT JOIN DEP_FORM_SCRAPPED_MODEL model ON scrap.id=model.DEP_FORM_SCRAPPED_ID WHERE 1=1 "; |
| | | private static String EXPORT_SQL_END = "order by scrap.DEAL_TIME DESC"; |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> export(Long id, String agencyId) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder(EXPORT_SQL); |
| | | //报废单号 |
| | | // 报废单号 |
| | | if (id != null) { |
| | | sql.append(" and scrap.id = :id"); |
| | | paramts.put("id", id); |
| | | } |
| | | //机构 |
| | | // 机构 |
| | | sql.append(" and scrap.AGENCY_ID = :agencyId "); |
| | | if (agencyId != null) { |
| | | paramts.put("agencyId", agencyId); |
| | |
| | | return select(sql.append(EXPORT_SQL_END).toString(), paramts, new MapperUtil()); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> listByModel(LDeptFormScrappedQry param) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder(EXPORT_SQL); |
| | | //报废单id |
| | | // 报废单id |
| | | if (param.getId() != null) { |
| | | sql.append(" and scrap.id = :id"); |
| | | paramts.put("id", param.getId()); |
| | | } |
| | | //报废单号 |
| | | // 报废单号 |
| | | if (param.getBusinessFormCode() != null) { |
| | | sql.append(" and scrap.BUSINESS_FORM_CODE= :businessFormCode"); |
| | | paramts.put("businessFormCode", param.getBusinessFormCode()); |
| | | } |
| | | //物品名称 |
| | | // 物品名称 |
| | | if (StringUtils.isNotEmpty(param.getGoodsTemplateName())) { |
| | | sql.append(" and model.BASE_GOODS_TEMPLATE_NAME LIKE :goodsTemplateName "); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("goodsTemplateName", |
| | | StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //规格型号 |
| | | // 规格型号 |
| | | if (param.getBaseGoodsModelsId() != null) { |
| | | sql.append("and model.BASE_GOODS_MODELS_ID =:baseGoodsModelsId "); |
| | | paramts.put("baseGoodsModelsId", param.getBaseGoodsModelsId()); |
| | | } |
| | | |
| | | //机构 |
| | | // 机构 |
| | | if (param.getAgencyId() != null) { |
| | | sql.append(" and scrap.AGENCY_ID = :agencyId "); |
| | | paramts.put("agencyId", param.getAgencyId()); |
| | |
| | | sql.append(" and scrap.OUT_WAREHOUSE_ID= :departmentId"); |
| | | paramts.put("departmentId", param.getDepartmentId()); |
| | | } |
| | | //创建人 |
| | | // 创建人 |
| | | if (!StringUtils.isEmpty(param.getOperatorName())) { |
| | | sql.append(" and scrap.OPERATOR_NAME LIKE :operatorName "); |
| | | paramts.put("operatorName", StringUtils.CHAR_PERCENT + param.getOperatorName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //报废时间 |
| | | // 报废时间 |
| | | if (param.getStartTime() != null) { |
| | | sql.append(" and scrap.DEAL_TIME >=:dealTimeStart "); |
| | | paramts.put("dealTimeStart", param.getStartTime() * 1000000); |
| | |
| | | return select(sql.append(EXPORT_SQL_END).toString(), paramts, new MapperUtil()); |
| | | } |
| | | |
| | | @Override |
| | | public GenericPager<Map<String, Object>> listByModel2(LDeptFormScrappedQry param) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder(EXPORT_SQL); |
| | | //报废单id |
| | | // 报废单id |
| | | if (param.getId() != null) { |
| | | sql.append(" and scrap.id = :id"); |
| | | paramts.put("id", param.getId()); |
| | | } |
| | | //报废单号 |
| | | // 报废单号 |
| | | if (param.getBusinessFormCode() != null) { |
| | | sql.append(" and scrap.BUSINESS_FORM_CODE= :businessFormCode"); |
| | | paramts.put("businessFormCode", param.getBusinessFormCode()); |
| | | } |
| | | //物品名称 |
| | | // 物品名称 |
| | | if (StringUtils.isNotEmpty(param.getGoodsTemplateName())) { |
| | | sql.append(" and model.BASE_GOODS_TEMPLATE_NAME LIKE :goodsTemplateName "); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("goodsTemplateName", |
| | | StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //规格型号 |
| | | // 规格型号 |
| | | if (param.getBaseGoodsModelsId() != null) { |
| | | sql.append("and model.BASE_GOODS_MODELS_ID =:baseGoodsModelsId "); |
| | | paramts.put("baseGoodsModelsId", param.getBaseGoodsModelsId()); |
| | | } |
| | | |
| | | //机构 |
| | | // 机构 |
| | | if (param.getAgencyId() != null) { |
| | | sql.append(" and scrap.AGENCY_ID = :agencyId "); |
| | | paramts.put("agencyId", param.getAgencyId()); |
| | |
| | | sql.append(" and scrap.OUT_WAREHOUSE_ID= :departmentId"); |
| | | paramts.put("departmentId", param.getDepartmentId()); |
| | | } |
| | | //创建人 |
| | | // 创建人 |
| | | if (!StringUtils.isEmpty(param.getOperatorName())) { |
| | | sql.append(" and scrap.OPERATOR_NAME LIKE :operatorName "); |
| | | paramts.put("operatorName", StringUtils.CHAR_PERCENT + param.getOperatorName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //报废时间 |
| | | // 报废时间 |
| | | if (param.getStartTime() != null) { |
| | | sql.append(" and scrap.DEAL_TIME >=:dealTimeStart "); |
| | | paramts.put("dealTimeStart", param.getStartTime() * 1000000); |
| | |
| | | sql.append(" and scrap.DEAL_TIME <:dealTimeEnd "); |
| | | paramts.put("dealTimeEnd", param.getEndTime() * 1000000 + 240000); |
| | | } |
| | | return selectSplit(sql.append(EXPORT_SQL_END).toString(),paramts, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | return selectSplit(sql.append(EXPORT_SQL_END).toString(), paramts, param.getPageNum(), param.getPageSize(), |
| | | new MapperUtil()); |
| | | |
| | | // return select(sql.append(EXPORT_SQL_END).toString(), paramts, new MapperUtil()); |
| | | } |
| | | |
| | | private static String GET_BF_MODEL_LIST = "SELECT\n" + |
| | | "\tscrGoods.TRANS_BUSINESS_ID,\n" + |
| | | "\tscrGoods.BUSINESS_FORM_CODE,\n" + |
| | | "\tscrGoods.TRANS_OUT_WAREHOUSE_TYPE,\n" + |
| | | "\tscrGoods.TRANS_OUT_WAREHOUSE_ID,\n" + |
| | | "\tgoodsModel.BASE_GOODS_TEMPLATE_ID,\n" + |
| | | "\tgoodsModel.COUNTS,\n" + |
| | | "\tgoodsModel.PROCURE_MODEL_USER_ID,\n" + |
| | | "\tgoodsModel.GOODS_USER_NAME \n" + |
| | | "FROM\n" + |
| | | "\tDEP_FORM_SCRAPPED_GOODS scrGoods\n" + |
| | | "\tLEFT JOIN DEP_FORM_SCRAPPED_MODEL goodsModel ON scrgoods.id = goodsModel.DEP_FORM_SCRAPPED_GOODS_ID"; |
| | | |
| | | public List<Map<String, Object>> getBfModelList(Long lWhFormScrappedId) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder(GET_BF_MODEL_LIST); |
| | | //报废单id |
| | | sql.append(" and scrGoods.DEP_FORM_SCRAPPED_ID = :lWhFormScrappedId"); |
| | | paramts.put("lWhFormScrappedId", lWhFormScrappedId); |
| | | return select(sql.toString(), paramts, new MapperUtil()); |
| | | } |
| | | } |