Commit 90bec985 by liuyang

2024-05-24 1.设备点检预警预警逻辑调整

2.设备保养逻辑调整
parent 0dfd5c29
......@@ -32,6 +32,7 @@ public class HGSB007 extends DaoEPBase {
public static final String FIELD_UPKEEP_CODE = "upkeepCode"; /* 保养单号*/
public static final String FIELD_GROUP_CODE = "groupCode"; /* 设备区域编码*/
public static final String FIELD_GROUP_NAME = "groupName"; /* 设备区域名称*/
public static final String FIELD_PLAN_CODE = "planCode"; /* 计划单号*/
public static final String FIELD_PLAN_START_DATE = "planStartDate"; /* 计划开始日期*/
public static final String FIELD_PLAN_END_DATE = "planEndDate"; /* 计划结束日期*/
public static final String FIELD_DEVICE_TYPE = "deviceType"; /* 设备类型*/
......@@ -90,6 +91,7 @@ public class HGSB007 extends DaoEPBase {
private String upkeepCode = " "; /* 保养单号*/
private String groupCode = " "; /* 设备区域编码*/
private String groupName = " "; /* 设备区域名称*/
private String planCode = " "; /* 计划单号*/
private String planStartDate = " "; /* 计划开始日期*/
private String planEndDate = " "; /* 计划结束日期*/
private String deviceType = " "; /* 设备类型*/
......@@ -170,6 +172,10 @@ public class HGSB007 extends DaoEPBase {
eiColumn.setDescName("保养单号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PLAN_CODE);
eiColumn.setDescName("计划单号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PLAN_START_DATE);
eiColumn.setDescName("计划开始日期");
eiMetadata.addMeta(eiColumn);
......@@ -634,6 +640,14 @@ public class HGSB007 extends DaoEPBase {
this.planEndDate = planEndDate;
}
public String getPlanCode() {
return planCode;
}
public void setPlanCode(String planCode) {
this.planCode = planCode;
}
/**
* get the value from Map.
*
......@@ -671,6 +685,7 @@ public class HGSB007 extends DaoEPBase {
setRemainderDays(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_REMAINDER_DAYS)), remainderDays));
setPlanStartDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_START_DATE)), planStartDate));
setPlanEndDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_END_DATE)), planEndDate));
setPlanCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_CODE)), planCode));
}
/**
......@@ -709,6 +724,7 @@ public class HGSB007 extends DaoEPBase {
map.put(FIELD_REMAINDER_DAYS, StringUtils.toString(remainderDays, eiMetadata.getMeta(FIELD_REMAINDER_DAYS)));
map.put(FIELD_PLAN_START_DATE, StringUtils.toString(planStartDate, eiMetadata.getMeta(FIELD_PLAN_START_DATE)));
map.put(FIELD_PLAN_END_DATE, StringUtils.toString(planEndDate, eiMetadata.getMeta(FIELD_PLAN_END_DATE)));
map.put(FIELD_PLAN_CODE, StringUtils.toString(planCode, eiMetadata.getMeta(FIELD_PLAN_CODE)));
return map;
}
......
......@@ -31,7 +31,7 @@ public class ServiceHGSB007 extends ServiceEPBase {
EiInfo outInfo = super.initLoad(inInfo,new HGSB007());
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSB007.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSB005.FIELD_CHECK_STATUS, CommonConstant.YesNo.YES_1);
outInfo = super.query(inInfo, HGSB007.QUERY, new HGSB007(),false, new EiBlockMeta(), EiConstant.queryBlock, CommonConstant.Field.DETAIL, CommonConstant.Field.DETAIL);
outInfo = super.query(inInfo, HGSB007.QUERY, new HGSB007(),false, new HGSB007().eiMetadata, EiConstant.queryBlock, CommonConstant.Field.DETAIL, CommonConstant.Field.DETAIL);
Map qarma = new HashMap();
if (!HGSBTools.getRoleDataAuth()){
String userId = "admin".equals(UserSessionUtils.getUserId())?"":UserSessionUtils.getUserId();
......
......@@ -5,36 +5,52 @@
<typeAlias alias="HGSB006" type="com.baosight.hggp.hg.sb.domain.HGSB006"/>
<typeAlias alias="HashMap" type="java.util.HashMap"/>
<sql id="column">
A.ID as "id", <!-- ID -->
A.ACCOUNT_CODE as "accountCode", <!-- 账套 -->
A.DEP_CODE as "depCode", <!-- 部门编码 -->
A.CREATED_BY as "createdBy", <!-- 创建人 -->
A.CREATED_NAME as "createdName", <!-- 创建人名称 -->
A.CREATED_TIME as "createdTime", <!-- 创建时间 -->
A.UPDATED_BY as "updatedBy", <!-- 修改人 -->
A.UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
A.UPDATED_TIME as "updatedTime", <!-- 修改时间 -->
A.DELETE_FLAG as "deleteFlag", <!-- 是否删除 0-否1-是 -->
A.PARENT_ID as "parentId", <!-- 父级ID -->
B.COMPANY_CODE as "companyCode", <!-- 公司编码 -->
B.COMPANY_NAME as "companyName", <!-- 公司名称 -->
B.INSPEC_DATE as "inspecDate", <!-- 点检日期 -->
B.INSPEC_CODE as "inspecCode", <!-- 点检单号 -->
A.COMPANY_CODE as "companyCode", <!-- 公司编码 -->
A.COMPANY_NAME as "companyName", <!-- 公司名称 -->
A.GROUP_CODE as "groupCode", <!-- 设备区域编码 -->
A.GROUP_NAME as "groupName", <!-- 设备区域名称 -->
B.PLAN_CODE as "planCode", <!-- 计划单号 -->
B.PLAN_START_DATE as "planStartDate", <!-- 计划开始日期 -->
B.PLAN_END_DATE as "planEndDate", <!-- 计划结束日期 -->
A.DEVICE_TYPE as "deviceType", <!-- 设备类型 -->
A.PLAN_CODE as "planCode", <!-- 计划单号 -->
A.PLAN_START_DATE as "planStartDate", <!-- 计划开始日期 -->
A.PLAN_END_DATE as "planEndDate", <!-- 计划结束日期 -->
A.DEVICE_CODE as "deviceCode", <!-- 设备编码 -->
A.DEVICE_NAME as "deviceName", <!-- 设备名称 -->
A.DEVICE_MODEL as "deviceModel", <!-- 设备型号 -->
A.CHECK_ITEM as "checkItem", <!-- 检查项 -->
A.CHECK_DESCRIP as "checkDescrip", <!-- 检查描述 -->
A.CHECK_RESULT as "checkResult", <!-- 检查描述结果 -->
DATEDIFF(DATE_FORMAT(B.PLAN_END_DATE, '%Y-%m-%d'), CURDATE()) as "remainderDays",
A.DOC_ID as "docId", <!-- 附件ID -->
A.DOC_NAME as "docName"
DATEDIFF(DATE_FORMAT(A.PLAN_END_DATE, '%Y-%m-%d'), CURDATE()) as "remainderDays",
A.DOC_ID as "docId" <!-- 附件ID -->
</sql>
<sql id="column001">
A.ACCOUNT_CODE, <!-- 账套 -->
A.DEP_CODE, <!-- 部门编码 -->
B.COMPANY_CODE, <!-- 公司编码 -->
B.COMPANY_NAME, <!-- 公司名称 -->
A.GROUP_CODE, <!-- 设备区域编码 -->
A.GROUP_NAME, <!-- 设备区域名称 -->
B.PLAN_CODE, <!-- 计划单号 -->
B.PLAN_START_DATE, <!-- 计划开始日期 -->
B.PLAN_END_DATE, <!-- 计划结束日期 -->
A.DEVICE_CODE, <!-- 设备编码 -->
A.DEVICE_NAME, <!-- 设备名称 -->
A.CHECK_RESULT, <!-- 检查描述结果 -->
A.DOC_ID <!-- 附件ID -->
</sql>
<sql id="column002">
A.ACCOUNT_CODE, <!-- 账套 -->
A.DEP_CODE, <!-- 部门编码 -->
B.COMPANY_CODE, <!-- 公司编码 -->
B.COMPANY_NAME, <!-- 公司名称 -->
A.GROUP_CODE, <!-- 设备区域编码 -->
A.GROUP_NAME, <!-- 设备区域名称 -->
B.PLAN_CODE, <!-- 计划单号 -->
B.PLAN_START_DATE, <!-- 计划开始日期 -->
B.PLAN_END_DATE, <!-- 计划结束日期 -->
A.DEVICE_CODE, <!-- 设备编码 -->
A.DEVICE_NAME, <!-- 设备名称 -->
'' as CHECK_RESULT, <!-- 检查描述结果 -->
'' as DOC_ID <!-- 附件ID -->
</sql>
<sql id="authCondition">
......@@ -141,24 +157,84 @@
<select id="query" parameterClass="HashMap" resultClass="HGSB006">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGSB004A A
LEFT JOIN ${hggpSchema}.HGSB004 B ON A.PARENT_ID = B.ID WHERE 1=1
<include refid="condition" />
<include refid="column"/>
from (
SELECT
<include refid="column001"/>
FROM ${hggpSchema}.HGSB004A A
LEFT JOIN ${hggpSchema}.HGSB004 B ON A.PARENT_ID = B.ID WHERE 1=1
<include refid="condition" />
UNION ALL
SELECT
<include refid="column002"/>
from ${hggpSchema}.HGSB002A A
join ${hggpSchema}.HGSB002 B on A.PARENT_ID = B.ID AND B.DELETE_FLAG = '0'
where 1 = 1
and PLAN_END_DATE &lt; DATE_FORMAT(CURDATE(), '%Y%m%d')
AND TASK_STATUS = '0' AND B.PLAN_TYPE = '1'
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
B.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
B.COMPANY_NAME LIKE CONCAT('%', #companyName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceName">
A.DEVICE_NAME LIKE CONCAT('%', #deviceName#, '%')
</isNotEmpty>
) A
where 1=1
<isEqual prepend=" AND " property="checkStatus" compareValue="1">
trim(A.DOC_ID) ='' and trim(A.CHECK_RESULT) = ''
</isEqual>
<isEqual prepend=" AND " property="checkStatus" compareValue="2">
(trim(A.DOC_ID) !='' or trim(A.CHECK_RESULT) != '')
</isEqual>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
B.PLAN_START_DATE desc,B.PLAN_END_DATE desc, A.ID asc
A.PLAN_START_DATE desc,A.PLAN_END_DATE desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSB004A A
LEFT JOIN ${hggpSchema}.HGSB004 B ON A.PARENT_ID = B.ID WHERE 1=1
<include refid="condition" />
SELECT
COUNT(*)
from (
SELECT
<include refid="column001"/>
FROM ${hggpSchema}.HGSB004A A
LEFT JOIN ${hggpSchema}.HGSB004 B ON A.PARENT_ID = B.ID WHERE 1=1
<include refid="condition" />
UNION ALL
SELECT
<include refid="column002"/>
from ${hggpSchema}.HGSB002A A
join ${hggpSchema}.HGSB002 B on A.PARENT_ID = B.ID AND B.DELETE_FLAG = '0'
where 1 = 1
and PLAN_END_DATE &lt; DATE_FORMAT(CURDATE(), '%Y%m%d')
AND TASK_STATUS = '0' AND B.PLAN_TYPE = '1'
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
B.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
B.COMPANY_NAME LIKE CONCAT('%', #companyName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceName">
A.DEVICE_NAME LIKE CONCAT('%', #deviceName#, '%')
</isNotEmpty>
) A
where 1=1
<isEqual prepend=" AND " property="checkStatus" compareValue="1">
trim(A.DOC_ID) ='' and trim(A.CHECK_RESULT) = ''
</isEqual>
<isEqual prepend=" AND " property="checkStatus" compareValue="2">
(trim(A.DOC_ID) !='' or trim(A.CHECK_RESULT) != '')
</isEqual>
</select>
</sqlMap>
\ No newline at end of file
......@@ -6,35 +6,52 @@
<typeAlias alias="HashMap" type="java.util.HashMap"/>
<sql id="column">
A.ID as "id", <!-- ID -->
A.ACCOUNT_CODE as "accountCode", <!-- 账套 -->
A.DEP_CODE as "depCode", <!-- 部门编码 -->
A.CREATED_BY as "createdBy", <!-- 创建人 -->
A.CREATED_NAME as "createdName", <!-- 创建人名称 -->
A.CREATED_TIME as "createdTime", <!-- 创建时间 -->
A.UPDATED_BY as "updatedBy", <!-- 修改人 -->
A.UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
A.UPDATED_TIME as "updatedTime", <!-- 修改时间 -->
A.DELETE_FLAG as "deleteFlag", <!-- 是否删除 0-否1-是 -->
A.PARENT_ID as "parentId", <!-- 父级ID -->
B.COMPANY_CODE as "companyCode", <!-- 公司编码 -->
B.COMPANY_NAME as "companyName", <!-- 公司名称 -->
A.COMPANY_CODE as "companyCode", <!-- 公司编码 -->
A.COMPANY_NAME as "companyName", <!-- 公司名称 -->
A.GROUP_CODE as "groupCode", <!-- 设备区域编码 -->
A.GROUP_NAME as "groupName", <!-- 设备区域名称 -->
B.UPKEEP_DATE as "upkeepDate", <!-- 保养日期 -->
B.UPKEEP_CODE as "upkeepCode", <!-- 保养单号 -->
B.PLAN_START_DATE as "planStartDate", <!-- 计划开始日期 -->
B.PLAN_END_DATE as "planEndDate", <!-- 计划结束日期 -->
A.DEVICE_TYPE as "deviceType", <!-- 设备类型 -->
A.PLAN_CODE as "planCode", <!-- 计划单号 -->
A.PLAN_START_DATE as "planStartDate", <!-- 计划开始日期 -->
A.PLAN_END_DATE as "planEndDate", <!-- 计划结束日期 -->
A.DEVICE_CODE as "deviceCode", <!-- 设备编码 -->
A.DEVICE_NAME as "deviceName", <!-- 设备名称 -->
A.DEVICE_MODEL as "deviceModel", <!-- 设备型号 -->
A.CHECK_ITEM as "checkItem", <!-- 检查项 -->
A.CHECK_DESCRIP as "checkDescrip", <!-- 检查描述 -->
A.CHECK_RESULT as "checkResult", <!-- 检查描述结果 -->
A.DOC_ID as "docId", <!-- 附件ID -->
A.DOC_NAME as "docName",
DATEDIFF(DATE_FORMAT(B.PLAN_END_DATE, '%Y-%m-%d'), CURDATE()) as "remainderDays"
DATEDIFF(DATE_FORMAT(A.PLAN_END_DATE, '%Y-%m-%d'), CURDATE()) as "remainderDays"
</sql>
<sql id="column001">
A.ACCOUNT_CODE,
A.DEP_CODE,
B.COMPANY_CODE,
B.COMPANY_NAME,
A.GROUP_CODE,
A.GROUP_NAME,
B.PLAN_CODE,
B.PLAN_START_DATE,
B.PLAN_END_DATE,
A.DEVICE_CODE,
A.DEVICE_NAME,
A.CHECK_RESULT,
A.DOC_ID
</sql>
<sql id="column002">
A.ACCOUNT_CODE,
A.DEP_CODE,
B.COMPANY_CODE,
B.COMPANY_NAME,
A.GROUP_CODE,
A.GROUP_NAME,
B.PLAN_CODE,
B.PLAN_START_DATE,
B.PLAN_END_DATE,
A.DEVICE_CODE,
A.DEVICE_NAME,
'' as CHECK_RESULT,
'' as DOC_ID
</sql>
<sql id="authCondition">
......@@ -58,7 +75,6 @@
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
......@@ -147,24 +163,86 @@
<select id="query" parameterClass="HashMap" resultClass="HGSB007">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGSB005A A
LEFT JOIN ${hggpSchema}.HGSB005 B ON A.PARENT_ID = B.ID WHERE 1=1
<include refid="condition" />
<include refid="column"/>
FROM (
SELECT
<include refid="column001"/>
FROM ${hggpSchema}.HGSB005A A
JOIN ${hggpSchema}.HGSB005 B ON A.PARENT_ID = B.ID AND B.DELETE_FLAG = '0' WHERE 1=1
<include refid="authCondition"/>
<include refid="condition" />
UNION ALL
SELECT
<include refid="column002"/>
from ${hggpSchema}.HGSB002A A
join ${hggpSchema}.HGSB002 B on A.PARENT_ID = B.ID AND B.DELETE_FLAG = '0'
where 1 = 1
and PLAN_END_DATE &lt; DATE_FORMAT(CURDATE(), '%Y%m%d')
AND TASK_STATUS = '0' AND B.PLAN_TYPE = '2'
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
B.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
B.COMPANY_NAME LIKE CONCAT('%', #companyName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceName">
A.DEVICE_NAME LIKE CONCAT('%', #deviceName#, '%')
</isNotEmpty>
) A
WHERE 1=1
<isEqual prepend=" AND " property="upkeepStatus" compareValue="1">
trim(A.DOC_ID) ='' and trim(A.CHECK_RESULT) = ''
</isEqual>
<isEqual prepend=" AND " property="upkeepStatus" compareValue="2">
(trim(A.DOC_ID) !='' or trim(A.CHECK_RESULT) != '')
</isEqual>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
B.UPKEEP_DATE desc, A.CREATED_TIME desc, A.ID asc
A.PLAN_START_DATE desc, A.PLAN_END_DATE desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSB005A A
LEFT JOIN ${hggpSchema}.HGSB005 B ON A.PARENT_ID = B.ID WHERE 1=1
SELECT
COUNT(*)
FROM (
SELECT
<include refid="column001"/>
FROM ${hggpSchema}.HGSB005A A
JOIN ${hggpSchema}.HGSB005 B ON A.PARENT_ID = B.ID AND B.DELETE_FLAG = '0' WHERE 1=1
<include refid="authCondition"/>
<include refid="condition" />
UNION ALL
SELECT
<include refid="column002"/>
from ${hggpSchema}.HGSB002A A
join ${hggpSchema}.HGSB002 B on A.PARENT_ID = B.ID AND B.DELETE_FLAG = '0'
where 1 = 1
and PLAN_END_DATE &lt; DATE_FORMAT(CURDATE(), '%Y%m%d')
AND TASK_STATUS = '0' AND B.PLAN_TYPE = '2'
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
B.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
B.COMPANY_NAME LIKE CONCAT('%', #companyName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceName">
A.DEVICE_NAME LIKE CONCAT('%', #deviceName#, '%')
</isNotEmpty>
) A
WHERE 1=1
<isEqual prepend=" AND " property="upkeepStatus" compareValue="1">
trim(A.DOC_ID) ='' and trim(A.CHECK_RESULT) = ''
</isEqual>
<isEqual prepend=" AND " property="upkeepStatus" compareValue="2">
(trim(A.DOC_ID) !='' or trim(A.CHECK_RESULT) != '')
</isEqual>
</select>
</sqlMap>
\ No newline at end of file
......@@ -39,6 +39,7 @@
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="planCode" cname="计划单号" width="120" align="center" readonly="true" required="true"/>
<EF:EFComboColumn ename="deviceCode" cname="设备名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
......@@ -46,8 +47,6 @@
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="deviceCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="upkeepDate" cname="保养日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="true" required="true"/>
<EF:EFColumn ename="planStartDate" cname="计划开始日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="true" required="true"/>
<EF:EFColumn ename="planEndDate" cname="计划结束日期" width="120" align="center" editType="date"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment