材料站,直转

This commit is contained in:
hongchao 2025-09-13 17:53:54 +08:00
parent 4bc97b87ac
commit 95bb8ca367
34 changed files with 789 additions and 241 deletions

View File

@ -62,4 +62,8 @@ public class WorkPeopleInfo implements Serializable {
private String[] roleIdArray;
private Integer nextNodeId;
private Long userId;
private String userName;
}

View File

@ -24,4 +24,6 @@ public class SysUserRoleVo extends SysUserRole {
private Long deptId;
private String ancestors;
private Long userid;
}

View File

@ -1,5 +1,6 @@
package com.bonus.material.basic.mapper;
import com.bonus.common.biz.domain.lease.WorkPeopleInfo;
import com.bonus.material.basic.domain.dto.SysUserRoleVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -23,4 +24,6 @@ public interface BmUserRoleMapper {
* @return List<SysUserRoleVo>
*/
List<SysUserRoleVo> getUserRoleListByDeptId(@Param("deptId") Long deptId, @Param("roleId") Long roleId);
List<WorkPeopleInfo> getUserListByDeptId(@Param("deptId") Long deptId, @Param("roleId") Long roleId);
}

View File

@ -199,4 +199,16 @@ public class MaterialBackApplyInfo implements Serializable {
@ApiModelProperty(value = "退料方式0 材料退料1 工器具退料2 第三方推送)")
private String backStyle;
@ApiModelProperty(value = "分公司")
private String impUnitName;
@ApiModelProperty(value = "分包单位")
@Excel(name = "分包单位",sort = 5)
private String subUnitName;
@ApiModelProperty(value = "项目部")
@Excel(name = "项目部",sort = 4)
private String departName;
}

View File

@ -163,4 +163,16 @@ public class MaterialBackApplyTotalInfo implements Serializable {
*/
private List<String> projectIdList;
@ApiModelProperty(value = "分包单位")
@Excel(name = "分包单位",sort = 5)
private String subUnitName;
@ApiModelProperty(value = "项目部")
@Excel(name = "项目部",sort = 4)
private String departName;
@Excel(name = "分公司",sort = 3)
@ApiModelProperty(value = "实施单位" )
private String impUnitName;
}

View File

@ -34,14 +34,15 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
@ApiModelProperty(value = "申请时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "申请时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "申请时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 1)
private Date createTime;
@Excel(name = "申请人")
@Excel(name = "申请人",sort = 2)
@ApiModelProperty(value = "申请人")
private String createBy;
@ApiModelProperty(value = "实施单位")
@Excel(name = "分公司",sort = 3)
@ApiModelProperty(value = "实施单位" )
private String impUnitName;
@ApiModelProperty(value = "合同主体")
@ -60,9 +61,10 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
private String teamId;
@ApiModelProperty(value = "班组名称")
@Excel(name = "领料班组")
@Excel(name = "领料班组",sort = 6)
private String teamName;
@Excel(name = "租赁工程",sort = 7)
@ApiModelProperty(value = "租赁工程")
private String leaseProject;
@ -83,7 +85,7 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
private Byte leaseSignType;
@ApiModelProperty(value = "领料物资名称汇总")
@Excel(name = "领料工器具类型")
@Excel(name = "领料工器具类型",sort=8)
private String maTypeNames;
@ApiModelProperty(value = "协议号")
@ -95,7 +97,7 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
@ApiModelProperty(value = "任务ID")
private Long taskId;
@Excel(name = "班组长")
@Excel(name = "班组长",sort=9)
@ApiModelProperty(value = "领料人")
private String leasePerson;
@ -315,4 +317,16 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
* 状态
*/
private String status;
@ApiModelProperty(value = "分包单位")
@Excel(name = "分包单位",sort = 5)
private String subUnitName;
@ApiModelProperty(value = "项目部")
@Excel(name = "项目部",sort = 4)
private String departName;
@ApiModelProperty(value = "工程名称")
@Excel(name = "工程名称")
private String proName;
}

View File

@ -233,4 +233,13 @@ public class MaterialRetainedEquipmentInfo {
@ApiModelProperty(value = "项目部名称")
private String proCenter;
@ApiModelProperty(value = "物资类型")
private String materialName;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
}

View File

@ -41,4 +41,20 @@ public class MaterialRetainedTeamTotalVo {
@ApiModelProperty(value = "实施单位id")
private String impUnit;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司")
private String impUnitName;
@ApiModelProperty(value = "项目部")
@Excel(name = "项目部")
private String departName;
@ApiModelProperty(value = "工程名称")
@Excel(name = "工程名称")
private String proName;
@ApiModelProperty(value = "分包单位")
@Excel(name = "分包单位")
private String subUnitName;
}

View File

@ -102,4 +102,20 @@ public class LeaseTotalInfo {
* i8工程id集合
*/
private List<String> projectIdList;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司")
private String impUnitName;
@ApiModelProperty(value = "项目部")
@Excel(name = "项目部")
private String departName;
@ApiModelProperty(value = "工程名称")
@Excel(name = "工程名称")
private String proName;
@ApiModelProperty(value = "分包单位")
@Excel(name = "分包单位")
private String subUnitName;
}

View File

