Commit 95f4d4cd by 宋祥

1.整改通知单

parent 6c0add7d
package com.baosight.hpjx.core.enums;
/**
* @author wwl
* @version 1.0 2024/5/21
*/
public enum HandleStatusEnum {
UNPROCESS(0, "待处理"),
PROCESSING(1, "处理中"),
PROCESSED(2, "已处理");
private Integer code;
private String value;
HandleStatusEnum(Integer code, String value) {
this.code = code;
this.value = value;
}
public static HandleStatusEnum getEnumByCode(Integer code) {
for (HandleStatusEnum en : HandleStatusEnum.values()) {
if (code.compareTo(en.code) == 0) {
return en;
}
}
return null;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
......@@ -74,6 +74,8 @@ public class HPConstant {
public static final String PRO_ORDER_NO = "PRO_ORDER_NO";
public static final String HGSC008_WORK_CODE = "WORK_CODE";
// 整改通知单号
public static final String RECTIFY_ID = "RECTIFY_ID";
}
/**
......
......@@ -392,6 +392,19 @@ public class HPSqlConstant {
public static final String DO_PROCESS2 = "HPZL001.doProcess2";
}
/**
* @author:songx
* @date:2024/8/13,10:24
*/
public class HpZl004 {
// 锁
public static final String LOCK = "HPZL004.lock";
// 确认
public static final String CONFIRM = "HPZL004.confirm";
}
/**
* HPXSOrg SQL 定义
*
......
package com.baosight.hpjx.hp.dm.constant;
/**
* @author:songx
* @date:2024/8/13,16:43
*/
public class HpDmConstant {
/**
* 业务类型
*
* @author:songx
* @date:2024/8/13,16:43
*/
public static class BizType {
// 整改通知单-处理照片
public static final String RECTIFY_HANDLE = "RECTIFY_HANDLE";
// 整改通知单-问题照片
public static final String RECTIFY_DEFECT = "RECTIFY_DEFECT";
}
}
package com.baosight.hpjx.hp.dm.service;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.constant.S3Constant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.utils.Iplat4jUtils;
import com.baosight.hpjx.hp.dm.domain.HPDM099;
import com.baosight.hpjx.hp.xs.domain.HPXS007A;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.List;
import java.util.Map;
/**
* 附件清单
*
* @author:songx
* @date:2024/8/13,15:27
*/
public class ServiceHPDM099 extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPDM099().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
// 文件存储位置
if (CommonConstant.FileLocation.S3.equalsIgnoreCase(S3Constant.FILE_LOCATION)) {
inInfo = super.query(inInfo, "HPDM099.queryS3", new HPXS007A());
} else {
inInfo = super.query(inInfo, "HPDM099.queryLocal", new HPXS007A());
}
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param inInfo
* @return
*/
public EiInfo upload(EiInfo inInfo) {
try {
HPDM099 fDm099 = MapUtils.toDaoEPBase(inInfo, HPDM099.class);
fDm099.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPDM099.INSERT, fDm099);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("上传成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo delete(EiInfo inInfo) {
try {
List<HPDM099> fDm099s = MapUtils.toDaoEPBases(inInfo, HPDM099.class);
for (HPDM099 fDm099 : fDm099s) {
DaoUtils.update(HPDM099.DELETE, fDm099);
if (!fDm099.getDocId().isEmpty()) {
Iplat4jUtils.deleteFileByDocId(fDm099.getDocId());
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fDm099s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.dm.service;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
/**
* 附件上传
*
* @author:songx
* @date:2024/8/13,15:26
*/
public class ServiceHPDM099A extends ServiceBase {
/**
* 画面初始化.
*/
public EiInfo initLoad(EiInfo inInfo) {
return inInfo;
}
/**
* 附件上传.
*/
public EiInfo form(EiInfo inInfo) {
return inInfo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPDM099">
<sql id="column">
A.ID as "id",
A.COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
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.BIZ_TYPE as "bizType", <!-- 业务类型 -->
A.BIZ_ID as "bizId", <!-- 业务ID -->
A.DOC_ID as "docId" <!-- 文件ID -->
</sql>
<sql id="columnLocal">
<include refid="column"/>,
B.DOC_NAME as "docName" <!-- 文件名称 -->
</sql>
<sql id="columnS3">
<include refid="column"/>,
B.RES_CNAME as "docName" <!-- 文件名称 -->
</sql>
<sql id="condition">
AND A.DELETE_FLAG = '0'
<include refid="SqlBase.authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizType">
A.BIZ_TYPE = #bizType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizId">
A.BIZ_ID = #bizId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
A.DOC_ID = #docId#
</isNotEmpty>
</sql>
<sql id="customCondition">
<include refid="condition"/>
<isNotEmpty prepend=" AND " property="createdDateFrom">
A.CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateTo">
A.CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959')
</isNotEmpty>
</sql>
<!-- 本地 -->
<sql id="conditionLocal">
AND A.DOC_ID = B.DOC_ID
<include refid="customCondition"/>
<isNotEmpty prepend=" AND " property="docName">
B.DOC_NAME LIKE CONCAT('%', #docName#, '%')
</isNotEmpty>
</sql>
<!-- S3地址 -->
<sql id="conditionS3">
AND A.DOC_ID = B.RES_ID
<include refid="customCondition"/>
<isNotEmpty prepend=" AND " property="docName">
B.RES_CNAME LIKE CONCAT('%', #docName#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.ID asc
</isEmpty>
</dynamic>
</sql>
<select id="queryLocal" resultClass="com.baosight.hpjx.hp.dm.domain.HPDM099">
SELECT
<include refid="columnLocal"/>
FROM ${hpjxSchema}.T_HPDM099 A, ${platSchema}.TEUDM02 B
WHERE 1=1
<include refid="conditionLocal"/>
<include refid="orderBy"/>
</select>
<select id="countLocal" resultClass="int">
SELECT COUNT(*)
FROM ${hpjxSchema}.T_HPDM099 A, ${platSchema}.TEUDM02 B
WHERE 1=1
<include refid="conditionLocal"/>
</select>
<select id="queryS3" resultClass="com.baosight.hpjx.hp.dm.domain.HPDM099">
SELECT
<include refid="columnS3"/>
FROM ${hpjxSchema}.T_HPDM099 A, ${platSchema}.TEUDM05 B
WHERE 1=1
<include refid="conditionS3"/>
<include refid="orderBy"/>
</select>
<select id="countS3" resultClass="int">
SELECT COUNT(*)
FROM ${hpjxSchema}.T_HPDM099 A, ${platSchema}.TEUDM05 B
WHERE 1=1
<include refid="conditionS3"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPDM099 (
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除 -->
BIZ_TYPE, <!-- 业务类型 -->
BIZ_ID, <!-- 业务ID -->
DOC_ID <!-- 文件ID -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #bizType#, #bizId#, #docId#
)
</insert>
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPDM099
SET DELETE_FLAG = '1'
WHERE ID = #id#
</delete>
</sqlMap>
package com.baosight.hpjx.hp.dm.tools;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.constant.S3Constant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.dm.domain.HPDM099;
import com.baosight.hpjx.hp.xs.domain.HPXS007A;
import com.baosight.hpjx.hp.zl.domain.HPZL004;
import com.baosight.hpjx.util.AssertUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/8/13,16:40
*/
public class HpDmTools {
/**
* @author:songx
* @date:2024/8/13,16:40
*/
public static class HpDm099 {
/**
* 查询
*
* @param bizType
* @param bizId
* @return
*/
public static List<HPDM099> list(String bizType, String bizId) {
AssertUtils.isEmpty(bizId, "业务ID不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put(HPDM099.FIELD_BIZ_TYPE, bizType);
paramMap.put(HPDM099.FIELD_BIZ_ID, bizId);
if (CommonConstant.FileLocation.S3.equalsIgnoreCase(S3Constant.FILE_LOCATION)) {
return DaoBase.getInstance().query("HPDM099.queryS3", paramMap);
} else {
return DaoBase.getInstance().query("HPDM099.queryLocal", paramMap);
}
}
}
}
package com.baosight.hpjx.hp.xs.domain;
import java.io.Serializable;
import com.baosight.iplat4j.core.data.DaoEPBase;
/**
* @author:songx
* @date:2024/1/15,14:50
*/
public class User implements Serializable {
public class User extends DaoEPBase {
public static final String FIELD_USER_ID = "userId"; /* 用户ID*/
public static final String FIELD_USER_NAME = "userName"; /* 用户中文名*/
......
......@@ -70,7 +70,7 @@ public class ServiceHPXS007A extends ServiceEPBase {
@OperationLogAnnotation(operModul = "附件清单", operType = "新增", operDesc = "客户回访-附件清单A-新增操作")
public EiInfo insert(EiInfo inInfo) {
try {
List<HPXS007A> fXs007s = MapUtils.toDaoEPBase(inInfo, HPXS007A.class);
List<HPXS007A> fXs007s = MapUtils.toDaoEPBases(inInfo, HPXS007A.class);
for (HPXS007A fXs007 : fXs007s) {
DaoUtils.insert(HPXS007A.INSERT, fXs007);
}
......@@ -91,7 +91,7 @@ public class ServiceHPXS007A extends ServiceEPBase {
@OperationLogAnnotation(operModul = "附件清单", operType = "删除", operDesc = "客户回访-附件清单A-删除操作")
public EiInfo delete(EiInfo inInfo) {
try {
List<HPXS007A> fXs007s = MapUtils.toDaoEPBase(inInfo, HPXS007A.class);
List<HPXS007A> fXs007s = MapUtils.toDaoEPBases(inInfo, HPXS007A.class);
for (HPXS007A fXs007 : fXs007s) {
DaoUtils.update(HPXS007A.DELETE, fXs007);
if (StringUtils.isNotBlank(fXs007.getDocId())) {
......
package com.baosight.hpjx.hp.zl.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.enums.HandleStatusEnum;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.dm.constant.HpDmConstant;
import com.baosight.hpjx.hp.dm.domain.HPDM099;
import com.baosight.hpjx.hp.dm.tools.HpDmTools;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.hp.zl.domain.HPZL004;
import com.baosight.hpjx.hp.zl.tools.HPZLTools;
import com.baosight.hpjx.hp.zl.utils.HpZlUtils;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author wwl
* @date 2025年05月29日 17:18
*/
public class ServiceHPZL004 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "整改通知单", operType = "查询", operDesc = "初始化查询")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPZL004().eiMetadata);
// inInfo = super.query(inInfo, HGZL004.QUERY, new HGZL004());
EiInfoUtils.addBlock(inInfo, "userBlockId", UserSessionUtils.getUser(), User.class);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "整改通知单", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPZL004.QUERY, new HPZL004());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 确认处理
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "整改通知单", operType = "处理完成", operDesc = "处理完成")
public EiInfo confirm(EiInfo inInfo) {
try {
List<HPZL004> fZl004s = MapUtils.toDaoEPBases(inInfo, HPZL004.class);
// 锁
Map<String, HPZL004> dbZl004Map = HpZlUtils.HpZl004.lockGetDataEp(fZl004s);
// 数据校验
this.checkData(fZl004s, dbZl004Map);
// 修改数据
this.saveData(fZl004s, dbZl004Map);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fZl004s.size() + "]条数据操作成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fZl004s
* @param dbZl004Map
*/
private void checkData(List<HPZL004> fZl004s, Map<String, HPZL004> dbZl004Map) {
for (HPZL004 fZl004 : fZl004s) {
String rectifyId = fZl004.getRectifyId();
HPZL004 dbZl004 = dbZl004Map.get(rectifyId);
AssertUtils.isNull(dbZl004, String.format("整改通知单【%s】不存在!", fZl004.getRectifyId()));
AssertUtils.isNotEquals(HandleStatusEnum.UNPROCESS.getCode(), dbZl004.getStatus(),
String.format("整改通知单【%s】的状态不是\"未处理\",不允许操作!", dbZl004.getRectifyId()));
AssertUtils.isEmpty(dbZl004.getRectifySugges(), String.format("整改通知单【%s】的整改措施不能为空!",
dbZl004.getRectifyId()));
// 处理照片不能为空
List<HPDM099> dbDm099s = HpDmTools.HpDm099.list(HpDmConstant.BizType.RECTIFY_HANDLE,
dbZl004.getRectifyId());
AssertUtils.isEmpty(dbDm099s, String.format("整改通知单【%s】还未上传处理照片!",
dbZl004.getRectifyId()));
}
}
/**
* 保存数据
*
* @param fZl004s
* @param dbZl004Map
*/
private void saveData(List<HPZL004> fZl004s, Map<String, HPZL004> dbZl004Map) {
for (HPZL004 fZl004 : fZl004s) {
fZl004.setStatus(HandleStatusEnum.PROCESSED.getCode());
fZl004.setCheckBy(UserSessionUtils.getLoginName());
fZl004.setCheckName(UserSessionUtils.getLoginCName());
fZl004.setCheckTime(DateUtils.shortDateTime());
DaoUtils.update(HPSqlConstant.HpZl004.CONFIRM, fZl004);
}
}
}
package com.baosight.hpjx.hp.zl.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.enums.HandleStatusEnum;
import com.baosight.hpjx.hp.zl.domain.HPZL004;
import com.baosight.hpjx.hp.zl.domain.HPZL004A;
import com.baosight.hpjx.hp.zl.utils.HpZlUtils;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.List;
import java.util.Map;
/**
* @author wwl
* @date 2025年05月29日 17:18
*/
public class ServiceHPZL004A extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "整改通知单-沟通记录", operType = "查询", operDesc = "初始化查询")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPZL004A().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "整改通知单-沟通记录", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPZL004A.QUERY, new HPZL004A());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "整改通知单-沟通记录", operType = "保存", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
// 取整改通知单ID
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String rectifyId = MapUtils.getString(queryMap, HPZL004A.FIELD_RECTIFY_ID);
List<HPZL004A> fZl004as = MapUtils.toDaoEPBases(inInfo, HPZL004A.class);
// 锁
HPZL004 dbZl004 = HpZlUtils.HpZl004.lockGetData(rectifyId);
// 数据校验
this.checkSaveData(fZl004as, dbZl004);
// 写入数据
this.saveData(fZl004as, rectifyId);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fZl004as
* @param dbZl004
*/
private void checkSaveData(List<HPZL004A> fZl004as, HPZL004 dbZl004) {
AssertUtils.isNull(dbZl004, "请选择整改通知单");
AssertUtils.isNotEquals(HandleStatusEnum.UNPROCESS.getCode(), dbZl004.getStatus(),
String.format("整改通知单【%s】的状态不是\"未处理\",不允许操作!", dbZl004.getRectifyId()));
for (HPZL004A fZl004a : fZl004as) {
AssertUtils.isEmpty(fZl004a.getContent(), "沟通内容不能为空");
}
}
/**
* 数据校验
*
* @param fZl004as
* @param rectifyId
*/
private void saveData(List<HPZL004A> fZl004as, String rectifyId) {
for (HPZL004A fZl004a : fZl004as) {
// 判断是新增还是修改
if (fZl004a.getId() == null || fZl004a.getId() == 0) {
fZl004a.setRectifyId(rectifyId);
fZl004a.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPZL004A.INSERT, fZl004a);
} else {
// 更新数据
DaoUtils.update(HPZL004A.UPDATE, fZl004a);
}
}
}
}
package com.baosight.hpjx.hp.zl.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.enums.HandleStatusEnum;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.zl.domain.HPZL004;
import com.baosight.hpjx.hp.zl.tools.HPZLTools;
import com.baosight.hpjx.hp.zl.utils.HpZlUtils;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.List;
import java.util.Map;
/**
* 选择质量巡检单
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPZL004B extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "生产任务查询", operType = "查询", operDesc = "质量巡检单-生产任务查询-初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
// 查询物料信息
this.setQualityInfo(inInfo);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPZL004().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 设置物料信息
*
* @param inInfo
*/
public void setQualityInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String rectifyId = MapUtils.getString(queryRow, HPZL004.FIELD_RECTIFY_ID);
if (StringUtils.isBlank(rectifyId)) {
return;
}
EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
resultBlock.addRow(HPZLTools.HpZl004.get(rectifyId));
resultBlock.addBlockMeta(new HPZL004().eiMetadata);
inInfo.setBlock(resultBlock);
}
/**
* 保存
*
* @param inInfo
* @return
*/
public EiInfo save(EiInfo inInfo) {
try {
HPZL004 fZl004 = MapUtils.toDaoEPBase(inInfo, HPZL004.class);
// 判断是新增还是修改
if (StringUtils.isBlank(fZl004.getRectifyId())) {
addData(fZl004);
} else {
this.modifyData(fZl004);
}
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增数据
*
* @param fZl004
*/
private void addData(HPZL004 fZl004) {
fZl004.setRectifyId(SequenceGenerator.getNextSequence(HPConstant.SequenceId.RECTIFY_ID));
fZl004.setDeleteFlag(CommonConstant.YesNo.NO_0);
fZl004.setStatus(HandleStatusEnum.UNPROCESS.getCode());
DaoUtils.insert(HPZL004.INSERT, fZl004);
}
/**
* 修改数据
*
* @param fZl004
*/
private void modifyData(HPZL004 fZl004) {
// 锁
HPZL004 dbZl004 = HpZlUtils.HpZl004.lockGetData(fZl004.getRectifyId());
// 数据校验
this.checkModifyData(fZl004, dbZl004);
// 更新数据
DaoUtils.update(HPZL004.UPDATE, fZl004);
}
/**
* 数据校验
*
* @param fZl004
* @param dbZl004
*/
private void checkModifyData(HPZL004 fZl004, HPZL004 dbZl004) {
String rectifyId = fZl004.getRectifyId();
AssertUtils.isNull(dbZl004, String.format("整改通知单【%s】不存在!", rectifyId));
AssertUtils.isNotEquals(HandleStatusEnum.UNPROCESS.getCode(), dbZl004.getStatus(),
String.format("整改通知单【%s】的状态不是\"未处理\",不允许操作!", rectifyId));
AssertUtils.isEmpty(fZl004.getQualityProblem(), "质量问题不能为空");
AssertUtils.isEmpty(fZl004.getProcessSugges(), "处理意见不能为空");
}
}
package com.baosight.hpjx.hp.zl.service;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.constant.S3Constant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.enums.HandleStatusEnum;
import com.baosight.hpjx.core.utils.Iplat4jUtils;
import com.baosight.hpjx.hp.dm.domain.HPDM099;
import com.baosight.hpjx.hp.xs.domain.HPXS007A;
import com.baosight.hpjx.hp.zl.domain.HPZL004;
import com.baosight.hpjx.hp.zl.domain.HPZL004C;
import com.baosight.hpjx.hp.zl.tools.HPZLTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.List;
import java.util.Map;
/**
* 附件清单
*
* @author:songx
* @date:2024/8/13,15:27
*/
public class ServiceHPZL004C extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 加载整改通知单的状态
HPZL004 dbZl004 = HPZLTools.HpZl004.get(MapUtils.getString(queryMap, HPZL004.FIELD_RECTIFY_ID));
AssertUtils.isNull(dbZl004, "整改通知单不存在");
queryMap.put(HPZL004.FIELD_STATUS, dbZl004.getStatus());
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPZL004C().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPZL004C.QUERY, new HPZL004C());
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param inInfo
* @return
*/
public EiInfo upload(EiInfo inInfo) {
try {
HPZL004C fZl004c = MapUtils.toDaoEPBase(inInfo, HPZL004C.class);
// 数据校验
this.checkUploadData(fZl004c);
fZl004c.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPZL004C.INSERT, fZl004c);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("上传成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "上传失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fZl004c
*/
private void checkUploadData(HPZL004C fZl004c) {
String rectifyId = fZl004c.getRectifyId();
HPZL004 dbZl004 = HPZLTools.HpZl004.get(rectifyId);
AssertUtils.isNull(dbZl004, String.format("整改通知单【%s】不存在", rectifyId));
AssertUtils.isNotEquals(HandleStatusEnum.UNPROCESS.getCode(), dbZl004.getStatus(),
String.format("整改通知单【%s】状态不是\"未处理\",不允许操作", rectifyId));
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo delete(EiInfo inInfo) {
try {
// 数据校验
this.checkDeleteData(inInfo);
List<HPZL004C> fZl004cs = MapUtils.toDaoEPBases(inInfo, HPZL004C.class);
for (HPZL004C fZl004c : fZl004cs) {
DaoUtils.update(HPZL004C.DELETE, fZl004c);
if (StringUtils.isNotBlank(fZl004c.getDocId())) {
Iplat4jUtils.deleteFileByDocId(fZl004c.getDocId());
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fZl004cs.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param inInfo
*/
private void checkDeleteData(EiInfo inInfo) {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String rectifyId = MapUtils.getString(queryMap, HPZL004.FIELD_RECTIFY_ID);
HPZL004 dbZl004 = HPZLTools.HpZl004.get(rectifyId);
AssertUtils.isNull(dbZl004, String.format("整改通知单【%s】不存在", rectifyId));
AssertUtils.isNotEquals(HandleStatusEnum.UNPROCESS.getCode(), dbZl004.getStatus(),
String.format("整改通知单【%s】状态不是\"未处理\",不允许操作", rectifyId));
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPZL004">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除 -->
RECTIFY_ID as "rectifyId", <!-- 整改ID -->
STATUS as "status", <!-- 状态,0:待处理;1:处理中;2:已处理 -->
QUALITY_PROBLEM as "qualityProblem", <!-- 质量问题 -->
PROCESS_SUGGES as "processSugges", <!-- 处理意见 -->
RECTIFY_SUGGES as "rectifySugges", <!-- 整改措施 -->
CHECK_BY as "checkBy", <!-- 质检人 -->
CHECK_NAME as "checkName", <!-- 质检人名称 -->
CHECK_TIME as "checkTime" <!-- 质检时间 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = '0'
<include refid="SqlBase.authCondition"/>
<include refid="idCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="qualityProblem">
QUALITY_PROBLEM = #qualityProblem#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processSugges">
PROCESS_SUGGES = #processSugges#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="rectifySugges">
RECTIFY_SUGGES = #rectifySugges#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="checkBy">
CHECK_BY = #checkBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="checkName">
CHECK_NAME = #checkName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="checkTime">
CHECK_TIME = #checkTime#
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="rectifyId">
RECTIFY_ID = #rectifyId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="rectifyIds">
RECTIFY_ID IN <iterate close=")" open="(" conjunction="," property="rectifyIds">#rectifyIds[]#</iterate>
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.zl.domain.HPZL004">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPZL004
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPZL004
WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPZL004 (
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除 -->
RECTIFY_ID, <!-- 整改ID -->
STATUS, <!-- 状态,0:待处理;1:处理中;2:已处理 -->
QUALITY_PROBLEM, <!-- 质量问题 -->
PROCESS_SUGGES, <!-- 处理意见 -->
RECTIFY_SUGGES <!-- 整改措施 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #rectifyId#, #status#, #qualityProblem#, #processSugges#,
#rectifySugges#
)
</insert>
<!-- 逻辑删除 -->
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPZL004
SET DELETE_FLAG = '1'
WHERE RECTIFY_ID = #rectifyId#
</delete>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hpjxSchema}.T_HPZL004
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
<!-- 修改 -->
<update id="update">
UPDATE ${hpjxSchema}.T_HPZL004
SET
QUALITY_PROBLEM = #qualityProblem#, <!-- 质量问题 -->
PROCESS_SUGGES = #processSugges#, <!-- 处理意见 -->
RECTIFY_SUGGES = #rectifySugges#, <!-- 整改措施 -->
<include refid="SqlBase.updateRevise"/>
WHERE RECTIFY_ID = #rectifyId#
</update>
<!-- 确认处理 -->
<update id="confirm">
UPDATE ${hpjxSchema}.T_HPZL004
SET
STATUS = #status#, <!-- 状态,0:待处理;1:处理中;2:已处理 -->
CHECK_BY = #checkBy#, <!-- 质检人 -->
CHECK_NAME = #checkName#, <!-- 质检人名称 -->
CHECK_TIME = #checkTime#, <!-- 质检时间 -->
<include refid="SqlBase.updateRevise"/>
WHERE RECTIFY_ID = #rectifyId#
</update>
</sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPZL004A">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除 -->
RECTIFY_ID as "rectifyId", <!-- 整改通知单ID -->
CONTENT as "content" <!-- 沟通内容 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = '0'
<include refid="SqlBase.authCondition"/>
<include refid="SqlBase.createdTimeCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="rectifyId">
RECTIFY_ID = #rectifyId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="content">
CONTENT LIKE CONCAT('%', #content#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.zl.domain.HPZL004A">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPZL004A
WHERE 1=1
<include refid="condition" />
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPZL004A WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPZL004A (
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除 -->
RECTIFY_ID, <!-- 整改通知单ID -->
CONTENT <!-- 沟通内容 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #rectifyId#, #content#
)
</insert>
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPZL004A
SET DELETE_FLAG = '1'
WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPZL004A
SET
CONTENT = #content#, <!-- 沟通内容 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPZL004C">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除 -->
RECTIFY_ID as "rectifyId", <!-- 整改通知ID -->
RECTIFY_TYPE as "rectifyType", <!-- 类型 -->
DOC_ID as "docId", <!-- 文件ID -->
DOC_NAME as "docName" <!-- 文件名称 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="rectifyId">
RECTIFY_ID = #rectifyId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="rectifyType">
RECTIFY_TYPE = #rectifyType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docName">
DOC_NAME LIKE CONCAT('%', #docName#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.zl.domain.HPZL004C">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPZL004C
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPZL004C
WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPZL004C (
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除 -->
RECTIFY_ID, <!-- 整改通知ID -->
RECTIFY_TYPE, <!-- 类型 -->
DOC_ID, <!-- 文件ID -->
DOC_NAME <!-- 文件名称 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #rectifyId#, #rectifyType#,#docId#, #docName#
)
</insert>
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPZL004C
SET DELETE_FLAG = '1'
WHERE ID = #id#
</delete>
</sqlMap>
package com.baosight.hpjx.hp.zl.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.zl.domain.HPZL001;
import com.baosight.hpjx.hp.zl.domain.HPZL004;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @author:songx
......@@ -45,4 +50,82 @@ public class HPZLTools {
return results.get(0);
}
/**
* 整改通知单
*
* @author:songx
* @date:2024/8/13,10:20
*/
public static class HpZl004 {
/**
* 锁
*
* @param rectifyId
* @return
*/
public static void lock(String rectifyId) {
if (StringUtils.isBlank(rectifyId)) {
return;
}
Map queryMap = new HashMap();
queryMap.put(HPZL004.FIELD_RECTIFY_ID, rectifyId);
DaoBase.getInstance().update(HPSqlConstant.HpZl004.LOCK, queryMap);
}
/**
* 锁
*
* @param rectifyIds
* @return
*/
public static void lock(List<String> rectifyIds) {
if (CollectionUtils.isEmpty(rectifyIds)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("rectifyIds", rectifyIds);
DaoBase.getInstance().update(HPSqlConstant.HpZl004.LOCK, queryMap);
}
/**
* GET
*
* @param rectifyId
*/
public static HPZL004 get(String rectifyId) {
AssertUtils.isNull(rectifyId, "ID不能为空");
Map paramMap = new HashMap();
paramMap.put(HPZL004.FIELD_RECTIFY_ID, rectifyId);
List<HPZL004> results = DaoBase.getInstance().query(HPZL004.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param rectifyIds
* @return
*/
public static List<HPZL004> list(List<String> rectifyIds) {
AssertUtils.isEmpty(rectifyIds, "ID不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("rectifyIds", rectifyIds);
return DaoBase.getInstance().query(HPZL004.QUERY, paramMap);
}
/**
* 查询
*
* @param rectifyIds
* @return
*/
public static Map<String, HPZL004> map(List<String> rectifyIds) {
List<HPZL004> results = list(rectifyIds);
return results.stream().collect(Collectors.toMap(HPZL004::getRectifyId, item -> item));
}
}
}
package com.baosight.hpjx.hp.zl.utils;
import com.baosight.hpjx.hp.zl.domain.HPZL004;
import com.baosight.hpjx.hp.zl.tools.HPZLTools;
import com.baosight.hpjx.util.ObjectUtils;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/8/13,16:31
*/
public class HpZlUtils {
/**
* @author:songx
* @date:2024/8/13,16:32
*/
public static class HpZl004 {
/**
* 锁并且获取数据
*
* @param rectifyId
* @return
*/
public static HPZL004 lockGetData(String rectifyId) {
// 锁
HPZLTools.HpZl004.lock(rectifyId);
// db数据
return HPZLTools.HpZl004.get(rectifyId);
}
/**
* 锁并且获取数据
*
* @param zl004s
* @return
*/
public static Map<String, HPZL004> lockGetDataEp(List<? extends HPZL004> zl004s) {
return lockGetData(ObjectUtils.listEpKey(zl004s, HPZL004.FIELD_ID));
}
/**
* 锁并且获取数据
*
* @param rectifyIds
* @return
*/
public static Map<String, HPZL004> lockGetData(List<String> rectifyIds) {
// 锁
HPZLTools.HpZl004.lock(rectifyIds);
// db数据
return HPZLTools.HpZl004.map(rectifyIds);
}
}
}
......@@ -162,4 +162,30 @@ public class AssertUtils {
}
}
/**
* bool is true
*
* @param a
* @param b
* @param message
*/
public static void isEquals(Object a, Object b, String message) {
if (a == null || a.equals(b)) {
throw new PlatException(message);
}
}
/**
* bool is true
*
* @param a
* @param b
* @param message
*/
public static void isNotEquals(Object a, Object b, String message) {
if (a == null || !a.equals(b)) {
throw new PlatException(message);
}
}
}
......@@ -164,7 +164,7 @@ public class MapUtils extends org.apache.commons.collections.MapUtils {
* @param clazz
* @param <T>
*/
public static <T extends DaoEPBase> List<T> toDaoEPBase(EiInfo inInfo, Class<T> clazz) {
public static <T extends DaoEPBase> T toDaoEPBase(EiInfo inInfo, Class<T> clazz) {
return toDaoEPBase(inInfo, EiConstant.resultBlock, clazz);
}
......@@ -176,9 +176,54 @@ public class MapUtils extends org.apache.commons.collections.MapUtils {
* @param clazz
* @param <T>
*/
public static <T extends DaoEPBase> List<T> toDaoEPBase(EiInfo inInfo, String blockId, Class<T> clazz) {
public static <T extends DaoEPBase> T toDaoEPBase(EiInfo inInfo, String blockId, Class<T> clazz) {
Map rowMap = inInfo.getBlock(blockId).getRow(0);
return toDaoEPBase(rowMap, clazz);
}
/**
* map 转 DaoEPBase
*
* @param rowMap
* @param clazz
* @param <T>
*/
public static <T extends DaoEPBase> T toDaoEPBase(Map rowMap, Class<T> clazz) {
if (MapUtils.isEmpty(rowMap) || clazz == null) {
return null;
}
T newBean = null;
try {
newBean = clazz.newInstance();
newBean.fromMap(rowMap);
} catch (Exception e) {
log.error("class new instance fail:{}", e.getMessage(), e);
}
return newBean;
}
/**
* map 转 DaoEPBase
*
* @param inInfo
* @param clazz
* @param <T>
*/
public static <T extends DaoEPBase> List<T> toDaoEPBases(EiInfo inInfo, Class<T> clazz) {
return toDaoEPBases(inInfo, EiConstant.resultBlock, clazz);
}
/**
* map 转 DaoEPBase
*
* @param inInfo
* @param blockId
* @param clazz
* @param <T>
*/
public static <T extends DaoEPBase> List<T> toDaoEPBases(EiInfo inInfo, String blockId, Class<T> clazz) {
List<Map> rows = inInfo.getBlock(blockId).getRows();
return toDaoEPBase(rows, clazz);
return toDaoEPBases(rows, clazz);
}
/**
......@@ -188,7 +233,7 @@ public class MapUtils extends org.apache.commons.collections.MapUtils {
* @param clazz
* @param <T>
*/
public static <T extends DaoEPBase> List<T> toDaoEPBase(List<Map> maps, Class<T> clazz) {
public static <T extends DaoEPBase> List<T> toDaoEPBases(List<Map> maps, Class<T> clazz) {
if (CollectionUtils.isEmpty(maps) || clazz == null) {
return null;
}
......@@ -203,4 +248,5 @@ public class MapUtils extends org.apache.commons.collections.MapUtils {
return newBean;
}).filter(t -> t != null).collect(Collectors.toList());
}
}
......@@ -9,7 +9,14 @@
<!-- 基础查询条件 -->
<sqlMap resource="com/baosight/hpjx/core/dao/SqlBase.xml"/>
<!-- 基础服务 -->
<sqlMap resource="com/baosight/hpjx/hp/dm/sql/HPDM099.xml"/>
<!-- 用户服务 -->
<sqlMap resource="com/baosight/hpjx/hp/xs/sql/HPXS007A.xml"/>
<!-- 质量管理 -->
<sqlMap resource="com/baosight/hpjx/hp/zl/sql/HPZL004.xml"/>
<sqlMap resource="com/baosight/hpjx/hp/zl/sql/HPZL004A.xml"/>
</sqlMapConfig>
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + downloadHref(item.docId) + '" target="_blank">附件下载</a>';
return template;
}
}],
loadComplete: function (grid) {
// 附件上传
$("#UPLOAD_FILE").on("click", uploadFile);
// 删除
$("#BTN_DELETE").on("click", deleteFunc);
},
dataBound: function () {
}
}
};
$("#ef_form_head").hide();
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 初始化查询
query();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
}
/**
* 文件上传
*
* @param id
*/
function uploadFile(id) {
JSColorbox.open({
href: "HPDM099A",
title: "<div style='text-align: center;'>附件上传</div>",
width: "60%",
height: "50%",
callbackName: uploadFileCallback
});
}
/**
* 附件上传回调
*
* @param docId
*/
function uploadFileCallback(res) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-bizId", $("#inqu_status-0-bizId").val());
inEiInfo.set("result-0-bizType", $("#inqu_status-0-bizType").val());
inEiInfo.set("result-0-docId", res.docId);
EiCommunicator.send('HPDM099', 'upload', inEiInfo, {
onSuccess(response) {
resultGrid.dataSource.page(1);
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
});
}
/**
* 删除
*/
function deleteFunc() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作?", {
ok: function () {
JSUtils.submitGridsData("result", "HPDM099", "delete", true);
}
})
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="附件清单">
<EF:EFRegion id="inqu" title="查询区域" type="query">
<EF:EFInput cname="业务ID" ename="bizId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFInput cname="文件名称" ename="docName" blockId="inqu_status" row="0" colWidth="3" />
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="150"/>
<EF:EFColumn ename="docName" cname="文件名称" enable="false" width="150"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
parseFormats="['yyyyMMddHHmmss']" editType="datetime" dateFormat="yyyy-MM-dd HH:mm:ss"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="200" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFUpload = {
uploadFile: {
success: function (e) {
let docId = e.response.docId;
if (isBlank(docId)) {
return;
}
NotificationUtil("附件上传成功");
try {
parent.JSColorbox.setValueCallback(e.response);
} catch (e) {
}
},
}
};
});
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="附件上传">
<EF:EFRegion id="result" title="请选择文件">
<EF:EFUpload blockId="result" ename="uploadFile" docTag="fj_file" path="biz"/>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
pageable: {
input: true,
numeric: false,
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200]
},
columns: [{
field: "operator",
template: function (item) {
let status = item.status;
let template = "";
// 0-未处理状态
if (status == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="modify(\'' + item.rectifyId + '\')" >修改</a>';
}
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="communication(\'' + item.rectifyId + '\')" >沟通记录</a>';
return template;
}
}, {
field: "problemPic",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(\'' + item.rectifyId
+ '\', \'RECTIFY_DEFECT\', \'问题照片\')" >问题照片</a>';
return template;
}
}, {
field: "processPic",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(\'' + item.rectifyId
+ '\', \'RECTIFY_HANDLE\', \'处理照片\')" >处理照片</a>';
return template;
}
}],
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'complete') {
query();
}
},
loadComplete: function (grid) {
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
}
}
}
// 查询
$("#QUERY").on("click", query);
// 新增
$("#ADD").on("click", add);
// 确认处理
$("#CONFIRM").on("click", confirm);
});
/**
* 页面加载完
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
function query() {
resultGrid.dataSource.page(1);
}
/**
* 新增
*/
let add = function () {
addOrUpdate("");
}
/**
* 修改
*
* @param rectifyId
*/
let modify = function (rectifyId) {
let params = "&inqu_status-0-rectifyId=" + rectifyId;
addOrUpdate(params);
}
/**
* 新增
*/
let addOrUpdate = function (params) {
JSColorbox.open({
href: "HPZL004B?methodName=initLoad" + params,
title: "<div style='text-align: center;'>" + (isBlank(params) ? "新增整改通知单" : "修改整改通知单") + "</div>",
width: "60%",
height: "70%",
callbackName: addOrUpdateCallback
});
}
/**
* 新增回调
*/
let addOrUpdateCallback = function (e) {
// 返回信息
message(e.msg);
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
/**
* 显示附件清单
*
* @param id
*/
function showUploadFile(rectifyId, rectifyType, title) {
JSColorbox.open({
href: "HPZL004C?methodName=initLoad&inqu_status-0-rectifyType=" + rectifyType
+ "&inqu_status-0-rectifyId=" + rectifyId,
title: "<div style='text-align: center;'>" + title + "</div>",
width: "85%",
height: "80%",
});
}
/**
* 沟通记录
*
* @param rectifyId
*/
function communication(rectifyId) {
JSColorbox.open({
href: "HPZL004A?methodName=initLoad&inqu_status-0-rectifyId=" + rectifyId,
title: "<div style='text-align: center;'>沟通记录</div>",
width: "85%",
height: "80%",
});
}
/**
* 确认处理
*/
function confirm() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message2("确认处理", "没有选中的行");
return;
}
for (let i = 0; i < rows.length; i++) {
let status = rows[i]['status'];
if (status != '0') {
message2("确认处理", "第" + (i + 1) + "行状态不是\"未处理\",不允许操作");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据处理操作吗? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPZL004", "confirm", true,
function (res) {
message(res.msg);
if (res.getStatus() >= 0) {
query();
}
}
);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="整改通知单">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput ename="projCode" cname="项目编号" blockId="inqu_status" row="0" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput ename="projName" cname="项目名称" blockId="inqu_status" row="0" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput ename="productName" cname="产品名称" blockId="inqu_status" row="0" placeholder="模糊查询" colWidth="3"/>
</div>
<div class="row">
<EF:EFInput ename="checkName" cname="质检人" blockId="inqu_status" row="0" placeholder="模糊查询" colWidth="3"/>
<EF:EFSelect cname="处理状态" ename="handleStatus" blockId="inqu_status" row="0" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.handleStatus"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="checkBy" cname="质检员" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="140" align="center"/>
<EF:EFColumn ename="problemPic" cname="问题照片" width="90" enable="false" align="center"/>
<EF:EFColumn ename="processPic" cname="处理照片" width="90" enable="false" align="center"/>
<EF:EFColumn ename="rectifyId" cname="单据ID" enable="false" width="130" align="center"/>
<EF:EFColumn ename="createdTime" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd"
parseFormats="['yyyyMMdd']" enable="true" width="120" align="center" readOnly="true"/>
<EF:EFComboColumn ename="status" cname="处理状态" width="80" align="center" enable="false">
<EF:EFCodeOption codeName="hpjx.hpzl.handleStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="qualityProblem" cname="质量问题描述" enable="true" width="130" align="center"/>
<EF:EFColumn ename="processSugges" cname="处理意见" enable="true" width="130" align="center"/>
<EF:EFColumn ename="rectifySugges" cname="整改措施" enable="true" width="130" align="center"/>
<EF:EFColumn ename="checkName" cname="处理人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="checkTime" cname="处理时间" enable="true" width="140" align="center" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" parseFormats="['yyyyMMddHHmmss']" readOnly="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
pageable: {
input: true,
numeric: false,
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200]
},
columns: [],
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
loadComplete: function (grid) {
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
}
}
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 查询
*/
function query() {
resultGrid.dataSource.page(1);
}
$(window).load(function () {
// 查
query();
});
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做保存操作吗? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPZL004A", "save", true);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="整改通知单-沟通记录">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput cname="整改通知单ID" ename="rectifyId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="content" cname="内容" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="createdName" cname="创建人" placeholder="模糊查询" colWidth="3"/>
<EF:EFDateSpan startCname="沟通日期(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="single">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="content" cname="内容" width="150" required="true" readonly="true" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" width="130" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" editType="date" enable="true" width="130"
dateFormat="yyyy-MM-dd HH:mm:ss" parseFormats="['yyyyMMddHHmmss']"
align="center" readOnly="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [],
dataBound: function () {
}
}
};
$("#ef_form_head").hide();
// 保存
$("#SAVE").on("click", save);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 键盘按键
downKeyUp();
});
/**
* 保存
*/
let save = function () {
let msg = checkParams();
if (msg != null) {
message(msg);
return;
}
JSUtils.confirm("确定进行\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("", "HPZL004B", "save", true,
function (e) {
// 操作成功,关闭弹窗
if (e.status !== -1) {
parent.JSColorbox.setValueCallback(e);
} else {
message(e.msg);
}
}
);
}
});
}
/**
* 参数校验
*/
let checkParams = function () {
let qualityProblem = $("#result-0-qualityProblem").val();
if (isBlank(qualityProblem)) {
return "质量问题不能为空";
}
let processSugges = $("#result-0-processSugges").val();
if (isBlank(processSugges)) {
return "处理意见不能为空";
}
let rectifySugges = $("#result-0-rectifySugges").val();
if (isBlank(rectifySugges)) {
return "整改措施不能为空";
}
return null;
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="新增整改通知单">
<EF:EFRegion id="result" title="数据区域">
<div class="row">
<EF:EFInput cname="单据ID" blockId="result" ename="rectifyId" row="0" colWidth="6" ratio="2:10"
readonly="true"/>
</div>
<div class="row">
<EF:EFInput cname="质量问题" blockId="result" ename="qualityProblem" row="0" colWidth="6" ratio="2:10"
required="true" type="textarea" rows="4" maxLength="500"/>
</div>
<div class="row">
<EF:EFInput cname="处理意见" blockId="result" ename="processSugges" row="0" colWidth="6" ratio="2:10"
required="true" type="textarea" rows="4" maxLength="500"/>
</div>
<div class="row">
<EF:EFInput cname="整改措施" blockId="result" ename="rectifySugges" row="0" colWidth="6" ratio="2:10"
required="true" type="textarea" rows="4" maxLength="500"/>
</div>
<br/>
<span style="color: red; ">说明:单据ID由系统自动生成</span><br>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + downloadHref(item.docId) + '" target="_blank">附件下载</a>';
return template;
}
}],
loadComplete: function (grid) {
},
dataBound: function () {
}
}
};
$("#ef_form_head").hide();
// 查询
$("#QUERY").on("click", query);
// 附件上传
$("#UPLOAD_FILE").on("click", uploadFile);
// 删除
$("#BTN_DELETE").on("click", deleteFunc);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 初始化查询
query();
// 已处理状态隐藏按钮
showButton();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
}
/**
* 显示按钮
*/
let showButton = function () {
let status = $("#inqu_status-0-status").val();
if (status != 0) {
$("#UPLOAD_FILE").hide();
$("#BTN_DELETE").hide();
}
}
/**
* 文件上传
*
* @param id
*/
function uploadFile(id) {
JSColorbox.open({
href: "HPDM099A",
title: "<div style='text-align: center;'>附件上传</div>",
width: "60%",
height: "50%",
callbackName: uploadFileCallback
});
}
/**
* 附件上传回调
*
* @param docId
*/
function uploadFileCallback(res) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-rectifyId", $("#inqu_status-0-rectifyId").val());
inEiInfo.set("result-0-rectifyType", $("#inqu_status-0-rectifyType").val());
inEiInfo.set("result-0-docId", res.docId);
inEiInfo.set("result-0-docName", res.docName);
EiCommunicator.send('HPZL004C', 'upload', inEiInfo, {
onSuccess(res) {
message(res.msg);
if (res.status >= 0) {
resultGrid.dataSource.page(1);
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
});
}
/**
* 删除
*/
function deleteFunc() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作?", {
ok: function () {
JSUtils.submitGridsData("result", "HPZL004C", "delete", true);
}
})
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="附件清单">
<EF:EFRegion id="inqu" title="查询区域" type="query">
<EF:EFInput cname="状态" ename="status" blockId="inqu_status" row="0" colWidth="3" type="hidden"/>
<div class="row">
<EF:EFInput cname="整改通知单号" ename="rectifyId" blockId="inqu_status" row="0" colWidth="3" readonly="true"/>
<EF:EFSelect cname="类型" ename="rectifyType" blockId="inqu_status" row="0" colWidth="3" readonly="true">
<EF:EFOption label="请选择" value=""/>
<EF:EFOption label="问题照片" value="RECTIFY_DEFECT"/>
<EF:EFOption label="处理照片" value="RECTIFY_HANDLE"/>
</EF:EFSelect>
<EF:EFInput cname="文件名称" ename="docName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="150"/>
<EF:EFColumn ename="docName" cname="文件名称" enable="false" width="150"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
parseFormats="['yyyyMMddHHmmss']" editType="datetime" dateFormat="yyyy-MM-dd HH:mm:ss"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="200" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -67,6 +67,19 @@ function message(msg) {
}
/**
* 消息提示
*
* @param title
* @param msg
*/
function message2(title, msg) {
WindowUtil({
title: title,
content: "<div class='kendo-del-message'>" + msg + "</div>"
});
}
/**
* 文件下载路径
*
* @param docId
......
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