材料站优化
This commit is contained in:
parent
bd953a8796
commit
040b69d594
|
|
@ -9,12 +9,9 @@ import com.bonus.common.core.web.controller.BaseController;
|
|||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.clz.domain.TeamVo;
|
||||
import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo;
|
||||
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo;
|
||||
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamVo;
|
||||
import com.bonus.material.clz.domain.vo.MaterialTotalMentInfo;
|
||||
import com.bonus.material.clz.domain.vo.*;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
import com.bonus.material.clz.domain.machine.MaterialStorageInfo;
|
||||
import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo;
|
||||
import com.bonus.material.clz.service.MaterialMachineService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -61,6 +58,11 @@ public class MaterialMachineController extends BaseController {
|
|||
@ApiOperation(value = "综合查询--保有设备总量查询")
|
||||
@GetMapping("/getRetainedEquipmentList")
|
||||
public AjaxResult getRetainedEquipmentList(MaterialRetainedEquipmentInfo bean) {
|
||||
if (bean != null) {
|
||||
if (bean.getIsApp() != null && bean.getIsApp() == 0) {
|
||||
return AjaxResult.success(materialMachineService.getRetainedEquipmentList(bean));
|
||||
}
|
||||
}
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getRetainedEquipmentList(bean);
|
||||
|
|
@ -389,4 +391,16 @@ public class MaterialMachineController extends BaseController {
|
|||
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getSubUnitList(bean);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分公司,项目部,工程下拉
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取分公司,项目部,工程下拉")
|
||||
@GetMapping("/getBranchList")
|
||||
public AjaxResult getBranchList(MaterialRetainedEquipmentInfo bean) {
|
||||
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getBranchList(bean);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,4 +251,10 @@ public class MaterialRetainedEquipmentInfo {
|
|||
|
||||
@ApiModelProperty(value = "报告路径")
|
||||
private String reportUrl;
|
||||
|
||||
@ApiModelProperty(value = "项目部集合")
|
||||
private List<MaterialRetainedEquipmentInfo> departNameList;
|
||||
|
||||
@ApiModelProperty(value = "工程集合")
|
||||
private List<MaterialRetainedEquipmentInfo> proNameList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -396,4 +396,11 @@ public interface MaterialLeaseInfoMapper {
|
|||
void updateLeaseRemarkLY(MaterialLeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
void updateLeaseRemarkLL(MaterialLeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 根据parentId和typeId查询详情备注数据
|
||||
* @param detail
|
||||
* @return
|
||||
*/
|
||||
MaterialLeaseApplyDetails getOutDetail(MaterialLeaseApplyDetails detail);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,4 +171,11 @@ public interface MaterialMachineService {
|
|||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getSubUnitList(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
/**
|
||||
* 获取分公司,项目部,工程下拉
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getBranchList(MaterialRetainedEquipmentInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -568,6 +568,11 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
|
||||
leaseApplyRequestVo.setLeaseOutDetailsList(outDetailsList);
|
||||
for (MaterialLeaseApplyDetails detail : outDetailsList) {
|
||||
// 根据parentId和typeId查询详情备注数据
|
||||
MaterialLeaseApplyDetails outDetail = materialLeaseInfoMapper.getOutDetail(detail);
|
||||
if (outDetail != null) {
|
||||
detail.setRemark(StringUtils.isNotBlank(outDetail.getRemark()) ? outDetail.getRemark() : null);
|
||||
}
|
||||
long outDetailStart = System.currentTimeMillis();
|
||||
// 直接使用已有的批量查询结果,无需再次查询数据库!
|
||||
List<MaterialLeaseMaCodeDto> maCodeVoList = maCodeMap.get(detail.getTypeId());
|
||||
|
|
|
|||
|
|
@ -1017,6 +1017,94 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
return materialMachineMapper.getSubUnitList(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MaterialRetainedEquipmentInfo> getBranchList(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);
|
||||
}*/
|
||||
List<MaterialRetainedEquipmentInfo> impUnitNameList = materialMachineMapper.getImpUnitNameList(bean);
|
||||
// 处理分公司列表,为每个分公司添加项目部和项目信息,
|
||||
impUnitNameList.forEach(impUnit -> {
|
||||
// 设置分公司名称(如果有)
|
||||
setImpUnitProperties(impUnit, bean);
|
||||
|
||||
// 查询并处理项目部
|
||||
List<MaterialRetainedEquipmentInfo> departNameList = materialMachineMapper.getDepartNameList(impUnit);
|
||||
if (CollectionUtils.isNotEmpty(departNameList)) {
|
||||
impUnit.setDepartNameList(departNameList);
|
||||
departNameList.forEach(dept -> processDepartment(dept, bean));
|
||||
}
|
||||
});
|
||||
// 如果该公司未查询到项目部,则移出该公司名称
|
||||
impUnitNameList.removeIf(impUnit -> CollectionUtils.isEmpty(impUnit.getDepartNameList()));
|
||||
return impUnitNameList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置分公司名称(如果有)
|
||||
* @param impUnit
|
||||
* @param bean
|
||||
*/
|
||||
private void setImpUnitProperties(MaterialRetainedEquipmentInfo impUnit, MaterialRetainedEquipmentInfo bean) {
|
||||
if (impUnit != null && bean != null && StringUtils.isNotBlank(bean.getDepartName())) {
|
||||
impUnit.setDepartName(bean.getDepartName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理项目部
|
||||
* @param dept
|
||||
* @param bean
|
||||
*/
|
||||
private void processDepartment(MaterialRetainedEquipmentInfo dept, MaterialRetainedEquipmentInfo bean) {
|
||||
// 设置项目部属性
|
||||
setDepartmentProperties(dept, bean);
|
||||
|
||||
// 查询并设置项目信息
|
||||
List<MaterialRetainedEquipmentInfo> projectNameList = materialMachineMapper.getProjectList(dept);
|
||||
if (CollectionUtils.isNotEmpty(projectNameList)) {
|
||||
dept.setDepartNameList(projectNameList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置项目部属性
|
||||
* @param dept
|
||||
* @param bean
|
||||
*/
|
||||
private void setDepartmentProperties(MaterialRetainedEquipmentInfo dept, MaterialRetainedEquipmentInfo bean) {
|
||||
if (dept != null && bean != null) {
|
||||
if (StringUtils.isNotBlank(bean.getDepartName())) {
|
||||
dept.setDepartName(bean.getDepartName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bean.getImpUnitName())) {
|
||||
dept.setImpUnitName(bean.getImpUnitName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bean.getProName())) {
|
||||
dept.setProName(bean.getProName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否具有特殊角色
|
||||
* @param userRoles
|
||||
|
|
|
|||
|
|
@ -115,5 +115,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE bpl.pro_id = #{proId} AND bpl.del_flag = '0'
|
||||
and bu.unit_name is not null
|
||||
and bu.unit_id is not null
|
||||
GROUP BY bu.unit_name
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1403,4 +1403,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.type_id,
|
||||
sai.agreement_id
|
||||
</select>
|
||||
|
||||
<select id="getOutDetail" resultType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetails">
|
||||
SELECT
|
||||
parent_id AS parentId,
|
||||
type_id AS typeId,
|
||||
remark AS remark
|
||||
FROM
|
||||
clz_lease_apply_details
|
||||
WHERE
|
||||
parent_id = #{parentId}
|
||||
AND type_id = #{typeId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bp.pro_name as leaseProject,
|
||||
bp.pro_center AS departName,
|
||||
mt3.type_name AS materialName,
|
||||
mt2.type_name AS typeName,
|
||||
mt1.type_name AS typeCode,
|
||||
mt1.type_name AS typeName,
|
||||
mt.type_name AS maModel,
|
||||
mm.ma_code AS maCode,
|
||||
mm.qr_code AS qrCode,
|
||||
|
|
@ -39,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE sai.`status` = '0' and mm.ma_code is not NULL
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
mt2.type_name like concat('%',#{keyWord},'%') or
|
||||
mt1.type_name like concat('%',#{keyWord},'%') or
|
||||
mm.inspect_man like concat('%',#{keyWord},'%') or
|
||||
mm.ma_code like concat('%',#{keyWord},'%')
|
||||
)
|
||||
|
|
@ -751,7 +750,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.manage_type AS manageType,
|
||||
-- 计算status的CASE表达式
|
||||
CASE
|
||||
WHEN mm.next_check_time < CURDATE() THEN 3 -- 已超过当前时间
|
||||
-- WHEN mm.next_check_time < CURDATE() THEN 3 -- 已超过当前时间
|
||||
WHEN DATEDIFF(mm.next_check_time, CURDATE()) <= 30 THEN 2 -- 相差不足1个月
|
||||
WHEN DATEDIFF(mm.next_check_time, CURDATE()) <= 90 THEN 1 -- 相差不足3个月
|
||||
ELSE 0 -- 相差3个月以上
|
||||
|
|
@ -1377,6 +1376,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="impUnit != null and impUnit != ''">
|
||||
and bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
<if test="jiJuType != null and jiJuType != ''">
|
||||
AND mt.jiju_type = #{jiJuType}
|
||||
</if>
|
||||
GROUP BY mt.type_id,
|
||||
bp.pro_id
|
||||
) AS subquery1 ON mt.type_id = subquery1.type_id
|
||||
|
|
@ -1442,6 +1444,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="impUnit != null and impUnit != ''">
|
||||
and bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
<if test="jiJuType != null and jiJuType != ''">
|
||||
AND mt.jiju_type = #{jiJuType}
|
||||
</if>
|
||||
GROUP BY mt.type_id,
|
||||
bp.pro_id
|
||||
) AS subquery3
|
||||
|
|
@ -1540,6 +1545,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="impUnit != null and impUnit != ''">
|
||||
AND bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
<if test="jiJuType != null and jiJuType != ''">
|
||||
AND mt.jiju_type = #{jiJuType}
|
||||
</if>
|
||||
GROUP BY mt.type_id,
|
||||
bu.unit_name,
|
||||
bp.pro_name
|
||||
|
|
@ -1648,7 +1656,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
AND bp.pro_name = #{proName}
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND df.project_dept LIKE CONCAT('%', #{departName}, '%')
|
||||
|
|
|
|||
Loading…
Reference in New Issue