no message

master
任广鹏 9 months ago
parent 3bd6b47b8a
commit 4e11b07bc6

@ -0,0 +1,121 @@
package com.api.custom.homePageDialog;
import com.alibaba.fastjson.JSONObject;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;
@Path("/custom/homePageDialog")
public class HomePageDialogApi {
@GET
@Path("/getHomePageDialog")
@Produces(MediaType.TEXT_PLAIN)
public String getVersionInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
RecordSet rs = new RecordSet();
JSONObject result = new JSONObject();
JSONObject record = new JSONObject();
try {
String currentDate = getCurrentDate();
String sql = " select * from uf_homePageDialo " +
" where id = (" +
" select max(id) from uf_homePageDialo" +
" where startDate <= ? and endDate >= ?" +
" ) ";
rs.executeQuery(sql,currentDate,currentDate);
String id = "";
String imgUrl = "";
String openUrl = "";
boolean isdialog = true;
if (rs.next()){
id = Util.null2String(rs.getString("id"));
imgUrl = Util.null2String(rs.getString("imgUrl"));
openUrl = Util.null2String(rs.getString("openUrl"));
}
if(!"".equals(id)){
sql = "select count(1) as sl from uf_homePageDialo_dt1 where mainid = ? and userid = ? ";
rs.executeQuery(sql,id,user.getUID());
while (rs.next()){
if(Util.getIntValue(rs.getString("sl"))>0){
isdialog = false;
}
}
}else{
isdialog = false;
}
record.put("isdialog",isdialog);
record.put("id",id);
record.put("imgUrl",imgUrl);
record.put("openUrl",openUrl);
result.put("data", record);
result.put("api_status", true);
}catch (Exception e){
e.printStackTrace();
result.put("api_status", false);
result.put("api_errormsg", "getVersionInfo catch exception : " + e.getMessage());
}
return (JSONObject.toJSONString(result));
}
@GET
@Path("/addDialogUser")
@Produces(MediaType.TEXT_PLAIN)
public String addDialogUser(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> apidatas = new HashMap<String, Object>();
try {
//获取当前用户
User user = HrmUserVarify.getUser(request, response);
String userid = user.getUID()+"";
String mainid = Util.null2String(request.getParameter("id"));
String sql = "insert into uf_homePageDialo_dt1 (mainid,userid) values ('"+mainid+"','"+userid+"')";
RecordSet rs = new RecordSet();
boolean status = rs.executeUpdate(sql);
//删除其它版本用户查看记录
sql = "delete uf_homePageDialo_dt1 where mainid != '"+ mainid +"'";
rs.execute(sql);
rs.next();
apidatas.put("status", status);
apidatas.put("api_status", true);
} catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "addDialogUser catch exception : " + e.getMessage());
}
return (JSONObject.toJSONString(apidatas));
}
/**
* yyyy-MM-dd
* @return
*/
public static String getCurrentDate() {
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 格式化日期为 yyyy-MM-dd 格式的字符串
return currentDate.format(formatter);
}
}

@ -180,7 +180,11 @@ public class WfToDocBizCus extends BaseBean {
useWk = Util.null2String(configComInfo.getValue("htmltopdf_usewk"));
log.error("jymjym……useWk ="+useWk);
//是否使用Itext7
String useItext7 = Util.null2String(configComInfo.getValue("workflowtodoc_useitext7"));
String useItext7 = Util.null2String(configComInfo.getValue("" +
"" +
"" +
" " +
""));
params.put("useItext7", useItext7);
if (!"".equals(useWk)){
params.put("useWk", useWk);

@ -61,9 +61,9 @@ public class PushAuditService {
// zipUtil.writeToTxt(file.getPath(), file.getName(), "", false);
}else{
for (HGBean hgBean : HGBeans) {
if (!isEnd(hgBean.getRequestId()+"")){
continue;
}
// if (!isEnd(hgBean.getRequestId()+"")){
// continue;
// }
//生成TXT
// String s1 = new String(hgBean.getContent().getBytes(StandardCharsets.UTF_8));
zipUtil.writeToTxt(file.getPath(), file.getName(), hgBean.getContent() , true);

@ -0,0 +1,234 @@
package com.engine.custom.readReminder.corn;
import com.cloudstore.dev.api.bean.MessageBean;
import com.cloudstore.dev.api.bean.MessageType;
import com.cloudstore.dev.api.util.Util_Message;
import com.wbi.util.Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
import weaver.hrm.User;
import weaver.interfaces.schedule.BaseCronJob;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
//阅件提醒
public class ReadReminderCorn extends BaseCronJob {
//查询sql
public String sql = "";
//更新sql
public String updateSql = "";
//消息来源id
public String codeid = "";
//提醒内容模板
public String contextTemplate =
"${userName},您好,您有${toReadNum}(该阅件人所有待阅件数量总和)份文件需要办理,"
+ "(办理时限为${timeStr}(该时间为离当前时间最近的最紧急待阅件办理时限)),"
+ "请尽快到保密室阅处。";
//标题
public String title = "";
//pcurl
public String linkUrl = "";
//移动url
public String linkMobileUrl = "";
private static final Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z0-9_]+)\\}");
private static final Logger log = LoggerFactory.getLogger("CustomBusiness");
@Override
public void execute() {
//查询sql
RecordSet rs = new RecordSet();
HashMap<String, String> param = new HashMap<>();
param.put("currentDate",getCurrentDate());
param.put("currentDateTime",getCurrentDateTime());
param.put("startOfDay",getStartOfDay());
param.put("endOfDay",getEndOfDay());
log.info("updateSql:{}",updateSql);
if (!StringUtil.isEmpty(updateSql)){
//判断下是否存在where,防止全表更新
if (updateSql.contains("where") || updateSql.contains("WHERE")){
String updateSqlStr = replaceVariables(updateSql, param);
log.info("updateSqlStr:{}",updateSqlStr);
rs.executeUpdate(updateSqlStr);
log.info("updateSql:Counts:{}",rs.getCounts());
String exceptionMsg = rs.getExceptionMsg();
if (!StringUtil.isEmpty(exceptionMsg)){
log.info("updateSql:ReadReminderCorn.rs.executeQuery.exceptionMsg:{}",exceptionMsg);
}
}
}
sql = replaceVariables(sql, param);
log.info("ReadReminderCorn:sql:{}",sql);
rs.executeQuery(sql); //执行查询sql
String exceptionMsg = rs.getExceptionMsg();
if (!StringUtil.isEmpty(exceptionMsg)){
log.info("ReadReminderCorn.rs.executeQuery.exceptionMsg:{}",exceptionMsg);
}
log.info("消息来源codeid:{}",codeid);
while (rs.next()){
int dyrxm = Util.getIntValue(rs.getString("dyrxm"));
int cnt = Util.getIntValue(rs.getString("cnt"));
String minTime = Util.null2String(rs.getString("minTime"));
HashMap<String, String> map = new HashMap<>();
map.put("userName",new User(dyrxm).getLastname());
map.put("toReadNum",cnt+"");
map.put("timeStr",convertToChineseFormat(minTime));
String context = replaceVariables(contextTemplate, map);
log.info("context:{}",context);
log.info("参数:{}",map);
sendMsg(dyrxm+"",Util.getIntValue(codeid),title,context);
}
}
/**
* ${}Map
* @param template ${}
* @param variables Map
* @return
*/
public static String replaceVariables(String template, Map<String, String> variables) {
// 定义匹配 ${变量名} 的正则表达式
Matcher matcher = pattern.matcher(template);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
// 获取变量名
String variableName = matcher.group(1);
// 从Map中获取变量的值如果不存在则使用空字符串
String replacement = variables.getOrDefault(variableName, "");
// 替换 ${变量名} 为对应的值
matcher.appendReplacement(result, replacement);
}
// 将剩余的字符串附加到结果中
matcher.appendTail(result);
return result.toString();
}
/**
* yyyy-MM-dd
* @return
*/
public static String getCurrentDate() {
// 获取当前日期时间
LocalDateTime now = LocalDateTime.now();
// 定义日期格式
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 格式化日期
return now.format(dateFormatter);
}
/**
* 00:00
* @return yyyy-MM-dd HH:mm
*/
public static String getStartOfDay() {
// 获取当前日期
LocalDateTime startOfDay = LocalDateTime.now().with(LocalTime.MIN);
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化开始时间
return startOfDay.format(formatter);
}
/**
* 23:59
* @return yyyy-MM-dd HH:mm
*/
public static String getEndOfDay() {
// 获取当前日期
LocalDateTime endOfDay = LocalDateTime.now().with(LocalTime.MAX);
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化最后一分钟的时间
return endOfDay.format(formatter);
}
/**
* yyyy-MM-dd HH:mm
* @return
*/
public static String getCurrentDateTime() {
// 获取当前日期时间
LocalDateTime now = LocalDateTime.now();
// 定义日期时间格式
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化日期时间
return now.format(dateTimeFormatter);
}
private void sendMsg(String userid , int codeid , String title , String context){
MessageType messageType = MessageType.newInstance(codeid); // 消息来源(见文档第四点补充 必填)
Set<String> userIdList = new HashSet<>(); // 接收人id 必填
userIdList.add(userid);
// String[] useridArr = userid.split(",");
// for (String s : useridArr) {
// userIdList.add(s);
// }
// String title = "个人周报更新提醒"; // 标题
// String context = "本次周报新增"+(endNum-startNum)+";" +
// "更新前总数"+startNum+";" +
// "更新后总数"+endNum+";"; // 内容
// String linkUrl = ""; // PC端链接
// String linkMobileUrl = ""; // 移动端链接
try {
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, title, context, linkUrl, linkMobileUrl);
messageBean.setCreater(1);// 创建人id
//message.setBizState("0");// 需要修改消息为已处理等状态时传入,表示消息最初状态为待处理
// messageBean.setTargetId("121|22"); //消息来源code +“|”+业务id需要修改消息为已处理等状态时传入
Util_Message.store(messageBean);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* yyyy-MM-dd HH:mm XXXX
* @param dateTimeStr yyyy-MM-dd HH:mm
* @return XXXX
*/
public static String convertToChineseFormat(String dateTimeStr) {
try {
// 定义输入格式
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 将字符串解析为 LocalDateTime 对象
LocalDateTime dateTime = LocalDateTime.parse(dateTimeStr, inputFormatter);
// 自定义输出格式X年X月X日X时
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy年M月d日H时");
// 返回格式化后的字符串
return dateTime.format(outputFormatter);
} catch (DateTimeParseException e) {
// 如果输入格式错误,捕获异常并返回提示
return dateTimeStr;
}
}
}

@ -19,6 +19,8 @@ public class TravelToEsbBean {
private String remark;
private String costDeptCode;
private String costDeptName;
private String srtpLnDeptCode;
private String srtpLnDeptName;
private List<ExpenseItem> expndArray;
@ -36,7 +38,10 @@ public class TravelToEsbBean {
"<expnsRsn>" + expnsRsn + "</expnsRsn>" +
"<remark>" + remark + "</remark>" +
"<costDeptCode>" + costDeptCode + "</costDeptCode>" +
"<costDeptName>" + costDeptName + "</costDeptName>");
"<costDeptName>" + costDeptName + "</costDeptName>" +
"<srtpLnDeptCode>" + srtpLnDeptCode + "</srtpLnDeptCode>" +
"<srtpLnDeptName>" + srtpLnDeptName + "</srtpLnDeptName>"+
"<sadsadfsa>" + srtpLnDeptName + "</sdasdsa>");
for (ExpenseItem expenseItem : expndArray) {
xmlString.append(convertObjectToXml(expenseItem, "expndArray"));
@ -193,4 +198,20 @@ public class TravelToEsbBean {
File tempFile = File.createTempFile("tempfile", ".tmp");
System.out.println("临时文件路径: " + tempFile.getAbsolutePath());
}
public String getSrtpLnDeptCode() {
return srtpLnDeptCode;
}
public void setSrtpLnDeptCode(String srtpLnDeptCode) {
this.srtpLnDeptCode = srtpLnDeptCode;
}
public String getSrtpLnDeptName() {
return srtpLnDeptName;
}
public void setSrtpLnDeptName(String srtpLnDeptName) {
this.srtpLnDeptName = srtpLnDeptName;
}
}

@ -10,21 +10,16 @@ import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
import com.api.browser.util.ConditionFactory;
import com.api.browser.util.ConditionType;
import com.api.browser.util.MobileJsonConfigUtil;
import com.api.browser.util.MobileShowTypeAttr;
import com.api.meeting.util.FieldUtil;
import com.api.meeting.util.MeetingSearchConditionUtil;
import com.api.workplan.util.WorkPlanUtil;
import com.cloudstore.dev.api.bean.SplitMobileDataBean;
import com.cloudstore.dev.api.util.Util_TableMap;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.PageIdConst;
import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
@ -71,6 +66,8 @@ public class GetMeetingInfoCmd extends AbstractCommonCommand<Map<String, Object>
String usePswd = "1";
String frommould = "";
String mouldkey = "";
String isOtherShare = "";
// String isAutoRecord = "";
int viewattr = 3;
int pwdViewAttr = 2;
String type = Util.null2String(params.get("type"));
@ -94,6 +91,7 @@ public class GetMeetingInfoCmd extends AbstractCommonCommand<Map<String, Object>
hrmids = Util.null2String(recordSet.getString("hrmmembers"));
videomtbegindate = Util.null2String(recordSet.getString("begindate"))+" "+Util.null2String(recordSet.getString("begintime"));
videomtenddate = Util.null2String(recordSet.getString("enddate"))+" "+Util.null2String(recordSet.getString("endtime"));
isOtherShare = Util.null2String(recordSet.getString("isOtherShare"))+" "+Util.null2String(recordSet.getString("endtime"));
}
}
}
@ -120,6 +118,9 @@ public class GetMeetingInfoCmd extends AbstractCommonCommand<Map<String, Object>
frommould = Util.null2String(recordSet.getString("frommould"));
mouldkey = Util.null2String(recordSet.getString("mouldkey"));
videomtid = Util.null2String(recordSet.getString("videomtid"));
isOtherShare = Util.null2String(recordSet.getString("isOtherShare"));
// isAutoRecord = Util.null2String(recordSet.getString("isAutoRecord"));
if(isJson(mtpassword)){
JSONObject jsonObject = JSONObject.fromObject(mtpassword);
if(user.getUID() == Util.getIntValue(videomtcreater)){
@ -172,6 +173,8 @@ public class GetMeetingInfoCmd extends AbstractCommonCommand<Map<String, Object>
videomtenddateMap.put("rules", "required");
itemlist.add(videomtenddateMap);
if(!"order".equals(type)){
Map videomtidMap = FieldUtil.getFormItemForInput("oaMtid", SystemEnv.getHtmlLabelName(525536, user.getLanguage()), oaMtid, viewattr);
videomtidMap.put("fieldcol", 14);
@ -282,6 +285,14 @@ public class GetMeetingInfoCmd extends AbstractCommonCommand<Map<String, Object>
joinMap.put("fieldcol", 14);
itemlist.add(joinMap);
}
Map<String, Object> isOtherShareMap = FieldUtil.getFormItemForSwitch("isOtherShare", "是否允许参会者分享会议", StringUtil.isEmpty(isOtherShare)? "1" : isOtherShare , viewattr);
videomtenddateMap.put("rules", "required");
itemlist.add(isOtherShareMap);
// Map<String, Object> isAutoRecordMap = FieldUtil.getFormItemForSwitch("isAutoRecord", "是否开启自动录制", StringUtil.isEmpty(isAutoRecord)? "0" : isAutoRecord , viewattr);
// isAutoRecordMap.put("rules", "required");
// itemlist.add(isAutoRecordMap);
//相关链接控件。
String browsertype = "";
@ -319,6 +330,7 @@ public class GetMeetingInfoCmd extends AbstractCommonCommand<Map<String, Object>
apidatas.put("isOpenInvite",videoMeetingUtil.isOpenInvite());
apidatas.put("personType",personType);
apidatas.put("userId",user.getUID());
apidatas.put("isOtherShare",isOtherShare);
//放一下是否开始的参数。
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {

@ -0,0 +1,202 @@
/*
*
* Copyright (c) 2001-2016 .
* ,.
*
*/
package com.engine.meeting.cmd.meetingmobilevideo;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import net.sf.json.JSONObject;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import weaver.meeting.video.util.VideoMeetingUtil;
import weaver.systeminfo.SystemEnv;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
*
* @author yp
*/
public class GetNotStartListCmd extends AbstractCommonCommand<Map<String, Object>> {
public GetNotStartListCmd(User user, Map<String, Object> params) {
this.user = user;
this.params = params;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map ret = new HashMap();
List datas = new ArrayList();
VideoMeetingUtil vmt = new VideoMeetingUtil();
String _ec_os = Util.null2String(params.get("_ec_os"));//移动端os类型
String ismobile = Util.null2String(params.get("ismobile"));//是否伟移动端请求
RecordSet recordSet = new RecordSet();
String sql = "";
if("sqlserver".equals(recordSet.getDBType())){
sql = "select * from meeting_videolist where (videomtstatus='0' OR videomtstatus = '1') AND videomtenddate>GETDATE()" ;
//只能看到自己的,或者参会
sql += " and (videomtcreater = " + user.getUID();
sql += " or ";
sql += VideoMeetingUtil.getHrmLikeSql("hrmids",user.getUID()+"",recordSet);
sql +=" )";
sql += " ORDER BY videomtbegindate ASC";
}else if ("mysql".equals(recordSet.getDBType())) {
sql = "select * from meeting_videolist where (videomtstatus='0' OR videomtstatus = '1') " ;
//只能看到自己的,或者参会
sql += " and (videomtcreater = " + user.getUID();
sql += " or ";
sql += VideoMeetingUtil.getHrmLikeSql("hrmids",user.getUID()+"",recordSet);
sql +=" )";
sql += "AND videomtenddate>now() ORDER BY videomtbegindate ASC";
}
else if ("postgresql".equals(recordSet.getDBType())) {
sql = "select * from meeting_videolist where (videomtstatus='0' OR videomtstatus = '1') " ;
//只能看到自己的,或者参会
sql += " and (videomtcreater = " + user.getUID();
sql += " or ";
sql += VideoMeetingUtil.getHrmLikeSql("hrmids",user.getUID()+"",recordSet);
sql +=" )";
sql += "AND videomtenddate>now() ORDER BY videomtbegindate ASC";
}
else{
sql = "select * from meeting_videolist where (videomtstatus='0' OR videomtstatus = '1')";
//只能看到自己的,或者参会
sql += " and (videomtcreater = " + user.getUID();
sql += " or ";
sql += VideoMeetingUtil.getHrmLikeSql("hrmids",user.getUID()+"",recordSet);
sql +=" )";
sql += " AND sysdate <to_date(videomtenddate,'yyyy-mm-dd hh24:mi') ORDER BY videomtbegindate ASC ";
}
recordSet.executeQuery(sql);
while (recordSet.next()) {
Map infoMap = new HashMap();
String videomtname = recordSet.getString("videomtname");
String videomtbegindate = recordSet.getString("videomtbegindate");
String videomtenddate = recordSet.getString("videomtenddate");
String manufacturers = recordSet.getString("manufacturers");
String videomtjoinurl = recordSet.getString("videomtjoinurl");
String videomtstarturl = recordSet.getString("videomtstarturl");
String videomtid = recordSet.getString("videomtid");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdff = new SimpleDateFormat("yyyy-MM-dd");
String begin = "";
String end = "";
String id = recordSet.getString("id");
try {
begin = sdf.format(sdff.parse(videomtbegindate));
end = sdf.format(sdff.parse(videomtenddate));
} catch (ParseException e) {
e.printStackTrace();
}
String videomtcreater = recordSet.getString("videomtcreater");
String mtpassword = recordSet.getString("mtpassword");
if("InfowareLab".equals(manufacturers) && "1".equals(ismobile)){//特殊处理红杉树会议链接
videomtstarturl = vmt.getHSSLinkUrl(user.getUID()+"",_ec_os,videomtid,mtpassword,true);
videomtjoinurl = vmt.getHSSLinkUrl(user.getUID()+"",_ec_os,videomtid,mtpassword,false);
}
String oaMtid = Util.null2String(recordSet.getString("oaMtid"));
if (isJson(mtpassword)) {
JSONObject jsonObject = JSONObject.fromObject(mtpassword);
mtpassword = jsonObject.getString("chair_pwd");
}
ResourceComInfo resourceComInfo = null;
try {
resourceComInfo = new ResourceComInfo();
} catch (Exception e) {
e.printStackTrace();
}
String creater = resourceComInfo.getResourcename(videomtcreater);
creater = Util.formatMultiLang(creater ,user.getLanguage()+"");
// if(creater.length()>5){
// creater = creater.substring(0,5)+"...";
// }
if (videomtbegindate.length() > 10) {
videomtbegindate = videomtbegindate.substring(11);
}
if (videomtenddate.length() > 10) {
videomtenddate = videomtenddate.substring(11);
}
if (!begin.equals(end)) {
videomtenddate = SystemEnv.getHtmlLabelName(388785, user.getLanguage()) + videomtenddate;
}
infoMap.put("name", videomtname);
infoMap.put("begin", begin);
infoMap.put("end", end);
infoMap.put("creater", creater);
infoMap.put("videomtbegindate", videomtbegindate);
infoMap.put("videomtenddate", videomtenddate);
infoMap.put("mtpassword", mtpassword);
infoMap.put("id", id);
infoMap.put("videomtid", oaMtid);
infoMap.put("manufacturers", manufacturers);
infoMap.put("videomtjoinurl", videomtjoinurl);
infoMap.put("videomtstarturl", videomtstarturl);
datas.add(infoMap);
}
Map<String, List<User>> map = new HashMap<>();
List newdata = this.getFinalData(datas);
ret.put("datas", newdata);
return ret;
}
public List getFinalData(List<Map> datas) {
Map<Object, List<Map<String, Object>>> map = new HashMap<>();
// Map mapss = new HashMap<>();
List listss = new ArrayList();
for (Map item : datas) {
Map map2 = new HashMap();
map2.put("begin", item.get("begin"));
if (map.containsKey(map2)) {//map中存在此id将数据存放当前key的map中
map.get(map2).add(item);
} else {//map中不存在新建key用来存放数据
List<Map<String, Object>> tmpList = new ArrayList<>();
tmpList.add(item);
Map mapss = new HashMap<>();
mapss.put("date", item.get("begin"));
mapss.put("week", getWeek(Util.null2String(item.get("begin")),user.getLanguage()));
mapss.put("data", tmpList);
listss.add(mapss);
map.put(map2, tmpList);
}
}
return listss;
}
public static boolean isJson(String content) {
try {
JSONObject.fromObject(content);
return true;
} catch (Exception e) {
return false;
}
}
public static String getWeek(String date,int langid) {
String[] arr = date.split("-");
Calendar calendar = Calendar.getInstance();//获得一个日历
calendar.set(Integer.parseInt(arr[0]), Integer.parseInt(arr[1]) - 1, Integer.parseInt(arr[2]));//设置当前时间,月份是从0月开始计算
int number = calendar.get(Calendar.DAY_OF_WEEK);//星期表示1-7是从星期日开始
String[] str = {"", SystemEnv.getHtmlLabelName(16106,langid), SystemEnv.getHtmlLabelName(16100,langid), SystemEnv.getHtmlLabelName(16101,langid),
SystemEnv.getHtmlLabelName(16102,langid), SystemEnv.getHtmlLabelName( 16103,langid), SystemEnv.getHtmlLabelName(16104,langid),SystemEnv.getHtmlLabelName(16105,langid),};
return str[number];
}
@Override
public BizLogContext getLogContext() {
return null;
}
}

@ -2,6 +2,7 @@ package com.engine.meeting.cmd.meetingvideo;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.biz.SimpleBizLogger;
import com.engine.common.constant.BizLogSmallType4Meeting;
import com.engine.common.constant.BizLogType;
import com.engine.common.constant.ParamConstant;
import com.engine.common.entity.BizLogContext;
@ -10,6 +11,7 @@ import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.meeting.remind.MeetingRemindUtil;
import weaver.meeting.video.consumer.MeetingVideoFactory;
import weaver.meeting.video.consumer.VideoMeetingClient;
import weaver.meeting.video.util.BizLogSmallType4VideoMeeting;
@ -125,6 +127,7 @@ public class DoAddVideoMeetingCmd extends AbstractCommonCommand<Map<String, Obje
zoomMap.put("hrmids", Util.null2String(params.get("hrmids")));
zoomMap.put("videoparties", Util.null2String(params.get("videoparties")));
zoomMap.put("isOtherShare", Util.null2String(params.get("isOtherShare")));
// zoomMap.put("isAutoRecord", Util.null2String(params.get("isAutoRecord")));
zoomMap = VideoMeetingUtil.dealParams(zoomMap);
String manu = "";
try {
@ -169,6 +172,7 @@ public class DoAddVideoMeetingCmd extends AbstractCommonCommand<Map<String, Obje
}
}
} else {
result = videoMeetingClient.addMeeting(zoomMap);
if(Boolean.parseBoolean(Util.null2String(result.get("api_status")))){
videoMeetingUtil.remindByThread(result.get("maxid")+"", new User(user.getUID()),999);
}

@ -9,6 +9,7 @@ import com.engine.common.constant.ParamConstant;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.meeting.video.util.BizLogSmallType4VideoMeeting;
@ -64,7 +65,14 @@ public class getVideoMeetingBtnCmd extends AbstractCommonCommand<Map<String, Obj
json.put("canforword",0);
json.put("opentype",1);
json.put("opentype_pc",1);
json.put("shareid",recordSet.getString("videomtid"));
json.put("shareid",recordSet.getInt("videomtid"));
// json.put("isOtherShare",recordSet.getString("isOtherShare"));
ret.put("isOtherShare",recordSet.getString("isOtherShare"));
int videomtcreater = Util.getIntValue(recordSet.getString("VIDEOMTCREATER"));
//判断下是否为会议创建人,是的话默认允许
if (user.getUID() == videomtcreater){
ret.put("isOtherShare","1");
}
String general_pwd = "";
//如果存在数据,看下是查看会议,还是加入会议
if (Util.null2String(user.getUID()).equals(recordSet.getString("videomtcreater"))) {
@ -148,6 +156,9 @@ public class getVideoMeetingBtnCmd extends AbstractCommonCommand<Map<String, Obj
}
}
}
if (StringUtil.isEmpty(Util.null2String(ret.get("isOtherShare")))){
ret.put("isOtherShare",1);
}
ret.put("isShowVideoBtn",showBtn);
return ret;
}

