Merge branch 'master' of http://192.168.30.2:3000/bonus/Bonus-Cloud-Material
This commit is contained in:
commit
a765c3fb65
|
|
@ -125,4 +125,13 @@ public interface ClzSltAgreementInfoMapper {
|
||||||
String getTeamOutTime(MaterialSltAgreementInfo materialSltAgreementInfo);
|
String getTeamOutTime(MaterialSltAgreementInfo materialSltAgreementInfo);
|
||||||
|
|
||||||
String getTeamSjOutTime(MaterialSltAgreementInfo materialSltAgreementInfo);
|
String getTeamSjOutTime(MaterialSltAgreementInfo materialSltAgreementInfo);
|
||||||
|
|
||||||
|
|
||||||
|
List<MaterialSltAgreementInfo> getSltLeaseList(MaterialSltAgreementInfo info);
|
||||||
|
|
||||||
|
List<MaterialSltAgreementInfo> getSltRepairList(MaterialSltAgreementInfo info);
|
||||||
|
|
||||||
|
List<MaterialSltAgreementInfo> getSltScrapList(MaterialSltAgreementInfo info);
|
||||||
|
|
||||||
|
List<MaterialSltAgreementInfo> getSltLoseList(MaterialSltAgreementInfo info);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -181,30 +181,30 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
|
||||||
List<SltAgreementInfo> resultVo = new ArrayList<>();
|
List<SltAgreementInfo> resultVo = new ArrayList<>();
|
||||||
// 查询数据库
|
// 查询数据库
|
||||||
List<SltAgreementInfo> list = clzSltAgreementInfoMapper.getSltList(bean);
|
List<SltAgreementInfo> list = clzSltAgreementInfoMapper.getSltList(bean);
|
||||||
if (CollectionUtils.isNotEmpty(list)) {
|
// if (CollectionUtils.isNotEmpty(list)) {
|
||||||
// 按照结算单号分组
|
// // 按照结算单号分组
|
||||||
Map<String, List<SltAgreementInfo>> sltListByCodeMap = list.stream().collect(Collectors.groupingBy(SltAgreementInfo::getSltApplyCode));
|
// Map<String, List<SltAgreementInfo>> sltListByCodeMap = list.stream().collect(Collectors.groupingBy(SltAgreementInfo::getSltApplyCode));
|
||||||
// 遍历Map
|
// // 遍历Map
|
||||||
sltListByCodeMap.forEach((s, sltAgreementInfoList) -> {
|
// sltListByCodeMap.forEach((s, sltAgreementInfoList) -> {
|
||||||
if (CollectionUtils.isNotEmpty(sltAgreementInfoList)) {
|
// if (CollectionUtils.isNotEmpty(sltAgreementInfoList)) {
|
||||||
// 定义初始化对象
|
// // 定义初始化对象
|
||||||
SltAgreementInfo obj = new SltAgreementInfo();
|
// SltAgreementInfo obj = new SltAgreementInfo();
|
||||||
BeanUtil.copyProperties(sltAgreementInfoList.get(0), obj, true);
|
// BeanUtil.copyProperties(sltAgreementInfoList.get(0), obj, true);
|
||||||
|
//
|
||||||
|
// // 合并结算单中的多个单位名称及费用
|
||||||
|
// String unitNames = sltAgreementInfoList.stream().map(SltAgreementInfo::getUnitName).collect(Collectors.joining(","));
|
||||||
|
// BigDecimal costsSum = sltAgreementInfoList.stream().map(SltAgreementInfo::getCosts).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
// obj.setUnitName(unitNames);
|
||||||
|
// obj.setCosts(costsSum);
|
||||||
|
//
|
||||||
|
// resultVo.add(obj);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// throw new ServiceException("数据库未查询到结算信息!");
|
||||||
|
// }
|
||||||
|
|
||||||
// 合并结算单中的多个单位名称及费用
|
return list;
|
||||||
String unitNames = sltAgreementInfoList.stream().map(SltAgreementInfo::getUnitName).collect(Collectors.joining(","));
|
|
||||||
BigDecimal costsSum = sltAgreementInfoList.stream().map(SltAgreementInfo::getCosts).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
||||||
obj.setUnitName(unitNames);
|
|
||||||
obj.setCosts(costsSum);
|
|
||||||
|
|
||||||
resultVo.add(obj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
throw new ServiceException("数据库未查询到结算信息!");
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultVo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -267,83 +267,104 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
|
||||||
* 获取已结算清单
|
* 获取已结算清单
|
||||||
*/
|
*/
|
||||||
private List<MaterialSltInfoVo> getSettledInfo(MaterialSltAgreementInfo info) {
|
private List<MaterialSltInfoVo> getSettledInfo(MaterialSltAgreementInfo info) {
|
||||||
// 查询各项费用列表
|
|
||||||
List<MaterialSltAgreementInfo> sltedList = clzSltAgreementInfoMapper.getSltedList(info);
|
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(sltedList)) {
|
|
||||||
throw new ServiceException("未查询到已结算信息!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 定义遍历集合
|
|
||||||
Map<Long, List<MaterialSltAgreementInfo>> materialSltInfoResultMap = sltedList.stream().collect(Collectors.groupingBy(MaterialSltAgreementInfo::getAgreementId));
|
|
||||||
|
|
||||||
// 定义返回对象
|
// 定义返回对象
|
||||||
List<MaterialSltInfoVo> resultVoList = new ArrayList<>();
|
List<MaterialSltInfoVo> resultVoList = new ArrayList<>();
|
||||||
|
|
||||||
for (List<MaterialSltAgreementInfo> key : materialSltInfoResultMap.values()) {
|
//租赁费用列表
|
||||||
if (CollectionUtils.isEmpty(key)) {
|
List<MaterialSltAgreementInfo> leaseList = clzSltAgreementInfoMapper.getSltLeaseList(info);
|
||||||
throw new ServiceException("已结算信息异常,请联系管理员!");
|
//维修费用列表
|
||||||
}
|
List<MaterialSltAgreementInfo> repairList = clzSltAgreementInfoMapper.getSltRepairList(info);
|
||||||
|
//报废费用列表
|
||||||
|
List<MaterialSltAgreementInfo> scrapList = clzSltAgreementInfoMapper.getSltScrapList(info);
|
||||||
|
//丢失费用列表
|
||||||
|
List<MaterialSltAgreementInfo>loseList =clzSltAgreementInfoMapper.getSltLoseList(info);
|
||||||
|
|
||||||
key.forEach((item) -> {
|
|
||||||
MaterialSltInfoVo sltInfoVo = new MaterialSltInfoVo();
|
|
||||||
BigDecimal leaseCost = BigDecimal.ZERO, repairCost = BigDecimal.ZERO, scrapCost = BigDecimal.ZERO;
|
|
||||||
BigDecimal loseCost = BigDecimal.ZERO, reducCost = BigDecimal.ZERO;
|
|
||||||
|
|
||||||
//租赁费用列表
|
MaterialSltInfoVo sltInfoVo = new MaterialSltInfoVo();
|
||||||
List<MaterialSltAgreementInfo> leaseList = key.stream().filter(slt -> slt.getSltType() == 1).collect(Collectors.toList());
|
|
||||||
//维修费用列表
|
|
||||||
List<MaterialSltAgreementInfo> repairList = key.stream().filter(slt -> slt.getSltType() == 3).collect(Collectors.toList());
|
|
||||||
//报废费用列表
|
|
||||||
List<MaterialSltAgreementInfo> scrapList = key.stream().filter(slt -> slt.getSltType() == 4).collect(Collectors.toList());
|
|
||||||
//丢失费用列表
|
|
||||||
List<MaterialSltAgreementInfo> loseList = key.stream().filter(slt -> slt.getSltType() == 2).collect(Collectors.toList());
|
|
||||||
|
|
||||||
sltInfoVo.setLeaseList(leaseList);
|
sltInfoVo.setLeaseList(leaseList);
|
||||||
sltInfoVo.setRepairList(repairList);
|
sltInfoVo.setRepairList(repairList);
|
||||||
sltInfoVo.setScrapList(scrapList);
|
sltInfoVo.setScrapList(scrapList);
|
||||||
sltInfoVo.setLoseList(loseList);
|
sltInfoVo.setLoseList(loseList);
|
||||||
sltInfoVo.setReductionList(Collections.emptyList());
|
resultVoList.add(sltInfoVo);
|
||||||
for (MaterialSltAgreementInfo lease : leaseList) {
|
// 查询各项费用列表
|
||||||
if (lease.getCosts() != null) {
|
// List<MaterialSltAgreementInfo> sltedList = clzSltAgreementInfoMapper.getSltedList(info);
|
||||||
leaseCost = leaseCost.add(lease.getCosts());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (MaterialSltAgreementInfo lose : loseList) {
|
|
||||||
if (lose.getCosts() != null) {
|
|
||||||
loseCost = loseCost.add(lose.getCosts());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sltInfoVo.setLeaseCost(leaseCost);
|
// if (CollectionUtils.isEmpty(sltedList)) {
|
||||||
sltInfoVo.setRepairCost(repairCost);
|
// throw new ServiceException("未查询到已结算信息!");
|
||||||
sltInfoVo.setScrapCost(scrapCost);
|
// }
|
||||||
sltInfoVo.setLoseCost(loseCost);
|
//
|
||||||
sltInfoVo.setReductionCost(reducCost);
|
// // 定义遍历集合
|
||||||
List<SltAgreementRelation> relations = getRelations(leaseList, repairList, scrapList, loseList, info);
|
// Map<Long, List<MaterialSltAgreementInfo>> materialSltInfoResultMap = sltedList.stream().collect(Collectors.groupingBy(MaterialSltAgreementInfo::getAgreementId));
|
||||||
sltInfoVo.setRelations(relations);
|
//
|
||||||
|
// // 定义返回对象
|
||||||
resultVoList.add(sltInfoVo);
|
// List<MaterialSltInfoVo> resultVoList = new ArrayList<>();
|
||||||
|
//
|
||||||
// 给外层的单位名称/工程名称赋值
|
// for (List<MaterialSltAgreementInfo> key : materialSltInfoResultMap.values()) {
|
||||||
extractInnerNameToOuter(resultVoList, sltInfoVo);
|
// if (CollectionUtils.isEmpty(key)) {
|
||||||
|
// throw new ServiceException("已结算信息异常,请联系管理员!");
|
||||||
});
|
// }
|
||||||
}
|
//
|
||||||
|
// key.forEach((item) -> {
|
||||||
// 返回之前对集合做去重处理,根据外层的单位名称去重,保留每个单位名称的第一个
|
// MaterialSltInfoVo sltInfoVo = new MaterialSltInfoVo();
|
||||||
Set<String> seen = new HashSet<>();
|
// BigDecimal leaseCost = BigDecimal.ZERO, repairCost = BigDecimal.ZERO, scrapCost = BigDecimal.ZERO;
|
||||||
List<MaterialSltInfoVo> dedup = new ArrayList<>(resultVoList.size());
|
// BigDecimal loseCost = BigDecimal.ZERO, reducCost = BigDecimal.ZERO;
|
||||||
for (MaterialSltInfoVo it : resultVoList) {
|
//
|
||||||
if (it == null) continue;
|
// //租赁费用列表
|
||||||
String key = normalize(it.getUnitName());
|
// List<MaterialSltAgreementInfo> leaseList = key.stream().filter(slt -> slt.getSltType() == 1).collect(Collectors.toList());
|
||||||
if (key == null) continue;
|
// //维修费用列表
|
||||||
if (seen.add(key)) {
|
// List<MaterialSltAgreementInfo> repairList = key.stream().filter(slt -> slt.getSltType() == 3).collect(Collectors.toList());
|
||||||
dedup.add(it); // 第一次见到该单位名 -> 保留
|
// //报废费用列表
|
||||||
}
|
// List<MaterialSltAgreementInfo> scrapList = key.stream().filter(slt -> slt.getSltType() == 4).collect(Collectors.toList());
|
||||||
}
|
// //丢失费用列表
|
||||||
|
// List<MaterialSltAgreementInfo> loseList = key.stream().filter(slt -> slt.getSltType() == 2).collect(Collectors.toList());
|
||||||
return dedup;
|
//
|
||||||
|
// sltInfoVo.setLeaseList(leaseList);
|
||||||
|
// sltInfoVo.setRepairList(repairList);
|
||||||
|
// sltInfoVo.setScrapList(scrapList);
|
||||||
|
// sltInfoVo.setLoseList(loseList);
|
||||||
|
// sltInfoVo.setReductionList(Collections.emptyList());
|
||||||
|
// for (MaterialSltAgreementInfo lease : leaseList) {
|
||||||
|
// if (lease.getCosts() != null) {
|
||||||
|
// leaseCost = leaseCost.add(lease.getCosts());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// for (MaterialSltAgreementInfo lose : loseList) {
|
||||||
|
// if (lose.getCosts() != null) {
|
||||||
|
// loseCost = loseCost.add(lose.getCosts());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// sltInfoVo.setLeaseCost(leaseCost);
|
||||||
|
// sltInfoVo.setRepairCost(repairCost);
|
||||||
|
// sltInfoVo.setScrapCost(scrapCost);
|
||||||
|
// sltInfoVo.setLoseCost(loseCost);
|
||||||
|
// sltInfoVo.setReductionCost(reducCost);
|
||||||
|
// List<SltAgreementRelation> relations = getRelations(leaseList, repairList, scrapList, loseList, info);
|
||||||
|
// sltInfoVo.setRelations(relations);
|
||||||
|
//
|
||||||
|
// resultVoList.add(sltInfoVo);
|
||||||
|
//
|
||||||
|
// // 给外层的单位名称/工程名称赋值
|
||||||
|
// extractInnerNameToOuter(resultVoList, sltInfoVo);
|
||||||
|
//
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 返回之前对集合做去重处理,根据外层的单位名称去重,保留每个单位名称的第一个
|
||||||
|
// Set<String> seen = new HashSet<>();
|
||||||
|
// List<MaterialSltInfoVo> dedup = new ArrayList<>(resultVoList.size());
|
||||||
|
// for (MaterialSltInfoVo it : resultVoList) {
|
||||||
|
// if (it == null) continue;
|
||||||
|
// String key = normalize(it.getUnitName());
|
||||||
|
// if (key == null) continue;
|
||||||
|
// if (seen.add(key)) {
|
||||||
|
// dedup.add(it); // 第一次见到该单位名 -> 保留
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return dedup;
|
||||||
|
return resultVoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -443,4 +443,11 @@ public interface RepairMapper {
|
||||||
List<RepairProjectInfo> getRepairProjectList(RepairProjectInfo bean);
|
List<RepairProjectInfo> getRepairProjectList(RepairProjectInfo bean);
|
||||||
|
|
||||||
List<PartDetails> getPartUsingList(PartDetails bean);
|
List<PartDetails> getPartUsingList(PartDetails bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务id查询待修数量
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
RepairDeviceVO getRepairNumByTaskId(RepairDeviceVO bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -684,6 +684,43 @@ public class RepairServiceImpl implements RepairService {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//校验本次维修数量不能大于待维修数量
|
||||||
|
if (bean.getTaskId() != null && bean.getTypeId() != null) {
|
||||||
|
// 查询该任务待维修数量
|
||||||
|
RepairDeviceVO repairDeviceVO = repairMapper.getRepairNumByTaskId(bean);
|
||||||
|
BigDecimal thisRepairNum = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
// 计算本次维修数量
|
||||||
|
if (bean.getNumberInRepairPartList().size() > 0) {
|
||||||
|
if (null != bean.getNumberInRepairPartList().get(0).getRepairNum() && 0 < bean.getNumberInRepairPartList().get(0).getRepairNum().compareTo(BigDecimal.ZERO)) {
|
||||||
|
thisRepairNum = thisRepairNum.add(bean.getNumberInRepairPartList().get(0).getRepairNum());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bean.getNumberOutRepairPartList().size() > 0) {
|
||||||
|
if (null != bean.getNumberOutRepairPartList().get(0).getRepairNum() && 0 < bean.getNumberOutRepairPartList().get(0).getRepairNum().compareTo(BigDecimal.ZERO)) {
|
||||||
|
thisRepairNum = thisRepairNum.add(bean.getNumberOutRepairPartList().get(0).getRepairNum());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bean.getNumberScrapRepairPartList().size() > 0) {
|
||||||
|
if (null != bean.getNumberScrapRepairPartList().get(0).getScrapNum() && 0 < bean.getNumberScrapRepairPartList().get(0).getScrapNum().compareTo(BigDecimal.ZERO)) {
|
||||||
|
thisRepairNum = thisRepairNum.add(bean.getNumberScrapRepairPartList().get(0).getScrapNum());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 比较 repairHomeInfo.getRepairNum() 和 thisRepairNum 的值
|
||||||
|
if (repairDeviceVO != null && repairDeviceVO.getRepairNum() != null) {
|
||||||
|
int comparisonResult = thisRepairNum.compareTo(repairDeviceVO.getRepairNum());
|
||||||
|
|
||||||
|
if (comparisonResult > 0) {
|
||||||
|
// thisRepairNum 大于 repairHomeInfo.getRepairNum()
|
||||||
|
return AjaxResult.success("维修已完成");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// repairHomeInfo 或 repairHomeInfo.getRepairNum() 为 null 的处理
|
||||||
|
throw new ServiceException("此维修记录不存在,请检查后提交");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 更新维修人员信息
|
// 更新维修人员信息
|
||||||
if (!CollectionUtils.isEmpty(bean.getRepairList())) {
|
if (!CollectionUtils.isEmpty(bean.getRepairList())) {
|
||||||
RepairPartDetails repairPartDetails = bean.getRepairList().get(0);
|
RepairPartDetails repairPartDetails = bean.getRepairList().get(0);
|
||||||
|
|
|
||||||
|
|
@ -183,4 +183,32 @@ public interface TmTaskMapper {
|
||||||
List<RepairApplyDetails> selectBackApplyInfoById(BackApplyInfo backApplyInfo);
|
List<RepairApplyDetails> selectBackApplyInfoById(BackApplyInfo backApplyInfo);
|
||||||
|
|
||||||
List<TmTask> getTaskIdByAgreementId(SltAgreementInfo info);
|
List<TmTask> getTaskIdByAgreementId(SltAgreementInfo info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询新购待入库任务
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Long> selectPurchaseInfo(TmTask info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据typeId查询审核人及部门
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<BackApplyInfo> selectApplyInfo(@Param("list") List<Long> list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门id获取部门人手机号
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String selectPhone(int userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询修饰待入库任务
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Long> selectRepairInfo(TmTask info);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.bonus.material.task.service;
|
package com.bonus.material.task.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.material.back.domain.BackApplyInfo;
|
||||||
import com.bonus.material.task.domain.TmTask;
|
import com.bonus.material.task.domain.TmTask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -58,6 +60,34 @@ public interface ITmTaskService {
|
||||||
*/
|
*/
|
||||||
public int deleteTmTaskByTaskId(Long taskId);
|
public int deleteTmTaskByTaskId(Long taskId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询新购待入库任务
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Long> selectPurchaseInfo(TmTask info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据typeId查询审核人及部门
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<BackApplyInfo> selectApplyInfo(List<Long> list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门id获取部门人手机号
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String selectPhone(int userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询修饰待入库任务
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Long> selectRepairInfo(TmTask info);
|
||||||
|
|
||||||
// List<TmTaskRequestVo> getLeaseAuditList(TmTaskRequestVo tmTask);
|
// List<TmTaskRequestVo> getLeaseAuditList(TmTaskRequestVo tmTask);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.task.service.impl;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
|
import com.bonus.material.back.domain.BackApplyInfo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||||
|
|
@ -96,6 +97,46 @@ public class TmTaskServiceImpl implements ITmTaskService {
|
||||||
return tmTaskMapper.deleteTmTaskByTaskId(taskId);
|
return tmTaskMapper.deleteTmTaskByTaskId(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询新购待入库任务
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Long> selectPurchaseInfo(TmTask info) {
|
||||||
|
return tmTaskMapper.selectPurchaseInfo(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据typeId查询审核人及部门
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BackApplyInfo> selectApplyInfo(List<Long> list) {
|
||||||
|
return tmTaskMapper.selectApplyInfo(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门id获取部门人手机号
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String selectPhone(int userId) {
|
||||||
|
return tmTaskMapper.selectPhone(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询修饰待入库任务
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Long> selectRepairInfo(TmTask info) {
|
||||||
|
return tmTaskMapper.selectRepairInfo(info);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取单个申请列表
|
* 获取单个申请列表
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,9 @@ import cn.hutool.json.JSONObject;
|
||||||
import com.ah.sbd.SmsTool;
|
import com.ah.sbd.SmsTool;
|
||||||
import com.ah.sbd.utils.param.SmsParam;
|
import com.ah.sbd.utils.param.SmsParam;
|
||||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||||
|
import com.alibaba.nacos.common.utils.StringUtils;
|
||||||
import com.bonus.common.biz.constant.BmConfigItems;
|
import com.bonus.common.biz.constant.BmConfigItems;
|
||||||
import com.bonus.common.biz.enums.PurchaseTaskStatusEnum;
|
import com.bonus.material.back.domain.BackApplyInfo;
|
||||||
import com.bonus.common.biz.enums.RepairInputStatusEnum;
|
|
||||||
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
|
||||||
import com.bonus.material.task.domain.TmTask;
|
import com.bonus.material.task.domain.TmTask;
|
||||||
import com.bonus.material.task.service.ITmTaskService;
|
import com.bonus.material.task.service.ITmTaskService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -19,7 +18,9 @@ import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 待入库定时任务
|
* 待入库定时任务
|
||||||
|
|
@ -75,27 +76,182 @@ public class WashHouseScheduledTasks {
|
||||||
* 未入库定时任务
|
* 未入库定时任务
|
||||||
*/
|
*/
|
||||||
public void taskWithWashHouse() {
|
public void taskWithWashHouse() {
|
||||||
|
List<SmsParam> mobileList = new ArrayList<>();
|
||||||
log.info("开始执行未入库定时推送任务");
|
log.info("开始执行未入库定时推送任务");
|
||||||
boolean hasNullTask = false;
|
|
||||||
TmTask info = new TmTask();
|
TmTask info = new TmTask();
|
||||||
List<TmTask> list = tmTaskService.selectTmTaskList(info);
|
// 查询新购待入库任务
|
||||||
if (CollectionUtils.isNotEmpty(list)) {
|
List<Long> purchaseList = tmTaskService.selectPurchaseInfo(info);
|
||||||
for (TmTask tmTask : list) {
|
// 查询修试待入库任务
|
||||||
if (tmTask.getTaskType().equals(TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId())) {
|
List<Long> repairList = tmTaskService.selectRepairInfo(info);
|
||||||
if (tmTask.getTaskStatus().equals(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus())) {
|
// 1. 处理【只有新购任务】的情况(purchaseList非空,repairList为空)
|
||||||
hasNullTask = true;
|
if (CollectionUtils.isNotEmpty(purchaseList) && CollectionUtils.isEmpty(repairList)) {
|
||||||
break;
|
List<BackApplyInfo> purchaseInfoList = tmTaskService.selectApplyInfo(purchaseList);
|
||||||
|
if (CollectionUtils.isNotEmpty(purchaseInfoList)) {
|
||||||
|
// 1.1 部门107有新购任务
|
||||||
|
boolean purchaseHas107 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 107);
|
||||||
|
if (purchaseHas107) {
|
||||||
|
// 李勇
|
||||||
|
String phone = tmTaskService.selectPhone(118);
|
||||||
|
if (StringUtils.isNotBlank(phone)) {
|
||||||
|
String content = "您好!您所属班组还有新购待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||||
|
mobileList.add(new SmsParam(phone, content));
|
||||||
}
|
}
|
||||||
} else if (tmTask.getTaskType().equals(TmTaskTypeEnum.TM_TASK_REPAIR_INPUT.getTaskTypeId())) {
|
}
|
||||||
if (tmTask.getTaskStatus().equals(RepairInputStatusEnum.INPUT_TASK_NO_FINISHED.getStatus())) {
|
// 1.2 部门336有新购任务
|
||||||
hasNullTask = true;
|
boolean purchaseHas336 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 336);
|
||||||
break;
|
if (purchaseHas336) {
|
||||||
|
// 王国宝
|
||||||
|
String phone = tmTaskService.selectPhone(455);
|
||||||
|
if (StringUtils.isNotBlank(phone)) {
|
||||||
|
String content = "您好!您所属班组还有新购待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||||
|
mobileList.add(new SmsParam(phone, content));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 1.3 部门106或335有新购任务
|
||||||
|
boolean purchaseHas106 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 106 || dto.getDeptId() == 335);
|
||||||
|
if (purchaseHas106) {
|
||||||
|
// 刘春杰
|
||||||
|
String phone = tmTaskService.selectPhone(1549);
|
||||||
|
if (StringUtils.isNotBlank(phone)) {
|
||||||
|
String content = "您好!您所属班组还有新购待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||||
|
mobileList.add(new SmsParam(phone, content));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 1.4 部门334有新购任务
|
||||||
|
boolean purchaseHas334 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 334);
|
||||||
|
if (purchaseHas334) {
|
||||||
|
// 董照霞
|
||||||
|
String phone = tmTaskService.selectPhone(65);
|
||||||
|
if (StringUtils.isNotBlank(phone)) {
|
||||||
|
String content = "您好!您所属班组还有新购待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||||
|
mobileList.add(new SmsParam(phone, content));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasNullTask) {
|
|
||||||
sendSms("15527030643", "您好!您还有待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!");
|
// 2. 处理【只有修试任务】的情况(purchaseList为空,repairList非空)
|
||||||
|
else if (CollectionUtils.isEmpty(purchaseList) && CollectionUtils.isNotEmpty(repairList)) {
|
||||||
|
List<BackApplyInfo> repairInfoList = tmTaskService.selectApplyInfo(repairList);
|
||||||
|
if (CollectionUtils.isNotEmpty(repairInfoList)) {
|
||||||
|
// 2.1 部门107有修试任务
|
||||||
|
boolean repairHas107 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 107);
|
||||||
|
if (repairHas107) {
|
||||||
|
// 李勇
|
||||||
|
String phone = tmTaskService.selectPhone(118);
|
||||||
|
if (StringUtils.isNotBlank(phone)) {
|
||||||
|
String content = "您好!您所属班组还有修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||||
|
mobileList.add(new SmsParam(phone, content));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2.2 部门336有修试任务
|
||||||
|
boolean repairHas336 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 336);
|
||||||
|
if (repairHas336) {
|
||||||
|
// 王国宝
|
||||||
|
String phone = tmTaskService.selectPhone(455);
|
||||||
|
if (StringUtils.isNotBlank(phone)) {
|
||||||
|
String content = "您好!您所属班组还有修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||||
|
mobileList.add(new SmsParam(phone, content));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2.3 部门106或335有修试任务
|
||||||
|
boolean repairHas106 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 106 || dto.getDeptId() == 335);
|
||||||
|
if (repairHas106) {
|
||||||
|
// 刘春杰
|
||||||
|
String phone = tmTaskService.selectPhone(1549);
|
||||||
|
if (StringUtils.isNotBlank(phone)) {
|
||||||
|
String content = "您好!您所属班组还有修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||||
|
mobileList.add(new SmsParam(phone, content));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2.4 部门334有修试任务
|
||||||
|
boolean repairHas334 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 334);
|
||||||
|
if (repairHas334) {
|
||||||
|
// 董照霞
|
||||||
|
String phone = tmTaskService.selectPhone(65);
|
||||||
|
if (StringUtils.isNotBlank(phone)) {
|
||||||
|
String content = "您好!您所属班组还有修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||||
|
mobileList.add(new SmsParam(phone, content));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 处理【既有新购又有修试任务】的情况(原逻辑保留,内容微调)
|
||||||
|
else if (CollectionUtils.isNotEmpty(purchaseList) && CollectionUtils.isNotEmpty(repairList)) {
|
||||||
|
List<BackApplyInfo> purchaseInfoList = tmTaskService.selectApplyInfo(purchaseList);
|
||||||
|
List<BackApplyInfo> repairInfoList = tmTaskService.selectApplyInfo(repairList);
|
||||||
|
if (CollectionUtils.isNotEmpty(purchaseInfoList) && CollectionUtils.isNotEmpty(repairInfoList)) {
|
||||||
|
// 3.1 部门107既有新购又有修试任务
|
||||||
|
boolean purchaseHas107 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 107);
|
||||||
|
boolean repairHas107 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 107);
|
||||||
|
if (purchaseHas107 && repairHas107) {
|
||||||
|
// 李勇
|
||||||
|
String phone = tmTaskService.selectPhone(118);
|
||||||
|
if (StringUtils.isNotBlank(phone)) {
|
||||||
|
String content = "您好!您所属班组还有新购及修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||||
|
mobileList.add(new SmsParam(phone, content));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3.2 部门336既有新购又有修试任务
|
||||||
|
boolean purchaseHas336 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 336);
|
||||||
|
boolean repairHas336 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 336);
|
||||||
|
if (purchaseHas336 && repairHas336) {
|
||||||
|
// 王国宝
|
||||||
|
String phone = tmTaskService.selectPhone(455);
|
||||||
|
if (StringUtils.isNotBlank(phone)) {
|
||||||
|
String content = "您好!您所属班组还有新购及修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||||
|
mobileList.add(new SmsParam(phone, content));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3.3 部门106/335既有新购又有修试任务
|
||||||
|
boolean purchaseHas106 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 106 || dto.getDeptId() == 335);
|
||||||
|
boolean repairHas106 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 106 || dto.getDeptId() == 335);
|
||||||
|
if (purchaseHas106 && repairHas106) {
|
||||||
|
// 刘春杰
|
||||||
|
String phone = tmTaskService.selectPhone(1549);
|
||||||
|
if (StringUtils.isNotBlank(phone)) {
|
||||||
|
String content = "您好!您所属班组还有新购及修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||||
|
mobileList.add(new SmsParam(phone, content));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3.4 部门334既有新购又有修试任务
|
||||||
|
boolean purchaseHas334 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 334);
|
||||||
|
boolean repairHas334 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 334);
|
||||||
|
if (purchaseHas334 && repairHas334) {
|
||||||
|
// 董照霞
|
||||||
|
String phone = tmTaskService.selectPhone(65);
|
||||||
|
if (StringUtils.isNotBlank(phone)) {
|
||||||
|
String content = "您好!您所属班组还有新购及修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||||
|
mobileList.add(new SmsParam(phone, content));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(mobileList)) {
|
||||||
|
// 根据mobileList相同手机号只发送一次短信
|
||||||
|
List<SmsParam> uniqueMobileList = new ArrayList<>(mobileList.stream()
|
||||||
|
// 以手机号为键,SmsParam为值,自动去重(后出现的会覆盖前一个)
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
SmsParam::getMobile,
|
||||||
|
param -> param,
|
||||||
|
(existing, replacement) -> replacement
|
||||||
|
))
|
||||||
|
.values());
|
||||||
|
JSONObject sendResult = SmsTool.sendSms(uniqueMobileList, BmConfigItems.ANHUI_COMPANY_SMS_KEY);
|
||||||
|
if (sendResult != null && !sendResult.isEmpty()) {
|
||||||
|
log.info("短信发送成功: {}", sendResult);
|
||||||
|
System.out.println("短信发送成功: " + sendResult);
|
||||||
|
} else {
|
||||||
|
log.error("短信发送失败,发送结果为空!");
|
||||||
|
System.out.println("短信发送失败,发送结果为空!");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log.info("没有待入库的单子");
|
log.info("没有待入库的单子");
|
||||||
System.out.println("没有待入库的单子");
|
System.out.println("没有待入库的单子");
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="url != null">url,</if>
|
<if test="url != null">url,</if>
|
||||||
<if test="fileType != null">file_type,</if>
|
<if test="fileType != null">file_type,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
create_time,
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="taskType != null">#{taskType},</if>
|
<if test="taskType != null">#{taskType},</if>
|
||||||
|
|
@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="url != null">#{url},</if>
|
<if test="url != null">#{url},</if>
|
||||||
<if test="fileType != null">#{fileType},</if>
|
<if test="fileType != null">#{fileType},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
NOW(),
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -345,24 +345,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getSltList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
<select id="getSltList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
saa.id as id, bai.agreement_id as agreementId, bai.agreement_code as agreementCode, saa.code as sltApplyCode,
|
saa.id AS id,
|
||||||
bui.unit_id as unitId, bui.unit_name as unitName, bp.pro_id as projectId, bp.pro_name as projectName,
|
bai.agreement_id AS agreementId,
|
||||||
saa.remark, saa.cost as costs, su.nick_name as auditor, saa.audit_time as auditTime,
|
bai.agreement_code AS agreementCode,
|
||||||
case when saa.status = '1' then '1' when saa.status = '2' then '2' when saa.status = '3' then '3' end as sltStatus
|
saa.CODE AS sltApplyCode,
|
||||||
FROM clz_bm_agreement_info bai
|
bui.unit_id AS unitId,
|
||||||
|
GROUP_CONCAT(DISTINCT bui.unit_name) AS unitName,
|
||||||
|
bp.pro_id AS projectId,
|
||||||
|
bp.pro_name AS projectName,
|
||||||
|
saa.remark,
|
||||||
|
saa.cost AS costs,
|
||||||
|
su.nick_name AS auditor,
|
||||||
|
saa.audit_time AS auditTime,
|
||||||
|
CASE
|
||||||
|
|
||||||
|
WHEN saa.STATUS = '1' THEN
|
||||||
|
'1'
|
||||||
|
WHEN saa.STATUS = '2' THEN
|
||||||
|
'2'
|
||||||
|
WHEN saa.STATUS = '3' THEN
|
||||||
|
'3'
|
||||||
|
END AS sltStatus
|
||||||
|
FROM
|
||||||
|
clz_slt_agreement_apply saa
|
||||||
|
|
||||||
|
LEFT JOIN clz_bm_agreement_info bai ON saa.agreement_id = bai.agreement_id
|
||||||
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
||||||
LEFT JOIN clz_slt_agreement_apply saa on saa.agreement_id = bai.agreement_id
|
LEFT JOIN sys_user su ON saa.auditor = su.user_id
|
||||||
LEFT JOIN sys_user su ON saa.auditor = su.user_id and su.del_flag = 0
|
AND su.del_flag = 0
|
||||||
where bai.status = '1' and saa.status in ('1','2','3')
|
WHERE
|
||||||
|
bai.STATUS = '1'
|
||||||
|
AND saa.STATUS IN ( '1', '2', '3' )
|
||||||
|
|
||||||
<if test="unitId != null and unitId != ''">
|
<if test="unitId != null and unitId != ''">
|
||||||
and bui.unit_id = #{unitId}
|
and bui.unit_id = #{unitId}
|
||||||
</if>
|
</if>
|
||||||
<if test="projectId != null and projectId != ''">
|
<if test="projectId != null and projectId != ''">
|
||||||
and bp.pro_id = #{projectId}
|
and bp.pro_id = #{projectId}
|
||||||
</if>
|
</if>
|
||||||
ORDER BY saa.create_time desc
|
GROUP BY saa.CODE
|
||||||
|
ORDER BY
|
||||||
|
saa.create_time DESC
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getSltedList" resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
|
<select id="getSltedList" resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
|
||||||
|
|
@ -438,6 +467,83 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getSltRepairList"
|
||||||
|
resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
|
||||||
|
SELECT
|
||||||
|
saa.id as id, bai.agreement_id as agreementId, bai.agreement_code as agreementCode, saa.`code` as sltApplyCode,
|
||||||
|
bui.unit_id as unitId, bui.unit_name as unitName, bp.pro_id as projectId, bp.pro_name as projectName,
|
||||||
|
saa.remark, sad.money as costs, saa.audit_time as auditTime, sad.start_time as startTime, sad.end_time as endTime,
|
||||||
|
saa.`status` as sltStatus, sad.slt_type as sltType, sad.num, sad.price as leasePrice,
|
||||||
|
mt1.type_name as typeName, mt.type_name as modelName, mt.unit_name as mtUnitName
|
||||||
|
FROM
|
||||||
|
clz_slt_agreement_apply saa
|
||||||
|
LEFT JOIN clz_bm_agreement_info bai ON saa.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
||||||
|
LEFT JOIN clz_slt_agreement_details sad ON saa.id = sad.apply_id
|
||||||
|
left join ma_type mt on sad.type_id = mt.type_id
|
||||||
|
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||||
|
where
|
||||||
|
saa.`code` = #{sltApplyCode} and sad.slt_type =3
|
||||||
|
</select>
|
||||||
|
<select id="getSltScrapList"
|
||||||
|
resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
|
||||||
|
SELECT
|
||||||
|
saa.id as id, bai.agreement_id as agreementId, bai.agreement_code as agreementCode, saa.`code` as sltApplyCode,
|
||||||
|
bui.unit_id as unitId, bui.unit_name as unitName, bp.pro_id as projectId, bp.pro_name as projectName,
|
||||||
|
saa.remark, sad.money as costs, saa.audit_time as auditTime, sad.start_time as startTime, sad.end_time as endTime,
|
||||||
|
saa.`status` as sltStatus, sad.slt_type as sltType, sad.num, sad.price as leasePrice,
|
||||||
|
mt1.type_name as typeName, mt.type_name as modelName, mt.unit_name as mtUnitName
|
||||||
|
FROM
|
||||||
|
clz_slt_agreement_apply saa
|
||||||
|
LEFT JOIN clz_bm_agreement_info bai ON saa.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
||||||
|
LEFT JOIN clz_slt_agreement_details sad ON saa.id = sad.apply_id
|
||||||
|
left join ma_type mt on sad.type_id = mt.type_id
|
||||||
|
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||||
|
where
|
||||||
|
saa.`code` = #{sltApplyCode} and sad.slt_type =4
|
||||||
|
</select>
|
||||||
|
<select id="getSltLoseList"
|
||||||
|
resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
|
||||||
|
SELECT
|
||||||
|
saa.id as id, bai.agreement_id as agreementId, bai.agreement_code as agreementCode, saa.`code` as sltApplyCode,
|
||||||
|
bui.unit_id as unitId, bui.unit_name as unitName, bp.pro_id as projectId, bp.pro_name as projectName,
|
||||||
|
saa.remark, sad.money as costs, saa.audit_time as auditTime, sad.start_time as startTime, sad.end_time as endTime,
|
||||||
|
saa.`status` as sltStatus, sad.slt_type as sltType, sad.num, sad.price as leasePrice,
|
||||||
|
mt1.type_name as typeName, mt.type_name as modelName, mt.unit_name as mtUnitName
|
||||||
|
FROM
|
||||||
|
clz_slt_agreement_apply saa
|
||||||
|
LEFT JOIN clz_bm_agreement_info bai ON saa.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
||||||
|
LEFT JOIN clz_slt_agreement_details sad ON saa.id = sad.apply_id
|
||||||
|
left join ma_type mt on sad.type_id = mt.type_id
|
||||||
|
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||||
|
where
|
||||||
|
saa.`code` = #{sltApplyCode} and sad.slt_type =2
|
||||||
|
</select>
|
||||||
|
<select id="getSltLeaseList" resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
|
||||||
|
SELECT
|
||||||
|
saa.id as id, bai.agreement_id as agreementId, bai.agreement_code as agreementCode, saa.`code` as sltApplyCode,
|
||||||
|
bui.unit_id as unitId, bui.unit_name as unitName, bp.pro_id as projectId, bp.pro_name as projectName,
|
||||||
|
saa.remark, sad.money as costs, saa.audit_time as auditTime, sad.start_time as startTime, sad.end_time as endTime,
|
||||||
|
saa.`status` as sltStatus, sad.slt_type as sltType, sad.num, sad.price as leasePrice,
|
||||||
|
mt1.type_name as typeName, mt.type_name as modelName, mt.unit_name as mtUnitName
|
||||||
|
FROM
|
||||||
|
clz_slt_agreement_apply saa
|
||||||
|
LEFT JOIN clz_bm_agreement_info bai ON saa.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
||||||
|
LEFT JOIN clz_slt_agreement_details sad ON saa.id = sad.apply_id
|
||||||
|
left join ma_type mt on sad.type_id = mt.type_id
|
||||||
|
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||||
|
where
|
||||||
|
saa.`code` = #{sltApplyCode} and sad.slt_type =1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<update id="updateClzAgreementInfoByIds">
|
<update id="updateClzAgreementInfoByIds">
|
||||||
update clz_bm_agreement_info
|
update clz_bm_agreement_info
|
||||||
set is_slt = 1, update_time = now()
|
set is_slt = 1, update_time = now()
|
||||||
|
|
|
||||||
|
|
@ -1591,4 +1591,12 @@
|
||||||
</if>
|
</if>
|
||||||
order by rpd.create_time desc
|
order by rpd.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getRepairNumByTaskId" resultType="com.bonus.material.repair.domain.vo.RepairDeviceVO">
|
||||||
|
SELECT rad.id,
|
||||||
|
rad.repair_num - (rad.repaired_num + rad.scrap_num) as repairNum
|
||||||
|
FROM repair_apply_details rad
|
||||||
|
WHERE rad.task_id = #{taskId}
|
||||||
|
and rad.type_id = #{typeId}
|
||||||
|
and rad.is_ds = '0'
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -287,4 +287,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPurchaseInfo" resultType="java.lang.Long">
|
||||||
|
SELECT
|
||||||
|
pcd.type_id
|
||||||
|
FROM
|
||||||
|
purchase_check_details pcd
|
||||||
|
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
||||||
|
WHERE
|
||||||
|
`status` = 4
|
||||||
|
AND NOT ( mt.manage_type = 0 AND ( pcd.bind_num IS NULL OR pcd.bind_num = 0 ) )
|
||||||
|
GROUP BY pcd.type_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectApplyInfo" resultType="com.bonus.material.back.domain.BackApplyInfo">
|
||||||
|
SELECT
|
||||||
|
mtr.user_id AS userId,
|
||||||
|
su.dept_id AS deptId
|
||||||
|
FROM
|
||||||
|
ma_type_keeper mtr
|
||||||
|
LEFT JOIN sys_user su ON su.user_id = mtr.user_id
|
||||||
|
WHERE
|
||||||
|
( su.dept_id = '106' OR su.dept_id = '107' OR su.dept_id = '334' OR su.dept_id = '335' OR su.dept_id = '336')
|
||||||
|
AND mtr.type_id in
|
||||||
|
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY
|
||||||
|
su.dept_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPhone" resultType="java.lang.String">
|
||||||
|
SELECT phonenumber
|
||||||
|
from sys_user
|
||||||
|
WHERE user_id = #{userId}
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRepairInfo" resultType="java.lang.Long">
|
||||||
|
SELECT
|
||||||
|
type_id
|
||||||
|
FROM
|
||||||
|
repair_input_details
|
||||||
|
WHERE
|
||||||
|
reject_num IS NULL
|
||||||
|
AND input_num IS NULL
|
||||||
|
GROUP BY
|
||||||
|
type_id
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue