材料站权限
This commit is contained in:
parent
d1d7d0f479
commit
492b4c4b92
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,4 +186,7 @@ public class MaterialBackApplyInfo implements Serializable {
|
|||
|
||||
@ApiModelProperty(value = "i8工程id")
|
||||
private String externalId;
|
||||
|
||||
@ApiModelProperty(value = "实施单位id")
|
||||
private String impUnit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -287,4 +287,7 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
|
|||
|
||||
@ApiModelProperty(value = "项目部id")
|
||||
private Long departId;
|
||||
|
||||
@ApiModelProperty(value = "实施单位id")
|
||||
private String impUnit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,4 +235,11 @@ public interface MaterialBackInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
MaterialBackApplyInfo selectByAgreementIdAndTypeId(MaCodeVo maCodeVo);
|
||||
|
||||
/**
|
||||
* 查询退料任务审核详情
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<MaCodeVo> getMachine(MaterialBackApplyInfo dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,13 +65,6 @@ public interface MaterialMachineMapper {
|
|||
*/
|
||||
BmTeam getTeamData(String username);
|
||||
|
||||
/**
|
||||
* 工器具台账查询
|
||||
* @param bmTeam
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getToolsLedgerListByTeam(BmTeam bmTeam);
|
||||
|
||||
/**
|
||||
* 工器具台账查询
|
||||
* @param bean
|
||||
|
|
|
|||
|
|
@ -113,4 +113,11 @@ public interface MaterialBackApplyInfoService {
|
|||
* @return
|
||||
*/
|
||||
AjaxResult submitBackApply(MaterialBackApplyInfo backApplyInfo);
|
||||
|
||||
/**
|
||||
* app编码检索
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getMachine(MaterialBackApplyInfo dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 -> 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 -> 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 -> 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
|
||||
|
|
|
|||
|
|
@ -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 -> 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 -> 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 -> username.equals(item.getIdCard()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
String keyWord = dto.getKeyWord();
|
||||
// 如果关键字不为空,进行过滤
|
||||
|
|
@ -734,15 +784,10 @@ 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() + "编码不符合出库条件,请检查后重新提交!";
|
||||
}
|
||||
} else {
|
||||
msg = "监测到" + bmQrcodeInfo.getQrCode() + "编码不符合出库条件,请检查后重新提交!";
|
||||
}
|
||||
// 返回包含设备列表和消息的结果
|
||||
Map<String, Object> result = new HashMap<>(2);
|
||||
result.put("recordList", recordList);
|
||||
|
|
@ -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 -> username.equals(item.getIdCard()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
// 处理数据并计算总和
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
|
|
|
|||
|
|
@ -96,6 +96,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 +105,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 +118,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 -> username.equals(item.getIdCard()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(recordList)) {
|
||||
for (MaterialRetainedEquipmentInfo retainedEquipmentInfo : recordList) {
|
||||
|
|
@ -204,7 +220,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 -> bean.getTeamLeaderIdCard().equals(item.getIdCard()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (MaterialRetainedEquipmentInfo retainedEquipmentInfo : list) {
|
||||
MaterialRetainedEquipmentInfo info = new MaterialRetainedEquipmentInfo();
|
||||
|
|
@ -225,7 +257,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 -> bean.getTeamLeaderIdCard().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());
|
||||
|
|
@ -277,22 +325,27 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
*/
|
||||
@Override
|
||||
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> list1 =new ArrayList<>();
|
||||
try {
|
||||
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) {
|
||||
// 根据用户名判断用户是否为班组长
|
||||
BmTeam teamData = materialMachineMapper.getTeamData(userName);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
|
||||
if (teamData != null) {
|
||||
// 将sortedList中班组身份证号与username相同的元素过滤处理
|
||||
list = list.stream()
|
||||
.filter(item -> userName.equals(item.getIdCard()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
list1 = groupByThirdTypeId(list);
|
||||
}
|
||||
return list1;
|
||||
|
|
@ -309,18 +362,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 -> username.equals(item.getIdCard()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
if (!CollectionUtil.isEmpty(list)) {
|
||||
for (MaterialRetainedEquipmentInfo retainedEquipmentInfo : list) {
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -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,
|
||||
'1' as maStatus,
|
||||
mm.qr_code as qrCode,
|
||||
case when mm.ma_status = '1' then '在库'
|
||||
else ''
|
||||
end as statusName,
|
||||
'在库' 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
|
||||
|
|
|
|||
|
|
@ -62,6 +62,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 +87,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 +98,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 +120,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 +131,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 +226,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 +266,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 +289,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 +300,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 +313,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,27 +332,12 @@ 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,
|
||||
|
|
@ -456,35 +346,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
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
|
||||
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
|
||||
GROUP BY mt.type_id) AS subquery1
|
||||
LEFT JOIN (
|
||||
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(bcd.back_num, 0)) backNum
|
||||
FROM back_check_details bcd
|
||||
LEFT JOIN ma_type mt ON mt.type_id = bcd.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
|
||||
|
|
|
|||
Loading…
Reference in New Issue