功能优化
This commit is contained in:
parent
5c540d2cf1
commit
d29122b150
|
|
@ -37,9 +37,6 @@ public class ComplexQueryController extends BaseController {
|
|||
@Resource
|
||||
private ComplexQueryService complexQueryService;
|
||||
|
||||
@Resource
|
||||
private LeaseApplyInfoMapper leaseApplyInfoMapper;
|
||||
|
||||
/**
|
||||
* 保有设备总量查询
|
||||
* @param bean
|
||||
|
|
@ -49,14 +46,7 @@ public class ComplexQueryController extends BaseController {
|
|||
@GetMapping("/getRetainedEquipmentList")
|
||||
public AjaxResult getRetainedEquipmentList(RetainedEquipmentInfo bean) {
|
||||
bean.setIsExport(1);
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
|
||||
List<Long> typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId);
|
||||
if (CollectionUtils.isEmpty(typeIdList)) {
|
||||
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
|
||||
} else {
|
||||
bean.setBindUserId(userId);
|
||||
}
|
||||
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
|
||||
if (bean.getIsApp() != null && bean.getIsApp() == 1) {
|
||||
List<RetainedEquipmentInfo> pageList = complexQueryService.getRetainedEquipmentList(bean);
|
||||
return AjaxResult.success(pageList);
|
||||
|
|
@ -75,14 +65,7 @@ public class ComplexQueryController extends BaseController {
|
|||
@GetMapping("/getRetainedEquipmentListNoPage")
|
||||
public AjaxResult getRetainedEquipmentListNoPage(RetainedEquipmentInfo bean) {
|
||||
bean.setIsExport(0);
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
|
||||
List<Long> typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId);
|
||||
if (CollectionUtils.isEmpty(typeIdList)) {
|
||||
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
|
||||
} else {
|
||||
bean.setBindUserId(userId);
|
||||
}
|
||||
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
|
||||
List<RetainedEquipmentInfo> list = complexQueryService.getRetainedEquipmentList(bean);
|
||||
RetainedEquipmentInfo dto = new RetainedEquipmentInfo();
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
|
|
@ -112,14 +95,7 @@ public class ComplexQueryController extends BaseController {
|
|||
@PostMapping("/exportRetainedEquipmentList")
|
||||
public void exportRetainedEquipmentList(HttpServletResponse response, RetainedEquipmentInfo bean)
|
||||
{
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
|
||||
List<Long> typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId);
|
||||
if (CollectionUtils.isEmpty(typeIdList)) {
|
||||
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
|
||||
} else {
|
||||
bean.setBindUserId(userId);
|
||||
}
|
||||
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
|
||||
bean.setIsExport(0);
|
||||
List<RetainedEquipmentInfo> list = complexQueryService.getRetainedEquipmentList(bean);
|
||||
ExcelUtil<RetainedEquipmentInfo> util = new ExcelUtil<>(RetainedEquipmentInfo.class);
|
||||
|
|
@ -188,9 +164,10 @@ public class ComplexQueryController extends BaseController {
|
|||
@ApiOperation(value = "综合查询--查询在修设备详情")
|
||||
@GetMapping("/getRepairRecordList")
|
||||
public AjaxResult getRepairRecordList(RepairStorageInfo bean) {
|
||||
startPage();
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||
List<RepairStorageInfo> list = complexQueryService.getRepairRecordList(bean);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class RepairStorageInfo {
|
|||
private BigDecimal dsNum;
|
||||
|
||||
@ApiModelProperty(value = "在修数量")
|
||||
@Excel(name = "在修数量", align = HorizontalAlignment.RIGHT)
|
||||
@Excel(name = "数量", align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal repairNum;
|
||||
|
||||
@ApiModelProperty(value = "购置单价")
|
||||
|
|
@ -67,4 +67,7 @@ public class RepairStorageInfo {
|
|||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
||||
@ApiModelProperty(value = "维修类型 1 定损 2 在修 3 修试待审核")
|
||||
private Integer type;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,10 +66,18 @@ public class RetainedEquipmentInfo {
|
|||
@Excel(name = "在用数量", align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal usNum;
|
||||
|
||||
@ApiModelProperty(value = "定损数量")
|
||||
@Excel(name = "定损数量", align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal dsNum;
|
||||
|
||||
@ApiModelProperty(value = "在修数量")
|
||||
@Excel(name = "在修数量", align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal repairNum;
|
||||
|
||||
@ApiModelProperty(value = "修试待审核数量")
|
||||
@Excel(name = "修试待审核数量", align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal repairAuditNum;
|
||||
|
||||
@ApiModelProperty(value = "新购待入库")
|
||||
@Excel(name = "新购待入库数量", align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal inputNum;
|
||||
|
|
|
|||
|
|
@ -233,4 +233,11 @@ public interface ComplexQueryMapper {
|
|||
* @return
|
||||
*/
|
||||
Type getTotalStorageNumLog(Type item);
|
||||
|
||||
/**
|
||||
* 获取修试待审核数量
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<RepairStorageInfo> getRepairAuditList(RepairStorageInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,7 +188,9 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
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);
|
||||
BigDecimal totalDsNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal totalRepairNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal totalRepairAuditNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal totalInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal totalRepairInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal totalPendingScrapNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
|
|
@ -205,7 +207,9 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
for (RetainedEquipmentInfo retainedEquipmentInfo : recordList) {
|
||||
totalStoreNum = totalStoreNum.add(retainedEquipmentInfo.getStoreNum());
|
||||
totalUsNum = totalUsNum.add(retainedEquipmentInfo.getUsNum());
|
||||
totalDsNum = totalDsNum.add(retainedEquipmentInfo.getDsNum());
|
||||
totalRepairNum = totalRepairNum.add(retainedEquipmentInfo.getRepairNum());
|
||||
totalRepairAuditNum = totalRepairAuditNum.add(retainedEquipmentInfo.getRepairAuditNum());
|
||||
totalInputNum = totalInputNum.add(retainedEquipmentInfo.getInputNum());
|
||||
totalRepairInputNum = totalRepairInputNum.add(retainedEquipmentInfo.getRepairInputNum());
|
||||
totalPendingScrapNum = totalPendingScrapNum.add(retainedEquipmentInfo.getPendingScrapNum());
|
||||
|
|
@ -264,7 +268,9 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
RetainedEquipmentInfo retainedEquipmentInfo = new RetainedEquipmentInfo();
|
||||
retainedEquipmentInfo.setStoreNum(totalStoreNum);
|
||||
retainedEquipmentInfo.setUsNum(totalUsNum);
|
||||
retainedEquipmentInfo.setDsNum(totalDsNum);
|
||||
retainedEquipmentInfo.setRepairNum(totalRepairNum);
|
||||
retainedEquipmentInfo.setRepairAuditNum(totalRepairAuditNum);
|
||||
retainedEquipmentInfo.setInputNum(totalInputNum);
|
||||
retainedEquipmentInfo.setRepairInputNum(totalRepairInputNum);
|
||||
retainedEquipmentInfo.setPendingScrapNum(totalPendingScrapNum);
|
||||
|
|
@ -451,7 +457,14 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
*/
|
||||
@Override
|
||||
public List<RepairStorageInfo> getRepairRecordList(RepairStorageInfo bean) {
|
||||
return complexQueryMapper.getRepairRecordList(bean);
|
||||
List<RepairStorageInfo> list = new ArrayList<>();
|
||||
if (bean.getType() != null && (bean.getType() == 1 || bean.getType() == 2)) {
|
||||
list = complexQueryMapper.getRepairRecordList(bean);
|
||||
}
|
||||
if (bean.getType() != null && bean.getType() == 3) {
|
||||
list = complexQueryMapper.getRepairAuditList(bean);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -315,7 +315,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
IFNULL(mt.storage_num, 0)
|
||||
END AS storeNum,
|
||||
IFNULL(subquery1.usNum, 0) AS usNum,
|
||||
IFNULL(subquery2.dsNum, 0) + IFNULL(subquery2.repairNum, 0) AS repairNum,
|
||||
IFNULL(subquery2.dsNum, 0) AS dsNum,
|
||||
IFNULL(subquery2.repairNum, 0) AS repairNum,
|
||||
IFNULL(subquery12.repairAuditNum, 0) AS repairAuditNum,
|
||||
IFNULL(subquery3.repairInputNum, 0) AS repairInputNum,
|
||||
IFNULL(subquery4.inputNum, 0) AS inputNum,
|
||||
IFNULL(subquery6.pendingScrapNum, 0) AS pendingScrapNum,
|
||||
|
|
@ -323,10 +325,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
CASE mt.manage_type
|
||||
WHEN 0 THEN
|
||||
IFNULL(subquery0.num, 0)+ IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.dsNum, 0) + IFNULL(subquery2.repairNum, 0) + IFNULL(subquery3.repairInputNum, 0)
|
||||
+ IFNULL(subquery4.inputNum, 0) + IFNULL(subquery6.pendingScrapNum, 0)
|
||||
+ IFNULL(subquery12.repairAuditNum, 0) + IFNULL(subquery4.inputNum, 0) + IFNULL(subquery6.pendingScrapNum, 0)
|
||||
ELSE
|
||||
IFNULL(mt.storage_num, 0)+ IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.dsNum, 0) + IFNULL(subquery2.repairNum, 0) + IFNULL(subquery3.repairInputNum, 0)
|
||||
+ IFNULL(subquery4.inputNum, 0) + IFNULL(subquery6.pendingScrapNum, 0)
|
||||
+ IFNULL(subquery12.repairAuditNum, 0) + IFNULL(subquery4.inputNum, 0) + IFNULL(subquery6.pendingScrapNum, 0)
|
||||
END AS allNum,
|
||||
CASE mt.manage_type
|
||||
WHEN 0 THEN
|
||||
|
|
@ -401,6 +403,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
INNER JOIN tm_task tt ON rad.task_id = tt.task_id
|
||||
WHERE
|
||||
tt.task_status IN (0, 4)
|
||||
and tt.code is not null
|
||||
GROUP BY
|
||||
mt.type_id) AS subquery2 ON subquery2.type_id = mt.type_id
|
||||
LEFT JOIN (
|
||||
|
|
@ -413,6 +416,28 @@ 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(rad.repair_num, 0) ) AS repairAuditNum
|
||||
FROM repair_audit_details rad
|
||||
LEFT JOIN ma_type mt ON mt.type_id = rad.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 tm_task tt ON rad.task_id = tt.task_id
|
||||
WHERE
|
||||
tt.code is not null
|
||||
and rad.`status` = '0'
|
||||
GROUP BY
|
||||
mt.type_id) AS subquery12 ON subquery12.type_id = mt.type_id
|
||||
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(rid.repair_num, 0) - IFNULL(rid.input_num, 0) - IFNULL(rid.reject_num, 0)) AS repairInputNum
|
||||
FROM repair_input_details rid
|
||||
|
|
@ -477,15 +502,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
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
|
||||
<if test="bindUserId != null">
|
||||
LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_id
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
JOIN ma_type_keeper mtk ON mtk.type_id = mt.type_id AND mtk.user_id = #{userId}
|
||||
</if>
|
||||
LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_id
|
||||
WHERE mt.del_flag = '0'
|
||||
<if test="bindUserId != null ">
|
||||
and mtm.user_id = #{bindUserId}
|
||||
<if test="userId != null">
|
||||
and mtm.user_id = #{userId}
|
||||
</if>
|
||||
|
||||
<if test="typeId != null">
|
||||
|
|
@ -905,8 +925,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_machine mm ON mm.ma_id = rad.ma_id
|
||||
LEFT JOIN tm_task tt ON rad.task_id = tt.task_id
|
||||
LEFT JOIN back_apply_info bai ON rad.back_id = bai.id
|
||||
WHERE tt.task_status IN (0, 4)
|
||||
WHERE
|
||||
tt.`code` is not null
|
||||
AND IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 ) > 0
|
||||
<if test="type != null and type == 1">
|
||||
AND tt.task_status = 0
|
||||
</if>
|
||||
<if test="type != null and type == 2">
|
||||
AND tt.task_status = 4
|
||||
</if>
|
||||
<if test="typeId != null">
|
||||
AND rad.type_id = #{typeId}
|
||||
</if>
|
||||
|
|
@ -1750,4 +1777,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
GROUP BY type_id
|
||||
</select>
|
||||
|
||||
<select id="getRepairAuditList" resultType="com.bonus.material.basic.domain.RepairStorageInfo">
|
||||
SELECT
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.buy_price AS buyPrice,
|
||||
tt.`code` AS repairCode,
|
||||
bai.create_time AS leaseTime,
|
||||
GROUP_CONCAT(DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ') AS repairer,
|
||||
bai.back_person AS creator,
|
||||
mm.ma_code as maCode,
|
||||
IFNULL(rad.repair_num, 0) AS repairNum
|
||||
FROM
|
||||
repair_audit_details rad
|
||||
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id
|
||||
LEFT JOIN sys_user su ON mtr.user_id = su.user_id
|
||||
LEFT JOIN ma_machine mm ON mm.ma_id = rad.ma_id
|
||||
LEFT JOIN tm_task tt ON rad.task_id = tt.task_id
|
||||
LEFT JOIN repair_apply_details ra ON rad.repair_id = ra.id
|
||||
LEFT JOIN back_apply_info bai ON ra.back_id = bai.id
|
||||
WHERE
|
||||
tt.`code` is not null
|
||||
AND rad.status = 0
|
||||
<if test="typeId != null">
|
||||
AND rad.type_id = #{typeId}
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
mt2.type_name like concat('%',#{keyWord},'%') or
|
||||
mt.type_name like concat('%',#{keyWord},'%') or
|
||||
mm.ma_code like concat('%',#{keyWord},'%') or
|
||||
tt.`code` like concat('%',#{keyWord},'%') or
|
||||
bai.back_person like concat('%',#{keyWord},'%') or
|
||||
su.nick_name like concat('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
GROUP BY mm.ma_id,tt.`code`,mt.type_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue