问题修改
This commit is contained in:
parent
02928c3ab3
commit
76a2ef5347
|
|
@ -11,7 +11,7 @@ public class CsDeviceChangeDetailsVo {
|
|||
|
||||
private String proId;
|
||||
|
||||
private int num=1;
|
||||
private int num = 1;
|
||||
|
||||
private String type;
|
||||
|
||||
|
|
@ -54,5 +54,7 @@ public class CsDeviceChangeDetailsVo {
|
|||
*/
|
||||
private String repairContent;
|
||||
|
||||
private String status;
|
||||
private String status;
|
||||
|
||||
private String changeStatus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,6 +123,4 @@ public class CsDeviceChangeVo {
|
|||
private String endTime;
|
||||
|
||||
private String useTime;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
int num = mapper.addChangeInfo(vo);
|
||||
if (num > 0) {
|
||||
for (CsDeviceChangeDetailsVo deviceChangeDetailsVo : list) {
|
||||
if ("1".equals(vo.getStatus())) {
|
||||
if ("1".equals(deviceChangeDetailsVo.getChangeStatus())) {
|
||||
updateDevDetails(deviceChangeDetailsVo.getDevId(), null, "1", deviceChangeDetailsVo.getNum());
|
||||
deviceChangeDetailsVo.setStatus("1");
|
||||
} else {
|
||||
|
|
@ -125,7 +125,7 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
int isSuccess = mapper.addDetailsInfo(deviceChangeDetailsVo);
|
||||
if (isSuccess > 0) {
|
||||
vo.setDevId(deviceChangeDetailsVo.getDevId());
|
||||
vo.setChangeStatus(vo.getStatus());
|
||||
vo.setChangeStatus(deviceChangeDetailsVo.getChangeStatus());
|
||||
vo.setUseUint(null);
|
||||
vo.setUserName(null);
|
||||
vo.setUserPhone(null);
|
||||
|
|
@ -319,11 +319,7 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
if (isSuccess > 0) {
|
||||
vo.setDevId(deviceChangeDetailsVo.getDevId());
|
||||
if ("2".startsWith(vo.getType())) {
|
||||
if ("0".equals(vo.getStatus())) {
|
||||
vo.setChangeStatus("2");
|
||||
} else {
|
||||
vo.setChangeStatus("3");
|
||||
}
|
||||
vo.setChangeStatus(vo.getStatus());
|
||||
} else if ("3".startsWith(vo.getType())) {
|
||||
vo.setChangeStatus("4");
|
||||
} else if ("4".startsWith(vo.getType())) {
|
||||
|
|
|
|||
|
|
@ -88,5 +88,11 @@ public class MaDevQc extends BaseEntity implements Serializable {
|
|||
private Integer maintenanceAlarmDay;
|
||||
private Integer ownId;
|
||||
private Integer fileId;
|
||||
|
||||
private String itemTypeModel;
|
||||
|
||||
private String phonenumber;
|
||||
|
||||
private String alert;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -235,10 +235,10 @@
|
|||
</update>
|
||||
|
||||
<select id="deviceTree" resultType="com.bonus.material.devchange.domain.DeviceTreeBean">
|
||||
SELECT mt.type_id as id,
|
||||
mt.type_name as name,
|
||||
mt.level,
|
||||
mt.parent_id as pId
|
||||
SELECT mt.type_id as id,
|
||||
mt.type_name as name,
|
||||
mt.level,
|
||||
mt.parent_id as pId
|
||||
FROM ma_type mt
|
||||
WHERE mt.level != '7'
|
||||
<if test="name != null and name != ''">
|
||||
|
|
@ -247,13 +247,11 @@
|
|||
</select>
|
||||
|
||||
<select id="deviceCount" resultType="com.bonus.material.devchange.domain.DeviceCountBean">
|
||||
SELECT
|
||||
count(distinct if(mdi.change_status = '1', mdi.ma_id, null)) as inStock,
|
||||
count(distinct if(mdi.change_status = '2', mdi.ma_id, null)) as ownUse,
|
||||
count(distinct if(mdi.change_status = '3', mdi.ma_id, null)) as share,
|
||||
count(distinct if(mdi.change_status = '5', mdi.ma_id, null)) as underRepair
|
||||
FROM
|
||||
ma_dev_info mdi
|
||||
SELECT count(distinct if(mdi.change_status = '1', mdi.ma_id, null)) as inStock,
|
||||
count(distinct if(mdi.change_status = '2', mdi.ma_id, null)) as ownUse,
|
||||
count(distinct if(mdi.change_status = '3', mdi.ma_id, null)) as share,
|
||||
count(distinct if(mdi.change_status = '5', mdi.ma_id, null)) as underRepair
|
||||
FROM ma_dev_info mdi
|
||||
WHERE mdi.is_active = 1
|
||||
</select>
|
||||
|
||||
|
|
@ -344,7 +342,7 @@
|
|||
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
|
||||
<where>
|
||||
mdi.is_active = '1' and mdi.entry_status = '1'
|
||||
<if test="typeId != null">
|
||||
<if test="typeId != null and typeId != 0 ">
|
||||
and (
|
||||
mtv.mainGxId = #{typeId}
|
||||
or mtv.childGxId = #{typeId}
|
||||
|
|
@ -365,6 +363,9 @@
|
|||
and sc.area_code = #{province}
|
||||
</if>
|
||||
|
||||
<if test="usingProjectId != null and usingProjectId != ''">
|
||||
and jsp.pro_code = #{usingProjectId}
|
||||
</if>
|
||||
|
||||
<if test="majorId != null and majorId != ''">
|
||||
and mtv.maxTypeId = #{majorId}
|
||||
|
|
@ -395,12 +396,7 @@
|
|||
and DATE_FORMAT(mdi.purchase_date,'%Y-%m-%d') between #{startPurchaseDate} and #{endPurchaseDate}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
<if test='status=="2"'>
|
||||
and mdi.change_status in(2,3)
|
||||
</if>
|
||||
<if test='status!="2"'>
|
||||
AND mdi.change_status=#{status}
|
||||
</if>
|
||||
AND mdi.change_status=#{status}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
|
|
@ -490,10 +486,9 @@
|
|||
|
||||
|
||||
<select id="selectTotalDeviceCount" resultType="java.lang.Integer">
|
||||
SELECT COUNT( t.type_id)
|
||||
SELECT COUNT(1)
|
||||
FROM ma_dev_info d
|
||||
JOIN ma_type t ON d.type_id = t.type_id
|
||||
|
||||
JOIN ma_type t ON d.type_id = t.type_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -58,20 +58,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
m2.ma_id AS maId,
|
||||
m2.CODE AS deviceCode,
|
||||
m2.device_name AS deviceName,
|
||||
m2.item_type_model AS itemTypeModel,
|
||||
m1.qc_code AS qcCode,
|
||||
m1.qc_user AS qcUser,
|
||||
m1.qc_time AS qcTime,
|
||||
m3.maintenance_alarm_day,
|
||||
su.nick_name AS createBy,
|
||||
m1.next_check_time AS nextCheckTime,
|
||||
m1.create_time AS updateTime,
|
||||
aa.create_time AS createTime
|
||||
aa.create_time AS createTime,
|
||||
su.phonenumber AS phonenumber,
|
||||
CASE
|
||||
WHEN DATEDIFF(m1.next_check_time, CURDATE()) < 0 THEN '已超期'
|
||||
WHEN DATEDIFF(m1.next_check_time, CURDATE()) <= 30 THEN '一月内到期'
|
||||
ELSE '正常'
|
||||
END AS alert
|
||||
FROM
|
||||
ma_dev_info m2
|
||||
LEFT JOIN ma_dev_qc m1 ON m1.ma_id = m2.ma_id
|
||||
LEFT JOIN ma_dev_qc m1 ON m1.ma_id = m2.ma_id
|
||||
LEFT JOIN ma_type m3 ON m2.type_id = m3.type_id
|
||||
LEFT JOIN sys_user su ON su.user_id = m1.create_by
|
||||
LEFT JOIN ( SELECT count(*) as num, ma_id, MAX( qc_time ) AS max_qc_time FROM ma_dev_qc GROUP BY ma_id ) latest_qc ON m1.ma_id = latest_qc.ma_id
|
||||
LEFT JOIN ( SELECT ma_id, min( create_time ) AS create_time FROM ma_dev_qc GROUP BY ma_id ) aa ON m1.ma_id = aa.ma_id
|
||||
LEFT JOIN ( SELECT count(*) as num, ma_id, MAX( qc_time ) AS max_qc_time FROM ma_dev_qc GROUP BY ma_id )
|
||||
latest_qc ON m1.ma_id = latest_qc.ma_id
|
||||
LEFT JOIN ( SELECT ma_id, min( create_time ) AS create_time FROM ma_dev_qc GROUP BY ma_id ) aa ON m1.ma_id =
|
||||
aa.ma_id
|
||||
<where>
|
||||
m2.is_active = '1'
|
||||
<if test="deviceCode != null and deviceCode != ''">
|
||||
|
|
|
|||
|
|
@ -757,9 +757,9 @@
|
|||
SELECT
|
||||
-- 按映射关系转换为目标类型(line/substation/cable)
|
||||
CASE
|
||||
WHEN mtv.proType = '架空输电线路工程' THEN 'line'
|
||||
WHEN mtv.proType = '电缆(海缆)工程' THEN 'substation'
|
||||
WHEN mtv.proType = '变电施工类' THEN 'cable'
|
||||
WHEN mtv.maxTypeId = '2' THEN 'line'
|
||||
WHEN mtv.maxTypeId = '3' THEN 'substation'
|
||||
WHEN mtv.maxTypeId = '1' THEN 'cable'
|
||||
END AS targetType,
|
||||
|
||||
-- 统计各指标
|
||||
|
|
@ -788,16 +788,16 @@
|
|||
INNER JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
|
||||
WHERE
|
||||
-- 过滤目标proType,只处理需要的三类
|
||||
mtv.proType IN ('变电施工类', '架空输电线路工程', '电缆(海缆)工程')
|
||||
mtv.maxTypeId IN ('1', '2', '3')
|
||||
and mdi.change_status != '4'
|
||||
and mdi.is_active = '1'
|
||||
AND mdi.production_date IS NOT NULL -- 排除无效出厂日期
|
||||
GROUP BY
|
||||
-- 按映射后的目标类型分组(确保结果按line/substation/cable聚合)
|
||||
CASE
|
||||
WHEN mtv.proType = '架空输电线路工程' THEN 'line'
|
||||
WHEN mtv.proType = '电缆(海缆)工程' THEN 'substation'
|
||||
WHEN mtv.proType = '变电施工类' THEN 'cable'
|
||||
WHEN mtv.maxTypeId = '2' THEN 'line'
|
||||
WHEN mtv.maxTypeId = '3' THEN 'substation'
|
||||
WHEN mtv.maxTypeId = '1' THEN 'cable'
|
||||
END
|
||||
ORDER BY
|
||||
targetType;
|
||||
|
|
|
|||
Loading…
Reference in New Issue