Commit 4efefac3 by wuwenlong

Merge remote-tracking branch 'origin/dev' into dev

parents 585042e0 bee2e13e
......@@ -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;
}
......
......@@ -91,6 +91,7 @@ public class ServiceHGSB004 extends ServiceEPBase {
map1.put(HGSB002.FIELD_PLAN_CODE,hgsb004.getPlanCode());
map1.put(HGSB002.FIELD_PLAN_START_DATE,hgsb004.getPlanStartDate());
map1.put(HGSB002.FIELD_PLAN_END_DATE,hgsb004.getPlanEndDate());
map1.put(HGSB002.FIELD_PLAN_TYPE,1);
List<HGSB002> list = DaoBase.getInstance().query(HGSB002.QUERY, map1);
for (HGSB002 hgsb002 : list){
hgsb002.setTaskStatus(0);
......
......@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.sb.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
......@@ -77,26 +78,32 @@ public class ServiceHGSB005 extends ServiceEPBase {
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HGSB005 hgsb005 = new HGSB005();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGSB005 hgsb005 = new HGSB005();
hgsb005.fromMap(map);
hgsb005.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hgsb005.getCheckStatus()==1) {
String str = "设备保养已审批完成,无法删除!";
throw new PlatException(str);
throw new PlatException("设备保养已审批完成,无法删除!");
}
Map map1 = new HashMap<>();
map1.put(HGSB002.FIELD_COMPANY_CODE,hgsb005.getCompanyCode());
map1.put(HGSB002.FIELD_PLAN_CODE,hgsb005.getPlanCode());
map1.put(HGSB002.FIELD_PLAN_START_DATE,hgsb005.getPlanStartDate());
map1.put(HGSB002.FIELD_PLAN_END_DATE,hgsb005.getPlanEndDate());
map1.put(HGSB002.FIELD_PLAN_TYPE,2);
List<HGSB002> list = DaoBase.getInstance().query(HGSB002.QUERY, map1);
for (HGSB002 hgsb002 : list){
hgsb002.setTaskStatus(0);
DaoUtils.update(HGSB002.UPDATE, hgsb002);
}
DaoUtils.update(HGSB005.DELETE_FLAG, hgsb005.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
......@@ -157,11 +164,7 @@ public class ServiceHGSB005 extends ServiceEPBase {
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
......
......@@ -4,9 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.sb.domain.HGSB002;
import com.baosight.hggp.hg.sb.domain.HGSB005A;
import com.baosight.hggp.hg.sb.domain.HGSB005;
import com.baosight.hggp.hg.sb.domain.*;
import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.util.CommonMethod;
......@@ -63,10 +61,16 @@ public class ServiceHGSB005A extends ServiceEPBase {
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HGSB005A hgsb005a = new HGSB005A();
Long parentId = Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSB005A.FIELD_PARENT_ID));
HGSB005 hgsb005 = HGSBTools.Hgsb005.getId(parentId);
if (hgsb005.getCheckStatus().equals(CommonConstant.PlanStatus.UN_PLAN)){
throw new PlatException("设备保养审批完成,无法删除");
}
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGSB005A hgsb005a = new HGSB005A();
hgsb005a.fromMap(map);
hgsb005a.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSB005A.DELETE_FLAG, hgsb005a.toMap());
......@@ -74,11 +78,7 @@ public class ServiceHGSB005A extends ServiceEPBase {
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
......@@ -88,9 +88,9 @@ public class ServiceHGSB005A extends ServiceEPBase {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
for (Map resultRow : resultRows) {
HGSB005A hgsb005a = new HGSB005A();
hgsb005a.fromMap(resultRows.get(i));
hgsb005a.fromMap(resultRow);
if (hgsb005a.getId() == null || hgsb005a.getId() == 0) {
hgsb005a.setParentId(Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSB005A.FIELD_PARENT_ID)));
this.add(hgsb005a);
......
......@@ -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
......@@ -5,10 +5,7 @@ import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sb.domain.HGSB002;
import com.baosight.hggp.hg.sb.domain.HGSB002A;
import com.baosight.hggp.hg.sb.domain.HGSB004;
import com.baosight.hggp.hg.sb.domain.HGSB004A;
import com.baosight.hggp.hg.sb.domain.*;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.domain.UserGroup;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
......@@ -168,4 +165,26 @@ public class HGSBTools {
return results;
}
}
public static class Hgsb005 {
public static HGSB005 getId(Long id) {
AssertUtils.isNull(id, "设备保养不能为空");
Map queryMap = new HashMap();
queryMap.put(HGSB005.FIELD_ID, id);
queryMap.put(HGSB005.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
List<HGSB005> results = DaoBase.getInstance().query(HGSB005.QUERY, queryMap);
AssertUtils.isEmpty(results, "设备保养不存在");
return results.get(0);
}
public static List<HGSB005A> getDetails(Long parentId) {
AssertUtils.isNull(parentId, "设备保养不能为空");
Map queryMap = new HashMap();
queryMap.put(HGSB005A.FIELD_PARENT_ID, parentId);
queryMap.put(HGSB005A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
List<HGSB005A> results = DaoBase.getInstance().query(HGSB005A.QUERY, queryMap);
return results;
}
}
}
......@@ -30,10 +30,8 @@ $(function () {
let auditStatus = item["checkStatus"];
let template = '';
if (item.companyCode) {
if (auditStatus == 1){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ',\''+item.companyCode+'\',\''+item.companyName+'\')" >点检详情</a>';
}
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ',\''+item.companyCode+'\',\''+item.companyName+'\')" >点检详情</a>';
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >审批完成</a>';
......
......@@ -30,10 +30,8 @@ $(function () {
let auditStatus = item["checkStatus"];
let template = '';
if (item.companyCode) {
if (auditStatus == 1){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ',\''+item.companyCode+'\',\''+item.companyName+'\')" >保养详情</a>';
}
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ',\''+item.companyCode+'\',\''+item.companyName+'\')" >保养详情</a>';
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >审批完成</a>';
......
......@@ -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