From 4a54e7f5c71462b99bc9443310eb80bd5340181b Mon Sep 17 00:00:00 2001
From: "youHong.ai" <774495953@qq.com>
Date: Mon, 27 Feb 2023 11:55:12 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9E=81=E5=85=94=E7=99=BB=E5=BD=95=E6=B6=88?=
=?UTF-8?q?=E6=81=AF=E6=9F=A5=E8=AF=A2=E3=80=81mapper=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../youhong.ai/pcn/workflow_code_block.js | 33 +-
.../utils/recordset/DoubleTypeHandler.java | 60 +-
.../utils/recordset/FloatTypeHandler.java | 60 +-
.../utils/recordset/IntegerTypeHandler.java | 82 +--
.../controller/HrmLoinTipController.java | 64 +++
.../hrmlogintip/mapper/HrmLoinTipMapper.java | 64 +++
.../service/HrmLoinTipService.java | 61 ++
.../config/service/SapConfigService.java | 528 +++++++++---------
.../service/VoucherPayableService.java | 19 +-
9 files changed, 620 insertions(+), 351 deletions(-)
create mode 100644 src/main/java/com/api/youhong/ai/jitu/hrmlogintip/controller/HrmLoinTipController.java
create mode 100644 src/main/java/com/api/youhong/ai/jitu/hrmlogintip/mapper/HrmLoinTipMapper.java
create mode 100644 src/main/java/com/api/youhong/ai/jitu/hrmlogintip/service/HrmLoinTipService.java
diff --git a/javascript/youhong.ai/pcn/workflow_code_block.js b/javascript/youhong.ai/pcn/workflow_code_block.js
index a6bb3d9..7efc27e 100644
--- a/javascript/youhong.ai/pcn/workflow_code_block.js
+++ b/javascript/youhong.ai/pcn/workflow_code_block.js
@@ -535,4 +535,35 @@ $(() => {
callback()
})
})
-/* ******************* 流程明细字段包含某个字符串时给某个字段赋值为某个东西end ******************* */
+ /* ******************* 流程明细字段包含某个字符串时给某个字段赋值为某个东西end ******************* */
+
+ /* ******************* 提交外出流程 ******************* */
+ (function start() {
+ function fillNum(n) {
+ if (n < 10) {
+ return "0" + n;
+ } else {
+ return n;
+ }
+ }
+
+ let date = new Date()
+ let month = date.getMonth() + 1
+ let year = date.getFullYear();
+ let n = window.prompt("请输入日期:", date.getDate().toString())
+ let workDate = year + "-" + fillNum(month) + "-" + fillNum(n)
+ n = fillNum(n)
+ WfForm.changeFieldValue("field607", {value: workDate})
+ let workflowTitle = WfForm.getFieldValue("field-1");
+ WfForm.changeFieldValue("field-1", {value: workflowTitle.substring(0, workflowTitle.length - 2) + n})
+ WfForm.changeFieldValue("field609", {value: workDate})
+ WfForm.changeFieldValue("field608", {value: "00:00"})
+ WfForm.changeFieldValue("field610", {value: "23:59"})
+ WfForm.changeFieldValue("field30038", {value: 0})
+ WfForm.changeFieldValue("field611", {value: "出差"})
+ WfForm.changeFieldValue("field8715", {value: "2"})
+ $("button[ecid='_Route@vmt0lk_Comp@upn4fo_FormContent@g9f33k_MainLayout@kdmfyn_LayoutTr@ds2cqb@main_0_CellType@27chqt@main_17_10_FieldContent@r045n3_BrowserElement@2mq6lm_WeaBrowser@j1zg9h_WrappedComponent@i9q2c5_Component@iiw91q_Associative@zt8qgk_Button@ztqsd2_button@xq1ea3']").trigger("click")
+ })()
+
+
+/* ******************* 提交外出流程 ******************* */
\ No newline at end of file
diff --git a/src/main/java/aiyh/utils/recordset/DoubleTypeHandler.java b/src/main/java/aiyh/utils/recordset/DoubleTypeHandler.java
index 6d9d9d0..ecc9e36 100644
--- a/src/main/java/aiyh/utils/recordset/DoubleTypeHandler.java
+++ b/src/main/java/aiyh/utils/recordset/DoubleTypeHandler.java
@@ -14,28 +14,40 @@ import java.lang.reflect.Field;
*/
public class DoubleTypeHandler implements TypeHandler {
- @Override
- public Object getValue(RecordSet rs, String fieldName, Field declaredField) {
- String string = Util.null2DefaultStr(GetRsValueUtil.getRsValue(rs, fieldName, declaredField), "0.0");
- return Double.parseDouble(string);
- }
-
- @Override
- public Object getValue(RecordSet rs, int index, Field declaredField) {
- String string = Util.null2DefaultStr(rs.getString(index), "0.0");
- return Double.parseDouble(string);
- }
-
- @Override
- public Object getValue(RecordSetTrans rs, String fieldName, Field declaredField) {
- String string = Util.null2DefaultStr(GetRsValueUtil.getRsValue(rs, fieldName, declaredField), "0.0");
- return Double.parseDouble(string);
- }
-
- @Override
- public Object getValue(RecordSetTrans rs, int index, Field declaredField) {
- String string = Util.null2DefaultStr(rs.getString(index), "0.0");
- return Double.parseDouble(string);
- }
-
+ @Override
+ public Object getValue(RecordSet rs, String fieldName, Field declaredField) {
+ String string = Util.null2String(GetRsValueUtil.getRsValue(rs, fieldName, declaredField));
+ if ("".equals(string)) {
+ return null;
+ }
+ return Double.parseDouble(string);
+ }
+
+ @Override
+ public Object getValue(RecordSet rs, int index, Field declaredField) {
+ String string = Util.null2String(rs.getString(index));
+ if ("".equals(string)) {
+ return null;
+ }
+ return Double.parseDouble(string);
+ }
+
+ @Override
+ public Object getValue(RecordSetTrans rs, String fieldName, Field declaredField) {
+ String string = Util.null2String(GetRsValueUtil.getRsValue(rs, fieldName, declaredField));
+ if ("".equals(string)) {
+ return null;
+ }
+ return Double.parseDouble(string);
+ }
+
+ @Override
+ public Object getValue(RecordSetTrans rs, int index, Field declaredField) {
+ String string = Util.null2String(rs.getString(index));
+ if ("".equals(string)) {
+ return null;
+ }
+ return Double.parseDouble(string);
+ }
+
}
diff --git a/src/main/java/aiyh/utils/recordset/FloatTypeHandler.java b/src/main/java/aiyh/utils/recordset/FloatTypeHandler.java
index 3dbe30b..7f5bde0 100644
--- a/src/main/java/aiyh/utils/recordset/FloatTypeHandler.java
+++ b/src/main/java/aiyh/utils/recordset/FloatTypeHandler.java
@@ -14,28 +14,40 @@ import java.lang.reflect.Field;
*/
public class FloatTypeHandler implements TypeHandler {
- @Override
- public Object getValue(RecordSet rs, String fieldName, Field declaredField) {
- String string = Util.null2DefaultStr(GetRsValueUtil.getRsValue(rs, fieldName, declaredField), "0.0");
- return Float.parseFloat(string);
- }
-
- @Override
- public Object getValue(RecordSet rs, int index, Field declaredField) {
- String string = Util.null2DefaultStr(rs.getString(index), "0.0");
- return Float.parseFloat(string);
- }
-
- @Override
- public Object getValue(RecordSetTrans rs, String fieldName, Field declaredField) {
- String string = Util.null2DefaultStr(GetRsValueUtil.getRsValue(rs, fieldName, declaredField), "0.0");
- return Float.parseFloat(string);
- }
-
- @Override
- public Object getValue(RecordSetTrans rs, int index, Field declaredField) {
- String string = Util.null2DefaultStr(rs.getString(index), "0.0");
- return Float.parseFloat(string);
- }
-
+ @Override
+ public Object getValue(RecordSet rs, String fieldName, Field declaredField) {
+ String string = Util.null2String(GetRsValueUtil.getRsValue(rs, fieldName, declaredField));
+ if ("".equals(string)) {
+ return null;
+ }
+ return Float.parseFloat(string);
+ }
+
+ @Override
+ public Object getValue(RecordSet rs, int index, Field declaredField) {
+ String string = Util.null2String(rs.getString(index), "0.0");
+ if ("".equals(string)) {
+ return null;
+ }
+ return Float.parseFloat(string);
+ }
+
+ @Override
+ public Object getValue(RecordSetTrans rs, String fieldName, Field declaredField) {
+ String string = Util.null2String(GetRsValueUtil.getRsValue(rs, fieldName, declaredField));
+ if ("".equals(string)) {
+ return null;
+ }
+ return Float.parseFloat(string);
+ }
+
+ @Override
+ public Object getValue(RecordSetTrans rs, int index, Field declaredField) {
+ String string = Util.null2String(rs.getString(index));
+ if ("".equals(string)) {
+ return null;
+ }
+ return Float.parseFloat(string);
+ }
+
}
diff --git a/src/main/java/aiyh/utils/recordset/IntegerTypeHandler.java b/src/main/java/aiyh/utils/recordset/IntegerTypeHandler.java
index 86d6c58..8d4f65c 100644
--- a/src/main/java/aiyh/utils/recordset/IntegerTypeHandler.java
+++ b/src/main/java/aiyh/utils/recordset/IntegerTypeHandler.java
@@ -12,39 +12,51 @@ import java.lang.reflect.Field;
public class IntegerTypeHandler implements TypeHandler {
- @Override
- public Object getValue(RecordSet rs, String fieldName, Field declaredField) {
- String string = Util.null2DefaultStr(GetRsValueUtil.getRsValue(rs, fieldName, declaredField), "-1");
- if (string.contains(".")) {
- string = string.substring(0, string.indexOf("."));
- }
- return Integer.parseInt(string);
- }
-
- @Override
- public Object getValue(RecordSet rs, int index, Field declaredField) {
- String string = Util.null2DefaultStr(rs.getString(index), "-1");
- if (string.contains(".")) {
- string = string.substring(0, string.indexOf("."));
- }
- return Integer.parseInt(string);
- }
-
- @Override
- public Object getValue(RecordSetTrans rs, String fieldName, Field declaredField) {
- String string = Util.null2DefaultStr(GetRsValueUtil.getRsValue(rs, fieldName, declaredField), "-1");
- if (string.contains(".")) {
- string = string.substring(0, string.indexOf("."));
- }
- return Integer.parseInt(string);
- }
-
- @Override
- public Object getValue(RecordSetTrans rs, int index, Field declaredField) {
- String string = Util.null2DefaultStr(rs.getString(index), "-1");
- if (string.contains(".")) {
- string = string.substring(0, string.indexOf("."));
- }
- return Integer.parseInt(string);
- }
+ @Override
+ public Object getValue(RecordSet rs, String fieldName, Field declaredField) {
+ String string = Util.null2String(GetRsValueUtil.getRsValue(rs, fieldName, declaredField));
+ if ("".equals(string)) {
+ return null;
+ }
+ if (string.contains(".")) {
+ string = string.substring(0, string.indexOf("."));
+ }
+ return Integer.parseInt(string);
+ }
+
+ @Override
+ public Object getValue(RecordSet rs, int index, Field declaredField) {
+ String string = Util.null2String(rs.getString(index));
+ if ("".equals(string)) {
+ return null;
+ }
+ if (string.contains(".")) {
+ string = string.substring(0, string.indexOf("."));
+ }
+ return Integer.parseInt(string);
+ }
+
+ @Override
+ public Object getValue(RecordSetTrans rs, String fieldName, Field declaredField) {
+ String string = Util.null2String(GetRsValueUtil.getRsValue(rs, fieldName, declaredField));
+ if ("".equals(string)) {
+ return null;
+ }
+ if (string.contains(".")) {
+ string = string.substring(0, string.indexOf("."));
+ }
+ return Integer.parseInt(string);
+ }
+
+ @Override
+ public Object getValue(RecordSetTrans rs, int index, Field declaredField) {
+ String string = Util.null2String(rs.getString(index));
+ if ("".equals(string)) {
+ return null;
+ }
+ if (string.contains(".")) {
+ string = string.substring(0, string.indexOf("."));
+ }
+ return Integer.parseInt(string);
+ }
}
diff --git a/src/main/java/com/api/youhong/ai/jitu/hrmlogintip/controller/HrmLoinTipController.java b/src/main/java/com/api/youhong/ai/jitu/hrmlogintip/controller/HrmLoinTipController.java
new file mode 100644
index 0000000..4d30fbf
--- /dev/null
+++ b/src/main/java/com/api/youhong/ai/jitu/hrmlogintip/controller/HrmLoinTipController.java
@@ -0,0 +1,64 @@
+package com.api.youhong.ai.jitu.hrmlogintip.controller;
+
+import aiyh.utils.ApiResult;
+import aiyh.utils.Util;
+import com.api.youhong.ai.jitu.hrmlogintip.service.HrmLoinTipService;
+import org.apache.log4j.Logger;
+import weaver.hrm.HrmUserVarify;
+import weaver.hrm.User;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+
+/**
+ *
人员第一次登录时候显示提示信息
+ *
+ * create: 2023/2/27 10:29
+ *
+ * @author youHong.ai
+ */
+@Path("aiyh/hrm-login/tip")
+public class HrmLoinTipController {
+
+ private final Logger log = Util.getLogger();
+
+ private final HrmLoinTipService service = new HrmLoinTipService();
+
+ @Path("/get/message")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ public String getMessage(@QueryParam("userAccount") String userAccount) {
+ try {
+ return ApiResult.success(service.getMessage(userAccount));
+ } catch (Exception e) {
+ log.error("get login before show message error! " + Util.getErrString(e));
+ return ApiResult.error("get message error!");
+ }
+ }
+
+
+ @Path("/get/message")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ public String readMessage(@Context HttpServletRequest request, @Context HttpServletResponse response,
+ @QueryParam("userAccount") String userAccount) {
+ User user = null;
+ try {
+ user = HrmUserVarify.getUser(request, response);
+ } catch (Exception ignore) {
+ }
+ try {
+ return ApiResult.success(service.updateMessageStatus(user, userAccount));
+ } catch (Exception e) {
+ log.error("update login before show message status error!" + Util.getErrString(e));
+ return ApiResult.error("update message status error");
+ }
+ }
+
+
+}
diff --git a/src/main/java/com/api/youhong/ai/jitu/hrmlogintip/mapper/HrmLoinTipMapper.java b/src/main/java/com/api/youhong/ai/jitu/hrmlogintip/mapper/HrmLoinTipMapper.java
new file mode 100644
index 0000000..836e5d3
--- /dev/null
+++ b/src/main/java/com/api/youhong/ai/jitu/hrmlogintip/mapper/HrmLoinTipMapper.java
@@ -0,0 +1,64 @@
+package com.api.youhong.ai.jitu.hrmlogintip.mapper;
+
+import aiyh.utils.annotation.recordset.*;
+
+/**
+ *
+ *
+ * create: 2023/2/27 10:53
+ *
+ * @author youHong.ai
+ */
+@SqlMapper
+public interface HrmLoinTipMapper {
+
+
+ /**
+ * 根据账号查询下用户id
+ *
+ * @param account 用户loginid
+ * @return 用户id
+ */
+ @Select("select id from hrmresource where loginid = #{account}")
+ Integer getUserIdByAccount(String account);
+
+ /**
+ * 查询消息显示状态
+ *
+ * @param showStatusField 消息显示状态字段
+ * @param userId 用户id
+ * @return 消息显示字段
+ */
+ @Select("select $t{showStatusField} from cus_fielddata where scope = 'HrmCustomFieldByInfoType'\n" +
+ " and scopeid = -1 and id = #{userId}")
+ Integer getMessageStatus(@ParamMapper("showStatusField") String showStatusField,
+ @ParamMapper("userId") Integer userId);
+
+ /**
+ * 更新消息状态
+ *
+ * @param showStatusField 消息状态字段
+ * @param userId 用户id
+ * @return 是否更新成功
+ */
+ @Update("update cus_fielddata set $t{showStatusField} = 1 where scope = 'HrmCustomFieldByInfoType'\n" +
+ " and scopeid = -1 and id = #{userId} ")
+ boolean updateStatus(@ParamMapper("showStatusField") String showStatusField,
+ @ParamMapper("userId") Integer userId);
+
+ /**
+ * 插入消息状态信息
+ *
+ * @param showStatusField 消息状态字段
+ * @param userId 用户id
+ * @return 是否更新成功
+ */
+ @Insert("insert into cus_fielddata (scope, scopeid, id, $t{showStatusField})\n" +
+ "values ('HrmCustomFieldByInfoType',-1,#{userId},0)")
+ boolean insertStatus(@ParamMapper("showStatusField") String showStatusField,
+ @ParamMapper("userId") Integer userId);
+
+ @Select("select SEQORDER from cus_fielddata where scope = 'HrmCustomFieldByInfoType'\n" +
+ " and scopeid = -1 and id = #{userId}")
+ Integer getMessageStatusId(@ParamMapper("userId") Integer userId);
+}
diff --git a/src/main/java/com/api/youhong/ai/jitu/hrmlogintip/service/HrmLoinTipService.java b/src/main/java/com/api/youhong/ai/jitu/hrmlogintip/service/HrmLoinTipService.java
new file mode 100644
index 0000000..7c7dd9f
--- /dev/null
+++ b/src/main/java/com/api/youhong/ai/jitu/hrmlogintip/service/HrmLoinTipService.java
@@ -0,0 +1,61 @@
+package com.api.youhong.ai.jitu.hrmlogintip.service;
+
+import aiyh.utils.Util;
+import aiyh.utils.tool.Assert;
+import com.api.youhong.ai.jitu.hrmlogintip.mapper.HrmLoinTipMapper;
+import weaver.hrm.User;
+
+import java.util.Objects;
+
+/**
+ *
+ *
+ * create: 2023/2/27 10:33
+ *
+ * @author youHong.ai
+ */
+public class HrmLoinTipService {
+
+ private final HrmLoinTipMapper mapper = Util.getMapper(HrmLoinTipMapper.class);
+
+ /**
+ * 获取显示消息
+ *
+ * @param userAccount 用户账号
+ * @return 消息
+ */
+ public String getMessage(String userAccount) {
+ Integer userId = mapper.getUserIdByAccount(userAccount);
+ String showStatusField = Util.getCusConfigValue("LOGIN_BEFORE_SHOW_MESSAGE_FIELD");
+ Assert.notEmpty(showStatusField, "can not query config by only mark [LOGIN_BEFORE_SHOW_MESSAGE_FIELD](登录前显示消息状态字段_人员卡片自定义字段基本信息字段) on table [uf_cus_dev_config]");
+ Integer showStatus = mapper.getMessageStatus(showStatusField, userId);
+ // 没有展示过
+ if (Objects.isNull(showStatus) || showStatus <= 0) {
+ String loginBeforeShowMessage = Util.getCusConfigValue("LOGIN_BEFORE_SHOW_MESSAGE");
+ Assert.notEmpty(loginBeforeShowMessage, "can not query config by only mark [LOGIN_BEFORE_SHOW_MESSAGE](登录前显示消息) on table [uf_cus_dev_config]");
+ return loginBeforeShowMessage;
+ }
+ return null;
+ }
+
+ /**
+ * 更新消息状态
+ *
+ * @param user 用户
+ * @param userAccount 用户账号
+ * @return 是否更新成功
+ */
+ public boolean updateMessageStatus(User user, String userAccount) {
+ Integer userId = null;
+ if (Objects.isNull(user)) {
+ userId = mapper.getUserIdByAccount(userAccount);
+ }
+ String showStatusField = Util.getCusConfigValue("LOGIN_BEFORE_SHOW_MESSAGE_FIELD");
+ Assert.notEmpty(showStatusField, "can not query config by only mark [LOGIN_BEFORE_SHOW_MESSAGE_FIELD](登录前显示消息状态字段_人员卡片自定义字段基本信息字段) on table [uf_cus_dev_config]");
+ Integer id = mapper.getMessageStatusId(userId);
+ if (!Objects.isNull(id)) {
+ return mapper.updateStatus(showStatusField, userId);
+ }
+ return mapper.insertStatus(showStatusField, userId);
+ }
+}
diff --git a/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/service/SapConfigService.java b/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/service/SapConfigService.java
index 286aa9e..4429ea8 100644
--- a/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/service/SapConfigService.java
+++ b/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/service/SapConfigService.java
@@ -24,268 +24,268 @@ import java.util.stream.Collectors;
*/
public class SapConfigService {
-
- private final SapConfigMapper mapper = Util.getMapper(SapConfigMapper.class);
- private final Logger log = Util.getLogger();
-
- public SapConfigService() {
- }
-
-
- /**
- * getVoucherData 获取凭证配置信息
- * 2023/2/2 13:29
- * ************************************************************
- *
- * @param onlyMark 唯一标识
- * @param requestId 流程请求id
- * @param billTable 流程所在表
- * @return Map 凭证数据
- * @author youHong.ai ******************************************
- */
- public SapVoucher getVoucherData(String onlyMark,
- String requestId,
- String billTable) {
- SapConfigMain sapConfigMain = mapper.selectSapConfigByOnlyMark(onlyMark);
- Assert.notNull(sapConfigMain, "can not query sap config main data by onlyMark : [{}]", onlyMark);
- /* ******************* 查询凭证配置明细 ******************* */
- List sapConfigVoucherHead = mapper.selectSapConfigDetail_1ByMainId(sapConfigMain.getId());
- Assert.notEmpty(sapConfigVoucherHead, "sap voucher head config can not be null!");
- List sapConfigVoucherDetails = mapper.selectSapConfigDetail_2ByMainId(sapConfigMain.getId());
- Assert.notEmpty(sapConfigVoucherDetails, "sap voucher detail config can not be null!");
- sapConfigMain.setVoucherHead(sapConfigVoucherHead);
- sapConfigMain.setVoucherDetails(sapConfigVoucherDetails);
- // 如果凭证数据来源于主表
- if (sapConfigMain.getDocumentTableType() == 0) {
- return parseByMainTable(requestId, billTable, sapConfigMain);
- }
- // 来源于明细表
- return parseByDetailTable(requestId, billTable, sapConfigMain);
- }
-
- /**
- * getReceiptPaymentData 获取收付款数据信息
- * 2023/2/3 15:55
- * ************************************************************
- *
- * @param onlyMark 唯一标识
- * @param requestId 流程请求id
- * @param billTable 流程表名
- * @return SapVoucher sap凭证数据
- * @author youHong.ai ******************************************
- */
- public SapVoucher getReceiptPaymentData(String onlyMark, String requestId, String billTable) {
- SapConfigMain sapConfigMain = mapper.selectSapConfigByOnlyMark(onlyMark);
- Assert.notNull(sapConfigMain, "can not query sap payment config main data by onlyMark : [{}]", onlyMark);
- /* ******************* 查询凭证配置明细 ******************* */
- List sapConfigVoucherHead = mapper.selectSapConfigDetail_1ByMainId(sapConfigMain.getId());
- Assert.notEmpty(sapConfigVoucherHead, "sap voucher payment head config can not be null!");
- sapConfigMain.setVoucherHead(sapConfigVoucherHead);
- // 如果凭证数据来源于主表
- if (sapConfigMain.getDocumentTableType() == 0) {
- return parsePaymentByMainTable(requestId, billTable, sapConfigMain);
- }
- // 来源于明细表
- return parseByPaymentDetailTable(requestId, billTable, sapConfigMain);
- }
-
- private SapVoucher parseByPaymentDetailTable(String requestId, String billTable, SapConfigMain sapConfigMain) {
- Map workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable);
- Assert.notNull(workflowMainData, "payment: query workflow data fail, query request id is {}", requestId);
- List