Commit 7a2deb79 by 宋祥

Merge branch 'dev-sx' of http://129.211.46.84:8800/platform/hp-smart into dev

parents 99289bf5 b40da5d1
package com.baosight.hpjx.hp.ct.constant;
/**
* @author:songx
* @date:2024/9/24,17:53
*/
public class HpCtConst {
/**
* HPCT01 定义
*
* @author:songx
* @date:2024/9/24,17:54
*/
public static class HpCt001 {
/**
* 状态
*
* @author:songx
* @date:2024/5/15,15:18
*/
public static class Status {
// 未关闭
public static final String OPEN = "open";
// 已关闭
public static final String CLOSE = "close";
}
}
}
package com.baosight.hpjx.hp.ct.constant;
/**
* @author:songx
* @date:2024/9/24,18:09
*/
public class HpCtSqlConst {
/**
* @author:songx
* @date:2024/8/29,15:54
*/
public static class HpCt001 {
// 确认
public static final String CONFIRM = "HPCT001.confirm";
}
}
package com.baosight.hpjx.hp.ct.service;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.ct.constant.HpCtConst;
import com.baosight.hpjx.hp.ct.constant.HpCtSqlConst;
import com.baosight.hpjx.hp.ct.domain.HPCT001;
import com.baosight.hpjx.hp.ct.tools.HpCtTools;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.collections.CollectionUtils;
import java.util.List;
import java.util.Map;
/**
* 通知信息
*
* @author:songx
* @date:2021/10/15,16:46
*/
public class ServiceHPCT001 extends ServiceEPBase {
/**
* 页面加载调用.
*
* @param inInfo
*/
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPCT001().eiMetadata);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 页面查询调用入口.
*
* @param inInfo
*/
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 只看自己的通知
queryMap.put(HPCT001.FIELD_USER_ENAME, UserSession.getLoginName());
inInfo = super.query(inInfo, HPCT001.QUERY);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 查询待办
*
* @param inInfo
* @return
*/
public EiInfo queryTodo(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HPCT001.FIELD_STATUS, HpCtConst.HpCt001.Status.OPEN);
queryMap.put(HPCT001.FIELD_USER_ENAME, UserSession.getLoginName());
inInfo = super.query(inInfo, HPCT001.QUERY, new HPCT001());
// 查询总数量
List<Integer> counts = dao.query(HPCT001.COUNT, queryMap);
inInfo.set(EiConstant.countStr, CollectionUtils.isEmpty(counts) ? 0 : counts.get(0));
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询待办信息");
}
return inInfo;
}
/**
* 查询已办
*
* @param inInfo
* @return
*/
public EiInfo queryRecord(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HPCT001.FIELD_STATUS, HpCtConst.HpCt001.Status.CLOSE);
queryMap.put(HPCT001.FIELD_USER_ENAME, UserSession.getLoginName());
inInfo = super.query(inInfo, HPCT001.QUERY, new HPCT001());
// 查询总数量
List<Integer> counts = dao.query(HPCT001.COUNT, queryMap);
inInfo.set(EiConstant.countStr, CollectionUtils.isEmpty(counts) ? 0 : counts.get(0));
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询已办信息");
}
return inInfo;
}
/**
* 已读
*
* @param inInfo
* @return
*/
public EiInfo confirm(EiInfo inInfo) {
try {
Map resultRow = EiInfoUtils.getFirstRow(inInfo, EiConstant.resultBlock);
if (ObjectUtils.isEmpty(resultRow.get(HPCT001.FIELD_INTERNAL_CODE))) {
inInfo.setMsg("无效的待办消息");
return inInfo;
}
resultRow.put(HPCT001.FIELD_STATUS, HpCtConst.HpCt001.Status.CLOSE);
resultRow.put(HPCT001.FIELD_CLOSE_TIME, DateUtils.shortDateTime());
DaoUtils.update(HpCtSqlConst.HpCt001.CONFIRM, resultRow);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "确认已办失败");
}
return inInfo;
}
/**
* 批量已读
*
* @param inInfo
* @return
*/
public EiInfo batchConfirm(EiInfo inInfo) {
try {
int successCount = 0;
List<HPCT001> fCt01s = MapUtils.toDaoEPBases(inInfo, HPCT001.class);
for (HPCT001 fCt01 : fCt01s) {
int result = HpCtTools.HpCt001.confirm(fCt01.getInternalCode());
successCount += result;
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + successCount + "]条数据确认已办成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "已办失败");
}
return inInfo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPCT001">
<sql id="column">
ID as "id", <!-- 主键id -->
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", <!-- 状态 -->
INTERNAL_CODE as "internalCode", <!-- 内码 -->
TITLE as "title", <!-- 标题 -->
CONTENT as "content", <!-- 内容 -->
USER_ENAME as "userEname", <!-- 用户ID -->
USER_CNAME as "userCname", <!-- 用户姓名 -->
FORM_ENAME as "formEname", <!-- 画面英文名 -->
FORM_PARAM as "formParam", <!-- 画面参数 -->
CLOSE_TIME as "closeTime" <!-- 关闭时间 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</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="internalCode">
INTERNAL_CODE = #internalCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="title">
TITLE = #title#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="content">
CONTENT = #content#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userEname">
USER_ENAME = #userEname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userCname">
USER_CNAME = #userCname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="formEname">
FORM_ENAME = #formEname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="formParam">
FORM_PARAM = #formParam#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="closeTime">
CLOSE_TIME = #closeTime#
</isNotEmpty>
</sql>
<sql id="customCondition">
<include refid="condition"/>
<isNotEmpty prepend=" AND " property="createTimeFrom">
CREATED_TIME &gt;= REPLACE(REPLACE(REPLACE(#createTimeFrom#, '-', ''), ':', ''), ' ', '')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createTimeTo">
CREATED_TIME &lt;= REPLACE(REPLACE(REPLACE(#createTimeTo#, '-', ''), ':', ''), ' ', '')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="closeTimeFrom">
CLOSE_TIME &gt;= REPLACE(REPLACE(REPLACE(#closeTimeFrom#, '-', ''), ':', ''), ' ', '')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="closeTimeTo">
CLOSE_TIME &lt;= REPLACE(REPLACE(REPLACE(#closeTimeTo#, '-', ''), ':', ''), ' ', '')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
STATUS ASC, CREATED_TIME DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.ct.domain.HPCT001">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPCT001 WHERE 1=1
<include refid="customCondition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPCT001 WHERE 1=1
<include refid="customCondition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPCT001 (
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
STATUS, <!-- 状态 -->
INTERNAL_CODE, <!-- 内码 -->
TITLE, <!-- 标题 -->
CONTENT, <!-- 内容 -->
USER_ENAME, <!-- 用户ID -->
USER_CNAME, <!-- 用户姓名 -->
FORM_ENAME, <!-- 画面英文名 -->
FORM_PARAM, <!-- 画面参数 -->
CLOSE_TIME <!-- 关闭时间 -->
) VALUES (
#createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#,
#deleteFlag#, #status#, #internalCode#, #title#, #content#, #userEname#, #userCname#,
#formEname#, #formParam#, #closeTime#)
</insert>
<!-- 确认 -->
<update id="confirm">
UPDATE ${hggpSchema}.T_HPCT001
SET
STATUS = #status#,
CLOSE_TIME = #closeTime#,
<include refid="SqlBase.updateRevise"/>
WHERE INTERNAL_CODE = #internalCode#
AND STATUS = 'open'
</update>
</sqlMap>
package com.baosight.hpjx.hp.ct.tools;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.ct.constant.HpCtConst;
import com.baosight.hpjx.hp.ct.constant.HpCtSqlConst;
import com.baosight.hpjx.hp.ct.domain.HPCT001;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* @author:songx
* @date:2024/3/25,20:44
*/
public class HpCtTools {
/**
* HPCT001 sql 定义
*
* @author:songx
* @date:2024/3/25,21:04
*/
public static class HpCt001 {
/**
* 写入数据库
*
* @param ct00
*/
public static void insertDb(HPCT001 ct00) {
ct00.setStatus(HpCtConst.HpCt001.Status.OPEN);
DaoUtils.insert(HPCT001.INSERT, ct00);
}
/**
* 确认已办
*
* @param internalCode
*/
public static int confirm(String internalCode) {
if (StringUtils.isBlank(internalCode)) {
return 0;
}
Map paramMap = new HashMap();
paramMap.put(HPCT001.FIELD_INTERNAL_CODE, internalCode);
paramMap.put(HPCT001.FIELD_STATUS, HpCtConst.HpCt001.Status.CLOSE);
paramMap.put(HPCT001.FIELD_CLOSE_TIME, DateUtils.shortDateTime());
return DaoUtils.update(HpCtSqlConst.HpCt001.CONFIRM, paramMap);
}
}
}
package com.baosight.hpjx.hp.ct.utils;
import com.baosight.hpjx.hp.ct.domain.HPCT001;
import com.baosight.hpjx.hp.ct.tools.HpCtTools;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* @author:songx
* @date:2024/3/25,20:45
*/
@Slf4j
public class HpCtUtils {
/**
* @author:songx
* @date:2024/10/8,17:20
*/
public static class HpCt001 {
/**
* 发送通知
*
* @param ct00 消息体
*/
public static void send(HPCT001 ct00) {
AssertUtils.isNull(ct00, "待办内容不能为空");
AssertUtils.isEmpty(ct00.getTitle(), "待办标题不能为空");
AssertUtils.isEmpty(ct00.getContent(), "待办内容不能为空");
AssertUtils.isEmpty(ct00.getUserEname(), "待办对象不能为空");
// 设置通知对象名称
User user = HPXSTools.XsUser.get(ct00.getUserEname());
ct00.setUserCname(user.getUserName());
HpCtTools.HpCt001.insertDb(ct00);
}
/**
* 发送通知
*
* @param ct00 消息体
* @param loginNames loginNames
*/
public static void send(HPCT001 ct00, List<String> loginNames) {
AssertUtils.isNull(ct00, "待办内容不能为空");
AssertUtils.isEmpty(ct00.getTitle(), "待办标题不能为空");
AssertUtils.isEmpty(ct00.getContent(), "待办内容不能为空");
AssertUtils.isEmpty(loginNames, "待办对象不能为空");
try {
for (String loginName : loginNames) {
User user = HPXSTools.XsUser.get(loginName);
ct00.setUserCname(user.getUserName());
ct00.setUserEname(user.getLoginName());
HpCtTools.HpCt001.insertDb(ct00);
}
} catch (Exception e) {
log.error("发送通知消息失败:{}", e.getMessage(), e);
}
}
}
}
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
<%@include file="/WEB-INF/fragments/kendo-ui-css.tagf" %> <%@include file="/WEB-INF/fragments/kendo-ui-css.tagf" %>
<link rel="shortcut icon" href="${iPlatStaticURL}/iplat.ico" type="image/x-icon"> <link rel="shortcut icon" href="${iPlatStaticURL}/iplat.ico" type="image/x-icon">
<%-- <link href="${iPlatStaticURL}/iPlatV7-index.css" rel="stylesheet" type="text/css"/>--%> <link href="${iPlatStaticURL}/iPlatV7-index.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="${iPlatStaticURL}/iplatui/assets/js/plugins/slick/slick.min.css"> <link rel="stylesheet" href="${iPlatStaticURL}/iplatui/assets/js/plugins/slick/slick.min.css">
<link rel="stylesheet" href="${iPlatStaticURL}/iplatui/assets/js/plugins/slick/slick-theme.min.css" onload="this.rel='stylesheet'" rel="preload" as="style" > <link rel="stylesheet" href="${iPlatStaticURL}/iplatui/assets/js/plugins/slick/slick-theme.min.css" onload="this.rel='stylesheet'" rel="preload" as="style" >
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<!-- 基础服务 --> <!-- 基础服务 -->
<sqlMap resource="com/baosight/hpjx/hp/dm/sql/HPDM099.xml"/> <sqlMap resource="com/baosight/hpjx/hp/dm/sql/HPDM099.xml"/>
<sqlMap resource="com/baosight/hpjx/hp/ct/sql/HPCT001.xml"/>
<!-- 用户服务 --> <!-- 用户服务 -->
<sqlMap resource="com/baosight/hpjx/hp/xs/sql/HPXS007A.xml"/> <sqlMap resource="com/baosight/hpjx/hp/xs/sql/HPXS007A.xml"/>
......
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false,
pageable: {
pageSize: 15,
pageSizes: [15, 50, 100, 200]
},
columns: [{
field: "operate",
template: function (options) {
let formEname = options.formEname;
if (isBlank(formEname)) {
return "";
}
let formParam = "todoInternalCode=" + options.internalCode
+ (isBlank(options.formParam) ? "" : "&" + options.formParam);
let params = '\'' + formEname + '\',\'' + formParam + '\'';
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + params + ')">详情</a>';
return template;
}
}]
}
}
// 查询
$("#QUERY").on("click", query);
// 已读
$("#CONFIRM").on("click", confirm);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 已读
*/
let confirm = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"确认已办\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPCT001", "batchConfirm", true);
}
});
}
/**
* 展示详情
*
* @param formEname
* @param param
*/
let showDetail = function (formEname, param) {
IPLAT.openForm(formEname, param);
}
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="待办消息">
<EF:EFRegion id="inqu" title="条件区域">
<div class="row">
<EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3" optionLabel="全部">
<EF:EFCodeOption codeName="app.ct.status"/>
</EF:EFSelect>
<EF:EFInput cname="标题" blockId="inqu_status" ename="title" row="0" colWidth="3"/>
<EF:EFInput cname="内容" blockId="inqu_status" ename="content" row="0" colWidth="3"/>
</div>
<div class="row">
<EF:EFDateSpan startCname="创建日期(从)" endCname="至" blockId="inqu_status"
startName="createTimeFrom" endName="createTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
<EF:EFDateSpan startCname="关闭日期(从)" endCname="至" blockId="inqu_status"
startName="closeTimeFrom" endName="closeTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细数据">
<EF:EFGrid blockId="result" autoDraw="override" showCount="true" checkMode="row" height="69vh">
<EF:EFColumn ename="internalCode" cname="内码" hidden="true"/>
<EF:EFColumn ename="formEname" cname="表单英文名" hidden="true"/>
<EF:EFColumn ename="formParam" cname="表单参数" hidden="true"/>
<EF:EFColumn ename="operate" cname="操作" enable="false" width="80" align="center"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="100" align="center">
<EF:EFCodeOption codeName="app.ct.status"/>
</EF:EFComboColumn>
<EF:EFColumn ename="title" cname="标题" enable="false" width="140" align="center"/>
<EF:EFColumn ename="content" cname="内容" enable="false" width="500" align="left" sort="true"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
<EF:EFColumn ename="closeTime" cname="关闭时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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