Compare commits

..

No commits in common. "8f2c58978e21eadcf3391a6f799c0bc8de255d13" and "cdda440ef272d21a33ff73eda3dc2507c027a33d" have entirely different histories.

9 changed files with 98 additions and 123 deletions

View File

@ -57,7 +57,7 @@ function submitCallback(detailTable, detail2PayProportionId){
let rowIndex = rowArr[i]; let rowIndex = rowArr[i];
if(rowIndex !== ""){ if(rowIndex !== ""){
let field = `${detail2PayProportionId}_${rowIndex}`; let field = `${detail2PayProportionId}_${rowIndex}`;
sum = addFloat(sum, parseFloat(WfForm.getFieldValue(field)));//遍历明细行字段 sum += parseFloat(WfForm.getFieldValue(field));//遍历明细行字段
} }
} }
console.log('sum => ', sum) console.log('sum => ', sum)
@ -65,11 +65,6 @@ function submitCallback(detailTable, detail2PayProportionId){
}); });
} }
function addFloat(a, b) {
let precision = Math.pow(10, 10); // 设置精度,根据需要调整
return (Math.round(a * precision) + Math.round(b * precision)) / precision;
}
/** /**
* 明细表字段发生变化进行日期计算 * 明细表字段发生变化进行日期计算
* @param bindField * @param bindField

View File

@ -1,27 +1,27 @@
// 首台销售日期 // 首台销售日期
var firstSaleDateField = WfForm.convertFieldNameToId("stxsrq"); const firstSaleDateField = WfForm.convertFieldNameToId("stxsrq");
// 跟踪时间 // 跟踪时间
var trackTimeField = WfForm.convertFieldNameToId("gzsj"); const trackTimeField = WfForm.convertFieldNameToId("gzsj");
// 跟踪时间为三个月以内 // 跟踪时间为三个月以内
var threeMonthIndex = 1; const threeMonthIndex = 1;
// 是否提交等待节点 // 是否提交等待节点
var submitWaitNode = WfForm.convertFieldNameToId("sftjddjd"); const submitWaitNode = WfForm.convertFieldNameToId("sftjddjd");
// 下次超时提醒日期 // 下次超时提醒日期
var timeoutRemindDateFiled = WfForm.convertFieldNameToId("cstxrq"); const timeoutRemindDateFiled = WfForm.convertFieldNameToId("cstxrq");
// 跟踪天数 <= 1 ? 15 : 30; // 跟踪天数 <= 1 ? 15 : 30;
var trackingDaysField = WfForm.convertFieldNameToId("gzts") const trackingDaysField = WfForm.convertFieldNameToId("gzts")
// 跟踪触发行数 // 跟踪触发行数
var trackingLineField = WfForm.convertFieldNameToId("gzcfxs"); const trackingLineField = WfForm.convertFieldNameToId("gzcfxs");
jQuery(document).ready(function (){ $(() => {
var detail2LineNum = WfForm.getDetailRowCount("detail_2"); let detail2LineNum = WfForm.getDetailRowCount("detail_2");
// let firstTrack = Boolean(true); // let firstTrack = Boolean(true);
// if (new Date(firstSaleDate) < new Date(currentDate) && dayDiff > 0) { // if (new Date(firstSaleDate) < new Date(currentDate) && dayDiff > 0) {
// firstTrack = false; // firstTrack = false;
// } // }
// console.log('firstTrack ', firstTrack) // console.log('firstTrack ', firstTrack)
// 到达节点次数 // 到达节点次数
var nodeNum = getNodeNum(); const nodeNum = getNodeNum();
var trackingLine = parseInt(WfForm.getFieldValue(trackingLineField)); let trackingLine = parseInt(WfForm.getFieldValue(trackingLineField));
// 如果不是则自动添加一行明细让他自己填写 // 如果不是则自动添加一行明细让他自己填写
if (detail2LineNum < trackingLine && detail2LineNum < nodeNum) { if (detail2LineNum < trackingLine && detail2LineNum < nodeNum) {
console.log('添加一行明细!'); console.log('添加一行明细!');
@ -33,32 +33,32 @@ jQuery(document).ready(function (){
return; return;
} }
initTimeoutDate(); initTimeoutDate();
WfForm.bindFieldChangeEvent(firstSaleDateField + "," + trackTimeField,function (){ WfForm.bindFieldChangeEvent(`${firstSaleDateField},${trackTimeField}`,()=>{
initTimeoutDate(); initTimeoutDate();
}); });
}); });
function getNodeNum(){ function getNodeNum(){
var firstSaleDate = WfForm.getFieldValue(firstSaleDateField); let firstSaleDate = WfForm.getFieldValue(firstSaleDateField);
console.log('首台销售日期 ', firstSaleDate); console.log('首台销售日期 ', firstSaleDate);
var currentDate = getCurrentDate(); let currentDate = getCurrentDate();
var dayDiff = getDaysDiff(firstSaleDate, currentDate); let dayDiff = getDaysDiff(firstSaleDate, currentDate);
console.log('当前天数与首台销售日期相差天数 : ', dayDiff) console.log('当前天数与首台销售日期相差天数 : ', dayDiff)
var trackingDays = WfForm.getFieldValue(trackingDaysField); let trackingDays = WfForm.getFieldValue(trackingDaysField);
return Math.floor(dayDiff / trackingDays) + 1; return Math.floor(dayDiff / trackingDays) + 1;
} }
function initTimeoutDate(){ function initTimeoutDate(){
console.log('==== initTimeoutDate begin ====') console.log('==== initTimeoutDate begin ====')
var firstSaleDate = WfForm.getFieldValue(firstSaleDateField); let firstSaleDate = WfForm.getFieldValue(firstSaleDateField);
var nodeNum = getNodeNum(); const nodeNum = getNodeNum();
console.log('到达节点次数 ', nodeNum); console.log('到达节点次数 ', nodeNum);
var trackingDays = WfForm.getFieldValue(trackingDaysField); let trackingDays = WfForm.getFieldValue(trackingDaysField);
console.log('跟踪天数 ', trackingDays); console.log('跟踪天数 ', trackingDays);
var computeTimeoutDate = addDays(firstSaleDate, nodeNum * trackingDays); let computeTimeoutDate = addDays(firstSaleDate, nodeNum * trackingDays);
console.log('计算下次超时日期 ', computeTimeoutDate); console.log('计算下次超时日期 ', computeTimeoutDate);
var trackingLine = parseInt(WfForm.getFieldValue(trackingLineField)); let trackingLine = parseInt(WfForm.getFieldValue(trackingLineField));
var detail2LineNum = WfForm.getDetailRowCount("detail_2"); let detail2LineNum = WfForm.getDetailRowCount("detail_2");
setTimeout(()=>{ setTimeout(()=>{
WfForm.changeFieldValue(timeoutRemindDateFiled, {value: computeTimeoutDate}); WfForm.changeFieldValue(timeoutRemindDateFiled, {value: computeTimeoutDate});
// 判断流程提交走向 // 判断流程提交走向
@ -72,7 +72,7 @@ function initTimeoutDate(){
if (detail2LineNum < trackingLine) { if (detail2LineNum < trackingLine) {
WfForm.showMessage('请填写明细表信息!'); WfForm.showMessage('请填写明细表信息!');
detail2LineNum = WfForm.getDetailRowCount("detail_2"); detail2LineNum = WfForm.getDetailRowCount("detail_2");
for (var i = 0; i < trackingLine - parseInt(detail2LineNum); i++) { for (let i = 0; i < trackingLine - parseInt(detail2LineNum); i++) {
WfForm.addDetailRow("detail_2", {}); WfForm.addDetailRow("detail_2", {});
} }
return; return;
@ -89,8 +89,8 @@ function initTimeoutDate(){
function getDaysDiff(date1, date2) { function getDaysDiff(date1, date2) {
date1 = new Date(date1); date1 = new Date(date1);
date2 = new Date(date2); date2 = new Date(date2);
var oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数 const oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
var timeDiff = Math.abs(date1.getTime() - date2.getTime()); // 两个日期对象的毫秒数差值 const timeDiff = Math.abs(date1.getTime() - date2.getTime()); // 两个日期对象的毫秒数差值
// 将毫秒数差值转换为天数差值并四舍五入 // 将毫秒数差值转换为天数差值并四舍五入
return Math.round(timeDiff / oneDay); return Math.round(timeDiff / oneDay);
} }
@ -100,14 +100,14 @@ function getCurrentDate() {
} }
function parseDate(date) { function parseDate(date) {
var currentYear = date.getFullYear(); const currentYear = date.getFullYear();
var currentMonth = date.getMonth() + 1; // getMonth()返回0~11需要加1 const currentMonth = date.getMonth() + 1; // getMonth()返回0~11需要加1
var currentDay = date.getDate(); const currentDay = date.getDate();
return currentYear + '-' + currentMonth + '-' + currentDay; return currentYear + '-' + currentMonth + '-' + currentDay;
} }
function addDays(date, days) { function addDays(date, days) {
var newDate = new Date(date); const newDate = new Date(date);
newDate.setDate(newDate.getDate() + days); newDate.setDate(newDate.getDate() + days);
console.log('newDate ', newDate) console.log('newDate ', newDate)
return parseDate(newDate); return parseDate(newDate);

View File

@ -69,7 +69,7 @@ public class OtherSystemToOAServiceImpl implements OtherSystemToOAService {
String sql = "select id from hrmresource where " + Util.null2DefaultStr(ShBigDataUtil.getPropertiesValByKey("ssoOaCompareField"),"outkey") + " = #{outKey}"; String sql = "select id from hrmresource where " + Util.null2DefaultStr(ShBigDataUtil.getPropertiesValByKey("ssoOaCompareField"),"outkey") + " = #{outKey}";
int id = otherSystemToOAMapper.selectUserIdByOutKey(sql, oaOutKey); int id = otherSystemToOAMapper.selectUserIdByOutKey(sql, oaOutKey);
if(id < 0){ if(id < 0){
throw new CustomerException(Util.logStr("code : {} not found in OA!", oaOutKey)); throw new CustomerException(Util.logStr("code : {} not found in OA!", id));
} }
return id; return id;
} }

View File

@ -2,10 +2,8 @@ package weaver.xuanran.wang.immc.cusfieldvalue;
import aiyh.utils.Util; import aiyh.utils.Util;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import weaver.general.TimeUtil;
import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue; import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue;
import weaver.xiao.commons.config.interfacies.CusInterfaceListValue; import weaver.xiao.commons.config.interfacies.CusInterfaceListValue;
import weaver.xuanran.wang.immc.mapper.ImMcMapper; import weaver.xuanran.wang.immc.mapper.ImMcMapper;
@ -29,30 +27,23 @@ public class CusListValue implements CusInterfaceGetValue {
log.info("pathParam : \n" + JSONObject.toJSONString(pathParam)); log.info("pathParam : \n" + JSONObject.toJSONString(pathParam));
String attachmentField = Util.null2DefaultStr(pathParam.get("attachmentField"), ""); String attachmentField = Util.null2DefaultStr(pathParam.get("attachmentField"), "");
String cusSql = Util.null2DefaultStr(pathParam.get("cusSql"), ""); String cusSql = Util.null2DefaultStr(pathParam.get("cusSql"), "");
// 如果fileName不为空则对集合中每个map添加"fileName":value value则是附件字段名称
String fileName = Util.null2DefaultStr(pathParam.get("fileName"), "");
if(StringUtils.isNotBlank(cusSql)){ if(StringUtils.isNotBlank(cusSql)){
String docIds = "";
if (StringUtils.isNotBlank(attachmentField)) { if (StringUtils.isNotBlank(attachmentField)) {
List<String> attachment = new ArrayList<>();
for (String item : attachmentField.split(",")) { for (String item : attachmentField.split(",")) {
String filedValue = Util.null2DefaultStr(mainMap.get(item),""); String filedValue = Util.null2DefaultStr(mainMap.get(item),"");
if(StringUtils.isNotBlank(Util.null2DefaultStr(mainMap.get(filedValue),""))){ if(StringUtils.isNotBlank(Util.null2DefaultStr(mainMap.get(item),""))){
cusSql = cusSql attachment.add(filedValue);
.replace("{?docIds}", "( " + filedValue + " )")
.replace("{?requestid}",Util.null2DefaultStr(mainMap.get("requestid"),""));
List<Map<String, String>> attachmentInfo = mapper.getAttachmentInfo(cusSql);
if(CollectionUtils.isEmpty(attachmentInfo)){
continue;
}
// 往map中put附件字段名
if(StringUtils.isBlank(fileName)){
attachmentInfo.forEach(file ->{
file.put(fileName, item);
});
}
list.addAll(attachmentInfo);
} }
} }
docIds = StringUtils.join(attachment, ",");
} }
cusSql = cusSql
.replace("{?docIds}", "( " + docIds + " )")
.replace("{?requestid}",Util.null2DefaultStr(mainMap.get("requestid"),""));
List<Map<String, String>> attachmentInfo = mapper.getAttachmentInfo(cusSql);
list.addAll(attachmentInfo);
} }
return list; return list;
} }

View File

@ -42,7 +42,6 @@ public class WorkFlowToVmsAndMQService {
// 表单字段 // 表单字段
private static final String VMS_SUCCESS = "vms_success"; private static final String VMS_SUCCESS = "vms_success";
private static final String SUCCESS = "0"; private static final String SUCCESS = "0";
{ {
httpUtils.getGlobalCache().header.put("Content-Type", MediaType.APPLICATION_JSON); // 全局请求头 httpUtils.getGlobalCache().header.put("Content-Type", MediaType.APPLICATION_JSON); // 全局请求头
} }
@ -51,11 +50,11 @@ public class WorkFlowToVmsAndMQService {
/** /**
* <h1></h1> * <h1></h1>
* *
* @param onlyMark * @param onlyMark
* @param billTable * @param billTable
* @param requestId id * @param requestId id
* @param vmsResponseVoField vms * @param vmsResponseVoField vms
* @param config kafka * @param config kafka
* @author xuanran.wang * @author xuanran.wang
* @dateTime 2022/12/5 17:05 * @dateTime 2022/12/5 17:05
**/ **/
@ -69,9 +68,9 @@ public class WorkFlowToVmsAndMQService {
String url = requestMappingConfig.getRequestUrl(); String url = requestMappingConfig.getRequestUrl();
dealWithMapping.setMainTable(billTable); dealWithMapping.setMainTable(billTable);
Map<String, Object> param = dealWithMapping.getRequestParam(recordSet, requestMappingConfig); Map<String, Object> param = dealWithMapping.getRequestParam(recordSet, requestMappingConfig);
String vmsSuccess = Util.null2DefaultStr(recordSet.getString(VMS_SUCCESS), ""); String vmsSuccess = Util.null2DefaultStr(recordSet.getString(VMS_SUCCESS),"");
String mqSuccess = Util.null2DefaultStr(recordSet.getString(MQ_SUCCESS), ""); String mqSuccess = Util.null2DefaultStr(recordSet.getString(MQ_SUCCESS),"");
if (!SUCCESS.equals(vmsSuccess)) { if(!SUCCESS.equals(vmsSuccess)){
ResponeVo responeVo; ResponeVo responeVo;
try { try {
responeVo = httpUtils.apiPost(url, param); responeVo = httpUtils.apiPost(url, param);
@ -81,7 +80,7 @@ public class WorkFlowToVmsAndMQService {
parseResponseVo(responeVo, url, param, vmsResponseVoField); parseResponseVo(responeVo, url, param, vmsResponseVoField);
updateWorkFlow(VMS_SUCCESS, billTable, requestId); updateWorkFlow(VMS_SUCCESS, billTable, requestId);
} }
if (!SUCCESS.equals(mqSuccess) && StringUtils.isNotBlank(config)) { if(!SUCCESS.equals(mqSuccess) && StringUtils.isNotBlank(config)){
sendToMQ(config, param); sendToMQ(config, param);
updateWorkFlow(MQ_SUCCESS, billTable, requestId); updateWorkFlow(MQ_SUCCESS, billTable, requestId);
} }
@ -89,14 +88,13 @@ public class WorkFlowToVmsAndMQService {
/** /**
* <h1></h1> * <h1></h1>
*
* @param responseVo
* @param url
* @param requestParam
* @author xuanran.wang * @author xuanran.wang
* @dateTime 2022/12/23 11:25 * @dateTime 2022/12/23 11:25
* @param responseVo
* @param url
* @param requestParam
**/ **/
private void parseResponseVo(ResponeVo responseVo, String url, Map<String, Object> requestParam, VmsResponseVoField vmsResponseVoField) { private void parseResponseVo(ResponeVo responseVo, String url, Map<String, Object> requestParam, VmsResponseVoField vmsResponseVoField){
if (responseVo.getCode() != SUCCESS_CODE) { // 相应状态码 if (responseVo.getCode() != SUCCESS_CODE) { // 相应状态码
log.error(Util.logStr("can not fetch [{}]this request params is [{}]" + // 构建日志字符串 log.error(Util.logStr("can not fetch [{}]this request params is [{}]" + // 构建日志字符串
"this request heard is [{}]but response status code is [{}]" + "this request heard is [{}]but response status code is [{}]" +
@ -114,65 +112,63 @@ public class WorkFlowToVmsAndMQService {
/** /**
* <h1>kafka</h1> * <h1>kafka</h1>
*
* @param kafkaConfig kafka
* @param message
* @author xuanran.wang * @author xuanran.wang
* @dateTime 2023/3/30 14:56 * @dateTime 2023/3/30 14:56
* @param kafkaConfig kafka
* @param message
**/ **/
public void sendToMQ(String kafkaConfig, Map<String, Object> message) { public void sendToMQ(String kafkaConfig, Map<String, Object> message){
KafkaProducer<String, String> producer = null; KafkaProducer<String, String> producer = null;
InputStream inputStream = null; InputStream inputStream = null;
try { try {
String path = GCONST.getPropertyPath() + "prop2map" + File.separator + kafkaConfig + ".properties"; String path = GCONST.getPropertyPath() + "prop2map" + File.separator + kafkaConfig + ".properties";
File configFile = new File(path); File configFile = new File(path);
if (!configFile.exists()) { if(!configFile.exists()){
throw new CustomerException("please check /web-inf/prop2map has " + kafkaConfig + ".properties"); throw new CustomerException("please check /web-inf/prop2map has " + kafkaConfig + ".properties");
} }
Properties prop = new Properties(); Properties prop = new Properties();
inputStream = new BufferedInputStream(Files.newInputStream(configFile.toPath())); inputStream= new BufferedInputStream(Files.newInputStream(configFile.toPath()));
prop.load(inputStream); prop.load(inputStream);
log.info("prop => " + JSONObject.toJSONString(prop)); log.info("prop => " + JSONObject.toJSONString(prop));
log.info("msg => " + JSONObject.toJSONString(message)); log.info("msg => " + JSONObject.toJSONString(message));
String topic = Util.null2DefaultStr(prop.getProperty("topic"), ""); String topic = Util.null2DefaultStr(prop.getProperty("topic"),"");
if (StringUtils.isBlank(topic)) { if(StringUtils.isBlank(topic)){
throw new CustomerException("kafka properties topic can not null!"); throw new CustomerException("kafka properties topic can not null!");
} }
producer = new KafkaProducer<>(prop); producer = new KafkaProducer<>(prop);
// 发送消息到指定主题 // 发送消息到指定主题
ProducerRecord<String, String> record = new ProducerRecord<>(topic, JSONObject.toJSONString(message)); ProducerRecord<String, String> record = new ProducerRecord<>(topic, JSONObject.toJSONString(message));
producer.send(record).get(); producer.send(record).get();
} catch (Exception e) { }catch (Exception e){
log.error(Util.getErrString(e)); log.error(Util.getErrString(e));
throw new CustomerException(Util.logStr("send to kafka error!: [{}]", e.getMessage())); throw new CustomerException(Util.logStr("send to kafka error!: [{}]", e.getMessage()));
} finally { }finally {
// 关闭Kafka生产者实例 // 关闭Kafka生产者实例
if (producer != null) { if(producer != null){
producer.close(); producer.close();
} }
if (inputStream != null) { if(inputStream != null){
try { try {
inputStream.close(); inputStream.close();
} catch (Exception e) { }catch (Exception e){
log.error("inputStream close error! " + e.getMessage()); log.error("inputStream close error! " + e.getMessage());
} }
} }
} }
} }
/** /**
* <h1>sql</h1> * <h1>sql</h1>
*
* @param field
* @param tableName
* @param requestId id
* @author xuanran.wang * @author xuanran.wang
* @dateTime 2023/3/30 19:18 * @dateTime 2023/3/30 19:18
* @param field
* @param tableName
* @param requestId id
**/ **/
public void updateWorkFlow(String field, String tableName, String requestId) { public void updateWorkFlow(String field, String tableName, String requestId){
String updateSQL = "update " + tableName + " set " + field + " = " + SUCCESS + " where requestid = ?"; String updateSQL = "update " + tableName + " set " + field + " = " + SUCCESS + " where requestid = ?";
RecordSet recordSet = new RecordSet(); RecordSet recordSet = new RecordSet();
if (!recordSet.executeUpdate(updateSQL, requestId)) { if(!recordSet.executeUpdate(updateSQL, requestId)){
log.error(Util.logStr("update field error! sql: {}, requestId: {}", updateSQL, requestId)); log.error(Util.logStr("update field error! sql: {}, requestId: {}", updateSQL, requestId));
throw new CustomerException("更新表单字段失败!"); throw new CustomerException("更新表单字段失败!");
} }

View File

@ -74,11 +74,6 @@ public class SendTodoTaskUtil {
todoTask.setAgentid(agentId); todoTask.setAgentid(agentId);
todoTask.setTaskName(obj.getRequestnamenew()); todoTask.setTaskName(obj.getRequestnamenew());
todoTask.setTaskDesc(obj.getRequestnamenew()); todoTask.setTaskDesc(obj.getRequestnamenew());
String pcAgentId = ShBigDataUtil.getPropertiesValByKey("pcAgentId");
if(StringUtils.isBlank(pcAgentId)){
pcAgentId = agentId;
}
todoTask.setPcAgentId(pcAgentId);
String todoSSOCallBackUrl = ShBigDataUtil.getPropertiesValByKey("todoSSOCallBackUrl"); String todoSSOCallBackUrl = ShBigDataUtil.getPropertiesValByKey("todoSSOCallBackUrl");
StringBuilder sb = new StringBuilder(todoSSOCallBackUrl); StringBuilder sb = new StringBuilder(todoSSOCallBackUrl);
sb.append("?user=") sb.append("?user=")

View File

@ -37,7 +37,6 @@ public class ShBigDataUtil {
WHILTE_LIST.add("getUserIdDebugOutKey"); WHILTE_LIST.add("getUserIdDebugOutKey");
WHILTE_LIST.add("ssoInterfaceCompareField"); WHILTE_LIST.add("ssoInterfaceCompareField");
WHILTE_LIST.add("ssoOaCompareField"); WHILTE_LIST.add("ssoOaCompareField");
WHILTE_LIST.add("pcAgentId");
} }
/** /**

View File

@ -26,5 +26,4 @@ public class CusTodoTask {
protected String mobileLinkUrl; protected String mobileLinkUrl;
protected String receiver; protected String receiver;
protected String sender; protected String sender;
protected String pcAgentId;
} }

View File

@ -391,8 +391,8 @@ public class BigDataTest extends BaseTest {
@Test @Test
public void testG(){ public void testG(){
String oaOutKey = "wld"; String oaOutKey = "111";
String sql = "select id from hrmresource where loginid = #{outKey}"; String sql = "select id from hrmresource where " + Util.null2DefaultStr(ShBigDataUtil.getPropertiesValByKey("ssoOaCompareField"),"outkey") + " = #{outKey}";
int id = otherSystemToOAMapper.selectUserIdByOutKey(sql, oaOutKey); int id = otherSystemToOAMapper.selectUserIdByOutKey(sql, oaOutKey);
log.info("id => " + id); log.info("id => " + id);
} }