柏美问题修复
parent
36ed42ce30
commit
8f2c58978e
|
@ -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 += parseFloat(WfForm.getFieldValue(field));//遍历明细行字段
|
sum = addFloat(sum, parseFloat(WfForm.getFieldValue(field)));//遍历明细行字段
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('sum => ', sum)
|
console.log('sum => ', sum)
|
||||||
|
@ -65,6 +65,11 @@ 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
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
// 首台销售日期
|
// 首台销售日期
|
||||||
const firstSaleDateField = WfForm.convertFieldNameToId("stxsrq");
|
var firstSaleDateField = WfForm.convertFieldNameToId("stxsrq");
|
||||||
// 跟踪时间
|
// 跟踪时间
|
||||||
const trackTimeField = WfForm.convertFieldNameToId("gzsj");
|
var trackTimeField = WfForm.convertFieldNameToId("gzsj");
|
||||||
// 跟踪时间为三个月以内
|
// 跟踪时间为三个月以内
|
||||||
const threeMonthIndex = 1;
|
var threeMonthIndex = 1;
|
||||||
// 是否提交等待节点
|
// 是否提交等待节点
|
||||||
const submitWaitNode = WfForm.convertFieldNameToId("sftjddjd");
|
var submitWaitNode = WfForm.convertFieldNameToId("sftjddjd");
|
||||||
// 下次超时提醒日期
|
// 下次超时提醒日期
|
||||||
const timeoutRemindDateFiled = WfForm.convertFieldNameToId("cstxrq");
|
var timeoutRemindDateFiled = WfForm.convertFieldNameToId("cstxrq");
|
||||||
// 跟踪天数 <= 1 ? 15 : 30;
|
// 跟踪天数 <= 1 ? 15 : 30;
|
||||||
const trackingDaysField = WfForm.convertFieldNameToId("gzts")
|
var trackingDaysField = WfForm.convertFieldNameToId("gzts")
|
||||||
// 跟踪触发行数
|
// 跟踪触发行数
|
||||||
const trackingLineField = WfForm.convertFieldNameToId("gzcfxs");
|
var trackingLineField = WfForm.convertFieldNameToId("gzcfxs");
|
||||||
$(() => {
|
jQuery(document).ready(function (){
|
||||||
let detail2LineNum = WfForm.getDetailRowCount("detail_2");
|
var 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)
|
||||||
// 到达节点次数
|
// 到达节点次数
|
||||||
const nodeNum = getNodeNum();
|
var nodeNum = getNodeNum();
|
||||||
let trackingLine = parseInt(WfForm.getFieldValue(trackingLineField));
|
var trackingLine = parseInt(WfForm.getFieldValue(trackingLineField));
|
||||||
// 如果不是则自动添加一行明细让他自己填写
|
// 如果不是则自动添加一行明细让他自己填写
|
||||||
if (detail2LineNum < trackingLine && detail2LineNum < nodeNum) {
|
if (detail2LineNum < trackingLine && detail2LineNum < nodeNum) {
|
||||||
console.log('添加一行明细!');
|
console.log('添加一行明细!');
|
||||||
|
@ -33,32 +33,32 @@ $(() => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
initTimeoutDate();
|
initTimeoutDate();
|
||||||
WfForm.bindFieldChangeEvent(`${firstSaleDateField},${trackTimeField}`,()=>{
|
WfForm.bindFieldChangeEvent(firstSaleDateField + "," + trackTimeField,function (){
|
||||||
initTimeoutDate();
|
initTimeoutDate();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function getNodeNum(){
|
function getNodeNum(){
|
||||||
let firstSaleDate = WfForm.getFieldValue(firstSaleDateField);
|
var firstSaleDate = WfForm.getFieldValue(firstSaleDateField);
|
||||||
console.log('首台销售日期 ', firstSaleDate);
|
console.log('首台销售日期 ', firstSaleDate);
|
||||||
let currentDate = getCurrentDate();
|
var currentDate = getCurrentDate();
|
||||||
let dayDiff = getDaysDiff(firstSaleDate, currentDate);
|
var dayDiff = getDaysDiff(firstSaleDate, currentDate);
|
||||||
console.log('当前天数与首台销售日期相差天数 : ', dayDiff)
|
console.log('当前天数与首台销售日期相差天数 : ', dayDiff)
|
||||||
let trackingDays = WfForm.getFieldValue(trackingDaysField);
|
var 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 ====')
|
||||||
let firstSaleDate = WfForm.getFieldValue(firstSaleDateField);
|
var firstSaleDate = WfForm.getFieldValue(firstSaleDateField);
|
||||||
const nodeNum = getNodeNum();
|
var nodeNum = getNodeNum();
|
||||||
console.log('到达节点次数 ', nodeNum);
|
console.log('到达节点次数 ', nodeNum);
|
||||||
let trackingDays = WfForm.getFieldValue(trackingDaysField);
|
var trackingDays = WfForm.getFieldValue(trackingDaysField);
|
||||||
console.log('跟踪天数 ', trackingDays);
|
console.log('跟踪天数 ', trackingDays);
|
||||||
let computeTimeoutDate = addDays(firstSaleDate, nodeNum * trackingDays);
|
var computeTimeoutDate = addDays(firstSaleDate, nodeNum * trackingDays);
|
||||||
console.log('计算下次超时日期 ', computeTimeoutDate);
|
console.log('计算下次超时日期 ', computeTimeoutDate);
|
||||||
let trackingLine = parseInt(WfForm.getFieldValue(trackingLineField));
|
var trackingLine = parseInt(WfForm.getFieldValue(trackingLineField));
|
||||||
let detail2LineNum = WfForm.getDetailRowCount("detail_2");
|
var 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 (let i = 0; i < trackingLine - parseInt(detail2LineNum); i++) {
|
for (var 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);
|
||||||
const oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
var oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
||||||
const timeDiff = Math.abs(date1.getTime() - date2.getTime()); // 两个日期对象的毫秒数差值
|
var 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) {
|
||||||
const currentYear = date.getFullYear();
|
var currentYear = date.getFullYear();
|
||||||
const currentMonth = date.getMonth() + 1; // getMonth()返回0~11,需要加1
|
var currentMonth = date.getMonth() + 1; // getMonth()返回0~11,需要加1
|
||||||
const currentDay = date.getDate();
|
var currentDay = date.getDate();
|
||||||
return currentYear + '-' + currentMonth + '-' + currentDay;
|
return currentYear + '-' + currentMonth + '-' + currentDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addDays(date, days) {
|
function addDays(date, days) {
|
||||||
const newDate = new Date(date);
|
var 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);
|
||||||
|
|
|
@ -2,8 +2,10 @@ 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;
|
||||||
|
@ -27,23 +29,30 @@ 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(item),""))){
|
if(StringUtils.isNotBlank(Util.null2DefaultStr(mainMap.get(filedValue),""))){
|
||||||
attachment.add(filedValue);
|
cusSql = cusSql
|
||||||
|
.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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue