推送优化及皖送接口及班组审批优化
This commit is contained in:
parent
d3753a9a34
commit
e298c589cf
|
|
@ -290,4 +290,9 @@ public class MaterialRetainedEquipmentInfo {
|
|||
* 是否过滤(true 过滤,默认过滤)
|
||||
*/
|
||||
private Boolean enableFilter = true;
|
||||
|
||||
/**
|
||||
* 皖送传参i8工程名称
|
||||
*/
|
||||
private String projectName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -405,9 +405,19 @@ public class ClzDirectServiceImpl implements ClzDirectService {
|
|||
* @param event
|
||||
*/
|
||||
private void updateSysWorkflowRecord(WorkflowEvent event) {
|
||||
// 项目部标识
|
||||
boolean isXmb = false;
|
||||
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
SysWorkflowRecord recordInfo = new SysWorkflowRecord();
|
||||
int count = 0;
|
||||
// 根据退料单位id查询该退料单位是否为项目部
|
||||
Long leaseUnitTypeId = mapper.getBackDeptId(event.getBackTeamId());
|
||||
if (leaseUnitTypeId == null) {
|
||||
throw new ServiceException("退料单位不存在,无法进行审核");
|
||||
}
|
||||
if (leaseUnitTypeId == 36) {
|
||||
isXmb = true;
|
||||
}
|
||||
//获取审批流id
|
||||
SysWorkflowType sysWorkflowType = new SysWorkflowType();
|
||||
sysWorkflowType.setTaskType(event.getTaskType());
|
||||
|
|
@ -417,9 +427,15 @@ public class ClzDirectServiceImpl implements ClzDirectService {
|
|||
throw new ServiceException("新增任务审批记录失败,请创建审核流程");
|
||||
}
|
||||
SysWorkflowRecord sysWorkflowRecord = new SysWorkflowRecord();
|
||||
if (sysWorkflowTypeList.size() == 1) {
|
||||
// 如果该任务类型配置了一个审批流,则直接使用
|
||||
sysWorkflowType = sysWorkflowTypeList.get(0);
|
||||
if (CollectionUtils.isNotEmpty(sysWorkflowTypeList)) {
|
||||
if (!isXmb) {
|
||||
// 转出单位为班组审批流
|
||||
sysWorkflowType = sysWorkflowTypeList.get(0);
|
||||
} else {
|
||||
// 转出单位为项目部审批流
|
||||
sysWorkflowType = sysWorkflowTypeList.get(1);
|
||||
}
|
||||
|
||||
// 先根据id查询该数据是否已经存在
|
||||
recordInfo = sysWorkflowRecordMapper.getWorkflowRecordHistory(event);
|
||||
// 根据id删除该数据
|
||||
|
|
@ -652,10 +668,20 @@ public class ClzDirectServiceImpl implements ClzDirectService {
|
|||
*/
|
||||
@Override
|
||||
public AjaxResult updateDirectSysWorkflowRecordHistory(ClzDirectApplyInfo directApplyInfo) {
|
||||
// 项目部标识
|
||||
boolean isXmb = false;
|
||||
Integer isAccept = directApplyInfo.getIsAccept();
|
||||
String remark = directApplyInfo.getRemark();
|
||||
// 考虑工单直转,参数只有一个id,故从后台查询详细数据
|
||||
directApplyInfo = clzDirectMapper.getInfoDetails(directApplyInfo);
|
||||
// 根据退料单位id查询该退料单位是否为项目部
|
||||
Long leaseUnitTypeId = mapper.getBackDeptId(directApplyInfo.getBackTeamId());
|
||||
if (leaseUnitTypeId == null) {
|
||||
throw new ServiceException("退料单位不存在,无法进行审核");
|
||||
}
|
||||
if (leaseUnitTypeId == 36) {
|
||||
isXmb = true;
|
||||
}
|
||||
directApplyInfo.setIsAccept(isAccept);
|
||||
directApplyInfo.setRemark(remark);
|
||||
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
|
|
@ -670,10 +696,10 @@ public class ClzDirectServiceImpl implements ClzDirectService {
|
|||
}
|
||||
|
||||
// 查询出【当前任务所属审批流】的所有节点
|
||||
List<SysWorkflowNode> sysWorkflowNodeList = getWorkflowNodes(directApplyInfo);
|
||||
List<SysWorkflowNode> sysWorkflowNodeList = getWorkflowNodes(isXmb);
|
||||
if (directApplyInfo.getIsAccept() == 1) {
|
||||
// 处理审批通过✅
|
||||
handleDirectApproval(sysWorkflowNodeList, directApplyInfo, sysUser, taskId, recordCode, nextNodeId, nodeId);
|
||||
handleDirectApproval(isXmb, sysWorkflowNodeList, directApplyInfo, sysUser, taskId, recordCode, nextNodeId, nodeId);
|
||||
} else {
|
||||
// 处理审核驳回❌
|
||||
handleDirectReject(sysWorkflowNodeList,directApplyInfo, taskId);
|
||||
|
|
@ -722,6 +748,7 @@ public class ClzDirectServiceImpl implements ClzDirectService {
|
|||
/**
|
||||
* 处理审批通过
|
||||
*
|
||||
* @param isXmb
|
||||
* @param sysWorkflowNodeList
|
||||
* @param directApplyInfo
|
||||
* @param sysUser
|
||||
|
|
@ -730,7 +757,7 @@ public class ClzDirectServiceImpl implements ClzDirectService {
|
|||
* @param nextNodeId
|
||||
* @param nodeId
|
||||
*/
|
||||
private void handleDirectApproval(List<SysWorkflowNode> sysWorkflowNodeList, ClzDirectApplyInfo directApplyInfo, SysUser sysUser, Integer taskId, String recordCode, Integer nextNodeId, Integer nodeId) {
|
||||
private void handleDirectApproval(boolean isXmb, List<SysWorkflowNode> sysWorkflowNodeList, ClzDirectApplyInfo directApplyInfo, SysUser sysUser, Integer taskId, String recordCode, Integer nextNodeId, Integer nodeId) {
|
||||
boolean found = false;
|
||||
List<WorkPeopleInfo> userList = new ArrayList<>();
|
||||
for (int i = 0; i < sysWorkflowNodeList.size(); i++) {
|
||||
|
|
@ -753,13 +780,20 @@ public class ClzDirectServiceImpl implements ClzDirectService {
|
|||
sysWorkflowNodeList.get(i).setNextNodeId(null);
|
||||
sysWorkflowNodeList.get(i).setNextRoleIds(null);
|
||||
}
|
||||
//根据领料单位id获取转出班组长身份证号
|
||||
if (history.getNextNodeId() != null && history.getNextNodeId() == 43) {
|
||||
userList = directAuditMapper.getProjectId(directApplyInfo.getBackTeamId());
|
||||
}
|
||||
// 转入方班组长审核
|
||||
if (history.getNextNodeId() != null && history.getNextNodeId() == 44) {
|
||||
userList = directAuditMapper.getProjectId(directApplyInfo.getLeaseTeamId());
|
||||
if (!isXmb) {
|
||||
//根据领料单位id获取转出班组长身份证号
|
||||
if (history.getNextNodeId() != null && history.getNextNodeId() == 43) {
|
||||
userList = directAuditMapper.getProjectId(directApplyInfo.getBackTeamId());
|
||||
}
|
||||
// 转入方班组长审核
|
||||
if (history.getNextNodeId() != null && history.getNextNodeId() == 44) {
|
||||
userList = directAuditMapper.getProjectId(directApplyInfo.getLeaseTeamId());
|
||||
}
|
||||
} else {
|
||||
// 跳过转出方班长审核,直接跳转转入方班长审核
|
||||
if (history.getNextNodeId() != null && history.getNextNodeId() == 51) {
|
||||
userList = directAuditMapper.getProjectId(directApplyInfo.getLeaseTeamId());
|
||||
}
|
||||
}
|
||||
String userIds = userList.stream().map(WorkPeopleInfo::getUserId).map(String::valueOf).collect(Collectors.joining(","));
|
||||
history.setDirectUserIds(userIds);
|
||||
|
|
@ -1171,12 +1205,18 @@ public class ClzDirectServiceImpl implements ClzDirectService {
|
|||
/**
|
||||
* 获取【当前任务所属审批流】的所有节点
|
||||
*
|
||||
* @param directApplyInfo
|
||||
* @param isXmb
|
||||
* @return
|
||||
*/
|
||||
private List<SysWorkflowNode> getWorkflowNodes(ClzDirectApplyInfo directApplyInfo) {
|
||||
private List<SysWorkflowNode> getWorkflowNodes(boolean isXmb) {
|
||||
SysWorkflowNode sysWorkflowNode = new SysWorkflowNode();
|
||||
sysWorkflowNode.setTypeId(22);
|
||||
if (isXmb) {
|
||||
// 转出方为项目部审批流
|
||||
sysWorkflowNode.setTypeId(24);
|
||||
} else {
|
||||
// 转出方为班组审批流
|
||||
sysWorkflowNode.setTypeId(22);
|
||||
}
|
||||
List<SysWorkflowNode> sysWorkflowNodeList = sysWorkflowNodeMapper.selectSysWorkflowNodeList(sysWorkflowNode);
|
||||
if (sysWorkflowNodeList == null || sysWorkflowNodeList.isEmpty()) {
|
||||
throw new ServiceException("流程节点配置为空");
|
||||
|
|
@ -1190,9 +1230,18 @@ public class ClzDirectServiceImpl implements ClzDirectService {
|
|||
* @param event
|
||||
*/
|
||||
private void addSysWorkflowRecord(WorkflowEvent event) {
|
||||
// 项目部标识
|
||||
boolean isXmb = false;
|
||||
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
int count = 0;
|
||||
|
||||
// 根据退料单位id查询该退料单位是否为项目部
|
||||
Long leaseUnitTypeId = mapper.getBackDeptId(event.getBackTeamId());
|
||||
if (leaseUnitTypeId == null) {
|
||||
throw new ServiceException("退料单位不存在,无法进行审核");
|
||||
}
|
||||
if (leaseUnitTypeId == 36) {
|
||||
isXmb = true;
|
||||
}
|
||||
//获取审批流id
|
||||
SysWorkflowType sysWorkflowType = new SysWorkflowType();
|
||||
sysWorkflowType.setTaskType(event.getTaskType());
|
||||
|
|
@ -1202,9 +1251,14 @@ public class ClzDirectServiceImpl implements ClzDirectService {
|
|||
throw new ServiceException("新增任务审批记录失败,请创建审核流程");
|
||||
}
|
||||
SysWorkflowRecord sysWorkflowRecord = new SysWorkflowRecord();
|
||||
if (sysWorkflowTypeList.size() == 1) {
|
||||
// 如果该任务类型配置了一个审批流,则直接使用
|
||||
sysWorkflowType = sysWorkflowTypeList.get(0);
|
||||
if (CollectionUtils.isNotEmpty(sysWorkflowTypeList)) {
|
||||
if (!isXmb) {
|
||||
// 转出单位为班组审批流
|
||||
sysWorkflowType = sysWorkflowTypeList.get(0);
|
||||
} else {
|
||||
// 转出单位为项目部审批流
|
||||
sysWorkflowType = sysWorkflowTypeList.get(1);
|
||||
}
|
||||
sysWorkflowRecord = new SysWorkflowRecord();
|
||||
sysWorkflowRecord.setWorkflowId(sysWorkflowType.getId());
|
||||
sysWorkflowRecord.setTaskId(event.getTaskId());
|
||||
|
|
|
|||
|
|
@ -536,4 +536,11 @@ public interface SelectMapper {
|
|||
* @return
|
||||
*/
|
||||
BmAgreementInfo getInfoList(BackApplyInfo bean);
|
||||
|
||||
/**
|
||||
* 根据班组id查询部门id
|
||||
* @param unitId
|
||||
* @return
|
||||
*/
|
||||
Long getBackDeptId(String unitId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -833,6 +833,7 @@ public class DirectRotationImpl implements DirectRotationService {
|
|||
1 : 0);
|
||||
record.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
record.setCreateTime(DateUtils.getNowDate());
|
||||
record.setSource(1);
|
||||
count = leaseOutDetailsMapper.insertLeaseOutDetails(record);
|
||||
// 插入结算表
|
||||
if (count > 0) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import com.bonus.common.core.utils.ServletUtils;
|
|||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo;
|
||||
import com.bonus.material.clz.domain.vo.MaterialTotalMentInfo;
|
||||
import com.bonus.material.push.domain.*;
|
||||
import com.bonus.material.push.mapper.ProDataUseInfoMapper;
|
||||
import com.bonus.material.push.service.ProDataUseInfoService;
|
||||
|
|
@ -194,7 +196,8 @@ public class PushProDataUseInfoController extends BaseController {
|
|||
try {
|
||||
StaticsNumsBean results = new StaticsNumsBean();
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("keyWord", "");
|
||||
map.put("projectId", bean.getProjectId());
|
||||
map.put("projectName", bean.getProjectName());
|
||||
String body = JSONObject.toJSONString(map);
|
||||
// 检验临期接口路径
|
||||
String url = "http://10.138.55.101:21021/iws/hystw/backstage/machine/getHyNearWarnList";
|
||||
|
|
@ -244,7 +247,8 @@ public class PushProDataUseInfoController extends BaseController {
|
|||
List<MachineInfoBean> results = new ArrayList<>();
|
||||
try {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("keyWord", "");
|
||||
map.put("projectId", bean.getProjectId());
|
||||
map.put("projectName", bean.getProjectName());
|
||||
String body = JSONObject.toJSONString(map);
|
||||
if (bean.getType() == null) {
|
||||
return AjaxResult.success();
|
||||
|
|
@ -486,4 +490,35 @@ public class PushProDataUseInfoController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* todo 皖送平台材料站计件类及绳索类总保有量查询
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "工器具台账数量查询")
|
||||
@GetMapping("/getTotalList")
|
||||
public AjaxResult getTotalList(MaterialRetainedEquipmentInfo bean) {
|
||||
try {
|
||||
MaterialTotalMentInfo info = service.getTotalList(bean);
|
||||
return AjaxResult.success(info);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* todo 皖送平台材料站计件类及绳索类总保有量查询详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "综合查询--保有设备总量查询")
|
||||
@GetMapping("/getRetainedEquipmentList")
|
||||
public AjaxResult getRetainedEquipmentList(MaterialRetainedEquipmentInfo bean) {
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||
List<MaterialRetainedEquipmentInfo> list = service.getRetainedEquipmentList(bean);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,4 +48,14 @@ public class ProIdsBean {
|
|||
private String externalId;
|
||||
|
||||
private String agreementIds;
|
||||
|
||||
/**
|
||||
* 皖送传参i8工程id
|
||||
*/
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 皖送传参i8工程名称
|
||||
*/
|
||||
private String projectName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.bonus.material.push.service;
|
||||
|
||||
import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo;
|
||||
import com.bonus.material.clz.domain.vo.MaterialTotalMentInfo;
|
||||
import com.bonus.material.push.domain.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
@ -52,4 +54,18 @@ public interface ProDataUseInfoService {
|
|||
List<TotalNumsBean> getDeviceNumByType(ProIdsBean bean);
|
||||
|
||||
List<MachineInfoBean> getProDataDetails(ProIdsBean bean);
|
||||
|
||||
/**
|
||||
* 皖送平台材料站计件类及绳索类总保有量查询
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
MaterialTotalMentInfo getTotalList(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
/**
|
||||
* 皖送平台材料站计件类及绳索类总保有量查询详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getRetainedEquipmentList(MaterialRetainedEquipmentInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
package com.bonus.material.push.service.impl;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo;
|
||||
import com.bonus.material.clz.domain.vo.MaterialTotalMentInfo;
|
||||
import com.bonus.material.clz.mapper.MaterialMachineMapper;
|
||||
import com.bonus.material.common.mapper.SelectMapper;
|
||||
import com.bonus.material.push.domain.*;
|
||||
|
||||
import com.bonus.material.push.mapper.ProDataUseInfoMapper;
|
||||
|
|
@ -24,6 +29,12 @@ public class ProDataUseInfoImpl implements ProDataUseInfoService {
|
|||
@Resource
|
||||
private ProDataUseInfoMapper proDataUseInfoMapper;
|
||||
|
||||
@Resource
|
||||
private MaterialMachineMapper materialMachineMapper;
|
||||
|
||||
@Resource
|
||||
private SelectMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<ProIdsBean> getProDataUseInfo(ProIdsBean bean) {
|
||||
List<Integer> typeIds = proDataUseInfoMapper.getTypeId();
|
||||
|
|
@ -56,6 +67,189 @@ public class ProDataUseInfoImpl implements ProDataUseInfoService {
|
|||
return machineDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* 皖送平台材料站计件类及绳索类总保有量查询
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public MaterialTotalMentInfo getTotalList(MaterialRetainedEquipmentInfo bean) {
|
||||
// 查询所有未结算的工程
|
||||
List<String> projectIdLists = mapper.getUnsettledProId();
|
||||
// 使用 HashSet 来加速查找过程
|
||||
Set<String> unsettledProjectIds = new HashSet<>(projectIdLists);
|
||||
|
||||
MaterialTotalMentInfo info = new MaterialTotalMentInfo();
|
||||
// 计件类在用数量
|
||||
BigDecimal useCountNum = BigDecimal.ZERO;
|
||||
// 分包计件类在用数量
|
||||
BigDecimal useCountNumSub = BigDecimal.ZERO;
|
||||
// 绳索类在用数量
|
||||
BigDecimal useRopeNum = BigDecimal.ZERO;
|
||||
// 分包绳索类在用数量
|
||||
BigDecimal useRopeNumSub = BigDecimal.ZERO;
|
||||
// 计件类站内数量
|
||||
BigDecimal inCountNum = BigDecimal.ZERO;
|
||||
// 绳索类站内数量
|
||||
BigDecimal inRopeNum = BigDecimal.ZERO;
|
||||
|
||||
// 获取在用量
|
||||
List<MaterialRetainedEquipmentInfo> useInfoList = materialMachineMapper.getUsInfoList(bean);
|
||||
// 分别获取useInfoList中以unitValue分组的usNum数量,展示出来
|
||||
if (!CollectionUtils.isEmpty(useInfoList)) {
|
||||
// 过滤掉不在未结算工程集合内的设备
|
||||
// 如果 proId 不在未结算集合中,则移除
|
||||
useInfoList.removeIf(infos -> infos.getProId() == null || !unsettledProjectIds.contains(infos.getProId()));
|
||||
|
||||
useCountNum = useInfoList.stream()
|
||||
.filter(item -> "0".equals(item.getUnitValue()))
|
||||
.map(MaterialRetainedEquipmentInfo::getAllNum)
|
||||
.reduce(BigDecimal::add)
|
||||
.orElse(BigDecimal.ZERO);
|
||||
useRopeNum = useInfoList.stream()
|
||||
.filter(item -> "1".equals(item.getUnitValue()))
|
||||
.map(MaterialRetainedEquipmentInfo::getAllNum)
|
||||
.reduce(BigDecimal::add)
|
||||
.orElse(BigDecimal.ZERO);
|
||||
|
||||
// 获取usList中的班组id,且去重的数量
|
||||
info.setTeamNum((int) useInfoList.stream()
|
||||
.map(MaterialRetainedEquipmentInfo::getTeamId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.count());
|
||||
} else {
|
||||
info.setTeamNum(0);
|
||||
}
|
||||
|
||||
//查询目前还有库存的设备
|
||||
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainInfoList(bean);
|
||||
if (CollectionUtils.isNotEmpty(recordList)) {
|
||||
// 过滤掉不在未结算工程集合内的设备
|
||||
// 如果 proId 不在未结算集合中,则移除
|
||||
recordList.removeIf(infos -> infos.getProId() == null || !unsettledProjectIds.contains(infos.getProId()));
|
||||
|
||||
inCountNum = recordList.stream()
|
||||
.filter(item -> "0".equals(item.getUnitValue()))
|
||||
.map(MaterialRetainedEquipmentInfo::getAllNum)
|
||||
.reduce(BigDecimal::add)
|
||||
.orElse(BigDecimal.ZERO);
|
||||
inRopeNum = recordList.stream()
|
||||
.filter(item -> "1".equals(item.getUnitValue()))
|
||||
.map(MaterialRetainedEquipmentInfo::getAllNum)
|
||||
.reduce(BigDecimal::add)
|
||||
.orElse(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
// 查询分包商领用数据,不作为库存,作为再用数据
|
||||
List<MaterialRetainedEquipmentInfo> subList = materialMachineMapper.getSubInfoList(bean);
|
||||
if (CollectionUtils.isNotEmpty(subList)) {
|
||||
// 过滤掉不在未结算工程集合内的设备
|
||||
// 如果 proId 不在未结算集合中,则移除
|
||||
subList.removeIf(infos -> infos.getProId() == null || !unsettledProjectIds.contains(infos.getProId()));
|
||||
|
||||
useCountNumSub = subList.stream()
|
||||
.filter(item -> "0".equals(item.getUnitValue()))
|
||||
.map(MaterialRetainedEquipmentInfo::getAllNum)
|
||||
.reduce(BigDecimal::add)
|
||||
.orElse(BigDecimal.ZERO);
|
||||
|
||||
useRopeNumSub = subList.stream()
|
||||
.filter(item -> "1".equals(item.getUnitValue()))
|
||||
.map(MaterialRetainedEquipmentInfo::getAllNum)
|
||||
.reduce(BigDecimal::add)
|
||||
.orElse(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
// 数据合并
|
||||
if (!CollectionUtils.isEmpty(recordList)) {
|
||||
useInfoList.addAll(recordList);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(subList)) {
|
||||
useInfoList.addAll(subList);
|
||||
}
|
||||
|
||||
// 获取在库数量
|
||||
info.setInCountNum(inCountNum);
|
||||
// 获取在用数量
|
||||
info.setInRopeNum(inRopeNum);
|
||||
// 获取计件类在用数量
|
||||
info.setUseCountNum(useCountNum.add(useCountNumSub));
|
||||
// 获取绳索类在用数量
|
||||
info.setUseRopeNum(useRopeNum.add(useRopeNumSub));
|
||||
// 计件类保有量
|
||||
info.setCountNum(inCountNum.add(useCountNum).add(useCountNumSub));
|
||||
// 绳索类保有量
|
||||
info.setRopeNum(inRopeNum.add(useRopeNum).add(useRopeNumSub));
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 皖送平台材料站计件类及绳索类总保有量查询详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MaterialRetainedEquipmentInfo> getRetainedEquipmentList(MaterialRetainedEquipmentInfo bean) {
|
||||
// 查询目前在用的设备信息
|
||||
List<MaterialRetainedEquipmentInfo> usList = materialMachineMapper.getUsInfoList(bean);
|
||||
// 查询目前还有库存的设备,仅查单位类型为项目部的
|
||||
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainInfoList(bean);
|
||||
// 查询分包商领用数据,不作为库存,作为再用数据
|
||||
List<MaterialRetainedEquipmentInfo> subList = materialMachineMapper.getSubInfoList(bean);
|
||||
|
||||
// 数据合并
|
||||
if (!CollectionUtils.isEmpty(recordList)) {
|
||||
usList.addAll(recordList);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(subList)) {
|
||||
usList.addAll(subList);
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(usList)) {
|
||||
// 查询所有未结算的工程
|
||||
List<String> projectIdList = mapper.getUnsettledProId();
|
||||
// 使用 HashSet 来加速查找过程
|
||||
Set<String> unsettledProjectIds = new HashSet<>(projectIdList);
|
||||
// 过滤掉不在未结算工程集合内的设备
|
||||
Iterator<MaterialRetainedEquipmentInfo> iterator = usList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
MaterialRetainedEquipmentInfo info = iterator.next();
|
||||
String proId = info.getProId() != null ?
|
||||
info.getProId() : null;
|
||||
|
||||
if (proId == null || !unsettledProjectIds.contains(proId)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(usList)) {
|
||||
// 判断关键字是否为空
|
||||
String keyWord = bean.getKeyWord();
|
||||
// 如果关键字不为空,进行过滤
|
||||
if (!StringUtils.isBlank(keyWord)) {
|
||||
usList = usList.stream()
|
||||
.filter(item -> containsKeyword(item, keyWord))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
}
|
||||
return usList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模糊查询
|
||||
* @param item
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
private boolean containsKeyword(MaterialRetainedEquipmentInfo item, String keyWord) {
|
||||
return (item.getTypeName() != null && item.getTypeName().contains(keyWord)) ||
|
||||
(item.getTypeModelName() != null && item.getTypeModelName().contains(keyWord)) ||
|
||||
(item.getSubUnitName() != null && item.getSubUnitName().contains(keyWord)) ||
|
||||
(item.getTeamName() != null && item.getTeamName().contains(keyWord)) ||
|
||||
(item.getJiJuType() != null && item.getJiJuType().contains(keyWord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计数据
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1302,6 +1302,7 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
|
|||
1 : 0);
|
||||
record.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
record.setCreateTime(DateUtils.getNowDate());
|
||||
record.setSource(1);
|
||||
count = leaseOutDetailsMapper.insertLeaseOutDetails(record);
|
||||
// 插入结算表
|
||||
if (count > 0) {
|
||||
|
|
|
|||
|
|
@ -1389,6 +1389,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="jiJuType != null and jiJuType != ''">
|
||||
AND mt.jiju_type = #{jiJuType}
|
||||
</if>
|
||||
<if test="projectId != null and projectId !=''">
|
||||
AND bp.external_id = #{projectId}
|
||||
</if>
|
||||
<if test="projectName != null and projectName !=''">
|
||||
AND bp.pro_name like concat ('%', #{projectName}, '%')
|
||||
</if>
|
||||
GROUP BY mt.type_id,
|
||||
bp.pro_id
|
||||
) AS subquery1 ON mt.type_id = subquery1.type_id
|
||||
|
|
@ -1462,6 +1468,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="jiJuType != null and jiJuType != ''">
|
||||
AND mt.jiju_type = #{jiJuType}
|
||||
</if>
|
||||
<if test="projectId != null and projectId !=''">
|
||||
AND bp.external_id = #{projectId}
|
||||
</if>
|
||||
<if test="projectName != null and projectName !=''">
|
||||
AND bp.pro_name like concat ('%', #{projectName}, '%')
|
||||
</if>
|
||||
GROUP BY mt.type_id,
|
||||
bp.pro_id
|
||||
) AS subquery3
|
||||
|
|
@ -1499,7 +1511,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sd.dept_name AS impUnitName,
|
||||
CASE mt.manage_type WHEN 0 THEN '编码' ELSE '数量' END manageType,
|
||||
mt.unit_value AS unitValue,
|
||||
bz.ssfbdw AS subUnitName,
|
||||
cla.sub_unit_name AS subUnitName,
|
||||
CASE mt.jiju_type WHEN 2 THEN '安全工器具' ELSE '施工机具' END jiJuType,
|
||||
'0' as bzFlag,
|
||||
mt.buy_price AS buyPrice,
|
||||
|
|
@ -1514,7 +1526,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id AND bu.del_flag = '0'
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
LEFT JOIN `micro-tool`.bzgl_bz bz ON bp.external_id = bz.project_id AND bz.bzmc = bu.unit_name
|
||||
LEFT JOIN clz_lease_apply_info cla ON cla.id = sai.lease_id
|
||||
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
||||
WHERE
|
||||
sai.`status` = '0'
|
||||
|
|
@ -1544,7 +1556,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND mt.type_name = #{typeModelName}
|
||||
</if>
|
||||
<if test="subUnitName != null and subUnitName != ''">
|
||||
AND bz.ssfbdw = #{subUnitName}
|
||||
AND cla.sub_unit_name = #{subUnitName}
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
AND bp.external_id in
|
||||
|
|
@ -1558,6 +1570,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="jiJuType != null and jiJuType != ''">
|
||||
AND mt.jiju_type = #{jiJuType}
|
||||
</if>
|
||||
<if test="projectId != null and projectId !=''">
|
||||
AND bp.external_id = #{projectId}
|
||||
</if>
|
||||
<if test="projectName != null and projectName !=''">
|
||||
AND bp.pro_name like concat ('%', #{projectName}, '%')
|
||||
</if>
|
||||
GROUP BY
|
||||
mt.type_id, bu.unit_id, bp.pro_id
|
||||
</select>
|
||||
|
|
@ -1689,13 +1707,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND bp.external_id IS NOT NULL
|
||||
and bp.pro_id not in (3414,1192,3321,3595)
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
||||
AND sd.dept_name = #{impUnitName}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name = #{proName}
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND df.project_dept LIKE CONCAT('%', #{departName}, '%')
|
||||
AND df.project_dept = #{departName}
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
AND bp.external_id in
|
||||
|
|
@ -1735,13 +1753,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
bz.bzmc IS NOT NULL
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
||||
AND sd.dept_name = #{impUnitName}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND df.project_dept LIKE CONCAT('%', #{departName}, '%')
|
||||
AND df.project_dept = #{departName}
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
AND bp.external_id in
|
||||
|
|
@ -2461,6 +2479,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="teamName != null and teamName != ''">
|
||||
AND bu.unit_name = #{teamName}
|
||||
</if>
|
||||
<if test="projectId != null and projectId !=''">
|
||||
AND bp.external_id = #{projectId}
|
||||
</if>
|
||||
<if test="projectName != null and projectName !=''">
|
||||
AND bp.pro_name like concat ('%', #{projectName}, '%')
|
||||
</if>
|
||||
GROUP BY
|
||||
mt.type_id,
|
||||
bp.pro_id,
|
||||
|
|
|
|||
|
|
@ -1768,4 +1768,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bai.agreement_id = #{agreementId}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getBackDeptId" resultType="java.lang.Long">
|
||||
select type_id as typeId
|
||||
from bm_unit
|
||||
where unit_id = #{unitId}
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -244,6 +244,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="deptId != null">
|
||||
AND sd.dept_id = #{deptId}
|
||||
</if>
|
||||
<if test="projectId != null and projectId !=''">
|
||||
AND bp.external_id = #{projectId}
|
||||
</if>
|
||||
<if test="projectName != null and projectName !=''">
|
||||
AND bp.pro_name like concat ('%', #{projectName}, '%')
|
||||
</if>
|
||||
|
||||
</select>
|
||||
<select id="getApproachingDetails" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
||||
|
|
@ -290,9 +296,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="proCenter != null and proCenter !=''">
|
||||
AND bp.pro_center like concat ('%', #{proCenter}, '%')
|
||||
</if>
|
||||
<if test="proName != null and proName !=''">
|
||||
<!--<if test="proName != null and proName !=''">
|
||||
AND bp.pro_name like concat ('%', #{proName}, '%')
|
||||
</if>
|
||||
</if>-->
|
||||
<if test="typeName != null and typeName !=''">
|
||||
AND mt2.type_name like concat ('%', #{typeName}, '%')
|
||||
</if>
|
||||
|
|
@ -302,6 +308,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="proId != null">
|
||||
GROUP BY bp.pro_id
|
||||
</if>
|
||||
<if test="projectId != null and projectId !=''">
|
||||
AND bp.external_id = #{projectId}
|
||||
</if>
|
||||
<if test="projectName != null and projectName !=''">
|
||||
AND bp.pro_name like concat ('%', #{projectName}, '%')
|
||||
</if>
|
||||
order by mt.jiju_type desc
|
||||
</select>
|
||||
<select id="getCompletionNotRefunded" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
||||
|
|
|
|||
Loading…
Reference in New Issue