# Conflicts:
#	bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java
#	bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java
This commit is contained in:
hongchao 2025-07-08 19:05:07 +08:00
commit 0c352f19d4
23 changed files with 565 additions and 268 deletions

View File

@ -310,4 +310,12 @@ public class LeaseApplyInfo extends BaseEntity{
@ApiModelProperty(value = "i8工程id")
private String externalId;
@ApiModelProperty(value = "签字人")
private String signPerson;
@ApiModelProperty(value = "领料出库id集合")
private String ids;
private Long leaseSignId;
}

View File

@ -252,4 +252,15 @@ public class MaterialBackApplyInfoController extends BaseController {
return error("系统错误, " + e.getMessage());
}
}
/**
* app编码检索
* @param dto
* @return
*/
@ApiOperation(value = "app编码检索")
@GetMapping("/getMachine")
public AjaxResult getMachine(MaterialBackApplyInfo dto) {
return materialBackApplyInfoService.getMachine(dto);
}
}

View File

@ -186,4 +186,7 @@ public class MaterialBackApplyInfo implements Serializable {
@ApiModelProperty(value = "i8工程id")
private String externalId;
@ApiModelProperty(value = "实施单位id")
private String impUnit;
}

View File

@ -150,4 +150,10 @@ public class MaterialBackApplyTotalInfo implements Serializable {
@ApiModelProperty(value = "i8工程id")
private String externalId;
@ApiModelProperty(value = "身份证号码")
private String idCard;
@ApiModelProperty(value = "实施单位id")
private String impUnit;
}

View File

@ -149,4 +149,13 @@ public class LeaseApplyDetailsInfo extends BaseEntity {
@ApiModelProperty(value = "结束时间")
private String endTime;
@ApiModelProperty(value = "身份证号码")
private String idCard;
@ApiModelProperty(value = "i8工程id")
private String externalId;
@ApiModelProperty(value = "实施单位id")
private String impUnit;
}

View File

@ -287,4 +287,7 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
@ApiModelProperty(value = "项目部id")
private Long departId;
@ApiModelProperty(value = "实施单位id")
private String impUnit;
}

View File

@ -208,4 +208,10 @@ public class MaterialRetainedEquipmentInfo {
@ApiModelProperty(value = "i8工程id")
private String externalId;
@ApiModelProperty(value = "身份证号码")
private String idCard;
@ApiModelProperty(value = "实施单位id")
private String impUnit;
}

View File

@ -90,4 +90,10 @@ public class LeaseTotalInfo {
@ApiModelProperty(value = "i8工程id")
private String externalId;
@ApiModelProperty(value = "实施单位id")
private String impUnit;
@ApiModelProperty(value = "身份证号码")
private String idCard;
}

View File

@ -235,4 +235,11 @@ public interface MaterialBackInfoMapper {
* @return
*/
MaterialBackApplyInfo selectByAgreementIdAndTypeId(MaCodeVo maCodeVo);
/**
* 查询退料任务审核详情
* @param dto
* @return
*/
List<MaCodeVo> getMachine(MaterialBackApplyInfo dto);
}

View File

@ -65,13 +65,6 @@ public interface MaterialMachineMapper {
*/
BmTeam getTeamData(String username);
/**
* 工器具台账查询
* @param bmTeam
* @return
*/
List<MaterialRetainedEquipmentInfo> getToolsLedgerListByTeam(BmTeam bmTeam);
/**
* 工器具台账查询
* @param bean
@ -127,4 +120,11 @@ public interface MaterialMachineMapper {
* @return
*/
MaterialUseStorageInfo selectUseInFo(MaterialUseStorageInfo useStorageInfo);
/**
* 获取设备状态
* @param machine1
* @return
*/
MaterialSltAgreementInfo selectStatusByUserId(Machine machine1);
}

View File

@ -113,4 +113,11 @@ public interface MaterialBackApplyInfoService {
* @return
*/
AjaxResult submitBackApply(MaterialBackApplyInfo backApplyInfo);
/**
* app编码检索
* @param dto
* @return
*/
AjaxResult getMachine(MaterialBackApplyInfo dto);
}

View File