@ -7,6 +7,7 @@ import com.engine.workflow.util.CommonUtil;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.security.util.SecurityMethodUtil;
@ -14,10 +15,9 @@ import weaver.wechat.util.Utils;
import weaver.workflow.request.todo.OfsSettingObject;
import weaver.workflow.request.todo.RequestUtil;
import weaver.workflow.webservices.WorkflowServiceImpl;
import weaver.workflow.workflow.WorkflowVersion;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import static weaver.security.util.SecurityMethodUtil.clearKeywordFromConditon;
@ -54,7 +54,7 @@ public class TJBKWorkFlowServiceImpl implements TJBKWorkFlowService {
// String[] strings = {};
// new RecordSet()
String conditionsql = getToDoWfidCondition();
// new BaseBean().writeLog("getToDoWfidCondition"+conditionsql);
new BaseBean().writeLog("getToDoWfidCondition"+conditionsql);
String[] strings = {conditionsql};
int toDoWorkflowRequestCount = getToDoWorkflowRequestCount4OS(Integer.parseInt(userId), strings,true);
@ -110,14 +110,27 @@ public class TJBKWorkFlowServiceImpl implements TJBKWorkFlowService {
private String getToReadWfidCondition() {
RecordSet rs = new RecordSet();
boolean b = rs.executeQuery(getToReadwfidsql);
String[] arr = new String[rs.getCounts()];
StringBuilder sqlwhere = new StringBuilder();
StringBuilder contextStr = new StringBuilder();
int i = 0;
while (rs.next()){
String content = Util.null2String( rs.getString("content"));
if (!StringUtils.isEmpty(content)){
arr[i] = "t1.workflowid = "+content;
i++;
contextStr = contextStr.append(content).append(",");
}
}
if (contextStr.length() > 1) {
contextStr.delete(contextStr.length() - 1, contextStr.length());
}
String allVersionString = WorkflowVersion.getAllVersionStringByWFIDs4List(contextStr.toString());
String[] allVersionStrArr = allVersionString.split(",");
String[] arr = new String[allVersionStrArr.length];
for (String VersionStr : allVersionStrArr) {
if (!StringUtils.isEmpty(VersionStr)){
arr[i] = "t1.workflowid = "+VersionStr;
i++;
}
}
// 过滤掉空元素
@ -133,23 +146,37 @@ public class TJBKWorkFlowServiceImpl implements TJBKWorkFlowService {
private String getToDoWfidCondition() {
RecordSet rs = new RecordSet();
boolean b = rs.executeQuery(getToDowfidsql);
String[] arr = new String[rs.getCounts()];
StringBuilder sqlwhere = new StringBuilder();
int i = 0;
StringBuffer result = new StringBuffer();
while (rs.next()){
String content = Util.null2String( rs.getString("content"));
if (!StringUtils.isEmpty(content)){
arr[i] = "t1.workflowid != " + content;
if (!StringUtil.isEmpty(content)){
result.append(content).append(",");
}
}
if (result.length() > 1) {
result.delete(result.length() - 1, result.length());
}
String allVersionString = WorkflowVersion.getAllVersionStringByWFIDs4List(result.toString());
String[] allVersionStrArr = allVersionString.split(",");
String[] arr = new String[allVersionStrArr.length];
for (String VersionStr : allVersionStrArr) {
if (!StringUtils.isEmpty(VersionStr)){
arr[i] = "t1.workflowid != " + VersionStr;
i++;
}
}
// 过滤掉空元素
List<String> nonNullElements = Arrays.stream(arr)
.filter(element -> element != null && !element.isEmpty())
.collect(Collectors.toList());
String result = String.join(" AND ", nonNullElements);
if (StringUtils.isEmpty(result)){return "";}
return "(" + result +")";
String resultStr = String.join(" AND ", nonNullElements);
if (StringUtils.isEmpty(resultStr)){return "";}
return "(" + resultStr +")";
}
public int getToDoWorkflowRequestCount4OS(int var1, String[] var2, boolean var3) {
String var4 = " select distinct ";

@ -45,17 +45,26 @@ public class CWGLSocketExecute extends BaseBean implements SocketExecute {
resultMap = getBeanByOAnum(oaTrvlBnsExpnsAcctNo, tableName);
} catch (Exception e) {
e.printStackTrace();
paramMap.put("status","FAIL");
paramMap.put("code","1");
paramMap.put("desc",e.getMessage());
return XMLUtils.CW2XML(paramMap, "1", e.getMessage());
}
try {
userid = getHrmidByWorkCode(apprvrNo);
} catch (Exception e) {
paramMap.put("status","FAIL");
paramMap.put("code","1");
paramMap.put("desc",e.getMessage());
e.printStackTrace();
}
String id = resultMap.get("id");
int requestid = Util.getIntValue(resultMap.get("requestid"));
writeLog("requestid==="+requestid);
if (requestid == 0) {
paramMap.put("status","FAIL");
paramMap.put("code","1");
paramMap.put("desc","流程未找到");
return XMLUtils.CW2XML(paramMap, "1", "流程未找到");
}
// if (userid == 0) {
@ -86,10 +95,17 @@ public class CWGLSocketExecute extends BaseBean implements SocketExecute {
} catch (Exception e) {
e.printStackTrace();
paramMap.put("status","FAIL");
paramMap.put("code","1");
paramMap.put("desc",e.getMessage());
return XMLUtils.CW2XML(paramMap, "1", e.getMessage());
}
paramMap.put("status","COMPLETE");
return XMLUtils.CW2XML(paramMap, "0", "");
} else {
paramMap.put("status","FAIL");
paramMap.put("code","1");
paramMap.put("desc","流程提交失败");
return XMLUtils.CW2XML(paramMap, "1", "流程提交失败");
}
}

@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.api.browser.bean.BrowserValueInfo;
import com.api.browser.service.BrowserValueInfoService;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
@ -11,10 +13,14 @@ import com.engine.tjyh.xc.util.HttpRequestUtil;
import com.engine.tjyh.xc.util.WorkflowCreateHandler;
import okhttp3.*;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.workflow.workflow.WorkflowBillComInfo;
import weaver.workflow.workflow.WorkflowComInfo;
import weaver.workflow.workflow.WorkflowVersion;
import java.io.BufferedReader;
import java.io.IOException;
@ -259,6 +265,13 @@ public class XcCmd extends AbstractCommonCommand<Map<String, Object>> {
writeLog("doHotailOrder----------RefundTotalAmount="+RefundTotalAmount);
writeLog("tgqyy="+tgqyy);
if(jouneryID.contains("-")){
yccsj= jouneryID.split("-")[0];
writeLog("yccsj="+yccsj);
}
Map map = new HashMap();
map.put("tgqlx",tgqlx);
map.put("sqlx",sqlx);
@ -286,10 +299,7 @@ public class XcCmd extends AbstractCommonCommand<Map<String, Object>> {
map.put("jdtpcsfy",Ts(SubcriptionFee));
if(jouneryID.contains("-")){
yccsj= jouneryID.split("-")[0];
writeLog("yccsj="+yccsj);
}
WorkflowCreateHandler handler = new WorkflowCreateHandler();
String tablename = handler.findWorkflowForm(workflowId);
@ -518,6 +528,15 @@ public class XcCmd extends AbstractCommonCommand<Map<String, Object>> {
String requestId = handler.WorkflowCreateByRequestMap(ccr,workflowId,title,IsNextFlow,map);
writeLog("requestid="+requestId);
if(Util.getIntValue(requestId)>1) {
//添加下公文待办分类逻辑
try {
updateLeftTreeInfo(requestId,workflowId);
}catch (Exception e){
}
RecordSet rs = new RecordSet();
rs.execute("select id from " + tablename +" where requestid="+requestId);
rs.next();
@ -735,8 +754,7 @@ public class XcCmd extends AbstractCommonCommand<Map<String, Object>> {
JSONArray SequenceInfoEntityList = passengerInfoObj.getJSONArray("SequenceInfo");
JSONObject SequenceInfoEntity = SequenceInfoEntityList.getJSONObject(0);
JSONArray ChangeInfoEntityList = SequenceInfoEntity.getJSONArray("ChangeInfo");
JSONObject ChangeInfoEntity = ChangeInfoEntityList.getJSONObject(0);
JSONArray TripRecordInfoList = obj.getJSONArray("TripRecordInfoList");
@ -744,6 +762,8 @@ public class XcCmd extends AbstractCommonCommand<Map<String, Object>> {
if("1".equals(tgq)){
JSONArray ChangeInfoEntityList = SequenceInfoEntity.getJSONArray("ChangeInfo");
JSONObject ChangeInfoEntity = ChangeInfoEntityList.getJSONObject(0);
if(ChangeInfoEntity!=null) {
tgqyy = ChangeInfoEntity.getString("RebookResonDesc");
}
@ -753,6 +773,13 @@ public class XcCmd extends AbstractCommonCommand<Map<String, Object>> {
}
}
if(jouneryID.contains("-")){
yccsj= jouneryID.split("-")[0];
writeLog("yccsj="+yccsj);
}
writeLog("tgqyy="+tgqyy);
@ -772,18 +799,25 @@ public class XcCmd extends AbstractCommonCommand<Map<String, Object>> {
double yjpje_2 = Util.getDoubleValue(TripRecordInfoEntity.getString("PrintPrice"))+Util.getDoubleValue(TripRecordInfoEntity.getString("Oil"))+Util.getDoubleValue(TripRecordInfoEntity.getString("Tax"));
double tgqf_2 = Util.getDoubleValue(basicInfo.getString("RefundAmount"))+Util.getDoubleValue(basicInfo.getString("ChangeAmount"));
String CPrintPrice = Util.null2String(ChangeInfoEntity.getString("CPrintPrice"));
String CPrintPrice = "0";
String OilFee="0";
String Tax="0";
if("1".equals(tgq)) {
JSONArray ChangeInfoEntityList = SequenceInfoEntity.getJSONArray("ChangeInfo");
JSONObject ChangeInfoEntity = ChangeInfoEntityList.getJSONObject(0);
CPrintPrice = Util.null2String(ChangeInfoEntity.getString("CPrintPrice"));
if("".equals(CPrintPrice)){
CPrintPrice="0";
}
String OilFee = Util.null2String(ChangeInfoEntity.getString("OilFee"));
if("".equals(OilFee)){
OilFee="0";
}
String Tax = Util.null2String(ChangeInfoEntity.getString("Tax"));
if("".equals(Tax)){
Tax="0";
if ("".equals(CPrintPrice)) {
CPrintPrice = "0";
}
OilFee = Util.null2String(ChangeInfoEntity.getString("OilFee"));
if ("".equals(OilFee)) {
OilFee = "0";
}
Tax = Util.null2String(ChangeInfoEntity.getString("Tax"));
if ("".equals(Tax)) {
Tax = "0";
}
}
String gqjg = dobuleAdd(CPrintPrice,OilFee);
@ -800,11 +834,6 @@ public class XcCmd extends AbstractCommonCommand<Map<String, Object>> {
if(jouneryID.contains("-")){
yccsj= jouneryID.split("-")[0];
writeLog("yccsj="+yccsj);
}
WorkflowCreateHandler handler = new WorkflowCreateHandler();
String tablename = handler.findWorkflowForm(workflowId);
@ -813,6 +842,7 @@ public class XcCmd extends AbstractCommonCommand<Map<String, Object>> {
String IsNextFlow = "1";
String title = handler.bulidWorkflowTitle(workflowId,ccr);
String requestId = handler.WorkflowCreateByRequestMap(ccr,workflowId,title,IsNextFlow,map);
writeLog("requestid="+requestId);
if(Util.getIntValue(requestId)>1) {
RecordSet rs = new RecordSet();
@ -832,6 +862,8 @@ public class XcCmd extends AbstractCommonCommand<Map<String, Object>> {
// 改签明细表 到达地 CACityName ItineraryEntity—FlightOrderInfoEntity—PassengerInfoEntity—SequenceInfoEntity—ChangeInfoEntity
// 改签明细表 "改签后机票金额
// " CPrintPrice ItineraryEntity—FlightOrderInfoEntity—PassengerInfoEntity—SequenceInfoEntity—ChangeInfoEntity
JSONArray ChangeInfoEntityList = SequenceInfoEntity.getJSONArray("ChangeInfo");
JSONObject ChangeInfoEntity = ChangeInfoEntityList.getJSONObject(0);
detailTableName =tablename + "_dt1";
Set set = new HashSet();
List list = new ArrayList();
@ -1113,4 +1145,125 @@ public class XcCmd extends AbstractCommonCommand<Map<String, Object>> {
BigDecimal value2 = new BigDecimal(d2);
return value1.add(value2).toString();
}
//保存自定义左侧树信息到requestbase表
private static void updateLeftTreeInfo(String requestid, String workflowid){
BaseBean baseBean = new BaseBean();
RecordSet rs = new RecordSet();
RecordSet rs1 = new RecordSet();
WorkflowBillComInfo wbInfo = new WorkflowBillComInfo();
WorkflowComInfo wcInfo = new WorkflowComInfo();
int formid = Util.getIntValue(wcInfo.getFormId(workflowid+""));
String tablename = wbInfo.getTablename(formid + "");
String workflowname = wcInfo.getWorkflowname(workflowid + "");
rs.executeQuery("select id,sfzxsw,secondfieldname,thirdfieldname,showname,doingwfids,donewfids,sencondIsGroupbyFieldname from uf_treelistsetting ");
baseBean.writeLog("---LHSP2021----requestid==="+requestid+"----selectSql===="+"select id,sfzxsw,secondfieldname,thirdfieldname,showname from uf_treelistsetting where (','||doingwfids||',' like '%,"+workflowid+",%') or (','||donewfids||',' like '%,"+workflowid+",%')");
while (rs.next()){
String id = rs.getString(1);
int sfzxsw = rs.getInt(2);
String secondfieldname = rs.getString(3);
String thirdfieldname = rs.getString(4);
String showname = rs.getString(5);
String doingwfids1 = Util.null2String(rs.getString(6));
String donewfids1 = Util.null2String(rs.getString(7));
List<String> list = Arrays.asList(doingwfids1.split(","));
List<String> list1 = Arrays.asList(donewfids1.split(","));
HashSet<String> set = new HashSet<>();
set.addAll(WorkflowVersion.getVersionStringByWfid4List(list));
set.addAll(WorkflowVersion.getVersionStringByWfid4List(list1));
if (set.contains(workflowid+"")) {
if (sfzxsw == 1) {
String secondShowName = "";
String secondValue = "";
String secondFieldId = "";
String thirdValue = "";
String thirdFieldType = "";
String thirdFieldDBType = "";
String thirdShowName = "";
rs1.executeQuery("select id from workflow_billfield where fieldname = ? and billid = ?", secondfieldname, formid);
if (rs1.next()) {
secondFieldId = rs1.getString(1);
}
baseBean.writeLog("---LHSP2021----requestid===" + requestid + "----secondFieldId====" + secondFieldId);
rs1.executeQuery("select type,fielddbtype from workflow_billfield where fieldname = ? and billid = ?", thirdfieldname, formid);
if (rs1.next()) {
thirdFieldType = rs1.getString(1);
thirdFieldDBType = rs1.getString(2);
}
baseBean.writeLog("---LHSP2021----requestid===" + requestid + "----thirdFieldType====" + thirdFieldType + "----thirdFieldDBType====" + thirdFieldDBType);
rs1.executeQuery("select " + secondfieldname + "," + thirdfieldname + " from " + tablename + " where requestid = ?", requestid);
baseBean.writeLog("---LHSP2021----requestid===" + requestid + "----selectData====" + "select " + secondfieldname + "," + thirdfieldname + " from " + tablename + " where requestid = " + requestid);
if (rs1.next()) {
secondValue = rs1.getString(1);
thirdValue = rs1.getString(2);
secondShowName = getSelectFieldValue(secondFieldId, secondValue);
List<BrowserValueInfo> browserValueInfo = getBrowserFieldValue(thirdFieldType, thirdValue, thirdFieldDBType);
for (BrowserValueInfo info : browserValueInfo) {
String name = info.getName();
thirdShowName += name + ",";
}
if (thirdShowName.endsWith(",")) {
thirdShowName = thirdShowName.substring(0, thirdShowName.length() - 1);
}
}
baseBean.writeLog("---LHSP2021----requestid===" + requestid + "----updateSql====" + "update workflow_requestbase set firstfloor = " + id + ",firstfloorname = " + showname + ",secondfloor = " + secondValue + ",secondfloorname = " + secondShowName + ",thirdfloor = " + thirdValue + ",thirdfloorname = " + thirdShowName + " where requestid = " + requestid);
rs1.executeUpdate("update workflow_requestbase set firstfloor = ?,firstfloorname = ?,secondfloor = ?,secondfloorname = ?,thirdfloor = ?,thirdfloorname = ? where requestid = ?", id, showname, secondValue, secondShowName, thirdValue, thirdShowName, requestid);
} else {
//qc2126083 除了总行收文分类外,其余所有分类,都要支持二级目录按字段分类,且通过建模字段控制是否分类
String sencondIsGroupbyFieldname = Util.null2String(rs.getString(8));
rs1.writeLog(">>>>>> wangsong requestid="+requestid+" 判断二级目录区分是否按照指定字段分类展示 sencondIsGroupbyFieldname="+sencondIsGroupbyFieldname);
if("0".equals(sencondIsGroupbyFieldname)){//需要按照字段分类展示
String secondShowName = "";
String secondValue = "";
String secondFieldId = "";
rs1.executeQuery("select id from workflow_billfield where fieldname = ? and billid = ?", secondfieldname, formid);
if (rs1.next()) {
secondFieldId = rs1.getString(1);
}
rs1.executeQuery("select * from " + tablename + " where requestid = ?", requestid);
if (rs1.next()) {
secondValue = rs1.getString(secondfieldname);
secondShowName = getSelectFieldValue(secondFieldId, secondValue);
}
rs1.writeLog(">>>>>> wangsong 更新二级目录的字段数据到workflow_requestbase表 secondFieldId="+secondFieldId+",secondValue="+secondValue+",secondShowName="+secondShowName);
rs1.executeUpdate("update workflow_requestbase set firstfloor = ?,firstfloorname = ?,secondfloor = ?,secondfloorname = ? where requestid = ?", id, showname, secondValue, secondShowName, requestid);
}else{
baseBean.writeLog("---LHSP2021----requestid===" + requestid + "----updateSql====" + "update workflow_requestbase set firstfloor = " + id + ",firstfloorname = " + showname + ",secondfloor = " + workflowid + ",secondfloorname = " + workflowname + " where requestid = " + requestid);
rs1.executeUpdate("update workflow_requestbase set firstfloor = ?,firstfloorname = ?,secondfloor = ?,secondfloorname = ? where requestid = ?", id, showname, workflowid + "", workflowname, requestid);
}
}
}
}
}
/**
*
* */
public static String getSelectFieldValue(String fieldId, String selectValue) {
String selectValueName = "";
RecordSet rs = new RecordSet();
String sql = "select selectvalue,selectname from workflow_selectitem where selectvalue = ? and fieldid=? and (cancel<>'1' or cancel is null) order by listorder,selectvalue";
rs.executeQuery(sql,selectValue, fieldId);
if (rs.next()) {
selectValueName = Util.null2String(rs.getString("selectname"));
}
return selectValueName;
}
/**
*
* */
public static List<BrowserValueInfo> getBrowserFieldValue(String fieldType, String fieldValue, String fieldDbType) {
BrowserValueInfoService browserValueInfoService = new BrowserValueInfoService();
List <BrowserValueInfo> result = new ArrayList<>();
try {
result= browserValueInfoService.getBrowserValueInfo(fieldType, fieldDbType, 0, fieldValue, 7, "", "");
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}

@ -0,0 +1,81 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="net.sf.json.JSONObject"%>
<%@ page import="net.sf.json.JSONArray"%>
<%@ page import="weaver.general.*" %>
<%@ page import="weaver.conn.RecordSet" %>
<%
String action = Util.null2String(request.getParameter("action"));
if("getSlideImages".equalsIgnoreCase(action)){// 获取幻灯片图片
JSONArray datas = new JSONArray();
// 处理屏幕宽度
int screenWidth = Util.getIntValue(request.getParameter("innerWidth"));
// int userid = Util.getIntValue(request.getParameter("userid"));
// String catalogid = Util.null2String(request.getParameter("catalogid"));
// int counts = Util.getIntValue(request.getParameter("counts"));
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_yddsylbt order by sx");
while (rs.next()){
if (screenWidth < 600){
JSONObject data = new JSONObject();
data.put("action", rs.getString("tpdjlj"));
data.put("pic_path", rs.getString("tpdzzc"));
// data.put("pic_desc", rs.getString("id"));
data.put("pic_desc", "");
datas.add(data);
}else {
JSONObject data = new JSONObject();
data.put("action", rs.getString("tpdjlj"));
data.put("pic_path", rs.getString("tpdzzd"));
// data.put("pic_desc", rs.getString("id"));
data.put("pic_desc", "");
datas.add(data);
}
}
// if (screenWidth < 600) {
// data.put("action", "");
// data.put("pic_path", "/mobilemode/upload/images/961bd94784144f26b35abdae955a3ac4.jpg");
// data.put("pic_desc", "");
// datas.add(data);
// data = new JSONObject();
// data.put("action", "");
// data.put("pic_path", "/mobilemode/upload/images/3b8c7ab1ae4f4a72a68cfc272a5fa173.jpg");
// data.put("pic_desc", "");
// datas.add(data);
// data = new JSONObject();
// data.put("action", "");
// data.put("pic_path", "/mobilemode/upload/images/28108cf70aa1429ea95c18f1c78e9e8b.jpg");
// data.put("pic_desc", "");
// datas.add(data);
// data = new JSONObject();
// data.put("action", "");
// data.put("pic_path", "/mobilemode/upload/images/9b0067f0be064235a41a872837f6b5c2.jpg");
// data.put("pic_desc", "");
// datas.add(data);
// data = new JSONObject();
// data.put("action", "");
// data.put("pic_path", "/mobilemode/upload/images/ab9301e55aec47eaa087c0b02a499112.jpg");
// data.put("pic_desc", "");
// datas.add(data);
// }else {
// data = new JSONObject();
// data.put("action", "");
// data.put("pic_path", "/mobilemode/upload/images/9b0067f0be064235a41a872837f6b5c2.jpg");
// data.put("pic_desc", "");
// datas.add(data);
// data = new JSONObject();
// data.put("action", "");
// data.put("pic_path", "/mobilemode/upload/images/ab9301e55aec47eaa087c0b02a499112.jpg");
// data.put("pic_desc", "");
// datas.add(data);
// }
/************** 模拟数据 *****************/
out.print(datas.toString());
}
%>

@ -0,0 +1,256 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="net.sf.json.JSONObject"%>
<%@ page import="net.sf.json.JSONArray"%>
<%@ page import="java.util.*" %>
<%@ page import="weaver.general.*" %>
<%@ page import="java.io.IOException"%>
<%@ page import="weaver.common.DateUtil"%>
<%@ page import="weaver.conn.RecordSet"%>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="WorkflowService" class="weaver.mobile.webservices.workflow.WorkflowServiceImpl" scope="page" />
<jsp:useBean id="DocGetListService" class="weaver.document.seconddev.api.DocGetListService" scope="page" />
<jsp:useBean id="DocCountInfo" class="weaver.docs.docs.util.DocCountInfo" scope="page" />
<%--
天一建设移动门户
访问路径:
/mobilemode/apps/QC708794/action.jsp?action=***
幻灯片路径:
/mobilemode/apps/QC708794/action.jsp?action=getSlideImages&userid={curruser}&catalogid=1,2,3&counts=3
-- created by cdh 2019/10/25
--%>
<%
String action = Util.null2String(request.getParameter("action"));
if("getSlideImages".equalsIgnoreCase(action)){// 获取幻灯片图片
JSONArray datas = new JSONArray();
int userid = Util.getIntValue(request.getParameter("userid"));
String catalogid = Util.null2String(request.getParameter("catalogid"));
int counts = Util.getIntValue(request.getParameter("counts"));
// rs.writeLog("【Debug】/mobilemode/apps/QC708794/action.jsp >>>>> [userid:"+userid+", catalogid:"+catalogid+", counts:"+counts+"]");
List<Map<String , String>> resultList = DocGetListService.getDocInfo(userid, catalogid, counts);
if(resultList.size() == 0){
JSONObject data = new JSONObject();
data.put("action", "");
data.put("pic_path", "/mobilemode/images/mec/pic-icon_wev8.png");
data.put("pic_desc", "");
datas.add(data);
}else{
for(int i=0; i<resultList.size(); i++){
Map<String , String> resultMap = resultList.get(i);
String docid = resultMap.get("docid");
String pic_path = Util.null2String(resultMap.get("pic_path"));
if("".equals(pic_path)){
continue;
}else{
pic_path += "&mobileCompress=1";
}
JSONObject data = new JSONObject();
//data.put("action", "openDocdetail("+docid+");");
data.put("action","/spa/document/static4mobile/index.html#/news/1664378919/doc/"+docid);
data.put("pic_path", pic_path);
data.put("pic_desc", "");
datas.add(data);
}
}
/************** 模拟数据 ****************
JSONObject data = new JSONObject();
data.put("action", "openDocdetail(872093);");
data.put("pic_path", "/mobilemode/apps/QC708794/images/b1.png");
data.put("pic_desc", "");
datas.add(data);
data = new JSONObject();
data.put("action", "openDocdetail(872093);");
data.put("pic_path", "/mobilemode/apps/QC708794/images/b2.png");
data.put("pic_desc", "");
datas.add(data);
data = new JSONObject();
data.put("action", "openDocdetail(872093);");
data.put("pic_path", "/mobilemode/apps/QC708794/images/b3.png");
data.put("pic_desc", "");
datas.add(data);
data = new JSONObject();
data.put("action", "");
data.put("pic_path", "/mobilemode/images/mec/pic-icon_wev8.png");
data.put("pic_desc", "");
datas.add(data);
*/
/************** 模拟数据 *****************/
out.print(datas.toString());
}else if("getWorkflowTodoCount".equalsIgnoreCase(action)){// 获取待办流程数量
JSONObject resultObj = new JSONObject();
try {
int userid = Util.getIntValue(request.getParameter("userid"));
String showCopy = Util.null2String(request.getParameter("showCopy"));
String showFlag = Util.null2String(request.getParameter("showFlag"));
String[] conditions = new String[]{};
boolean hasShowCopy = "1".equals(showCopy) ? true : false;// 包含抄送
boolean belongtoshowFlag = "1".equals(showFlag) ? true : false;// 多账号
int counts = WorkflowService.getToDoWorkflowRequestCount(userid, hasShowCopy, conditions, belongtoshowFlag);
resultObj.put("counts", counts);
resultObj.put("status", "1");
} catch (Exception ex) {
ex.printStackTrace();
resultObj.put("status", "-1");
resultObj.put("errMsg", ex.getMessage());
}finally{
try{
out.print(resultObj.toString());
out.flush();
}catch(IOException ex){
ex.printStackTrace();
}
}
}else if("getDocIsnewCount".equalsIgnoreCase(action)){// 获取指定文档目录文档未读数
JSONObject resultObj = new JSONObject();
try {
int userid = Util.getIntValue(request.getParameter("userid"));
String catalogid = Util.null2String(request.getParameter("catalogid"));
// rs.writeLog("【Debug】/mobilemode/apps/QC708794/action.jsp >>>>> [userid:"+userid+", catalogid:"+catalogid+"]");
int counts = DocCountInfo.getDocNotReadNums(catalogid, userid);
resultObj.put("counts", counts);
resultObj.put("status", "1");
} catch (Exception ex) {
ex.printStackTrace();
resultObj.put("status", "-1");
resultObj.put("errMsg", ex.getMessage());
}finally{
try{
out.print(resultObj.toString());
out.flush();
}catch(IOException ex){
ex.printStackTrace();
}
}
}else if("getWorkflowListData".equalsIgnoreCase(action)){// 获取流程列表数据
JSONObject resultObj = new JSONObject();
try {
int pageNo = Util.getIntValue(request.getParameter("pageNo"), 1);// 分页当前页码
int pageSize = Util.getIntValue(request.getParameter("pageSize"), 10);// 分页每页条数
String searchKey = Util.null2String(request.getParameter("searchKey"));// 搜索条件(流程标题)
String timestamp = Util.null2String(request.getParameter("timestamp"));// 时间戳
String userid = Util.null2String(request.getParameter("userid"));// 当前用户
String wftypeid = Util.null2String(request.getParameter("wftypeid"));// 流程分类id
/**/
rs.writeLog("【debug】/mobilemode/apps/QC708794/action.jsp getWorkflowListData >>>>> [pageNo:"+pageNo+", pageSize:"+pageSize+", searchKey:"+searchKey
+", userid:"+userid+", wftypeid:"+wftypeid+",timestamp:"+timestamp+"]");
int totalSize = 0;
JSONArray dataArray = new JSONArray();
/************** 模拟数据 *****************/
totalSize = 4;
JSONObject dataObj = new JSONObject();
dataObj.put("requestid", "1");
dataObj.put("workflowid", "1");
dataObj.put("workflowname", "[出差审批流程]");
dataObj.put("wftitle", "出差审批流程-系统管理员-2019-02-18出差地点北京");
dataObj.put("creator", "系统管理员");
dataObj.put("createdate", "2019-02-18");
dataObj.put("createtime", "17:48:04");
dataObj.put("receivedate", "2019-02-18");
dataObj.put("receivetime", "17:48:04");
dataObj.put("isnew", "1");
dataArray.add(dataObj);
dataObj = new JSONObject();
dataObj.put("requestid", "2");
dataObj.put("workflowid", "2");
dataObj.put("workflowname", "[部门发文申请]");
dataObj.put("wftitle", "部门发文申请-系统管理员-2019-02-19");
dataObj.put("creator", "系统管理员");
dataObj.put("createdate", "2019-02-19");
dataObj.put("createtime", "15:50:04");
dataObj.put("receivedate", "2019-02-19");
dataObj.put("receivetime", "15:50:04");
dataObj.put("isnew", "1");
dataArray.add(dataObj);
dataObj = new JSONObject();
dataObj.put("requestid", "3");
dataObj.put("workflowid", "3");
dataObj.put("workflowname", "[系统提醒工作流]");
dataObj.put("wftitle", "License授权到期提醒");
dataObj.put("creator", "系统管理员");
dataObj.put("createdate", "2019-10-18");
dataObj.put("createtime", "16:49:04");
dataObj.put("receivedate", "2019-10-18");
dataObj.put("receivetime", "16:49:04");
dataObj.put("isnew", "0");
dataArray.add(dataObj);
dataObj = new JSONObject();
dataObj.put("requestid", "4");
dataObj.put("workflowid", "4");
dataObj.put("workflowname", "[用车申请]");
dataObj.put("wftitle", "用车申请-系统管理员-2019-01-28");
dataObj.put("creator", "系统管理员");
dataObj.put("createdate", "2019-01-28");
dataObj.put("createtime", "16:47:04");
dataObj.put("receivedate", "2019-01-28");
dataObj.put("receivetime", "16:47:04");
dataObj.put("isnew", "1");
dataArray.add(dataObj);
/************** 模拟数据 *****************/
resultObj.put("totalSize", totalSize);
resultObj.put("datas", dataArray);
resultObj.put("status", "1");
} catch (Exception ex) {
ex.printStackTrace();
rs.writeLog(ex);
rs.writeLog("【debug】/mobilemode/apps/QC708794/action.jsp getWorkflowListData error:"+ex.getMessage());
resultObj.put("status", "-1");
resultObj.put("totalSize", "0");
resultObj.put("errMsg", ex.getMessage());
}finally{
try{
// rs.writeLog("【debug】QC708794 getWorkflowListData finally resultObj:"+resultObj.toString());
out.print(resultObj.toString());
out.flush();
}catch(Exception ex){
ex.printStackTrace();
rs.writeLog(ex);
rs.writeLog("【debug】/mobilemode/apps/QC708794/action.jsp getWorkflowListData finally error:"+ex.getMessage());
}
}
}else if("getWorkflowTodoCountByType".equalsIgnoreCase(action)){// 获取流程大类下的待办数量
JSONObject resultObj = new JSONObject();
try {
int userid = Util.getIntValue(request.getParameter("userid"));
String wftypeid = Util.null2String(request.getParameter("wftypeid"));// 流程分类id
// rs.writeLog("【Debug】/mobilemode/apps/QC708794/action.jsp >>>>> [userid:"+userid+", wftypeid:"+wftypeid+"]");
resultObj.put("counts", 33);
resultObj.put("status", "1");
} catch (Exception ex) {
ex.printStackTrace();
resultObj.put("status", "-1");
resultObj.put("errMsg", ex.getMessage());
}finally{
try{
out.print(resultObj.toString());
out.flush();
}catch(IOException ex){
ex.printStackTrace();
}
}
}
%>

@ -0,0 +1,124 @@
<%@ page import="com.engine.custom.sl.entity.EsbRequestHeader" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="com.engine.custom.sl.entity.TravelToEsbBean" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="com.engine.util.SocketClientUtil" %>
<%@ page import="com.engine.util.XMLUtils" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="java.net.Socket" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
//公司业务查询待办数接口
// Map<String, Object> param = ParamUtil.request2Map(request);
// String workCode = param.get("workCode").toString();
String workCode = HrmUserVarify.getUser(request, response).getLoginid();
String timeStr = generateTimestamp();
EsbRequestHeader esbRequestHeader = new EsbRequestHeader();
esbRequestHeader.setService_sn(timeStr+workCode);
esbRequestHeader.setSystem_id("2036");
esbRequestHeader.setRequester_id("0258");
esbRequestHeader.setBranch_id("queryUndoCount");
esbRequestHeader.setChannel_id("19");
esbRequestHeader.setService_time(timeStr);
esbRequestHeader.setNeed_request("");
esbRequestHeader.setSvcCd("50013N003");
esbRequestHeader.setSvcScn("19");
String bnkSrlNo = esbRequestHeader.getRequester_id() + timeStr + workCode;
esbRequestHeader.setBnkSrlNo(bnkSrlNo);
esbRequestHeader.setFileFlg("0");
String Service_Body = "<Service_Body><request><employeeNo>"+workCode+"</employeeNo></request></Service_Body>" ;
String Service_Header = TravelToEsbBean.convertObjectToXml(esbRequestHeader,"Service_Header");
String serviceXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Service>";
// out.print("UTF_8_serviceXML==="+ serviceXML);
serviceXML = serviceXML + Service_Header + Service_Body;
serviceXML = serviceXML + "</Service>";
// out.print("UTF_8_serviceXML==="+ serviceXML);
String length = String.format("%08d", serviceXML.length());
serviceXML = length + serviceXML;
serviceXML = new String(serviceXML.getBytes(StandardCharsets.UTF_8));
String send = "";
try {
send = send(serviceXML);
// out.print("返回=="+send);
}catch (Exception e){
// out.print("异常=="+ e.getMessage());
}
// SocketClientUtil scketClient = new SocketClientUtil("14.1.76.116",10149);
// String substring = send.substring(0, 8);
// String substring1 = send.substring(8);
// out.print(substring);
Map<String, String> map = XMLUtils.parseXMLToMap(send);
JSONObject jsonObject = new JSONObject();
jsonObject.put("count", Util.getIntValue(map.get("todoCount")));
out.print(jsonObject.toJSONString());
%>
<%!
public String send(String request) throws Exception {
// bs.writeLog("Client Start...");
BaseBean bs = new BaseBean();
Socket socket = null;
try {
//创建一个流套接字并将其连接到指定主机上的指定端口号
socket = new Socket("14.1.71.90",10149);
// String str = "00000612<?xml version=\"1.0\" encoding=\"UTF-8\"?><Service><Service_Header><service_sn>1010157060000081243</service_sn><system_id>0258</system_id><requester_id>0157</requester_id><branch_id>010231100</branch_id><channel_id>01</channel_id><service_time>20230905104426</service_time><need_request>true</need_request><SvcCd>500130004</SvcCd><SvcScn>13</SvcScn><BnkSrlNo>015720230905060000081243</BnkSrlNo><FileFlg>0</FileFlg></Service_Header><Service_Body><request><path>todo</path><method>getCount</method><args><entry><key>userNum</key><value>10913026任广鹏是个大刷币</value></entry></args></request></Service_Body></Service>";
// System.out.println(str);
//读取服务器端数据
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8));
//向服务器端发送数据
// PrintStream out = new PrintStream(new OutputStreamWriter(socket.getOutputStream(),StandardCharsets.UTF_8));
PrintWriter out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream(),StandardCharsets.UTF_8),true);
out.println(request);
char[] datalen=new char[8];//报文前八位为报文体总长度
input.read(datalen,0,8);
String lendata=new String (datalen);
int length=Integer.parseInt(lendata);
new BaseBean().writeLog("报文长度"+length);
char[] data=new char[length];
int datalength = input.read(data,0,length);
String requestData = new String(data);
new BaseBean().writeLog("requestData",requestData);
// String ret = input.readLine();
System.out.println("服务器端返回过来的是: " + requestData);
bs.writeLog("服务器端返回过来的是: " + requestData);
// 如接收到 "OK" 则断开连接
if (!StringUtil.isEmpty(requestData)) {
bs.writeLog("客户端将关闭连接");
System.out.println("客户端将关闭连接: " + requestData);
Thread.sleep(500);
}
out.close();
input.close();
return requestData;
} catch (Exception e) {
bs.writeLog("客户端异常:" + e.getMessage());
throw e;
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
socket = null;
bs.writeLog("客户端 finally 异常:" + e.getMessage());
}
}
}
// return "-1";
}
public static String generateTimestamp() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date currentDate = new Date();
return dateFormat.format(currentDate);
}
%>

@ -0,0 +1,124 @@
<%@ page import="com.engine.custom.sl.entity.EsbRequestHeader" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="com.engine.custom.sl.entity.TravelToEsbBean" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="com.engine.util.SocketClientUtil" %>
<%@ page import="com.engine.util.XMLUtils" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="java.net.Socket" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
//同业系统查询待办数接口
// Map<String, Object> param = ParamUtil.request2Map(request);
// String workCode = param.get("workCode").toString();
String workCode = HrmUserVarify.getUser(request, response).getLoginid();
String timeStr = generateTimestamp();
EsbRequestHeader esbRequestHeader = new EsbRequestHeader();
esbRequestHeader.setService_sn(timeStr+workCode);
esbRequestHeader.setSystem_id("0227");
esbRequestHeader.setRequester_id("0258");
esbRequestHeader.setBranch_id("20000");
esbRequestHeader.setChannel_id("09");
esbRequestHeader.setService_time(timeStr);
esbRequestHeader.setNeed_request("");
esbRequestHeader.setSvcCd("500130004");
esbRequestHeader.setSvcScn("09");
String bnkSrlNo = esbRequestHeader.getRequester_id() + timeStr + workCode;
esbRequestHeader.setBnkSrlNo(bnkSrlNo);
esbRequestHeader.setFileFlg("0");
String Service_Body = "<Service_Body><request><path>todo</path><method>getCount</method><args><entry><key>userNum</key><value>"+workCode+"</value></entry></args></request></Service_Body>" ;
String Service_Header = TravelToEsbBean.convertObjectToXml(esbRequestHeader,"Service_Header");
String serviceXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Service>";
// out.print("UTF_8_serviceXML==="+ serviceXML);
serviceXML = serviceXML + Service_Header + Service_Body;
serviceXML = serviceXML + "</Service>";
// out.print("UTF_8_serviceXML==="+ serviceXML);
String length = String.format("%08d", serviceXML.length());
serviceXML = length + serviceXML;
serviceXML = new String(serviceXML.getBytes(StandardCharsets.UTF_8));
String send = "";
try {
send = send(serviceXML);
// out.print("返回=="+send);
}catch (Exception e){
// out.print("异常=="+ e.getMessage());
}
// SocketClientUtil scketClient = new SocketClientUtil("14.1.76.116",10149);
// String substring = send.substring(0, 8);
// String substring1 = send.substring(8);
// out.print(substring);
Map<String, String> map = XMLUtils.parseXMLToMap(send);
JSONObject jsonObject = new JSONObject();
jsonObject.put("count", Util.getIntValue(map.get("count")));
out.print(jsonObject.toJSONString());
%>
<%!
public String send(String request) throws Exception {
// bs.writeLog("Client Start...");
BaseBean bs = new BaseBean();
Socket socket = null;
try {
//创建一个流套接字并将其连接到指定主机上的指定端口号
socket = new Socket("14.1.71.90",10149);
// String str = "00000612<?xml version=\"1.0\" encoding=\"UTF-8\"?><Service><Service_Header><service_sn>1010157060000081243</service_sn><system_id>0258</system_id><requester_id>0157</requester_id><branch_id>010231100</branch_id><channel_id>01</channel_id><service_time>20230905104426</service_time><need_request>true</need_request><SvcCd>500130004</SvcCd><SvcScn>13</SvcScn><BnkSrlNo>015720230905060000081243</BnkSrlNo><FileFlg>0</FileFlg></Service_Header><Service_Body><request><path>todo</path><method>getCount</method><args><entry><key>userNum</key><value>10913026任广鹏是个大刷币</value></entry></args></request></Service_Body></Service>";
// System.out.println(str);
//读取服务器端数据
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8));
//向服务器端发送数据
// PrintStream out = new PrintStream(new OutputStreamWriter(socket.getOutputStream(),StandardCharsets.UTF_8));
PrintWriter out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream(),StandardCharsets.UTF_8),true);
out.println(request);
char[] datalen=new char[8];//报文前八位为报文体总长度
input.read(datalen,0,8);
String lendata=new String (datalen);
int length=Integer.parseInt(lendata);
new BaseBean().writeLog("报文长度"+length);
char[] data=new char[length];
int datalength = input.read(data,0,length);
String requestData = new String(data);
new BaseBean().writeLog("requestData",requestData);
// String ret = input.readLine();
System.out.println("服务器端返回过来的是: " + requestData);
bs.writeLog("服务器端返回过来的是: " + requestData);
// 如接收到 "OK" 则断开连接
if (!StringUtil.isEmpty(requestData)) {
bs.writeLog("客户端将关闭连接");
System.out.println("客户端将关闭连接: " + requestData);
Thread.sleep(500);
}
out.close();
input.close();
return requestData;
} catch (Exception e) {
bs.writeLog("客户端异常:" + e.getMessage());
throw e;
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
socket = null;
bs.writeLog("客户端 finally 异常:" + e.getMessage());
}
}
}
// return "-1";
}
public static String generateTimestamp() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date currentDate = new Date();
return dateFormat.format(currentDate);
}
%>

@ -22,7 +22,7 @@ public class Action20230918061401 extends BaseBean implements Action {
public String execute(RequestInfo request) {
try {
String insertsql = "INSERT INTO uf_tohgLog(REQUEST, CONTENT, ZT, ML, DDSJ, TSSJ, FJML, ZWID, FJID) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )";
String insertsql = "INSERT INTO uf_tosjLog(REQUEST, CONTENT, ZT, ML, DDSJ, TSSJ, FJML, ZWID, FJID) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )";
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
//公文标题
String requestname = request.getRequestManager().getRequestname();
@ -60,7 +60,9 @@ public class Action20230918061401 extends BaseBean implements Action {
departmentNames = "天津银行股份有限公司-"+departmentNames;
String context = "";
String flag = "|";
context = requestname + flag + fwwh + flag +departmentNames + flag + cwrq +flag+ user.getLoginid()+flag+user.getLastname()+flag;
// context = requestname + flag + fwwh + flag +departmentNames + flag + cwrq +flag+ user.getLoginid()+flag+user.getLastname()+flag;
context = fwwh + flag + departmentNames + flag + cwrq + flag + user.getLastname();
//获取文件命
Map<String, String> fjName = getIdIMIDName(fj);
Map<String, String> zwName = getIdIMIDName(zw);
@ -105,7 +107,8 @@ public class Action20230918061401 extends BaseBean implements Action {
if (zwStr.startsWith("&&")){
zwStr = zwStr.substring(2);
}
context = context+zwStr+flag+fjStr+flag+requestId+flag;
// context = context+zwStr+flag+fjStr+flag+requestId+flag;
context = zwStr+flag+fjStr+flag+context+flag+"sj"+requestId+flag;
Date date = new Date();
String time = new SimpleDateFormat("yyyy-MM-dd hh:mm").format(date);
rs.executeUpdate(insertsql,requestId,context,0,null,time,null,null,zw,fj);

@ -9,6 +9,8 @@ import com.engine.util.XMLUtils;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import com.weaver.general.Util;
import org.jsoup.Jsoup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import weaver.conn.RecordSet;
import weaver.file.ImageFileManager;
import weaver.general.StringUtil;
@ -27,10 +29,14 @@ import java.util.*;
* (
*
*/
public class Action20231015024217 extends BaseBean implements Action {
public class Action20231015024217 implements Action {
/**
* After selecting aciton after the process path node, this method will be executed after the node is submitted.
*/
Logger log = LoggerFactory.getLogger("CustomBusiness");
@Override
public String execute(RequestInfo request) {
writeLog("推送商旅节点后附加操作====>");
@ -101,6 +107,10 @@ public class Action20231015024217 extends BaseBean implements Action {
return Action.SUCCESS;
}
private void writeLog(String s) {
log.info(s);
}
private void fileToEsb(TravelToEsbBean toEsbBean, String requestId) throws Exception {
// HashMap<String, String> filePathMap = new HashMap<>();
List<acsryItem> acsryArray = toEsbBean.getAcsryArray();
@ -198,6 +208,12 @@ public class Action20231015024217 extends BaseBean implements Action {
toEsbBean.setExpnsRsn(text);
//备注
toEsbBean.setRemark(Util.null2String(rs.getString("bz")));
//条线部门
toEsbBean.setSrtpLnDeptCode(Util.null2String(rs.getString("txbm")));
toEsbBean.setSrtpLnDeptName(Util.null2String(rs.getString("txbmmc")));
fj = Util.null2String(rs.getString("fj"));
spdfj = Util.null2String(rs.getString("spdfj"));
spwhscpdfwj = Util.null2String(rs.getString("clspdpdffj"));

@ -0,0 +1,387 @@
package weaver.interfaces.workflow.action.javacode;
import com.dcfs.fts.common.error.FtpException;
import com.engine.custom.hg.util.HgUtils;
import com.engine.custom.sl.entity.*;
// import com.engine.util.SocketClientUtil;
import com.engine.util.SocketClientUtil;
import com.engine.util.XMLUtils;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import com.weaver.general.Util;
import org.jsoup.Jsoup;
import weaver.conn.RecordSet;
import weaver.file.ImageFileManager;
import weaver.general.StringUtil;
import weaver.hrm.User;
import weaver.interfaces.workflow.action.Action;
import weaver.general.BaseBean;
import weaver.soa.workflow.request.RequestInfo;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* (
*
*/
public class Action20240828044115 extends BaseBean implements Action {
/**
* After selecting aciton after the process path node, this method will be executed after the node is submitted.
*/
@Override
public String execute(RequestInfo request) {
writeLog("推送商旅节点后附加操作====>");
// if(error) {
// request.getRequestManager().setMessageid("90001");
// request.getRequestManager().setMessagecontent("System Abnormal Termination Process Submission");
// }
String requestId = request.getRequestid();
String tablename = request.getRequestManager().getBillTableName();
TravelToEsbBean toEsbBean = new TravelToEsbBean();
//封装主表数据
RecordSet rs = new RecordSet();
String mainId = setMainForm(requestId, tablename, rs, toEsbBean);
writeLog("toEsbBean1====>"+toEsbBean);
writeLog("上传附件到ESB服务器====>");
try {
fileToEsb(toEsbBean,requestId);
} catch (Exception e) {
request.getRequestManager().setMessageid("10001");
request.getRequestManager().setMessagecontent(e.getMessage());
return Action.FAILURE_AND_CONTINUE;
}
setFormDt1(mainId,tablename,rs,toEsbBean);
writeLog("toEsbBean2====>"+toEsbBean);
setFormDt2(mainId,tablename,rs,toEsbBean);
writeLog("toEsbBean3====>"+toEsbBean);
String Service_Body = "<Service_Body><request>"+ toEsbBean.toXMLString()+"</request></Service_Body>" ;
writeLog("toEsbBean4====>"+Service_Body);
try{
EsbRequestHeader esbRequestHeader = new EsbRequestHeader(Util.getIntValue(mainId));
writeLog("esbRequestHeader====>"+esbRequestHeader);
String Service_Header = TravelToEsbBean.convertObjectToXml(esbRequestHeader,"Service_Header");
writeLog("esbRequestHeaderXML====>"+Service_Header);
String serviceXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Service>";
serviceXML = serviceXML + Service_Header + Service_Body;
serviceXML = serviceXML + "</Service>";
writeLog("esbRequestHeaderXML====>"+serviceXML);
int byteArray = serviceXML.getBytes("UTF-8").length;
// Calculate the length of the byte array
// int bytelength = byteArray.length;
String length = String.format("%08d", byteArray);
writeLog("XMLlength"+ length);
serviceXML = length + serviceXML;
writeLog("serviceXML==="+ serviceXML);
// serviceXML = new String(serviceXML.getBytes(StandardCharsets.UTF_8));
writeLog("UTF_8_serviceXML==="+ serviceXML);
SocketClientUtil scketClient = new SocketClientUtil("14.1.78.197",10149);
String send = scketClient.send(serviceXML);
String substring = send.substring(0, 8);
String substring1 = send.substring(8);
Map<String, String> map = XMLUtils.parseXMLToMap(substring1);
String retCd = map.get("retCd");
String retCdDsc = map.get("retCdDsc");
if ("9999".equals(retCd)){
request.getRequestManager().setMessageid("9999");
request.getRequestManager().setMessagecontent(retCdDsc);
return Action.FAILURE_AND_CONTINUE;
}
}catch (Exception e){
e.printStackTrace();
writeLog("构建XML异常"+e.getMessage());
request.getRequestManager().setMessageid("10001");
request.getRequestManager().setMessagecontent(e.getMessage());
return Action.FAILURE_AND_CONTINUE;
}
// setFormDt1();
return Action.SUCCESS;
}
private void fileToEsb(TravelToEsbBean toEsbBean, String requestId) throws Exception {
// HashMap<String, String> filePathMap = new HashMap<>();
List<acsryItem> acsryArray = toEsbBean.getAcsryArray();
for (acsryItem acsryItem : acsryArray) {
String acsryNm = acsryItem.getAcsryNm();
writeLog("acsryNm"+acsryNm);
ImageFileManager ifm = new ImageFileManager();
ifm.getImageFileInfoById(Util.getIntValue(acsryNm,0));
InputStream inputStream = ifm.getInputStream();
String imageFileName = ifm.getImageFileName();
writeLog("imageFileName"+imageFileName);
String[] filename = imageFileName.split("\\.");
int lastIndex = imageFileName.lastIndexOf('.');
String part1 = "";
String part2 = "";
if (lastIndex != -1) {
part1 = imageFileName.substring(0, lastIndex);
part2 = imageFileName.substring(lastIndex + 1);
}else {
part1 = imageFileName;
}
if(part1.length()<=3){
part1 = part1+"文件";
}
String tempFilePath = "";
try {
File tempFile = File.createTempFile(part1,part2.length() == 0 ? "" :part2);
// 创建一个输出流,将数据写入临时文件
OutputStream outputStream = new FileOutputStream(tempFile);
// 将输入流中的数据复制到输出流(即临时文件)
byte[] buffer = new byte[2048];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
tempFilePath = tempFile.getAbsolutePath();
writeLog( "临时文件位置"+tempFilePath);
// 关闭输入流和输出流
inputStream.close();
outputStream.close();
}catch (Exception e){
e.printStackTrace();
writeLog( "创建本地文件异常"+e.getMessage());
throw new Exception("创建"+imageFileName+"文件异常"+e.getMessage());
}
//推送ESB服务器
String ftpPath = "";
try {
ftpPath = HgUtils.putFile(tempFilePath, requestId + File.separator + imageFileName);
} catch (FtpException e) {
e.printStackTrace();
writeLog( "传输ESBftp异常"+e.getMessage());
throw new Exception("传输ESBftp异常");
} catch (IOException e) {
e.printStackTrace();
writeLog( "传输ESBIO异常"+e.getMessage());
throw new Exception("传输ESBftp异常");
}
acsryItem.setAcsryNm(imageFileName);
acsryItem.setSavePath(ftpPath);
}
}
private String setMainForm(String requestId, String tablename, RecordSet rs ,TravelToEsbBean toEsbBean) {
rs.execute("select * from " + tablename + " where requestid = " + requestId);
String mainid = "";
String fj = "";
String spdfj = "";
String spwhscpdfwj = "";
String qxspdpdffj = "";
String tjyxgnccspdfjpdf = "";
//表单数据
if (rs.next()) {
mainid = rs.getString("id");
//OA差旅报销单单据编号
toEsbBean.setOaTrvlBnsExpnsAcctNo(rs.getString(Util.null2String("djbh")));
//经办人工号
toEsbBean.setOperatorNo(processString(Util.null2String(rs.getString("jbrgh"))));
//经办人姓名 id
toEsbBean.setOperatorName(Util.null2String(rs.getString("jbrxm")));
String lastname = new User(Util.getIntValue(toEsbBean.getOperatorName())).getLastname();
toEsbBean.setOperatorName(lastname);
//附件张数
toEsbBean.setAcsryNums(Util.null2String(rs.getString("fjzs")));
toEsbBean.setCostDeptCode((Util.null2String(rs.getString("cbzxbm"))));
//报销金额
toEsbBean.setExpnsAmt(multiply100(Util.null2String(rs.getString("bxjedwf"))));
//报销事由 Jsoup.parse(htmlContent).text()
String expnsRsn = Util.null2String(rs.getString("bxsy"));
String text = Jsoup.parse(expnsRsn).text();
toEsbBean.setExpnsRsn(text);
//备注
toEsbBean.setRemark(Util.null2String(rs.getString("bz")));
//条线部门
toEsbBean.setSrtpLnDeptCode(Util.null2String(rs.getString("txbm")));
toEsbBean.setSrtpLnDeptName(Util.null2String(rs.getString("txbmmc")));
fj = Util.null2String(rs.getString("fj"));
spdfj = Util.null2String(rs.getString("spdfj"));
spwhscpdfwj = Util.null2String(rs.getString("clspdpdffj"));
qxspdpdffj = Util.null2String(rs.getString("qxspdpdffj"));
tjyxgnccspdfjpdf = Util.null2String(rs.getString("tjyxgnccspdfjpdf"));
// String formData = rs.getString("formData");
}
// 封装文件数组
//现在是id
List<String> fjids;
if(!StringUtil.isEmpty(fj)){
fjids = new ArrayList<>( Arrays.asList(fj.split(",")));
}else {
fjids = new ArrayList<>();
}
//
writeLog("fjids"+fjids);
try {
if (!StringUtil.isEmpty(spdfj)){
fjids.add(spdfj);
}
if (!StringUtil.isEmpty(spwhscpdfwj)){
fjids.add(spwhscpdfwj);
}
if (!StringUtil.isEmpty(qxspdpdffj)){
fjids.add(qxspdpdffj);
}
if (!StringUtil.isEmpty(tjyxgnccspdfjpdf)){
fjids.add(tjyxgnccspdfjpdf);
}
ArrayList<acsryItem> acsryArray = new ArrayList<>();
for (String fjid : fjids) {
acsryItem acsryItem = new acsryItem();
acsryItem.setAcsryNm(getimgid(fjid,rs));
acsryArray.add(acsryItem);
}
toEsbBean.setAcsryArray(acsryArray);
//重新设置下附件张数为数组长度
toEsbBean.setAcsryNums(acsryArray.size()+"");
}catch (Exception e){
e.printStackTrace();
writeLog("fjidsException"+e);
}
return mainid;
}
private void setFormDt1(String mainid, String tablename, RecordSet rs , TravelToEsbBean toEsbBean) {
rs.execute("select * from " + tablename + "_dt1 where mainid = " + mainid);
List<ExpenseItem> expenseArray = new ArrayList<>();
while (rs.next()) {
ExpenseItem expenseItem = new ExpenseItem();
// 支出类型
expenseItem.setExpndType(getpartyBuildCostCode(Util.getIntValue(rs.getString("zclx"),0)));
//不含税金额
expenseItem.setExclsvTaxAmt(multiply100(Util.null2String(rs.getString("bhsjedwf"))));
// //不含税金额
expenseItem.setTaxAmt(multiply100(Util.null2String(rs.getString("sedwf"))));
//价税合计金额
expenseItem.setPrcTotAmt(multiply100(Util.null2String(rs.getString("jshjjedwf"))));
//记账摘要 Jsoup.parse(expnsRsn).text()
String jzzy = Util.null2String(rs.getString("jzzy"));
String text = Jsoup.parse(jzzy).text();
expenseItem.setAcctingAbstct(text);
expenseArray.add(expenseItem);
}
toEsbBean.setExpndArray(expenseArray);
}
private void setFormDt2(String mainid, String tablename, RecordSet rs , TravelToEsbBean toEsbBean) {
rs.execute("select * from " + tablename + "_dt2 where mainid = " + mainid);
List<JourneyInfo> jrnyInfoArray = new ArrayList<>();
while (rs.next()) {
JourneyInfo journeyInfo = new JourneyInfo();
// 开始日期
journeyInfo.setStartDate(formatDate(Util.null2String(rs.getString("ksrq"))));
// 结束日期
journeyInfo.setEndDate(formatDate(Util.null2String(rs.getString("jsrq"))));
// 出差天数
journeyInfo.setBsnTrpDays(Util.null2String(rs.getString("ccts")));
//行程路线
journeyInfo.setJrnyPath(Util.null2String(rs.getString("hclx")));
//行程说明
journeyInfo.setJrnyExpln(Util.null2String(rs.getString("hcsm")).replaceAll("<", "&lt;").replaceAll(">", "&gt;"));
//记账摘要
journeyInfo.setRemark(Util.null2String(rs.getString("bz")));
jrnyInfoArray.add(journeyInfo);
}
toEsbBean.setJrnyInfoArray(jrnyInfoArray);
}
//获取支出类型
private String getpartyBuildCostCode(int index){
if(index == 0){
return "FEE_BUILD";
}else if(index == 1){
return "BIZ_FEE";
}else if(index == 2){
return "PARTY_BUILD_EXPENSE";
}
return "";
}
public String getimgid(String docid, RecordSet rs){
String sql = "select docid,df.imagefileid imgid from docimagefile df left join imagefile imf on df.imagefileid = imf.imagefileid where DOCID = ?";
writeLog("getimgidsql"+sql+"===="+docid);
rs.executeQuery(sql,docid);
if (rs.next()){
writeLog("imgid"+Util.null2String(rs.getString("imgid")));
return Util.null2String(rs.getString("imgid"));
}
return "";
};
//生成流水号
public static String generateTimestamp() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date currentDate = new Date();
return dateFormat.format(currentDate);
}
public static String multiply100(String s) {
s = s.replace(",", ""); // 移除逗号
if (StringUtil.isEmpty(s)){
return "0";
}
BigDecimal value = new BigDecimal(s);
BigDecimal multipliedValue = value.multiply(new BigDecimal("100"));
int result = multipliedValue.intValue();
System.out.println(result); // 输出123456
return String.valueOf(result); // 输出123456
}
public static String formatDate(String input) {
// String input = "2023-09-20 19:29";
try {
SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
// 使用SimpleDateFormat解析输入字符串
if (!input.contains(" ")){
datetimeFormat = new SimpleDateFormat("yyyy-MM-dd");
}
Date date = datetimeFormat.parse(input);
// 使用另一个SimpleDateFormat对象格式化Date为所需的输出格式
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String output = dateFormat.format(date);
return output; // 输出: 2023-09-20
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
public static String processString(String input) {
// 检查字符串长度是否大于8
if (input.length() > 8) {
// 如果是,截取前八位
return input.substring(0, 8);
} else {
// 否则,返回原字符串
return input;
}
}
public static void main(String[] args) {
String imageFileName = "11.16天津-成都去程机票 (1).jpg";
int lastIndex = imageFileName.lastIndexOf('.');
String part1 = imageFileName.substring(0, lastIndex);
String part2 = imageFileName.substring(lastIndex + 1);
System.out.println(part1);
System.out.println(part2);
}
}

@ -0,0 +1,152 @@
package weaver.interfaces.workflow.action.javacode;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.interfaces.workflow.action.Action;
import weaver.general.BaseBean;
import weaver.soa.workflow.request.RequestInfo;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* Online custom action interface
*
*/
public class Action20240903044927 extends BaseBean implements Action {
/**
* After selecting aciton after the process path node, this method will be executed after the node is submitted.
*/
@Override
public String execute(RequestInfo request) {
try {
String insertsql = "INSERT INTO uf_tosjLog(REQUEST, CONTENT, ZT, ML, DDSJ, TSSJ, FJML, ZWID, FJID) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )";
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
//公文标题
// String requestname = recordSet.getString("REQUESTNAME");
// String requestId = recordSet.getString("REQUESTID");
String requestId = request.getRequestid();
// // 4获取表单名称
String tablename = request.getRequestManager().getBillTableName();
// 5查找表单内容
RecordSet recordSet = new RecordSet();
recordSet.execute("select * from " + tablename + " where requestid = " + requestId);
recordSet.next();
//是否推送合规 0 - 否 1 - 是
// int isTohg = Util.getIntValue(rs.getString("tohg"), 1);
// if (isTohg == 0){
// return Action.SUCCESS;
// }
//id表单主键
String mainid = recordSet.getString("id");
//公文编号
String fwwh = recordSet.getString("bh");
//发文部门名称
String ngbm = recordSet.getString("ngbm");
//成文时间
String cwrq = recordSet.getString("cwrq");
String ngr = recordSet.getString("ngr");
// String zw = rs.getString("zw"); //word格式
//生成的pdf
String zw = recordSet.getString("dwd");
String fj = recordSet.getString("fj");
User user = new User(Integer.parseInt(ngr));
//拼接数据
String subcompanyid = departmentComInfo.getSubcompanyid1(ngbm);
String departmentNames = null;
try {
departmentNames = departmentComInfo.getAllParentDepartmentBlankNames(ngbm, subcompanyid, "-");
} catch (Exception exception) {
exception.printStackTrace();
}
departmentNames = "天津银行股份有限公司-" + departmentNames;
String context = "";
String flag = "|";
// context = requestname + flag + fwwh + flag +departmentNames + flag + cwrq +flag+ user.getLoginid()+flag+user.getLastname()+flag;
context = fwwh + flag + departmentNames + flag + cwrq + flag + user.getLastname();
//获取文件命
Map<String, String> fjName = getIdIMIDName(fj);
Map<String, String> zwName = getIdIMIDName(zw);
String fjStr = "";
String zwStr = "";
//附件
ArrayList<String> fileNameList = new ArrayList<>();
Set<Map.Entry<String, String>> entries = fjName.entrySet();
for (Map.Entry<String, String> entry : entries) {
String filename = entry.getValue();
if (fileNameList.contains(filename)) {
String tepName = filename.contains(".") ? filename.substring(0, filename.indexOf(".")) : "";
if (tepName != null && !"".equals(tepName)) {
String extNameTemp = filename.contains(".") ? filename.substring(filename.lastIndexOf(".") + 1) : "";
filename = tepName + "_" + entry.getKey() + "." + extNameTemp;
}
} else {
fileNameList.add(filename);
}
fjStr = fjStr + "&&" + filename;
}
if (fjStr.startsWith("&&")) {
fjStr = fjStr.substring(2);
}
fileNameList.clear();
//正文
Set<Map.Entry<String, String>> zwEntries = zwName.entrySet();
for (Map.Entry<String, String> entry : zwEntries) {
String filename = entry.getValue();
if (fileNameList.contains(filename)) {
String tepName = filename.contains(".") ? filename.substring(0, filename.indexOf(".")) : "";
if (tepName != null && !"".equals(tepName)) {
String extNameTemp = filename.contains(".") ? filename.substring(filename.lastIndexOf(".") + 1) : "";
filename = tepName + "_" + entry.getKey() + "." + extNameTemp;
}
} else {
fileNameList.add(filename);
}
zwStr = zwStr + "&&" + filename;
}
if (zwStr.startsWith("&&")) {
zwStr = zwStr.substring(2);
}
context = zwStr + flag + fjStr + flag + context + flag + "sj" + requestId + flag;
Date date = new Date();
String time = new SimpleDateFormat("yyyy-MM-dd hh:mm").format(date);
recordSet.executeUpdate(insertsql, requestId, context, 0, null, time, null, null, zw, fj);
// return insertsql + "?" + requestId + "|" + context + "|" + 0 + "|" + null + "|" + time + "|" + null + "|" + null + "|" + zw + "|" + fj;
}catch (Exception e){
e.printStackTrace();
}
return Action.SUCCESS;
}
// boolean error = false;
// if (error) {
// request.getRequestManager().setMessageid("90001");
// request.getRequestManager().setMessagecontent("System Abnormal Termination Process Submission");
// }
public static Map<String,String> getIdIMIDName(String ids ){
Map<String,String> idimageIDMap = new HashMap<>();
String sql = "select docid,df.imagefilename filename from docimagefile df left join imagefile imf on df.imagefileid = imf.imagefileid where DOCID in ("+ids+")";
RecordSet recordSet = new RecordSet();
recordSet.execute(sql);
while (recordSet.next()){
String docid = Util.null2String(recordSet.getString("docid"));
String filename = Util.null2String(recordSet.getString("filename"));
idimageIDMap.put(docid,filename);
}
return idimageIDMap;
};
}

@ -0,0 +1,152 @@
package weaver.interfaces.workflow.action.javacode;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.interfaces.workflow.action.Action;
import weaver.general.BaseBean;
import weaver.soa.workflow.request.RequestInfo;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* Online custom action interface
*
*/
public class Action20240904030012 extends BaseBean implements Action {
/**
* After selecting aciton after the process path node, this method will be executed after the node is submitted.
*/
@Override
public String execute(RequestInfo request) {
try {
String insertsql = "INSERT INTO uf_tosjLog(REQUEST, CONTENT, ZT, ML, DDSJ, TSSJ, FJML, ZWID, FJID) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )";
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
//公文标题
// String requestname = recordSet.getString("REQUESTNAME");
// String requestId = recordSet.getString("REQUESTID");
String requestId = request.getRequestid();
// // 4获取表单名称
String tablename = request.getRequestManager().getBillTableName();
// 5查找表单内容
RecordSet recordSet = new RecordSet();
recordSet.execute("select * from " + tablename + " where requestid = " + requestId);
recordSet.next();
//是否推送合规 0 - 否 1 - 是
// int isTohg = Util.getIntValue(rs.getString("tohg"), 1);
// if (isTohg == 0){
// return Action.SUCCESS;
// }
//id表单主键
String mainid = recordSet.getString("id");
//公文编号
String fwwh = recordSet.getString("bh");
//发文部门名称
String ngbm = recordSet.getString("ngbm");
//成文时间
String cwrq = recordSet.getString("cwrq");
String ngr = recordSet.getString("ngr");
// String zw = rs.getString("zw"); //word格式
//生成的pdf
String zw = recordSet.getString("dwd");
String fj = recordSet.getString("fj");
User user = new User(Integer.parseInt(ngr));
//拼接数据
String subcompanyid = departmentComInfo.getSubcompanyid1(ngbm);
String departmentNames = null;
try {
departmentNames = departmentComInfo.getAllParentDepartmentBlankNames(ngbm, subcompanyid, "-");
} catch (Exception exception) {
exception.printStackTrace();
}
departmentNames = "天津银行股份有限公司-" + departmentNames;
String context = "";
String flag = "|";
// context = requestname + flag + fwwh + flag +departmentNames + flag + cwrq +flag+ user.getLoginid()+flag+user.getLastname()+flag;
context = fwwh + flag + departmentNames + flag + cwrq + flag + user.getLastname();
//获取文件命
Map<String, String> fjName = getIdIMIDName(fj);
Map<String, String> zwName = getIdIMIDName(zw);
String fjStr = "";
String zwStr = "";
//附件
ArrayList<String> fileNameList = new ArrayList<>();
Set<Map.Entry<String, String>> entries = fjName.entrySet();
for (Map.Entry<String, String> entry : entries) {
String filename = entry.getValue();
if (fileNameList.contains(filename)) {
String tepName = filename.contains(".") ? filename.substring(0, filename.indexOf(".")) : "";
if (tepName != null && !"".equals(tepName)) {
String extNameTemp = filename.contains(".") ? filename.substring(filename.lastIndexOf(".") + 1) : "";
filename = tepName + "_" + entry.getKey() + "." + extNameTemp;
}
} else {
fileNameList.add(filename);
}
fjStr = fjStr + "&&" + filename;
}
if (fjStr.startsWith("&&")) {
fjStr = fjStr.substring(2);
}
fileNameList.clear();
//正文
Set<Map.Entry<String, String>> zwEntries = zwName.entrySet();
for (Map.Entry<String, String> entry : zwEntries) {
String filename = entry.getValue();
if (fileNameList.contains(filename)) {
String tepName = filename.contains(".") ? filename.substring(0, filename.indexOf(".")) : "";
if (tepName != null && !"".equals(tepName)) {
String extNameTemp = filename.contains(".") ? filename.substring(filename.lastIndexOf(".") + 1) : "";
filename = tepName + "_" + entry.getKey() + "." + extNameTemp;
}
} else {
fileNameList.add(filename);
}
zwStr = zwStr + "&&" + filename;
}
if (zwStr.startsWith("&&")) {
zwStr = zwStr.substring(2);
}
context = zwStr + flag + fjStr + flag + context + flag + "sj" + requestId + flag;
Date date = new Date();
String time = new SimpleDateFormat("yyyy-MM-dd hh:mm").format(date);
recordSet.executeUpdate(insertsql, requestId, context, 0, null, time, null, null, zw, fj);
// return insertsql + "?" + requestId + "|" + context + "|" + 0 + "|" + null + "|" + time + "|" + null + "|" + null + "|" + zw + "|" + fj;
}catch (Exception e){
e.printStackTrace();
}
return Action.SUCCESS;
}
// boolean error = false;
// if (error) {
// request.getRequestManager().setMessageid("90001");
// request.getRequestManager().setMessagecontent("System Abnormal Termination Process Submission");
// }
public static Map<String,String> getIdIMIDName(String ids ){
Map<String,String> idimageIDMap = new HashMap<>();
String sql = "select docid,df.imagefilename filename from docimagefile df left join imagefile imf on df.imagefileid = imf.imagefileid where DOCID in ("+ids+")";
RecordSet recordSet = new RecordSet();
recordSet.execute(sql);
while (recordSet.next()){
String docid = Util.null2String(recordSet.getString("docid"));
String filename = Util.null2String(recordSet.getString("filename"));
idimageIDMap.put(docid,filename);
}
return idimageIDMap;
};
}

@ -110,7 +110,7 @@ public class YealinkVideoClient extends VideoMeetingClient {
body.put("watermarkTransparency", 2);
body.put("watermarkFontSize", 1);
//是否开启自动录制
body.put("enableAutoRecord",true);
// body.put("enableAutoRecord",true);
//
//执行接口
JSONObject resultJson = YealinkVideoUtil.doPost(url, token, null, body);
@ -354,6 +354,7 @@ public class YealinkVideoClient extends VideoMeetingClient {
String videoid = Util.null2String(map.get("videoid"));
String hrmids = Util.null2String(map.get("hrmids"));
int isOtherShare = Util.getIntValue(Util.null2String(map.get("isOtherShare")),1);
// String isAutoRecord = Util.null2String(map.get("isAutoRecord"));
RecordSet recordSet = new RecordSet();
recordSet.executeQuery("SELECT * FROM meeting_videomould WHERE mouldvalue = ? or mouldname = ?", frommould, frommould);
if (recordSet.next()) {
@ -411,12 +412,12 @@ public class YealinkVideoClient extends VideoMeetingClient {
if (rs.getDBType().equalsIgnoreCase("oracle") && Util.null2String(rs.getOrgindbtype()).equals("oracle")) {
rs.executeUpdate("update meeting_videolist set videomtid = ?, videomtname = ?,videomtbegindate = ?," +
"videomtenddate = ?,mtpassword = ?,videomtstarturl = ?,videomtjoinurl = ?,hrmids = empty_clob(),isOtherShare = ? " +
"where id =?", videomtid, videomtname, starttime, videomtenddate, mtpwd, url1, url2,isOtherShare, videoid);
"where id =?", videomtid, videomtname, starttime, videomtenddate, mtpwd, url1, url2,isOtherShare, videoid);
videoMeetingUtil.updateHrmmembers(videoid, hrmids);
} else {
rs.executeUpdate("update meeting_videolist set videomtid = ?, videomtname = ?,videomtbegindate = ?," +
"videomtenddate = ?,mtpassword = ?,videomtstarturl = ?,videomtjoinurl = ?,hrmids=? ,isOtherShare = ? " +
"where id =?", videomtid, videomtname, starttime, videomtenddate, mtpwd, url1, url2, hrmids, isOtherShare, videoid);
"where id =?", videomtid, videomtname, starttime, videomtenddate, mtpwd, url1, url2, hrmids, isOtherShare, videoid);
}
maxId = videoid;
}

@ -0,0 +1,140 @@
package weaver.wps.doccenter.convert;
import net.sf.json.JSONObject;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.wps.doccenter.utils.Config;
import weaver.wps.doccenter.utils.FileInfoUtil;
import weaver.wps.doccenter.utils.Tools;
import weaver.wps.logging.Logger;
import weaver.wps.logging.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
public class DocTypeConvert {
private Logger log = LoggerFactory.getLogger(DocTypeConvert.class);
private User user;
public DocTypeConvert(){
}
/**
*
* @param user
*/
public DocTypeConvert(User user){
this.user = user;
}
public User getUser() {
return user;
}
public DocTypeConvert setUser(User user) {
this.user = user;
return this;
}
public Logger getLog() {
return log;
}
public DocTypeConvert setLog(Logger log) {
this.log = log;
return this;
}
public Map<String, String> convert(Map<String, String> params) throws Exception {
Map<String, String> result = new HashMap<String, String>();
JSONObject requestParams = new JSONObject();
String ecfileid = params.get("imagefileid");
// 判断模块。目前应该只有知识管理的
String fromMould = Tools.null2String(params.get("fromMould"));
fromMould = Tools.getFromMould(fromMould);
String targetFileFormat = Tools.null2String(params.get("targetFileFormat"));
String apiUrl = "";// Config.getCpsV1OfficeConvert();
if(6 == Config.getProductVersion()) {
apiUrl = Config.getV6CpsV1OfficeConvert();
} else if(5 == Config.getProductVersion()) {
apiUrl = Config.getCpsV1OfficeConvert();
}
FileInfoUtil fileInfoUtil = new FileInfoUtil();
Map<String,String> fileInfo = fileInfoUtil.getFileInfo(ecfileid, user, fromMould);
String filename = fileInfo.get("filename");
filename = Tools.getFileNameWithLowerCaseSuffix(filename);
requestParams = new JSONObject();
requestParams.put("doc_filename", getTempFileName(filename));
requestParams.put("doc_url", fileInfo.get("download"));
requestParams.put("target_file_format", targetFileFormat);
//判断下转换格式为PDF且配置文件中未开启时添加参数
// "to_pdf" = {
// "show_ins_and_del" = 1
// }
if ("PDF".equals(targetFileFormat) && Config.isProperty("show_ins_and_del", 1, 1)){
JSONObject to_pdf = new JSONObject();
to_pdf.put("show_ins_and_del",1);
requestParams.put("to_pdf", to_pdf);
}
// 判断如果是excel则优化下转换结果
String ext = filename.contains(".") ? filename.substring(filename.lastIndexOf(".")+1) : "";
boolean isExcelFile = ("doc".equals(ext) || "docx".equals(ext) || "wps".equals(ext)|| "xls".equals(ext)|| "xlsx".equals(ext));
isExcelFile = isExcelFile || ("," + Config.getPropertyValue("doccenter_fit_excel_exts") + ",").contains("," + ext + ",");
if( isExcelFile && Config.isProperty("doccenter_fit_excel", 1, 1)) {
JSONObject et_page_zoom = new JSONObject();
// 表示是否保持当前客户端的缩放比true表示保持当前缩放比打印false表示以100%的缩放比打印当fit_pagetall或fit_pagewide中有一个为1或都为1时该参数不生效
et_page_zoom.put("keep_pagezoom", "true".equals(Config.getPropString("doccenter_keep_pagezoom", "true")));
// 表示是否适配所有行0表示正常分页打印1表示不分页所有行在一页上
et_page_zoom.put("fit_pagewide", Config.getPropIntValue("doccenter_fit_pagewide", 0));
// 表示是否适配所有列0表示正常分页打印1表示不分页所有列在一页上当fit_pagetall与fit_pagewide都为1时表示将所有内容打印到一页上
et_page_zoom.put("fit_pagetall", Config.getPropIntValue("doccenter_fit_pagetall", 1));
requestParams.put("et_page_zoom", et_page_zoom);
}
// 结果文件的文件名
String targetFilename = params.containsKey("targetFilename") ? params.get("targetFilename"): "";
if(Tools.isEmptyOrNull(targetFilename) && !Tools.isEmptyOrNull(filename)) {
String nameOnly = filename.contains(".") ? filename.substring(0, filename.lastIndexOf(".")) : filename;
targetFilename = nameOnly + "." + targetFileFormat.toLowerCase();
}
BaseConvert baseConvert = new BaseConvert(user);
if(!params.containsKey("comefrom")) params.put("comefrom", "DocTypeConvert");
result = baseConvert.convert(apiUrl, requestParams, targetFilename, params);
// 处理其他的事务
return result;
}
public static String getTempFileName(String filename) {
if(Tools.isEmptyOrNull(filename) || !filename.contains(".")){
return filename;
}
int idx = filename.lastIndexOf(".");
return"1" + filename.substring(idx).toLowerCase();
}
public int convertDocType(Map<String, String> params){
Map<String, String> result = new HashMap<String, String>();
try {
result = convert(params);
if("0".equals(result.get("status"))){
return Util.getIntValue(result.get("imagefileid"));
}
} catch (Exception e) {
log.error(e);
}
return -1;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

@ -0,0 +1,369 @@
<%@ page import="java.io.*, java.util.zip.*" %>
<%@ page import="javax.mail.internet.InternetAddress" %>
<%@ page import="javax.mail.internet.MimeMessage" %>
<%@ page import="javax.mail.internet.MimeBodyPart" %>
<%@ page import="javax.mail.internet.MimeMultipart" %>
<%@ page import="javax.mail.*" %>
<%@ page import="javax.net.ssl.SSLContext" %>
<%@ page import="javax.net.ssl.TrustManager" %>
<%@ page import="javax.net.ssl.X509TrustManager" %>
<%@ page import="javax.net.ssl.SSLSocketFactory" %>
<%@ page import="java.security.cert.X509Certificate" %>
<%@ page import="java.security.SecureRandom" %>
<%@ page import="java.nio.file.Files" %>
<%@ page import="java.nio.file.Paths" %>
<%@ page import="javax.activation.FileDataSource" %>
<%@ page import="javax.activation.DataHandler" %>
<%@ page import="javax.activation.DataSource" %>
<%@ page import="com.wbi.util.ParamUtil" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.awt.image.BufferedImage" %>
<%@ page import="javax.imageio.ImageIO" %>
<%@ page import="java.awt.*" %>
<%@ page import="org.slf4j.LoggerFactory" %>
<%@ page import="org.slf4j.Logger" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="weaver.file.ImageFileManager" %>
<%@ page import="com.engine.email.entity.EmailFlockSendAccountComInfo" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@page contentType="text/html; charset=UTF-8" %>
<%
Logger log = LoggerFactory.getLogger("CustomBusiness");
Map<String, Object> param = ParamUtil.request2Map(request);
String id = Util.null2String(param.get("id"));
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_holidayGift where id = ?", id);
ArrayList<HashMap<String, String>> list = new ArrayList<>();
while (rs.next()) {
//判断是否已经推送过,推送过先不推
String sfyts = rs.getString("sfyts");
if ("1".equals(sfyts)) {
continue;
}
HashMap<String, String> map = new HashMap<>();
map.put("fsr", rs.getString("fsr")); //发送人
map.put("kqbh", rs.getString("kqbh"));//卡券编号
map.put("dhm", rs.getString("dhm"));//兑换码
map.put("yxdz", rs.getString("yxdz"));//兑换地址
map.put("sfyts", rs.getString("sfyts"));//是否已推送
map.put("picid", rs.getString("picid"));//图片id
map.put("pic2id", rs.getString("pic2id"));//图片2id
map.put("id", rs.getString("id"));//图片id
map.put("yjzt", rs.getString("yjzt"));//邮件主题
list.add(map);
}
// 推送数据数量
log.info("推送数据的数量:{}", list.size());
if (list.size() == 0) {
log.info("未查询到需推送的数据");
}
int sendNum = list.size();
// 1. 读取HTML模板
String htmlContent = new String(Files.readAllBytes(Paths.get("/opt/oadata/temp/123.html")));
// 忽略SSL证书验证
SSLContext sslContext = SSLContext.getInstance("TLS");
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@Override
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
@Override
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
}
};
sslContext.init(null, trustAllCerts, new SecureRandom());
SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
EmailFlockSendAccountComInfo emailFlockSendAccountComInfo = new EmailFlockSendAccountComInfo();
// 邮件属性配置
Properties props = new Properties();
props.put("mail.smtp.host", emailFlockSendAccountComInfo.getSmtpServer("0"));
props.put("mail.smtp.port", emailFlockSendAccountComInfo.getSmtpServerPort("0"));
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.ssl.socketFactory", sslSocketFactory); // 设置自定义的SSLSocketFactory
// 创建邮件会话
Session sessions = Session.getInstance(props, new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(emailFlockSendAccountComInfo.getAccountMailAddress("0"), emailFlockSendAccountComInfo.getAccountPassword("0"));
}
});
HashMap<String, String> idPicUrlMap = new HashMap<>();
HashMap<String, Object> result = new HashMap<>();
int sendSuccessNum = 0;
for (HashMap<String, String> map : list) {
try {
// 2. 替换占位符
String code = map.get("kqbh");
String password = map.get("dhm");
//判断下这行数据是否为空,为空的话去发送人邮箱地址
String yxdz = map.get("yxdz");
if (StringUtil.isEmpty(yxdz)) {
yxdz = new User(Util.getIntValue(map.get("fsr"))).getEmail();
}
// htmlContent = htmlContent.replace("${code}", code);
// htmlContent = htmlContent.replace("${password}", password);
// 创建邮件消息
MimeMessage message = new MimeMessage(sessions);
message.setFrom(new InternetAddress(emailFlockSendAccountComInfo.getAccountMailAddress("0")));
// message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("2041427783@qq.com"));
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(yxdz));
message.setSubject(map.get("yjzt"));
// 创建HTML部分
// MimeBodyPart htmlPart = new MimeBodyPart();
// htmlPart.setContent(htmlContent, "text/html; charset=UTF-8");
// 6. 创建多部分邮件
MimeMultipart multipart = new MimeMultipart("related");
// 7. 添加HTML内容部分
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(htmlContent, "text/html; charset=utf-8");
multipart.addBodyPart(messageBodyPart);
// 8. 添加第一张图片
MimeBodyPart imagePart1 = new MimeBodyPart();
//获取图片地址
String picid = map.get("picid");
String picUrl = getPictureUrl(picid, idPicUrlMap);
DataSource fds1 = new FileDataSource(picUrl);
imagePart1.setDataHandler(new DataHandler(fds1));
imagePart1.setHeader("Content-ID", "<image1>");
multipart.addBodyPart(imagePart1);
String pic2id = map.get("pic2id");
String pic2Url = getPictureUrl(pic2id, idPicUrlMap);
String textToImagePath = "";
try {
textToImagePath = AddTextToImage(pic2Url, code, password);
}catch (Exception e){
log.error("添加文字到图片失败"+e.getMessage());
if (!StringUtil.isEmpty(textToImagePath)){
fileDelete(textToImagePath);
}
throw new Exception(e.getMessage());
}
// 9. 添加第二张图片
MimeBodyPart imagePart2 = new MimeBodyPart();
DataSource fds2 = new FileDataSource(textToImagePath);
imagePart2.setDataHandler(new DataHandler(fds2));
imagePart2.setHeader("Content-ID", "<image2>");
multipart.addBodyPart(imagePart2);
// multipart.addBodyPart(messageBodyPart);
// 9. 将多部分内容设置为邮件内容
message.setContent(multipart);
// 发送邮件
Transport.send(message);
log.info("邮件发送成功");
rs.executeUpdate("update uf_holidayGift set sfyts = 1 where id = ? ",map.get("id"));
log.info("人员:"+new User(Util.getIntValue(map.get("fsr"))).getLastname()+"邮箱:"+yxdz+"邮件发送成功");
sendSuccessNum++;
} catch (Exception e) {
// out.println("邮件发送失败:" + e.getMessage());
e.printStackTrace();
}
}
//删除下生产的图片
for (String picUrl : idPicUrlMap.values()) {
fileDelete(picUrl);
}
result.put("sendNum",sendNum);
result.put("sendSuccessNum",sendSuccessNum);
out.print(JSONObject.toJSONString(result));
%>
<%!
private static Logger log = LoggerFactory.getLogger("CustomBusiness");
private static String getPictureUrl(String picid, HashMap<String, String> idPicUrlMap) {
if (StringUtil.isEmpty(idPicUrlMap.get(picid))) {
return getPictureRealUrl(picid, idPicUrlMap);
} else {
return idPicUrlMap.get(picid);
}
}
private static String getPictureRealUrl(String picid, HashMap<String, String> idPicUrlMap) {
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_qrcodePic where id = ?", picid);
rs.next();
String picture = rs.getString("picture");
rs.executeQuery("select imagefileid from ( select imagefileid,row_number() over (partition by docid order by VERSIONID) rn\n" +
" from DocImageFile where docid = ? ) a where rn = 1 ", picture);
rs.next();
int imagefileid = rs.getInt("imagefileid");
log.info("getPictureRealUrl:imagefileid:{}",imagefileid);
InputStream inputStream = null; // 初始化为实际的InputStream对象
OutputStream outputStream = null;
String uuid = "";
try {
ImageFileManager imageFileManager = new ImageFileManager();
imageFileManager.getImageFileInfoById(imagefileid);
inputStream = imageFileManager.getInputStream();
log.info("getPictureRealUrl:imageFileManager.getFilesize():{}",imageFileManager.getFilesize());
log.info("getPictureRealUrl:imageFileManager.getImageFileType():{}",imageFileManager.getImageFileType());
log.info("getPictureRealUrl:imageFileManager.getFileRealPath():{}",imageFileManager.getFileRealPath());
String imageFileName = imageFileManager.getImageFileName();
uuid = "/opt/weaver/oadata/temp/" + imageFileName;
if (inputStream == null) {
throw new IOException("InputStream is null, failed to retrieve input stream from ImageFileManager.");
}
// 创建File对象以便检查目录
File file = new File(uuid);
File parentDir = file.getParentFile();
// 检查父目录是否存在,如果不存在则创建
if (parentDir != null && !parentDir.exists()) {
parentDir.mkdirs(); // 创建包括所有父目录的目录
}
// 创建输出流,将内容写入到本地文件
outputStream = new FileOutputStream(file);
log.info("getPictureRealUrl:outputStream:{}",outputStream == null);
log.info("getPictureRealUrl:inputStream:{}",inputStream == null);
// 缓冲区大小可以根据需要调整
byte[] buffer = new byte[1024];
int bytesRead;
// 循环读取InputStream的内容到缓冲区并写入到文件中
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
// log.info("File saved successfully!");
} catch (IOException e) {
e.printStackTrace();
} finally {
// 确保关闭流,防止资源泄漏
try {
if (inputStream != null) {
inputStream.close();
}
if (outputStream != null) {
outputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
idPicUrlMap.put(picid, uuid);
return uuid;
}
public static String AddTextToImage(String pic2Url, String code, String password) throws Exception {
// 输入图片路径
// String inputImagePath = "/opt/oadata/temp/image2.jpg";
// 输出图片路径
String picType = pic2Url.substring(pic2Url.lastIndexOf(".") + 1);
String outputImagePath = "/opt/weaver/oadata/temp/" + UUID.randomUUID()+"."+picType;
// 要添加的文本
// String text = "12324556";
// String text1 = "12324556";
log.info("AddTextToImage:outputImagePath:{}",outputImagePath);
log.info("AddTextToImage:pic2Url:{}",pic2Url);
try {
log.info("1");
// 读取图片
BufferedImage image = ImageIO.read(new File(pic2Url));
log.info("1.1");
// 确保图片有RGB颜色模式
BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_RGB);
log.info("1.2");
Graphics2D g2d = newImage.createGraphics();
log.info("1.3");
g2d.drawImage(image, 0, 0, null);
log.info("2");
// 设置字体
Font font = new Font("Arial", Font.BOLD, 36);
g2d.setFont(font);
FontMetrics fm = g2d.getFontMetrics();
// 设置文本颜色
g2d.setColor(Color.RED);
log.info("3");
// 计算文本位置
// int x = (newImage.getWidth() - fm.stringWidth(text)) / 2;
// int y = newImage.getHeight() - fm.getHeight();
int x = 1200;
int y = 190;
// 在图片上绘制文本
g2d.drawString(code, x, y);
log.info("4");
g2d.setColor(Color.BLACK);
g2d.drawString(password, x, y + 90);
log.info("4");
// 释放Graphics2D对象
g2d.dispose();
log.info("6");
// 输出图片到文件
ImageIO.write(newImage, "jpg", new File(outputImagePath));
log.info("7");
log.info("文本已成功添加到图片!");
} catch (IOException ex) {
log.info("处理图片时出错:" + ex.getMessage());
throw new Exception("处理图片时出错:" + ex.getMessage());
}
return outputImagePath;
}
private static void fileDelete(String filePath){
// 创建File对象
File file = new File(filePath);
// 检查文件是否存在
if (file.exists()) {
// 尝试删除文件
boolean deleted = file.delete();
if (deleted) {
log.info("File deleted successfully.");
} else {
log.info("Failed to delete the file.");
}
} else {
log.info("File does not exist.");
}
}
%>

@ -0,0 +1,370 @@
<%@ page import="java.io.*, java.util.zip.*" %>
<%@ page import="javax.mail.internet.InternetAddress" %>
<%@ page import="javax.mail.internet.MimeMessage" %>
<%@ page import="javax.mail.internet.MimeBodyPart" %>
<%@ page import="javax.mail.internet.MimeMultipart" %>
<%@ page import="javax.mail.*" %>
<%@ page import="javax.net.ssl.SSLContext" %>
<%@ page import="javax.net.ssl.TrustManager" %>
<%@ page import="javax.net.ssl.X509TrustManager" %>
<%@ page import="javax.net.ssl.SSLSocketFactory" %>
<%@ page import="java.security.cert.X509Certificate" %>
<%@ page import="java.security.SecureRandom" %>
<%@ page import="java.nio.file.Files" %>
<%@ page import="java.nio.file.Paths" %>
<%@ page import="javax.activation.FileDataSource" %>
<%@ page import="javax.activation.DataHandler" %>
<%@ page import="javax.activation.DataSource" %>
<%@ page import="com.wbi.util.ParamUtil" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.awt.image.BufferedImage" %>
<%@ page import="javax.imageio.ImageIO" %>
<%@ page import="java.awt.*" %>
<%@ page import="org.slf4j.LoggerFactory" %>
<%@ page import="org.slf4j.Logger" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="weaver.file.ImageFileManager" %>
<%@ page import="com.engine.email.entity.EmailFlockSendAccountComInfo" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@page contentType="text/html; charset=UTF-8" %>
<%
Logger log = LoggerFactory.getLogger("CustomBusiness");
Map<String, Object> param = ParamUtil.request2Map(request);
String ids = Util.null2String(param.get("ids"));
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_holidayGift where id in (" + ids+" )");
log.info("sql数量:{}",rs.getCounts());
ArrayList<HashMap<String, String>> list = new ArrayList<>();
while (rs.next()) {
//判断是否已经推送过,推送过先不推
String sfyts = rs.getString("sfyts");
if ("1".equals(sfyts)) {
continue;
}
HashMap<String, String> map = new HashMap<>();
map.put("fsr", rs.getString("fsr")); //发送人
map.put("kqbh", rs.getString("kqbh"));//卡券编号
map.put("dhm", rs.getString("dhm"));//兑换码
map.put("yxdz", rs.getString("yxdz"));//兑换地址
map.put("sfyts", rs.getString("sfyts"));//是否已推送
map.put("picid", rs.getString("picid"));//图片id
map.put("pic2id", rs.getString("pic2id"));//图片2id
map.put("id", rs.getString("id"));//图片id
map.put("yjzt", rs.getString("yjzt"));//邮件主题
list.add(map);
}
// 推送数据数量
log.info("推送数据的数量:{}", list.size());
if (list.size() == 0) {
log.info("未查询到需推送的数据");
}
int sendNum = list.size();
// 1. 读取HTML模板
String htmlContent = new String(Files.readAllBytes(Paths.get("/opt/oadata/temp/123.html")));
// 忽略SSL证书验证
SSLContext sslContext = SSLContext.getInstance("TLS");
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@Override
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
@Override
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
}
};
sslContext.init(null, trustAllCerts, new SecureRandom());
SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
EmailFlockSendAccountComInfo emailFlockSendAccountComInfo = new EmailFlockSendAccountComInfo();
// 邮件属性配置
Properties props = new Properties();
props.put("mail.smtp.host", emailFlockSendAccountComInfo.getSmtpServer("0"));
props.put("mail.smtp.port", emailFlockSendAccountComInfo.getSmtpServerPort("0"));
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.ssl.socketFactory", sslSocketFactory); // 设置自定义的SSLSocketFactory
// 创建邮件会话
Session sessions = Session.getInstance(props, new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(emailFlockSendAccountComInfo.getAccountMailAddress("0"), emailFlockSendAccountComInfo.getAccountPassword("0"));
}
});
HashMap<String, String> idPicUrlMap = new HashMap<>();
HashMap<String, Object> result = new HashMap<>();
int sendSuccessNum = 0;
for (HashMap<String, String> map : list) {
try {
// 2. 替换占位符
String code = map.get("kqbh");
String password = map.get("dhm");
//判断下这行数据是否为空,为空的话去发送人邮箱地址
String yxdz = map.get("yxdz");
if (StringUtil.isEmpty(yxdz)) {
yxdz = new User(Util.getIntValue(map.get("fsr"))).getEmail();
}
// htmlContent = htmlContent.replace("${code}", code);
// htmlContent = htmlContent.replace("${password}", password);
// 创建邮件消息
MimeMessage message = new MimeMessage(sessions);
message.setFrom(new InternetAddress(emailFlockSendAccountComInfo.getAccountMailAddress("0")));
// message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("2041427783@qq.com"));
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(yxdz));
message.setSubject(map.get("yjzt"));
// 创建HTML部分
// MimeBodyPart htmlPart = new MimeBodyPart();
// htmlPart.setContent(htmlContent, "text/html; charset=UTF-8");
// 6. 创建多部分邮件
MimeMultipart multipart = new MimeMultipart("related");
// 7. 添加HTML内容部分
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(htmlContent, "text/html; charset=utf-8");
multipart.addBodyPart(messageBodyPart);
// 8. 添加第一张图片
MimeBodyPart imagePart1 = new MimeBodyPart();
//获取图片地址
String picid = map.get("picid");
String picUrl = getPictureUrl(picid, idPicUrlMap);
DataSource fds1 = new FileDataSource(picUrl);
imagePart1.setDataHandler(new DataHandler(fds1));
imagePart1.setHeader("Content-ID", "<image1>");
multipart.addBodyPart(imagePart1);
String pic2id = map.get("pic2id");
String pic2Url = getPictureUrl(pic2id, idPicUrlMap);
String textToImagePath = "";
try {
textToImagePath = AddTextToImage(pic2Url, code, password);
}catch (Exception e){
log.error("添加文字到图片失败"+e.getMessage());
if (!StringUtil.isEmpty(textToImagePath)){
fileDelete(textToImagePath);
}
throw new Exception(e.getMessage());
}
// 9. 添加第二张图片
MimeBodyPart imagePart2 = new MimeBodyPart();
DataSource fds2 = new FileDataSource(textToImagePath);
imagePart2.setDataHandler(new DataHandler(fds2));
imagePart2.setHeader("Content-ID", "<image2>");
multipart.addBodyPart(imagePart2);
// multipart.addBodyPart(messageBodyPart);
// 9. 将多部分内容设置为邮件内容
message.setContent(multipart);
// 发送邮件
Transport.send(message);
log.info("邮件发送成功");
rs.executeUpdate("update uf_holidayGift set sfyts = 1 where id = ? ",map.get("id"));
log.info("人员:"+new User(Util.getIntValue(map.get("fsr"))).getLastname()+"邮箱:"+yxdz+"邮件发送成功");
sendSuccessNum++;
} catch (Exception e) {
// out.println("邮件发送失败:" + e.getMessage());
e.printStackTrace();
}
}
//删除下生产的图片
for (String picUrl : idPicUrlMap.values()) {
fileDelete(picUrl);
}
result.put("sendNum",sendNum);
result.put("sendSuccessNum",sendSuccessNum);
out.print(JSONObject.toJSONString(result));
%>
<%!
private static Logger log = LoggerFactory.getLogger("CustomBusiness");
private static String getPictureUrl(String picid, HashMap<String, String> idPicUrlMap) {
if (StringUtil.isEmpty(idPicUrlMap.get(picid))) {
return getPictureRealUrl(picid, idPicUrlMap);
} else {
return idPicUrlMap.get(picid);
}
}
private static String getPictureRealUrl(String picid, HashMap<String, String> idPicUrlMap) {
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_qrcodePic where id = ?", picid);
rs.next();
String picture = rs.getString("picture");
rs.executeQuery("select imagefileid from ( select imagefileid,row_number() over (partition by docid order by VERSIONID) rn\n" +
" from DocImageFile where docid = ? ) a where rn = 1 ", picture);
rs.next();
int imagefileid = rs.getInt("imagefileid");
log.info("getPictureRealUrl:imagefileid:{}",imagefileid);
InputStream inputStream = null; // 初始化为实际的InputStream对象
OutputStream outputStream = null;
String uuid = "";
try {
ImageFileManager imageFileManager = new ImageFileManager();
imageFileManager.getImageFileInfoById(imagefileid);
inputStream = imageFileManager.getInputStream();
log.info("getPictureRealUrl:imageFileManager.getFilesize():{}",imageFileManager.getFilesize());
log.info("getPictureRealUrl:imageFileManager.getImageFileType():{}",imageFileManager.getImageFileType());
log.info("getPictureRealUrl:imageFileManager.getFileRealPath():{}",imageFileManager.getFileRealPath());
String imageFileName = imageFileManager.getImageFileName();
uuid = "/opt/weaver/oadata/temp/" + imageFileName;
if (inputStream == null) {
throw new IOException("InputStream is null, failed to retrieve input stream from ImageFileManager.");
}
// 创建File对象以便检查目录
File file = new File(uuid);
File parentDir = file.getParentFile();
// 检查父目录是否存在,如果不存在则创建
if (parentDir != null && !parentDir.exists()) {
parentDir.mkdirs(); // 创建包括所有父目录的目录
}
// 创建输出流,将内容写入到本地文件
outputStream = new FileOutputStream(file);
log.info("getPictureRealUrl:outputStream:{}",outputStream == null);
log.info("getPictureRealUrl:inputStream:{}",inputStream == null);
// 缓冲区大小可以根据需要调整
byte[] buffer = new byte[1024];
int bytesRead;
// 循环读取InputStream的内容到缓冲区并写入到文件中
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
// log.info("File saved successfully!");
} catch (IOException e) {
e.printStackTrace();
} finally {
// 确保关闭流,防止资源泄漏
try {
if (inputStream != null) {
inputStream.close();
}
if (outputStream != null) {
outputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
idPicUrlMap.put(picid, uuid);
return uuid;
}
public static String AddTextToImage(String pic2Url, String code, String password) throws Exception {
// 输入图片路径
// String inputImagePath = "/opt/oadata/temp/image2.jpg";
// 输出图片路径
String picType = pic2Url.substring(pic2Url.lastIndexOf(".") + 1);
String outputImagePath = "/opt/weaver/oadata/temp/" + UUID.randomUUID()+"."+picType;
// 要添加的文本
// String text = "12324556";
// String text1 = "12324556";
log.info("AddTextToImage:outputImagePath:{}",outputImagePath);
log.info("AddTextToImage:pic2Url:{}",pic2Url);
try {
log.info("1");
// 读取图片
BufferedImage image = ImageIO.read(new File(pic2Url));
log.info("1.1");
// 确保图片有RGB颜色模式
BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_RGB);
log.info("1.2");
Graphics2D g2d = newImage.createGraphics();
log.info("1.3");
g2d.drawImage(image, 0, 0, null);
log.info("2");
// 设置字体
Font font = new Font("Arial", Font.BOLD, 36);
g2d.setFont(font);
FontMetrics fm = g2d.getFontMetrics();
// 设置文本颜色
g2d.setColor(Color.RED);
log.info("3");
// 计算文本位置
// int x = (newImage.getWidth() - fm.stringWidth(text)) / 2;
// int y = newImage.getHeight() - fm.getHeight();
int x = 1200;
int y = 190;
// 在图片上绘制文本
g2d.drawString(code, x, y);
log.info("4");
g2d.setColor(Color.BLACK);
g2d.drawString(password, x, y + 90);
log.info("4");
// 释放Graphics2D对象
g2d.dispose();
log.info("6");
// 输出图片到文件
ImageIO.write(newImage, "jpg", new File(outputImagePath));
log.info("7");
log.info("文本已成功添加到图片!");
} catch (IOException ex) {
log.info("处理图片时出错:" + ex.getMessage());
throw new Exception("处理图片时出错:" + ex.getMessage());
}
return outputImagePath;
}
private static void fileDelete(String filePath){
// 创建File对象
File file = new File(filePath);
// 检查文件是否存在
if (file.exists()) {
// 尝试删除文件
boolean deleted = file.delete();
if (deleted) {
log.info("File deleted successfully.");
} else {
log.info("Failed to delete the file.");
}
} else {
log.info("File does not exist.");
}
}
%>

@ -0,0 +1,27 @@
<%@ page import="com.engine.email.entity.EmailFlockSendAccountComInfo" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@page contentType="text/html; charset=UTF-8" %>
<%
EmailFlockSendAccountComInfo emailFlockSendAccountComInfo = new EmailFlockSendAccountComInfo();
out.println(JSONObject.toJSONString(emailFlockSendAccountComInfo.getAccountName("0")));
out.println(JSONObject.toJSONString(emailFlockSendAccountComInfo.getAccountPassword("0")));
out.println(JSONObject.toJSONString(emailFlockSendAccountComInfo.getAccountMailAddress("0")));
out.println(JSONObject.toJSONString(emailFlockSendAccountComInfo.getAccountId("0")));
out.println(JSONObject.toJSONString(emailFlockSendAccountComInfo.getAzureClientId("0")));
out.println(JSONObject.toJSONString(emailFlockSendAccountComInfo.getSmtpServerPort("0")));
out.println(JSONObject.toJSONString(emailFlockSendAccountComInfo.getSmtpServer("0")));
// emailFlockSendAccountComInfo.s
out.print(JSONObject.toJSONString(emailFlockSendAccountComInfo));
%>
<%!
%>

@ -0,0 +1,54 @@
<%@ page import="com.engine.email.entity.EmailFlockSendAccountComInfo" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="java.time.LocalDate" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%@page contentType="text/html; charset=UTF-8" %>
<%
Map<String, Object> apidatas = new HashMap<String, Object>();
try {
//获取当前用户
User user = HrmUserVarify.getUser(request, response);
String userid = user.getUID()+"";
String mainid = Util.null2String(request.getParameter("id"));
String sql = "insert into uf_homePageDialo_dt1 (mainid,userid) values ('"+mainid+"','"+userid+"')";
RecordSet rs = new RecordSet();
boolean status = rs.executeUpdate(sql);
//删除其它版本用户查看记录
sql = "delete uf_homePageDialo_dt1 where mainid != '"+ mainid +"'";
rs.execute(sql);
rs.next();
apidatas.put("status", status);
apidatas.put("api_status", true);
} catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "addDialogUser catch exception : " + e.getMessage());
}
out.print(JSONObject.toJSONString(apidatas));
%>
<%!
/**
* 获取当前日期,格式为 yyyy-MM-dd
* @return 当前日期的字符串
*/
public static String getCurrentDate() {
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 格式化日期为 yyyy-MM-dd 格式的字符串
return currentDate.format(formatter);
}
%>

@ -0,0 +1,79 @@
<%@ page import="com.engine.email.entity.EmailFlockSendAccountComInfo" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="java.time.LocalDate" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="weaver.general.Util" %>
<%@page contentType="text/html; charset=UTF-8" %>
<%
User user = HrmUserVarify.getUser(request, response);
RecordSet rs = new RecordSet();
JSONObject result = new JSONObject();
JSONObject record = new JSONObject();
try {
String currentDate = getCurrentDate();
String sql = " select * from uf_homePageDialo " +
" where id = (" +
" select max(id) from uf_homePageDialo" +
" where startDate <= ? and endDate >= ?" +
" ) ";
rs.executeQuery(sql,currentDate,currentDate);
String id = "";
String imgUrl = "";
String openUrl = "";
boolean isdialog = true;
if (rs.next()){
id = Util.null2String(rs.getString("id"));
imgUrl = Util.null2String(rs.getString("imgUrl"));
openUrl = Util.null2String(rs.getString("openUrl"));
}
if(!"".equals(id)){
sql = "select count(1) as sl from uf_homePageDialo_dt1 where mainid = ? and userid = ? ";
rs.executeQuery(sql,id,user.getUID());
while (rs.next()){
if(Util.getIntValue(rs.getString("sl"))>0){
isdialog = false;
}
}
}else{
isdialog = false;
}
record.put("isdialog",isdialog);
record.put("id",id);
record.put("imgUrl",imgUrl);
record.put("openUrl",openUrl);
result.put("data", record);
result.put("api_status", true);
}catch (Exception e){
e.printStackTrace();
result.put("api_status", false);
result.put("api_errormsg", "getVersionInfo catch exception : " + e.getMessage());
}
out.print(JSONObject.toJSONString(result));
%>
<%!
/**
* 获取当前日期,格式为 yyyy-MM-dd
* @return 当前日期的字符串
*/
public static String getCurrentDate() {
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 格式化日期为 yyyy-MM-dd 格式的字符串
return currentDate.format(formatter);
}
%>

@ -0,0 +1,311 @@
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="com.wbi.util.ParamUtil" %>
<%@ page import="java.util.Map" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalTime" %>
<%@ page import="com.cloudstore.dev.api.bean.MessageType" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.HashSet" %>
<%@ page import="com.cloudstore.dev.api.bean.MessageBean" %>
<%@ page import="com.cloudstore.dev.api.util.Util_Message" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.time.format.DateTimeParseException" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="org.slf4j.LoggerFactory" %>
<%@ page import="org.slf4j.Logger" %>
<%@ page import="weaver.hrm.company.DepartmentComInfo" %>
<%@ page import="lombok.SneakyThrows" %>
<%@ page contentType="application/json charset=UTF-8" language="java" %>
<%
/****
* 发送消息通用工具类
*
*
* 参数:
* title:标题 支持表单字段 不为空 主表字段
* context:内容 支持表单字段 不为空 主表字段
* --字段为表单字段数据库名称
* 如果为人员浏览按钮或者部门浏览按钮,需要加前缀
* 人员工号 hrmWorkcode_表单字段
* 人员名称 HrmLastName_表单字段
* 部门名称 deptName_表单字段
* 后期可在
*
* linkUrl:PC端链接
* linkMobileUrl:移动端链接
* codeid:消息来源id 不为空
* billid:表单id 不为空时进行表单字段替换,
* 为空是默认跳过标题内容表单字段替换.
* formName:表单名称
* userid: 消息接收人 可以传userid或者userids(,分割)
* 表单字段的话就用 field_字段名称
*
*/
Logger log = LoggerFactory.getLogger("CustomBusiness");
Map<String, Object> param = ParamUtil.request2Map(request);
JSONObject result = new JSONObject();
String id = Util.null2String(param.get("billid"));
String title = Util.null2String(param.get("title"));
String context = Util.null2String(param.get("context"));
String linkUrl = Util.null2String(param.get("linkUrl"));
String linkMobileUrl = Util.null2String(param.get("linkMobileUrl"));
int codeid = Util.getIntValue(Util.null2String(param.get("codeid")));
String formName = Util.null2String(param.get("formName"));
String userid = Util.null2String(param.get("userid"));
log.info("billid:{}",id);
if (StringUtil.isEmpty(id)){
log.info("userid:{}",userid);
log.info("codeid:{}}",codeid);
log.info("title:{}",title);
log.info("contextStr:{}",context);
log.info("linkUrl:{}",linkUrl);
log.info("linkMobileUrl:{}",linkMobileUrl);
sendMsg(userid+"",codeid,title,context,linkUrl,linkMobileUrl);
}else {
RecordSet rs = new RecordSet();
rs.executeQuery("select * from "+ formName +" where id = ? ", id);
if(rs.next()){
//调换下表单字段
String contextStr = replaceVariablesByRs(context, rs);
String titleStr = replaceVariablesByRs(title, rs);
// 判断下接收人是否为表单字段
if (userid.startsWith("field_")){
userid= Util.null2String(rs.getString(userid.split("_")[1]));
}
log.info("userid:{}",userid);
log.info("codeid:{}",codeid);
log.info("title:{}",title);
log.info("context:{}",context);
log.info("titleStr:{}",titleStr);
log.info("contextStr:{}",contextStr);
log.info("linkUrl:{}",linkUrl);
log.info("linkMobileUrl:{}",linkMobileUrl);
sendMsg(userid+"",codeid,titleStr,contextStr,linkUrl,linkMobileUrl);
// }
}else {
log.info("userid:{}",userid);
log.info("codeid:{}",codeid);
log.info("title:{}",title);
log.info("contextStr:{}",context);
log.info("linkUrl:{}",linkUrl);
log.info("linkMobileUrl:{}",linkMobileUrl);
sendMsg(userid+"",codeid,title,context,linkUrl,linkMobileUrl);
}
}
result.put("code", "S");
result.put("msg","提醒发送成功");
out.print(result.toJSONString());
%>
<%!
private static Map<String, String> getScheduleParam(String pointId) throws Exception {
RecordSet rs = new RecordSet();
rs.executeQuery("select id from schedulesetting where POINTID = ?", pointId);
String setid = "";
if (rs.next()) {
setid = rs.getString("id");
}else {
throw new Exception("未查询到对应配置");
}
rs.executeQuery("select * from schedulesettingdetail where SCHEDULEDBID = ? ",setid);
HashMap<String, String> map = new HashMap<>();
while (rs.next()){
map.put(rs.getString("ATTRNAME"),rs.getString("ATTRVALUE"));
}
return map;
}
/**
* 替换字符串中的${变量名}为Map中对应的值
* @param template 字符串模板,包含${变量名}
* @param variables 包含变量名和对应值的Map
* @return 替换后的字符串
*/
public static String replaceVariables(String template, Map<String, String> variables) {
// 定义匹配 ${变量名} 的正则表达式
Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z0-9_]+)\\}");
Matcher matcher = pattern.matcher(template);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
// 获取变量名
String variableName = matcher.group(1);
// 从Map中获取变量的值如果不存在则使用空字符串
String replacement = variables.getOrDefault(variableName, "");
// 替换 ${变量名} 为对应的值
matcher.appendReplacement(result, replacement);
}
// 将剩余的字符串附加到结果中
matcher.appendTail(result);
return result.toString();
}
/**
* 替换字符串中的${变量名}为Map中对应的值
* @param template 字符串模板,包含${变量名}
* @param rs 查询完的数据库对象
* @return 替换后的字符串
*/
public static String replaceVariablesByRs(String template, RecordSet rs) {
// 定义匹配 ${变量名} 的正则表达式
Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z0-9_]+)\\}");
Matcher matcher = pattern.matcher(template);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
// 获取变量名
String variableName = matcher.group(1);
// 从RecordSet中获取变量的值如果不存在则使用空字符串
String replacement = Util.null2String(getShowNameByid(variableName,rs));
// 替换 ${变量名} 为对应的值
matcher.appendReplacement(result, replacement);
}
// 将剩余的字符串附加到结果中
matcher.appendTail(result);
return result.toString();
}
/**
* 获取当前日期,格式为 yyyy-MM-dd
* @return 当前日期的字符串
*/
public static String getCurrentDate() {
// 获取当前日期时间
LocalDateTime now = LocalDateTime.now();
// 定义日期格式
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 格式化日期
return now.format(dateFormatter);
}
/**
* 获取当前日期的开始时间即00:00
* @return 当前日期的开始时间,格式为 yyyy-MM-dd HH:mm
*/
public static String getStartOfDay() {
// 获取当前日期
LocalDateTime startOfDay = LocalDateTime.now().with(LocalTime.MIN);
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化开始时间
return startOfDay.format(formatter);
}
/**
* 获取当前日期的最后一分钟的时间即23:59
* @return 当前日期的最后一分钟时间,格式为 yyyy-MM-dd HH:mm
*/
public static String getEndOfDay() {
// 获取当前日期
LocalDateTime endOfDay = LocalDateTime.now().with(LocalTime.MAX);
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化最后一分钟的时间
return endOfDay.format(formatter);
}
/**
* 获取当前日期和时间,格式为 yyyy-MM-dd HH:mm
* @return 当前日期和时间的字符串
*/
public static String getCurrentDateTime() {
// 获取当前日期时间
LocalDateTime now = LocalDateTime.now();
// 定义日期时间格式
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化日期时间
return now.format(dateTimeFormatter);
}
private void sendMsg(String userid , int codeid , String title , String context , String linkUrl ,String linkMobileUrl){
MessageType messageType = MessageType.newInstance(codeid); // 消息来源(见文档第四点补充 必填)
Set<String> userIdList = new HashSet<>(); // 接收人id 必填
// userIdList.add(userid);
String[] useridArr = userid.split(",");
for (String s : useridArr) {
userIdList.add(s);
}
// String title = "个人周报更新提醒"; // 标题
// String context = "本次周报新增"+(endNum-startNum)+";" +
// "更新前总数"+startNum+";" +
// "更新后总数"+endNum+";"; // 内容
// String linkUrl = ""; // PC端链接
// String linkMobileUrl = ""; // 移动端链接
try {
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, title, context, linkUrl, linkMobileUrl);
messageBean.setCreater(1);// 创建人id
//message.setBizState("0");// 需要修改消息为已处理等状态时传入,表示消息最初状态为待处理
// messageBean.setTargetId("121|22"); //消息来源code +“|”+业务id需要修改消息为已处理等状态时传入
Util_Message.store(messageBean);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 将 yyyy-MM-dd HH:mm 格式的字符串转换为 X年X月X日X时 的格式
* @param dateTimeStr 输入的日期时间字符串,格式为 yyyy-MM-dd HH:mm
* @return 转换后的日期时间字符串,格式为 X年X月X日X时
*/
public static String convertToChineseFormat(String dateTimeStr) {
try {
// 定义输入格式
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 将字符串解析为 LocalDateTime 对象
LocalDateTime dateTime = LocalDateTime.parse(dateTimeStr, inputFormatter);
// 自定义输出格式X年X月X日X时
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy年M月d日H时");
// 返回格式化后的字符串
return dateTime.format(outputFormatter);
} catch (DateTimeParseException e) {
// 如果输入格式错误,捕获异常并返回提示
return dateTimeStr;
}
}
private static String getShowNameByid(String fieldName, RecordSet rs){
if (StringUtil.isEmpty(fieldName) ){
return "";
}
if (fieldName.startsWith("hrmWorkcode_")){
int userid = Util.getIntValue(rs.getString(fieldName.split("_")[1]));
return new User(userid).getLoginid();
}else if(fieldName.startsWith("HrmLastName_")){
int userid = Util.getIntValue(rs.getString(fieldName.split("_")[1]));
return new User(userid).getLastname();
}else if(fieldName.startsWith("deptName_")){
String deptid = Util.null2String(rs.getString(fieldName.split("_")[1]));
return new DepartmentComInfo().getDepartmentmark(deptid);
}else{
return Util.null2String(rs.getString(fieldName));
}
}
%>

@ -0,0 +1,308 @@
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="com.wbi.util.ParamUtil" %>
<%@ page import="java.util.Map" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalTime" %>
<%@ page import="com.cloudstore.dev.api.bean.MessageType" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.HashSet" %>
<%@ page import="com.cloudstore.dev.api.bean.MessageBean" %>
<%@ page import="com.cloudstore.dev.api.util.Util_Message" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.time.format.DateTimeParseException" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="org.slf4j.LoggerFactory" %>
<%@ page import="org.slf4j.Logger" %>
<%@ page import="weaver.hrm.company.DepartmentComInfo" %>
<%@ page import="lombok.SneakyThrows" %>
<%@ page contentType="application/json charset=UTF-8" language="java" %>
<%
/****
* 发送消息通用工具类
*
*
* 参数:
* title:标题 支持表单字段 不为空 主表字段
* context:内容 支持表单字段 不为空 主表字段
* --字段为表单字段数据库名称
* 如果为人员浏览按钮或者部门浏览按钮,需要加前缀
* 人员工号 hrmWorkcode_表单字段
* 人员名称 HrmLastName_表单字段
* 部门名称 deptName_表单字段
* 后期可在
*
* linkUrl:PC端链接
* linkMobileUrl:移动端链接
* codeid:消息来源id 不为空
* billid:表单id 不为空时进行表单字段替换,
* 为空是默认跳过标题内容表单字段替换.
* formName:表单名称
* userid: 消息接收人 可以传userid或者userids(,分割)
* 表单字段的话就用 field_字段名称
*
*/
Logger log = LoggerFactory.getLogger("CustomBusiness");
Map<String, Object> param = ParamUtil.request2Map(request);
JSONObject result = new JSONObject();
String ids = Util.null2String(param.get("billids"));
String title = Util.null2String(param.get("title"));
String context = Util.null2String(param.get("context"));
String linkUrl = Util.null2String(param.get("linkUrl"));
String linkMobileUrl = Util.null2String(param.get("linkMobileUrl"));
int codeid = Util.getIntValue(Util.null2String(param.get("codeid")));
String formName = Util.null2String(param.get("formName"));
String userid = Util.null2String(param.get("userid"));
log.info("billids:{}",ids);
int sendNum = 0;
int successNum = 0;
if (StringUtil.isEmpty(ids)){
result.put("code", "E");
result.put("msg", "单据id为空");
out.print(result.toJSONString());
return;
}else {
RecordSet rs = new RecordSet();
rs.executeQuery("select * from "+ formName +" where id in ( " + ids + " )" );
while (rs.next()){
sendNum++;
//调换下表单字段
String contextStr = replaceVariablesByRs(context, rs);
String titleStr = replaceVariablesByRs(title, rs);
// 判断下接收人是否为表单字段
String sender = "";
if (userid.startsWith("field_")){
sender= Util.null2String(rs.getString(userid.split("_")[1]));
}else {
sender = userid;
}
log.info("userid:{}",userid);
log.info("codeid:{}",codeid);
log.info("title:{}",title);
log.info("context:{}",context);
log.info("titleStr:{}",titleStr);
log.info("contextStr:{}",contextStr);
log.info("linkUrl:{}",linkUrl);
log.info("linkMobileUrl:{}",linkMobileUrl);
sendMsg(sender+"",codeid,titleStr,contextStr,linkUrl,linkMobileUrl);
successNum++;
// }
}
}
result.put("code", "S");
result.put("msg","提醒发送成功");
result.put("sendNum",sendNum);
result.put("successNum",successNum);
out.print(result.toJSONString());
%>
<%!
private static Map<String, String> getScheduleParam(String pointId) throws Exception {
RecordSet rs = new RecordSet();
rs.executeQuery("select id from schedulesetting where POINTID = ?", pointId);
String setid = "";
if (rs.next()) {
setid = rs.getString("id");
}else {
throw new Exception("未查询到对应配置");
}
rs.executeQuery("select * from schedulesettingdetail where SCHEDULEDBID = ? ",setid);
HashMap<String, String> map = new HashMap<>();
while (rs.next()){
map.put(rs.getString("ATTRNAME"),rs.getString("ATTRVALUE"));
}
return map;
}
/**
* 替换字符串中的${变量名}为Map中对应的值
* @param template 字符串模板,包含${变量名}
* @param variables 包含变量名和对应值的Map
* @return 替换后的字符串
*/
public static String replaceVariables(String template, Map<String, String> variables) {
// 定义匹配 ${变量名} 的正则表达式
Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z0-9_]+)\\}");
Matcher matcher = pattern.matcher(template);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
// 获取变量名
String variableName = matcher.group(1);
// 从Map中获取变量的值如果不存在则使用空字符串
String replacement = variables.getOrDefault(variableName, "");
// 替换 ${变量名} 为对应的值
matcher.appendReplacement(result, replacement);
}
// 将剩余的字符串附加到结果中
matcher.appendTail(result);
return result.toString();
}
/**
* 替换字符串中的${变量名}为Map中对应的值
* @param template 字符串模板,包含${变量名}
* @param rs 查询完的数据库对象
* @return 替换后的字符串
*/
public static String replaceVariablesByRs(String template, RecordSet rs) {
// 定义匹配 ${变量名} 的正则表达式
Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z0-9_]+)\\}");
Matcher matcher = pattern.matcher(template);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
// 获取变量名
String variableName = matcher.group(1);
// 从RecordSet中获取变量的值如果不存在则使用空字符串
String replacement = Util.null2String(getShowNameByid(variableName,rs));
// 替换 ${变量名} 为对应的值
matcher.appendReplacement(result, replacement);
}
// 将剩余的字符串附加到结果中
matcher.appendTail(result);
return result.toString();
}
/**
* 获取当前日期,格式为 yyyy-MM-dd
* @return 当前日期的字符串
*/
public static String getCurrentDate() {
// 获取当前日期时间
LocalDateTime now = LocalDateTime.now();
// 定义日期格式
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 格式化日期
return now.format(dateFormatter);
}
/**
* 获取当前日期的开始时间即00:00
* @return 当前日期的开始时间,格式为 yyyy-MM-dd HH:mm
*/
public static String getStartOfDay() {
// 获取当前日期
LocalDateTime startOfDay = LocalDateTime.now().with(LocalTime.MIN);
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化开始时间
return startOfDay.format(formatter);
}
/**
* 获取当前日期的最后一分钟的时间即23:59
* @return 当前日期的最后一分钟时间,格式为 yyyy-MM-dd HH:mm
*/
public static String getEndOfDay() {
// 获取当前日期
LocalDateTime endOfDay = LocalDateTime.now().with(LocalTime.MAX);
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化最后一分钟的时间
return endOfDay.format(formatter);
}
/**
* 获取当前日期和时间,格式为 yyyy-MM-dd HH:mm
* @return 当前日期和时间的字符串
*/
public static String getCurrentDateTime() {
// 获取当前日期时间
LocalDateTime now = LocalDateTime.now();
// 定义日期时间格式
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化日期时间
return now.format(dateTimeFormatter);
}
private void sendMsg(String userid , int codeid , String title , String context , String linkUrl ,String linkMobileUrl){
MessageType messageType = MessageType.newInstance(codeid); // 消息来源(见文档第四点补充 必填)
Set<String> userIdList = new HashSet<>(); // 接收人id 必填
// userIdList.add(userid);
String[] useridArr = userid.split(",");
for (String s : useridArr) {
userIdList.add(s);
}
// String title = "个人周报更新提醒"; // 标题
// String context = "本次周报新增"+(endNum-startNum)+";" +
// "更新前总数"+startNum+";" +
// "更新后总数"+endNum+";"; // 内容
// String linkUrl = ""; // PC端链接
// String linkMobileUrl = ""; // 移动端链接
try {
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, title, context, linkUrl, linkMobileUrl);
messageBean.setCreater(1);// 创建人id
//message.setBizState("0");// 需要修改消息为已处理等状态时传入,表示消息最初状态为待处理
// messageBean.setTargetId("121|22"); //消息来源code +“|”+业务id需要修改消息为已处理等状态时传入
Util_Message.store(messageBean);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 将 yyyy-MM-dd HH:mm 格式的字符串转换为 X年X月X日X时 的格式
* @param dateTimeStr 输入的日期时间字符串,格式为 yyyy-MM-dd HH:mm
* @return 转换后的日期时间字符串,格式为 X年X月X日X时
*/
public static String convertToChineseFormat(String dateTimeStr) {
try {
// 定义输入格式
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 将字符串解析为 LocalDateTime 对象
LocalDateTime dateTime = LocalDateTime.parse(dateTimeStr, inputFormatter);
// 自定义输出格式X年X月X日X时
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy年M月d日H时");
// 返回格式化后的字符串
return dateTime.format(outputFormatter);
} catch (DateTimeParseException e) {
// 如果输入格式错误,捕获异常并返回提示
return dateTimeStr;
}
}
private static String getShowNameByid(String fieldName, RecordSet rs){
if (StringUtil.isEmpty(fieldName) ){
return "";
}
if (fieldName.startsWith("hrmWorkcode_")){
int userid = Util.getIntValue(rs.getString(fieldName.split("_")[1]));
return new User(userid).getLoginid();
}else if(fieldName.startsWith("HrmLastName_")){
int userid = Util.getIntValue(rs.getString(fieldName.split("_")[1]));
return new User(userid).getLastname();
}else if(fieldName.startsWith("deptName_")){
String deptid = Util.null2String(rs.getString(fieldName.split("_")[1]));
return new DepartmentComInfo().getDepartmentmark(deptid);
}else{
return Util.null2String(rs.getString(fieldName));
}
}
%>

@ -0,0 +1,232 @@
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="com.wbi.util.ParamUtil" %>
<%@ page import="java.util.Map" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalTime" %>
<%@ page import="com.cloudstore.dev.api.bean.MessageType" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.HashSet" %>
<%@ page import="com.cloudstore.dev.api.bean.MessageBean" %>
<%@ page import="com.cloudstore.dev.api.util.Util_Message" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.time.format.DateTimeParseException" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="org.slf4j.LoggerFactory" %>
<%@ page import="org.slf4j.Logger" %>
<%@ page contentType="application/json charset=UTF-8" language="java" %>
<%
Logger log = LoggerFactory.getLogger("CustomBusiness");
Map<String, Object> param = ParamUtil.request2Map(request);
JSONObject result = new JSONObject();
String id = Util.null2String(param.get("billid"));
log.info("billid:{}",id);
if (StringUtil.isEmpty(id)) {
result.put("code", "E");
result.put("msg", "单据id为空");
out.print(result.toJSONString());
return;
}
// Map<String, String> scheduleParam = null;
// try {
// scheduleParam = getScheduleParam("ReadReminderCorn");
// } catch (Exception e) {
// e.printStackTrace();
// result.put("code", "E");
// result.put("msg", e.getMessage());
// out.print(result.toJSONString());
// return;
// }
//不取定时任务中的配置项,写死
String title = "涉密文件阅件提醒";
String context = "${userName},您好,您有一份文号为\"${wh}\"的文件需要办理,请尽快到保密室阅处。";
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_readRemind where id = ? ", id);
if(rs.next()){
int dyrxm = Util.getIntValue(rs.getString("dyrxm"));
String dymwwh = Util.null2String(rs.getString("dymwwh"));
String sfsdcftx = Util.null2String(rs.getString("sfsdcftx"));
// if ("0".equals(sfsdcftx)){
// result.put("code", "E");
// result.put("msg","当前数据已经提醒过了");
// out.print(result.toJSONString());
// return;
// }else {
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("userName",new User(dyrxm).getLastname());
paramMap.put("wh",dymwwh);
String contextStr = replaceVariables(context, paramMap);
log.info("dyrxm:{}",dyrxm);
log.info("codeid:[}",2198);
log.info("title:{}",title);
log.info("contextStr:{}",contextStr);
sendMsg(dyrxm+"",2198,title,contextStr);
// }
}
result.put("code", "S");
result.put("msg","提醒发送成功");
out.print(result.toJSONString());
%>
<%!
private static Map<String, String> getScheduleParam(String pointId) throws Exception {
RecordSet rs = new RecordSet();
rs.executeQuery("select id from schedulesetting where POINTID = ?", pointId);
String setid = "";
if (rs.next()) {
setid = rs.getString("id");
}else {
throw new Exception("未查询到对应配置");
}
rs.executeQuery("select * from schedulesettingdetail where SCHEDULEDBID = ? ",setid);
HashMap<String, String> map = new HashMap<>();
while (rs.next()){
map.put(rs.getString("ATTRNAME"),rs.getString("ATTRVALUE"));
}
return map;
}
/**
* 替换字符串中的${变量名}为Map中对应的值
* @param template 字符串模板,包含${变量名}
* @param variables 包含变量名和对应值的Map
* @return 替换后的字符串
*/
public static String replaceVariables(String template, Map<String, String> variables) {
// 定义匹配 ${变量名} 的正则表达式
Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z0-9_]+)\\}");
Matcher matcher = pattern.matcher(template);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
// 获取变量名
String variableName = matcher.group(1);
// 从Map中获取变量的值如果不存在则使用空字符串
String replacement = variables.getOrDefault(variableName, "");
// 替换 ${变量名} 为对应的值
matcher.appendReplacement(result, replacement);
}
// 将剩余的字符串附加到结果中
matcher.appendTail(result);
return result.toString();
}
/**
* 获取当前日期,格式为 yyyy-MM-dd
* @return 当前日期的字符串
*/
public static String getCurrentDate() {
// 获取当前日期时间
LocalDateTime now = LocalDateTime.now();
// 定义日期格式
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 格式化日期
return now.format(dateFormatter);
}
/**
* 获取当前日期的开始时间即00:00
* @return 当前日期的开始时间,格式为 yyyy-MM-dd HH:mm
*/
public static String getStartOfDay() {
// 获取当前日期
LocalDateTime startOfDay = LocalDateTime.now().with(LocalTime.MIN);
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化开始时间
return startOfDay.format(formatter);
}
/**
* 获取当前日期的最后一分钟的时间即23:59
* @return 当前日期的最后一分钟时间,格式为 yyyy-MM-dd HH:mm
*/
public static String getEndOfDay() {
// 获取当前日期
LocalDateTime endOfDay = LocalDateTime.now().with(LocalTime.MAX);
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化最后一分钟的时间
return endOfDay.format(formatter);
}
/**
* 获取当前日期和时间,格式为 yyyy-MM-dd HH:mm
* @return 当前日期和时间的字符串
*/
public static String getCurrentDateTime() {
// 获取当前日期时间
LocalDateTime now = LocalDateTime.now();
// 定义日期时间格式
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化日期时间
return now.format(dateTimeFormatter);
}
private void sendMsg(String userid , int codeid , String title , String context){
MessageType messageType = MessageType.newInstance(codeid); // 消息来源(见文档第四点补充 必填)
Set<String> userIdList = new HashSet<>(); // 接收人id 必填
userIdList.add(userid);
// String[] useridArr = userid.split(",");
// for (String s : useridArr) {
// userIdList.add(s);
// }
// String title = "个人周报更新提醒"; // 标题
// String context = "本次周报新增"+(endNum-startNum)+";" +
// "更新前总数"+startNum+";" +
// "更新后总数"+endNum+";"; // 内容
String linkUrl = ""; // PC端链接
String linkMobileUrl = ""; // 移动端链接
try {
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, title, context, linkUrl, linkMobileUrl);
messageBean.setCreater(1);// 创建人id
//message.setBizState("0");// 需要修改消息为已处理等状态时传入,表示消息最初状态为待处理
// messageBean.setTargetId("121|22"); //消息来源code +“|”+业务id需要修改消息为已处理等状态时传入
Util_Message.store(messageBean);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 将 yyyy-MM-dd HH:mm 格式的字符串转换为 X年X月X日X时 的格式
* @param dateTimeStr 输入的日期时间字符串,格式为 yyyy-MM-dd HH:mm
* @return 转换后的日期时间字符串,格式为 X年X月X日X时
*/
public static String convertToChineseFormat(String dateTimeStr) {
try {
// 定义输入格式
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 将字符串解析为 LocalDateTime 对象
LocalDateTime dateTime = LocalDateTime.parse(dateTimeStr, inputFormatter);
// 自定义输出格式X年X月X日X时
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy年M月d日H时");
// 返回格式化后的字符串
return dateTime.format(outputFormatter);
} catch (DateTimeParseException e) {
// 如果输入格式错误,捕获异常并返回提示
return dateTimeStr;
}
}
%>

@ -0,0 +1,239 @@
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="com.wbi.util.ParamUtil" %>
<%@ page import="java.util.Map" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalTime" %>
<%@ page import="com.cloudstore.dev.api.bean.MessageType" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.HashSet" %>
<%@ page import="com.cloudstore.dev.api.bean.MessageBean" %>
<%@ page import="com.cloudstore.dev.api.util.Util_Message" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.time.format.DateTimeParseException" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="org.slf4j.LoggerFactory" %>
<%@ page import="org.slf4j.Logger" %>
<%@ page contentType="application/json charset=UTF-8" language="java" %>
<%
Logger log = LoggerFactory.getLogger("CustomBusiness");
Map<String, Object> param = ParamUtil.request2Map(request);
JSONObject result = new JSONObject();
String ids = Util.null2String(param.get("billids"));
log.info("billids:{}",ids);
if (StringUtil.isEmpty(ids)) {
result.put("code", "E");
result.put("msg", "单据id为空");
out.print(result.toJSONString());
return;
}
// Map<String, String> scheduleParam = null;
// try {
// scheduleParam = getScheduleParam("ReadReminderCorn");
// } catch (Exception e) {
// e.printStackTrace();
// result.put("code", "E");
// result.put("msg", e.getMessage());
// out.print(result.toJSONString());
// return;
// }
//不取定时任务中的配置项,写死
String title = "涉密文件阅件提醒";
String context = "${userName},您好,您有一份文号为\"${wh}\"的文件需要办理,请尽快到保密室阅处。";
log.info("codeid:{}",2198);
log.info("title:{}",title);
RecordSet rs = new RecordSet();
int sendNum = 0;
int successNum = 0;
rs.executeQuery("select * from uf_readRemind where id in ( " + ids + " )" );
while(rs.next()){
sendNum++;
int dyrxm = Util.getIntValue(rs.getString("dyrxm"));
String dymwwh = Util.null2String(rs.getString("dymwwh"));
String sfsdcftx = Util.null2String(rs.getString("sfsdcftx"));
// if ("0".equals(sfsdcftx)){
// result.put("code", "E");
// result.put("msg","当前数据已经提醒过了");
// out.print(result.toJSONString());
// return;
// }else {
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("userName",new User(dyrxm).getLastname());
paramMap.put("wh",dymwwh);
String contextStr = replaceVariables(context, paramMap);
log.info("dyrxm:{}",dyrxm);
log.info("contextStr:{}",contextStr);
sendMsg(dyrxm+"",2198,title,contextStr);
successNum++;
// }
}
result.put("code", "S");
result.put("msg","提醒发送成功");
result.put("sendNum",sendNum);
result.put("successNum",successNum);
out.print(result.toJSONString());
%>
<%!
private static Map<String, String> getScheduleParam(String pointId) throws Exception {
RecordSet rs = new RecordSet();
rs.executeQuery("select id from schedulesetting where POINTID = ?", pointId);
String setid = "";
if (rs.next()) {
setid = rs.getString("id");
}else {
throw new Exception("未查询到对应配置");
}
rs.executeQuery("select * from schedulesettingdetail where SCHEDULEDBID = ? ",setid);
HashMap<String, String> map = new HashMap<>();
while (rs.next()){
map.put(rs.getString("ATTRNAME"),rs.getString("ATTRVALUE"));
}
return map;
}
/**
* 替换字符串中的${变量名}为Map中对应的值
* @param template 字符串模板,包含${变量名}
* @param variables 包含变量名和对应值的Map
* @return 替换后的字符串
*/
public static String replaceVariables(String template, Map<String, String> variables) {
// 定义匹配 ${变量名} 的正则表达式
Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z0-9_]+)\\}");
Matcher matcher = pattern.matcher(template);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
// 获取变量名
String variableName = matcher.group(1);
// 从Map中获取变量的值如果不存在则使用空字符串
String replacement = variables.getOrDefault(variableName, "");
// 替换 ${变量名} 为对应的值
matcher.appendReplacement(result, replacement);
}
// 将剩余的字符串附加到结果中
matcher.appendTail(result);
return result.toString();
}
/**
* 获取当前日期,格式为 yyyy-MM-dd
* @return 当前日期的字符串
*/
public static String getCurrentDate() {
// 获取当前日期时间
LocalDateTime now = LocalDateTime.now();
// 定义日期格式
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 格式化日期
return now.format(dateFormatter);
}
/**
* 获取当前日期的开始时间即00:00
* @return 当前日期的开始时间,格式为 yyyy-MM-dd HH:mm
*/
public static String getStartOfDay() {
// 获取当前日期
LocalDateTime startOfDay = LocalDateTime.now().with(LocalTime.MIN);
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化开始时间
return startOfDay.format(formatter);
}
/**
* 获取当前日期的最后一分钟的时间即23:59
* @return 当前日期的最后一分钟时间,格式为 yyyy-MM-dd HH:mm
*/
public static String getEndOfDay() {
// 获取当前日期
LocalDateTime endOfDay = LocalDateTime.now().with(LocalTime.MAX);
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化最后一分钟的时间
return endOfDay.format(formatter);
}
/**
* 获取当前日期和时间,格式为 yyyy-MM-dd HH:mm
* @return 当前日期和时间的字符串
*/
public static String getCurrentDateTime() {
// 获取当前日期时间
LocalDateTime now = LocalDateTime.now();
// 定义日期时间格式
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 格式化日期时间
return now.format(dateTimeFormatter);
}
private void sendMsg(String userid , int codeid , String title , String context){
MessageType messageType = MessageType.newInstance(codeid); // 消息来源(见文档第四点补充 必填)
Set<String> userIdList = new HashSet<>(); // 接收人id 必填
userIdList.add(userid);
// String[] useridArr = userid.split(",");
// for (String s : useridArr) {
// userIdList.add(s);
// }
// String title = "个人周报更新提醒"; // 标题
// String context = "本次周报新增"+(endNum-startNum)+";" +
// "更新前总数"+startNum+";" +
// "更新后总数"+endNum+";"; // 内容
String linkUrl = ""; // PC端链接
String linkMobileUrl = ""; // 移动端链接
try {
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, title, context, linkUrl, linkMobileUrl);
messageBean.setCreater(1);// 创建人id
//message.setBizState("0");// 需要修改消息为已处理等状态时传入,表示消息最初状态为待处理
// messageBean.setTargetId("121|22"); //消息来源code +“|”+业务id需要修改消息为已处理等状态时传入
Util_Message.store(messageBean);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 将 yyyy-MM-dd HH:mm 格式的字符串转换为 X年X月X日X时 的格式
* @param dateTimeStr 输入的日期时间字符串,格式为 yyyy-MM-dd HH:mm
* @return 转换后的日期时间字符串,格式为 X年X月X日X时
*/
public static String convertToChineseFormat(String dateTimeStr) {
try {
// 定义输入格式
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
// 将字符串解析为 LocalDateTime 对象
LocalDateTime dateTime = LocalDateTime.parse(dateTimeStr, inputFormatter);
// 自定义输出格式X年X月X日X时
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy年M月d日H时");
// 返回格式化后的字符串
return dateTime.format(outputFormatter);
} catch (DateTimeParseException e) {
// 如果输入格式错误,捕获异常并返回提示
return dateTimeStr;
}
}
%>

@ -0,0 +1,42 @@
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.wbi.util.ParamUtil" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.workflow.workflow.WorkflowComInfo" %>
<%@ page import="weaver.workflow.workflow.WorkflowBillComInfo" %>
<%@ page import="com.api.formmode.page.util.Util" %>
<%@ page import="weaver.workflow.workflow.WorkflowVersion" %>
<%@ page import="java.util.*" %>
<%@ page import="com.icbc.api.internal.apache.http.E" %>
<%@page contentType="text/html; charset=UTF-8" %>
<%
HashMap<String, Object> result = new HashMap<>();
try {
String parameter = request.getParameter("nodeid");
List<String> relationNodeListByNodeID = WorkflowVersion.getRelationNodeListByNodeID(parameter);
RecordSet rs = new RecordSet();
rs.executeQuery("select count(id) cnt from uf_xsxgbdanjd where nodeid in ( "+ String.join(",",relationNodeListByNodeID) +" )");
rs.next();
int cnt = rs.getInt("cnt");
if (cnt > 0){
result.put("code","200");
result.put("isShow",true);
}else {
result.put("code","200");
result.put("isShow",false);
}
}catch (Exception e){
result.put("code","500");
result.put("isShow",false);
result.put("msg",e.getMessage());
}
out.print(JSONObject.toJSONString(result));
%>
<%!
%>

@ -0,0 +1,464 @@
<%@ page import="com.wbi.util.ParamUtil" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.workflow.workflow.WorkflowComInfo" %>
<%@ page import="weaver.workflow.workflow.WorkflowBillComInfo" %>
<%@ page import="weaver.conn.BatchRecordSet" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="org.slf4j.LoggerFactory" %>
<%@ page import="org.slf4j.Logger" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@page contentType="text/html; charset=UTF-8" %>
<%
Logger log = LoggerFactory.getLogger("CustomBusiness");
Map<String, Object> param = ParamUtil.request2Map(request);
String requestid = Util.null2String(param.get("requestid"));
String workflowid = Util.null2String(param.get("workflowid"));
Object formid = param.get("formid");
Object nodeid = param.get("nodeid");
log.info("requestparam:{}", param);
HashMap<String, String> newFieldInfo = new HashMap<>();
HashMap<String, String> oldFieldInfo = new HashMap<>();
int userid = HrmUserVarify.getUser(request, response).getUID();
String clientIp = getClientIp(request);
String newRequestName = "";
//判断下是否需要修改流程标题
if (!StringUtil.isEmpty(Util.null2String(param.get("field_requestName")))){
newRequestName = Util.null2String(param.get("field_requestName"));
}
//将字段信息封装进fieldInfo
param.forEach((k, v) -> {
if (k.startsWith("field_")) {
String fieldName = k.split("_")[1];
if (!"requestName".equals(fieldName)){
newFieldInfo.put(fieldName, Util.null2String(v));
}
}
});
HashMap<Object, Object> map = new HashMap<>();
map.put("requestid", requestid);
map.put("workflowid", workflowid);
map.put("formid", formid);
map.put("nodeid", nodeid);
//获取表单名称
WorkflowComInfo wf = new WorkflowComInfo();
WorkflowBillComInfo wcInfo = new WorkflowBillComInfo();
String formId = wf.getFormId(workflowid);
String tablename = wcInfo.getTablename(formId);
// 查询数据,记录原始数据;
RecordSet rs = new RecordSet();
rs.executeQuery("select * from " + tablename + " where requestid = ? ", requestid);
log.info("查询数据sql:select * from " + tablename + " where requestid = {} ", requestid);
if (rs.next()) {
for (String fieldName : newFieldInfo.keySet()) {
String oldValue = rs.getString(fieldName);
oldFieldInfo.put(fieldName, oldValue);
}
}
//更新主流程表单数据 -- start
ArrayList<String> updateParam = new ArrayList<>();
ArrayList<String> updateField = new ArrayList<>();
for (String fieldName : newFieldInfo.keySet()) {
updateField.add(fieldName + " = ? ");
updateParam.add(newFieldInfo.get(fieldName));
}
updateParam.add(requestid);
String updateFormSql = String.format(" UPDATE %s SET %s WHERE requestid = ? ", tablename, String.join(",", updateField));
log.info("updateFormSql:{}", updateFormSql);
log.info("updateParam.toArray():{}", updateParam.toArray());
rs.executeUpdate(updateFormSql, updateParam.toArray());
log.info("updateFormSql.getExceptionMsg:{}", rs.getExceptionMsg());
//记录日志
String maxid = insertMainReqLog(requestid, oldFieldInfo, updateFormSql, updateParam ,userid,clientIp);
//更新主流程表单数据 -- end
// 开始处理子流程数据 -- start
//查询出当前流程的所有子流程
//获取当前流程的子流程
//封装一个map,key为流程id,value为请求id的List
HashMap<String, List<String>> wfid_subrequestidMap = new HashMap<>();
HashMap<String, List<String>> subrequestid_wfidMap = new HashMap<>();
// rs.executeQuery("select * from WORKFLOW_REQUESTBASE where MAINREQUESTID = ?", requestid);
// while (rs.next()) {
// String subworkflowid = rs.getString("WORKFLOWID");
// if (wfid_subrequestidMap.get(subworkflowid) == null) {
// ArrayList<String> subrequestids = new ArrayList<>();
// subrequestids.add(rs.getString("REQUESTID"));
// wfid_subrequestidMap.put(subworkflowid, subrequestids);
// } else {
// wfid_subrequestidMap.get(subworkflowid).add(rs.getString("REQUESTID"));
// }
// }
getAllSubReqs(requestid,workflowid,wfid_subrequestidMap);
log.info("wfid_subrequestidMap:{}", wfid_subrequestidMap);
String sep = Util.getSeparator() + "";
BatchRecordSet batchRecordSet = new BatchRecordSet();
ArrayList<String> updateSetfield = null;
for (String wfkey : wfid_subrequestidMap.keySet()) {
String[] key = wfkey.split("_");
// String mainwfid = sp[0];
String subwfid = key[key.length-1];
String subformId = wf.getFormId(subwfid);
String subTablename = wcInfo.getTablename(subformId);
updateField = new ArrayList<>();
updateSetfield = new ArrayList<>();
String updateParamStr = "";
// 查询当前流程和子流程的字段对应关系
Map<String, String> fieldSetInfo = getFieldSetInfo(wfkey,newFieldInfo);
log.info("fieldSetInfo:{}", fieldSetInfo);
for (String fieldName : newFieldInfo.keySet()) {
if (fieldSetInfo.get(fieldName) != null) {
String subfieldName = fieldSetInfo.get(fieldName);
updateField.add(subfieldName + " = ?");
updateSetfield.add(subfieldName);
if (StringUtil.isEmpty(updateParamStr)) {
updateParamStr = newFieldInfo.get(fieldName);
} else {
updateParamStr += sep + newFieldInfo.get(fieldName);
}
}
}
if (updateSetfield.size() == 0 ){
continue;
}
String updateSubReqFormSql = String.format(" UPDATE %s SET %s WHERE requestid = ? ", subTablename, String.join(",", updateField));
log.info("updateSubReqFormSql:{}", updateSubReqFormSql);
//开始处理子流程
String updateSetfieldStr = String.join(",", updateSetfield);
ArrayList<String> updateParamList = new ArrayList<>();
List<String> subrequestids = wfid_subrequestidMap.get(wfkey);
log.info("subrequestids:{}",subrequestids);
HashMap<String, String> reqid_oldValueMap = new HashMap<>();
for (String subrequestid : subrequestids) {
// 查询下原始数据
String oldValueStr = "";
rs.executeQuery("select " + updateSetfieldStr + "from "+subTablename+" where requestid = ? ", subrequestid);
rs.next();
for (String field : updateSetfield) {
if (StringUtil.isEmpty(oldValueStr)) {
oldValueStr = field + "=" + rs.getString(field);
} else {
oldValueStr += "," + field + "=" + rs.getString(field);
}
}
reqid_oldValueMap.put(subrequestid,oldValueStr);
//更新字段参数
String paramStr = updateParamStr + sep + subrequestid;
log.info("paramStr:{}", paramStr);
updateParamList.add(paramStr);
}
batchRecordSet.executeSqlBatchNew(updateSubReqFormSql, updateParamList);
insertsubReqLog(maxid,reqid_oldValueMap,updateSubReqFormSql,updateParamList,batchRecordSet);
}
// out.print(rs.getMsg());
//表单字段处理结束,开始处理流程标题
if(!StringUtil.isEmpty(newRequestName)){
updateRequestNameAllReq(newRequestName,requestid,wfid_subrequestidMap,maxid)
}
%>
<%!
//更新涉及到的流程的流程标题
private void updateRequestNameAllReq(String newRequestName, String requestid, HashMap<String, List<String>> wfid_subrequestidMap, String maxid) {
RecordSet rs = new RecordSet();
//用于记录插入日志表的字符串参数list
ArrayList<String> logParamStrs = new ArrayList<>();
//主要更新workflow_requestBase的字段
//REQUESTNAME ,REQUESTNAMENEW,REQUESTNAMEHTMLNEW
// 先更新主流程
//更新主流程RequestName
updateRequestNameByRequestId(newRequestName,requestid,maxid,rs,logParamStrs);
//开始更新子流程
for (List<String> value : wfid_subrequestidMap.values()) {
for (String subreqid : value) {
updateRequestNameByRequestId(newRequestName,subreqid,maxid,rs,logParamStrs);
}
}
String sql = "insert into uf_updateFormLog_dt1 (mainid,lcid,xgqdz,xgsql,sqlcs) values (?,?,?,?,?) ";
BatchRecordSet batchRecordSet = new BatchRecordSet();
boolean b = batchRecordSet.executeSqlBatchNew(sql, logParamStrs);
log.info("updateRequestNameAllReq.executeSqlBatchNew.result:{}",b);
}
private void updateRequestNameByRequestId(String newRequestName, String requestid,String maxid, RecordSet rs, ArrayList<String> logParamStrs) {
log.info("updateRequestNameByRequestId:requestid:{}",requestid);
rs.executeQuery("select REQUESTNAME ,REQUESTNAMENEW,REQUESTNAMEHTMLNEW from workflow_requestBase where requestid = ?" , requestid);
rs.next();
String requestname = Util.null2String(rs.getString("REQUESTNAME"));
String requestnamenew = Util.null2String(rs.getString("REQUESTNAMENEW"));
String requestnamehtmlnew = Util.null2String(rs.getString("REQUESTNAMEHTMLNEW"));
// 通过字符串替换获取新的标题
String update_requestnamenew = requestnamenew.replaceAll(requestname, newRequestName);
String update_requestnamehtmlnew = requestnamehtmlnew.replaceAll(requestname, newRequestName);
String updateSql = "update workflow_requestBase set REQUESTNAME = ? ,REQUESTNAMENEW = ? ,REQUESTNAMEHTMLNEW = ? where requestid = ?";
rs.executeUpdate(updateSql,newRequestName,update_requestnamenew,update_requestnamehtmlnew,requestid);
//拼接日志表的参数
String sep = Util.getSeparator() + "";
//
String param = maxid
+ sep + requestid
+ sep + "requestname:"+requestname + ",requestnamenew:"+requestnamenew+",requestnamehtmlnew"+requestnamehtmlnew
+ sep + updateSql
+ sep + newRequestName +"|"+ update_requestnamenew +"|"+ update_requestnamehtmlnew+"|"+requestid;
logParamStrs.add(param);
}
private void insertsubReqLog(String maxid, HashMap<String, String> reqid_oldValueMap, String updateFormSql, ArrayList<String> updateParam, BatchRecordSet batchRecordSet) {
log.info("insertsubReqLog:maxid:{}",maxid);
// RecordSet rs = new RecordSet();
String sql = "insert into uf_updateFormLog_dt1 (mainid,lcid,xgqdz,xgsql,sqlcs) values (?,?,?,?,?) ";
String sep = Util.getSeparator() + "";
ArrayList<String> insertParam = new ArrayList<>();
for (String paramStr : updateParam) {
String reqid = paramStr.substring(paramStr.lastIndexOf(sep) + 1);
String oldValue = reqid_oldValueMap.get(reqid);
String noSepParamStr = paramStr.replaceAll(sep,"|");
String insertParamStr = maxid + sep + reqid + sep + oldValue + sep + updateFormSql + sep + noSepParamStr;
insertParam.add(insertParamStr);
// rs.executeUpdate(sql,maxid,reqid,oldValue,updateFormSql,paramStr);
}
log.info("insertsubReqLog:insertParam.size:{}",insertParam.size());
boolean b = batchRecordSet.executeSqlBatchNew(sql, insertParam);
log.info("batchRecordSet.executeSqlBatchNew.result:{}",b);
}
private String insertMainReqLog(String requestid, HashMap<String, String> oldFieldInfo, String updateFormSql, ArrayList<String> updateParam, int userid, String clientIp) {
String maxid = "";
try {
RecordSet rs = new RecordSet();
rs.executeUpdate("insert into uf_updateFormLog (lcid , xgqdz ,xgsql,sqlcs,ip,czr) values (?,?,?,?,?,?)",requestid,oldFieldInfo.toString(),updateFormSql,String.join("|",updateParam),clientIp,userid);
rs.executeQuery("select max(id) id from uf_updateFormLog ");
rs.next();
maxid = Util.null2String(rs.getString("id"));
}catch (Exception e){
log.info("insertMainReqLog:error:{}",e.getMessage());
}
return maxid;
}
static Logger log = LoggerFactory.getLogger("CustomBusiness");
WorkflowComInfo wf = new WorkflowComInfo();
WorkflowBillComInfo wcInfo = new WorkflowBillComInfo();
private Map<String, String> getFieldSetInfo(String wfkey, HashMap<String, String> newFieldInfo) {
RecordSet rs = new RecordSet();
log.info("getFieldSetInfo:wfkey:{}",wfkey);
String[] key = wfkey.split("_");
log.info("getFieldSetInfo:key:{}",wfkey);
HashMap<String, String> fieldSetInfo = new HashMap<>();
for (int i = key.length - 1; i >= 1 ; i--) {
String mainwfid = key[i-1];;
String subwfid = key[i];
log.info("mainwfid:{}",mainwfid);
log.info("subwfid:{}",subwfid);
String activeVersionID = "";
rs.executeQuery("select ACTIVEVERSIONID from WORKFLOW_BASE where id = ? ", subwfid);
if (rs.next()) {
activeVersionID = rs.getString("ACTIVEVERSIONID");
}
log.info("activeVersionID:{}", activeVersionID);
rs.executeQuery("select * from WORKFLOW_BASE where ACTIVEVERSIONID = ? ", activeVersionID);
ArrayList<String> subwfids = new ArrayList<>();
while (rs.next()) {
subwfids.add(rs.getString("id"));
}
log.info("subwfids:{}", subwfids);
String setid = "";
rs.executeQuery("select * from workflow_subwfset where MAINWORKFLOWID = ? and SUBWORKFLOWID in ( " + String.join(",", subwfids) + " )", mainwfid);
if (rs.next()) {
setid = rs.getString("id");
}
log.info("setid:{}", setid);
rs.executeQuery("select b.FIELDNAME mainwfField,c.FIELDNAME subwfField, " +
" b.fieldhtmltype mainfieldhtmltype, " +
" c.fieldhtmltype subfieldhtmltype " +
" from workflow_subwfsetdetail a left join WORKFLOW_BILLFIELD b " +
" on a.MAINWORKFLOWFIELDID = b.ID " +
" left join WORKFLOW_BILLFIELD c " +
" on a.SUBWORKFLOWFIELDID = c.ID " +
" where SUBWFSETID = ? ", setid);
HashMap<String, String> tempfieldSetInfo = new HashMap<>();
while (rs.next()) {
//todo
//这里通过fieldhtmltype字段类型判断是否需要更新,如果字段类型不同就忽略,
//后期需优化,着急上线,先用这个方法简单判断下
String mainfieldhtmltype = Util.null2String(rs.getString("mainfieldhtmltype"));
String subfieldhtmltype = Util.null2String(rs.getString("subfieldhtmltype"));
if (mainfieldhtmltype.equals(subfieldhtmltype)) {
tempfieldSetInfo.put(rs.getString("mainwfField"), rs.getString("subwfField"));
}
}
if (fieldSetInfo.size() == 0){
fieldSetInfo = tempfieldSetInfo;
}else{
HashMap<String, String> map = new HashMap<>();
for (String mainwffield : tempfieldSetInfo.keySet()) {
String subwffield = tempfieldSetInfo.get(mainwffield);
map.put(mainwffield,fieldSetInfo.get(subwffield));
}
fieldSetInfo = map;
}
log.info("getFieldSetInfo:fieldSetInfo:{}",fieldSetInfo);
}
return fieldSetInfo;
}
/****
* 使用递归查询获取当前流程的所有子流程
* @return key 主流程wfid_子流程wfid value 子流程requestid的list
*/
// private static Map<String, List<String>> getAllSubReqs(String requestids, String mainwfId, Map<String, List<String>> wfid_subrequestidMap) {
//
// RecordSet rs = new RecordSet();
// rs.executeQuery("select * from WORKFLOW_REQUESTBASE where MAINREQUESTID in ( "+requestids+" )");
// int size = wfid_subrequestidMap.size();
// while (rs.next()) {
// String subworkflowid = rs.getString("WORKFLOWID");
// String wfIdKey = mainwfId + "_" + subworkflowid;
// if (wfid_subrequestidMap.get(wfIdKey) == null) {
// ArrayList<String> subrequestids = new ArrayList<>();
// subrequestids.add(rs.getString("REQUESTID"));
// wfid_subrequestidMap.put(wfIdKey, subrequestids);
// } else {
// wfid_subrequestidMap.get(wfIdKey).add(rs.getString("REQUESTID"));
// }
// }
// if (size != wfid_subrequestidMap.size()) {
// for (String wfkey : wfid_subrequestidMap.keySet()) {
// List<String> subrequestids = wfid_subrequestidMap.get(wfid_subrequestidMap);
// String join = String.join(",", subrequestids);
// getAllSubReqs(join,wfkey.split(",")[1],wfid_subrequestidMap);
// }
// }
// return wfid_subrequestidMap;
// }
// public static Map<String, List<String>> getAllSubReqs(String requestids, String mainwfId, Map<String, List<String>> wfid_subrequestidMap) {
// // 初始化一个队列来处理请求ID和相应的层级key
// Queue<Map.Entry<String, String>> requestQueue = new LinkedList<>();
// // 初始化一个集合来追踪已经处理过的工作流路径
// Set<String> processedKeys = new HashSet<>();
//
// // 将初始请求ID和mainwfId放入队列
// requestQueue.add(new AbstractMap.SimpleEntry<>(requestids, mainwfId));
//
// // 开始处理队列中的请求ID
// while (!requestQueue.isEmpty()) {
// Map.Entry<String, String> entry = requestQueue.poll();
// String currentRequestIds = entry.getKey();
// String currentKey = entry.getValue();
//
// processRequests(currentRequestIds, currentKey, wfid_subrequestidMap, processedKeys, requestQueue);
// }
//
// return wfid_subrequestidMap;
// }
//
// private static void processRequests(String requestids, String currentKey, Map<String, List<String>> wfid_subrequestidMap, Set<String> processedKeys, Queue<Map.Entry<String, String>> requestQueue) {
// RecordSet rs = new RecordSet();
// rs.executeQuery("select * from WORKFLOW_REQUESTBASE where MAINREQUESTID in (" + requestids + ")");
//
// // 处理查询结果集并更新映射表
// while (rs.next()) {
// String subworkflowid = rs.getString("WORKFLOWID");
// String newKey = currentKey + "_" + subworkflowid;
// String requestId = rs.getString("REQUESTID");
//
// // 如果该工作流路径还没有被处理过,处理并加入映射表
// if (!processedKeys.contains(newKey)) {
// processedKeys.add(newKey);
// wfid_subrequestidMap.computeIfAbsent(newKey, k -> new ArrayList<>()).add(requestId);
//
// // 将新的子请求ID和新生成的key放入队列中以便后续处理
// requestQueue.add(new AbstractMap.SimpleEntry<>(requestId, newKey));
// } else {
// // 如果已经处理过则只更新映射表中的请求ID列表
// wfid_subrequestidMap.get(newKey).add(requestId);
// }
// }
// }
public static Map<String, List<String>> getAllSubReqs(String requestids, String mainwfId, Map<String, List<String>> wfid_subrequestidMap) {
// 初始化一个集合来追踪已经处理过的工作流路径
Set<String> processedKeys = new HashSet<>();
// 开始递归处理主请求
processRequests(requestids, mainwfId, wfid_subrequestidMap, processedKeys);
return wfid_subrequestidMap;
}
private static void processRequests(String requestids, String currentKey, Map<String, List<String>> wfid_subrequestidMap, Set<String> processedKeys) {
RecordSet rs = new RecordSet();
rs.executeQuery("select * from WORKFLOW_REQUESTBASE where MAINREQUESTID in (" + requestids + ")");
// 处理查询结果集并更新映射表
while (rs.next()) {
String subworkflowid = rs.getString("WORKFLOWID");
String newKey = currentKey + "_" + subworkflowid;
String requestId = rs.getString("REQUESTID");
// 如果该工作流路径还没有被处理过,处理并加入映射表
if (!processedKeys.contains(newKey)) {
processedKeys.add(newKey);
wfid_subrequestidMap.computeIfAbsent(newKey, k -> new ArrayList<>()).add(requestId);
// 递归处理子请求构建下一层的key
processRequests(requestId, newKey, wfid_subrequestidMap, processedKeys);
} else {
// 如果已经处理过则只更新映射表中的请求ID列表
wfid_subrequestidMap.get(newKey).add(requestId);
}
}
}
public static String getClientIp(HttpServletRequest request) {
String ip = request.getHeader("X-Forwarded-For");
if (ip == null || ip.isEmpty() || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.isEmpty() || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.isEmpty() || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.isEmpty() || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.isEmpty() || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
return ip;
}
%>

@ -0,0 +1,178 @@
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.wbi.util.ParamUtil" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.workflow.workflow.WorkflowComInfo" %>
<%@ page import="weaver.workflow.workflow.WorkflowBillComInfo" %>
<%@ page import="com.api.formmode.page.util.Util" %>
<%@ page import="weaver.workflow.workflow.WorkflowVersion" %>
<%@ page import="java.util.*" %>
<%@ page import="com.icbc.api.internal.apache.http.E" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.page.interfaces.elementtemplate.util.WorkflowCount" %>
<%@ page import="weaver.workflow.request.WFUrgerManager" %>
<%@ page import="weaver.systeminfo.setting.HrmUserSettingComInfo" %>
<%@ page import="weaver.workflow.request.todo.RequestUtil" %>
<%@ page import="weaver.workflow.request.WFWorkflowTypes" %>
<%@ page import="weaver.workflow.request.WFWorkflows" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.synergy.SynergyOperatWorkflow" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="com.engine.tjyh.xc.util.HttpRequestUtil" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="com.engine.tjyh.xc.util.WorkflowCreateHandler" %>
<%@ page import="com.api.browser.bean.BrowserValueInfo" %>
<%@ page import="com.api.browser.service.BrowserValueInfoService" %>
<%@page contentType="text/html; charset=UTF-8" %>
<%
HttpRequestUtil httpRequestUtil = HttpRequestUtil.getInstance();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
Map<String, Object> apimap = new HashMap<String, Object>();
String appKey = bb.getPropValue("tjyhxcjc","appKey");
String appSecurity = bb.getPropValue("tjyhxcjc","appSecurity");
String url = bb.getPropValue("tjyhxcjc","url");
String orderurl = bb.getPropValue("tjyhxcjc","orderurl");
String workflowId = bb.getPropValue("tjyhxcjc","workflowId");
WorkflowCreateHandler handler = new WorkflowCreateHandler();
String tablename = handler.findWorkflowForm(workflowId);
HashMap<String, String> map = new HashMap<>();
map.put("ccr","758");
map.put("cbzx","23");
String IsNextFlow = "0";
String title = handler.bulidWorkflowTitle(workflowId,"758");
String requestId = handler.WorkflowCreateByRequestMap("758",workflowId,title,IsNextFlow,map);
updateLeftTreeInfo(requestId,workflowId);
out.print(requestId);
%>
<%!
//保存自定义左侧树信息到requestbase表
private static void updateLeftTreeInfo(String requestid, String workflowid){
BaseBean baseBean = new BaseBean();
RecordSet rs = new RecordSet();
RecordSet rs1 = new RecordSet();
WorkflowBillComInfo wbInfo = new WorkflowBillComInfo();
WorkflowComInfo wcInfo = new WorkflowComInfo();
int formid = weaver.general.Util.getIntValue(wcInfo.getFormId(workflowid+""));
String tablename = wbInfo.getTablename(formid + "");
String workflowname = wcInfo.getWorkflowname(workflowid + "");
rs.executeQuery("select id,sfzxsw,secondfieldname,thirdfieldname,showname,doingwfids,donewfids,sencondIsGroupbyFieldname from uf_treelistsetting ");
baseBean.writeLog("---LHSP2021----requestid==="+requestid+"----selectSql===="+"select id,sfzxsw,secondfieldname,thirdfieldname,showname from uf_treelistsetting where (','||doingwfids||',' like '%,"+workflowid+",%') or (','||donewfids||',' like '%,"+workflowid+",%')");
while (rs.next()){
String id = rs.getString(1);
int sfzxsw = rs.getInt(2);
String secondfieldname = rs.getString(3);
String thirdfieldname = rs.getString(4);
String showname = rs.getString(5);
String doingwfids1 = weaver.general.Util.null2String(rs.getString(6));
String donewfids1 = weaver.general.Util.null2String(rs.getString(7));
List<String> list = Arrays.asList(doingwfids1.split(","));
List<String> list1 = Arrays.asList(donewfids1.split(","));
HashSet<String> set = new HashSet<>();
set.addAll(WorkflowVersion.getVersionStringByWfid4List(list));
set.addAll(WorkflowVersion.getVersionStringByWfid4List(list1));
if (set.contains(workflowid+"")) {
if (sfzxsw == 1) {
String secondShowName = "";
String secondValue = "";
String secondFieldId = "";
String thirdValue = "";
String thirdFieldType = "";
String thirdFieldDBType = "";
String thirdShowName = "";
rs1.executeQuery("select id from workflow_billfield where fieldname = ? and billid = ?", secondfieldname, formid);
if (rs1.next()) {
secondFieldId = rs1.getString(1);
}
baseBean.writeLog("---LHSP2021----requestid===" + requestid + "----secondFieldId====" + secondFieldId);
rs1.executeQuery("select type,fielddbtype from workflow_billfield where fieldname = ? and billid = ?", thirdfieldname, formid);
if (rs1.next()) {
thirdFieldType = rs1.getString(1);
thirdFieldDBType = rs1.getString(2);
}
baseBean.writeLog("---LHSP2021----requestid===" + requestid + "----thirdFieldType====" + thirdFieldType + "----thirdFieldDBType====" + thirdFieldDBType);
rs1.executeQuery("select " + secondfieldname + "," + thirdfieldname + " from " + tablename + " where requestid = ?", requestid);
baseBean.writeLog("---LHSP2021----requestid===" + requestid + "----selectData====" + "select " + secondfieldname + "," + thirdfieldname + " from " + tablename + " where requestid = " + requestid);
if (rs1.next()) {
secondValue = rs1.getString(1);
thirdValue = rs1.getString(2);
secondShowName = getSelectFieldValue(secondFieldId, secondValue);
List<BrowserValueInfo> browserValueInfo = getBrowserFieldValue(thirdFieldType, thirdValue, thirdFieldDBType);
for (BrowserValueInfo info : browserValueInfo) {
String name = info.getName();
thirdShowName += name + ",";
}
if (thirdShowName.endsWith(",")) {
thirdShowName = thirdShowName.substring(0, thirdShowName.length() - 1);
}
}
baseBean.writeLog("---LHSP2021----requestid===" + requestid + "----updateSql====" + "update workflow_requestbase set firstfloor = " + id + ",firstfloorname = " + showname + ",secondfloor = " + secondValue + ",secondfloorname = " + secondShowName + ",thirdfloor = " + thirdValue + ",thirdfloorname = " + thirdShowName + " where requestid = " + requestid);
rs1.executeUpdate("update workflow_requestbase set firstfloor = ?,firstfloorname = ?,secondfloor = ?,secondfloorname = ?,thirdfloor = ?,thirdfloorname = ? where requestid = ?", id, showname, secondValue, secondShowName, thirdValue, thirdShowName, requestid);
} else {
//qc2126083 除了总行收文分类外,其余所有分类,都要支持二级目录按字段分类,且通过建模字段控制是否分类
String sencondIsGroupbyFieldname = weaver.general.Util.null2String(rs.getString(8));
rs1.writeLog(">>>>>> wangsong requestid="+requestid+" 判断二级目录区分是否按照指定字段分类展示 sencondIsGroupbyFieldname="+sencondIsGroupbyFieldname);
if("0".equals(sencondIsGroupbyFieldname)){//需要按照字段分类展示
String secondShowName = "";
String secondValue = "";
String secondFieldId = "";
rs1.executeQuery("select id from workflow_billfield where fieldname = ? and billid = ?", secondfieldname, formid);
if (rs1.next()) {
secondFieldId = rs1.getString(1);
}
rs1.executeQuery("select * from " + tablename + " where requestid = ?", requestid);
if (rs1.next()) {
secondValue = rs1.getString(secondfieldname);
secondShowName = getSelectFieldValue(secondFieldId, secondValue);
}
rs1.writeLog(">>>>>> wangsong 更新二级目录的字段数据到workflow_requestbase表 secondFieldId="+secondFieldId+",secondValue="+secondValue+",secondShowName="+secondShowName);
rs1.executeUpdate("update workflow_requestbase set firstfloor = ?,firstfloorname = ?,secondfloor = ?,secondfloorname = ? where requestid = ?", id, showname, secondValue, secondShowName, requestid);
}else{
baseBean.writeLog("---LHSP2021----requestid===" + requestid + "----updateSql====" + "update workflow_requestbase set firstfloor = " + id + ",firstfloorname = " + showname + ",secondfloor = " + workflowid + ",secondfloorname = " + workflowname + " where requestid = " + requestid);
rs1.executeUpdate("update workflow_requestbase set firstfloor = ?,firstfloorname = ?,secondfloor = ?,secondfloorname = ? where requestid = ?", id, showname, workflowid + "", workflowname, requestid);
}
}
}
}
}
/**
* 获取选择框选中值
* */
public static String getSelectFieldValue(String fieldId, String selectValue) {
String selectValueName = "";
RecordSet rs = new RecordSet();
String sql = "select selectvalue,selectname from workflow_selectitem where selectvalue = ? and fieldid=? and (cancel<>'1' or cancel is null) order by listorder,selectvalue";
rs.executeQuery(sql,selectValue, fieldId);
if (rs.next()) {
selectValueName = weaver.general.Util.null2String(rs.getString("selectname"));
}
return selectValueName;
}
/**
* 获取浏览按钮的值
* */
public static List<BrowserValueInfo> getBrowserFieldValue(String fieldType, String fieldValue, String fieldDbType) {
BrowserValueInfoService browserValueInfoService = new BrowserValueInfoService();
List <BrowserValueInfo> result = new ArrayList<>();
try {
result= browserValueInfoService.getBrowserValueInfo(fieldType, fieldDbType, 0, fieldValue, 7, "", "");
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
%>

@ -0,0 +1,123 @@
<%@ page import="org.slf4j.Logger" %>
<%@ page import="org.slf4j.LoggerFactory" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%@ page import="net.sf.json.JSONObject" %>
<%@ page import="weaver.wps.doccenter.utils.Tools" %>
<%@ page import="weaver.wps.doccenter.utils.Config" %>
<%@ page import="weaver.wps.doccenter.utils.FileInfoUtil" %>
<%@ page import="weaver.wps.doccenter.convert.BaseConvert" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.hrm.User" %>
<%@page contentType="text/html; charset=UTF-8" %>
<%
HashMap<String, String> param = new HashMap<>();
param.put("imagefileid","37304");
param.put("targetFileFormat","PDF");
int i = convertDocType(param);
out.print(i);
%>
<%!
static Logger log = LoggerFactory.getLogger("CustomBusiness");
public Map<String, String> convert(Map<String, String> params) throws Exception {
Map<String, String> result = new HashMap<String, String>();
JSONObject requestParams = new JSONObject();
User user = new User(1);
String ecfileid = params.get("imagefileid");
// 判断模块。目前应该只有知识管理的
String fromMould = Tools.null2String(params.get("fromMould"));
fromMould = Tools.getFromMould(fromMould);
String targetFileFormat = Tools.null2String(params.get("targetFileFormat"));
String apiUrl = "";// Config.getCpsV1OfficeConvert();
if(6 == Config.getProductVersion()) {
apiUrl = Config.getV6CpsV1OfficeConvert();
} else if(5 == Config.getProductVersion()) {
apiUrl = Config.getCpsV1OfficeConvert();
}
FileInfoUtil fileInfoUtil = new FileInfoUtil();
Map<String,String> fileInfo = fileInfoUtil.getFileInfo(ecfileid, user, fromMould);
String filename = fileInfo.get("filename");
filename = Tools.getFileNameWithLowerCaseSuffix(filename);
requestParams = new JSONObject();
requestParams.put("doc_filename", getTempFileName(filename));
requestParams.put("doc_url", fileInfo.get("download"));
requestParams.put("target_file_format", targetFileFormat);
//判断下转换格式为PDF且配置文件中未开启时添加参数
// "to_pdf" = {
// "show_ins_and_del" = 1
// }
// if ("PDF".equals(targetFileFormat) && Config.isProperty("show_ins_and_del", 1, 1)){
JSONObject to_pdf = new JSONObject();
to_pdf.put("show_ins_and_del",1);
requestParams.put("to_pdf", to_pdf);
// }
// 判断如果是excel则优化下转换结果
String ext = filename.contains(".") ? filename.substring(filename.lastIndexOf(".")+1) : "";
boolean isExcelFile = ("doc".equals(ext) || "docx".equals(ext) || "wps".equals(ext)|| "xls".equals(ext)|| "xlsx".equals(ext));
isExcelFile = isExcelFile || ("," + Config.getPropertyValue("doccenter_fit_excel_exts") + ",").contains("," + ext + ",");
if( isExcelFile && Config.isProperty("doccenter_fit_excel", 1, 1)) {
JSONObject et_page_zoom = new JSONObject();
// 表示是否保持当前客户端的缩放比true表示保持当前缩放比打印false表示以100%的缩放比打印当fit_pagetall或fit_pagewide中有一个为1或都为1时该参数不生效
et_page_zoom.put("keep_pagezoom", "true".equals(Config.getPropString("doccenter_keep_pagezoom", "true")));
// 表示是否适配所有行0表示正常分页打印1表示不分页所有行在一页上
et_page_zoom.put("fit_pagewide", Config.getPropIntValue("doccenter_fit_pagewide", 0));
// 表示是否适配所有列0表示正常分页打印1表示不分页所有列在一页上当fit_pagetall与fit_pagewide都为1时表示将所有内容打印到一页上
et_page_zoom.put("fit_pagetall", Config.getPropIntValue("doccenter_fit_pagetall", 1));
requestParams.put("et_page_zoom", et_page_zoom);
}
// 结果文件的文件名
String targetFilename = params.containsKey("targetFilename") ? params.get("targetFilename"): "";
if(Tools.isEmptyOrNull(targetFilename) && !Tools.isEmptyOrNull(filename)) {
String nameOnly = filename.contains(".") ? filename.substring(0, filename.lastIndexOf(".")) : filename;
targetFilename = nameOnly + "." + targetFileFormat.toLowerCase();
}
BaseConvert baseConvert = new BaseConvert(user);
if(!params.containsKey("comefrom")) {
params.put("comefrom", "DocTypeConvert");
}
result = baseConvert.convert(apiUrl, requestParams, targetFilename, params);
// 处理其他的事务
return result;
}
public static String getTempFileName(String filename) {
if(Tools.isEmptyOrNull(filename) || !filename.contains(".")){
return filename;
}
int idx = filename.lastIndexOf(".");
return"1" + filename.substring(idx).toLowerCase();
}
public int convertDocType(Map<String, String> params){
Map<String, String> result = new HashMap<String, String>();
try {
result = convert(params);
if("0".equals(result.get("status"))){
return Util.getIntValue(result.get("imagefileid"));
}
} catch (Exception e) {
log.error(e.getMessage());
}
return -1;
}
%>
Loading…
Cancel
Save