From 1c15dbfcab5dd355f00e35a963adffe8ca135b4f Mon Sep 17 00:00:00 2001 From: dy <dingyang@lnfxkj.tech> Date: 星期三, 23 四月 2025 11:08:13 +0800 Subject: [PATCH] 零件计划统计表和钣金计划统计表后台代码提交 --- aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java | 93 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 93 insertions(+), 0 deletions(-) diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java index 8ef46ca..defb7ec 100644 --- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java +++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java @@ -1,6 +1,19 @@ package com.aps.core.service.impl; +import java.time.LocalDateTime; import java.util.List; +import java.util.Optional; + + +import com.aps.common.core.utils.DateUtils; +import com.aps.common.core.utils.uuid.IdUtils; +import com.aps.common.security.utils.DictUtils; +import com.aps.core.domain.ApsPlatePlanTemp; +import com.aps.core.mapper.ApsPartPlanTempMapper; +import com.aps.core.mapper.ApsPlatePlanTempMapper; +import com.aps.system.api.domain.SysDictData; +import org.apache.logging.log4j.util.Strings; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.aps.core.mapper.ApsPlatePlanMapper; @@ -18,6 +31,11 @@ { @Autowired private ApsPlatePlanMapper apsPlatePlanMapper; + + @Autowired + private ApsPartPlanTempMapper apsPartPlanTempMapper; + @Autowired + private ApsPlatePlanTempMapper apsPlatePlanTempMapper; /** * 鏌ヨ閽i噾璁″垝绠$悊 @@ -52,6 +70,8 @@ @Override public int insertApsPlatePlan(ApsPlatePlan apsPlatePlan) { + apsPlatePlan.setId(IdUtils.fastUUID()); + apsPlatePlan.setCreateTime(DateUtils.getNowDate()); return apsPlatePlanMapper.insertApsPlatePlan(apsPlatePlan); } @@ -90,4 +110,77 @@ { return apsPlatePlanMapper.deleteApsPlatePlanById(id); } + + @Override + public int confirmPlan(ApsPlatePlanTemp tempPlan) { + //鍏堝垹闄ゆ墍鏈� + apsPlatePlanMapper.removeAllPlatePlans(); + //鏌ヨ涓存椂琛ㄦ暟鎹� + List<ApsPlatePlanTemp> apsPartPlanTemps=apsPlatePlanTempMapper.selectApsPlatePlanTempList(tempPlan); + int count=0; + String[] ids=new String[apsPartPlanTemps.size()]; + for (int i = 0; i <apsPartPlanTemps.size() ; i++) { + //璁板綍涓存椂琛╥d + ids[i]=apsPartPlanTemps.get(i).getId(); + ApsPlatePlan platePlan=new ApsPlatePlan(); + BeanUtils.copyProperties(apsPartPlanTemps.get(i), platePlan); + platePlan.setId(IdUtils.fastUUID()); + platePlan.setCreateTime(DateUtils.getNowDate()); + //鎻掑叆姝e紡琛紝骞惰褰� + apsPlatePlanMapper.insertApsPlatePlan(platePlan); + count++; + } + //鎻掑叆鏁伴噺涓庝复鏃惰〃鏌ヨ涓�鐩村垯鍒犻櫎涓存椂琛ㄦ暟鎹� + if (count==apsPartPlanTemps.size()) { + apsPlatePlanTempMapper.deleteApsPlatePlanTempByIds(ids); + } + return 1; + } + @Override + public String importData(List<ApsPlatePlanTemp> tempList) throws Exception { + + String batchNum= IdUtils.fastUUID(); + //鍒ゆ柇瀵煎叆鏁版嵁鏄惁涓虹┖ + if (tempList.size() > 0) { + /* + * aps_business_type aps_document_status aps_is_suspended aps_account + * */ + + List<SysDictData> suspendedDic = DictUtils.getDictCache("aps_is_suspended"); + List<SysDictData> businessTypeDic = DictUtils.getDictCache("aps_business_type"); + List<SysDictData> documentStatusDic = DictUtils.getDictCache("aps_document_status"); + List<SysDictData> accountDic = DictUtils.getDictCache("aps_account"); + for (int i = 0; i < tempList.size(); i++) { + + ApsPlatePlanTemp planTemp = tempList.get(i); + + String isSuspendedTxt = planTemp.getIsSuspended().trim(); + String businessType = planTemp.getBusinessType().trim(); + String documentStatusText = planTemp.getDocumentStatus().trim(); + String account = planTemp.getAccount().trim(); + + Optional<SysDictData> documentStatusFirst = documentStatusDic.stream().filter(x -> x.getDictLabel().equals(documentStatusText)).findFirst(); + documentStatusFirst.ifPresent(sysDictData -> planTemp.setDocumentStatus(sysDictData.getDictValue())); + + Optional<SysDictData> accountFirst = accountDic.stream().filter(x -> x.getDictLabel().equals(account)).findFirst(); + accountFirst.ifPresent(sysDictData -> planTemp.setAccount(sysDictData.getDictValue())); + + Optional<SysDictData> businessTypeFirst = businessTypeDic.stream().filter(x -> x.getDictLabel().equals(businessType)).findFirst(); + businessTypeFirst.ifPresent(sysDictData -> planTemp.setBusinessType(sysDictData.getDictValue())); + + + Optional<SysDictData> isSuspendedFirst = suspendedDic.stream().filter(x -> x.getDictLabel().equals(isSuspendedTxt)).findFirst(); + isSuspendedFirst.ifPresent(sysDictData -> planTemp.setIsSuspended(sysDictData.getDictValue())); + + planTemp.setId(IdUtils.fastUUID()); + //鎻掑叆鐗堟湰鍙� + planTemp.setBatchNumber(batchNum); + //鎻掑叆涓存椂琛� + apsPlatePlanTempMapper.insertApsPlatePlanTemp(planTemp); + } + return batchNum ; + } else { + return Strings.EMPTY; + } + } } -- Gitblit v1.9.3