Commit abe57f65 by 宋祥
parents 57d92599 0de4ee7c
package com.baosight.hpjx.common;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description 变更类型
*/
public enum ChangeTypeEnum {
ADD("add", "添加"),
UPDATE("update", "修改"),
DELETE("delete", "删除"),
UPLOAD_ADD("uploadAdd", "附件添加"),
UPLOAD_UPDATE("uploadUpdate", "附件变更"),
UPLOAD_DELETE("uploadDelete", "附件删除"),
RELEASE("release", "发布"),
;
private String code;
private String value;
ChangeTypeEnum(String code, String value) {
this.code = code;
this.value = value;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
package com.baosight.hpjx.common;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description
*/
public enum DeleteFlagEnum {
UN_REMOVE(0, "未删除"),
REMOVE(1, "已删除"),
;
private Integer code;
private String name;
DeleteFlagEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.baosight.hpjx.controller;
import com.baosight.hpjx.core.constant.S3Constant;
import com.baosight.hpjx.core.tools.ThreadLocalTools;
import com.baosight.hpjx.core.utils.Iplat4jUtils;
import com.baosight.hpjx.core.utils.S3Utils;
import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.common.eu.domain.Teudm05;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -19,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
......@@ -39,6 +44,31 @@ import lombok.extern.slf4j.Slf4j;
@CrossOrigin
@RequestMapping({"/file/download"})
public class FileDownloadController {
/**
* 预览文件
*
* @param docId
* @param response
* @throws IOException
*/
@RequestMapping({"/preview/{docId}"})
public void preview(@PathVariable String docId, HttpServletResponse response) throws IOException {
try {
if ("s3".equalsIgnoreCase(S3Constant.FILE_LOCATION)) {
Teudm05 dbDm05 = S3Utils.buildUrl(docId);
FileUtils.downloadUrlFile(dbDm05.getUrl(), dbDm05.getResCname(), true, response);
} else {
Map dbDm02 = Iplat4jUtils.getDoc02ById(docId);
String returnUrl = MapUtils.getString(dbDm02, "url");
String fileName = MapUtils.getString(dbDm02, "docName");
FileUtils.downloadFile(new File(returnUrl), fileName, true, response);
}
} catch (Exception e) {
String msg = String.format("预览文件【%s】失败!原因:%s", docId, LogUtils.getMsg(e));
response.getWriter().write(msg);
}
}
/**
* 更具docId下载文件
......@@ -81,6 +111,27 @@ public class FileDownloadController {
response.getWriter().write(msg);
}
}
/**
* 下载本地文件
*
* @param docId
* @param response
* @throws IOException
*/
@RequestMapping({"docId/{docId}"})
public void downloadUrls(@PathVariable String docId, HttpServletResponse response)
throws IOException {
try {
Map dbDm02 = Iplat4jUtils.getDoc02ById(docId);
String url = MapUtils.getString(dbDm02, "url");
String fileName = MapUtils.getString(dbDm02, "docName");
FileUtils.downloadFile(new File(url), fileName, false, response);
} catch (Exception e) {
String msg = String.format("下载文件【%s】失败!原因:%s", docId, LogUtils.getMsg(e));
response.getWriter().write(msg);
}
}
private String getReturnUrlByParam(Map<String, String[]> parameterMap, String returnUrl)
throws UnsupportedEncodingException {
......
......@@ -86,8 +86,18 @@ public class CommonConstant {
public static final String PRODUCTTION_ORDER_NO = "productionOrderNo";
// ROOT
public static final String ROOT = "root";
// ROOT2
public static final String ROOT2 = "$";
// NODE
public static final String NODE = "node";
// 项目档案ID
public static final String PROJ_ID = "projId";
// 企业管理员
public static final String COMPANY_MANAGE = "companyManage";
// ADMIN
public static final String ADMIN = "ADMIN";
public static final String ENAME = "ename";
}
/**
......
package com.baosight.hpjx.core.dao;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
......@@ -12,6 +11,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -56,6 +56,37 @@ public class DaoUtils {
}
DaoBase.getInstance().insert(sql, obj);
}
/**
* insertBatch method.
*
* @param sql
* @param rows
*/
public static void batchInsert(String sql, List rows) {
// 创建人部门
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
String depCode = orgIds.get(0);
for (Object row : rows) {
if (row instanceof DaoEPBase) {
DaoEPBase daoEPBase = (DaoEPBase) row;
try {
BeanUtils.setProperty(daoEPBase, "depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人部门编码失败", e);
}
setCreator(daoEPBase);
} else if (row instanceof Map) {
Map map = (Map) row;
map.put("depCode", depCode);
setCreator(map);
}
}
Map paramMap = new HashMap();
paramMap.put("rows", rows);
DaoBase.getInstance().insert(sql, paramMap);
}
/**
* update method.
......@@ -88,7 +119,7 @@ public class DaoUtils {
}
try {
BeanUtils.setProperty(bean, "createdBy", userId);
BeanUtils.setProperty(bean, "updatedBy", "");
BeanUtils.setProperty(bean, "updatedBy", userId);
} catch (Exception e) {
log.warn("写入创建人ID失败", e);
}
......@@ -101,7 +132,7 @@ public class DaoUtils {
userName = "System";
}
BeanUtils.setProperty(bean, "createdName", userName);
BeanUtils.setProperty(bean, "updatedName", "");
BeanUtils.setProperty(bean, "updatedName", userName);
} catch (Exception e) {
log.warn("写入创建人姓名失败", e);
}
......@@ -123,8 +154,9 @@ public class DaoUtils {
}
// 创建时刻
try {
BeanUtils.setProperty(bean, "createdTime", DateUtils.shortDateTime());
BeanUtils.setProperty(bean, "updatedTime", "");
String dateTime = DateUtils.shortDateTime();
BeanUtils.setProperty(bean, "createdTime", dateTime);
BeanUtils.setProperty(bean, "updatedTime", dateTime);
} catch (Exception e) {
log.error("写入创建时刻失败:{}", e.getMessage(), e);
}
......@@ -147,7 +179,7 @@ public class DaoUtils {
userId = "System";
}
map.put("createdBy", userId);
map.put("updatedBy", "");
map.put("updatedBy", userId);
// 创建人姓名
String userName = MapUtils.getString(map, "createdName");
try {
......@@ -158,7 +190,7 @@ public class DaoUtils {
userName = "System";
}
map.put("createdName", userName);
map.put("updatedName", "");
map.put("updatedName", userName);
// 创建人企业编码
String companyCode = UserSessionUtils.getCompanyCode();
AssertUtils.isEmpty(companyCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
......@@ -177,8 +209,9 @@ public class DaoUtils {
}
// 创建时刻
try {
map.put("createdTime", DateUtils.shortDateTime());
map.put("updatedTime", "");
String dateTime = DateUtils.shortDateTime();
map.put("createdTime", dateTime);
map.put("updatedTime", dateTime);
} catch (PlatException e) {
log.warn("写入创建时刻失败", e);
}
......
......@@ -37,6 +37,18 @@
</isNotEmpty>
</sql>
<sql id="authConditionA">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
......
......@@ -90,5 +90,19 @@ public class Iplat4jTools {
List<Teudm05> results = DaoBase.getInstance().query("EUDM05.getDocByDocId", paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询页面信息
*
* @param docId
* @return
*/
public static Teudm05 getByDocId(String docId) {
AssertUtils.isEmpty(docId, "文件ID不能为空!");
Map<String, String> paramMap = new HashMap();
paramMap.put("resId", docId);
List<Teudm05> results = DaoBase.getInstance().query("EUDM05.getDocByDocId", paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
}
}
......@@ -3,6 +3,7 @@ package com.baosight.hpjx.core.utils;
import com.baosight.hpjx.core.constant.S3Constant;
import com.baosight.hpjx.core.tools.Iplat4jTools;
import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.common.eu.domain.Teudm05;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -55,5 +56,22 @@ public class Iplat4jUtils {
// return false;
}
}
/**
* 获取本地上传的文件
*
* @param docId
* @return
*/
public static Map getDoc02ById(String docId) {
Map document = platFileUploader.getDocument(docId);
if (MapUtils.isEmpty(document)) {
return null;
}
String chgName = document.get("chgName").toString();
String docPath = document.get("realPath").toString();
document.put("url", docPath + "/" + chgName);
return document;
}
}
......@@ -2,9 +2,15 @@ package com.baosight.hpjx.core.utils;
import com.amazonaws.services.s3.AmazonS3;
import com.baosight.hpjx.core.constant.S3Constant;
import com.baosight.hpjx.core.tools.Iplat4jTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.common.eu.domain.Teudm05;
import com.baosight.iplat4j.eu.dm.document.bos.s3.api.signed.SignedBosHelp;
import com.baosight.iplat4j.eu.dm.document.bos.s3.param.BosParamHelp;
import java.io.File;
import java.net.URL;
/**
* OSS工具类
......@@ -13,6 +19,24 @@ import java.io.File;
* @date:2023/8/28,11:25
*/
public class S3Utils {
/**
* 根据docId换取临时下载地址
*
* @param docId
* @return
*/
public static Teudm05 buildUrl(String docId) throws Exception {
Teudm05 dbDm05 = Iplat4jTools.EuDm05.getByDocId(docId);
String s3UrlPrefix = dbDm05.getUrl();
String fileName = dbDm05.getResCname();
String returnUrlPrefix = BosParamHelp.disposeUrl(s3UrlPrefix);
URL s3Url = SignedBosHelp.getDownloadTempUrl(s3UrlPrefix, fileName, null);
String s3UrlParam = StringUtils.defaultIfEmpty(s3Url.getQuery(), "");
String returnUrl = returnUrlPrefix + "?" + s3UrlParam;
dbDm05.setUrl(com.baosight.iplat4j.eu.dm.util.FileUtils.returnDocUrlByEncodeFileName(returnUrl));
return dbDm05;
}
/**
* 上传文件
......
......@@ -95,6 +95,16 @@ public class HPConstant {
public static final String HPCW001_BILL_NUMBER = "HPCW001_BILL_NUMBER";
//发票单号
public static final String HPCW002_BILL_NUMBER = "HPCW002_BILL_NUMBER";
public static final String WD_FILE_ID = "WD_FILE_ID";
// 售后单号
public static final String AFTER_SALE_NO = "AFTER_SALE_NO";
// 客户关怀单号
public static final String CARE_NO = "CARE_NO";
// 回访单号
public static final String FOL_NO = "FOL_NO";
// 投诉单号
public static final String COMPLAINT_NO = "COMPLAINT_NO";
}
/**
......@@ -127,4 +137,17 @@ public class HPConstant {
public static final Integer S_1 = 1;
}
/**
* 处理状态
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class dealStatus {
// 未处理
public static final Integer S0 = 0;
// 已处理
public static final Integer S1 = 1;
}
}
......@@ -368,9 +368,9 @@ public class HPSqlConstant {
// 更新完成数量
public static final String UPDATE_COMPLETE_NUM = "HPSC005A.updateCompleteNum";
}
public class HPSC006 {
// 锁
public static final String LOCK = "HPSC006.lock";
// 更新完成数量
......@@ -378,6 +378,18 @@ public class HPSqlConstant {
}
/**
* HPSC0061 定义
*
* @author:songx
* @date:2024/9/26,10:08
*/
public class HPSC0061 {
// 锁
public static final String LOCK = "HPSC0061.lock";
}
/**
* 质量巡检单
*
* @author:songx
......
......@@ -36,6 +36,9 @@ public class HPDM099 extends DaoEPBase {
public static final String FIELD_BIZ_ID = "bizId"; /* 业务ID*/
public static final String FIELD_DOC_ID = "docId"; /* 文件ID*/
public static final String FIELD_DOC_NAME = "docName"; /* 文件名称*/
public static final String FIELD_DOC_TYPE = "docType"; /* 文件类型*/
public static final String FIELD_PREVIEW_NUM = "previewNum"; /* 预览次数*/
public static final String FIELD_DOWNLOAD_NUM = "downloadNum"; /* 下载次数*/
public static final String COL_ID = "ID";
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
......@@ -51,6 +54,9 @@ public class HPDM099 extends DaoEPBase {
public static final String COL_BIZ_ID = "BIZ_ID"; /* 业务ID*/
public static final String COL_DOC_ID = "DOC_ID"; /* 文件ID*/
public static final String COL_DOC_NAME = "DOC_NAME"; /* 文件名称*/
public static final String COL_DOC_TYPE = "DOC_TYPE"; /* 文件类型*/
public static final String COL_PREVIEW_NUM = "PREVIEW_NUM"; /* 预览次数*/
public static final String COL_DOWNLOAD_NUM = "DOWNLOAD_NUM"; /* 下载次数*/
public static final String QUERY = "HPDM099.query";
public static final String COUNT = "HPDM099.count";
......@@ -72,6 +78,9 @@ public class HPDM099 extends DaoEPBase {
private String bizId = " "; /* 业务ID*/
private String docId = " "; /* 文件ID*/
private String docName = " "; /* 文件名称*/
private String docType = " "; /* 文件类型*/
private Integer previewNum = new Integer(0); /* 预览次数*/
private Integer downloadNum = new Integer(0); /* 下载次数*/
/**
* initialize the metadata.
......@@ -135,7 +144,18 @@ public class HPDM099 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_DOC_NAME);
eiColumn.setDescName("文件名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOC_TYPE);
eiColumn.setDescName("文件类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PREVIEW_NUM);
eiColumn.setDescName("预览次数");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOWNLOAD_NUM);
eiColumn.setDescName("下载次数");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -358,7 +378,7 @@ public class HPDM099 extends DaoEPBase {
* @return the docName
*/
public String getDocName() {
return this.getDocName();
return docName;
}
/**
......@@ -369,6 +389,48 @@ public class HPDM099 extends DaoEPBase {
public void setDocName(String docName) {
this.docName = docName;
}
public String getDocType() {
return docType;
}
public void setDocType(String docType) {
this.docType = docType;
}
/**
* get the previewNum - 预览次数.
* @return the previewNum
*/
public Integer getPreviewNum() {
return this.previewNum;
}
/**
* set the previewNum - 预览次数.
*
* @param previewNum - 预览次数
*/
public void setPreviewNum(Integer previewNum) {
this.previewNum = previewNum;
}
/**
* get the downloadNum - 下载次数.
* @return the downloadNum
*/
public Integer getDownloadNum() {
return this.downloadNum;
}
/**
* set the downloadNum - 下载次数.
*
* @param downloadNum - 下载次数
*/
public void setDownloadNum(Integer downloadNum) {
this.downloadNum = downloadNum;
}
/**
* get the value from Map.
*
......@@ -390,7 +452,9 @@ public class HPDM099 extends DaoEPBase {
setBizType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_BIZ_TYPE)), bizType));
setBizId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_BIZ_ID)), bizId));
setDocId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID)), docId));
setDocName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_NAME)), docName));
setDocName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_NAME)), docName)); setDocType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_TYPE)), docType));
setPreviewNum(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_PREVIEW_NUM)), previewNum));
setDownloadNum(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DOWNLOAD_NUM)), downloadNum));
}
/**
......@@ -414,6 +478,9 @@ public class HPDM099 extends DaoEPBase {
map.put(FIELD_BIZ_ID, StringUtils.toString(bizId, eiMetadata.getMeta(FIELD_BIZ_ID)));
map.put(FIELD_DOC_ID, StringUtils.toString(docId, eiMetadata.getMeta(FIELD_DOC_ID)));
map.put(FIELD_DOC_NAME, StringUtils.toString(docName, eiMetadata.getMeta(FIELD_DOC_NAME)));
map.put(FIELD_DOC_TYPE, StringUtils.toString(docType, eiMetadata.getMeta(FIELD_DOC_TYPE)));
map.put(FIELD_PREVIEW_NUM, StringUtils.toString(previewNum, eiMetadata.getMeta(FIELD_PREVIEW_NUM)));
map.put(FIELD_DOWNLOAD_NUM, StringUtils.toString(downloadNum, eiMetadata.getMeta(FIELD_DOWNLOAD_NUM)));
return map;
}
......
......@@ -49,12 +49,7 @@ public class ServiceHPDM099 extends ServiceEPBase {
@Override
public EiInfo query(EiInfo inInfo) {
try {
// 文件存储位置
if (CommonConstant.FileLocation.S3.equalsIgnoreCase(S3Constant.FILE_LOCATION)) {
inInfo = super.query(inInfo, "HPDM099.queryS3", new HPDM099());
} else {
inInfo = super.query(inInfo, "HPDM099.queryLocal", new HPDM099());
}
inInfo = super.query(inInfo, HPDM099.QUERY, new HPDM099());
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
......
......@@ -3,72 +3,51 @@
<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" <!-- 文件名称 -->
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", <!-- 修改时间 -->
BIZ_TYPE as "bizType", <!-- 业务类型 -->
BIZ_ID as "bizId", <!-- 业务ID -->
DOC_ID as "docId", <!-- 文件ID -->
DOC_NAME as "docName", <!-- 文件名称 -->
DOC_TYPE as "docType", <!-- 文件类型 -->
PREVIEW_NUM as "previewNum", <!-- 预览次数 -->
DOWNLOAD_NUM as "downloadNum" <!-- 下载次数 -->
</sql>
<sql id="condition">
AND A.DELETE_FLAG = '0'
AND DELETE_FLAG = '0'
<include refid="SqlBase.authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizType">
A.BIZ_TYPE = #bizType#
BIZ_TYPE = #bizType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizId">
A.BIZ_ID = #bizId#
BIZ_ID = #bizId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
A.DOC_ID = #docId#
DOC_ID = #docId#
</isNotEmpty>
</sql>
<sql id="customCondition">
<include refid="condition"/>
<isNotEmpty prepend=" AND " property="docName">
DOC_NAME LIKE CONCAT('%', #docName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateFrom">
A.CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
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#, '%')
CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959')
</isNotEmpty>
</sql>
......@@ -78,41 +57,25 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.ID asc
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="queryLocal" resultClass="com.baosight.hpjx.hp.dm.domain.HPDM099">
<select id="query" resultClass="com.baosight.hpjx.hp.dm.domain.HPDM099">
SELECT
<include refid="columnLocal"/>
FROM ${hpjxSchema}.T_HPDM099 A, ${platSchema}.TEUDM02 B
<include refid="column"/>
FROM ${hpjxSchema}.T_HPDM099
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="customCondition"/>
<include refid="orderBy"/>
</select>
<select id="countS3" resultClass="int">
<select id="count" resultClass="int">
SELECT COUNT(*)
FROM ${hpjxSchema}.T_HPDM099 A, ${platSchema}.TEUDM05 B
FROM ${hpjxSchema}.T_HPDM099
WHERE 1=1
<include refid="conditionS3"/>
<include refid="customCondition"/>
</select>
<insert id="insert">
......@@ -122,20 +85,54 @@
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 -->
BIZ_TYPE, <!-- 业务类型 -->
BIZ_ID, <!-- 业务ID -->
DOC_ID <!-- 文件ID -->
DOC_ID, <!-- 文件ID -->
DOC_NAME, <!-- 文件名称 -->
DOC_TYPE <!-- 文件类型 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #bizType#, #bizId#, #docId#
#updatedBy#, #updatedName#, #updatedTime#,
#deleteFlag#, #bizType#, #bizId#, #docId#, #docName#, #docType#
)
</insert>
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPDM099
SET DELETE_FLAG = '1'
<delete id="deleteBizId">
UPDATE ${hpjxSchema}.T_HPDM099
SET DELETE_FLAG = 1
<include refid="SqlBase.updateRevise"/>
WHERE BIZ_ID = #bizId#
AND BIZ_TYPE = #bizType#
</delete>
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPDM099
SET DELETE_FLAG = 1,
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</delete>
</delete>
<!-- 预览自增 -->
<update id="previewIncr">
UPDATE ${hpjxSchema}.T_HPDM099
SET
PREVIEW_NUM = PREVIEW_NUM + 1,
<include refid="SqlBase.updateRevise"/>
WHERE DOC_ID = #docId#
</update>
<!-- 下载自增 -->
<update id="downloadIncr">
UPDATE ${hpjxSchema}.T_HPDM099
SET
DOWNLOAD_NUM = DOWNLOAD_NUM + 1,
<include refid="SqlBase.updateRevise"/>
WHERE DOC_ID = #docId#
</update>
</sqlMap>
package com.baosight.hpjx.hp.fw.constant;
/**
* @author:songx
* @date:2024/9/24,17:53
*/
public class HpFwConstant {
/**
* HPFW001 定义
*
* @author:songx
* @date:2024/9/24,17:54
*/
public static class HpFw001 {
}
/**
* HPFW001 定义
*
* @author:songx
* @date:2024/9/24,17:54
*/
public static class HpFw002 {
}
}
package com.baosight.hpjx.hp.fw.constant;
/**
* @author:songx
* @date:2024/9/24,18:09
*/
public class HpFwSqlConstant {
/**
* @author:songx
* @date:2024/8/29,15:54
*/
public static class HpFw001 {
// 锁
public static final String LOCK = "HPFW001.lock";
// 修改
public static final String UPDATE_DEAL = "HPFW001.updateDeal";
}
/**
* @author:songx
* @date:2024/8/29,15:54
*/
public static class HpFw002 {
// 锁
public static final String LOCK = "HPFW002.lock";
// 修改
public static final String UPDATE_DEAL = "HPFW002.updateDeal";
}
/**
* @author:songx
* @date:2024/8/29,15:54
*/
public static class HpFw003 {
// 锁
public static final String LOCK = "HPFW003.lock";
// 修改
public static final String UPDATE_DEAL = "HPFW003.updateDeal";
}
/**
* @author:songx
* @date:2024/8/29,15:54
*/
public static class HpFw007 {
// 锁
public static final String LOCK = "HPFW007.lock";
// 修改
public static final String UPDATE_DEAL = "HPFW007.updateDeal";
}
}
package com.baosight.hpjx.hp.fw.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.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConstant;
import com.baosight.hpjx.hp.fw.domain.HPFW001;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
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.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.ServiceBase;
import java.util.List;
import java.util.Map;
/**
* 售后服务
*
* @author:songx
* @date:2024/9/24,17:47
*/
public class ServiceHPFW001 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "售后维修", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPFW001().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作.
*/
@Override
@OperationLogAnnotation(operModul = "售后维修", operType = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HPFW001.FIELD_AFTER_SALE_DATE,
DateUtils.formatShort(queryMap.get(HPFW001.FIELD_AFTER_SALE_DATE)));
inInfo = super.query(inInfo, HPFW001.QUERY, new HPFW001());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "删除")
public EiInfo remove(EiInfo inInfo) {
try {
List<HPFW001> fFw001s = MapUtils.toDaoEPBases(inInfo, HPFW001.class);
// db数据
Map<String, HPFW001> dbFw001Map = HpFwUtils.HpFw001.lockAndGet(fFw001s);
// 数据校验
this.checkRemoveData(fFw001s, dbFw001Map);
// 保存数据
this.removeData(fFw001s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fFw001s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fFw001s
* @param dbFw001Map
*/
private void checkRemoveData(List<HPFW001> fFw001s, Map<String, HPFW001> dbFw001Map) {
for (HPFW001 fFw001 : fFw001s) {
String afterSaleNo = fFw001.getAfterSaleNo();
HPFW001 dbFw001 = dbFw001Map.get(afterSaleNo);
this.checkData(afterSaleNo, dbFw001);
}
}
/**
* 数据保存
*
* @param fFw001s
*/
private void removeData(List<HPFW001> fFw001s) {
for (HPFW001 fFw001 : fFw001s) {
fFw001.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPFW001.DELETE, fFw001.toMap());
}
}
/**
* 检查状态
*
* @param inInfo
* @return
*/
public EiInfo checkStatus(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String afterSaleNo = MapUtils.getString(queryMap, HPFW001.FIELD_AFTER_SALE_NO);
HPFW001 dbFw001 = HpFwUtils.HpFw001.lockAndGet(afterSaleNo);
this.checkData(afterSaleNo, dbFw001);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
/**
* 处理
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "审核")
public EiInfo deal(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String content = MapUtils.getString(queryMap, "content");
List<HPFW001> fFw001s = MapUtils.toDaoEPBases(inInfo, HPFW001.class);
// db数据
Map<String, HPFW001> dbFw001Map = HpFwUtils.HpFw001.lockAndGet(fFw001s);
// 数据校验
this.checkDealData(fFw001s, dbFw001Map);
// 保存数据
this.dealData(fFw001s, content);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fFw001s.size() + "]条数据处理成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "处理失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fFw001s
* @param dbFw001Map
*/
private void checkDealData(List<HPFW001> fFw001s, Map<String, HPFW001> dbFw001Map) {
for (HPFW001 fFw001 : fFw001s) {
String afterSaleNo = fFw001.getAfterSaleNo();
HPFW001 dbFw001 = dbFw001Map.get(afterSaleNo);
this.checkData(afterSaleNo, dbFw001);
}
}
/**
* 数据保存
*
* @param fFw001s
* @param content
*/
private void dealData(List<HPFW001> fFw001s, String content) {
for (HPFW001 fFw001 : fFw001s) {
fFw001.setDealContent(content);
fFw001.setStatus(HPConstant.dealStatus.S1);
fFw001.setDealUserId(UserSessionUtils.getLoginName());
fFw001.setDealUserName(UserSessionUtils.getLoginCName());
DaoUtils.update(HpFwSqlConstant.HpFw001.UPDATE_DEAL, fFw001.toMap());
}
}
/**
* 数据校验
*
* @param afterSaleNo
* @param dbFw001
*/
private void checkData(String afterSaleNo, HPFW001 dbFw001) {
AssertUtils.isNull(dbFw001, String.format("售后服务单[%s]不存在", afterSaleNo));
AssertUtils.isNotEquals(dbFw001.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("售后服务单【%s】不是\"未删除\"状态,不允许操作", afterSaleNo));
AssertUtils.isNotEquals(dbFw001.getStatus(), HPConstant.dealStatus.S0,
String.format("售后服务单【%s】不是\"待处理\"状态,不允许操作", afterSaleNo));
}
}
package com.baosight.hpjx.hp.fw.service;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.utils.Iplat4jUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.dm.domain.HPDM099;
import com.baosight.hpjx.hp.fw.constant.HpFwConstant;
import com.baosight.hpjx.hp.fw.domain.HPFW001;
import com.baosight.hpjx.hp.fw.tools.HpFwTools;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
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.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.List;
import java.util.Map;
/**
* 附件清单
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPFW001A extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
this.setDetailInfo(inInfo);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPDM099().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPDM099.QUERY, new HPDM099());
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除
*
* @param inInfo
* @return
*/
public EiInfo remove(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String bizId = MapUtils.getString(queryMap, HPDM099.FIELD_BIZ_ID);
HPFW001 dbFw001 = HpFwUtils.HpFw001.lockAndGet(bizId);
this.checkData(dbFw001);
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 (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param dbFw001
*/
private void checkData(HPFW001 dbFw001) {
AssertUtils.isNotEquals(dbFw001.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("售后服务单【%s】不是\"未删除\"状态,不允许操作", dbFw001.getAfterSaleNo()));
AssertUtils.isNotEquals(dbFw001.getStatus(), HPConstant.dealStatus.S0,
String.format("售后服务单【%s】不是\"待处理\"状态,不允许操作", dbFw001.getAfterSaleNo()));
}
/**
* 设置信息
*
* @param inInfo
*/
public void setDetailInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String bizId = MapUtils.getString(queryRow, HPDM099.FIELD_BIZ_ID);
if (bizId == null) {
return;
}
EiBlock block = new EiBlock(CommonConstant.Field.DETAIL);
block.addRow(HpFwTools.HpFw001.get(bizId));
block.addBlockMeta(new HPFW001().eiMetadata);
inInfo.setBlock(block);
}
}
package com.baosight.hpjx.hp.fw.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.domain.HPFW001;
import com.baosight.hpjx.hp.fw.tools.HpFwTools;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
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.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.Arrays;
import java.util.Map;
/**
* 新增修改
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPFW001B extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), null);
this.setBaseInfo(inInfo);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "保存", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
HPFW001 fFw001 = MapUtils.toDaoEPBase(inInfo, HPFW001.class);
fFw001.setAfterSaleDate(DateUtils.formatShort(fFw001.getAfterSaleDate()));
if (StringUtils.isBlank(fFw001.getAfterSaleNo())) {
this.add(fFw001);
} else {
this.modify(fFw001);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增
*
* @param fFw001
*/
private void add(HPFW001 fFw001) {
fFw001.setAfterSaleNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.AFTER_SALE_NO));
fFw001.setStatus(HPConstant.dealStatus.S0);
fFw001.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPFW001.INSERT, fFw001);
}
/**
* 修改数据
*
* @param fFw001
*/
private void modify(HPFW001 fFw001) {
HPFW001 dbFw001 = HpFwUtils.HpFw001.lockAndGet(fFw001);
this.checkData(fFw001, dbFw001);
DaoUtils.update(HPFW001.UPDATE, fFw001);
}
/**
* 设置信息
*
* @param inInfo
*/
public void setBaseInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String afterSaleNo = MapUtils.getString(queryRow, HPFW001.FIELD_AFTER_SALE_NO);
if (StringUtils.isBlank(afterSaleNo)) {
return;
}
EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
resultBlock.addRow(HpFwTools.HpFw001.get(afterSaleNo));
resultBlock.addBlockMeta(new HPFW001().eiMetadata);
inInfo.setBlock(resultBlock);
}
/**
* 数据校验
*
* @param fFw001
* @param dbFw001
*/
private void checkData(HPFW001 fFw001, HPFW001 dbFw001) {
AssertUtils.isNull(dbFw001, String.format("售后服务单【%s】不存在", fFw001.getAfterSaleNo()));
AssertUtils.isNotEquals(dbFw001.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("售后服务单【%s】不是\"未删除\"状态,不允许操作", dbFw001.getAfterSaleNo()));
AssertUtils.isNotEquals(dbFw001.getStatus(), HPConstant.dealStatus.S0,
String.format("售后服务单【%s】不是\"待处理\"状态,不允许操作", dbFw001.getAfterSaleNo()));
}
}
package com.baosight.hpjx.hp.fw.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.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConstant;
import com.baosight.hpjx.hp.fw.domain.HPFW002;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
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.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.ServiceBase;
import java.util.List;
import java.util.Map;
/**
* 客户关怀
*
* @author:songx
* @date:2024/9/24,17:47
*/
public class ServiceHPFW002 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "售后维修", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPFW002().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作.
*/
@Override
@OperationLogAnnotation(operModul = "售后维修", operType = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HPFW002.FIELD_CARE_DATE,
DateUtils.formatShort(queryMap.get(HPFW002.FIELD_CARE_DATE)));
inInfo = super.query(inInfo, HPFW002.QUERY, new HPFW002());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "删除")
public EiInfo remove(EiInfo inInfo) {
try {
List<HPFW002> fFw002s = MapUtils.toDaoEPBases(inInfo, HPFW002.class);
// db数据
Map<String, HPFW002> dbFw002Map = HpFwUtils.HpFw002.lockAndGet(fFw002s);
// 数据校验
this.checkRemoveData(fFw002s, dbFw002Map);
// 保存数据
this.removeData(fFw002s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fFw002s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fFw002s
* @param dbFw002Map
*/
private void checkRemoveData(List<HPFW002> fFw002s, Map<String, HPFW002> dbFw002Map) {
for (HPFW002 fFw002 : fFw002s) {
String careNo = fFw002.getCareNo();
HPFW002 dbFw002 = dbFw002Map.get(careNo);
this.checkData(careNo, dbFw002);
}
}
/**
* 数据保存
*
* @param fFw002s
*/
private void removeData(List<HPFW002> fFw002s) {
for (HPFW002 fFw002 : fFw002s) {
fFw002.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPFW002.DELETE, fFw002.toMap());
}
}
/**
* 检查状态
*
* @param inInfo
* @return
*/
public EiInfo checkStatus(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String careNo = MapUtils.getString(queryMap, HPFW002.FIELD_CARE_NO);
HPFW002 dbFw002 = HpFwUtils.HpFw002.lockAndGet(careNo);
this.checkData(careNo, dbFw002);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
/**
* 处理
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "审核")
public EiInfo deal(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String content = MapUtils.getString(queryMap, "content");
List<HPFW002> fFw002s = MapUtils.toDaoEPBases(inInfo, HPFW002.class);
// db数据
Map<String, HPFW002> dbFw002Map = HpFwUtils.HpFw002.lockAndGet(fFw002s);
// 数据校验
this.checkDealData(fFw002s, dbFw002Map);
// 保存数据
this.dealData(fFw002s, content);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fFw002s.size() + "]条数据处理成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "处理失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fFw002s
* @param dbFw002Map
*/
private void checkDealData(List<HPFW002> fFw002s, Map<String, HPFW002> dbFw002Map) {
for (HPFW002 fFw002 : fFw002s) {
String careNo = fFw002.getCareNo();
HPFW002 dbFw002 = dbFw002Map.get(careNo);
this.checkData(careNo, dbFw002);
}
}
/**
* 数据保存
*
* @param fFw002s
* @param content
*/
private void dealData(List<HPFW002> fFw002s, String content) {
for (HPFW002 fFw002 : fFw002s) {
fFw002.setStatus(HPConstant.dealStatus.S1);
fFw002.setDealUserId(UserSessionUtils.getLoginName());
fFw002.setDealUserName(UserSessionUtils.getLoginCName());
fFw002.setDealContent(content);
DaoUtils.update(HpFwSqlConstant.HpFw002.UPDATE_DEAL, fFw002.toMap());
}
}
/**
* 数据校验
*
* @param careNo
* @param dbFw002
*/
private void checkData(String careNo, HPFW002 dbFw002) {
AssertUtils.isNull(dbFw002, String.format("客户关怀单[%s]不存在", careNo));
AssertUtils.isNotEquals(dbFw002.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("客户关怀单【%s】不是\"未删除\"状态,不允许操作", careNo));
AssertUtils.isNotEquals(dbFw002.getStatus(), HPConstant.dealStatus.S0,
String.format("客户关怀单【%s】不是\"待处理\"状态,不允许操作", careNo));
}
}
package com.baosight.hpjx.hp.fw.service;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.utils.Iplat4jUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.dm.domain.HPDM099;
import com.baosight.hpjx.hp.fw.domain.HPFW001;
import com.baosight.hpjx.hp.fw.domain.HPFW002;
import com.baosight.hpjx.hp.fw.tools.HpFwTools;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
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.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.List;
import java.util.Map;
/**
* 附件清单
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPFW002A extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
this.setDetailInfo(inInfo);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPDM099().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPDM099.QUERY, new HPDM099());
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除
*
* @param inInfo
* @return
*/
public EiInfo remove(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String bizId = MapUtils.getString(queryMap, HPDM099.FIELD_BIZ_ID);
HPFW002 dbFw002 = HpFwUtils.HpFw002.lockAndGet(bizId);
this.checkData(bizId, dbFw002);
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 (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param careNo
* @param dbFw002
*/
private void checkData(String careNo, HPFW002 dbFw002) {
AssertUtils.isNull(dbFw002, String.format("客户关怀单[%s]不存在", careNo));
AssertUtils.isNotEquals(dbFw002.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("客户关怀单【%s】不是\"未删除\"状态,不允许操作", careNo));
AssertUtils.isNotEquals(dbFw002.getStatus(), HPConstant.dealStatus.S0,
String.format("客户关怀单【%s】不是\"待回访\"状态,不允许操作", careNo));
}
/**
* 设置信息
*
* @param inInfo
*/
public void setDetailInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String bizId = MapUtils.getString(queryRow, HPDM099.FIELD_BIZ_ID);
if (bizId == null) {
return;
}
EiBlock block = new EiBlock(CommonConstant.Field.DETAIL);
block.addRow(HpFwTools.HpFw002.get(bizId));
block.addBlockMeta(new HPFW002().eiMetadata);
inInfo.setBlock(block);
}
}
package com.baosight.hpjx.hp.fw.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.domain.HPFW002;
import com.baosight.hpjx.hp.fw.tools.HpFwTools;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
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.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.Arrays;
import java.util.Map;
/**
* 新增修改
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPFW002B extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), null);
this.setBaseInfo(inInfo);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "保存", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
HPFW002 fFw002 = MapUtils.toDaoEPBase(inInfo, HPFW002.class);
fFw002.setCareDate(DateUtils.formatShort(fFw002.getCareDate()));
if (StringUtils.isBlank(fFw002.getCareNo())) {
this.add(fFw002);
} else {
this.modify(fFw002);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增
*
* @param fFw002
*/
private void add(HPFW002 fFw002) {
fFw002.setCareNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.CARE_NO));
fFw002.setStatus(HPConstant.dealStatus.S0);
fFw002.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPFW002.INSERT, fFw002);
}
/**
* 修改数据
*
* @param fFw002
*/
private void modify(HPFW002 fFw002) {
HPFW002 dbFw002 = HpFwUtils.HpFw002.lockAndGet(fFw002);
this.checkData(fFw002, dbFw002);
DaoUtils.update(HPFW002.UPDATE, fFw002);
}
/**
* 设置信息
*
* @param inInfo
*/
public void setBaseInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String careNo = MapUtils.getString(queryRow, HPFW002.FIELD_CARE_NO);
if (StringUtils.isBlank(careNo)) {
return;
}
EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
resultBlock.addRow(HpFwTools.HpFw002.get(careNo));
resultBlock.addBlockMeta(new HPFW002().eiMetadata);
inInfo.setBlock(resultBlock);
}
/**
* 数据校验
*
* @param fFw002
* @param dbFw002
*/
private void checkData(HPFW002 fFw002, HPFW002 dbFw002) {
String careNo = fFw002.getCareNo();
AssertUtils.isNull(dbFw002, String.format("客户关怀单【%s】不存在", careNo));
AssertUtils.isNotEquals(dbFw002.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("客户关怀单【%s】不是\"未删除\"状态,不允许操作", careNo));
AssertUtils.isNotEquals(dbFw002.getStatus(), HPConstant.dealStatus.S0,
String.format("客户关怀单【%s】不是\"待处理\"状态,不允许操作", careNo));
}
}
package com.baosight.hpjx.hp.fw.service;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConstant;
import com.baosight.hpjx.hp.fw.domain.HPFW003;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
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.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.ServiceBase;
import java.util.List;
import java.util.Map;
/**
* 客户投诉
*
* @author:songx
* @date:2024/9/24,17:47
*/
public class ServiceHPFW003 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPFW003().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作.
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HPFW003.FIELD_COMPLAINT_DATE,
DateUtils.formatShort(queryMap.get(HPFW003.FIELD_COMPLAINT_DATE)));
inInfo = super.query(inInfo, HPFW003.QUERY, new HPFW003());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo remove(EiInfo inInfo) {
try {
List<HPFW003> fFw003s = MapUtils.toDaoEPBases(inInfo, HPFW003.class);
// db数据
Map<String, HPFW003> dbFw003Map = HpFwUtils.HpFw003.lockAndGet(fFw003s);
// 数据校验
this.checkRemoveData(fFw003s, dbFw003Map);
// 保存数据
this.removeData(fFw003s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fFw003s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fFw003s
* @param dbFw003Map
*/
private void checkRemoveData(List<HPFW003> fFw003s, Map<String, HPFW003> dbFw003Map) {
for (HPFW003 fFw003 : fFw003s) {
String complaintNo = fFw003.getComplaintNo();
HPFW003 dbFw003 = dbFw003Map.get(complaintNo);
this.checkData(complaintNo, dbFw003);
}
}
/**
* 数据保存
*
* @param fFw003s
*/
private void removeData(List<HPFW003> fFw003s) {
for (HPFW003 fFw003 : fFw003s) {
fFw003.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPFW003.DELETE, fFw003.toMap());
}
}
/**
* 检查状态
*
* @param inInfo
* @return
*/
public EiInfo checkStatus(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String complaintNo = MapUtils.getString(queryMap, HPFW003.FIELD_COMPLAINT_NO);
HPFW003 dbFw003 = HpFwUtils.HpFw003.lockAndGet(complaintNo);
this.checkData(complaintNo, dbFw003);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
/**
* 处理
*
* @param inInfo
* @return
*/
public EiInfo deal(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String content = MapUtils.getString(queryMap, "content");
List<HPFW003> fFw003s = MapUtils.toDaoEPBases(inInfo, HPFW003.class);
// db数据
Map<String, HPFW003> dbFw003Map = HpFwUtils.HpFw003.lockAndGet(fFw003s);
// 数据校验
this.checkDealData(fFw003s, dbFw003Map);
// 保存数据
this.dealData(fFw003s, content);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fFw003s.size() + "]条数据处理成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "处理失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fFw003s
* @param dbFw003Map
*/
private void checkDealData(List<HPFW003> fFw003s, Map<String, HPFW003> dbFw003Map) {
for (HPFW003 fFw003 : fFw003s) {
String complaintNo = fFw003.getComplaintNo();
HPFW003 dbFw003 = dbFw003Map.get(complaintNo);
this.checkData(complaintNo, dbFw003);
}
}
/**
* 数据保存
*
* @param fFw003s
* @param content
*/
private void dealData(List<HPFW003> fFw003s, String content) {
for (HPFW003 fFw003 : fFw003s) {
fFw003.setStatus(HPConstant.dealStatus.S1);
fFw003.setDealUserId(UserSessionUtils.getLoginName());
fFw003.setDealUserName(UserSessionUtils.getLoginCName());
fFw003.setDealContent(content);
DaoUtils.update(HpFwSqlConstant.HpFw003.UPDATE_DEAL, fFw003.toMap());
}
}
/**
* 数据校验
*
* @param careNo
* @param dbFw003
*/
private void checkData(String careNo, HPFW003 dbFw003) {
AssertUtils.isNull(dbFw003, String.format("投诉单[%s]不存在", careNo));
AssertUtils.isNotEquals(dbFw003.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("投诉单【%s】不是\"未删除\"状态,不允许操作", careNo));
AssertUtils.isNotEquals(dbFw003.getStatus(), HPConstant.dealStatus.S0,
String.format("投诉单【%s】不是\"待处理\"状态,不允许操作", careNo));
}
}
package com.baosight.hpjx.hp.fw.service;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.utils.Iplat4jUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.dm.domain.HPDM099;
import com.baosight.hpjx.hp.fw.domain.HPFW003;
import com.baosight.hpjx.hp.fw.tools.HpFwTools;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
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.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.List;
import java.util.Map;
/**
* 附件清单
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPFW003A extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
this.setDetailInfo(inInfo);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPDM099().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPDM099.QUERY, new HPDM099());
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除
*
* @param inInfo
* @return
*/
public EiInfo remove(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String bizId = MapUtils.getString(queryMap, HPDM099.FIELD_BIZ_ID);
HPFW003 dbFw003 = HpFwUtils.HpFw003.lockAndGet(bizId);
this.checkData(bizId, dbFw003);
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 (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param complaintNo
* @param dbFw003
*/
private void checkData(String complaintNo, HPFW003 dbFw003) {
AssertUtils.isNull(dbFw003, String.format("投诉单[%s]不存在", complaintNo));
AssertUtils.isNotEquals(dbFw003.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("投诉单【%s】不是\"未删除\"状态,不允许操作", complaintNo));
AssertUtils.isNotEquals(dbFw003.getStatus(), HPConstant.dealStatus.S0,
String.format("投诉单【%s】不是\"未处理\"状态,不允许操作", complaintNo));
}
/**
* 设置信息
*
* @param inInfo
*/
public void setDetailInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String bizId = MapUtils.getString(queryRow, HPDM099.FIELD_BIZ_ID);
if (bizId == null) {
return;
}
EiBlock block = new EiBlock(CommonConstant.Field.DETAIL);
block.addRow(HpFwTools.HpFw003.get(bizId));
block.addBlockMeta(new HPFW003().eiMetadata);
inInfo.setBlock(block);
}
}
package com.baosight.hpjx.hp.fw.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.domain.HPFW003;
import com.baosight.hpjx.hp.fw.tools.HpFwTools;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
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.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.Arrays;
import java.util.Map;
/**
* 新增修改
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPFW003B extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), null);
this.setBaseInfo(inInfo);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "保存", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
HPFW003 fFw003 = MapUtils.toDaoEPBase(inInfo, HPFW003.class);
fFw003.setComplaintDate(DateUtils.formatShort(fFw003.getComplaintDate()));
fFw003.setLastDate(DateUtils.formatShort(fFw003.getLastDate()));
if (StringUtils.isBlank(fFw003.getComplaintNo())) {
this.add(fFw003);
} else {
this.modify(fFw003);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增
*
* @param fFw003
*/
private void add(HPFW003 fFw003) {
fFw003.setComplaintNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.COMPLAINT_NO));
fFw003.setStatus(HPConstant.dealStatus.S0);
fFw003.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPFW003.INSERT, fFw003);
}
/**
* 修改数据
*
* @param fFw003
*/
private void modify(HPFW003 fFw003) {
HPFW003 dbFw003 = HpFwUtils.HpFw003.lockAndGet(fFw003);
this.checkData(fFw003, dbFw003);
DaoUtils.update(HPFW003.UPDATE, fFw003);
}
/**
* 设置信息
*
* @param inInfo
*/
public void setBaseInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String complaintNo = MapUtils.getString(queryRow, HPFW003.FIELD_COMPLAINT_NO);
if (StringUtils.isBlank(complaintNo)) {
return;
}
EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
resultBlock.addRow(HpFwTools.HpFw003.get(complaintNo));
resultBlock.addBlockMeta(new HPFW003().eiMetadata);
inInfo.setBlock(resultBlock);
}
/**
* 数据校验
*
* @param fFw003
* @param dbFw002
*/
private void checkData(HPFW003 fFw003, HPFW003 dbFw002) {
String complaintNo = fFw003.getComplaintNo();
AssertUtils.isNull(dbFw002, String.format("投诉单【%s】不存在", complaintNo));
AssertUtils.isNotEquals(dbFw002.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("投诉单【%s】不是\"未删除\"状态,不允许操作", complaintNo));
AssertUtils.isNotEquals(dbFw002.getStatus(), HPConstant.dealStatus.S0,
String.format("投诉单【%s】不是\"未处理\"状态,不允许操作", complaintNo));
}
}
package com.baosight.hpjx.hp.fw.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.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConstant;
import com.baosight.hpjx.hp.fw.domain.HPFW007;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
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.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.ServiceBase;
import java.util.List;
import java.util.Map;
/**
* 客户回访
*
* @author:songx
* @date:2024/9/24,17:47
*/
public class ServiceHPFW007 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "售后维修", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPFW007().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作.
*/
@Override
@OperationLogAnnotation(operModul = "售后维修", operType = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HPFW007.FIELD_FOL_DATE, DateUtils.formatShort(queryMap.get(HPFW007.FIELD_FOL_DATE)));
inInfo = super.query(inInfo, HPFW007.QUERY, new HPFW007());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "删除")
public EiInfo remove(EiInfo inInfo) {
try {
List<HPFW007> fFw007s = MapUtils.toDaoEPBases(inInfo, HPFW007.class);
// db数据
Map<String, HPFW007> dbFw007Map = HpFwUtils.HpFw007.lockAndGet(fFw007s);
// 数据校验
this.checkRemoveData(fFw007s, dbFw007Map);
// 保存数据
this.removeData(fFw007s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fFw007s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fFw007s
* @param dbFw007Map
*/
private void checkRemoveData(List<HPFW007> fFw007s, Map<String, HPFW007> dbFw007Map) {
for (HPFW007 fFw007 : fFw007s) {
String folNo = fFw007.getFolNo();
HPFW007 dbFw007 = dbFw007Map.get(folNo);
this.checkData(folNo, dbFw007);
}
}
/**
* 数据保存
*
* @param fFw007s
*/
private void removeData(List<HPFW007> fFw007s) {
for (HPFW007 fFw007 : fFw007s) {
fFw007.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPFW007.DELETE, fFw007.toMap());
}
}
/**
* 检查状态
*
* @param inInfo
* @return
*/
public EiInfo checkStatus(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String folNo = MapUtils.getString(queryMap, HPFW007.FIELD_FOL_NO);
HPFW007 dbFw007 = HpFwUtils.HpFw007.lockAndGet(folNo);
this.checkData(folNo, dbFw007);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
/**
* 处理
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "审核")
public EiInfo deal(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String content = MapUtils.getString(queryMap, "content");
List<HPFW007> fFw007s = MapUtils.toDaoEPBases(inInfo, HPFW007.class);
// db数据
Map<String, HPFW007> dbFw007Map = HpFwUtils.HpFw007.lockAndGet(fFw007s);
// 数据校验
this.checkDealData(fFw007s, dbFw007Map);
// 保存数据
this.dealData(fFw007s, content);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fFw007s.size() + "]条数据处理成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "处理失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fFw007s
* @param dbFw007Map
*/
private void checkDealData(List<HPFW007> fFw007s, Map<String, HPFW007> dbFw007Map) {
for (HPFW007 fFw007 : fFw007s) {
String folNo = fFw007.getFolNo();
HPFW007 dbFw007 = dbFw007Map.get(folNo);
this.checkData(folNo, dbFw007);
}
}
/**
* 数据保存
*
* @param fFw007s
* @param content
*/
private void dealData(List<HPFW007> fFw007s, String content) {
for (HPFW007 fFw007 : fFw007s) {
fFw007.setStatus(HPConstant.dealStatus.S1);
fFw007.setDealUserId(UserSessionUtils.getLoginName());
fFw007.setDealUserName(UserSessionUtils.getLoginCName());
fFw007.setDealContent(content);
DaoUtils.update(HpFwSqlConstant.HpFw007.UPDATE_DEAL, fFw007.toMap());
}
}
/**
* 数据校验
*
* @param folNo
* @param dbFw007
*/
private void checkData(String folNo, HPFW007 dbFw007) {
AssertUtils.isNull(dbFw007, String.format("回访单[%s]不存在", folNo));
AssertUtils.isNotEquals(dbFw007.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("回访单【%s】不是\"未删除\"状态,不允许操作", folNo));
AssertUtils.isNotEquals(dbFw007.getStatus(), HPConstant.dealStatus.S0,
String.format("回访单【%s】不是\"待回访\"状态,不允许操作", folNo));
}
}
package com.baosight.hpjx.hp.fw.service;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.utils.Iplat4jUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.dm.domain.HPDM099;
import com.baosight.hpjx.hp.fw.domain.HPFW007;
import com.baosight.hpjx.hp.fw.tools.HpFwTools;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
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.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.List;
import java.util.Map;
/**
* 附件清单
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPFW007A extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
this.setDetailInfo(inInfo);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPDM099().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPDM099.QUERY, new HPDM099());
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除
*
* @param inInfo
* @return
*/
public EiInfo remove(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String bizId = MapUtils.getString(queryMap, HPDM099.FIELD_BIZ_ID);
HPFW007 dbFw007 = HpFwUtils.HpFw007.lockAndGet(bizId);
this.checkData(bizId, dbFw007);
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 (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param folNo
* @param dbFw007
*/
private void checkData(String folNo, HPFW007 dbFw007) {
AssertUtils.isNull(dbFw007, String.format("回访单[%s]不存在", folNo));
AssertUtils.isNotEquals(dbFw007.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("回访单【%s】不是\"未删除\"状态,不允许操作", folNo));
AssertUtils.isNotEquals(dbFw007.getStatus(), HPConstant.dealStatus.S0,
String.format("回访单【%s】不是\"待回访\"状态,不允许操作", folNo));
}
/**
* 设置信息
*
* @param inInfo
*/
public void setDetailInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String bizId = MapUtils.getString(queryRow, HPDM099.FIELD_BIZ_ID);
if (bizId == null) {
return;
}
EiBlock block = new EiBlock(CommonConstant.Field.DETAIL);
block.addRow(HpFwTools.HpFw007.get(bizId));
block.addBlockMeta(new HPFW007().eiMetadata);
inInfo.setBlock(block);
}
}
package com.baosight.hpjx.hp.fw.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.domain.HPFW007;
import com.baosight.hpjx.hp.fw.tools.HpFwTools;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
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.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.Arrays;
import java.util.Map;
/**
* 新增修改
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPFW007B extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SALE_NO_BLOCK_ID), null);
this.setBaseInfo(inInfo);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "保存", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
HPFW007 fFw007 = MapUtils.toDaoEPBase(inInfo, HPFW007.class);
fFw007.setFolDate(DateUtils.formatShort(fFw007.getFolDate()));
if (StringUtils.isBlank(fFw007.getFolNo())) {
this.add(fFw007);
} else {
this.modify(fFw007);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增
*
* @param fFw007
*/
private void add(HPFW007 fFw007) {
fFw007.setFolNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.FOL_NO));
fFw007.setStatus(HPConstant.dealStatus.S0);
fFw007.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPFW007.INSERT, fFw007);
}
/**
* 修改数据
*
* @param fFw007
*/
private void modify(HPFW007 fFw007) {
HPFW007 dbFw007 = HpFwUtils.HpFw007.lockAndGet(fFw007);
this.checkData(fFw007, dbFw007);
DaoUtils.update(HPFW007.UPDATE, fFw007);
}
/**
* 设置信息
*
* @param inInfo
*/
public void setBaseInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String folNo = MapUtils.getString(queryRow, HPFW007.FIELD_FOL_NO);
if (StringUtils.isBlank(folNo)) {
return;
}
EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
resultBlock.addRow(HpFwTools.HpFw007.get(folNo));
resultBlock.addBlockMeta(new HPFW007().eiMetadata);
inInfo.setBlock(resultBlock);
}
/**
* 数据校验
*
* @param fFw007
* @param dbFw002
*/
private void checkData(HPFW007 fFw007, HPFW007 dbFw002) {
String folNo = fFw007.getFolNo();
AssertUtils.isNull(dbFw002, String.format("回访单【%s】不存在", folNo));
AssertUtils.isNotEquals(dbFw002.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("回访单【%s】不是\"未删除\"状态,不允许操作", folNo));
AssertUtils.isNotEquals(dbFw002.getStatus(), HPConstant.dealStatus.S0,
String.format("回访单【%s】不是\"待回访\"状态,不允许操作", folNo));
}
}
<?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="HPFW001">
<sql id="column">
ID as "id", <!-- 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", <!-- 是否删除 0-否1-是 -->
STATUS as "status", <!-- 维修状态 0-未处理 1-已维修 -->
AFTER_SALE_DATE as "afterSaleDate", <!-- 售后日期 -->
AFTER_SALE_NO as "afterSaleNo", <!-- 售后单号 -->
AFTER_SALE_TYPE as "afterSaleType", <!-- 售后方式 -->
URGENCY as "urgency", <!-- 紧急程度 -->
AFTER_SALE_CONTENT as "afterSaleContent", <!-- 售后内容 -->
CUSTOM_ID as "customId", <!-- 客户ID -->
CUSTOM_NAME as "customName", <!-- 客户名称 -->
DEAL_USER_ID as "dealUserId", <!-- 处理人ID -->
DEAL_USER_NAME as "dealUserName", <!-- 处理人名称 -->
DEAL_CONTENT as "dealContent" <!-- 处理内容 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<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="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="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="afterSaleDate">
AFTER_SALE_DATE = #afterSaleDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="afterSaleType">
AFTER_SALE_TYPE = #afterSaleType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="urgency">
URGENCY = #urgency#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="customId">
CUSTOM_ID = #customId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="customName">
CUSTOM_NAME LIKE CONCAT('%', #customName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dealUserId">
DEAL_USER_ID = #dealUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dealUserName">
DEAL_USER_NAME LIKE CONCAT('%', #dealUserName#, '%')
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="afterSaleNo">
AFTER_SALE_NO = #afterSaleNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="afterSaleNos">
AFTER_SALE_NO IN <iterate close=")" open="(" conjunction="," property="afterSaleNos">#afterSaleNos[]#</iterate>
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.fw.domain.HPFW001">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPFW001 WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPFW001 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPFW001 (
COMPANY_CODE, <!-- 公司编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
STATUS, <!-- 维修状态 0-未处理 1-已维修 -->
AFTER_SALE_DATE, <!-- 售后日期 -->
AFTER_SALE_NO, <!-- 售后单号 -->
AFTER_SALE_TYPE, <!-- 售后方式 -->
URGENCY, <!-- 紧急程度 -->
AFTER_SALE_CONTENT, <!-- 售后内容 -->
CUSTOM_ID, <!-- 客户ID -->
CUSTOM_NAME, <!-- 客户名称 -->
DEAL_USER_ID, <!-- 处理人ID -->
DEAL_USER_NAME <!-- 处理人名称 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #status#, #afterSaleDate#, #afterSaleNo#, #afterSaleType#, #urgency#,
#afterSaleContent#, #customId#, #customName#, #dealUserId#, #dealUserName#)
</insert>
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPFW001 SET DELETE_FLAG = 1 WHERE AFTER_SALE_NO = #afterSaleNo#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPFW001
SET
AFTER_SALE_DATE = #afterSaleDate#, <!-- 售后日期 -->
AFTER_SALE_TYPE = #afterSaleType#, <!-- 售后方式 -->
URGENCY = #urgency#, <!-- 紧急程度 -->
AFTER_SALE_CONTENT = #afterSaleContent#, <!-- 售后内容 -->
CUSTOM_ID = #customId#, <!-- 客户ID -->
CUSTOM_NAME = #customName#, <!-- 客户名称 -->
<include refid="SqlBase.updateRevise"/>
WHERE AFTER_SALE_NO = #afterSaleNo#
</update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hpjxSchema}.T_HPFW001
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
<!-- 修改 -->
<update id="updateDeal">
UPDATE ${hpjxSchema}.T_HPFW001
SET
STATUS = #status#,
DEAL_USER_ID = #dealUserId#, <!-- 处理人ID -->
DEAL_USER_NAME = #dealUserName#, <!-- 处理人名称 -->
DEAL_CONTENT = #dealContent#,
<include refid="SqlBase.updateRevise"/>
WHERE AFTER_SALE_NO = #afterSaleNo#
</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="HPFW002">
<sql id="column">
ID as "id", <!-- 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", <!-- 是否删除 0-否1-是 -->
STATUS as "status", <!-- 状态 0-未处理 1-已维修 -->
CARE_DATE as "careDate", <!-- 关怀日期 -->
CARE_NO as "careNo", <!-- 关怀单号 -->
CARE_WAY as "careWay", <!-- 关怀方式 -->
CARE_TYPE as "careType", <!-- 关怀类型 -->
CARE_CONTENT as "careContent", <!-- 关怀内容 -->
CUSTOM_ID as "customId", <!-- 客户ID -->
CUSTOM_NAME as "customName", <!-- 客户名称 -->
DEAL_USER_ID as "dealUserId", <!-- 执行人ID -->
DEAL_USER_NAME as "dealUserName", <!-- 执行人名称 -->
DEAL_CONTENT as "dealContent" <!-- 客户反馈 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<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="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="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="careDate">
CARE_DATE = #careDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="careWay">
CARE_WAY = #careWay#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="careType">
CARE_TYPE = #careType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="customId">
CUSTOM_ID = #customId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="customName">
CUSTOM_NAME LIKE CONCAT('%', #customName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dealUserId">
DEAL_USER_ID = #dealUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dealUserName">
DEAL_USER_NAME LIKE CONCAT('%', #dealUserName#, '%')
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="careNo">
CARE_NO = #careNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="careNos">
CARE_NO IN <iterate close=")" open="(" conjunction="," property="careNos">#careNos[]#</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.fw.domain.HPFW002">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPFW002 WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPFW002 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPFW002 (
COMPANY_CODE, <!-- 公司编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
STATUS, <!-- 状态 0-未处理 1-已维修 -->
CARE_DATE, <!-- 关怀日期 -->
CARE_NO, <!-- 关怀单号 -->
CARE_WAY, <!-- 关怀方式 -->
CARE_TYPE, <!-- 关怀类型 -->
CARE_CONTENT, <!-- 关怀内容 -->
CUSTOM_ID, <!-- 客户ID -->
CUSTOM_NAME, <!-- 客户名称 -->
DEAL_USER_ID, <!-- 执行人ID -->
DEAL_USER_NAME <!-- 执行人名称 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #status#, #careDate#, #careNo#, #careWay#, #careType#, #careContent#,
#customId#, #customName#, #dealUserId#, #dealUserName#)
</insert>
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPFW002 SET DELETE_FLAG = 1 WHERE CARE_NO = #careNo#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPFW002
SET
CARE_DATE = #careDate#, <!-- 关怀日期 -->
CARE_NO = #careNo#, <!-- 关怀单号 -->
CARE_WAY = #careWay#, <!-- 关怀方式 -->
CARE_TYPE = #careType#, <!-- 关怀类型 -->
CARE_CONTENT = #careContent#, <!-- 关怀内容 -->
CUSTOM_ID = #customId#, <!-- 客户ID -->
CUSTOM_NAME = #customName#, <!-- 客户名称 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hpjxSchema}.T_HPFW002
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
<!-- 修改 -->
<update id="updateDeal">
UPDATE ${hpjxSchema}.T_HPFW002
SET
STATUS = #status#,
DEAL_USER_ID = #dealUserId#, <!-- 处理人ID -->
DEAL_USER_NAME = #dealUserName#, <!-- 处理人名称 -->
DEAL_CONTENT = #dealContent#, <!-- 处理内容 -->
<include refid="SqlBase.updateRevise"/>
WHERE CARE_NO = #careNo#
</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="HPFW003">
<sql id="column">
ID as "id", <!-- 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", <!-- 是否删除 0-否1-是 -->
COMPLAINT_DATE as "complaintDate", <!-- 投诉日期 -->
COMPLAINT_NO as "complaintNo", <!-- 投诉单号 -->
STATUS as "status", <!-- 状态 -->
CUSTOM_ID as "customId", <!-- 客户ID -->
CUSTOM_NAME as "customName", <!-- 客户名称 -->
COMPLAINT_WAY as "complaintWay", <!-- 投诉方式 -->
COMPLAINT_TYPE as "complaintType", <!-- 投诉类型 -->
COMPLAINT_CONTENT as "complaintContent", <!-- 投诉内容 -->
COMPLAINT_USER_ID as "complaintUserId", <!-- 被投诉人ID -->
COMPLAINT_USER_NAME as "complaintUserName", <!-- 被投诉人名称 -->
ACCEPT_USER_ID as "acceptUserId", <!-- 受理人ID -->
ACCEPT_USER_NAME as "acceptUserName", <!-- 受理人名称 -->
LAST_DATE as "lastDate", <!-- 最后期限 -->
DEAL_CONTENT as "dealContent", <!-- 处理结果 -->
DEAL_USER_ID as "dealUserId", <!-- 处理人ID -->
DEAL_USER_NAME as "dealUserName" <!-- 处理人名称 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<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="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="complaintDate">
COMPLAINT_DATE = #complaintDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="customId">
CUSTOM_ID = #customId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="customName">
CUSTOM_NAME LIKE CONCAT('%', #customName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="complaintWay">
COMPLAINT_WAY = #complaintWay#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="complaintType">
COMPLAINT_TYPE = #complaintType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="complaintContent">
COMPLAINT_CONTENT = #complaintContent#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="complaintUserId">
COMPLAINT_USER_ID = #complaintUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="complaintUserName">
COMPLAINT_USER_NAME LIKE CONCAT('%', #complaintUserName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="acceptUserId">
ACCEPT_USER_ID = #acceptUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="acceptUserName">
ACCEPT_USER_NAME = #acceptUserName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="lastDate">
LAST_DATE = #lastDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dealContent">
DEAL_CONTENT = #dealContent#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dealUserId">
DEAL_USER_ID = #dealUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dealUserName">
DEAL_USER_NAME LIKE CONCAT('%', #dealUserName#, '%')
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="complaintNo">
COMPLAINT_NO = #complaintNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="complaintNos">
COMPLAINT_NO IN <iterate close=")" open="(" conjunction="," property="complaintNos">#complaintNos[]#</iterate>
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.fw.domain.HPFW003">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPFW003
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPFW003 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPFW003 (
COMPANY_CODE, <!-- 公司编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
COMPLAINT_DATE, <!-- 投诉日期 -->
COMPLAINT_NO, <!-- 投诉单号 -->
STATUS, <!-- 状态 -->
CUSTOM_ID, <!-- 客户ID -->
CUSTOM_NAME, <!-- 客户名称 -->
COMPLAINT_WAY, <!-- 投诉方式 -->
COMPLAINT_TYPE, <!-- 投诉类型 -->
COMPLAINT_CONTENT, <!-- 投诉内容 -->
COMPLAINT_USER_ID, <!-- 被投诉人ID -->
COMPLAINT_USER_NAME, <!-- 被投诉人名称 -->
ACCEPT_USER_ID, <!-- 受理人ID -->
ACCEPT_USER_NAME, <!-- 受理人名称 -->
LAST_DATE, <!-- 最后期限 -->
DEAL_CONTENT, <!-- 处理结果 -->
DEAL_USER_ID, <!-- 处理人ID -->
DEAL_USER_NAME <!-- 处理人名称 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#,
#updatedName#, #updatedTime#, #deleteFlag#, #complaintDate#, #complaintNo#, #status#,
#customId#, #customName#, #complaintWay#, #complaintType#, #complaintContent#,
#complaintUserId#, #complaintUserName#, #acceptUserId#, #acceptUserName#,
#lastDate#, #dealContent#, #dealUserId#, #dealUserName#)
</insert>
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPFW003 SET DELETE_FLAG = 1 WHERE COMPLAINT_NO = #complaintNo#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPFW003
SET
COMPLAINT_DATE = #complaintDate#, <!-- 投诉日期 -->
CUSTOM_ID = #customId#, <!-- 客户ID -->
CUSTOM_NAME = #customName#, <!-- 客户名称 -->
COMPLAINT_WAY = #complaintWay#, <!-- 投诉方式 -->
COMPLAINT_TYPE = #complaintType#, <!-- 投诉类型 -->
COMPLAINT_CONTENT = #complaintContent#, <!-- 投诉内容 -->
COMPLAINT_USER_ID = #complaintUserId#, <!-- 被投诉人ID -->
COMPLAINT_USER_NAME = #complaintUserName#, <!-- 被投诉人名称 -->
ACCEPT_USER_ID = #acceptUserId#, <!-- 受理人ID -->
ACCEPT_USER_NAME = #acceptUserName#, <!-- 受理人名称 -->
LAST_DATE = #lastDate#, <!-- 最后期限 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hpjxSchema}.T_HPFW003
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
<!-- 修改 -->
<update id="updateDeal">
UPDATE ${hpjxSchema}.T_HPFW003
SET
STATUS = #status#,
DEAL_USER_ID = #dealUserId#, <!-- 处理人ID -->
DEAL_USER_NAME = #dealUserName#, <!-- 处理人名称 -->
DEAL_CONTENT = #dealContent#, <!-- 处理内容 -->
<include refid="SqlBase.updateRevise"/>
WHERE COMPLAINT_NO = #complaintNo#
</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="HPFW004">
<sql id="column">
ID as "id", <!-- 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", <!-- 是否删除 0-否1-是 -->
STATUS as "status", <!-- 状态 -->
SUGGEST_DATE as "suggestDate", <!-- 建议日期 -->
SUGGEST_NO as "suggestNo", <!-- 建议单号 -->
CUSTOM_ID as "customId", <!-- 客户ID -->
CUSTOM_NAME as "customName", <!-- 客户名称 -->
SUGGEST_WAY as "suggestWay", <!-- 建议方式 -->
SUGGEST_TYPE as "suggestType", <!-- 建议类型 -->
SUGGEST_CONTENT as "suggestContent", <!-- 建议内容 -->
DEAL_CONTENT as "dealContent", <!-- 处理结果 -->
DEAL_USER_ID as "dealUserId", <!-- 处理人ID -->
DEAL_USER_NAME as "dealUserName" <!-- 处理人名称 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<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="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="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="suggestDate">
SUGGEST_DATE = #suggestDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="customId">
CUSTOM_ID = #customId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="customName">
CUSTOM_NAME = #customName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="suggestWay">
SUGGEST_WAY = #suggestWay#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="suggestType">
SUGGEST_TYPE = #suggestType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="suggestContent">
SUGGEST_CONTENT = #suggestContent#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dealContent">
DEAL_CONTENT = #dealContent#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dealUserId">
DEAL_USER_ID = #dealUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dealUserName">
DEAL_USER_NAME LIKE CONCAT('%', #dealUserName#, '%')
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="suggestNo">
SUGGEST_NO = #suggestNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="suggestNos">
SUGGEST_NO IN <iterate close=")" open="(" conjunction="," property="suggestNos">#suggestNos[]#</iterate>
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.fw.domain.HPFW004">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPFW004
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPFW004 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPFW004 (
COMPANY_CODE, <!-- 公司编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
COMPLAINT_DATE, <!-- 投诉日期 -->
COMPLAINT_NO, <!-- 投诉单号 -->
STATUS, <!-- 状态 -->
CUSTOM_ID, <!-- 客户ID -->
CUSTOM_NAME, <!-- 客户名称 -->
COMPLAINT_WAY, <!-- 投诉方式 -->
COMPLAINT_TYPE, <!-- 投诉类型 -->
COMPLAINT_CONTENT, <!-- 投诉内容 -->
COMPLAINT_USER_ID, <!-- 被投诉人ID -->
COMPLAINT_USER_NAME, <!-- 被投诉人名称 -->
ACCEPT_USER_ID, <!-- 受理人ID -->
ACCEPT_USER_NAME, <!-- 受理人名称 -->
LAST_DATE, <!-- 最后期限 -->
DEAL_CONTENT, <!-- 处理结果 -->
DEAL_USER_ID, <!-- 处理人ID -->
DEAL_USER_NAME <!-- 处理人名称 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#,
#updatedName#, #updatedTime#, #deleteFlag#, #complaintDate#, #complaintNo#, #status#,
#customId#, #customName#, #complaintWay#, #complaintType#, #complaintContent#,
#complaintUserId#, #complaintUserName#, #acceptUserId#, #acceptUserName#,
#lastDate#, #dealContent#, #dealUserId#, #dealUserName#)
</insert>
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPFW004 SET DELETE_FLAG = 1 WHERE COMPLAINT_NO = #complaintNo#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPFW004
SET
COMPLAINT_DATE = #complaintDate#, <!-- 投诉日期 -->
CUSTOM_ID = #customId#, <!-- 客户ID -->
CUSTOM_NAME = #customName#, <!-- 客户名称 -->
COMPLAINT_WAY = #complaintWay#, <!-- 投诉方式 -->
COMPLAINT_TYPE = #complaintType#, <!-- 投诉类型 -->
COMPLAINT_CONTENT = #complaintContent#, <!-- 投诉内容 -->
COMPLAINT_USER_ID = #complaintUserId#, <!-- 被投诉人ID -->
COMPLAINT_USER_NAME = #complaintUserName#, <!-- 被投诉人名称 -->
ACCEPT_USER_ID = #acceptUserId#, <!-- 受理人ID -->
ACCEPT_USER_NAME = #acceptUserName#, <!-- 受理人名称 -->
LAST_DATE = #lastDate#, <!-- 最后期限 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hpjxSchema}.T_HPFW004
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
<!-- 修改 -->
<update id="updateDeal">
UPDATE ${hpjxSchema}.T_HPFW004
SET
STATUS = #status#,
DEAL_USER_ID = #dealUserId#, <!-- 处理人ID -->
DEAL_USER_NAME = #dealUserName#, <!-- 处理人名称 -->
DEAL_CONTENT = #dealContent#, <!-- 处理内容 -->
<include refid="SqlBase.updateRevise"/>
WHERE COMPLAINT_NO = #complaintNo#
</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="HPFW007">
<sql id="column">
ID as "id", <!-- 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", <!-- 是否删除 0-否1-是 -->
FOL_DATE as "folDate", <!-- 回访日期 -->
FOL_NO as "folNo", <!-- 回访单号 -->
DEL_ORDER_NO as "delOrderNo", <!-- 发货单号 -->
FOL_WAY as "folWay", <!-- 回访方式 1-电话回访 2-上门回访 -->
STATUS as "status", <!-- 回访状态 0-未回访 1-已回访 -->
CUSTOM_ID as "customId", <!-- 客户ID -->
CUSTOM_NAME as "customName", <!-- 客户名称 -->
DEAL_CONTENT as "dealContent", <!-- 回访内容 -->
DEAL_USER_ID as "dealUserId", <!-- 回访人ID -->
DEAL_USER_NAME as "dealUserName" <!-- 回访人名称 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<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="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="folDate">
FOL_DATE = #folDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="delOrderNo">
DEL_ORDER_NO LIKE CONCAT('%', #delOrderNo#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="folWay">
FOL_WAY = #folWay#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="customId">
CUSTOM_ID = #customId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="customName">
CUSTOM_NAME LIKE CONCAT('%', #customName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dealContent">
DEAL_CONTENT = #dealContent#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dealUserId">
DEAL_USER_ID = #dealUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dealUserName">
DEAL_USER_NAME LIKE CONCAT('%', #dealUserName#, '%')
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="folNo">
FOL_NO = #folNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="folNos">
FOL_NO IN <iterate close=")" open="(" conjunction="," property="folNos">#folNos[]#</iterate>
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.fw.domain.HPFW007">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPFW007 WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPFW007 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPFW007 (
COMPANY_CODE, <!-- 公司编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
FOL_DATE, <!-- 回访日期 -->
FOL_NO, <!-- 回访单号 -->
DEL_ORDER_NO, <!-- 发货单号 -->
FOL_WAY, <!-- 回访方式 1-电话回访 2-上门回访 -->
STATUS, <!-- 回访状态 0-未回访 1-已回访 -->
CUSTOM_ID, <!-- 客户ID -->
CUSTOM_NAME, <!-- 客户名称 -->
DEAL_CONTENT, <!-- 回访内容 -->
DEAL_USER_ID, <!-- 回访人ID -->
DEAL_USER_NAME <!-- 回访人名称 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#,
#updatedName#, #updatedTime#, #deleteFlag#, #folDate#, #folNo#, #delOrderNo#,
#folWay#, #status#, #customId#, #customName#, #dealContent#, #dealUserId#,
#dealUserName#
)
</insert>
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPFW007 SET DELETE_FLAG = 1 WHERE FOL_NO = #folNo#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPFW007
SET
FOL_DATE = #folDate#, <!-- 回访日期 -->
DEL_ORDER_NO = #delOrderNo#, <!-- 发货单号 -->
FOL_WAY = #folWay#, <!-- 回访方式 1-电话回访 2-上门回访 -->
CUSTOM_ID = #customId#, <!-- 客户ID -->
CUSTOM_NAME = #customName#, <!-- 客户名称 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hpjxSchema}.T_HPFW007
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
<!-- 修改 -->
<update id="updateDeal">
UPDATE ${hpjxSchema}.T_HPFW007
SET
STATUS = #status#,
DEAL_USER_ID = #dealUserId#,
DEAL_USER_NAME = #dealUserName#,
DEAL_CONTENT = #dealContent#,
<include refid="SqlBase.updateRevise"/>
WHERE FOL_NO = #folNo#
</update>
</sqlMap>
package com.baosight.hpjx.hp.fw.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConstant;
import com.baosight.hpjx.hp.fw.domain.HPFW001;
import com.baosight.hpjx.hp.fw.domain.HPFW002;
import com.baosight.hpjx.hp.fw.domain.HPFW003;
import com.baosight.hpjx.hp.fw.domain.HPFW007;
import com.baosight.hpjx.util.AssertUtils;
import org.apache.commons.collections.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:songx
* @date:2024/9/24,18:08
*/
public class HpFwTools {
/**
* @author:songx
* @date:2024/9/24,18:08
*/
public static class HpFw001 {
/**
* 锁.
*
* @param afterSaleNo
*/
public static void lock(String afterSaleNo) {
AssertUtils.isEmpty(afterSaleNo, "售后单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HPFW001.FIELD_AFTER_SALE_NO, afterSaleNo);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw001.LOCK, paramMap);
}
/**
* 锁.
*
* @param afterSaleNos
*/
public static void lock(List<String> afterSaleNos) {
AssertUtils.isEmpty(afterSaleNos, "售后单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("afterSaleNos", afterSaleNos);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw001.LOCK, paramMap);
}
/**
* 查询
*
* @param afterSaleNo
* @return
*/
public static HPFW001 get(String afterSaleNo) {
AssertUtils.isEmpty(afterSaleNo, "售后单号不能为空!");
Map<String, Object> paramMap = new HashMap();
paramMap.put(HPFW001.FIELD_AFTER_SALE_NO, afterSaleNo);
List<HPFW001> results = DaoBase.getInstance().query(HPFW001.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param afterSaleNos
* @return
*/
public static List<HPFW001> list(List<String> afterSaleNos) {
AssertUtils.isEmpty(afterSaleNos, "售后服务单号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("afterSaleNos", afterSaleNos);
return DaoBase.getInstance().query(HPFW001.QUERY, paramMap);
}
/**
* 查询
*
* @param afterSaleNos
* @return
*/
public static Map<String, HPFW001> map(List<String> afterSaleNos) {
List<HPFW001> results = list(afterSaleNos);
return results.stream().collect(Collectors.toMap(HPFW001::getAfterSaleNo, item -> item));
}
}
/**
* @author:songx
* @date:2024/9/24,18:08
*/
public static class HpFw002 {
/**
* 锁.
*
* @param careNo
*/
public static void lock(String careNo) {
AssertUtils.isEmpty(careNo, "关怀单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HPFW002.FIELD_CARE_NO, careNo);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw002.LOCK, paramMap);
}
/**
* 锁.
*
* @param careNos
*/
public static void lock(List<String> careNos) {
AssertUtils.isEmpty(careNos, "关怀单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("careNos", careNos);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw002.LOCK, paramMap);
}
/**
* 查询
*
* @param careNo
* @return
*/
public static HPFW002 get(String careNo) {
AssertUtils.isEmpty(careNo, "关怀单号不能为空!");
Map<String, Object> paramMap = new HashMap();
paramMap.put(HPFW002.FIELD_CARE_NO, careNo);
List<HPFW002> results = DaoBase.getInstance().query(HPFW002.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param careNos
* @return
*/
public static List<HPFW002> list(List<String> careNos) {
AssertUtils.isEmpty(careNos, "客户关怀单号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("careNos", careNos);
return DaoBase.getInstance().query(HPFW002.QUERY, paramMap);
}
/**
* 查询
*
* @param careNos
* @return
*/
public static Map<String, HPFW002> map(List<String> careNos) {
List<HPFW002> results = list(careNos);
return results.stream().collect(Collectors.toMap(HPFW002::getCareNo, item -> item));
}
}
/**
* @author:songx
* @date:2024/9/24,18:08
*/
public static class HpFw003 {
/**
* 锁.
*
* @param complaintNo
*/
public static void lock(String complaintNo) {
AssertUtils.isEmpty(complaintNo, "投诉单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HPFW003.FIELD_COMPLAINT_NO, complaintNo);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw003.LOCK, paramMap);
}
/**
* 锁.
*
* @param complaintNos
*/
public static void lock(List<String> complaintNos) {
AssertUtils.isEmpty(complaintNos, "投诉单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("complaintNos", complaintNos);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw003.LOCK, paramMap);
}
/**
* 查询
*
* @param complaintNo
* @return
*/
public static HPFW003 get(String complaintNo) {
AssertUtils.isEmpty(complaintNo, "投诉单号不能为空!");
Map<String, Object> paramMap = new HashMap();
paramMap.put(HPFW003.FIELD_COMPLAINT_NO, complaintNo);
List<HPFW003> results = DaoBase.getInstance().query(HPFW003.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param complaintNos
* @return
*/
public static List<HPFW003> list(List<String> complaintNos) {
AssertUtils.isEmpty(complaintNos, "投诉单号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("complaintNos", complaintNos);
return DaoBase.getInstance().query(HPFW003.QUERY, paramMap);
}
/**
* 查询
*
* @param complaintNos
* @return
*/
public static Map<String, HPFW003> map(List<String> complaintNos) {
List<HPFW003> results = list(complaintNos);
return results.stream().collect(Collectors.toMap(HPFW003::getComplaintNo, item -> item));
}
}
/**
* @author:songx
* @date:2024/9/24,18:08
*/
public static class HpFw007 {
/**
* 锁.
*
* @param folNo
*/
public static void lock(String folNo) {
AssertUtils.isEmpty(folNo, "关怀单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HPFW007.FIELD_FOL_NO, folNo);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw007.LOCK, paramMap);
}
/**
* 锁.
*
* @param folNos
*/
public static void lock(List<String> folNos) {
AssertUtils.isEmpty(folNos, "回访单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("folNos", folNos);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw007.LOCK, paramMap);
}
/**
* 查询
*
* @param folNo
* @return
*/
public static HPFW007 get(String folNo) {
AssertUtils.isEmpty(folNo, "回访单号不能为空!");
Map<String, Object> paramMap = new HashMap();
paramMap.put(HPFW007.FIELD_FOL_NO, folNo);
List<HPFW007> results = DaoBase.getInstance().query(HPFW007.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param folNos
* @return
*/
public static List<HPFW007> list(List<String> folNos) {
AssertUtils.isEmpty(folNos, "回访单号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("folNos", folNos);
return DaoBase.getInstance().query(HPFW007.QUERY, paramMap);
}
/**
* 查询
*
* @param folNos
* @return
*/
public static Map<String, HPFW007> map(List<String> folNos) {
List<HPFW007> results = list(folNos);
return results.stream().collect(Collectors.toMap(HPFW007::getFolNo, item -> item));
}
}
}
package com.baosight.hpjx.hp.fw.utils;
import com.baosight.hpjx.hp.fw.domain.HPFW001;
import com.baosight.hpjx.hp.fw.domain.HPFW002;
import com.baosight.hpjx.hp.fw.domain.HPFW003;
import com.baosight.hpjx.hp.fw.domain.HPFW007;
import com.baosight.hpjx.hp.fw.tools.HpFwTools;
import com.baosight.hpjx.util.ObjectUtils;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/9/24,18:06
*/
public class HpFwUtils {
/**
* @author:songx
* @date:2024/9/24,18:07
*/
public static class HpFw001 {
/**
* 锁并获取数据
*
* @param fFw001s
* @return
*/
public static Map<String, HPFW001> lockAndGet(List<HPFW001> fFw001s) {
List<String> afterSaleNos = ObjectUtils.listEpKey(fFw001s, HPFW001.FIELD_AFTER_SALE_NO);
// 锁
HpFwTools.HpFw001.lock(afterSaleNos);
// 查询数据
return HpFwTools.HpFw001.map(afterSaleNos);
}
/**
* 锁并获取数据
*
* @param fFw001
* @return
*/
public static HPFW001 lockAndGet(HPFW001 fFw001) {
return lockAndGet(fFw001.getAfterSaleNo());
}
/**
* 锁并获取数据
*
* @param afterSaleNo
* @return
*/
public static HPFW001 lockAndGet(String afterSaleNo) {
// 锁
HpFwTools.HpFw001.lock(afterSaleNo);
// 查询数据
return HpFwTools.HpFw001.get(afterSaleNo);
}
}
/**
* @author:songx
* @date:2024/9/24,18:07
*/
public static class HpFw002 {
/**
* 锁并获取数据
*
* @param fFw002s
* @return
*/
public static Map<String, HPFW002> lockAndGet(List<HPFW002> fFw002s) {
List<String> careNos = ObjectUtils.listEpKey(fFw002s, HPFW002.FIELD_CARE_NO);
// 锁
HpFwTools.HpFw002.lock(careNos);
// 查询数据
return HpFwTools.HpFw002.map(careNos);
}
/**
* 锁并获取数据
*
* @param fFw002
* @return
*/
public static HPFW002 lockAndGet(HPFW002 fFw002) {
return lockAndGet(fFw002.getCareNo());
}
/**
* 锁并获取数据
*
* @param careNo
* @return
*/
public static HPFW002 lockAndGet(String careNo) {
// 锁
HpFwTools.HpFw002.lock(careNo);
// 查询数据
return HpFwTools.HpFw002.get(careNo);
}
}
/**
* @author:songx
* @date:2024/9/24,18:07
*/
public static class HpFw003 {
/**
* 锁并获取数据
*
* @param fFw003s
* @return
*/
public static Map<String, HPFW003> lockAndGet(List<HPFW003> fFw003s) {
List<String> complaintNos = ObjectUtils.listEpKey(fFw003s, HPFW003.FIELD_COMPLAINT_NO);
// 锁
HpFwTools.HpFw003.lock(complaintNos);
// 查询数据
return HpFwTools.HpFw003.map(complaintNos);
}
/**
* 锁并获取数据
*
* @param fFw003
* @return
*/
public static HPFW003 lockAndGet(HPFW003 fFw003) {
return lockAndGet(fFw003.getComplaintNo());
}
/**
* 锁并获取数据
*
* @param complaintNos
* @return
*/
public static HPFW003 lockAndGet(String complaintNos) {
// 锁
HpFwTools.HpFw003.lock(complaintNos);
// 查询数据
return HpFwTools.HpFw003.get(complaintNos);
}
}
/**
* @author:songx
* @date:2024/9/24,18:07
*/
public static class HpFw007 {
/**
* 锁并获取数据
*
* @param fFw007s
* @return
*/
public static Map<String, HPFW007> lockAndGet(List<HPFW007> fFw007s) {
List<String> folNos = ObjectUtils.listEpKey(fFw007s, HPFW007.FIELD_FOL_NO);
// 锁
HpFwTools.HpFw007.lock(folNos);
// 查询数据
return HpFwTools.HpFw007.map(folNos);
}
/**
* 锁并获取数据
*
* @param fFw007
* @return
*/
public static HPFW007 lockAndGet(HPFW007 fFw007) {
return lockAndGet(fFw007.getFolNo());
}
/**
* 锁并获取数据
*
* @param folNo
* @return
*/
public static HPFW007 lockAndGet(String folNo) {
// 锁
HpFwTools.HpFw007.lock(folNo);
// 查询数据
return HpFwTools.HpFw007.get(folNo);
}
}
}
......@@ -183,8 +183,8 @@ public class HPKC003 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(12);
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(15);
eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn);
......
......@@ -45,7 +45,7 @@ public class HPSB003A extends DaoEPBase {
public static final String FIELD_DOC_NAME = "docName";
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 账套*/
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 账套*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
......
......@@ -129,8 +129,8 @@
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
A.ACCOUNT_CODE = #accountCode#
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
......
package com.baosight.hpjx.hp.sc.constant;
/**
* @author:songx
* @date:2024/9/25,10:06
*/
public class HpScConst {
/**
* 完成状态
*
* @author:songx
* @date:2024/9/25,10:07
*/
public static class CompleteStatus {
// 未完成
public static final Integer S0 = 0;
// 已完成
public static final Integer S1 = 1;
// 部分完成
public static final Integer S2 = 2;
}
}
......@@ -72,6 +72,7 @@ public class HPSC005 extends DaoEPBase {
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 存货档案ID*/
public static final String FIELD_MAT_ID = "matId"; /* 材料ID*/
public static final String FIELD_DELIVERY_DATE = "deliveryDate";
public static final String FIELD_COMPLETE_STATUS = "completeStatus"; /* 完成状态*/
public static final String COL_MAT_ID = "MAT_ID"; /* 材料ID*/
public static final String COL_ID = "ID";
......@@ -122,6 +123,7 @@ public class HPSC005 extends DaoEPBase {
public static final String COL_FILE_PATH5 = "FILE_PATH5"; /* 文件地址5*/
public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID"; /* 存货档案ID*/
public static final String COL_DELIVERY_DATE = "DELIVERY_DATE";
public static final String COL_COMPLETE_STATUS = "COMPLETE_STATUS";
public static final String QUERY = "HPSC005.query";
public static final String COUNT = "HPSC005.count";
......@@ -178,6 +180,7 @@ public class HPSC005 extends DaoEPBase {
private Long inventRecordId; /* 存货档案ID*/
private Long matId; /* 材料ID*/
private String deliveryDate = " ";
private Integer completeStatus = new Integer(0);
/**
* initialize the metadata.
......@@ -414,6 +417,10 @@ public class HPSC005 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_DELIVERY_DATE);
eiColumn.setDescName("交货日期");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPLETE_STATUS);
eiColumn.setDescName("完成状态");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -1192,7 +1199,15 @@ public class HPSC005 extends DaoEPBase {
public void setDeliveryDate(String deliveryDate) {
this.deliveryDate = deliveryDate;
}
public Integer getCompleteStatus() {
return completeStatus;
}
public void setCompleteStatus(Integer completeStatus) {
this.completeStatus = completeStatus;
}
/**
* get the value from Map.
*
......@@ -1250,6 +1265,7 @@ public class HPSC005 extends DaoEPBase {
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
setMatId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_MAT_ID)), matId));
setDeliveryDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DELIVERY_DATE)), deliveryDate));
setCompleteStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_COMPLETE_STATUS)), completeStatus));
}
......@@ -1309,6 +1325,7 @@ public class HPSC005 extends DaoEPBase {
map.put(FIELD_INVENT_RECORD_ID, StringUtils.toString(inventRecordId, eiMetadata.getMeta(FIELD_INVENT_RECORD_ID)));
map.put(FIELD_MAT_ID, StringUtils.toString(matId, eiMetadata.getMeta(FIELD_MAT_ID)));
map.put(FIELD_DELIVERY_DATE, StringUtils.toString(deliveryDate, eiMetadata.getMeta(FIELD_DELIVERY_DATE)));
map.put(FIELD_COMPLETE_STATUS, StringUtils.toString(completeStatus, eiMetadata.getMeta(FIELD_COMPLETE_STATUS)));
return map;
}
......
......@@ -56,6 +56,7 @@ public class HPSC006 extends DaoEPBase {
public static final String FIELD_FILE_PATH1 = "filePath1"; /* 文件地址1*/
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 存货档案ID*/
public static final String FIELD_MATERIAL = "material"; /* 材质*/
public static final String FIELD_COMPLETE_STATUS = "completeStatus"; /* 完成状态*/
public static final String FIELD_PRDT_NAME = "prdtName"; /* 产品名称*/
public static final String FIELD_PART_NAME = "partName"; /* 零件名称*/
......@@ -104,6 +105,7 @@ public class HPSC006 extends DaoEPBase {
public static final String COL_CUT_SCHEDULE = "CUT_SCHEDULE"; /* 下料进度*/
public static final String COL_REQ_NUM = "REQ_NUM"; /* 领料记录*/
public static final String COL_DELIVERY_DATE = "DELIVERY_DATE";
public static final String COL_COMPLETE_STATUS = "COMPLETE_STATUS";
public static final String QUERY = "HPSC006.query";
......@@ -161,6 +163,7 @@ public class HPSC006 extends DaoEPBase {
private Integer reqNum = new Integer(0);
private String deliveryDate = " ";
private Integer completeStatus = new Integer(0);
/**
* initialize the metadata.
......@@ -344,6 +347,11 @@ public class HPSC006 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_DELIVERY_DATE);
eiColumn.setDescName("交货日期");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPLETE_STATUS);
eiColumn.setDescName("完成状态");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -947,8 +955,16 @@ public class HPSC006 extends DaoEPBase {
public void setDeliveryDate(String deliveryDate) {
this.deliveryDate = deliveryDate;
}
/**
public Integer getCompleteStatus() {
return completeStatus;
}
public void setCompleteStatus(Integer completeStatus) {
this.completeStatus = completeStatus;
}
/**
* get the value from Map.
*
* @param map - source data map
......@@ -994,6 +1010,7 @@ public class HPSC006 extends DaoEPBase {
setCutSchedule(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CUT_SCHEDULE)), cutSchedule));
setReqNum(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_REQ_NUM)), reqNum));
setDeliveryDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DELIVERY_DATE)), deliveryDate));
setCompleteStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_COMPLETE_STATUS)), completeStatus));
}
/**
......@@ -1041,6 +1058,7 @@ public class HPSC006 extends DaoEPBase {
map.put(FIELD_CUT_SCHEDULE, StringUtils.toString(cutSchedule, eiMetadata.getMeta(FIELD_CUT_SCHEDULE)));
map.put(FIELD_REQ_NUM, StringUtils.toString(reqNum, eiMetadata.getMeta(FIELD_REQ_NUM)));
map.put(FIELD_DELIVERY_DATE, StringUtils.toString(deliveryDate, eiMetadata.getMeta(FIELD_DELIVERY_DATE)));
return map;
map.put(FIELD_COMPLETE_STATUS, StringUtils.toString(completeStatus, eiMetadata.getMeta(FIELD_COMPLETE_STATUS)));
return map;
}
}
......@@ -73,7 +73,7 @@ public class HPSC010 extends DaoEPBase {
private String registerDate = " "; /* 登记日期*/
private String factoryCode = " "; /* 工厂代码*/
private BigDecimal weight = new BigDecimal("0"); /* 产量*/
private Long userCount = new Long(0); /* 用工人数*/
private BigDecimal userCount = new BigDecimal(0); /* 用工人数*/
/**
* initialize the metadata.
......@@ -138,6 +138,9 @@ public class HPSC010 extends DaoEPBase {
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_USER_COUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(18);
eiColumn.setDescName("用工人数");
eiMetadata.addMeta(eiColumn);
......@@ -363,7 +366,7 @@ public class HPSC010 extends DaoEPBase {
* get the userCount - 用工人数.
* @return the userCount
*/
public Long getUserCount() {
public BigDecimal getUserCount() {
return this.userCount;
}
......@@ -372,7 +375,7 @@ public class HPSC010 extends DaoEPBase {
*
* @param userCount - 用工人数
*/
public void setUserCount(Long userCount) {
public void setUserCount(BigDecimal userCount) {
this.userCount = userCount;
}
/**
......@@ -396,7 +399,7 @@ public class HPSC010 extends DaoEPBase {
setRegisterDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REGISTER_DATE)), registerDate));
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_CODE)), factoryCode));
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setUserCount(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_USER_COUNT)), userCount));
setUserCount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_USER_COUNT)), userCount));
}
/**
......
......@@ -92,7 +92,7 @@ public class HPSC010A extends DaoEPBase {
private BigDecimal weight = new BigDecimal("0"); /* 产量*/
private BigDecimal weightJh = new BigDecimal("0"); /* 加焊产量*/
private Integer groupUserCount = 0; /* 组用工人数*/
private BigDecimal groupUserCount = new BigDecimal(0); /* 组用工人数*/
private Integer rowNo = 0;
private Long parentId = new Long(0); /* 父级ID*/
private Integer deleteFlag; /* 是否删除0:否1.是*/
......@@ -165,6 +165,9 @@ public class HPSC010A extends DaoEPBase {
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_GROUP_USER_COUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("组人数");
eiMetadata.addMeta(eiColumn);
......@@ -408,7 +411,7 @@ public class HPSC010A extends DaoEPBase {
* get the groupUserCount - 组人数.
* @return the groupUserCount
*/
public Integer getGroupUserCount() {
public BigDecimal getGroupUserCount() {
return this.groupUserCount;
}
......@@ -417,7 +420,7 @@ public class HPSC010A extends DaoEPBase {
*
* @param groupUserCount - 组人数
*/
public void setGroupUserCount(Integer groupUserCount) {
public void setGroupUserCount(BigDecimal groupUserCount) {
this.groupUserCount = groupUserCount;
}
......@@ -578,7 +581,7 @@ public class HPSC010A extends DaoEPBase {
setPrdtName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRDT_NAME)), prdtName));
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setWeightJh(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT_JH)), weightJh));
setGroupUserCount(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_GROUP_USER_COUNT)), groupUserCount));
setGroupUserCount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_GROUP_USER_COUNT)), groupUserCount));
setParentId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PARENT_ID)), parentId));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
......
......@@ -84,7 +84,7 @@ public class ServiceHPSC002 extends ServiceBase {
try {
inInfo = super.query(inInfo, HPSC002.APPQUERY, new HPSC002());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
......
......@@ -11,6 +11,8 @@ import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC005A;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.hp.zl.domain.HPZL001;
import com.baosight.hpjx.hp.zl.tools.HPZLTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
......@@ -21,12 +23,11 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 生产任务
......@@ -274,7 +275,71 @@ public class ServiceHPSC005A extends ServiceBase {
}
return inInfo;
}
/**
* 分派
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "拆单派工",operType = "改派",operDesc = "生产订单-拆单派工A-改派")
public EiInfo assignChange(EiInfo inInfo) {
try {
String[] prodOrderNos = inInfo.getString("prodOrderNos").split(","); //生产订单号
String factoryCode = inInfo.getString("factoryCode");
String factoryName = inInfo.getString("factoryName");
String groupCode = inInfo.getString("groupCode");
String groupName = inInfo.getString("groupName");
// 校验主订单是否已分派
List<HPSC005> hgsc005List = HPSCTools.HpSc005.get(Arrays.asList(prodOrderNos));
AssertUtils.isTrue(CollectionUtils.isEmpty(hgsc005List), "未找到生产订单信息");
//List<String> prodOrderNos = hgsc005List.stream().map(HPSC005::getProdOrderNo).collect(Collectors.toList());
List<HPSC005A> hgsc005AList = HPSCTools.HpSc005a.getByProdOrderNo(Arrays.asList(prodOrderNos));
List<HPZL001> hpzl001List = HPZLTools.getByprodOrderNos(Arrays.asList(prodOrderNos));
AssertUtils.isTrue(CollectionUtils.isNotEmpty(hpzl001List), "生产订单已经进入质检环节,无法改派");
// 锁主单号
HPSCTools.HpSc005a.lock(Arrays.asList(prodOrderNos));
for (HPSC005A hgsc005A : hgsc005AList) {
hgsc005A.setOrgNo(groupCode);
hgsc005A.setOrgName(groupName);
hgsc005A.setFactoryCode(factoryCode);
hgsc005A.setFactoryName(factoryName);
DaoUtils.update("HPSC005A.updateFactoryCode", hgsc005A);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + prodOrderNos.length + "]条数据改派成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "改派失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "拆单派工",operType = "撤销",operDesc = "生产订单-拆单派工A-撤销")
public EiInfo revocation(EiInfo inInfo) {
try {
List<HPSC005> hgsc005List =MapUtils.toDaoEPBases(inInfo, HPSC005.class);
List<String> prodOrderNos =hgsc005List.stream().map(HPSC005::getProdOrderNo).collect(Collectors.toList());
List<HPZL001> hpzl001List = HPZLTools.getByprodOrderNos(prodOrderNos);
AssertUtils.isTrue(CollectionUtils.isNotEmpty(hpzl001List), "生产订单已经进入质检环节,无法撤销");
List<HPSC005A> hgsc005AList = HPSCTools.HpSc005a.getByProdOrderNo(prodOrderNos);
for (HPSC005 hgsc005:hgsc005List) {
hgsc005.setStatus(ProdOrderStatusEnum.NOT_ASSIGN.getCode());
hgsc005.setAssignedNum(BigDecimal.ZERO);
hgsc005.setUnassignedNum(hgsc005.getNum());
DaoUtils.update(HPSC005.UPDATE, hgsc005);
}
hgsc005AList.forEach(hgsc005A -> DaoUtils.update(HPSC005A.DELETE, hgsc005A));
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + 1 + "]条数据撤销成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "撤销失败");
}
return inInfo;
}
/**
* 设置基础信息
*
......
package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.HPConstants;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.ds.domain.HPDS002;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.constant.HpScConst;
import com.baosight.hpjx.hp.sc.domain.HPSC002A;
import com.baosight.hpjx.hp.sc.domain.HPSC003;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.hp.sc.domain.HPSC0061;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.sc.utils.HpScUtils;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ProjectInfo;
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.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.NumberUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:songx
* @date:2024/9/26,9:37
*/
public class ServiceHPSC0061 extends ServiceBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产下料", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC005().eiMetadata);
inInfo.addBlock(CommonConstant.Field.DETAIL).addBlockMeta(new HPSC006().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "生产下料", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HPSC003.FIELD_DELIVERY_DATE, DateUtils.formatShort(queryMap.get(HPSC003.FIELD_DELIVERY_DATE)));
queryMap.put(HPSC005.FIELD_WORK_DATE, DateUtils.formatShort(queryMap.get(HPSC005.FIELD_WORK_DATE)));
queryMap.put(HPSC005.FIELD_PLAN_COMPLETION_DATE,
DateUtils.formatShort(queryMap.get(HPSC005.FIELD_PLAN_COMPLETION_DATE)));
inInfo = super.query(inInfo, "HPSC005.query", new HPSC005());
// 统计各个状态数量
List<Map> statusStats = dao.query("HPSC005.statByCompleteStatus", queryMap);
inInfo.set("statusStat", statusStats);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 明细
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产下料", operType = "查询", operDesc = "查询明细")
public EiInfo queryDetail(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
queryMap.put("prodOrderNo", inInfo.getString("prodOrderNo"));
List<HPSC0061> dbSc0061s = dao.query("HPSC0061.queryDetail", queryMap);
inInfo.addBlock(CommonConstant.Field.DETAIL).setRows(dbSc0061s);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询明细失败");
}
return inInfo;
}
/**
* 刷新主信息
*
* @param inInfo
* @param prodOrderNo
* @return
*/
private EiInfo refreshMain(EiInfo inInfo, String prodOrderNo) {
Map queryMap = new HashMap();
queryMap.put("prodOrderNo", prodOrderNo);
List<HPSC0061> dbSc0061s = dao.query("HPSC0061.queryDetail", queryMap);
inInfo.addBlock(CommonConstant.Field.DETAIL).setRows(dbSc0061s);
return inInfo;
}
/**
* 保存操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产下料", operType = "保存", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
String prodOrderNo = inInfo.getString("prodOrderNo");
List<HPSC0061> fSc0061s = MapUtils.toDaoEPBases(inInfo, CommonConstant.Field.DETAIL, HPSC0061.class);
for (HPSC0061 fSc0061 : fSc0061s) {
String groupCode = fSc0061.getGroupCode();
AssertUtils.isEmpty(groupCode, String.format("物料【%s】的生产组不能为空,请检查", fSc0061.getInventName()));
Org groupOrg = HPXSTools.XsOrg.get(groupCode);
fSc0061.setGroupName(groupOrg.getOrgCname());
fSc0061.setFactoryCode(groupOrg.getFactoryCode());
fSc0061.setFactoryName(groupOrg.getFactoryName());
fSc0061.setProdOrderNo(prodOrderNo);
if (fSc0061.getId() == null || fSc0061.getId() == 0) {
this.add(fSc0061);
} else {
this.modify(fSc0061);
}
}
// 更新主订单状态
this.updateMainStatus(prodOrderNo);
inInfo = this.queryDetail(inInfo);
inInfo.setMsg("操作成功!本次对[" + fSc0061s.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param fSc0061
*/
public void add(HPSC0061 fSc0061) {
fSc0061.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPSC0061.INSERT, fSc0061);
}
/**
* 修改操作.
*/
public void modify(HPSC0061 fSc006) {
DaoUtils.update(HPSC0061.UPDATE, fSc006);
}
/**
* 完成
*
* @param inInfo
* @return
*/
public EiInfo complete(EiInfo inInfo) {
try {
String prodOrderNo = inInfo.getString("prodOrderNo");
List<HPSC0061> fSc0061s = MapUtils.toDaoEPBases(inInfo, CommonConstant.Field.DETAIL, HPSC0061.class);
// 检查数据
this.checkCompleteData(prodOrderNo, fSc0061s);
// 写入数据
this.saveCompleteData(prodOrderNo, fSc0061s);
// 更新主订单状态
this.updateMainStatus(prodOrderNo);
// 刷新页面数据
inInfo = this.query(inInfo);
inInfo = this.refreshMain(inInfo, prodOrderNo);
inInfo.setMsg("操作成功,本次完成" + fSc0061s.size() + "条数据");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
/**
* @param prodOrderNo
* @param fSc0061s
*/
private void checkCompleteData(String prodOrderNo, List<HPSC0061> fSc0061s) {
AssertUtils.isEmpty(prodOrderNo, "请选择订单");
for (HPSC0061 fSc0061 : fSc0061s) {
AssertUtils.isEmpty(fSc0061.getGroupCode(), String.format("物料【%s】的生产组不能为空",
fSc0061.getInventName()));
}
}
/**
* 写入数据
*
* @param prodOrderNo
* @param fSc0061s
*/
private void saveCompleteData(String prodOrderNo, List<HPSC0061> fSc0061s) {
for (HPSC0061 fSc0061 : fSc0061s) {
String groupCode = fSc0061.getGroupCode();
AssertUtils.isEmpty(groupCode, String.format("物料【%s】的生产组不能为空,请检查", fSc0061.getInventName()));
Org groupOrg = HPXSTools.XsOrg.get(groupCode);
fSc0061.setGroupName(groupOrg.getOrgCname());
fSc0061.setFactoryCode(groupOrg.getFactoryCode());
fSc0061.setFactoryName(groupOrg.getFactoryName());
fSc0061.setProdOrderNo(prodOrderNo);
fSc0061.setCompleteStatus(HpScConst.CompleteStatus.S1);
this.add(fSc0061);
}
}
/**
* 更新主订单状态
*
* @param prodOrderNo
*/
private void updateMainStatus(String prodOrderNo) {
Integer completeStatus = calcCompleteStatus(prodOrderNo);
Map paramMap = new HashMap();
paramMap.put(HPSC005.FIELD_PROD_ORDER_NO, prodOrderNo);
paramMap.put(HPSC0061.FIELD_COMPLETE_STATUS, completeStatus);
DaoUtils.update("HPSC005.updateCompleteStatus", paramMap);
}
/**
* 计算完成状态
*
* @param prodOrderNo
* @return
*/
private Integer calcCompleteStatus(String prodOrderNo) {
List<HPSC0061> dbSc0061s = HPSCTools.HpSc0061.getDetailByOrder(prodOrderNo);
List<Integer> statuses = dbSc0061s.stream().map(HPSC0061::getCompleteStatus).distinct()
.collect(Collectors.toList());
if (statuses.size() > 1) {
return HpScConst.CompleteStatus.S2;
} else {
return statuses.get(0);
}
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
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