项目部退料及直转优化
This commit is contained in:
parent
86be0b78d0
commit
70fd7ac0cc
|
|
@ -561,4 +561,11 @@ public interface BackApplyInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
List<BackExportDetailsVo> exportBackDetailsList(BackApplyInfo dto);
|
||||
|
||||
/**
|
||||
* 修改材料站结算表在用
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
int updateClzInfo(SltAgreementInfo info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1212,104 +1212,110 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult submitBackApply(@NotNull(message = "参数不能为空") BackApplyInfo backApplyInfo) {
|
||||
if (backApplyInfo.getUnitId() == null || backApplyInfo.getProId() == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "参数不能为空");
|
||||
}
|
||||
List<BackApplyInfo> codeList = new ArrayList<>();
|
||||
// 根据传入的id查询退料申请信息
|
||||
List<BackApplyInfo> applyInfoList = backApplyInfoMapper.selectBackDetails(backApplyInfo);
|
||||
// 将applyInfoList中状态不为在用的数据收集到新集合中
|
||||
if (CollectionUtils.isNotEmpty(applyInfoList)) {
|
||||
for (BackApplyInfo applyInfo : applyInfoList) {
|
||||
if (StringUtils.isNotBlank(applyInfo.getMaStatus())) {
|
||||
if (!"2".equals(applyInfo.getMaStatus())) {
|
||||
codeList.add(applyInfo);
|
||||
try {
|
||||
BmUnit unit = taskMapper.selectBmUnitInfo(backApplyInfo);
|
||||
if (backApplyInfo.getUnitId() == null || backApplyInfo.getProId() == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "参数不能为空");
|
||||
}
|
||||
List<BackApplyInfo> codeList = new ArrayList<>();
|
||||
// 根据传入的id查询退料申请信息
|
||||
List<BackApplyInfo> applyInfoList = backApplyInfoMapper.selectBackDetails(backApplyInfo);
|
||||
// 将applyInfoList中状态不为在用的数据收集到新集合中
|
||||
if (CollectionUtils.isNotEmpty(applyInfoList)) {
|
||||
for (BackApplyInfo applyInfo : applyInfoList) {
|
||||
if (StringUtils.isNotBlank(applyInfo.getMaStatus())) {
|
||||
if (!"2".equals(applyInfo.getMaStatus())) {
|
||||
codeList.add(applyInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(codeList)) {
|
||||
StringBuilder msgBuilder = new StringBuilder("您所选择的编码设备编号");
|
||||
for (int i = 0; i < codeList.size(); i++) {
|
||||
String maCode = codeList.get(i).getMaCode();
|
||||
msgBuilder.append(maCode);
|
||||
if (i < codeList.size() - 1) {
|
||||
msgBuilder.append(", ");
|
||||
if (CollectionUtils.isNotEmpty(codeList)) {
|
||||
StringBuilder msgBuilder = new StringBuilder("您所选择的编码设备编号");
|
||||
for (int i = 0; i < codeList.size(); i++) {
|
||||
String maCode = codeList.get(i).getMaCode();
|
||||
msgBuilder.append(maCode);
|
||||
if (i < codeList.size() - 1) {
|
||||
msgBuilder.append(", ");
|
||||
}
|
||||
}
|
||||
msgBuilder.append("已被他人完成退料,请编辑后重新提交!");
|
||||
String msg = msgBuilder.toString();
|
||||
msg = msg.replaceAll("\n", "");
|
||||
return AjaxResult.error(msg);
|
||||
}
|
||||
msgBuilder.append("已被他人完成退料,请编辑后重新提交!");
|
||||
String msg = msgBuilder.toString();
|
||||
msg = msg.replaceAll("\n", "");
|
||||
return AjaxResult.error(msg);
|
||||
}
|
||||
int result = 0;
|
||||
//先查询退料详情信息
|
||||
List<BackApplyDetails> applyDetails = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(backApplyInfo);
|
||||
// 根据id查询协议id
|
||||
Long agreementId = backApplyInfoMapper.selectAgreementId(backApplyInfo);
|
||||
// 先查第四层类型
|
||||
backApplyInfo.setAgreementId(agreementId);
|
||||
List<TypeTreeNode> listL4 = mapper.getUseTypeTreeL4(backApplyInfo);
|
||||
if (CollectionUtils.isNotEmpty(applyDetails)) {
|
||||
for (BackApplyDetails applyDetail : applyDetails) {
|
||||
if (CollectionUtils.isNotEmpty(listL4)) {
|
||||
for (TypeTreeNode typeTreeNode : listL4) {
|
||||
if(applyDetail.getTypeId()!=null){
|
||||
if (applyDetail.getTypeId().equals(typeTreeNode.getTypeId())) {
|
||||
if (applyDetail.getPreNum().compareTo(typeTreeNode.getNum()) > 0) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "退料数量不能大于在用数量");
|
||||
int result = 0;
|
||||
//先查询退料详情信息
|
||||
List<BackApplyDetails> applyDetails = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(backApplyInfo);
|
||||
// 根据id查询协议id
|
||||
Long agreementId = backApplyInfoMapper.selectAgreementId(backApplyInfo);
|
||||
// 先查第四层类型
|
||||
backApplyInfo.setAgreementId(agreementId);
|
||||
List<TypeTreeNode> listL4 = mapper.getUseTypeTreeL4(backApplyInfo);
|
||||
if (CollectionUtils.isNotEmpty(applyDetails)) {
|
||||
for (BackApplyDetails applyDetail : applyDetails) {
|
||||
if (CollectionUtils.isNotEmpty(listL4)) {
|
||||
for (TypeTreeNode typeTreeNode : listL4) {
|
||||
if(applyDetail.getTypeId()!=null){
|
||||
if (applyDetail.getTypeId().equals(typeTreeNode.getTypeId())) {
|
||||
if (applyDetail.getPreNum().compareTo(typeTreeNode.getNum()) > 0) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "退料数量不能大于在用数量");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error("退料物资为空,无法进行提交");
|
||||
}
|
||||
// 设置更新信息,
|
||||
backApplyInfo.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
backApplyInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
backApplyInfo.setTaskStatus(BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus());
|
||||
// 更新任务表及退料申请表状态
|
||||
result += updateTaskAndBackInfo(backApplyInfo);
|
||||
if (result > 0 && CollectionUtils.isNotEmpty(applyInfoList)) {
|
||||
for (BackApplyInfo applyInfo : applyInfoList) {
|
||||
result += machineMapper.updateStatus(applyInfo.getMaId(), MaMachineStatusEnum.BACK_REPAIR.getStatus());
|
||||
}
|
||||
// 获取applyInfoList的typeId并生成集合
|
||||
List<String> typeIdList = applyInfoList.stream()
|
||||
.map(BackApplyInfo::getTypeId).distinct()
|
||||
.collect(Collectors.toList());
|
||||
// 插入任务表
|
||||
Long newTaskId = insertTt(SecurityUtils.getLoginUser().getSysUser().getNickName(), backApplyInfo.getRemark(), backApplyInfo.getTaskId());
|
||||
// 插入协议任务表
|
||||
result += insertTta(newTaskId, applyInfoList);
|
||||
for (String typeId : typeIdList) {
|
||||
// 查询待维修的机具设备
|
||||
backApplyInfo.setTypeId(typeId);
|
||||
List<BackApplyInfo> wxList = backApplyInfoMapper.getWxList(backApplyInfo);
|
||||
if (CollectionUtils.isNotEmpty(wxList)) {
|
||||
// 插入维修记录表
|
||||
result += insertRad(newTaskId, wxList);
|
||||
// 更新结算表
|
||||
List<BackApplyInfo> allList = backApplyInfoMapper.selectBackDetails(backApplyInfo);
|
||||
if (CollectionUtils.isNotEmpty(allList)) {
|
||||
int res = updateSlt4Bean(backApplyInfo, allList);
|
||||
// 检查机具是否领料
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("该机具未被领料使用");
|
||||
}
|
||||
}
|
||||
// 完成退料部分,更新 back_check_details
|
||||
finishBackCheckDetails(backApplyInfo);
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error("退料物资为空,无法进行提交");
|
||||
}
|
||||
// 设置更新信息,
|
||||
backApplyInfo.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
backApplyInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
backApplyInfo.setTaskStatus(BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus());
|
||||
// 更新任务表及退料申请表状态
|
||||
result += updateTaskAndBackInfo(backApplyInfo);
|
||||
if (result > 0 && CollectionUtils.isNotEmpty(applyInfoList)) {
|
||||
for (BackApplyInfo applyInfo : applyInfoList) {
|
||||
result += machineMapper.updateStatus(applyInfo.getMaId(), MaMachineStatusEnum.BACK_REPAIR.getStatus());
|
||||
}
|
||||
// 获取applyInfoList的typeId并生成集合
|
||||
List<String> typeIdList = applyInfoList.stream()
|
||||
.map(BackApplyInfo::getTypeId).distinct()
|
||||
.collect(Collectors.toList());
|
||||
// 插入任务表
|
||||
Long newTaskId = insertTt(SecurityUtils.getLoginUser().getSysUser().getNickName(), backApplyInfo.getRemark(), backApplyInfo.getTaskId());
|
||||
// 插入协议任务表
|
||||
result += insertTta(newTaskId, applyInfoList);
|
||||
for (String typeId : typeIdList) {
|
||||
// 查询待维修的机具设备
|
||||
backApplyInfo.setTypeId(typeId);
|
||||
List<BackApplyInfo> wxList = backApplyInfoMapper.getWxList(backApplyInfo);
|
||||
if (CollectionUtils.isNotEmpty(wxList)) {
|
||||
// 插入维修记录表
|
||||
result += insertRad(newTaskId, wxList);
|
||||
// 更新结算表
|
||||
List<BackApplyInfo> allList = backApplyInfoMapper.selectBackDetails(backApplyInfo);
|
||||
if (CollectionUtils.isNotEmpty(allList)) {
|
||||
int res = updateSlt4Bean(backApplyInfo, allList, unit);
|
||||
// 检查机具是否领料
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("该机具未被领料使用");
|
||||
}
|
||||
}
|
||||
// 完成退料部分,更新 back_check_details
|
||||
finishBackCheckDetails(backApplyInfo);
|
||||
}
|
||||
}
|
||||
// 如果所有操作都成功
|
||||
if (result > 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
// 如果所有操作都成功
|
||||
if (result > 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
log.error("退料提交异常:{}", e.getMessage());
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
// 操作失败,返回错误
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
|
|
@ -2799,7 +2805,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
* @param allList
|
||||
* @return
|
||||
*/
|
||||
private int updateSlt4Bean(BackApplyInfo record, List<BackApplyInfo> allList) {
|
||||
private int updateSlt4Bean(BackApplyInfo record, List<BackApplyInfo> allList, BmUnit unit) {
|
||||
for (BackApplyInfo bean : allList) {
|
||||
List<SltAgreementInfo> infoList = backApplyInfoMapper.getStlInfo(bean);
|
||||
if (infoList.size() > 0) {
|
||||
|
|
@ -2829,6 +2835,19 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
} else {
|
||||
return 0;
|
||||
}
|
||||
// 判断机具是否在材料站处于在用状态,只针对于项目部退料的编码设备
|
||||
if (unit != null && unit.getTypeId() == 36L) {
|
||||
// 单位类型为项目部退料提交
|
||||
if (bean.getMaId() != null) {
|
||||
// 查询此编码是否在材料站处于在用状态
|
||||
List<SltAgreementInfo> clzList = backApplyInfoMapper.getClzUserList(bean);
|
||||
if (CollectionUtils.isNotEmpty(clzList)) {
|
||||
for (SltAgreementInfo info : clzList) {
|
||||
backApplyInfoMapper.updateClzInfo(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -499,4 +499,11 @@ public interface SelectMapper {
|
|||
* @return
|
||||
*/
|
||||
String getDepartName(BmUnit bmUnit);
|
||||
|
||||
/**
|
||||
* 获取部门下拉选
|
||||
* @param bmUnit
|
||||
* @return
|
||||
*/
|
||||
List<ProjectTreeNode> getAgreeUnitList(BmUnit bmUnit);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -754,7 +754,7 @@ public class SelectServiceImpl implements SelectService {
|
|||
List<ProjectTreeNode> groupList = new ArrayList<>();
|
||||
List<ProjectTreeNode> list;
|
||||
try {
|
||||
list = mapper.getUnitList(bmUnit);
|
||||
list = mapper.getAgreeUnitList(bmUnit);
|
||||
if (list != null) {
|
||||
list = list.stream()
|
||||
.filter(Objects::nonNull)
|
||||
|
|
@ -767,6 +767,9 @@ public class SelectServiceImpl implements SelectService {
|
|||
// 根据工程id想查询已授权班组id
|
||||
if (bmUnit.getProjectId() != null) {
|
||||
teamIds = mapper.getTeamIds(bmUnit.getProjectId());
|
||||
if (CollectionUtils.isEmpty(teamIds)) {
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
}
|
||||
List<ProjectTreeNode> newList = mapper.getTeam(teamIds);
|
||||
groupList.addAll(newList);
|
||||
|
|
|
|||
|
|
@ -119,6 +119,9 @@ public class LeaseApplyDetails extends BaseEntity {
|
|||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "待发布数量")
|
||||
private BigDecimal pendingPublishNum;
|
||||
|
||||
/**
|
||||
* 装备管理方式(0编号 1计数)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.basic.domain.BmUnit;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.ma.domain.*;
|
||||
import com.bonus.material.ma.service.DirectRotationService;
|
||||
|
|
@ -42,6 +43,8 @@ public class DirectRotationController extends BaseController {
|
|||
@GetMapping("/getUseringData")
|
||||
public AjaxResult getUseringData(SltAgreementInfo sltAgreementInfo) {
|
||||
try {
|
||||
// 根据协议id查询该直转单位是否属于项目部
|
||||
BmUnit team = service.getTeam(sltAgreementInfo);
|
||||
List<SltAgreementInfo> datas = new ArrayList<>();
|
||||
List<SltAgreementInfo> useringData = service.getUseringData(sltAgreementInfo);
|
||||
Integer projectId = service.getprojectId(sltAgreementInfo);
|
||||
|
|
@ -78,21 +81,24 @@ public class DirectRotationController extends BaseController {
|
|||
for (SltAgreementInfo data : useringData) {
|
||||
boolean shouldAdd = true;
|
||||
Long dataTypeId = data.getTypeId();
|
||||
List<SltAgreementInfo> matchedClzList = clzMap.get(dataTypeId);
|
||||
if (matchedClzList != null && !matchedClzList.isEmpty()) {
|
||||
for (SltAgreementInfo clzInfo : matchedClzList) {
|
||||
if (data.getMaId() == null && clzInfo.getMaId() == null) {
|
||||
// 优化:先计算结果,最后一次set,减少BigDecimal创建
|
||||
BigDecimal subtractResult = data.getUseNum().subtract(clzInfo.getUseNum());
|
||||
if (subtractResult.compareTo(BigDecimal.ZERO) > 0) {
|
||||
data.setUseNum(subtractResult);
|
||||
} else {
|
||||
// 只有项目部类型领料单位才剔除材料站领用数据
|
||||
if (team != null && team.getTypeId() == 36) {
|
||||
List<SltAgreementInfo> matchedClzList = clzMap.get(dataTypeId);
|
||||
if (matchedClzList != null && !matchedClzList.isEmpty()) {
|
||||
for (SltAgreementInfo clzInfo : matchedClzList) {
|
||||
if (data.getMaId() == null && clzInfo.getMaId() == null) {
|
||||
// 优化:先计算结果,最后一次set,减少BigDecimal创建
|
||||
BigDecimal subtractResult = data.getUseNum().subtract(clzInfo.getUseNum());
|
||||
if (subtractResult.compareTo(BigDecimal.ZERO) > 0) {
|
||||
data.setUseNum(subtractResult);
|
||||
} else {
|
||||
shouldAdd = false;
|
||||
break;
|
||||
}
|
||||
} else if (Objects.equals(data.getMaId(), clzInfo.getMaId())) {
|
||||
shouldAdd = false;
|
||||
break;
|
||||
}
|
||||
} else if (Objects.equals(data.getMaId(), clzInfo.getMaId())) {
|
||||
shouldAdd = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.material.ma.mapper;
|
||||
|
||||
import com.bonus.common.biz.domain.lease.LeaseOutSign;
|
||||
import com.bonus.material.basic.domain.BmUnit;
|
||||
import com.bonus.material.clz.domain.direct.ClzDirectApplyInfo;
|
||||
import com.bonus.material.ma.domain.DirectApplyDetails;
|
||||
import com.bonus.material.ma.domain.DirectApplyExportInfo;
|
||||
|
|
@ -118,4 +119,11 @@ public interface DirectRotationMapper {
|
|||
List<SltAgreementInfo> getBatchInfo(@Param("agreementId") Long agreementId, @Param("pairs")List<SltAgreementInfo> list);
|
||||
|
||||
DirectApplyInfo getDeptInfo(DirectApplyInfo directApplyInfo);
|
||||
|
||||
/**
|
||||
* 根据协议id查询该直转单位是否属于项目部
|
||||
* @param sltAgreementInfo
|
||||
* @return
|
||||
*/
|
||||
BmUnit getTeam(SltAgreementInfo sltAgreementInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.ma.service;
|
|||
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.BmUnit;
|
||||
import com.bonus.material.ma.domain.DirectApplyExportInfo;
|
||||
import com.bonus.material.ma.domain.DirectApplyInfo;
|
||||
import com.bonus.material.ma.domain.DirectApplyInfoDetails;
|
||||
|
|
@ -114,4 +115,11 @@ public interface DirectRotationService {
|
|||
* @return
|
||||
*/
|
||||
List<SltAgreementInfo> getBatchInfo(Long agreementId, List<SltAgreementInfo> list);
|
||||
|
||||
/**
|
||||
* 根据协议id查询该直转单位是否属于项目部
|
||||
* @param sltAgreementInfo
|
||||
* @return
|
||||
*/
|
||||
BmUnit getTeam(SltAgreementInfo sltAgreementInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.bonus.common.security.utils.SecurityUtils;
|
|||
import com.bonus.material.back.domain.BackApplyDetails;
|
||||
import com.bonus.material.back.domain.BackApplyInfo;
|
||||
import com.bonus.material.back.mapper.BackApplyInfoMapper;
|
||||
import com.bonus.material.basic.domain.BmUnit;
|
||||
import com.bonus.material.clz.domain.direct.ClzDirectApplyInfo;
|
||||
import com.bonus.material.event.InsertWorkflowEvent;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||
|
|
@ -426,6 +427,7 @@ public class DirectRotationImpl implements DirectRotationService {
|
|||
applyInfo.setCreateBy(SecurityUtils.getUsername());
|
||||
applyInfo.setCreateTime(DateUtils.getNowDate());
|
||||
applyInfo.setDeptId(Long.valueOf(id));
|
||||
applyInfo.setDirectId((long) id);
|
||||
/** 设置审批人为默认的董班长 --防止代码冲突 **/
|
||||
int count = leaseApplyInfoMapper.insertLeaseApplyInfo(applyInfo);
|
||||
if (count > 0) {
|
||||
|
|
@ -569,6 +571,16 @@ public class DirectRotationImpl implements DirectRotationService {
|
|||
return mapper.getBatchInfo(agreementId, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据协议id查询该直转单位是否属于项目部
|
||||
* @param sltAgreementInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public BmUnit getTeam(SltAgreementInfo sltAgreementInfo) {
|
||||
return mapper.getTeam(sltAgreementInfo);
|
||||
}
|
||||
|
||||
// 将签名分类的逻辑提取到一个单独的方法
|
||||
private void classifySignature(ClzDirectApplyInfo clzDirectApplyInfo, LeaseOutSign leaseOutSign,
|
||||
List<LeaseOutSign> list1, List<LeaseOutSign> list2, List<LeaseOutSign> list3) {
|
||||
|
|
|
|||
|
|
@ -880,6 +880,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update bm_handling_order set is_active = '0' where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateClzInfo">
|
||||
UPDATE
|
||||
clz_slt_agreement_info
|
||||
SET end_time = now(),
|
||||
update_time = now(),
|
||||
status = '1'
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 设置审批人为默认的李勇 防止代码冲突-->
|
||||
<select id="getDirectAuditBy" resultType="Long">
|
||||
select
|
||||
|
|
|
|||
|
|
@ -571,6 +571,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY bu.unit_name
|
||||
</select>
|
||||
|
||||
<select id="getTeamLeaseList" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
|
||||
|
|
@ -1639,4 +1640,80 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
data_center.dx_fb_son
|
||||
WHERE name = #{projectName}
|
||||
</select>
|
||||
|
||||
<select id="getAgreeUnitList" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
|
||||
/*根据标段工程id关联协议查询往来单位*/
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
CONCAT( 'dw', sd.dept_id ) AS id,
|
||||
sd.dept_name AS NAME,
|
||||
0 AS parentId,
|
||||
1 AS LEVEL,
|
||||
null AS typeKey
|
||||
FROM
|
||||
sys_dept sd
|
||||
LEFT JOIN bm_unit bu ON sd.dept_id = bu.dept_id
|
||||
WHERE
|
||||
bu.del_flag = '0'
|
||||
AND sd.del_flag = '0'
|
||||
AND sd.`status` = '0'
|
||||
AND bu.type_id != 1731
|
||||
<if test="deptId != null">
|
||||
AND bu.dept_id = #{deptId}
|
||||
</if>
|
||||
<if test="unitId != null">
|
||||
AND bu.unit_id = #{unitId}
|
||||
</if>
|
||||
|
||||
UNION
|
||||
|
||||
SELECT DISTINCT
|
||||
CONCAT( 'lx', bu.dept_id, '-', sda.dict_code ) AS id,
|
||||
sda.dict_label AS NAME,
|
||||
CONCAT( 'dw', bu.dept_id ) AS parentId,
|
||||
2 AS LEVEL,
|
||||
sda.dict_value AS typeKey
|
||||
FROM
|
||||
bm_unit bu
|
||||
LEFT JOIN sys_dict_data sda ON bu.type_id = sda.dict_code
|
||||
AND sda.dict_type = 'bm_unit_type'
|
||||
WHERE
|
||||
bu.del_flag = '0'
|
||||
AND sda.STATUS = '0'
|
||||
AND bu.type_id != 1731
|
||||
<if test="deptId != null">
|
||||
AND bu.dept_id = #{deptId}
|
||||
</if>
|
||||
<if test="unitId != null">
|
||||
AND bu.unit_id = #{unitId}
|
||||
</if>
|
||||
|
||||
UNION
|
||||
SELECT
|
||||
bu.unit_id AS id,
|
||||
bu.unit_name AS NAME,
|
||||
CONCAT( 'lx', bu.dept_id, '-', sda.dict_code ) AS parentId,
|
||||
3 AS LEVEL,
|
||||
sda.dict_value AS typeKey
|
||||
FROM
|
||||
bm_unit bu
|
||||
LEFT JOIN sys_dict_data sda ON bu.type_id = sda.dict_code
|
||||
AND sda.dict_type = 'bm_unit_type'
|
||||
WHERE
|
||||
bu.del_flag = '0'
|
||||
AND sda.STATUS = '0'
|
||||
AND bu.type_id != 1731
|
||||
<if test="deptId != null">
|
||||
AND bu.dept_id = #{deptId}
|
||||
</if>
|
||||
<if test="unitId != null">
|
||||
AND bu.unit_id = #{unitId}
|
||||
</if>
|
||||
) ff
|
||||
ORDER BY
|
||||
LEVEL
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -428,4 +428,15 @@
|
|||
bp.pro_name
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getTeam" resultType="com.bonus.material.basic.domain.BmUnit">
|
||||
SELECT
|
||||
bai.unit_id as unitId,
|
||||
bu.type_id as typeId
|
||||
FROM
|
||||
bm_agreement_info bai
|
||||
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
||||
WHERE
|
||||
agreement_id = #{agreementId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue