Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c06be418c2
|
|
@ -1,7 +1,9 @@
|
|||
package com.bonus.common.biz.utils;
|
||||
package com.bonus.material.common.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.utils.StringHelper;
|
||||
import com.bonus.material.ma.service.ITypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
|
|
@ -11,7 +13,9 @@ import org.apache.http.entity.mime.MultipartEntityBuilder;
|
|||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
|
|
@ -22,8 +26,12 @@ import java.nio.charset.StandardCharsets;
|
|||
* @author bonus
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutomaticHttpHelper {
|
||||
|
||||
@Resource
|
||||
private ITypeService typeService;
|
||||
|
||||
public static final String KEY = "$jqgcYouote@c103";
|
||||
|
||||
public static String sendHttpPost(String url, String JSONBody) throws Exception {
|
||||
|
|
@ -40,7 +48,7 @@ public class AutomaticHttpHelper {
|
|||
return responseContent;
|
||||
}
|
||||
|
||||
public static String sendHttpPostPushCost(String url, String JSONBody) throws Exception {
|
||||
public String sendHttpPostPushCost(String url, String JSONBody) throws Exception {
|
||||
// 获取token
|
||||
String token = getToken();
|
||||
if (StringHelper.isEmpty(token)) {
|
||||
|
|
@ -187,11 +195,13 @@ public class AutomaticHttpHelper {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
private static String getToken() {
|
||||
private String getToken() {
|
||||
// 立体库本地测试token路径
|
||||
//String tokenUrl = MaterialConstants.TEST_TOKEN_URL;
|
||||
// 立体库生产环境token路径
|
||||
String tokenUrl = MaterialConstants.PROD_TOKEN_URL;
|
||||
//String tokenUrl = MaterialConstants.PROD_TOKEN_URL;
|
||||
// 改为从数据库根据key直接获取,方便后期维护
|
||||
String tokenUrl = typeService.getAsToken();
|
||||
log.info("立体仓获取token路径:{}", tokenUrl);
|
||||
try {
|
||||
String userName = "ZNXT";
|
||||
|
|
@ -4,20 +4,18 @@ import java.io.OutputStream;
|
|||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.common.biz.constant.GlobalConstants;
|
||||
import com.bonus.common.biz.domain.purchase.AutomaticInPutDto;
|
||||
import com.bonus.common.biz.domain.purchase.AutomaticOutPutDto;
|
||||
import com.bonus.common.biz.domain.repair.RepairInputDetails;
|
||||
import com.bonus.common.biz.enums.*;
|
||||
import com.bonus.common.biz.utils.AutomaticHttpHelper;
|
||||
import com.bonus.material.common.utils.AutomaticHttpHelper;
|
||||
import com.bonus.material.basic.domain.BmAgreementInfo;
|
||||
import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
|
||||
import com.bonus.material.common.mapper.SelectMapper;
|
||||
import com.bonus.material.ma.service.ITypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
|
|
@ -97,6 +95,12 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
@Resource
|
||||
private BmAgreementInfoMapper bmAgreementInfoMapper;
|
||||
|
||||
@Resource
|
||||
private AutomaticHttpHelper automaticHttpHelper;
|
||||
|
||||
@Resource
|
||||
private ITypeService typeService;
|
||||
|
||||
/**
|
||||
* 查询领料任务
|
||||
*
|
||||
|
|
@ -1655,9 +1659,10 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
// 立体库本地建立出库单接口路径
|
||||
//String url = MaterialConstants.TEST_CREATE_OUT_URL;
|
||||
// 立体库生产建立出库单接口路径
|
||||
String url = MaterialConstants.PROD_CREATE_OUT_URL;
|
||||
//String url = MaterialConstants.PROD_CREATE_OUT_URL;
|
||||
String url = typeService.getAsOutUrl();
|
||||
log.info("立体仓建立出库单路径:{}", url);
|
||||
String data = AutomaticHttpHelper.sendHttpPostPushCost(url, body);
|
||||
String data = automaticHttpHelper.sendHttpPostPushCost(url, body);
|
||||
log.info("传输立体仓返回data:{}", data);
|
||||
if (StringUtils.isEmpty(data)) {
|
||||
System.err.println("立体仓出库单创建失败");
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import com.bonus.common.biz.domain.purchase.AutomaticOutPutDto;
|
|||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.biz.enums.LeaseTaskStatusEnum;
|
||||
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
||||
import com.bonus.common.biz.utils.AutomaticHttpHelper;
|
||||
import com.bonus.material.common.utils.AutomaticHttpHelper;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
|
|
@ -118,6 +118,9 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
|||
@Resource
|
||||
private ITypeService typeService;
|
||||
|
||||
@Resource
|
||||
private AutomaticHttpHelper automaticHttpHelper;
|
||||
|
||||
|
||||
/**
|
||||
* 新增领用任务
|
||||
|
|
@ -1221,8 +1224,9 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
|||
// 立体库本地建立出库单接口路径
|
||||
//String url = MaterialConstants.TEST_CREATE_OUT_URL;
|
||||
// 立体库生产建立出库单接口路径
|
||||
String url = MaterialConstants.PROD_CREATE_OUT_URL;
|
||||
String data = AutomaticHttpHelper.sendHttpPostPushCost(url, body);
|
||||
//String url = MaterialConstants.PROD_CREATE_OUT_URL;
|
||||
String url = typeService.getAsOutUrl();
|
||||
String data = automaticHttpHelper.sendHttpPostPushCost(url, body);
|
||||
if (StringUtils.isEmpty(data)) {
|
||||
throw new RuntimeException("立体仓出库单创建失败");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import com.bonus.common.biz.domain.purchase.AutomaticInPutDto;
|
|||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.biz.enums.MaTypeManageTypeEnum;
|
||||
import com.bonus.common.biz.enums.PurchaseTaskStatusEnum;
|
||||
import com.bonus.common.biz.utils.AutomaticHttpHelper;
|
||||
import com.bonus.material.common.utils.AutomaticHttpHelper;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.lease.mapper.LeaseOutDetailsMapper;
|
||||
|
|
@ -22,6 +22,7 @@ import com.bonus.material.purchase.service.IPurchaseStorageService;
|
|||
import com.bonus.material.purchase.domain.vo.PurchaseVo;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -36,6 +37,7 @@ import java.util.stream.Collectors;
|
|||
* @create 2024/10/21 13:53
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
||||
|
||||
@Resource
|
||||
|
|
@ -56,6 +58,9 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
@Resource
|
||||
private ITypeService typeService;
|
||||
|
||||
@Resource
|
||||
private AutomaticHttpHelper automaticHttpHelper;
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock(true);
|
||||
|
||||
/**
|
||||
|
|
@ -277,33 +282,18 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
// 立体库本地建立入库单接口路径
|
||||
//String url = MaterialConstants.TEST_CREATE_IN_URL;
|
||||
// 立体库生产建立入库单接口路径
|
||||
String url = MaterialConstants.PROD_CREATE_IN_URL;
|
||||
String data = AutomaticHttpHelper.sendHttpPostPushCost(url, body);
|
||||
//String url = MaterialConstants.PROD_CREATE_IN_URL;
|
||||
String url = typeService.getAsInUrl();
|
||||
log.info("立体库获取建立新购入库单路径:{}", url);
|
||||
String data = automaticHttpHelper.sendHttpPostPushCost(url, body);
|
||||
log.info("立体库建立新购入库单返回data:{}", data);
|
||||
if (StringUtils.isEmpty(data)) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "立体仓入库单创建失败");
|
||||
}
|
||||
JSONObject object = JSONObject.parseObject(data);
|
||||
String code = object.getString("code");
|
||||
if ("0".equals(code)) {
|
||||
// 修改状态为待上架
|
||||
if (CollectionUtils.isEmpty(purchaseDto.getInPutList())) {
|
||||
// 数量设备
|
||||
purchaseStorageMapper.updateNumById(PurchaseTaskStatusEnum.TO_UPLOAD.getStatus(), purchaseDto.getPurchaseId(), purchaseDto.getInputNum());
|
||||
} else {
|
||||
// 修改上架数量
|
||||
purchaseStorageMapper.updateUpNum(Long.valueOf(purchaseDto.getPurchaseId()), BigDecimal.valueOf(purchaseDto.getInPutList().size()));
|
||||
// 编码设备
|
||||
for (PurchaseDto dto : purchaseDto.getInPutList()) {
|
||||
dto.setTypeId(purchaseDto.getTypeId());
|
||||
// 待上架
|
||||
dto.setMaStatus("19");
|
||||
purchaseStorageMapper.updateMaStatus(dto);
|
||||
}
|
||||
// 修改详情任务状态
|
||||
purchaseStorageMapper.updatePurchaseStatus(PurchaseTaskStatusEnum.TO_UPLOAD.getStatus(), Integer.parseInt(purchaseDto.getPurchaseId()));
|
||||
}
|
||||
return AjaxResult.success("立体仓入库单创建成功");
|
||||
} else {
|
||||
log.info("立体库建立新购入库单返回code:{}", code);
|
||||
if (!"0".equals(code)) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "立体仓入库单创建失败");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,16 +40,20 @@ public interface IwsCostPushMapper {
|
|||
*/
|
||||
int insertCalcMonthRecord(IwsCostPushBean record);
|
||||
|
||||
List<IwsCostPushBean> selectCalcMonthRecord(IwsCostPushBean record);
|
||||
|
||||
/**
|
||||
* 插入项目月费用info数据 -- 批量
|
||||
*/
|
||||
int insertProjectMonthCosts(List<IwsCostPushBean> list);
|
||||
int updateProjectMonthCosts(IwsCostPushBean vo);
|
||||
List<IwsCostPushBean> selectHaveProjectMonthCosts(IwsCostPushBean vo);
|
||||
|
||||
/**
|
||||
* 插入项目月费用details数据 -- 批量
|
||||
*/
|
||||
int insertProjectMonthCostsDetails(@Param("list") List<PeriodCostResultVo> list);
|
||||
|
||||
List<PeriodCostResultVo> selectHaveProjectMonthCostsDetails(PeriodCostResultVo vo);
|
||||
/**
|
||||
* 根据协议ID查询领用物资数据
|
||||
* @param record 协议信息及条件
|
||||
|
|
|
|||
|
|
@ -122,7 +122,12 @@ public class IwsCostPushServiceImpl implements IwsCostPushService {
|
|||
//cleanSameMonthOldRecords(record);
|
||||
|
||||
// 插入新的当前月份,并生成记录id
|
||||
iwsCostPushMapper.insertCalcMonthRecord(costDto);
|
||||
List<IwsCostPushBean> monthList=iwsCostPushMapper.selectCalcMonthRecord(costDto);
|
||||
if(monthList==null||monthList.size()==0){
|
||||
iwsCostPushMapper.insertCalcMonthRecord(costDto);
|
||||
}else{
|
||||
costDto.setTaskId(monthList.get(0).getTaskId());
|
||||
}
|
||||
|
||||
// 查询协议信息列表
|
||||
List<IwsCostPushBean> agreementList = iwsCostPushMapper.findAgreement(costDto);
|
||||
|
|
@ -296,9 +301,24 @@ public class IwsCostPushServiceImpl implements IwsCostPushService {
|
|||
.setConsumeMoney(vo.getConsumeCost())
|
||||
);
|
||||
}
|
||||
|
||||
List<IwsCostPushBean> uplist=new ArrayList<>();
|
||||
List<IwsCostPushBean> addlist=new ArrayList<>();
|
||||
//将已录入的数据筛选出来
|
||||
for(IwsCostPushBean vo:resultArray){
|
||||
List<IwsCostPushBean> haveList=iwsCostPushMapper.selectHaveProjectMonthCosts(vo);
|
||||
if(haveList!=null&&haveList.size()>0){
|
||||
uplist.add(vo);
|
||||
}else{
|
||||
addlist.add(vo);
|
||||
}
|
||||
}
|
||||
// 批量插入 -- 存入数据库costs列表
|
||||
int addProjectMonthCostsMapperResult = iwsCostPushMapper.insertProjectMonthCosts(resultArray);
|
||||
int addProjectMonthCostsMapperResult = iwsCostPushMapper.insertProjectMonthCosts(addlist);
|
||||
try{
|
||||
for(IwsCostPushBean vo:uplist){
|
||||
iwsCostPushMapper.updateProjectMonthCosts(vo);
|
||||
}
|
||||
}catch (Exception e){}
|
||||
// 批量插入 -- 存入数据库租赁费用明细(project_month_info表)
|
||||
if (CollectionUtils.isNotEmpty(unsettlementEquipmentLeaseCostsDetails)) {
|
||||
// (工器具)未结算租赁费用的存入
|
||||
|
|
@ -306,7 +326,16 @@ public class IwsCostPushServiceImpl implements IwsCostPushService {
|
|||
item.setTaskId(costDto.getTaskId());
|
||||
item.setEquipmentType((byte) 1);
|
||||
});
|
||||
iwsCostPushMapper.insertProjectMonthCostsDetails(unsettlementEquipmentLeaseCostsDetails);
|
||||
List<PeriodCostResultVo> addDetailList=new ArrayList<>();
|
||||
//将已录入的数据筛选出来
|
||||
for(PeriodCostResultVo vo:unsettlementEquipmentLeaseCostsDetails){
|
||||
List<PeriodCostResultVo> haveList=iwsCostPushMapper.selectHaveProjectMonthCostsDetails(vo);
|
||||
if(haveList!=null&&haveList.size()>0){
|
||||
}else{
|
||||
addDetailList.add(vo);
|
||||
}
|
||||
}
|
||||
iwsCostPushMapper.insertProjectMonthCostsDetails(addDetailList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(settlementEquipmentCostsDetails)) {
|
||||
// (工器具)已结算租赁费用的存入
|
||||
|
|
@ -314,7 +343,16 @@ public class IwsCostPushServiceImpl implements IwsCostPushService {
|
|||
item.setTaskId(costDto.getTaskId());
|
||||
item.setEquipmentType((byte) 1);
|
||||
});
|
||||
iwsCostPushMapper.insertProjectMonthCostsDetails(settlementEquipmentCostsDetails);
|
||||
List<PeriodCostResultVo> addDetailList=new ArrayList<>();
|
||||
//将已录入的数据筛选出来
|
||||
for(PeriodCostResultVo vo:settlementEquipmentCostsDetails){
|
||||
List<PeriodCostResultVo> haveList=iwsCostPushMapper.selectHaveProjectMonthCostsDetails(vo);
|
||||
if(haveList!=null&&haveList.size()>0){
|
||||
}else{
|
||||
addDetailList.add(vo);
|
||||
}
|
||||
}
|
||||
iwsCostPushMapper.insertProjectMonthCostsDetails(addDetailList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(unsettlementSafetyEquipmentLeaseCostsDetails)) {
|
||||
// (安全工器具)未结算租赁费用的存入
|
||||
|
|
@ -322,7 +360,16 @@ public class IwsCostPushServiceImpl implements IwsCostPushService {
|
|||
item.setTaskId(costDto.getTaskId());
|
||||
item.setEquipmentType((byte) 2);
|
||||
});
|
||||
iwsCostPushMapper.insertProjectMonthCostsDetails(unsettlementSafetyEquipmentLeaseCostsDetails);
|
||||
List<PeriodCostResultVo> addDetailList=new ArrayList<>();
|
||||
//将已录入的数据筛选出来
|
||||
for(PeriodCostResultVo vo:unsettlementSafetyEquipmentLeaseCostsDetails){
|
||||
List<PeriodCostResultVo> haveList=iwsCostPushMapper.selectHaveProjectMonthCostsDetails(vo);
|
||||
if(haveList!=null&&haveList.size()>0){
|
||||
}else{
|
||||
addDetailList.add(vo);
|
||||
}
|
||||
}
|
||||
iwsCostPushMapper.insertProjectMonthCostsDetails(addDetailList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(settlementSafetyEquipmentCostsDetails)) {
|
||||
// (安全工器具)已结算租赁费用的存入
|
||||
|
|
@ -330,7 +377,16 @@ public class IwsCostPushServiceImpl implements IwsCostPushService {
|
|||
item.setTaskId(costDto.getTaskId());
|
||||
item.setEquipmentType((byte) 2);
|
||||
});
|
||||
iwsCostPushMapper.insertProjectMonthCostsDetails(settlementSafetyEquipmentCostsDetails);
|
||||
List<PeriodCostResultVo> addDetailList=new ArrayList<>();
|
||||
//将已录入的数据筛选出来
|
||||
for(PeriodCostResultVo vo:settlementSafetyEquipmentCostsDetails){
|
||||
List<PeriodCostResultVo> haveList=iwsCostPushMapper.selectHaveProjectMonthCostsDetails(vo);
|
||||
if(haveList!=null&&haveList.size()>0){
|
||||
}else{
|
||||
addDetailList.add(vo);
|
||||
}
|
||||
}
|
||||
iwsCostPushMapper.insertProjectMonthCostsDetails(addDetailList);
|
||||
}
|
||||
|
||||
return 0 < addProjectMonthCostsMapperResult ? AjaxResult.success("月结费用计算成功") : AjaxResult.error("月结费用计算失败");
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public class IwsCostPushTask {
|
|||
* 定时任务 -- 计算月结费用 -- 每月最后一天的23点30分执行
|
||||
*/
|
||||
@Scheduled(cron = "0 30 23 L * ?")
|
||||
// @Scheduled(fixedDelay = 1000*60*30)
|
||||
public void computeTheMonthCostTask() {
|
||||
System.out.println("-----------开始计算四类未结算费用定时器-----------");
|
||||
iwsCostPushService.computeTheMonthCost(new IwsCostPushBean());
|
||||
|
|
@ -66,6 +67,7 @@ public class IwsCostPushTask {
|
|||
/**
|
||||
* 定时任务 -- 保存未结算报表记录(工器具) -- 每月最后一天的23点00分执行
|
||||
*/
|
||||
// @Scheduled(fixedDelay = 1000*60*30)
|
||||
@Scheduled(cron = "0 00 23 L * ?", zone = "Asia/Shanghai")
|
||||
public void saveUnSltHistoryReport() {
|
||||
System.out.println("-----------开始执行保存未结算记录定时器-----------");
|
||||
|
|
@ -170,7 +172,14 @@ public class IwsCostPushTask {
|
|||
}
|
||||
|
||||
try {
|
||||
validRecords.forEach(vo -> vo.setYearMonth(DateTime.now().toString("yyyyMM")));
|
||||
// 根据 协议ID、结算类型、年月 删除多余数据
|
||||
for(SltInfoVo vo:validRecords){
|
||||
vo.setYearMonth(DateTime.now().toString("yyyyMM"));
|
||||
List<SltInfoVo> oldList=sltAgreementInfoMapper.selectOldHistoryReport(vo);
|
||||
if(oldList!=null&&oldList.size()>0){
|
||||
sltAgreementInfoMapper.deleteOldHistoryReport(vo);
|
||||
}
|
||||
}
|
||||
int rows = sltAgreementInfoMapper.addSltHistoryReport(validRecords);
|
||||
log.info("未结算报表定时器:保存未结算报表记录完成,受影响行数:{}", rows);
|
||||
|
||||
|
|
@ -186,6 +195,14 @@ public class IwsCostPushTask {
|
|||
detail.setYearMonth(DateTime.now().toString("yyyyMM"));
|
||||
detail.setSettlementType(1);
|
||||
});
|
||||
// 根据 协议ID、结算类型、年月、(1租赁 2维修 3丢失 4报废) 删除多余数据
|
||||
for(SltAgreementInfo vo:leaseDetails){
|
||||
vo.setCostType("1");
|
||||
List<SltAgreementInfo> oldList=sltAgreementInfoMapper.selectOldHistoryReportDetail(vo);
|
||||
if(oldList!=null&&oldList.size()>0){
|
||||
sltAgreementInfoMapper.deleteOldHistoryReportDetail(vo);
|
||||
}
|
||||
}
|
||||
sltAgreementInfoMapper.addSltHistoryReportLeaseDetail(leaseDetails);
|
||||
}
|
||||
|
||||
|
|
@ -200,6 +217,14 @@ public class IwsCostPushTask {
|
|||
detail.setYearMonth(DateTime.now().toString("yyyyMM"));
|
||||
detail.setSettlementType(1);
|
||||
});
|
||||
// 根据 协议ID、结算类型、年月、(1租赁 2维修 3丢失 4报废) 删除多余数据
|
||||
for(SltAgreementInfo vo:leaseDetails){
|
||||
vo.setCostType("2");
|
||||
List<SltAgreementInfo> oldList=sltAgreementInfoMapper.selectOldHistoryReportDetail(vo);
|
||||
if(oldList!=null&&oldList.size()>0){
|
||||
sltAgreementInfoMapper.deleteOldHistoryReportDetail(vo);
|
||||
}
|
||||
}
|
||||
sltAgreementInfoMapper.addSltHistoryReportRepairDetail(repairDetails);
|
||||
}
|
||||
|
||||
|
|
@ -214,6 +239,14 @@ public class IwsCostPushTask {
|
|||
detail.setYearMonth(DateTime.now().toString("yyyyMM"));
|
||||
detail.setSettlementType(1);
|
||||
});
|
||||
// 根据 协议ID、结算类型、年月、(1租赁 2维修 3丢失 4报废) 删除多余数据
|
||||
for(SltAgreementInfo vo:leaseDetails){
|
||||
vo.setCostType("3");
|
||||
List<SltAgreementInfo> oldList=sltAgreementInfoMapper.selectOldHistoryReportDetail(vo);
|
||||
if(oldList!=null&&oldList.size()>0){
|
||||
sltAgreementInfoMapper.deleteOldHistoryReportDetail(vo);
|
||||
}
|
||||
}
|
||||
sltAgreementInfoMapper.addSltHistoryReportLoseDetail(loseDetails);
|
||||
}
|
||||
|
||||
|
|
@ -228,6 +261,14 @@ public class IwsCostPushTask {
|
|||
detail.setYearMonth(DateTime.now().toString("yyyyMM"));
|
||||
detail.setSettlementType(1);
|
||||
});
|
||||
// 根据 协议ID、结算类型、年月、(1租赁 2维修 3丢失 4报废) 删除多余数据
|
||||
for(SltAgreementInfo vo:leaseDetails){
|
||||
vo.setCostType("4");
|
||||
List<SltAgreementInfo> oldList=sltAgreementInfoMapper.selectOldHistoryReportDetail(vo);
|
||||
if(oldList!=null&&oldList.size()>0){
|
||||
sltAgreementInfoMapper.deleteOldHistoryReportDetail(vo);
|
||||
}
|
||||
}
|
||||
sltAgreementInfoMapper.addSltHistoryReportScrapDetail(scrapDetails);
|
||||
}
|
||||
|
||||
|
|
@ -248,7 +289,6 @@ public class IwsCostPushTask {
|
|||
sltAgreementInfoService.clearCache();
|
||||
log.info("缓存已清理");
|
||||
}
|
||||
|
||||
System.out.println("-----------保存未结算记录定时器执行完毕-----------");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
|||
import com.bonus.common.biz.domain.purchase.AutomaticInPutDto;
|
||||
import com.bonus.common.biz.domain.repair.RepairInputExportDetails;
|
||||
import com.bonus.common.biz.enums.*;
|
||||
import com.bonus.common.biz.utils.AutomaticHttpHelper;
|
||||
import com.bonus.material.common.utils.AutomaticHttpHelper;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
|
|
@ -36,7 +36,7 @@ import com.bonus.material.task.domain.TmTask;
|
|||
import com.bonus.material.task.domain.TmTaskAgreement;
|
||||
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
|
||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.repair.mapper.RepairInputDetailsMapper;
|
||||
import com.bonus.common.biz.domain.repair.RepairInputDetails;
|
||||
|
|
@ -52,6 +52,7 @@ import javax.annotation.Resource;
|
|||
* @date 2024-10-16
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService {
|
||||
@Resource
|
||||
private RepairInputDetailsMapper repairInputDetailsMapper;
|
||||
|
|
@ -75,6 +76,9 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
|
||||
@Resource
|
||||
private ITypeService typeService;
|
||||
|
||||
@Resource
|
||||
private AutomaticHttpHelper automaticHttpHelper;
|
||||
/**
|
||||
* 查询修试后入库
|
||||
*
|
||||
|
|
@ -674,34 +678,18 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
// 立体库本地建立入库单接口路径
|
||||
//String url = MaterialConstants.TEST_CREATE_IN_URL;
|
||||
// 立体库生产建立入库单接口路径
|
||||
String url = MaterialConstants.PROD_CREATE_IN_URL;
|
||||
String data = AutomaticHttpHelper.sendHttpPostPushCost(url, body);
|
||||
//String url = MaterialConstants.PROD_CREATE_IN_URL;
|
||||
String url = typeService.getAsInUrl();
|
||||
log.info("立体库获取建立修试入库单路径:{}", url);
|
||||
String data = automaticHttpHelper.sendHttpPostPushCost(url, body);
|
||||
log.info("立体库建立修试入库单返回data:{}", data);
|
||||
if (StringUtils.isEmpty(data)) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "立体仓入库单创建失败");
|
||||
}
|
||||
JSONObject object = JSONObject.parseObject(data);
|
||||
String code = object.getString("code");
|
||||
if ("0".equals(code)) {
|
||||
if (CollectionUtils.isNotEmpty(repairInputDetails.getMaCodeList())) {
|
||||
for (RepairInputDetails inputDetails : repairInputDetails.getMaCodeList()) {
|
||||
inputDetails.setStatus(RepairInputStatusEnum.TO_UPLOAD.getStatus().toString());
|
||||
inputDetails.setTaskId(repairInputDetails.getTaskId());
|
||||
inputDetails.setTypeId(repairInputDetails.getTypeId());
|
||||
inputDetails.setUpdateBy(SecurityUtils.getLoginUser().getUserid().toString());
|
||||
inputDetails.setUpdateTime(DateUtils.getNowDate());
|
||||
result += repairInputDetailsMapper.updateRepairStatus(inputDetails);
|
||||
// 待上架
|
||||
inputDetails.setStatus(MaMachineStatusEnum.TO_UPLOAD.getStatus().toString());
|
||||
repairInputDetailsMapper.updateStatus(inputDetails);
|
||||
}
|
||||
} else {
|
||||
repairInputDetails.setStatus(RepairInputStatusEnum.TO_UPLOAD.getStatus().toString());
|
||||
repairInputDetails.setUpdateBy(SecurityUtils.getLoginUser().getUserid().toString());
|
||||
repairInputDetails.setUpdateTime(DateUtils.getNowDate());
|
||||
result += repairInputDetailsMapper.updateRepairStatus(repairInputDetails);
|
||||
}
|
||||
return AjaxResult.success("立体仓入库单创建成功");
|
||||
} else {
|
||||
log.info("立体库建立修试入库单返回code:{}", code);
|
||||
if (!"0".equals(code)) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "立体仓入库单创建失败");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -335,4 +335,6 @@ public class SltAgreementInfo extends BaseEntity {
|
|||
* 领料工程id
|
||||
*/
|
||||
private String leaseProId;
|
||||
|
||||
private String costType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,11 @@ public interface SltAgreementInfoMapper {
|
|||
|
||||
int addSltHistoryReportScrapDetail(List<SltAgreementInfo> list);
|
||||
|
||||
List<SltInfoVo> selectOldHistoryReport(SltInfoVo vo);
|
||||
int deleteOldHistoryReport(SltInfoVo vo);
|
||||
List<SltAgreementInfo> selectOldHistoryReportDetail(SltAgreementInfo vo);
|
||||
int deleteOldHistoryReportDetail(SltAgreementInfo vo);
|
||||
|
||||
List<SltHistoryReport> selectSltHistoryReportList(SltHistoryReport sltHistoryReport);
|
||||
|
||||
List<SltHistoryReportDetail> selectSltHistoryLeaseDetail(SltHistoryReportDetail sltHistoryReportDetail);
|
||||
|
|
|
|||
|
|
@ -148,6 +148,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
VALUES (#{month})
|
||||
</insert>
|
||||
|
||||
<select id="selectCalcMonthRecord" parameterType="com.bonus.material.push.domain.IwsCostPushBean" resultType="com.bonus.material.push.domain.IwsCostPushBean">
|
||||
select MONTH,ID as taskId from calc_project_month where month=#{month}
|
||||
</select>
|
||||
|
||||
<select id="getPaidSltBaseInfo" resultType="com.bonus.material.push.domain.IwsCostPushBean">
|
||||
SELECT
|
||||
mt1.type_name as typeName,
|
||||
|
|
@ -214,6 +218,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updateProjectMonthCosts">
|
||||
update project_month_costs set
|
||||
LEASE_MONEY=#{leaseMoney},
|
||||
CONSUME_MONEY=#{consumeMoney},
|
||||
LOST_MONEY=#{lostMoney},
|
||||
REPAIR_MONEY=#{repairMoney},
|
||||
SCRAP_MONEY=#{scrapMoney}
|
||||
where
|
||||
AGREEMENT_ID=#{agreementId} and TASK_ID=#{taskId} and TYPE=#{settlementType}
|
||||
</update>
|
||||
|
||||
<select id="selectHaveProjectMonthCosts" parameterType="com.bonus.material.push.domain.IwsCostPushBean" resultType="com.bonus.material.push.domain.IwsCostPushBean">
|
||||
select
|
||||
AGREEMENT_ID as agreementId,
|
||||
LEASE_MONEY as leaseMoney,
|
||||
CONSUME_MONEY as consumeMoney,
|
||||
LOST_MONEY as lostMoney,
|
||||
REPAIR_MONEY as repairMoney,
|
||||
SCRAP_MONEY as scrapMoney,
|
||||
TASK_ID as taskId,
|
||||
TYPE as settlementType
|
||||
from project_month_costs where
|
||||
AGREEMENT_ID=#{agreementId} and TASK_ID=#{taskId} and TYPE=#{settlementType}
|
||||
</select>
|
||||
|
||||
<insert id="insertProjectMonthCostsDetails" parameterType="com.bonus.material.settlement.domain.vo.PeriodCostResultVo">
|
||||
insert into project_month_info(agreementId, typeId, leaseNum, leaseDate, returnDate,
|
||||
leasePrice, leaseMoney, taskId, buy_price, money, jiju_type)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.agreementId},
|
||||
#{item.typeId},
|
||||
#{item.num},
|
||||
#{item.calcStartTime},
|
||||
#{item.calcEndTime},
|
||||
#{item.leasePrice},
|
||||
#{item.leaseCost},
|
||||
#{item.taskId},
|
||||
#{item.buyPrice},
|
||||
#{item.consumeCost},
|
||||
#{item.equipmentType}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<select id="selectHaveProjectMonthCostsDetails" parameterType="com.bonus.material.settlement.domain.vo.PeriodCostResultVo" resultType="com.bonus.material.settlement.domain.vo.PeriodCostResultVo">
|
||||
select
|
||||
agreementId, typeId, leaseNum, leaseDate, returnDate,
|
||||
leasePrice, leaseMoney, taskId, buy_price as buyprice, money as consumeCost, jiju_type as equipmentType
|
||||
from project_month_info
|
||||
where
|
||||
agreementId=#{agreementId} and taskId=#{taskId} and jiju_type=#{equipmentType}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getProLeaseInfo" resultType="com.bonus.material.push.domain.IwsCostPushBean">
|
||||
SELECT
|
||||
|
|
@ -482,27 +540,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insertProjectMonthCostsDetails" parameterType="com.bonus.material.settlement.domain.vo.PeriodCostResultVo">
|
||||
insert into project_month_info(agreementId, typeId, leaseNum, leaseDate, returnDate,
|
||||
leasePrice, leaseMoney, taskId, buy_price, money, jiju_type)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.agreementId},
|
||||
#{item.typeId},
|
||||
#{item.num},
|
||||
#{item.calcStartTime},
|
||||
#{item.calcEndTime},
|
||||
#{item.leasePrice},
|
||||
#{item.leaseCost},
|
||||
#{item.taskId},
|
||||
#{item.buyPrice},
|
||||
#{item.consumeCost},
|
||||
#{item.equipmentType}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getProIdsByAgreementIds" resultType="com.bonus.material.push.domain.IwsCostPushBean">
|
||||
select project_id as proId,
|
||||
GROUP_CONCAT(agreement_id) as agreementIdsStr
|
||||
|
|
|
|||
|
|
@ -2638,6 +2638,56 @@
|
|||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="selectOldHistoryReport" parameterType="com.bonus.material.settlement.domain.vo.SltInfoVo" resultType="com.bonus.material.settlement.domain.vo.SltInfoVo">
|
||||
select a.agreement_id as agreementid,a.settlement_type as settlementtype,a.year_month as yearmonth
|
||||
from slt_history_report a
|
||||
where 1=1
|
||||
<if test="agreementId != null and agreementId != ''">
|
||||
and a.agreement_id=#{agreementId}
|
||||
</if>
|
||||
<if test="settlementType != null and settlementType != ''">
|
||||
and a.settlement_type=#{settlementType}
|
||||
</if>
|
||||
<if test="yearMonth != null and yearMonth != ''">
|
||||
and a.year_month=#{yearMonth}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<delete id="deleteOldHistoryReport">
|
||||
delete from slt_history_report where
|
||||
agreement_id=#{agreementId}
|
||||
and settlement_type=#{settlementType}
|
||||
and year_month=#{yearMonth}
|
||||
</delete>
|
||||
|
||||
<select id="selectOldHistoryReportDetail" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||
select a.agreement_id as agreementid,a.settlement_type as settlementtype,a.year_month as yearmonth,
|
||||
a.cost_type as costtype
|
||||
from slt_history_report_detail a
|
||||
where 1=1
|
||||
<if test="agreementId != null and agreementId != ''">
|
||||
and a.agreement_id=#{agreementId}
|
||||
</if>
|
||||
<if test="settlementType != null and settlementType != ''">
|
||||
and a.settlement_type=#{settlementType}
|
||||
</if>
|
||||
<if test="yearMonth != null and yearMonth != ''">
|
||||
and a.year_month=#{yearMonth}
|
||||
</if>
|
||||
<if test="costType != null and costType != ''">
|
||||
and a.cost_type=#{costType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<delete id="deleteOldHistoryReportDetail">
|
||||
delete from slt_history_report_detail where
|
||||
agreement_id=#{agreementId}
|
||||
and settlement_type=#{settlementType}
|
||||
and year_month=#{yearMonth}
|
||||
and cost_type=#{costType}
|
||||
</delete>
|
||||
|
||||
<insert id="insertSltStatus">
|
||||
insert into slt_agreement_status
|
||||
(slt_task,slt_auditor,slt_status)
|
||||
|
|
|
|||
Loading…
Reference in New Issue