generated from dxfeng/secondev-chapanda-feishu
BUG修复
This commit is contained in:
parent
5ec8cc7ca5
commit
1b5648259a
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.recruit.util;
|
||||
|
||||
import weaver.common.MessageUtil;
|
||||
import weaver.email.EmailWorkRunnable;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -28,7 +29,22 @@ public class RecruitMessageUtils {
|
|||
return MessageUtil.sendEmail(sendTo, emailTitle, emailContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sendTo 收件人
|
||||
* @param emailTitle 邮件标题
|
||||
* @param emailContent 邮件内容
|
||||
* @param imageFileIds 邮件附件,imageFile表记录id,多个时英文逗号分隔
|
||||
* @return
|
||||
*/
|
||||
public static boolean SendEmailWithFile(String sendTo, String emailTitle, String emailContent, String imageFileIds) {
|
||||
EmailWorkRunnable emailWorkRunnable = new EmailWorkRunnable(sendTo, Util.toHtmlMode(emailTitle), Util.toHtmlMode(emailContent));
|
||||
emailWorkRunnable.setImagefileids(imageFileIds);
|
||||
return emailWorkRunnable.emailCommonRemind();
|
||||
}
|
||||
|
||||
public static boolean sendSMS(String receiver, String content) {
|
||||
return MessageUtil.sendSMS(receiver, content);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package weaver.formmode.recruit.modeexpand.offer;
|
||||
|
||||
import com.engine.recruit.enums.RecordOperateEnum;
|
||||
import com.engine.recruit.exception.CustomizeRunTimeException;
|
||||
import com.engine.recruit.util.RecruitMessageUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
|
|
@ -38,6 +40,10 @@ public class CreateOfferModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
int modeId;
|
||||
RequestInfo requestInfo = (RequestInfo) params.get("RequestInfo");
|
||||
User user = (User) params.get("user");
|
||||
String recordType = Util.null2String(params.get("recordType"));
|
||||
if (!RecordOperateEnum.SEND_OFFER.getOperateType().equals(recordType)) {
|
||||
return result;
|
||||
}
|
||||
if (requestInfo != null) {
|
||||
billId = Util.getIntValue(requestInfo.getRequestid());
|
||||
modeId = Util.getIntValue(requestInfo.getWorkflowid());
|
||||
|
|
@ -63,31 +69,32 @@ public class CreateOfferModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
}
|
||||
|
||||
private void sendMessage(int billId) {
|
||||
String querySql = "select sjhm,dzyx,yjtzmb,tznr,tzypz from uf_jcl_offer where id = ?";
|
||||
String querySql = "select sjhm,dzyx,yjtzmb,tznr,tzypz,offerfj from uf_jcl_offer where id = ?";
|
||||
recordSet.executeQuery(querySql, billId);
|
||||
String sjhm = "";
|
||||
String dzyx = "";
|
||||
String yjtzmb = "";
|
||||
String tznr = "";
|
||||
String tzypz = "";
|
||||
String offerfj = "";
|
||||
while (recordSet.next()) {
|
||||
sjhm = Util.null2String(recordSet.getString("sjhm"));
|
||||
dzyx = Util.null2String(recordSet.getString("dzyx"));
|
||||
yjtzmb = Util.null2String(recordSet.getString("yjtzmb"));
|
||||
tznr = Util.null2String(recordSet.getString("tznr"));
|
||||
tzypz = Util.null2String(recordSet.getString("tzypz"));
|
||||
offerfj = Util.null2String(recordSet.getString("offerfj"));
|
||||
}
|
||||
offerfj = RecruitModeUtil.getImageFileIdsByDocIds(offerfj);
|
||||
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
String[] ways = tzypz.split(",");
|
||||
for (String way : ways) {
|
||||
switch (way) {
|
||||
case "0":
|
||||
// 邮件
|
||||
params.put("sendTo", dzyx);
|
||||
params.put("emailTitle", getEmailTitle(yjtzmb));
|
||||
params.put("emailContent", tznr);
|
||||
RecruitMessageUtils.SendEmail(params);
|
||||
// 邮件附件,对应表单上传的附件
|
||||
RecruitMessageUtils.SendEmailWithFile(dzyx, getEmailTitle(yjtzmb), tznr, offerfj);
|
||||
break;
|
||||
case "1":
|
||||
// 短信
|
||||
|
|
|
|||
|
|
@ -199,56 +199,83 @@ public class RecruitModeUtil {
|
|||
return docId;
|
||||
}
|
||||
|
||||
public static String getImageFileIdsByDocIds(String docId) {
|
||||
if (StringUtils.isBlank(docId)) {
|
||||
return "";
|
||||
}
|
||||
List<String> imageFileIds = new ArrayList<>();
|
||||
String[] split = docId.split(",");
|
||||
try {
|
||||
for (String s : split) {
|
||||
if (StringUtils.isBlank(s)) {
|
||||
continue;
|
||||
}
|
||||
DocImageManager imgManger = new DocImageManager();
|
||||
imgManger.setDocid(Integer.parseInt(s));
|
||||
|
||||
imgManger.selectDocImageInfo();
|
||||
imgManger.next();
|
||||
imageFileIds.add(imgManger.getImagefileid());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
return StringUtils.join(imageFileIds, ",");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Author ml
|
||||
* @Date 2023/10/23 18:21
|
||||
* @Description 根据建模表名称获取列名称
|
||||
* @Param [tableName]
|
||||
* @Return Map<Object,List<Map<String,Object>>>
|
||||
* @Return Map<Object, List < Map < String, Object>>>
|
||||
*/
|
||||
public static Map<String,Object> getModeColumns(String tableName) {
|
||||
public static Map<String, Object> getModeColumns(String tableName) {
|
||||
RecordSet rs = new RecordSet();
|
||||
List<Map<String,String>> mapList = new ArrayList<>();
|
||||
List<Map<String, String>> mapList = new ArrayList<>();
|
||||
Map<String, String> tmpMap = new HashMap<>(16);
|
||||
rs.executeQuery("select b.FIELDNAME,b.VIEWTYPE from workflow_bill a left join workflow_billfield b on a.id = b.BILLID where a.TABLENAME = ?",tableName);
|
||||
rs.executeQuery("select b.FIELDNAME,b.VIEWTYPE from workflow_bill a left join workflow_billfield b on a.id = b.BILLID where a.TABLENAME = ?", tableName);
|
||||
while (rs.next()) {
|
||||
tmpMap.put("fieldname",rs.getString("FIELDNAME"));
|
||||
tmpMap.put("viewtype",rs.getString("VIEWTYPE"));
|
||||
tmpMap.put("fieldname", rs.getString("FIELDNAME"));
|
||||
tmpMap.put("viewtype", rs.getString("VIEWTYPE"));
|
||||
mapList.add(tmpMap);
|
||||
}
|
||||
Map<String,List<Map<String,String>>> dataMap = mapList.stream().collect(Collectors.groupingBy(item -> item.get("viewtype")));
|
||||
Map<String,Object> resMap = new HashMap<>();
|
||||
Map<String, List<Map<String, String>>> dataMap = mapList.stream().collect(Collectors.groupingBy(item -> item.get("viewtype")));
|
||||
Map<String, Object> resMap = new HashMap<>();
|
||||
for (String key : dataMap.keySet()) {
|
||||
resMap.put(key,dataMap.get(key).stream().map(Map -> Map.get("fieldname")).collect(Collectors.toList()));
|
||||
resMap.put(key, dataMap.get(key).stream().map(Map -> Map.get("fieldname")).collect(Collectors.toList()));
|
||||
}
|
||||
return resMap;
|
||||
}
|
||||
|
||||
|
||||
public static String getQuerySql(String tableName) {
|
||||
Map<String,Object> params = getModeColumns(tableName);
|
||||
Map<String, Object> params = getModeColumns(tableName);
|
||||
String fieldSql = "";
|
||||
StringBuilder whereSql = new StringBuilder();
|
||||
whereSql.append(tableName).append(" t0");
|
||||
for (String key : params.keySet()) {
|
||||
List<String> oldlist = (List<String>) params.get(key);
|
||||
List<String> list = new ArrayList<>();
|
||||
oldlist.forEach(field -> list.add("t"+key+"."+field));
|
||||
fieldSql = StringUtils.join(list,",");
|
||||
oldlist.forEach(field -> list.add("t" + key + "." + field));
|
||||
fieldSql = StringUtils.join(list, ",");
|
||||
if ("0".equals(key)) {
|
||||
continue;
|
||||
}
|
||||
whereSql.append(" left join ").append(tableName).append("_dt").append(key).append(" ").append("t").append(key).append(" on t0.id=").append("t").append(key).append(".mainid");
|
||||
}
|
||||
return "select "+fieldSql+" from " + whereSql + " where t0.id=?";
|
||||
return "select " + fieldSql + " from " + whereSql + " where t0.id=?";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取邮件模板主题
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public static String getEmailTitle (String id) {
|
||||
public static String getEmailTitle(String id) {
|
||||
RecordSet recordSet = new RecordSet();
|
||||
String emailTitle = "";
|
||||
recordSet.executeQuery("select yjzt from uf_jcl_yjtzmb where id = ?", id);
|
||||
|
|
|
|||
Loading…
Reference in New Issue