功能优化
This commit is contained in:
parent
ca98ff1eb2
commit
b376d46041
|
|
@ -13,6 +13,7 @@ import com.bonus.material.basic.domain.ProjUsingRecordExports;
|
|||
import com.bonus.material.basic.domain.*;
|
||||
import com.bonus.material.basic.domain.vo.MaTypeSelectInfo;
|
||||
import com.bonus.material.basic.service.ComplexQueryService;
|
||||
import com.bonus.material.lease.mapper.LeaseApplyInfoMapper;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.system.api.model.LoginUser;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -36,6 +37,9 @@ public class ComplexQueryController extends BaseController {
|
|||
@Resource
|
||||
private ComplexQueryService complexQueryService;
|
||||
|
||||
@Resource
|
||||
private LeaseApplyInfoMapper leaseApplyInfoMapper;
|
||||
|
||||
/**
|
||||
* 保有设备总量查询
|
||||
* @param bean
|
||||
|
|
@ -45,8 +49,14 @@ public class ComplexQueryController extends BaseController {
|
|||
@GetMapping("/getRetainedEquipmentList")
|
||||
public AjaxResult getRetainedEquipmentList(RetainedEquipmentInfo bean) {
|
||||
bean.setIsExport(1);
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
bean.setUserId(loginUser.getUserid());
|
||||
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);
|
||||
}
|
||||
if (bean.getIsApp() != null && bean.getIsApp() == 1) {
|
||||
List<RetainedEquipmentInfo> pageList = complexQueryService.getRetainedEquipmentList(bean);
|
||||
return AjaxResult.success(pageList);
|
||||
|
|
@ -65,7 +75,14 @@ public class ComplexQueryController extends BaseController {
|
|||
@GetMapping("/getRetainedEquipmentListNoPage")
|
||||
public AjaxResult getRetainedEquipmentListNoPage(RetainedEquipmentInfo bean) {
|
||||
bean.setIsExport(0);
|
||||
bean.setUserId( SecurityUtils.getLoginUser().getUserid());
|
||||
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);
|
||||
}
|
||||
List<RetainedEquipmentInfo> list = complexQueryService.getRetainedEquipmentList(bean);
|
||||
RetainedEquipmentInfo dto = new RetainedEquipmentInfo();
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
|
|
@ -95,7 +112,14 @@ public class ComplexQueryController extends BaseController {
|
|||
@PostMapping("/exportRetainedEquipmentList")
|
||||
public void exportRetainedEquipmentList(HttpServletResponse response, RetainedEquipmentInfo bean)
|
||||
{
|
||||
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
|
||||
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.setIsExport(0);
|
||||
List<RetainedEquipmentInfo> list = complexQueryService.getRetainedEquipmentList(bean);
|
||||
ExcelUtil<RetainedEquipmentInfo> util = new ExcelUtil<>(RetainedEquipmentInfo.class);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ public class RepairStorageInfo {
|
|||
@Excel(name = "规格型号")
|
||||
private String typeModelName;
|
||||
|
||||
@ApiModelProperty(value = "定损数量")
|
||||
private BigDecimal dsNum;
|
||||
|
||||
@ApiModelProperty(value = "在修数量")
|
||||
@Excel(name = "在修数量", align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal repairNum;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public class RetainedEquipmentInfo {
|
|||
private BigDecimal repairInputNum;
|
||||
|
||||
@ApiModelProperty(value = "待报废数量")
|
||||
@Excel(name = "待报废数量", align = HorizontalAlignment.RIGHT)
|
||||
//@Excel(name = "待报废数量", align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal pendingScrapNum;
|
||||
|
||||
@ApiModelProperty(value = "已审核报废数量")
|
||||
|
|
@ -160,4 +160,7 @@ public class RetainedEquipmentInfo {
|
|||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "绑定用户id")
|
||||
private Long bindUserId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1129,6 +1129,9 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
String msg = isValid
|
||||
? "监测到" + bmQrcodeInfo.getQrCode() + "符合出库条件,请确认是否出库!"
|
||||
: "监测到" + bmQrcodeInfo.getQrCode() + "编码不符合出库条件,请检查后重新提交!";
|
||||
if (!isValid) {
|
||||
recordList = new ArrayList<>();
|
||||
}
|
||||
// 返回包含设备列表和消息的结果
|
||||
Map<String, Object> result = new HashMap<>(2);
|
||||
result.put("recordList", recordList);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.ma.mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
|
|
@ -249,4 +250,15 @@ public interface MachineMapper
|
|||
void insertInfo(Machine machine);
|
||||
|
||||
List<MachineSynch> selectSynchDetailList(MachineSynch machine);
|
||||
|
||||
/**
|
||||
* 修改机具的检测时间
|
||||
* @param maIds
|
||||
* @param thisCheckTime
|
||||
* @param nextCheckTime
|
||||
* @return
|
||||
*/
|
||||
int updateCheckTimeBatch(@Param("maIds") Long[] maIds,
|
||||
@Param("thisCheckTime") Date thisCheckTime,
|
||||
@Param("nextCheckTime") Date nextCheckTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,4 +159,11 @@ public interface IMachineService
|
|||
List<MachineSynch> selectSynchList(MachineSynch machine);
|
||||
|
||||
List<MachineSynch> selectSynchDetailList(MachineSynch machine);
|
||||
|
||||
/**
|
||||
* 批量更新检验时间
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
AjaxResult updateDate(Machine info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -768,4 +768,33 @@ public class MachineServiceImpl implements IMachineService
|
|||
public List<MachineSynch> selectSynchDetailList(MachineSynch machine) {
|
||||
return machineMapper.selectSynchDetailList(machine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新检验时间
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updateDate(Machine info) {
|
||||
try {
|
||||
if (info.getMaIds() != null && info.getMaIds().length > 0) {
|
||||
if (info.getThisCheckTime() != null && info.getNextCheckTime() != null) {
|
||||
// 批量更新
|
||||
int rows = machineMapper.updateCheckTimeBatch(
|
||||
info.getMaIds(),
|
||||
info.getThisCheckTime(),
|
||||
info.getNextCheckTime()
|
||||
);
|
||||
return rows > 0 ? success("批量更新成功") : error("未更新任何数据");
|
||||
} else {
|
||||
return error("检验时间不能为空");
|
||||
}
|
||||
} else {
|
||||
return error("设备ID不能为空");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("批量更新检验时间失败", e);
|
||||
return error("检验时间更新失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -279,10 +279,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
)
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and bs.type_name like CONCAT('%',#{typeName},'%')
|
||||
and mt1.type_name like CONCAT('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName != ''">
|
||||
and bs.type_model_name like CONCAT('%',#{typeModelName},'%')
|
||||
and mt.type_name like CONCAT('%',#{typeModelName},'%')
|
||||
</if>
|
||||
<if test="firstTypeIdList != null and firstTypeIdList.size > 0">
|
||||
and mt3.type_id in
|
||||
|
|
@ -315,17 +315,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
IFNULL(mt.storage_num, 0)
|
||||
END AS storeNum,
|
||||
IFNULL(subquery1.usNum, 0) AS usNum,
|
||||
IFNULL(subquery2.repairNum, 0) AS repairNum,
|
||||
IFNULL(subquery2.dsNum, 0) + IFNULL(subquery2.repairNum, 0) AS repairNum,
|
||||
IFNULL(subquery3.repairInputNum, 0) AS repairInputNum,
|
||||
IFNULL(subquery4.inputNum, 0) AS inputNum,
|
||||
IFNULL(subquery6.pendingScrapNum, 0) AS pendingScrapNum,
|
||||
IFNULL(subquery6.scrapNum, 0) AS scrapNum,
|
||||
CASE mt.manage_type
|
||||
WHEN 0 THEN
|
||||
IFNULL(subquery0.num, 0)+ IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.repairNum, 0) + IFNULL(subquery3.repairInputNum, 0)
|
||||
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)
|
||||
ELSE
|
||||
IFNULL(mt.storage_num, 0)+ IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.repairNum, 0) + IFNULL(subquery3.repairInputNum, 0)
|
||||
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)
|
||||
END AS allNum,
|
||||
CASE mt.manage_type
|
||||
|
|
@ -333,10 +333,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
'编码'
|
||||
ELSE
|
||||
'数量'
|
||||
END manageType,
|
||||
IFNULL(subquery5.fiveReplacementNum, 0) AS fiveReplacementNum,
|
||||
END manageType
|
||||
/*IFNULL(subquery5.fiveReplacementNum, 0) AS fiveReplacementNum,
|
||||
IFNULL(subquery5.tenReplacementNum, 0) AS tenReplacementNum,
|
||||
IFNULL(subquery5.tenPlusReplacementNum, 0) AS tenPlusReplacementNum
|
||||
IFNULL(subquery5.tenPlusReplacementNum, 0) AS tenPlusReplacementNum*/
|
||||
FROM ma_type mt
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
|
|
@ -391,16 +391,16 @@ 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) - IFNULL(rad.repaired_num, 0) -
|
||||
IFNULL(rad.scrap_num, 0)) AS repairNum
|
||||
SUM(CASE WHEN tt.task_status = 0 and rad.is_ds = 1 THEN IFNULL(rad.repair_num, 0) ELSE 0 END) AS dsNum,
|
||||
SUM(CASE WHEN tt.task_status = 4 and rad.is_ds = 0 THEN (IFNULL(rad.repair_num, 0) - IFNULL(rad.repaired_num, 0) - IFNULL(rad.scrap_num, 0)) ELSE 0 END) AS repairNum
|
||||
FROM repair_apply_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
|
||||
INNER JOIN tm_task tt ON rad.task_id = tt.task_id
|
||||
WHERE
|
||||
rad.status = '0' and rad.is_ds = '1'
|
||||
tt.task_status IN (0, 4)
|
||||
GROUP BY
|
||||
mt.type_id) AS subquery2 ON subquery2.type_id = mt.type_id
|
||||
LEFT JOIN (
|
||||
|
|
@ -444,7 +444,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and pcd.status in (3,4, 13,14)
|
||||
GROUP BY
|
||||
mt.type_id) AS subquery4 ON subquery4.type_id = mt.type_id
|
||||
LEFT JOIN (
|
||||
/*LEFT JOIN (
|
||||
SELECT
|
||||
mt.type_id AS typeId,
|
||||
IFNULL(SUM(IF(TIMESTAMPDIFF(YEAR,pcd.create_time,now()) < 5, pcd.input_num,0)),0) AS fiveReplacementNum,
|
||||
|
|
@ -453,7 +453,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
FROM purchase_check_details pcd
|
||||
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
||||
GROUP BY mt.type_id
|
||||
) subquery5 ON subquery5.typeId = mt.type_id
|
||||
) subquery5 ON subquery5.typeId = mt.type_id*/
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
mt.type_id AS typeId,
|
||||
|
|
@ -477,10 +477,15 @@ 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
|
||||
LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_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>
|
||||
WHERE mt.del_flag = '0'
|
||||
<if test="userId != null ">
|
||||
and mtm.user_id = #{userId}
|
||||
<if test="bindUserId != null ">
|
||||
and mtm.user_id = #{bindUserId}
|
||||
</if>
|
||||
|
||||
<if test="typeId != null">
|
||||
|
|
@ -880,25 +885,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getRepairRecordList" resultType="com.bonus.material.basic.domain.RepairStorageInfo">
|
||||
SELECT
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.buy_price AS buyPrice,
|
||||
IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 ) AS repairNum,
|
||||
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
|
||||
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) - IFNULL(rad.repaired_num, 0) - IFNULL(rad.scrap_num, 0) AS repairNum
|
||||
/* CASE WHEN tt.task_status = 0 and rad.is_ds = 1 THEN IFNULL(rad.repair_num, 0) ELSE 0 END AS dsNum,
|
||||
CASE WHEN tt.task_status = 4 and rad.is_ds = 0 THEN (IFNULL(rad.repair_num, 0) - IFNULL(rad.repaired_num, 0) - IFNULL(rad.scrap_num, 0)) ELSE 0 END AS repairNum*/
|
||||
FROM
|
||||
repair_apply_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 back_apply_info bai ON rad.back_id = bai.id
|
||||
WHERE rad.`status` = '0' and rad.is_ds = '1'
|
||||
repair_apply_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 back_apply_info bai ON rad.back_id = bai.id
|
||||
WHERE tt.task_status IN (0, 4)
|
||||
AND IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 ) > 0
|
||||
<if test="typeId != null">
|
||||
AND rad.type_id = #{typeId}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -672,7 +672,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bp.external_id AS externalId,
|
||||
bu.bzz_idcard AS idCard,
|
||||
mt4.type_id AS firstId,
|
||||
a.create_time AS releaseTime
|
||||
a.create_time AS releaseTime,
|
||||
lod.publish_task AS publishTask
|
||||
FROM
|
||||
lease_out_details lod
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id
|
||||
|
|
|
|||
|
|
@ -1000,6 +1000,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update ma_machine set ma_status = 1 where ma_id = #{maId}
|
||||
</update>
|
||||
|
||||
<update id="updateCheckTimeBatch">
|
||||
update ma_machine
|
||||
set this_check_time = #{thisCheckTime},
|
||||
next_check_time = #{nextCheckTime},
|
||||
update_time=now()
|
||||
where ma_id in
|
||||
<foreach collection="maIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getNewByMaCode" resultType="com.bonus.material.ma.domain.Machine">
|
||||
|
||||
SELECT
|
||||
|
|
|
|||
Loading…
Reference in New Issue