@ -21,6 +21,7 @@ import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.material.clz.domain.BmTeam;
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo;
import com.bonus.material.clz.mapper.IwsTeamUserMapper;
import com.bonus.material.clz.mapper.MaterialMachineMapper;
import com.bonus.material.common.mapper.SelectMapper;
import com.bonus.material.ma.mapper.MachineMapper;
@ -74,6 +75,9 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
@Resource
private MaterialMachineMapper materialMachineMapper;
@Resource
private IwsTeamUserMapper iwsTeamUserMapper;
/**
* 查询退料申请列表
* @param backApplyInfo
@ -125,12 +129,21 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
}*/
}
if (!CollectionUtils.isEmpty(list)) {
// 提取关键字
String keyWord = backApplyInfo.getKeyWord();
// 如果关键字不为空进行过滤
if (!StringUtils.isBlank(keyWord)) {
for (MaterialBackApplyInfo materialRetainedEquipmentInfo : list) {
// 根据班组名称查询分包单位
String subUnitName = iwsTeamUserMapper.getTeamName(materialRetainedEquipmentInfo.getTeamName());
materialRetainedEquipmentInfo.setSubUnitName(subUnitName);
}
if(backApplyInfo.getSubUnitName()!=null && !backApplyInfo.getSubUnitName().equals("") && !list.isEmpty()){
// 根据传入的SubUnitName过滤列表
list = list.stream()
.filter(item -> containsKeyword(item, keyWord))
.filter(item -> com.alibaba.nacos.common.utils.StringUtils.equals(item.getSubUnitName(), backApplyInfo.getSubUnitName()))
.collect(Collectors.toList());
}
if (!org.springframework.util.CollectionUtils.isEmpty(list) && !StringUtils.isBlank(backApplyInfo.getTypeName())) {
list = list.stream()
.filter(item -> StringUtils.isNotBlank(item.getTypeName()) &&
item.getTypeName().contains(backApplyInfo.getTypeName()))
.collect(Collectors.toList());
}
// 如果需要导出
@ -232,6 +245,13 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
list = filterList(list, username);
}*/
}
// 新增typeName过滤条件
if (!org.springframework.util.CollectionUtils.isEmpty(list) && !StringUtils.isBlank(backApplyInfo.getTypeName())) {
list = list.stream()
.filter(item -> StringUtils.isNotBlank(item.getTypeName()) &&
item.getTypeName().contains(backApplyInfo.getTypeName()))
.collect(Collectors.toList());
}
if (!CollectionUtils.isEmpty(list)) {
// 如果关键字不为空进行过滤
if (!StringUtils.isBlank(backApplyInfo.getKeyWord())) {
@ -601,6 +621,19 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
list = filterInfo(list, username);
}*/
}
if (CollectionUtils.isNotEmpty(list)) {
for (MaterialBackApplyTotalInfo materialRetainedEquipmentInfo : list) {
// 根据班组名称查询分包单位
String subUnitName = iwsTeamUserMapper.getTeamName(materialRetainedEquipmentInfo.getTeamName());
materialRetainedEquipmentInfo.setSubUnitName(subUnitName);
}
if(info.getSubUnitName()!=null && !info.getSubUnitName().equals("") && !list.isEmpty()){
// 根据传入的SubUnitName过滤列表
list = list.stream()
.filter(item -> com.alibaba.nacos.common.utils.StringUtils.equals(item.getSubUnitName(), info.getSubUnitName()))
.collect(Collectors.toList());
}
}
if (CollectionUtils.isNotEmpty(list)) {
for (MaterialBackApplyTotalInfo backApplyTotalInfo : list) {
backNum = backNum.add(backApplyTotalInfo.getBackNum());

View File

@ -25,7 +25,9 @@ import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.material.clz.domain.BmTeam;
import com.bonus.material.clz.domain.vo.MaterialMaCodeVo;
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo;
import com.bonus.material.clz.mapper.BmTeamMapper;
import com.bonus.material.clz.mapper.IwsTeamUserMapper;
import com.bonus.material.clz.mapper.MaterialMachineMapper;
import com.bonus.material.common.domain.dto.SelectDto;
import com.bonus.material.common.domain.vo.AgreementVo;
@ -93,6 +95,9 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
@Resource
private BmTeamMapper bmTeamMapper;
@Resource
private IwsTeamUserMapper iwsTeamUserMapper;
/**
* 查询领料任务列表
*
@ -141,13 +146,25 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
.collect(Collectors.toList());
}
}
// 处理剩余数据
if (!CollectionUtils.isEmpty(sortedList)) {
// 关键字过滤
String keyWord = leaseApplyInfo.getKeyWord();
if (!StringUtils.isBlank(keyWord)) {
for (MaterialLeaseApplyInfo materialRetainedEquipmentInfo : sortedList) {
// 根据班组名称查询分包单位
String subUnitName = iwsTeamUserMapper.getTeamName(materialRetainedEquipmentInfo.getTeamName());
materialRetainedEquipmentInfo.setSubUnitName(subUnitName);
}
if(leaseApplyInfo.getSubUnitName()!=null && !leaseApplyInfo.getSubUnitName().equals("") && !sortedList.isEmpty()){
// 根据传入的SubUnitName过滤列表
sortedList = sortedList.stream()
.filter(item -> containsKeyword(item, keyWord))
.filter(item -> com.alibaba.nacos.common.utils.StringUtils.equals(item.getSubUnitName(), leaseApplyInfo.getSubUnitName()))
.collect(Collectors.toList());
}
if (!org.springframework.util.CollectionUtils.isEmpty(sortedList) && !StringUtils.isBlank(leaseApplyInfo.getMaTypeNames())) {
sortedList = sortedList.stream()
.filter(item -> StringUtils.isNotBlank(item.getMaTypeNames()) &&
item.getMaTypeNames().contains(leaseApplyInfo.getMaTypeNames()))
.collect(Collectors.toList());
}
// 状态过滤
@ -241,6 +258,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
}
// 领料数据
List<MaterialLeaseApplyInfo> list = materialLeaseInfoMapper.getTotalList(leaseApplyInfo);
// 查询领用数据
List<MaterialLeaseApplyInfo> leaseApplyOutList = materialLeaseInfoMapper.selectPublishList(leaseApplyInfo);
if (!CollectionUtils.isEmpty(leaseApplyOutList)) {
@ -280,6 +298,13 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
.collect(Collectors.toList());
}
}
// 新增maTypeNames过滤条件
if (!CollectionUtils.isEmpty(sortedList) && !StringUtils.isBlank(leaseApplyInfo.getMaTypeNames())) {
sortedList = sortedList.stream()
.filter(item -> StringUtils.isNotBlank(item.getMaTypeNames()) &&
item.getMaTypeNames().contains(leaseApplyInfo.getMaTypeNames()))
.collect(Collectors.toList());
}
if (!CollectionUtils.isEmpty(sortedList)) {
// 如果关键字不为空进行过滤
if (!StringUtils.isBlank(leaseApplyInfo.getKeyWord())) {

View File

@ -569,7 +569,19 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
@Override
public List<MaterialRetainedEquipmentInfo> getSafeDetailsList(MaterialRetainedEquipmentInfo bean) {
bean.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
return materialMachineMapper.getTotalList(bean);
List<MaterialRetainedEquipmentInfo> usList = materialMachineMapper.getTotalList(bean);
for (MaterialRetainedEquipmentInfo materialRetainedEquipmentInfo : usList) {
// 根据班组名称查询分包单位
String subUnitName = iwsTeamUserMapper.getTeamName(materialRetainedEquipmentInfo.getTeamName());
materialRetainedEquipmentInfo.setSubUnitName(subUnitName);
}
if(bean.getSubUnitName()!=null && !bean.getSubUnitName().equals("") && !usList.isEmpty()){
// 根据传入的SubUnitName过滤列表
usList = usList.stream()
.filter(item -> StringUtils.equals(item.getSubUnitName(), bean.getSubUnitName()))
.collect(Collectors.toList());
}
return usList;
}
/**
@ -598,6 +610,18 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
List<String> departId = mapper.getDepartId(username);
// 根据项目部id查询工程信息
List<MaterialRetainedTeamTotalVo> teamNumList = materialMachineMapper.getTeamNumList(bean);
for (MaterialRetainedTeamTotalVo materialRetainedEquipmentInfo : teamNumList) {
// 根据班组名称查询分包单位
String subUnitName = iwsTeamUserMapper.getTeamName(materialRetainedEquipmentInfo.getTeamName());
materialRetainedEquipmentInfo.setSubUnitName(subUnitName);
}
if(bean.getSubUnitName()!=null && !bean.getSubUnitName().equals("") && !teamNumList.isEmpty()){
// 根据传入的SubUnitName过滤列表
teamNumList = teamNumList.stream()
.filter(item -> StringUtils.equals(item.getSubUnitName(), bean.getSubUnitName()))
.collect(Collectors.toList());
}
if (CollectionUtils.isEmpty(departId)) {
List<String> projectIdList = mapper.getProjectId(departId);
List<BmProject> list = mapper.getProjectInfo(new BmProject());

View File

@ -27,6 +27,8 @@ import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import static net.sf.jsqlparser.util.validation.metadata.NamedObject.user;
@Component
public class ApplyEventListener {
@ -75,8 +77,6 @@ public class ApplyEventListener {
throw new RuntimeException("创建审批任务失败!");
}
} else {
sysWorkflowRecord = new SysWorkflowRecord();
sysWorkflowRecord.setTaskId(event.getTaskId());
@ -84,12 +84,6 @@ public class ApplyEventListener {
sysWorkflowRecord.setTaskCode(event.getTaskCode());
//创建审批任务
count = sysWorkflowRecordMapper.addSysWorkflowRecord(sysWorkflowRecord);
// int newId = 0;
//
// newId = sysWorkflowRecord.getId() ;
// if (count > 0) {
// createWorkOrderAndPeople(sysUser, event, Long.valueOf(sysWorkflowRecord.getTaskId()), newId);
// }
// 如果该任务类型配置了多个审批流则根据任务信息判断使用
if (event.getTaskType() == TmTaskTypeEnum.TM_TASK_DIRECT.getTaskTypeId()) {
// 直转审批任务则根据转出和转入的部门判断同一部门使用无需接收审批流不同部门则使用需要接收审批流
@ -152,17 +146,42 @@ public class ApplyEventListener {
sysWorkflowRecordHistory.setIsAccept(1);
sysWorkflowRecordHistory.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
sysWorkflowRecordHistory.setCreateTime(DateUtils.getNowDate());
int projectId = directAuditMapper.getProjectIdById(event.getBackAgreementId());
//根据project_id获取external_id
String externalId = directAuditMapper.getExternalId(projectId);
List<WorkPeopleInfo> userList = new ArrayList<>();
if (externalId != null && !externalId.isEmpty()) {
//获取项目总工id
String leaderId = directAuditMapper.getLeaderId(externalId);
if(leaderId != null && !leaderId.isEmpty()){
//获取项目总工账号
String leaderAccount = directAuditMapper.getUserNameById(leaderId);
if(leaderAccount != null && !leaderAccount.isEmpty()){
userList = directAuditMapper.getUserIdByUserName(leaderAccount);
if(userList != null && !userList.isEmpty()){
String userIds = userList.stream().map(WorkPeopleInfo::getUserId).map(String::valueOf).collect(Collectors.joining(","));
sysWorkflowRecordHistory.setDirectUserIds(userIds);
}
}
}else{
directAuditMapper.deleteWorkflowRecord(newId);
throw new RuntimeException("项目总工不存在");
}
}else{
directAuditMapper.deleteWorkflowRecord(newId);
throw new RuntimeException("未找到所属工程");
}
sysWorkflowRecordHistoryMapper.addSysWorkflowRecordHistory(sysWorkflowRecordHistory);
if (count > 0) {
createWorkOrderAndPeople(sysUser, event, Long.valueOf(sysWorkflowRecord.getTaskId()), newId,sysWorkflowRecordHistory.getNodeId());
if (count > 0 && userList != null && !userList.isEmpty()) {
createWorkOrderAndPeople(sysUser, event, Long.valueOf(sysWorkflowRecord.getTaskId()), newId,sysWorkflowRecordHistory.getNodeId(),userList);
}
return newId;
}
private void createWorkOrderAndPeople(SysUser sysUser, InsertWorkflowEvent event, Long taskId, int newId,int nodeId) {
private void createWorkOrderAndPeople(SysUser sysUser, InsertWorkflowEvent event, Long taskId, int newId,int nodeId,List<WorkPeopleInfo> userList) {
//获取工程名称
int projectId = directAuditMapper.getProjectIdById(event.getLeaseAgreementId());
int projectId = directAuditMapper.getProjectIdById(event.getBackAgreementId());
String projectName = directAuditMapper.getProjectNameById(projectId);
String id = UUID.randomUUID().toString().replace("-", "");
String webUrlBase = "/mea-h5/#/pages/businessAudit/directAudit/details";
@ -190,39 +209,15 @@ public class ApplyEventListener {
int countWork = directAuditMapper.insertWorkOrder(workApplyInfo);
if (countWork > 0) {
//查询审批人集合
WorkPeopleInfo info = new WorkPeopleInfo();
info.setFlowId(newId);
List<WorkPeopleInfo> workPeopleInfoList = directAuditMapper.selectWorkPeopleInfoList(info.getFlowId());
// 过滤掉nextNodeId为null的数据
if (workPeopleInfoList != null) {
workPeopleInfoList = workPeopleInfoList.stream()
.filter(person -> person.getNextNodeId() != null) // 过滤条件nextNodeId不为null
.collect(Collectors.toList());
}
if(workPeopleInfoList != null && workPeopleInfoList.size() > 0){
WorkPeopleInfo person = workPeopleInfoList.get(0);
String roleIds = person.getRoleIds();
String[] roleIdArray = roleIds.split(",");
long deptId = sysUser.getDeptId();
//根据角色和部门查询用户集合
WorkPeopleInfo param = new WorkPeopleInfo();
param.setRoleIdArray(roleIdArray);
param.setDeptId(deptId);
List<WorkPeopleInfo> userList = directAuditMapper.selectUserListByRoleAndDept(param);
for (WorkPeopleInfo user : userList) {
WorkPeopleInfo workPeopleInfo = new WorkPeopleInfo();
workPeopleInfo.setId(UUID.randomUUID().toString().replace("-", ""));
workPeopleInfo.setInformationId(id);
workPeopleInfo.setReceiverUsername(user.getReceiverUsername());
for (WorkPeopleInfo user : userList) {
WorkPeopleInfo workPeopleInfo = new WorkPeopleInfo();
workPeopleInfo.setId(UUID.randomUUID().toString().replace("-", ""));
workPeopleInfo.setInformationId(id);
workPeopleInfo.setReceiverUsername(user.getUserName());
workPeopleInfo.setReadState(0);
workPeopleInfo.setHandleState(0);
workPeopleInfo.setIsExamine(0);
directAuditMapper.insertWorkPeople(workPeopleInfo);
}
}
}
}

View File

@ -9,13 +9,15 @@ public class InsertWorkflowEvent {
private final int taskType;
private final String taskCode;
private final int leaseAgreementId;
private final int backAgreementId;
private final String leaseMan;
public InsertWorkflowEvent(int taskId, String taskCode, int taskType,int leaseAgreementId, String leaseMan) {
public InsertWorkflowEvent(int taskId, String taskCode, int taskType,int leaseAgreementId,int backAgreementId, String leaseMan) {
this.taskId = taskId;
this.taskCode = taskCode;
this.taskType = taskType;
this.leaseAgreementId = leaseAgreementId;
this.backAgreementId = backAgreementId;
this.leaseMan = leaseMan;
}

View File

@ -204,4 +204,6 @@ public class DirectApplyInfo extends BaseEntity {
@ApiModelProperty(value = "任务状态列表")
private List<Integer> statusList;
private Integer deptId;
}

View File

@ -348,4 +348,27 @@ public class Machine extends BaseEntity {
@ApiModelProperty(value = "当前状态")
private String oldStatus;
@ApiModelProperty(value = "分公司")
private String impUnitName;
@ApiModelProperty(value = "项目部")
private String departName;
@ApiModelProperty(value="开始时间")
private String startTime;
@ApiModelProperty(value="结束时间")
private String endTime;
@ApiModelProperty(value="本次检验开始时间")
private String checkStartTime;
@ApiModelProperty(value="本次检验结束时间")
private String checkEndTime;
@ApiModelProperty(value="下次检验开始时间")
private String nextStartTime;
@ApiModelProperty(value="下次检验结束时间")
private String nextEndTime;
}

View File

@ -135,6 +135,7 @@ public class DirectRotationImpl implements DirectRotationService {
String code;
String leaseMan;
int leaseAgreementId;
int backAgreementId;
if (directApplyInfoDetails != null) {
if (directApplyInfoDetails.getDirectApplyInfo() != null) {
DirectApplyInfo directApplyInfos = directApplyInfoDetails.getDirectApplyInfo();
@ -156,6 +157,7 @@ public class DirectRotationImpl implements DirectRotationService {
directApplyInfos.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
leaseMan = directApplyInfos.getLeaseMan();
leaseAgreementId = directApplyInfos.getLeaseAgreementId();
backAgreementId = directApplyInfos.getBackAgreementId();
int i = workSiteDirectManageService.saveDirectApplyInfo(directApplyInfos);
if (i < 0) {
return AjaxResult.error("保存失败");
@ -186,7 +188,7 @@ public class DirectRotationImpl implements DirectRotationService {
// @Override
// public void afterCommit() {
// 发布审批流程事件
applicationEventPublisher.publishEvent(new InsertWorkflowEvent(id, code, TM_TASK_DIRECT.getTaskTypeId(),leaseAgreementId,leaseMan));
applicationEventPublisher.publishEvent(new InsertWorkflowEvent(id, code, TM_TASK_DIRECT.getTaskTypeId(),leaseAgreementId,backAgreementId,leaseMan));
// }
// });

View File

@ -122,4 +122,8 @@ public class SysWorkflowNode {
* 审核人
*/
private String auditBy;
private Integer nextNodeId;
private String nextRoleIds;
}

View File

@ -103,4 +103,6 @@ public class SysWorkflowRecordHistory {
* 工单审核状态0待审核1已审核
*/
private int isExamine;
private String directUserIds;
}

View File

@ -11,6 +11,7 @@ import com.bonus.material.work.domain.DirectAudit;
import com.bonus.material.work.domain.SysWorkflowRecord;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/**
@ -44,4 +45,16 @@ public interface DirectAuditMapper {
List<WorkPeopleInfo> selectUserListByRoleAndDept(WorkPeopleInfo param);
void insertWorkPeople(WorkPeopleInfo workPeopleInfo);
String getExternalId(int projectId);
String getLeaderId(String externalId);
String getUserNameById(String leaderId);
List<WorkPeopleInfo> getUserIdByUserName(String leaderAccount);
void deleteWorkflowRecord(int newId);
List<WorkPeopleInfo> getUserIdByExternalId(String leaderAccount);
}

View File

@ -1,5 +1,6 @@
package com.bonus.material.work.mapper;
import com.bonus.material.basic.domain.dto.SysUserRoleVo;
import com.bonus.material.work.domain.SysWorkflowConfig;
import com.bonus.material.work.domain.SysWorkflowType;
@ -25,4 +26,6 @@ public interface SysWorkflowConfigMapper {
SysWorkflowConfig selectConfigValueInfoByNodeId(Integer nodeId);
int getImpUnit(String backProId);
List<SysUserRoleVo> getUserIdByUserName(String leaderAccount);
}

View File

@ -17,4 +17,16 @@ public interface SysWorkflowRecordHistoryMapper {
SysWorkflowRecordHistory getWorkFlowRecordNodeInfoByTaskId(Integer taskId);
SysWorkflowRecordHistory getWorkflowRecordHistory(Integer recordId);
String getDirectUserIdsByTaskId(SysWorkflowRecordHistory sysWorkflowRecordHistory);
int getLeaseAgreementIdByTaskId(SysWorkflowRecordHistory sysWorkflowRecordHistory);
int getProjectIdById(int leaseAgreementId);
int getBackAgreementIdByTaskId(SysWorkflowRecordHistory sysWorkflowRecordHistory);
String getNowUserIds(SysWorkflowRecordHistory sysWorkflowRecordHistory);
void deleteNowNode(SysWorkflowRecordHistory sysWorkflowRecordHistory);
}

View File

@ -1,6 +1,7 @@
package com.bonus.material.work.service;
import com.bonus.common.biz.domain.lease.WorkPeopleInfo;
import com.bonus.material.ma.domain.DirectApplyInfo;
import com.bonus.material.work.domain.SysWorkflowNode;
@ -19,7 +20,7 @@ public interface SysWorkflowNodeService {
List<SysWorkflowNode> listByTaskId(SysWorkflowNode sysWorkflowNode);
void copeNodeConfigPersonValuesByNode(SysWorkflowNode forSysWorkflowNode);
void copeNodeConfigPersonValuesByNodeTwo(SysWorkflowNode forSysWorkflowNode, DirectApplyInfo directApplyInfo);
void copeNodeConfigPersonValuesByNodeTwo(SysWorkflowNode forSysWorkflowNode, DirectApplyInfo directApplyInfo,List<WorkPeopleInfo> userList,int num);
Map<Integer, SysWorkflowNode> listByProId(SysWorkflowNode sysWorkflowNode);
}

View File

@ -48,73 +48,73 @@ public class DirectAuditImpl implements IDirectAuditService {
List<DirectApplyInfo> directApplyInfoList = mapper.getList(directApplyInfo);
directApplyInfoList.removeIf(item -> item == null || item.getNodeId() == null);
for (DirectApplyInfo directApplyInfoNew : directApplyInfoList) {
log.info("当前节点为{}", directApplyInfoNew.getNodeId());
SysWorkflowRecordHistory sysWorkflowRecordHistory = sysWorkflowRecordHistoryMapper.getWorkflowRecordHistoryByRecordId(directApplyInfoNew.getRecordId());
directApplyInfoNew.setNodeId(sysWorkflowRecordHistory.getNodeId());
//设置当前节点
if (1 == directApplyInfoNew.getNodeSignType() && sysWorkflowRecordHistory.getNodeSort() == 1) {
directApplyInfoNew.setNodeId(sysWorkflowRecordHistory.getNextNodeId());
}
String configValue = sysWorkflowConfigMapper.selectConfigValueByNodeId(directApplyInfoNew.getNodeId());
SysWorkflowNode sysWorkflowNode = sysWorkflowNodeMapper.selectSysWorkflowNodeById(directApplyInfoNew.getNodeId());
directApplyInfoNew.setConfigValue(configValue);
//判断当前节点是否审核
sysWorkflowRecordHistory.setRecordId(directApplyInfoNew.getRecordId());
sysWorkflowRecordHistory.setNodeId(directApplyInfoNew.getNodeId());
List<SysWorkflowRecordHistory> sysWorkflowRecordHistoryList = sysWorkflowRecordHistoryMapper.seleteSysWorkflowRecordHistory(sysWorkflowRecordHistory);
//判断是或签还是会签0:或签 1:会签
if (sysWorkflowNode.getNodeSignType() == 0) {
//当前节点已经审核需要修改节点值
if (sysWorkflowRecordHistoryList.get(0) != null) {
// 查询下个节点需要审核的人员
// 不能采用简单的直接查询数据库字段而是要调用方法根据配置来获取对应的配置
// String configValueNew = sysWorkflowConfigMapper.selectConfigValueByNodeId(sysWorkflowRecordHistoryList.get(0).getNextNodeId());
// 先根据下个节点的ID去查询下个节点信息
SysWorkflowNode nextWorkflowInfo = sysWorkflowNodeMapper.selectSysWorkflowNodeById(sysWorkflowRecordHistoryList.get(0).getNextNodeId());
// 再根据下个节点信息查询到配置值
sysWorkflowNodeService.copeNodeConfigPersonValuesByNodeTwo(nextWorkflowInfo,directApplyInfoNew);
directApplyInfoNew.setNodeId(sysWorkflowRecordHistoryList.get(0).getNextNodeId());
if (nextWorkflowInfo != null && nextWorkflowInfo.getConfigValues() != null) {
directApplyInfoNew.setConfigValue(nextWorkflowInfo.getConfigValues());
} else {
directApplyInfoNew.setConfigValue("");
}
}
} else {
String[] ConfigValue = configValue.split(",");
List<String> filteredList = Arrays.stream(ConfigValue).collect(Collectors.toList());
for (SysWorkflowRecordHistory sysWorkflowRecordHistoryNew : sysWorkflowRecordHistoryList) {
if (sysWorkflowRecordHistoryNew != null) {
// 过滤数组元素
filteredList = filteredList.stream()
.filter(value -> value != null && !value.equals(sysWorkflowRecordHistoryNew.getCreateBy()))
.collect(Collectors.toList());
directApplyInfoNew.setConfigValue(filteredList.toString());
}
}
// 判断是否这个节点的所有人都需要审核
if (filteredList.isEmpty()) {
// 不能采用简单的直接查询数据库字段而是要调用方法根据配置来获取对应的配置
// String configValueNew = sysWorkflowConfigMapper.selectConfigValueByNodeId(sysWorkflowRecordHistoryList.get(0).getNextNodeId());
// 先根据下个节点的ID去查询下个节点信息
SysWorkflowNode nextWorkflowInfo = sysWorkflowNodeMapper.selectSysWorkflowNodeById(sysWorkflowRecordHistoryList.get(0).getNextNodeId());
// 再根据下个节点信息查询到配置值
sysWorkflowNodeService.copeNodeConfigPersonValuesByNode(nextWorkflowInfo);
directApplyInfoNew.setNodeId(sysWorkflowRecordHistoryList.get(0).getNextNodeId());
directApplyInfoNew.setConfigValue(nextWorkflowInfo.getConfigValues());
} else {
if (!sysWorkflowRecordHistoryList.isEmpty()) {
directApplyInfoNew.setNodeId(directApplyInfoNew.getNodeId());
directApplyInfoNew.setConfigValue(filteredList.toString());
}
}
}
}
// for (DirectApplyInfo directApplyInfoNew : directApplyInfoList) {
// log.info("当前节点为{}", directApplyInfoNew.getNodeId());
// SysWorkflowRecordHistory sysWorkflowRecordHistory = sysWorkflowRecordHistoryMapper.getWorkflowRecordHistoryByRecordId(directApplyInfoNew.getRecordId());
// directApplyInfoNew.setNodeId(sysWorkflowRecordHistory.getNodeId());
// //设置当前节点
// if (1 == directApplyInfoNew.getNodeSignType() && sysWorkflowRecordHistory.getNodeSort() == 1) {
// directApplyInfoNew.setNodeId(sysWorkflowRecordHistory.getNextNodeId());
// }
// String configValue = sysWorkflowConfigMapper.selectConfigValueByNodeId(directApplyInfoNew.getNodeId());
// SysWorkflowNode sysWorkflowNode = sysWorkflowNodeMapper.selectSysWorkflowNodeById(directApplyInfoNew.getNodeId());
// directApplyInfoNew.setConfigValue(configValue);
// //判断当前节点是否审核
// sysWorkflowRecordHistory.setRecordId(directApplyInfoNew.getRecordId());
// sysWorkflowRecordHistory.setNodeId(directApplyInfoNew.getNodeId());
// List<SysWorkflowRecordHistory> sysWorkflowRecordHistoryList = sysWorkflowRecordHistoryMapper.seleteSysWorkflowRecordHistory(sysWorkflowRecordHistory);
// //判断是或签还是会签0:或签 1:会签
// if (sysWorkflowNode.getNodeSignType() == 0) {
// //当前节点已经审核需要修改节点值
// if (sysWorkflowRecordHistoryList.get(0) != null) {
// // 查询下个节点需要审核的人员
// // 不能采用简单的直接查询数据库字段而是要调用方法根据配置来获取对应的配置
// // String configValueNew = sysWorkflowConfigMapper.selectConfigValueByNodeId(sysWorkflowRecordHistoryList.get(0).getNextNodeId());
//
// // 先根据下个节点的ID去查询下个节点信息
// SysWorkflowNode nextWorkflowInfo = sysWorkflowNodeMapper.selectSysWorkflowNodeById(sysWorkflowRecordHistoryList.get(0).getNextNodeId());
// // 再根据下个节点信息查询到配置值
// sysWorkflowNodeService.copeNodeConfigPersonValuesByNodeTwo(nextWorkflowInfo,directApplyInfoNew);
// directApplyInfoNew.setNodeId(sysWorkflowRecordHistoryList.get(0).getNextNodeId());
// if (nextWorkflowInfo != null && nextWorkflowInfo.getConfigValues() != null) {
// directApplyInfoNew.setConfigValue(nextWorkflowInfo.getConfigValues());
// } else {
// directApplyInfoNew.setConfigValue("");
// }
// }
// } else {
// String[] ConfigValue = configValue.split(",");
// List<String> filteredList = Arrays.stream(ConfigValue).collect(Collectors.toList());
// for (SysWorkflowRecordHistory sysWorkflowRecordHistoryNew : sysWorkflowRecordHistoryList) {
// if (sysWorkflowRecordHistoryNew != null) {
// // 过滤数组元素
// filteredList = filteredList.stream()
// .filter(value -> value != null && !value.equals(sysWorkflowRecordHistoryNew.getCreateBy()))
// .collect(Collectors.toList());
// directApplyInfoNew.setConfigValue(filteredList.toString());
// }
// }
//
// // 判断是否这个节点的所有人都需要审核
// if (filteredList.isEmpty()) {
// // 不能采用简单的直接查询数据库字段而是要调用方法根据配置来获取对应的配置
// // String configValueNew = sysWorkflowConfigMapper.selectConfigValueByNodeId(sysWorkflowRecordHistoryList.get(0).getNextNodeId());
// // 先根据下个节点的ID去查询下个节点信息
// SysWorkflowNode nextWorkflowInfo = sysWorkflowNodeMapper.selectSysWorkflowNodeById(sysWorkflowRecordHistoryList.get(0).getNextNodeId());
// // 再根据下个节点信息查询到配置值
// sysWorkflowNodeService.copeNodeConfigPersonValuesByNode(nextWorkflowInfo);
//
// directApplyInfoNew.setNodeId(sysWorkflowRecordHistoryList.get(0).getNextNodeId());
// directApplyInfoNew.setConfigValue(nextWorkflowInfo.getConfigValues());
// } else {
// if (!sysWorkflowRecordHistoryList.isEmpty()) {
// directApplyInfoNew.setNodeId(directApplyInfoNew.getNodeId());
// directApplyInfoNew.setConfigValue(filteredList.toString());
// }
// }
//
// }
// }
return directApplyInfoList;
}

View File

@ -1,5 +1,6 @@
package com.bonus.material.work.service.impl;
import com.bonus.common.biz.domain.lease.WorkPeopleInfo;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.security.utils.SecurityUtils;
@ -9,6 +10,7 @@ import com.bonus.material.ma.domain.DirectApplyInfo;
import com.bonus.material.work.domain.SysWorkflowConfig;
import com.bonus.material.work.domain.SysWorkflowNode;
import com.bonus.material.work.domain.SysWorkflowRecordHistory;
import com.bonus.material.work.mapper.DirectAuditMapper;
import com.bonus.material.work.mapper.SysWorkflowConfigMapper;
import com.bonus.material.work.mapper.SysWorkflowNodeMapper;
import com.bonus.material.work.mapper.SysWorkflowRecordHistoryMapper;
@ -36,6 +38,9 @@ public class SysWorkflowNodeServiceImpl implements SysWorkflowNodeService {
@Resource
private BmUserRoleMapper bmUserRoleMapper;
@Resource
private DirectAuditMapper directAuditMapper;
/**
* 工作流详情列表
*/
@ -222,7 +227,7 @@ public class SysWorkflowNodeServiceImpl implements SysWorkflowNodeService {
}
@Override
public void copeNodeConfigPersonValuesByNodeTwo(SysWorkflowNode forSysWorkflowNode, DirectApplyInfo directApplyInfo) {
public void copeNodeConfigPersonValuesByNodeTwo(SysWorkflowNode forSysWorkflowNode, DirectApplyInfo directApplyInfo,List<WorkPeopleInfo> userList,int num) {
if (forSysWorkflowNode == null) {
System.err.println("传入的节点信息为空!");
return;
@ -231,7 +236,7 @@ public class SysWorkflowNodeServiceImpl implements SysWorkflowNodeService {
// 判断配置的类型
if (forSysWorkflowNode.getConfigType() == null || forSysWorkflowNode.getConfigType() == 0) {
// 如果配置的是角色那么要根据角色id去查询有哪些用户
String roleIds = forSysWorkflowNode.getRoleIds();
String roleIds = forSysWorkflowNode.getNextRoleIds();
// 如果参数没有那么就从数据库中查询
if (roleIds == null || roleIds.isEmpty()) {
System.out.println("节点配置角色为空!去再执行数据库查询");
@ -241,51 +246,58 @@ public class SysWorkflowNodeServiceImpl implements SysWorkflowNodeService {
StringBuilder roleConfigValues = new StringBuilder();
String[] roleIdArray = roleIds.split(",");
for (String forRoleId : roleIdArray) {
List<SysUserRoleVo> userList = bmUserRoleMapper.getUserRoleListByDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId(), Long.valueOf(forRoleId));
if(forSysWorkflowNode.getNodeName().contains("接收")){
int proIdLease = sysWorkflowConfigMapper.getImpUnit(directApplyInfo.getLeaseProId());
// 使用 Iterator 迭代器遍历支持安全删除元素
Iterator<SysUserRoleVo> iterator = userList.iterator();
while (iterator.hasNext()) {
SysUserRoleVo user = iterator.next();
// 条件1部门ID等于proIdBack 保留跳过删除
if (proIdLease == user.getDeptId()) {
continue;
if(forSysWorkflowNode.getNodeName().contains("接收方材料员审核")){
//根据project_id获取external_id
String externalId = directAuditMapper.getExternalId(Integer.parseInt(directApplyInfo.getLeaseProId()));
if (externalId != null && !externalId.isEmpty()) {
//获取项目总工id
String leaderId = directAuditMapper.getLeaderId(externalId);
if(leaderId != null && !leaderId.isEmpty()){
//获取项目总工账号
String leaderAccount = directAuditMapper.getUserNameById(leaderId);
if(leaderAccount != null && !leaderAccount.isEmpty()){
userList.addAll(directAuditMapper.getUserIdByUserName(leaderAccount));
}
}else{
throw new RuntimeException("项目总工不存在");
}
// 条件2祖先ID列表包含proIdBack 保留跳过删除
String ancestors = user.getAncestors();
if (ancestors != null && Arrays.asList(ancestors.split(",")).contains(String.valueOf(proIdLease))) {
continue;
}
// 若以上条件均不满足 剔除该条数据
iterator.remove();
}else{
throw new RuntimeException("未找到所属工程");
}
}else if(forSysWorkflowNode.getNodeName().contains("所属施工管理科审核") && num==6){
//根据project_id获取external_id
String externalId = directAuditMapper.getExternalId(Integer.parseInt(directApplyInfo.getLeaseProId()));
if (externalId != null && !externalId.isEmpty()) {
userList.addAll(directAuditMapper.getUserIdByExternalId(externalId));
}else{
throw new RuntimeException("未找到所属工程");
}
}else{
int proIdBack = sysWorkflowConfigMapper.getImpUnit(directApplyInfo.getBackProId());
// 使用 Iterator 迭代器遍历支持安全删除元素
Iterator<SysUserRoleVo> iterator = userList.iterator();
while (iterator.hasNext()) {
SysUserRoleVo user = iterator.next();
// 条件1部门ID等于proIdBack 保留跳过删除
if (proIdBack == user.getDeptId()) {
continue;
}
// 条件2祖先ID列表包含proIdBack 保留跳过删除
String ancestors = user.getAncestors();
if (ancestors != null && Arrays.asList(ancestors.split(",")).contains(String.valueOf(proIdBack))) {
continue;
}
// 若以上条件均不满足 剔除该条数据
iterator.remove();
}
userList.addAll(bmUserRoleMapper.getUserListByDeptId(Long.valueOf(directApplyInfo.getDeptId()), Long.valueOf(forRoleId)));
}
//去重
Set<Long> seenUserIds = new HashSet<>();
userList.removeIf(info -> {
Long userId = info.getUserId();
return userId == null || !seenUserIds.add(userId); // 若userId已存在则移除当前元素
});
if (!userList.isEmpty()) {
// 如果不是第一次拼接先添加逗号分隔
if (roleConfigValues.length() > 0) {
roleConfigValues.append(",");
for(WorkPeopleInfo info:userList){
String userId = String.valueOf(info.getUserId());
if(!roleConfigValues.toString().contains(userId)){
// 如果不是第一次拼接先添加逗号分隔
roleConfigValues.append(info.getUserId());
roleConfigValues.append(",");
}
}
}
if(roleConfigValues.length() > 0){
// 去除结尾的逗号
if (roleConfigValues.charAt(roleConfigValues.length() - 1) == ',') {
roleConfigValues.deleteCharAt(roleConfigValues.length() - 1);
}
roleConfigValues.append(userList.stream().map(user -> String.valueOf(user.getUserId())).collect(Collectors.joining(",")));
}
}
forSysWorkflowNode.setConfigValues(roleConfigValues.toString());

View File

@ -167,7 +167,7 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
* 直转审批
*/
@Override
@Transactional(rollbackFor = Exception.class)
// @Transactional(rollbackFor = Exception.class)
public int updateDirectSysWorkflowRecordHistory(@NotNull(message = "审批方法参数不能为空") SysWorkflowRecordHistory sysWorkflowRecordHistory) {
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
Long userId = sysUser.getUserId();
@ -183,7 +183,7 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
Integer nextNodeId = sysWorkflowRecordHistory.getNextNodeId();
Integer nodeId = sysWorkflowRecordHistory.getNodeId();
sysWorkflowRecordHistory.setCreateBy(userId.toString());
sysWorkflowRecordHistoryMapper.addSysWorkflowRecordHistory(sysWorkflowRecordHistory);
// sysWorkflowRecordHistoryMapper.addSysWorkflowRecordHistory(sysWorkflowRecordHistory);
if (sysWorkflowRecordHistory.getIsAccept() == null) {
throw new ServiceException("请选择是否接受审批");
@ -365,33 +365,44 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
private void handleDirectApproval(List<SysWorkflowNode> sysWorkflowNodeList, SysWorkflowRecordHistory sysWorkflowRecordHistory,
SysUser sysUser, Integer taskId, String recordCode, Integer recordId, Integer nextNodeId, Integer nodeId) {
boolean found = false;
for (SysWorkflowNode sysWorkflowNode : sysWorkflowNodeList) {
Integer proId = null;
List<WorkPeopleInfo> userList = new ArrayList<>();
for (int i = 0; i < sysWorkflowNodeList.size(); i++) {
// 判断列表中哪个节点是当前审批的节点如果不是审批的节点不处理
if (sysWorkflowRecordHistory.getNodeId().equals(sysWorkflowNode.getId())) {
if (sysWorkflowRecordHistory.getNextNodeId().equals(sysWorkflowNodeList.get(i).getId())) {
log.info("-------------进入到了当前审批的节点-------------");
// 根据传入的节点信息去判断配置的是角色or用户 自动处理
sysWorkflowNodeService.copeNodeConfigPersonValuesByNode(sysWorkflowNode);
// sysWorkflowRecordHistoryMapper.addSysWorkflowRecordHistory(sysWorkflowRecordHistory);
// 增加节点code编码判断是否有节点审批限制
if (StringUtils.isNotBlank(sysWorkflowNode.getNodeRestrictCode())) {
if (StringUtils.isNotBlank(sysWorkflowNodeList.get(i).getNodeRestrictCode())) { //属于后三个审批流
log.info("-------------当前节点有审批限制,进行限制🚫-------------");
switch (sysWorkflowNode.getNodeRestrictCode()) {
switch (sysWorkflowNodeList.get(i).getNodeRestrictCode()) {
case "unit":
// 限制同一unit单位
// 根据任务类型 + 任务ID + 节点ID 去查询满足限制的用户然后更新configValues值
if (Objects.equals(sysWorkflowRecordHistory.getTaskTypeId(), TmTaskTypeEnum.TM_TASK_DIRECT.getTaskTypeId())) {
// 直转任务, 根据任务ID去查询当前任务的接收项目部有哪些人员
String thisUnitUserIds = sysWorkflowConfigMapper.selectUnitConfigValuesByTaskId(sysWorkflowRecordHistory.getTaskId());
String filterConfigValuesResult = filterStringByReference(sysWorkflowNode.getConfigValues(), thisUnitUserIds);
if (StringUtils.isBlank(filterConfigValuesResult)) {
throw new ServiceException("您不满足当前节点的审批限制🚫,无法进行此操作!!");
//获取转入接收方的agreementId
proId = sysWorkflowRecordHistoryMapper.getLeaseAgreementIdByTaskId(sysWorkflowRecordHistory);
int deptId = directAuditMapper.getImpUnit(String.valueOf(proId));
DirectApplyInfo directApplyInfo = new DirectApplyInfo();
directApplyInfo.setLeaseProId(String.valueOf(proId));
directApplyInfo.setDeptId(deptId);
//插入history表中
SysWorkflowRecordHistory history = sysWorkflowRecordHistory;
history.setNodeId(sysWorkflowRecordHistory.getNextNodeId());
if(i!=sysWorkflowNodeList.size()-1){
history.setNextNodeId(sysWorkflowNodeList.get(i+1).getId());
sysWorkflowNodeList.get(i).setNextNodeId(sysWorkflowNodeList.get(i+1).getId());
sysWorkflowNodeList.get(i).setNextRoleIds(sysWorkflowNodeList.get(i+1).getRoleIds());
}else{
history.setNextNodeId(null);
sysWorkflowNodeList.get(i).setNextNodeId(null);
sysWorkflowNodeList.get(i).setNextRoleIds(null);
}
sysWorkflowNode.setConfigValues(filterConfigValuesResult);
} else {
System.err.println("非直转任务限制同一单位,系统暂不支持!!!" + sysWorkflowRecordHistory.getTypeId());
throw new ServiceException("非直转任务限制同一单位,系统暂不支持此配置,请联系管理员");
}
sysWorkflowNodeService.copeNodeConfigPersonValuesByNodeTwo(sysWorkflowNodeList.get(i), directApplyInfo,userList,sysWorkflowNodeList.size());
sysWorkflowRecordHistory.setDirectUserIds(sysWorkflowNodeList.get(i).getConfigValues());
history.setDirectUserIds(sysWorkflowNodeList.get(i).getConfigValues());
sysWorkflowRecordHistoryMapper.addSysWorkflowRecordHistory(history);
break;
case "project":
// 限制工程暂无相关需求暂定
@ -402,10 +413,34 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
default:
throw new ServiceException("当前节点有审批限制code却是非法字符请联系管理员");
}
}else{//属于前三个审批流
proId = sysWorkflowRecordHistoryMapper.getBackAgreementIdByTaskId(sysWorkflowRecordHistory);
int deptId = directAuditMapper.getImpUnit(String.valueOf(proId));
DirectApplyInfo directApplyInfo = new DirectApplyInfo();
directApplyInfo.setBackProId(String.valueOf(proId));
directApplyInfo.setDeptId(deptId);
//插入history表中
SysWorkflowRecordHistory history = sysWorkflowRecordHistory;
history.setNodeId(sysWorkflowRecordHistory.getNextNodeId());
if(i!=sysWorkflowNodeList.size()-1){
history.setNextNodeId(sysWorkflowNodeList.get(i+1).getId());
sysWorkflowNodeList.get(i).setNextNodeId(sysWorkflowNodeList.get(i+1).getId());
sysWorkflowNodeList.get(i).setNextRoleIds(sysWorkflowNodeList.get(i+1).getRoleIds());
}else{
history.setNextNodeId(null);
sysWorkflowNodeList.get(i).setNextNodeId(null);
sysWorkflowNodeList.get(i).setNextRoleIds(null);
}
sysWorkflowNodeService.copeNodeConfigPersonValuesByNodeTwo(sysWorkflowNodeList.get(i), directApplyInfo,userList,sysWorkflowNodeList.size());
sysWorkflowRecordHistory.setDirectUserIds(sysWorkflowNodeList.get(i).getConfigValues());
history.setDirectUserIds(sysWorkflowNodeList.get(i).getConfigValues());
sysWorkflowRecordHistoryMapper.addSysWorkflowRecordHistory(history);
}
//获取当前node的directUserIds
String userIdsNow = sysWorkflowRecordHistoryMapper.getNowUserIds(sysWorkflowRecordHistory);
// 判断当前用户是否是当前节点的配置用户
if (sysWorkflowNode.getConfigValues().contains(sysUser.getUserId().toString())) {
if (userIdsNow.contains(sysUser.getUserId().toString())) {
log.info("-------------✅通过校验,当前用户是该节点审批人员,进行更新任务信息-------------");
// 根据任务ID 更新审批流状态
updateWorkflowStatus(taskId, 1);
@ -414,8 +449,11 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
found = true;
break;
} else {
//删除新增节点
sysWorkflowRecordHistoryMapper.deleteNowNode(sysWorkflowRecordHistory);
throw new ServiceException("您不是当前节点配置的审批人员,无法进行操作!!");
}
}
}
@ -430,10 +468,8 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
updateWorkOrder(recordId, sysUser.getUserName());
// 如果下个节点存在的话那么就创建下个节点的工单信息
if (nextNodeId != null) {
//获取leaseAgreementId
int leaseAgreementId = sysWorkflowRecordMapper.selectLeaseAgreementIdByRecordId(taskId);
createWorkOrderAndPeopleDirect(sysUser,leaseAgreementId, taskId, recordCode, recordId, nodeId);
if (nextNodeId != null && proId != null) {
createWorkOrderAndPeopleDirect(sysUser,proId, taskId, recordCode, recordId, nextNodeId,userList);
}else{
//以下走退料领料方法
SltAgreementInfo sltAgreementInfo = new SltAgreementInfo();
@ -802,10 +838,9 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
}
}
private void createWorkOrderAndPeopleDirect(SysUser sysUser, int leaseAgreementId, int taskId,String taskCode, int newId,int nodeId) {
private void createWorkOrderAndPeopleDirect(SysUser sysUser, int proId, int taskId,String taskCode, int newId,int nodeId,List<WorkPeopleInfo> userList) {
//获取工程名称
int projectId = directAuditMapper.getProjectIdById(leaseAgreementId);
String projectName = directAuditMapper.getProjectNameById(projectId);
String projectName = directAuditMapper.getProjectNameById(proId);
String id = UUID.randomUUID().toString().replace("-", "");
String webUrlBase = "/mea-h5/#/pages/businessAudit/directAudit/details";
String queryParams = UriComponentsBuilder.newInstance()
@ -832,40 +867,16 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
int countWork = directAuditMapper.insertWorkOrder(workApplyInfo);
if (countWork > 0) {
//查询审批人集合
WorkPeopleInfo info = new WorkPeopleInfo();
info.setFlowId(newId);
List<WorkPeopleInfo> workPeopleInfoList = directAuditMapper.selectWorkPeopleInfoList(info.getFlowId());
// 过滤掉nextNodeId为null的数据
if (workPeopleInfoList != null) {
workPeopleInfoList = workPeopleInfoList.stream()
.filter(person -> person.getNextNodeId() != null) // 过滤条件nextNodeId不为null
.collect(Collectors.toList());
}
if(workPeopleInfoList != null && workPeopleInfoList.size() > 0){
WorkPeopleInfo person = workPeopleInfoList.get(0);
String roleIds = person.getRoleIds();
String[] roleIdArray = roleIds.split(",");
long deptId = sysUser.getDeptId();
//根据角色和部门查询用户集合
WorkPeopleInfo param = new WorkPeopleInfo();
param.setRoleIdArray(roleIdArray);
param.setDeptId(deptId);
List<WorkPeopleInfo> userList = directAuditMapper.selectUserListByRoleAndDept(param);
for (WorkPeopleInfo user : userList) {
WorkPeopleInfo workPeopleInfo = new WorkPeopleInfo();
workPeopleInfo.setId(UUID.randomUUID().toString().replace("-", ""));
workPeopleInfo.setInformationId(id);
workPeopleInfo.setReceiverUsername(user.getReceiverUsername());
workPeopleInfo.setReceiverUsername(user.getUserName());
workPeopleInfo.setReadState(0);
workPeopleInfo.setHandleState(0);
workPeopleInfo.setIsExamine(0);
directAuditMapper.insertWorkPeople(workPeopleInfo);
}
}
}
}

View File

@ -18,4 +18,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sys_role sr ON sur.role_id = sr.role_id
WHERE su.dept_id = #{deptId} AND sr.role_id = #{roleId}
</select>
<select id="getUserListByDeptId" resultType="com.bonus.common.biz.domain.lease.WorkPeopleInfo">
SELECT
su.user_id as userId, su.user_name as userName
FROM
sys_user su
LEFT JOIN
sys_user_role sur ON su.user_id = sur.user_id
LEFT JOIN
sys_dept sd ON su.dept_id = sd.dept_id
LEFT JOIN
sys_role sr ON sur.role_id = sr.role_id
WHERE (su.dept_id = #{deptId} or CONCAT(',', sd.ancestors, ',') LIKE CONCAT('%,', #{deptId}, ',%')) AND sr.role_id = #{roleId}
</select>
</mapper>

View File

@ -202,6 +202,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBackApplyInfoList" resultType="com.bonus.material.clz.domain.back.MaterialBackApplyInfo">
SELECT
sd.dept_name AS impUnitName,
bp.pro_center AS departName,
bai.id as id,
bai.task_id as taskId,
bai.`code` as code,
@ -239,8 +241,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND bt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt1.type_id = bad.type_id AND mt1.del_flag = '0'
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id AND mt2.del_flag = '0'
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
1=1
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="departName != null and departName != ''">
and bp.pro_center LIKE CONCAT('%', #{departName}, '%')
</if>
<if test="teamName != null and teamName != ''">
and bt.unit_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="proName != null and proName != ''">
and bp.pro_name LIKE CONCAT('%', #{proName}, '%')
</if>
<if test="keyWord != null and keyWord != ''">
and (
bai.`code` like concat('%', #{keyWord}, '%') or
bai.back_person like concat('%', #{keyWord}, '%') or
bai.create_by like concat('%', #{keyWord}, '%') or
bp.pro_name like concat('%', #{keyWord}, '%') or
bai.phone like concat('%', #{keyWord}, '%')
)
</if>
<if test="teamId != null and teamId != ''">
and bt.id = #{teamId}
</if>
@ -274,6 +298,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getTotalList" resultType="com.bonus.material.clz.domain.back.MaterialBackApplyInfo">
SELECT
sd.dept_name AS impUnitName,
bai.id as id,
bai.task_id as taskId,
bai.`code` as code,
@ -309,8 +334,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND bu.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt1.type_id = bad.type_id AND mt1.del_flag = '0'
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id AND mt2.del_flag = '0'
left join sys_dept sd on sd.dept_id = bp.imp_unit
WHERE
1=1
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="backPerson != null and backPerson != ''">
and bai.back_person LIKE CONCAT('%', #{backPerson}, '%')
</if>
<if test="code != null and code != ''">
and bai.code LIKE CONCAT('%', #{code}, '%')
</if>
<if test="unitName != null and unitName != ''">
and bu.unit_name LIKE CONCAT('%', #{unitName}, '%')
</if>
<if test="proName != null and proName != ''">
and bp.pro_name LIKE CONCAT('%', #{proName}, '%')
</if>
<if test="unitId != null">
and bu.unit_id = #{unitId}
</if>
@ -558,7 +599,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="getBackInfoDetails" resultType="com.bonus.material.clz.domain.back.MaterialBackApplyTotalInfo">
SELECT
select
sd.dept_name AS impUnitName,
bp.pro_center AS departName,
bcd.id AS id,
bcd.parent_id AS parentId,
mt.type_id AS typeId,
@ -590,9 +633,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_project bp ON bp.pro_id = bagi.project_id
AND bp.del_flag = '0'
LEFT JOIN bm_unit bt ON bt.unit_id = bagi.unit_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
AND bt.del_flag = '0'
WHERE
bcd.is_finished = 1
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="departName != null and departName != ''">
and bp.pro_center LIKE CONCAT('%', #{departName}, '%')
</if>
<if test="teamName != null and teamName != ''">
and bt.unit_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[and DATE_FORMAT( bcd.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
@ -605,8 +658,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="keyWord != null and keyWord != ''">
and (
mt2.type_name like concat('%', #{keyWord}, '%') or
mt.type_name like concat('%', #{keyWord}, '%') or
bt.unit_name like concat('%', #{keyWord}, '%') or
bp.pro_name like concat('%', #{keyWord}, '%') or
bai.back_person like concat('%', #{keyWord}, '%') or
bai.create_by like concat('%', #{keyWord}, '%') or

View File

@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectLeaseApplyInfoVo">
select
bp.pro_center AS departName,
lai.id, lai.code, lai.task_id, lai.lease_person, lai.phone, lai.type, lai.company_audit_by,
lai.company_audit_time, lai.company_audit_remark, lai.dept_audit_by, lai.dept_audit_time,
lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark,
@ -388,6 +389,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectLeaseApplyInfoList" parameterType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo" resultMap="LeaseApplyInfoResult">
<include refid="selectLeaseApplyInfoVo"/>
<where>
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="departName != null and departName != ''">
and bp.pro_center LIKE CONCAT('%', #{departName}, '%')
</if>
<if test="teamName != null and teamName != ''">
and bt.unit_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="keyWord != null and keyWord != ''">
and (
lai.create_by like concat('%',#{keyWord},'%') or
bp.pro_name like concat('%',#{keyWord},'%') or
lai.lease_person like concat('%',#{keyWord},'%')
)
</if>
<if test="taskStatus != null"> and tt.task_status = #{taskStatus}</if>
<if test="code != null and code != ''"> and lai.code = #{code}</if>
<if test="taskId != null "> and lai.task_id = #{taskId}</if>
@ -420,6 +437,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getTotalList" resultType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo">
select
sd.dept_name as impUnitName,
lai.id, lai.code as code, lai.lease_person as leasePerson,
lai.create_by, lai.create_time as leaseTime, lai.update_by, lai.update_time, lai.remark, lai.company_id,
lai.lease_sign_url as leaseSignUrl, lai.lease_sign_type as leaseSignType,
@ -449,7 +467,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">
JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId}
</if>
<where>
where
1=1
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="leasePerson != null and leasePerson != ''">
and lai.lease_person LIKE CONCAT('%', #{leasePerson}, '%')
</if>
<if test="code != null and code != ''">
and lai.code LIKE CONCAT('%', #{code}, '%')
</if>
<if test="leaseUnit != null and leaseUnit != ''">
and bu.unit_name LIKE CONCAT('%', #{leaseUnit}, '%')
</if>
<if test="leaseProject != null and leaseProject != ''">
and bp.pro_name LIKE CONCAT('%', #{leaseProject}, '%')
</if>
<if test="statusList != null and statusList.size() > 0">
and tt.task_status in
<foreach item="item" collection="statusList" open="(" separator="," close=")">
@ -466,7 +500,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<![CDATA[ AND DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
and tt.task_type = '2'
</where>
GROUP BY lai.id
ORDER BY tt.create_time desc
</select>
@ -791,6 +825,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getLeaseInfoDetails" resultType="com.bonus.material.clz.domain.vo.lease.LeaseTotalInfo">
SELECT
sd.dept_name AS impUnitName,
bp.pro_center AS departName,
lod.id AS id,
lod.parent_id AS parentId,
mt.type_id AS typeId,
@ -822,8 +858,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_unit bt on lai.team_id = bt.unit_id
LEFT JOIN bm_project bp ON lai.project_id = bp.pro_id
LEFT JOIN sys_user su on su.user_id=lod.create_by
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
lod.is_finished = '1'
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="departName != null and departName != ''">
and bp.pro_center LIKE CONCAT('%', #{departName}, '%')
</if>
<if test="teamName != null and teamName != ''">
and bt.unit_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[and DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
@ -836,11 +882,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="keyWord != null and keyWord != ''">
and (
mt2.type_name like concat('%', #{keyWord}, '%') or
mt.type_name like concat('%', #{keyWord}, '%') or
lai.`code` like concat('%', #{keyWord}, '%') or
lai.lease_person like concat('%', #{keyWord}, '%') or
lod.create_by like concat('%', #{keyWord}, '%') or
bt.unit_name like concat('%', #{keyWord}, '%') or
su.nick_name like concat('%', #{keyWord}, '%') or
bp.pro_name like concat('%', #{keyWord}, '%')
)
</if>
@ -1029,6 +1073,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPublishList" resultType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo">
SELECT
sd.dept_name as impUnitName,
lai.id AS id,
lai.code AS code,
lai.create_by AS createBy,
@ -1073,6 +1118,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
JOIN ma_type_keeper mtk ON mtk.type_id = lpd.type_id AND mtk.user_id = #{userId}
</if>
where 1 = 1
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="leasePerson != null and leasePerson != ''">
and lpd.lease_person LIKE CONCAT('%', #{leasePerson}, '%')
</if>
<if test="code != null and code != ''">
and lai.code LIKE CONCAT('%', #{code}, '%')
</if>
<if test="leaseUnit != null and leaseUnit != ''">
and bu.unit_name LIKE CONCAT('%', #{leaseUnit}, '%')
</if>
<if test="leaseProject != null and leaseProject != ''">
and bp.pro_name LIKE CONCAT('%', #{leaseProject}, '%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>

View File

@ -5,6 +5,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.bonus.material.clz.mapper.MaterialMachineMapper">
<select id="getMachineInfo" resultType="com.bonus.material.ma.domain.Machine">
SELECT
sd.dept_name AS impUnitName,
bu.unit_name as leaseUnit,
bp.pro_name as leaseProject,
bp.pro_center AS departName,
mt3.type_name AS materialName,
mt2.type_name AS typeName,
mt1.type_name AS typeCode,
@ -31,7 +35,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
left join sys_dept sd on sd.dept_id = bp.imp_unit
WHERE sai.`status` = '0' and mm.ma_code is not NULL
<if test="keyWord != null and keyWord != ''">
and (
mt2.type_name like concat('%',#{keyWord},'%') or
mm.inspect_man like concat('%',#{keyWord},'%') or
mm.ma_code like concat('%',#{keyWord},'%')
)
</if>
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name like concat('%', #{impUnitName}, '%')
</if>
<if test="departName != null and departName != ''">
and bp.pro_center like concat('%', #{departName}, '%')
</if>
<if test="typeCode != null and typeCode != ''">
and mt1.type_name like concat('%', #{typeCode}, '%')
</if>
@ -41,6 +59,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="impUnit != null and impUnit != ''">
and bp.imp_unit = #{impUnit}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[and DATE_FORMAT( mm.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
<if test="checkStartTime != null and checkStartTime != '' and checkEndTime != null and checkEndTime != ''">
<![CDATA[and DATE_FORMAT( mm.this_check_time, '%Y-%m-%d' ) BETWEEN #{checkStartTime} AND #{checkEndTime} ]]>
</if>
<if test="nextStartTime != null and nextStartTime != '' and nextEndTime != null and nextEndTime != ''">
<![CDATA[and DATE_FORMAT( mm.next_check_time, '%Y-%m-%d' ) BETWEEN #{nextStartTime} AND #{nextEndTime} ]]>
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
and bp.external_id in
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
@ -709,6 +736,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT * FROM (
-- 原查询包含status计算
SELECT
sd.dept_name as impUnitName,
bp.pro_center AS departName,
mt3.type_name as materialName,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
sai.ma_id AS maId,
@ -732,14 +762,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
LEFT JOIN clz_slt_agreement_info csi ON mm.ma_id = csi.ma_id
LEFT JOIN clz_bm_agreement_info cba ON csi.agreement_id = cba.agreement_id
LEFT JOIN bm_unit bu ON cba.unit_id = bu.unit_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
sai.`status` = '0'
AND mt.jiju_type = 2
AND sai.ma_id IS NOT NULL
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="departName != null and departName != ''">
and bp.pro_center LIKE CONCAT('%', #{departName}, '%')
</if>
<if test="proName != null and proName != ''">
and bp.pro_name LIKE CONCAT('%', #{proName}, '%')
</if>
<if test="materialName != null and materialName != ''">
and mt3.type_name LIKE CONCAT('%', #{materialName}, '%')
</if>
<if test="teamName != null and teamName != ''">
and bu.unit_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( mm.this_check_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
<if test="agreementIdList != null and agreementIdList.size >0">
AND sai.agreement_id IN
<foreach item="item" collection="agreementIdList" open="(" separator="," close=")">
@ -777,17 +827,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getTeamNumList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo">
SELECT
sd.dept_name AS impUnitName,
bp.pro_center AS departName,
bu.unit_id as teamId,
bu.unit_name as teamName,
bu.link_man as teamLeaderIdCard,
SUM( sai.num ) as usNum,
bu.bzz_idcard as idCard,
bp.imp_unit as impUnit
bp.imp_unit as impUnit,
bp.pro_name as proName
FROM
bm_unit bu
LEFT JOIN clz_bm_agreement_info bai ON bu.unit_id = bai.unit_id
LEFT JOIN clz_slt_agreement_info sai ON bai.agreement_id = sai.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
sai.`status` = 0 and bu.type_id = 1731
<if test="keyWord != null and keyWord != ''">
@ -796,6 +850,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bu.link_man like concat('%',#{keyWord},'%')
)
</if>
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="departName != null and departName != ''">
and bp.pro_center LIKE CONCAT('%', #{departName}, '%')
</if>
<if test="proName != null and proName != ''">
and bp.pro_name LIKE CONCAT('%', #{proName}, '%')
</if>
<if test="teamName != null and teamName != ''">
and bu.unit_name LIKE CONCAT('%', #{teamName}, '%')
</if>
GROUP BY
bu.unit_id
</select>
@ -1341,22 +1407,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND bu.unit_name is not null
AND bp.external_id is not NULL
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name = #{impUnitName}
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="proName != null and proName != ''">
AND bp.pro_name = #{proName}
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
</if>
<if test="departName != null and departName != ''">
AND bp.pro_center = #{departName}
AND bp.pro_center LIKE CONCAT('%', #{departName}, '%')
</if>
<if test="teamName != null and teamName != ''">
AND bu.unit_name = #{teamName}
AND bu.unit_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="typeName != null and typeName != ''">
AND mt2.type_name = #{typeName}
AND mt2.type_name LIKE CONCAT('%', #{typeName}, '%')
</if>
<if test="typeModelName != null and typeModelName != ''">
AND mt.type_name = #{typeModelName}
AND mt.type_name LIKE CONCAT('%', #{typeModelName}, '%')
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
and bp.external_id in

View File

@ -403,9 +403,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where
lod.num >0 and lod.lease_sign_id is not null and bp.external_id is not null
and tt.task_type = 2
<if test="code != null and code != ''"> and lai.code = #{code}</if>
<if test="code != null and code != ''"> and lai.code LIKE CONCAT('%', #{code}, '%')</if>
<if test="taskId != null "> and lai.task_id = #{taskId}</if>
<if test="leasePerson != null and leasePerson != ''"> and lai.lease_person = #{leasePerson}</if>
<if test="leasePerson != null and leasePerson != ''"> and lai.lease_person LIKE CONCAT('%', #{leasePerson}, '%')</if>
<if test="impUnitName != null and impUnitName != ''"> and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')</if>
<if test="unitName != null and unitName != ''">
and bu.unit_name LIKE CONCAT('%', #{unitName}, '%')
</if>
<if test="projectName != null and projectName != ''">
and bp.pro_name LIKE CONCAT('%', #{projectName}, '%')
</if>
<if test="phone != null and phone != ''"> and lai.phone = #{phone}</if>
<if test="type != null and type != ''"> and lai.type = #{type}</if>
<if test="companyAuditBy != null "> and lai.company_audit_by = #{companyAuditBy}</if>
@ -751,6 +758,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_user su on lpd.create_by = su.user_id
where
lod.lease_sign_id is not null and bp.external_id is not null and tt.task_type = '19'
<if test="leasePerson != null and leasePerson != ''"> and lpd.lease_person LIKE CONCAT('%', #{leasePerson}, '%')</if>
<if test="impUnitName != null and impUnitName != ''"> and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')</if>
<if test="unitName != null and unitName != ''">
and bu.unit_name LIKE CONCAT('%', #{unitName}, '%')
</if>
<if test="projectName != null and projectName != ''">
and bp.pro_name LIKE CONCAT('%', #{projectName}, '%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( lpd.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>

View File

@ -28,7 +28,9 @@
swrs.node_id AS nodeId,
swrs.next_node_id AS nextNodeId,
swrs.record_id AS recordId,
swn.node_sign_type as nodeSignType
swn.node_sign_type as nodeSignType,
swrs.direct_user as directUserIds,
swrs.direct_user as configValue
FROM
direct_apply_info dai
LEFT JOIN bm_agreement_info bai ON dai.back_agreement_id = bai.agreement_id
@ -156,6 +158,50 @@
<!-- </if>-->
</select>
<select id="getExternalId" resultType="java.lang.String">
select
external_id as externalId
from
bm_project
where
pro_id = #{projectId}
</select>
<select id="getLeaderId" resultType="java.lang.String">
select
project_engineer_id as leaderId
from
data_center.dx_fb_son
where
id = #{externalId}
</select>
<select id="getUserNameById" resultType="java.lang.String">
select
account as userName
from
data_center.dc_user
where
id = #{leaderId}
</select>
<select id="getUserIdByUserName" resultType="com.bonus.common.biz.domain.lease.WorkPeopleInfo">
select
user_id as userId,
user_name as userName
from
sys_user
where user_name = #{userName}
</select>
<select id="getUserIdByExternalId" resultType="com.bonus.common.biz.domain.lease.WorkPeopleInfo">
SELECT
su.user_id as userId,
sgp.cno as userName
FROM
sys_user su
LEFT JOIN `sbd_audit`.sg_project_post_personnel sgp on sgp.cno = su.user_name
LEFT JOIN `data_center`.dx_fb_son dfs on sgp.depart_id = dfs.project_dept_id
WHERE sgp.post_id = '3de0eb390f3611efa1940242ac130004'
and dfs.id = #{externalId}
</select>
<update id="updateWorkflowRecord">
update sys_workflow_record set workflow_status = #{flowStatus} where id = #{id}
@ -230,4 +276,8 @@
<if test="isExamine != null">#{isExamine},</if>
</trim>
</insert>
<delete id="deleteWorkflowRecord">
delete from sys_workflow_record where id = #{newId}
</delete>
</mapper>

View File

@ -65,4 +65,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where
pro_id = #{proId}
</select>
<select id="getUserIdByUserName" resultType="com.bonus.material.basic.domain.dto.SysUserRoleVo">
select
user_id as userId,
user_name as userName
from
sys_user
where
user_name = #{userName}
</select>
</mapper>

View File

@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by,</if>
create_time,
<if test="remark != null">remark,</if>
<if test="directUserIds != null">direct_user,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null">#{recordId},</if>
@ -24,6 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">#{createBy},</if>
now(),
<if test="remark != null">#{remark},</if>
<if test="directUserIds != null">#{directUserIds},</if>
</trim>
</insert>
<select id="seleteSysWorkflowRecordHistory" resultType="com.bonus.material.work.domain.SysWorkflowRecordHistory">
@ -66,4 +68,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE swrh.record_id = #{recordId} and swrh.node_id = #{nodeId} and swrh.next_node_id = #{nextNodeId}
limit 1
</select>
<select id="getDirectUserIdsByTaskId" resultType="java.lang.String">
select
direct_user as directUserIds
from sys_workflow_record_history
where record_id = #{record} and next_node_id = #{nodeId} limit 1
</select>
<select id="getLeaseAgreementIdByTaskId" resultType="java.lang.Integer">
select
bai.project_id as proId
from direct_apply_info dai
left join bm_agreement_info bai ON dai.lease_agreement_id = bai.agreement_id
where id = #{taskId}
</select>
<select id="getBackAgreementIdByTaskId" resultType="java.lang.Integer">
select
bai.project_id as proId
from direct_apply_info dai
left join bm_agreement_info bai ON dai.back_agreement_id = bai.agreement_id
where id = #{taskId}
</select>
<select id="getNowUserIds" resultType="java.lang.String">
select
direct_user as directUserIds
from sys_workflow_record_history
where record_id = #{recordId} and next_node_id = #{nodeId}
</select>
<delete id="deleteNowNode">
delete from sys_workflow_record_history where record_id = #{recordId} and node_id = #{nodeId}
</delete>
</mapper>