@ -19,7 +19,8 @@ import com.bonus.material.back.domain.BackApplyInfo;
import com.bonus.material.back.domain.MaCodeDto;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo;
import com.bonus.material.clz.domain.BmTeam;
import com.bonus.material.clz.mapper.MaterialMachineMapper;
import com.bonus.material.common.mapper.SelectMapper;
import com.bonus.material.ma.mapper.MachineMapper;
import com.bonus.material.clz.domain.back.MaterialBackApplyDetails;
@ -70,6 +71,8 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
@Resource
private SelectMapper mapper;
@Resource
private MaterialMachineMapper materialMachineMapper;
/**
* 查询退料申请列表
* @param backApplyInfo
@ -83,7 +86,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
return new ArrayList<>();
}
String username = SecurityUtils.getLoginUser().getUsername();
list.removeIf(info -> {
/*list.removeIf(info -> {
if (StringUtils.isBlank(info.getExternalId())) {
return true;
}
@ -93,7 +96,22 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
}
List<String> userNameList = mapper.getUserNameList(i8ProjectInfo);
return CollectionUtils.isEmpty(userNameList) || !userNameList.contains(username);
});
});*/
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!org.springframework.util.CollectionUtils.isEmpty(list) && deptId != null) {
// 删除元素
list.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
}
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
}
if (!CollectionUtils.isEmpty(list)) {
// 提取关键字
String keyWord = backApplyInfo.getKeyWord();
@ -133,9 +151,10 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
*/
@Override
public List<MaterialBackApplyInfo> getTotalList(MaterialBackApplyInfo backApplyInfo) {
String username = SecurityUtils.getLoginUser().getUsername();
List<MaterialBackApplyInfo> list = materialBackInfoMapper.getTotalList(backApplyInfo);
// 安全过滤数据权限
if (!CollectionUtils.isEmpty(list)) {
/*if (!CollectionUtils.isEmpty(list)) {
String username = SecurityUtils.getLoginUser().getUsername();
list.removeIf(leaseTotalInfo -> {
if (StringUtils.isBlank(leaseTotalInfo.getExternalId())) {
@ -148,6 +167,21 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
List<String> userNameList = mapper.getUserNameList(i8ProjectInfo);
return org.springframework.util.CollectionUtils.isEmpty(userNameList) || !userNameList.contains(username);
});
}*/
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!org.springframework.util.CollectionUtils.isEmpty(list) && deptId != null) {
// 删除元素
list.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
}
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
}
if (!CollectionUtils.isEmpty(list)) {
// 如果关键字不为空进行过滤
@ -472,9 +506,25 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
*/
@Override
public List<MaterialBackApplyTotalInfo> getBackInfoDetails(MaterialBackApplyTotalInfo info) {
String username = SecurityUtils.getLoginUser().getUsername();
BigDecimal backNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
List<MaterialBackApplyTotalInfo> list = materialBackInfoMapper.getBackInfoDetails(info);
if (CollectionUtils.isNotEmpty(list)) {
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(list) && deptId != null) {
// 删除元素
list.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
}
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
}
/*if (CollectionUtils.isNotEmpty(list)) {
String username = SecurityUtils.getLoginUser().getUsername();
list.removeIf(b -> {
if (StringUtils.isBlank(b.getExternalId())) {
@ -487,7 +537,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
List<String> userNameList = mapper.getUserNameList(i8ProjectInfo);
return CollectionUtils.isEmpty(userNameList) || !userNameList.contains(username);
});
}
}*/
if (CollectionUtils.isNotEmpty(list)) {
for (MaterialBackApplyTotalInfo backApplyTotalInfo : list) {
backNum = backNum.add(backApplyTotalInfo.getBackNum());
@ -652,6 +702,24 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
}
/**
* app编码检索
* @param dto
* @return
*/
@Override
public AjaxResult getMachine(MaterialBackApplyInfo dto) {
//判断输入或者编码识别或者二维码识别是否为领料工程和单位对应
List<MaCodeVo> list = new ArrayList<>();
if (dto.getMaCode() != null ||dto.getQrCode() != null) {
list = materialBackInfoMapper.getMachine(dto);
}
if (CollectionUtils.isNotEmpty(list)) {
return AjaxResult.success(list);
}
return AjaxResult.error(HttpCodeEnum.SYSTEM_ERROR.getCode(), "该编码设备非该班组和工程所领");
}
/**
* 完成退料
* @param backApplyInfo

View File

@ -5,12 +5,10 @@ import com.bonus.common.biz.constant.MaterialConstants;
import com.bonus.common.biz.domain.BmFileInfo;
import com.bonus.common.biz.domain.TypeTreeBuild;
import com.bonus.common.biz.domain.TypeTreeNode;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
import com.bonus.common.biz.domain.lease.MaterialLeaseMaCodeDto;
import com.bonus.common.biz.enums.HttpCodeEnum;
import com.bonus.common.biz.enums.LeaseTaskStatusEnum;
import com.bonus.common.biz.enums.MaMachineStatusEnum;
import com.bonus.common.biz.enums.TmTaskTypeEnum;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
@ -23,10 +21,11 @@ import com.bonus.material.basic.domain.BmAgreementInfo;
import com.bonus.material.basic.domain.BmQrcodeInfo;
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.mapper.MaterialMachineMapper;
import com.bonus.material.common.mapper.SelectMapper;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.mapper.MachineMapper;
import com.bonus.material.ma.mapper.TypeMapper;
import com.bonus.material.clz.domain.lease.LeaseApplyDetailsInfo;
import com.bonus.material.clz.domain.lease.LeaseOutDetailsInfo;
@ -82,6 +81,9 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
@Resource(name = "SelectMapper")
private SelectMapper mapper;
@Resource
private MaterialMachineMapper materialMachineMapper;
/**
* 查询领料任务列表
*
@ -90,6 +92,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
*/
@Override
public List<MaterialLeaseApplyInfo> selectLeaseApplyInfoList(MaterialLeaseApplyInfo leaseApplyInfo) {
String username = SecurityUtils.getLoginUser().getUsername();
List<MaterialLeaseApplyInfo> list = materialLeaseInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo);
// 利用Stream API进行降序排序
List<MaterialLeaseApplyInfo> sortedList = list.stream()
@ -97,7 +100,23 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
.collect(Collectors.toList());
// 数据权限划分
sortedList = filterByDataPermission(sortedList);
//sortedList = filterByDataPermission(sortedList);
// 获取当前用户的deptId
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(sortedList) && deptId != null) {
// 删除元素
sortedList.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
}
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (!CollectionUtils.isEmpty(sortedList)) {
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
sortedList = sortedList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
}
// 处理剩余数据
if (!CollectionUtils.isEmpty(sortedList)) {
processLeaseApplyInfo(sortedList);
@ -195,6 +214,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
*/
@Override
public List<MaterialLeaseApplyInfo> getTotalList(MaterialLeaseApplyInfo leaseApplyInfo) {
String username = SecurityUtils.getLoginUser().getUsername();
// 领料数据
List<MaterialLeaseApplyInfo> list = materialLeaseInfoMapper.getTotalList(leaseApplyInfo);
// 查询领用数据
@ -216,9 +236,8 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
.sorted(Comparator.comparing(MaterialLeaseApplyInfo::getCreateTime,
Comparator.nullsLast(Comparator.naturalOrder())).reversed())
.collect(Collectors.toList());
// 安全过滤数据权限
if (!CollectionUtils.isEmpty(sortedList)) {
String username = SecurityUtils.getLoginUser().getUsername();
// 材料员安全过滤数据权限
/*if (!CollectionUtils.isEmpty(sortedList)) {
sortedList.removeIf(leaseTotalInfo -> {
if (StringUtils.isBlank(leaseTotalInfo.getExternalId())) {
return true;
@ -230,6 +249,21 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
List<String> userNameList = mapper.getUserNameList(i8ProjectInfo);
return CollectionUtils.isEmpty(userNameList) || !userNameList.contains(username);
});
}*/
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(sortedList) && deptId != null) {
// 删除元素
sortedList.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
}
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (!CollectionUtils.isEmpty(sortedList)) {
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
sortedList = sortedList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
}
if (!CollectionUtils.isEmpty(sortedList)) {
// 如果关键字不为空进行过滤
@ -473,10 +507,26 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
*/
@Override
public List<LeaseApplyDetailsInfo> getLeaseInfo(LeaseApplyDetailsInfo dto) {
String username = SecurityUtils.getLoginUser().getUsername();
BigDecimal preNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal alNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal outNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
List<LeaseApplyDetailsInfo> list = materialLeaseInfoMapper.getLeaseInfo(dto);
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(list) && deptId != null) {
// 删除元素
list.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
}
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (!CollectionUtils.isEmpty(list)) {
if (teamData != null) {
// 将list中班组身份证号与username相同的元素过滤处理
list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
}
if (!CollectionUtils.isEmpty(list)) {
String keyWord = dto.getKeyWord();
// 如果关键字不为空进行过滤
@ -734,12 +784,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
List<LeaseOutDetails> recordList = materialLeaseInfoMapper.getInfoByQrcode(bmQrcodeInfo);
String msg = "";
if (CollectionUtil.isNotEmpty(recordList)) {
recordList = recordList.stream().filter(item -> item.getMaStatus().equals(MaMachineStatusEnum.IN_STORE.getStatus().toString())).collect(Collectors.toList());
if (recordList.size() > 0) {
msg = "监测到" + bmQrcodeInfo.getQrCode() + "符合出库条件,请确认是否出库!";
} else {
msg = "监测到" + bmQrcodeInfo.getQrCode() + "编码不符合出库条件,请检查后重新提交!";
}
msg = "监测到" + bmQrcodeInfo.getQrCode() + "符合出库条件,请确认是否出库!";
} else {
msg = "监测到" + bmQrcodeInfo.getQrCode() + "编码不符合出库条件,请检查后重新提交!";
}
@ -818,13 +863,13 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
*/
@Override
public List<LeaseTotalInfo> getLeaseInfoDetails(LeaseTotalInfo info) {
String username = SecurityUtils.getLoginUser().getUsername();
BigDecimal preNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal outNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal pendingNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
List<LeaseTotalInfo> list = materialLeaseInfoMapper.getLeaseInfoDetails(info);
// 安全过滤数据权限
if (!CollectionUtils.isEmpty(list)) {
String username = SecurityUtils.getLoginUser().getUsername();
/*if (!CollectionUtils.isEmpty(list)) {
list.removeIf(leaseTotalInfo -> {
if (StringUtils.isBlank(leaseTotalInfo.getExternalId())) {
return true;
@ -836,6 +881,21 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
List<String> userNameList = mapper.getUserNameList(i8ProjectInfo);
return CollectionUtils.isEmpty(userNameList) || !userNameList.contains(username);
});
}*/
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(list) && deptId != null) {
// 删除元素
list.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
}
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (!CollectionUtils.isEmpty(list)) {
if (teamData != null) {
// 将list中班组身份证号与username相同的元素过滤处理
list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
}
// 处理数据并计算总和
if (!CollectionUtils.isEmpty(list)) {

View File

@ -78,8 +78,11 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
for (Machine machine1 : mergedList) {
if (machine1.getMaId() != null) {
MaterialSltAgreementInfo sltAgreementInfo = materialMachineMapper.selectStatusById(machine1);
MaterialSltAgreementInfo materialSltAgreementInfo = materialMachineMapper.selectStatusByUserId(machine1);
if (sltAgreementInfo != null) {
machine1.setMaStatus("在用");
} else if (materialSltAgreementInfo != null) {
machine1.setMaStatus("退回");
} else {
machine1.setMaStatus("在库");
}
@ -96,6 +99,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
*/
@Override
public List<MaterialRetainedEquipmentInfo> getRetainedEquipmentList(MaterialRetainedEquipmentInfo bean) {
String username = SecurityUtils.getLoginUser().getUsername();
BigDecimal totalPrice = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
BigDecimal totalStoreNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalUsNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
@ -104,7 +108,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
BigDecimal totalRepairInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalAllNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainedEquipmentList(bean);
if (CollectionUtils.isNotEmpty(recordList)) {
/*if (CollectionUtils.isNotEmpty(recordList)) {
String username = SecurityUtils.getLoginUser().getUsername();
recordList.removeIf(info -> {
if (com.bonus.common.core.utils.StringUtils.isBlank(info.getExternalId())) {
@ -117,6 +121,21 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
List<String> userNameList = mapper.getUserNameList(i8ProjectInfo);
return CollectionUtils.isEmpty(userNameList) || !userNameList.contains(username);
});
}*/
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(recordList) && deptId != null) {
// 删除元素
recordList.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
}
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (!org.springframework.util.CollectionUtils.isEmpty(recordList)) {
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
recordList = recordList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
}
if (CollectionUtils.isNotEmpty(recordList)) {
for (MaterialRetainedEquipmentInfo retainedEquipmentInfo : recordList) {
@ -204,7 +223,23 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
*/
@Override
public List<MaterialRetainedEquipmentInfo> getTeamUseNumList(MaterialRetainedEquipmentInfo bean) {
String username = SecurityUtils.getLoginUser().getUsername();
List<MaterialRetainedEquipmentInfo> list = materialMachineMapper.getTeamUseNumList(bean);
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(list) && deptId != null) {
// 删除元素
list.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
}
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
}
if (CollectionUtils.isNotEmpty(list)) {
for (MaterialRetainedEquipmentInfo retainedEquipmentInfo : list) {
MaterialRetainedEquipmentInfo info = new MaterialRetainedEquipmentInfo();
@ -225,7 +260,23 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
*/
@Override
public List<MaterialRetainedEquipmentInfo> getTeamWarnDetailsList(MaterialRetainedEquipmentInfo bean) {
String username = SecurityUtils.getLoginUser().getUsername();
List<MaterialRetainedEquipmentInfo> list = materialMachineMapper.getTeamUseNumDetailsList(bean);
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(list) && deptId != null) {
// 删除元素
list.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
}
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
}
if (!CollectionUtil.isEmpty(list)) {
// 将list中manageType为0的数据过滤出来
list = list.stream().filter(item -> "0".equals(item.getManageType())).collect(Collectors.toList());
@ -279,20 +330,14 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
public List<MaterialRetainedEquipmentInfo> getToolsLedgerList(MaterialRetainedEquipmentInfo bean) {
List<MaterialRetainedEquipmentInfo> list1 =new ArrayList<>();
try {
//1获取当前用户名
String userName = SecurityUtils.getLoginUser().getUsername();
//2判断用户是否为班组长且对应的是否有班组
BmTeam bmTeam = materialMachineMapper.getTeamData(userName);
List<MaterialRetainedEquipmentInfo> list = new ArrayList<>();
if (bmTeam != null) {
//不为空 是班组长且对应的有班组
//查询班组下工器具库存
list = materialMachineMapper.getToolsLedgerListByTeam(bmTeam);
} else {
//没有班组则查全部
list = materialMachineMapper.getToolsLedgerList(bean);
List<MaterialRetainedEquipmentInfo> list = materialMachineMapper.getToolsLedgerList(bean);
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(list) && deptId != null) {
// 删除元素
list.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
}
if (list.size() > 0) {
// 根据用户名判断用户是否为班组长
if (CollectionUtils.isNotEmpty(list)) {
list1 = groupByThirdTypeId(list);
}
return list1;
@ -309,18 +354,23 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
*/
@Override
public MaterialRetainedEquipmentInfo getToolsLedgerDetailsList(MaterialRetainedEquipmentInfo bean) {
List<MaterialRetainedEquipmentInfo> list = new ArrayList<>();
try {
// 先根据用户名去查班组信息
List<MaterialRetainedEquipmentInfo> list = materialMachineMapper.getTeamUseNumDetailsList(bean);
String username = SecurityUtils.getLoginUser().getUsername();
BmTeam bmTeam = new BmTeam();
bmTeam.setIdCard(username);
List<BmTeam> teamList = bmTeamMapper.queryByPage(bmTeam);
if (CollectionUtil.isNotEmpty(teamList)) {
bean.setTeamLeaderIdCard(username);
list = materialMachineMapper.getTeamUseNumDetailsList(bean);
} else {
list = materialMachineMapper.getToolsLedgerDetailsList(bean);
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(list) && deptId != null) {
// 删除元素
list.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
}
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
}
if (!CollectionUtil.isEmpty(list)) {
for (MaterialRetainedEquipmentInfo retainedEquipmentInfo : list) {
@ -381,21 +431,8 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
@Override
public List<MaterialRetainedEquipmentInfo> getToolsDetailsList(MaterialRetainedEquipmentInfo bean) {
try {
//1获取当前用户名
String username = SecurityUtils.getLoginUser().getUsername();
//2判断用户是否为班组长且对应的是否有班组
BmTeam bmTeam = materialMachineMapper.getTeamData(username);
List<MaterialRetainedEquipmentInfo> list = new ArrayList<>();
if (bmTeam != null) {
//不为空 是班组长且对应的有班组
MaCodeVo bean1 = new MaCodeVo();
bean1.setTeamId(bmTeam.getId());
bean1.setTypeId(bean.getTypeId()+"");
list = materialMachineMapper.getToolsDetailsListByTeam(bean1);
} else {
//没有班组则查全部
list = materialMachineMapper.getToolsDetailsList(bean);
}
//没有班组则查全部
List<MaterialRetainedEquipmentInfo> list = materialMachineMapper.getToolsDetailsList(bean);
if (!CollectionUtil.isEmpty(list)) {
for (MaterialRetainedEquipmentInfo retainedEquipmentInfo : list) {
if (StringUtils.isNotBlank(retainedEquipmentInfo.getNextCheckTime())) {

View File

@ -107,6 +107,20 @@ public interface LeaseApplyInfoMapper {
*/
int updateLeasePublishInfoSign(LeaseApplyInfo leaseApplyInfo);
/**
* 新增领用发布签名
* @param leaseApplyInfo
* @return
*/
int insertLeaseSign(LeaseApplyInfo leaseApplyInfo);
/**
* 查询未签名的领用单
* @param leaseApplyInfo
* @return
*/
List<LeaseApplyInfo> selectNoSignList(LeaseApplyInfo leaseApplyInfo);
List<LeaseApplyInfo> selectCompleteOutList(LeaseApplyInfo leaseApplyInfo);
int checkPermission(@Param("externalId") String externalId,@Param("username") String username);

View File

@ -2,6 +2,7 @@ package com.bonus.material.lease.mapper;
import java.util.List;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
import com.bonus.material.ma.domain.Type;
@ -102,4 +103,11 @@ public interface LeaseOutDetailsMapper {
* @return
*/
int updateMachine(LeaseOutDetails record);
/**
* 修改领料出库详细
* @param leaseApplyInfo
* @return
*/
int updateLeaseOutSign(LeaseApplyInfo leaseApplyInfo);
}

View File

@ -28,6 +28,7 @@ import com.bonus.material.lease.domain.LeaseApplyDetails;
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
import com.bonus.material.lease.domain.vo.LeaseOutVo;
import com.bonus.material.lease.mapper.LeaseApplyDetailsMapper;
import com.bonus.material.lease.mapper.LeaseOutDetailsMapper;
import com.bonus.material.lease.service.ILeaseOutDetailsService;
import com.bonus.material.task.domain.TmTask;
import com.bonus.material.task.domain.TmTaskAgreement;
@ -72,6 +73,9 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
@Resource
private BmFileInfoMapper bmFileInfoMapper;
@Resource
private LeaseOutDetailsMapper leaseOutDetailsMapper;
/**
* 查询领料任务
*
@ -270,17 +274,8 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
}
}
if (!CollectionUtils.isEmpty(list)) {
if (leaseApplyInfo.getHasSign() != null && leaseApplyInfo.getHasSign() == 1) {
// 将list集合中leaseSignUrl不为null的数据过滤出来
list = list.stream()
.filter(info -> StringUtils.isNotBlank(info.getLeaseSignUrl()))
.collect(Collectors.toList());
} else if (leaseApplyInfo.getHasSign() != null && leaseApplyInfo.getHasSign() == 0) {
extracted(leaseApplyInfo, list);
// 查询待签名的领料单
list = list.stream()
.filter(info -> StringUtils.isBlank(info.getLeaseSignUrl()))
.collect(Collectors.toList());
if (leaseApplyInfo.getHasSign() != null && leaseApplyInfo.getHasSign() == 0) {
list = leaseApplyInfoMapper.selectNoSignList(leaseApplyInfo);
}
}
// 使用 Stream API 进行降序排序
@ -870,11 +865,29 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
*/
@Override
public int updateLeaseApplyInfoSign(LeaseApplyInfo leaseApplyInfo) {
// 领用电子签名修改
if (leaseApplyInfo.getTaskType() != null && leaseApplyInfo.getTaskType() == 19) {
return leaseApplyInfoMapper.updateLeasePublishInfoSign(leaseApplyInfo);
int result = 0;
Long userid = SecurityUtils.getLoginUser().getUserid();
String nickName = SecurityUtils.getLoginUser().getSysUser().getNickName();
leaseApplyInfo.setSignPerson(nickName);
leaseApplyInfo.setCreateBy(userid.toString());
leaseApplyInfo.setCreateTime(DateUtils.getNowDate());
// 新增领料签字表lease_sign_info
result = leaseApplyInfoMapper.insertLeaseSign(leaseApplyInfo);
if (result == 0) {
throw new RuntimeException("添加签名信息失败");
}
return leaseApplyInfoMapper.updateLeaseApplyInfoSign(leaseApplyInfo);
// 往lease_out_details表增加新增签字id字段
if (StringUtils.isNotBlank(leaseApplyInfo.getIds())) {
List<String> ids = Collections.singletonList(leaseApplyInfo.getIds());
for (String id : ids) {
leaseApplyInfo.setId(Long.parseLong(id));
result = leaseOutDetailsMapper.updateLeaseOutSign(leaseApplyInfo);
if (result == 0) {
throw new RuntimeException("修改领料签字信息失败");
}
}
}
return result;
}

View File

@ -246,4 +246,10 @@ public class Machine extends BaseEntity
@ApiModelProperty(value = "标准箱ID")
private Long boxId;
@ApiModelProperty(value = "实施单位id")
private String impUnit;
@ApiModelProperty(value = "身份证号码")
private String idCard;
}

View File

@ -221,7 +221,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bai.`status` AS status,
bai.print_status as printStatus,
SUM(IFNULL(bad.pre_num, 0)) AS backNum,
bp.external_id AS externalId
bp.external_id AS externalId,
bp.imp_unit AS impUnit,
bt.bzz_idcard AS idCard
FROM
clz_back_apply_info bai
LEFT JOIN clz_back_apply_details bad on bad.parent_id = bai.id
@ -282,7 +284,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP_CONCAT(DISTINCT mt2.type_id) as typeId,
GROUP_CONCAT(DISTINCT mt2.type_name) AS typeName,
bai.`status` AS status,
bai.print_status as printStatus
bai.print_status as printStatus,
bp.external_id AS externalId,
bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard
FROM
back_apply_info bai
LEFT JOIN back_apply_details bad on bad.parent_id = bai.id
@ -553,7 +558,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bai.back_person AS backPerson,
bai.create_by AS createBy,
bai.`code` AS code,
bp.external_id AS externalId
bp.external_id AS externalId,
bp.imp_unit AS impUnit,
bt.bzz_idcard AS idCard
FROM
clz_back_check_details bcd
LEFT JOIN ma_type mt ON bcd.type_id = mt.type_id
@ -674,7 +681,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mt.type_id = #{typeId}
AND ba.unit_id = #{teamId}
AND ba.project_id = #{proId}
GROUP BY mm.ma_code
GROUP BY mm.ma_id
</select>
<select id="selectAgreementId" resultType="java.lang.Long">
@ -718,4 +725,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND ma_id = #{maId}
</if>
</select>
<select id="getMachine" resultType="com.bonus.material.back.domain.vo.MaCodeVo">
SELECT
mm.ma_id AS maId,
mm.ma_code AS maCode,
mm.ma_status AS maStatus,
mt1.type_name AS typeName,
mm.type_id AS typeId,
mt.type_name AS materialName,
mt2.type_name AS materialType,
ba.unit_id AS teamId,
bu.unit_name AS teamName,
ba.project_id AS proId,
bp.pro_name AS proName,
ba.agreement_id AS agreementId
FROM
clz_lease_out_details lod
LEFT JOIN clz_slt_agreement_info cs ON lod.ma_id = cs.ma_id
AND lod.type_id = cs.type_id
LEFT JOIN ma_machine mm ON lod.ma_id = mm.ma_id
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
AND mt1.del_flag = '0'
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
AND mt2.del_flag = '0'
LEFT JOIN clz_lease_apply_info lai ON lod.parent_id = lai.id
LEFT JOIN clz_bm_agreement_info ba ON cs.agreement_id = ba.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = ba.project_id
AND bp.del_flag = '0'
LEFT JOIN bm_unit bu ON bu.unit_id = ba.unit_id
AND bu.del_flag = '0'
WHERE
cs.`status` = '0'
AND ba.unit_id = #{teamId}
AND ba.project_id = #{proId}
<if test="maCode != null and maCode != ''">
AND mm.ma_code = #{maCode}
</if>
<if test="qrCode != null and qrCode != ''">
AND mm.qr_code = #{qrCode}
</if>
</select>
</mapper>

View File

@ -38,6 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="leaseSignType" column="lease_sign_type" />
<result property="agreementId" column="agreement_id" />
<result property="externalId" column="external_id" />
<result property="impUnit" column="imp_unit" />
<result property="idCard" column="bzz_idcard" />
</resultMap>
<resultMap type="com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetails" id="LeaseApplyDetailsResult">
@ -78,7 +80,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.contract_part as contractPart,
sd.dept_name as impUnitName,
tta.agreement_id,
bp.external_id
bp.external_id,
bp.imp_unit,
bt.bzz_idcard
from
clz_lease_apply_info lai
left join tm_task tt on lai.task_id = tt.task_id
@ -422,7 +426,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(sum(lad.pre_num),0) as preCountNum,
IFNULL(sum(lad.al_num),0) as alNum,
GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames,
tt.task_type as taskType
tt.task_type as taskType,
bp.external_id AS externalId,
bu.bzz_idcard AS idCard
from
lease_apply_info lai
left join tm_task tt on lai.task_id = tt.task_id
@ -673,7 +679,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP_CONCAT(DISTINCT lod.create_by) as outPerson,
lai.`code` as leaseCode,
bt.unit_name as teamName,
bp.pro_name as projectName
bp.pro_name as projectName,
bp.external_id AS externalId,
bt.bzz_idcard AS idCard,
bp.imp_unit AS impUnit
FROM
clz_lease_apply_info lai
LEFT JOIN clz_lease_apply_details lad ON lai.id = lad.parent_id
@ -699,17 +708,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mm.ma_id as maId,
mm.ma_code as maCode,
mm.type_id as typeId,
mm.ma_status as maStatus,
mm.qr_code as qrCode,
case when mm.ma_status = '1' then '在库'
else ''
end as statusName,
'1' as maStatus,
mm.qr_code as qrCode,
'在库' as statusName,
mt.manage_type as manageType
FROM ma_machine mm
LEFT JOIN slt_agreement_info sai ON mm.ma_id = sai.ma_id
and mm.type_id = sai.type_id
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.del_flag = '0'
where
mm.qr_code = #{qrCode}
sai.`status` = '0' and mm.qr_code = #{qrCode}
<if test="typeId != null and typeId != ''">
and mt.type_id = #{typeId}
</if>
@ -739,7 +748,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.pro_name as projectName,
lai.lease_person as leasePerson,
lod.create_by as outPerson,
lai.`code` as code
lai.`code` as code,
bp.imp_unit as impUnit,
bt.bzz_idcard as idCard
FROM
clz_lease_out_details lod
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
@ -947,11 +958,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and sai.ma_id = lod.ma_id
LEFT JOIN clz_bm_agreement_info ba ON sai.agreement_id = ba.agreement_id
WHERE
sai.status = '0'
AND mt.type_id = #{typeId}
mt.type_id = #{typeId}
AND ba.unit_id = #{teamId}
AND ba.project_id = #{proId}
GROUP BY mm.ma_code
GROUP BY mm.ma_id
</select>
<select id="selectPublishList" resultType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo">
@ -976,7 +986,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lai.task_id AS taskId,
lpd.lease_sign_url AS leaseSignUrl,
lpd.lease_sign_type AS leaseSignType,
tt.task_type AS taskType
tt.task_type AS taskType,
bp.external_id AS externalId,
bu.bzz_idcard AS idCard
FROM
lease_publish_details lpd
LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id

View File

@ -17,7 +17,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mm.inspect_man AS checkMan,
mm.out_fac_time AS outFacTime,
mm.create_time AS inputTime,
mm.ma_id AS maId
mm.ma_id AS maId,
bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard
FROM
slt_agreement_info sai
left join ma_machine mm ON sai.type_id = mm.type_id and mm.ma_id = sai.ma_id
@ -25,6 +27,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = 0
left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = 0
left join ma_type mt3 ON mt3.type_id = mt2.parent_id and mt3.del_flag = 0
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
WHERE sai.`status` = '0' and mm.ma_code is not NULL
<if test="keyWord != null and keyWord != ''">
and (
@ -62,6 +67,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
subquery1.proId AS proId,
subquery1.proName AS proName,
subquery1.externalId AS externalId,
subquery1.impUnit AS impUnit,
subquery1.idCard AS idCard,
IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0) AS storeNum,
IFNULL(subquery3.usNum, 0) AS usNum,
IFNULL(subquery1.usNum, 0) AS allNum,
@ -85,7 +92,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SUM(IFNULL( sai.num, 0 )) AS usNum,
bp.pro_name as proName,
bp.pro_id as proId,
bp.external_id as externalId
bp.external_id as externalId,
bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard
FROM
slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
@ -94,6 +103,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
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
AND bu.del_flag = '0'
WHERE
sai.`status` = '0'
AND sai.end_time IS NULL
@ -114,7 +125,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SUM(IFNULL( sai.num, 0 )) AS usNum,
bp.pro_name as proName,
bp.pro_id as proId,
bp.external_id as externalId
bp.external_id as externalId,
bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard
FROM
clz_slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
@ -123,6 +136,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN clz_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
AND bu.del_flag = '0'
WHERE
sai.`status` = '0'
AND sai.end_time IS NULL
@ -216,11 +231,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_name AS typeModelName,
mt2.type_name AS typeName,
SUM(IFNULL(sai.num, 0)) AS usNum,
mt2.type_id AS typeId
mt2.type_id AS typeId,
bp.imp_unit AS impUnit,
bt.bzz_idcard AS idCard
FROM
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
clz_slt_agreement_info sai
LEFT JOIN clz_bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_unit bt ON bai.unit_id = bt.unit_id
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
WHERE
@ -253,11 +271,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mm.ma_code AS maCode,
mm.this_check_time AS thisCheckTime,
mm.next_check_time AS nextCheckTime,
mt.manage_type AS manageType
mt.manage_type AS manageType,
bp.imp_unit AS impUnit,
bt.bzz_idcard AS idCard
FROM
clz_slt_agreement_info sai
LEFT JOIN clz_bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_unit bt ON bai.unit_id = bt.unit_id
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_machine mm ON mm.ma_id = sai.ma_id
@ -273,9 +294,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="teamName != null">
AND bt.unit_name LIKE concat('%',#{teamName},'%')
</if>
<if test="teamLeaderIdCard != null">
AND bt.bzz_idcard = #{teamLeaderIdCard}
</if>
<if test="keyWord != null and keyWord != ''">
AND (
mt2.type_name LIKE concat('%',#{keyWord},'%')
@ -287,7 +305,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY
mt.type_name,
mt2.type_name,
mm.ma_code
mm.ma_id
</select>
<select id="getTeamData" resultType="com.bonus.material.clz.domain.BmTeam">
@ -300,114 +318,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LIMIT 1
</select>
<select id="getToolsLedgerListByTeam" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
SELECT
COALESCE(t1.typeName, t2.typeName) AS typeName,
COALESCE(t1.typeModelName, t2.typeModelName) AS typeModelName,
COALESCE(t1.typeId, t2.typeId) AS typeId,
COALESCE(t1.thirdTypeId, t2.thirdTypeId) AS thirdTypeId,
CASE COALESCE(t1.manageType, t2.manageType)
WHEN 0 THEN
'编码'
ELSE
'数量'
END manageType,
COALESCE(t1.buyPrice, t2.buyPrice) AS buyPrice,
COALESCE(t1.unit, t2.unit) AS unit,
COALESCE(t1.storeNum, 0) - COALESCE(t2.storeNum, 0) AS storeNum
FROM (
SELECT
mt2.type_name as typeName,
mt1.type_name as typeModelName,
lod.type_id as typeId,
mt2.type_id as thirdTypeId,
mt1.manage_type as manageType,
mt1.buy_price as buyPrice,
mt1.unit_name as unit,
SUM(lod.out_num) as storeNum
FROM clz_lease_out_details lod
LEFT JOIN clz_lease_apply_info lai ON lai.id = lod.parent_id
LEFT JOIN ma_type mt1 ON mt1.type_id = lod.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
WHERE lai.team_id = #{id}
AND lod.is_finished = '1'
GROUP BY lod.type_id
) AS t1
LEFT JOIN (
SELECT
mt2.type_name as typeName,
mt1.type_name as typeModelName,
bcd.type_id as typeId,
mt2.type_id as thirdTypeId,
mt1.manage_type as manageType,
mt1.buy_price as buyPrice,
mt1.unit_name as unit,
SUM(bcd.back_num) as storeNum
FROM clz_back_check_details bcd
LEFT JOIN clz_back_apply_info bai ON bai.id = bcd.parent_id
LEFT JOIN tm_task tt ON tt.task_id = bai.task_id
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
LEFT JOIN clz_bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
LEFT JOIN ma_type mt1 ON mt1.type_id = bcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
WHERE bagi.unit_id = #{id}
AND bcd.is_finished = '1'
GROUP BY bcd.type_id
) AS t2 ON t1.typeId = t2.typeId
UNION
SELECT
COALESCE(t1.typeName, t2.typeName) AS typeName,
COALESCE(t1.typeModelName, t2.typeModelName) AS typeModelName,
COALESCE(t1.typeId, t2.typeId) AS typeId,
COALESCE(t1.thirdTypeId, t2.thirdTypeId) AS thirdTypeId,
COALESCE(t1.manageType, t2.manageType) AS manageType,
COALESCE(t1.buyPrice, t2.buyPrice) AS buyPrice,
COALESCE(t1.unit, t2.unit) AS unit,
COALESCE(t1.storeNum, 0) - COALESCE(t2.storeNum, 0) AS diff_num
FROM (
SELECT
mt2.type_name as typeName,
mt1.type_name as typeModelName,
lod.type_id as typeId,
mt2.type_id as thirdTypeId,
mt1.manage_type as manageType,
mt1.buy_price as buyPrice,
mt1.unit_name as unit,
SUM(lod.out_num) as storeNum
FROM clz_lease_out_details lod
LEFT JOIN clz_lease_apply_info lai ON lai.id = lod.parent_id
LEFT JOIN ma_type mt1 ON mt1.type_id = lod.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
WHERE lai.team_id = #{id}
AND lod.is_finished = '1'
GROUP BY lod.type_id
) AS t1
RIGHT JOIN (
SELECT
mt2.type_name as typeName,
mt1.type_name as typeModelName,
bcd.type_id as typeId,
mt2.type_id as thirdTypeId,
mt1.manage_type as manageType,
mt1.buy_price as buyPrice,
mt1.unit_name as unit,
SUM(bcd.back_num) as storeNum
FROM clz_back_check_details bcd
LEFT JOIN clz_back_apply_info bai ON bai.id = bcd.parent_id
LEFT JOIN tm_task tt ON tt.task_id = bai.task_id
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
LEFT JOIN clz_bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
LEFT JOIN ma_type mt1 ON mt1.type_id = bcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
WHERE bagi.unit_id = #{id}
AND bcd.is_finished = '1'
GROUP BY bcd.type_id
) AS t2 ON t1.typeId = t2.typeId
WHERE t1.typeId IS NULL
</select>
<select id="getToolsLedgerList"
resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
SELECT
@ -427,64 +337,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
'编码'
ELSE
'数量'
END manageType
END manageType,
subquery1.impUnit AS impUnit,
subquery1.idCard AS idCard
FROM ma_type mt
LEFT JOIN (
SELECT
subquery1.type_id,
subquery1.constructionType,
subquery1.firstTypeId,
subquery1.materialType,
subquery1.secondTypeId,
subquery1.typeName,
subquery1.thirdTypeId,
subquery1.typeModelName,
IFNULL(subquery1.outNum, 0) AS outNum,
IFNULL(subquery2.backNum, 0) AS backNum,
CASE
WHEN IFNULL(subquery1.outNum, 0) - IFNULL(subquery2.backNum, 0) > 0 THEN
IFNULL(subquery1.outNum, 0) - IFNULL(subquery2.backNum, 0)
ELSE 0
END AS usNum
FROM (
SELECT
mt.type_id,
mt4.type_name AS constructionType,
mt4.type_id AS firstTypeId,
mt3.type_name AS materialType,
mt3.type_id AS secondTypeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL(lod.out_num, 0)) AS outNum
FROM lease_out_details lod
LEFT JOIN ma_type mt ON mt.type_id = lod.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
GROUP BY mt.type_id) AS subquery1
LEFT JOIN (
SELECT
mt.type_id,
mt4.type_name AS constructionType,
mt4.type_id AS firstTypeId,
mt4.type_id AS firstTypeId,
mt3.type_name AS materialType,
mt3.type_id AS secondTypeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL(bcd.back_num, 0)) backNum
FROM back_check_details bcd
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
mt3.type_id AS secondTypeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL( sai.num, 0 )) AS usNum,
bp.imp_unit AS impUnit,
bt.bzz_idcard AS idCard
FROM
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_unit bt ON bai.unit_id = bt.unit_id
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 mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
WHERE bcd.is_finished = '1'
GROUP BY mt.type_id) AS subquery2
ON subquery1.type_id = subquery2.type_id) AS subquery1
WHERE
sai.`status` = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
GROUP BY mt.type_id ) AS subquery1
ON mt.type_id = subquery1.type_id
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
@ -615,7 +499,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY
mt.type_name,
mt1.type_name,
mm.ma_code
mm.ma_id
</select>
<select id="selectStatusById" resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
@ -714,4 +598,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY parent_id
LIMIT 1
</select>
<select id="selectStatusByUserId" resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
SELECT
type_id as typeId,
ma_id as maId,
status as status
FROM clz_slt_agreement_info
WHERE status = '1' and ma_id = #{maId}
</select>
</mapper>

View File

@ -210,6 +210,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<insert id="insertLeaseSign" parameterType="com.bonus.common.biz.domain.lease.LeaseApplyInfo" useGeneratedKeys="true" keyProperty="leaseSignId">
insert into lease_sign_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="leaseSignUrl != null and leaseSignUrl != ''">lease_sign_url,</if>
<if test="leaseSignType != null">lease_sign_type,</if>
<if test="signPerson != null and signPerson != ''">lease_user,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="leaseSignUrl != null and leaseSignUrl != ''">#{leaseSignUrl},</if>
<if test="leaseSignType != null">#{leaseSignType},</if>
<if test="signPerson != null and signPerson != ''">#{signPerson},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateLeaseApplyInfo" parameterType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
update lease_apply_info
<trim prefix="SET" suffixOverrides=",">
@ -497,6 +515,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where su.user_id = #{confirmPerson} and su.del_flag = 0
</select>
<select id="selectNoSignList" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
SELECT
GROUP_CONCAT( DISTINCT lod.id ) AS ids,
lai.id AS id,
lai.CODE AS CODE,
lai.create_by AS createBy,
lai.create_time AS createTime,
lai.lease_person AS leasePerson,
lai.phone AS phone,
bai.unit_id AS leaseUnitId,
bai.project_id AS leaseProjectId,
bu.unit_name AS leaseUnit,
bp.pro_name AS leaseProject,
bai.agreement_code AS agreementCode,
IFNULL( sum( lod.out_num ), 0 ) AS alNum,
GROUP_CONCAT( DISTINCT mt1.type_name ) AS maTypeNames,
lai.task_id AS taskId,
tt.task_type AS taskType,
bp.external_id AS externalId,
bu.bzz_idcard AS idCard
FROM
lease_out_details lod
LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
AND mt1.del_flag = '0'
WHERE
lod.lease_sign_id is null
<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>
GROUP BY
lod.parent_id
ORDER BY
lod.create_time DESC
</select>
<update id="confirmLeaseTask">
update
lease_out_details

View File

@ -265,6 +265,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</set>
where id = #{maId}
</update>
<update id="updateLeaseOutSign">
update lease_out_details
<trim prefix="SET" suffixOverrides=",">
<if test="createTime != null">update_time = #{createTime},</if>
<if test="leaseSignId != null">lease_sign_id = #{leaseSignId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteLeaseOutDetailsById" parameterType="Long">
delete from lease_out_details where id = #{id}