功能优化
This commit is contained in:
parent
76490ac8c7
commit
ee5d6414d7
|
|
@ -329,4 +329,64 @@ public class MaterialMachineController extends BaseController {
|
|||
ExcelUtil<TeamVo> util = new ExcelUtil<>(TeamVo.class);
|
||||
util.exportExcel(response, list, "导出班组进出场记录");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分公司下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取分公司下拉选")
|
||||
@GetMapping("/getImpUnitNameList")
|
||||
public AjaxResult getImpUnitNameList(MaterialRetainedEquipmentInfo bean) {
|
||||
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getImpUnitNameList(bean);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目部下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取项目部下拉选")
|
||||
@GetMapping("/getDepartNameList")
|
||||
public AjaxResult getDepartNameList(MaterialRetainedEquipmentInfo bean) {
|
||||
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getDepartNameList(bean);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工程下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取工程下拉选")
|
||||
@GetMapping("/getProjectList")
|
||||
public AjaxResult getProjectList(MaterialRetainedEquipmentInfo bean) {
|
||||
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getProjectList(bean);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取班组下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取班组下拉选")
|
||||
@GetMapping("/getTeamList")
|
||||
public AjaxResult getTeamList(MaterialRetainedEquipmentInfo bean) {
|
||||
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getTeamList(bean);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分包单位下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取分包单位下拉选")
|
||||
@GetMapping("/getSubUnitList")
|
||||
public AjaxResult getSubUnitList(MaterialRetainedEquipmentInfo bean) {
|
||||
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getSubUnitList(bean);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,4 +221,39 @@ public interface MaterialMachineMapper {
|
|||
* @return
|
||||
*/
|
||||
List<MaterialStorageInfo> getMaCodeDetails(MaterialStorageInfo bean);
|
||||
|
||||
/**
|
||||
* 获取分公司下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getImpUnitNameList(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
/**
|
||||
* 获取项目部下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getDepartNameList(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
/**
|
||||
* 获取工程下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getProjectList(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
/**
|
||||
* 获取班组下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getTeamList(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
/**
|
||||
* 获取分包单位下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getSubUnitList(MaterialRetainedEquipmentInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,4 +136,39 @@ public interface MaterialMachineService {
|
|||
* @return
|
||||
*/
|
||||
List<TeamVo> getTeamInOrOutInfo(TeamVo bean);
|
||||
|
||||
/**
|
||||
* 获取分公司下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getImpUnitNameList(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
/**
|
||||
* 获取项目部下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getDepartNameList(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
/**
|
||||
* 获取工程下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getProjectList(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
/**
|
||||
* 获取班组下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getTeamList(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
/**
|
||||
* 获取分包单位下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getSubUnitList(MaterialRetainedEquipmentInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,42 +161,13 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
}
|
||||
}
|
||||
}
|
||||
String deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId().toString();
|
||||
Set<String> targetUnits = new HashSet<>(Arrays.asList(
|
||||
"101", "102", "309", "327", "330", "333", "337", "338",
|
||||
"339", "340", "341", "342", "344", "345", "346", "347",
|
||||
"348", "349"
|
||||
));
|
||||
if (targetUnits.contains(deptId)) {
|
||||
bean.setImpUnit(deptId);
|
||||
} else {
|
||||
//判断祖籍是否包含分公司
|
||||
String ancestors = mapper.getAncestors(deptId);
|
||||
if (ancestors != null && !ancestors.isEmpty()) {
|
||||
// 将ancestors转换为集合
|
||||
String[] parts = ancestors.split(",");
|
||||
for (String part : parts) {
|
||||
String trimmedPart = part.trim();
|
||||
// Check if the trimmed part is in our target set
|
||||
if (targetUnits.contains(trimmedPart)) {
|
||||
bean.setImpUnit(trimmedPart);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
// 查询目前在用的设备信息
|
||||
List<MaterialRetainedEquipmentInfo> usList = materialMachineMapper.getUsInfoList(bean);
|
||||
//查询目前还有库存的设备
|
||||
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainInfoList(bean);
|
||||
if (!CollectionUtils.isEmpty(usList)) {
|
||||
for (MaterialRetainedEquipmentInfo materialRetainedEquipmentInfo : usList) {
|
||||
// 根据班组名称查询分包单位
|
||||
String subUnitName = iwsTeamUserMapper.getTeamName(materialRetainedEquipmentInfo.getTeamName());
|
||||
materialRetainedEquipmentInfo.setSubUnitName(subUnitName);
|
||||
}
|
||||
}
|
||||
// 数据合并
|
||||
if (!CollectionUtils.isEmpty(recordList)) {
|
||||
usList.addAll(recordList);
|
||||
|
|
@ -208,14 +179,6 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
String subUnitName = bean.getSubUnitName();
|
||||
|
||||
if (!CollectionUtils.isEmpty(usList)) {
|
||||
usList = usList.stream()
|
||||
.filter(item -> StringUtils.isBlank(subUnitName)
|
||||
|| (item.getSubUnitName() != null && item.getSubUnitName().contains(subUnitName)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return usList;
|
||||
}
|
||||
|
|
@ -800,37 +763,9 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
}
|
||||
}
|
||||
}
|
||||
String deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId().toString();
|
||||
Set<String> targetUnits = new HashSet<>(Arrays.asList(
|
||||
"101", "102", "309", "327", "330", "333", "337", "338",
|
||||
"339", "340", "341", "342", "344", "345", "346", "347",
|
||||
"348", "349"
|
||||
));
|
||||
if (targetUnits.contains(deptId)) {
|
||||
bean.setImpUnit(deptId);
|
||||
} else {
|
||||
//判断祖籍是否包含分公司
|
||||
String ancestors = mapper.getAncestors(deptId);
|
||||
if (ancestors != null && !ancestors.isEmpty()) {
|
||||
// 将ancestors转换为集合
|
||||
String[] parts = ancestors.split(",");
|
||||
for (String part : parts) {
|
||||
String trimmedPart = part.trim();
|
||||
// Check if the trimmed part is in our target set
|
||||
if (targetUnits.contains(trimmedPart)) {
|
||||
bean.setImpUnit(trimmedPart);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
// 获取项目部总数
|
||||
Integer departNum = materialMachineMapper.selectDepartNum(bean);
|
||||
// 获取工程总数
|
||||
//Integer projectNum = materialMachineMapper.selectProjectNum(bean);
|
||||
// 获取班组总数
|
||||
//Integer teamNum = materialMachineMapper.selectTeamNum(bean);
|
||||
// 获取在用量
|
||||
MaterialRetainedEquipmentInfo useInfo = materialMachineMapper.getRetainTotalInfo(bean);
|
||||
BigDecimal useNum = (useInfo != null && useInfo.getUsNum() != null) ?
|
||||
|
|
@ -838,6 +773,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
|
||||
//查询目前还有库存的设备
|
||||
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainInfoList(bean);
|
||||
List<MaterialRetainedEquipmentInfo> infos = new ArrayList<>();
|
||||
BigDecimal storeNum = BigDecimal.ZERO;
|
||||
if (CollectionUtils.isNotEmpty(recordList)) {
|
||||
// 将recordList中storeNum大于0的数据过滤出来,并对总数求和
|
||||
|
|
@ -847,13 +783,22 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
.reduce(BigDecimal::add)
|
||||
.orElse(BigDecimal.ZERO);
|
||||
// 获取到recordList中externalId不为null且去重的总数(转换为Integer类型)
|
||||
long externalIdNum = recordList.stream()
|
||||
info.setProNum((int) recordList.stream()
|
||||
.map(MaterialRetainedEquipmentInfo::getProName)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.count();
|
||||
// 将externalIdNum转换为Integer类型
|
||||
info.setProNum((int) externalIdNum);
|
||||
.count());
|
||||
// 获取集合中departName不为空,且去重的数据存放在新集合中
|
||||
List<MaterialRetainedEquipmentInfo> distinctDepartNames = recordList.stream()
|
||||
// 过滤出departName不为空的元素
|
||||
.filter(entity -> StringUtils.isNotBlank(entity.getDepartName()))
|
||||
// 根据departName进行去重
|
||||
.distinct()
|
||||
// 收集到新的List集合中
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(distinctDepartNames)) {
|
||||
infos.addAll(distinctDepartNames);
|
||||
}
|
||||
} else {
|
||||
info.setProNum(0);
|
||||
}
|
||||
|
|
@ -861,23 +806,72 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
List<MaterialRetainedEquipmentInfo> usList = materialMachineMapper.getUsInfoList(bean);
|
||||
if (CollectionUtils.isNotEmpty(usList)) {
|
||||
// 获取usList中的班组id,且去重的数量
|
||||
long teamNum = usList.stream()
|
||||
info.setTeamNum((int) usList.stream()
|
||||
.map(MaterialRetainedEquipmentInfo::getTeamId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.count();
|
||||
info.setTeamNum((int) teamNum);
|
||||
.count());
|
||||
// 获取集合中departName不为空,且去重的数据存放在新集合中
|
||||
List<MaterialRetainedEquipmentInfo> userInfoList = usList.stream()
|
||||
// 过滤出departName不为空的元素
|
||||
.filter(entity -> StringUtils.isNotBlank(entity.getDepartName()))
|
||||
// 根据departName进行去重
|
||||
.distinct()
|
||||
// 收集到新的List集合中
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(userInfoList)) {
|
||||
infos.addAll(userInfoList);
|
||||
}
|
||||
} else {
|
||||
info.setTeamNum(0);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(infos)) {
|
||||
info.setDepartNum((int) infos.stream()
|
||||
.map(MaterialRetainedEquipmentInfo::getDepartName)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.count());
|
||||
} else {
|
||||
info.setDepartNum(0);
|
||||
}
|
||||
// 设置结果
|
||||
info.setInNum(storeNum);
|
||||
info.setUseNum(useNum);
|
||||
info.setDepartNum(departNum);
|
||||
info.setAllNum(storeNum.add(useNum));
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门查询赋值
|
||||
* @param bean
|
||||
*/
|
||||
private void extractedDept(MaterialRetainedEquipmentInfo bean) {
|
||||
String deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId().toString();
|
||||
Set<String> targetUnits = new HashSet<>(Arrays.asList(
|
||||
"101", "102", "309", "327", "330", "333", "337", "338",
|
||||
"339", "340", "341", "342", "344", "345", "346", "347",
|
||||
"348", "349"
|
||||
));
|
||||
if (targetUnits.contains(deptId)) {
|
||||
bean.setImpUnit(deptId);
|
||||
} else {
|
||||
//判断祖籍是否包含分公司
|
||||
String ancestors = mapper.getAncestors(deptId);
|
||||
if (ancestors != null && !ancestors.isEmpty()) {
|
||||
// 将ancestors转换为集合
|
||||
String[] parts = ancestors.split(",");
|
||||
for (String part : parts) {
|
||||
String trimmedPart = part.trim();
|
||||
// Check if the trimmed part is in our target set
|
||||
if (targetUnits.contains(trimmedPart)) {
|
||||
bean.setImpUnit(trimmedPart);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 班组进出场记录
|
||||
* @param bean
|
||||
|
|
@ -888,6 +882,141 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
return materialMachineMapper.getTeamInOrOutInfo(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分公司下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MaterialRetainedEquipmentInfo> getImpUnitNameList(MaterialRetainedEquipmentInfo bean) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
if (!CollectionUtils.isEmpty(departId)) {
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
return materialMachineMapper.getImpUnitNameList(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目部下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MaterialRetainedEquipmentInfo> getDepartNameList(MaterialRetainedEquipmentInfo bean) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
if (!CollectionUtils.isEmpty(departId)) {
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
return materialMachineMapper.getDepartNameList(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工程下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MaterialRetainedEquipmentInfo> getProjectList(MaterialRetainedEquipmentInfo bean) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
if (!CollectionUtils.isEmpty(departId)) {
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
return materialMachineMapper.getProjectList(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取班组下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MaterialRetainedEquipmentInfo> getTeamList(MaterialRetainedEquipmentInfo bean) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
if (!CollectionUtils.isEmpty(departId)) {
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
return materialMachineMapper.getTeamList(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分包单位下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MaterialRetainedEquipmentInfo> getSubUnitList(MaterialRetainedEquipmentInfo bean) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
if (!CollectionUtils.isEmpty(departId)) {
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
return materialMachineMapper.getSubUnitList(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否具有特殊角色
|
||||
* @param userRoles
|
||||
|
|
|
|||
|
|
@ -1183,7 +1183,8 @@ public class RepairServiceImpl implements RepairService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult endRepairTask(@NotNull List<RepairTask> taskList) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
||||
// 修试审核标志
|
||||
boolean isWSFlag = false;
|
||||
try {
|
||||
// 1.查询选择任务是否还有未完成维修的数据
|
||||
for (RepairTask task : taskList) {
|
||||
|
|
@ -1197,6 +1198,10 @@ public class RepairServiceImpl implements RepairService {
|
|||
repairedNum = repairedNum.add(repairTaskDetails.getRepairedNum());
|
||||
scrapNum = scrapNum.add(repairTaskDetails.getScrapNum());
|
||||
taskCode = repairTaskDetails.getTaskCode();
|
||||
List<RepairTaskDetails> list = repairMapper.getAuditDetailsById(repairTaskDetails);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
isWSFlag = true;
|
||||
}
|
||||
}
|
||||
if (repairedNum.add(scrapNum).compareTo(BigDecimal.ZERO) == 0) {
|
||||
return AjaxResult.error("维修单号" + taskCode + "还未进行维修,请先维修后再提交审核!");
|
||||
|
|
@ -1217,22 +1222,24 @@ public class RepairServiceImpl implements RepairService {
|
|||
List<RepairTaskDetails> repairTaskDetails = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(detailsList)) {
|
||||
task.setCreateBy(loginUser.getUserid());
|
||||
agreementId = repairMapper.getAgreementId(task);
|
||||
// 新增tm_task表数据、修饰审核任务、状态是待审核
|
||||
task.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR_AUDIT.getTaskTypeId());
|
||||
task.setTaskStatus(RepairTaskStatusEnum.TASK_STATUS_TO_EXAM.getStatus());
|
||||
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_REPAIR_AUDIT.getTaskTypeId());
|
||||
// 生成维修单号
|
||||
String code = genderWsTaskCode(thisMonthMaxOrder);
|
||||
task.setRepairCode(code);
|
||||
task.setMonthOrder(thisMonthMaxOrder + 1);
|
||||
// 插入之前的维修任务id标记前置任务
|
||||
task.setPreTaskId(task.getTaskId());
|
||||
// 注意:此处将会生成新的 taskId (审核入库用的)
|
||||
repairMapper.addTask(task);
|
||||
// 新增协议任务表tm_task_agreement--关联修饰任务与协议
|
||||
task.setAgreementId(agreementId);
|
||||
repairMapper.createAgreementTask(task);
|
||||
if (isWSFlag) {
|
||||
agreementId = repairMapper.getAgreementId(task);
|
||||
// 新增tm_task表数据、修饰审核任务、状态是待审核
|
||||
task.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR_AUDIT.getTaskTypeId());
|
||||
task.setTaskStatus(RepairTaskStatusEnum.TASK_STATUS_TO_EXAM.getStatus());
|
||||
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_REPAIR_AUDIT.getTaskTypeId());
|
||||
// 生成维修单号
|
||||
String code = genderWsTaskCode(thisMonthMaxOrder);
|
||||
task.setRepairCode(code);
|
||||
task.setMonthOrder(thisMonthMaxOrder + 1);
|
||||
// 插入之前的维修任务id标记前置任务
|
||||
task.setPreTaskId(task.getTaskId());
|
||||
// 注意:此处将会生成新的 taskId (审核入库用的)
|
||||
repairMapper.addTask(task);
|
||||
// 新增协议任务表tm_task_agreement--关联修饰任务与协议
|
||||
task.setAgreementId(agreementId);
|
||||
repairMapper.createAgreementTask(task);
|
||||
}
|
||||
// 新增审计记录
|
||||
for (RepairTaskDetails details : detailsList) {
|
||||
if (StringUtils.isNotBlank(details.getMaId())) {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
GROUP BY bzgl_bz.bzmc
|
||||
</select>
|
||||
|
||||
<select id="getTeamName" resultType="java.lang.String">
|
||||
|
|
|
|||
|
|
@ -1466,7 +1466,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ELSE
|
||||
'数量'
|
||||
END manageType,
|
||||
mt.unit_value AS unitValue
|
||||
mt.unit_value AS unitValue,
|
||||
bz.ssfbdw AS subUnitName
|
||||
FROM
|
||||
clz_slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
|
|
@ -1477,6 +1478,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id AND bu.del_flag = '0'
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
LEFT JOIN `micro-tool`.bzgl_bz bz ON bz.bzmc = bu.unit_name
|
||||
WHERE
|
||||
sai.`status` = '0'
|
||||
AND sai.end_time IS NULL
|
||||
|
|
@ -1501,6 +1503,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="typeModelName != null and typeModelName != ''">
|
||||
AND mt.type_name LIKE CONCAT('%', #{typeModelName}, '%')
|
||||
</if>
|
||||
<if test="subUnitName != null and subUnitName != ''">
|
||||
AND bz.ssfbdw LIKE CONCAT('%', #{subUnitName}, '%')
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
AND bp.external_id in
|
||||
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
|
||||
|
|
@ -1547,4 +1552,163 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getImpUnitNameList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
|
||||
SELECT
|
||||
DISTINCT sd.dept_name AS impUnitName
|
||||
FROM
|
||||
bm_project bp
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
WHERE
|
||||
sd.dept_name IS NOT NULL
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center LIKE CONCAT('%', #{departName}, '%')
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
AND bp.external_id in
|
||||
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="impUnit != null and impUnit != ''">
|
||||
AND bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
GROUP BY sd.dept_name
|
||||
</select>
|
||||
|
||||
<select id="getDepartNameList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
|
||||
SELECT
|
||||
DISTINCT bp.pro_center AS departName
|
||||
FROM
|
||||
bm_project bp
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
WHERE
|
||||
bp.pro_center IS NOT NULL
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center LIKE CONCAT('%', #{departName}, '%')
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
AND bp.external_id in
|
||||
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="impUnit != null and impUnit != ''">
|
||||
AND bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
GROUP BY bp.pro_center
|
||||
</select>
|
||||
|
||||
<select id="getProjectList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
|
||||
SELECT
|
||||
DISTINCT bp.pro_name AS proName
|
||||
FROM
|
||||
bm_project bp
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
WHERE
|
||||
bp.pro_center IS NOT NULL
|
||||
AND bp.external_id IS NOT NULL
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center LIKE CONCAT('%', #{departName}, '%')
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
AND bp.external_id in
|
||||
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="impUnit != null and impUnit != ''">
|
||||
AND bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
GROUP BY bp.pro_center
|
||||
</select>
|
||||
|
||||
<select id="getTeamList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
|
||||
SELECT DISTINCT
|
||||
bz.bzmc AS teamName,
|
||||
bz.project_name AS proName
|
||||
FROM
|
||||
`micro-tool`.bzgl_bz bz
|
||||
LEFT JOIN bm_project bp ON bz.project_id = bp.external_id
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
WHERE
|
||||
bz.bzmc IS NOT NULL
|
||||
AND bp.external_id IS NOT NULL
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center LIKE CONCAT('%', #{departName}, '%')
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
AND bp.external_id in
|
||||
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="subUnitName != null and subUnitName != ''">
|
||||
AND bz.ssfbdw LIKE CONCAT('%', #{subUnitName}, '%')
|
||||
</if>
|
||||
<if test="impUnit != null and impUnit != ''">
|
||||
AND bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
GROUP BY bz.bzmc
|
||||
</select>
|
||||
|
||||
<select id="getSubUnitList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
|
||||
SELECT DISTINCT
|
||||
bz.bzmc AS teamName,
|
||||
bz.ssfbdw AS subUnitName
|
||||
FROM
|
||||
`micro-tool`.bzgl_bz bz
|
||||
LEFT JOIN bm_project bp ON bz.project_id = bp.external_id
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
WHERE
|
||||
bz.bzmc IS NOT NULL
|
||||
AND bp.external_id IS NOT NULL
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center LIKE CONCAT('%', #{departName}, '%')
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
AND bp.external_id in
|
||||
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="subUnitName != null and subUnitName != ''">
|
||||
AND bz.ssfbdw LIKE CONCAT('%', #{subUnitName}, '%')
|
||||
</if>
|
||||
<if test="impUnit != null and impUnit != ''">
|
||||
AND bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
GROUP BY
|
||||
bz.ssfbdw
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue