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