|
@@ -32,13 +32,13 @@ import com.boman.web.core.service.update.IBaseUpdateService;
|
|
|
import com.boman.web.core.utils.ColumnUtils;
|
|
|
import com.boman.web.core.utils.IdUtils;
|
|
|
import com.boman.web.core.utils.JSONObjectUtils;
|
|
|
+import com.boman.wechat.api.RemoteWechatService;
|
|
|
import com.google.common.base.Strings;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import org.apache.commons.lang3.BooleanUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.aop.framework.AopContext;
|
|
|
-import org.springframework.aop.support.AopUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Isolation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -92,6 +92,9 @@ public class TableServiceCmdService {
|
|
|
private RemoteMenuService remoteMenuService;
|
|
|
@Resource
|
|
|
private RemoteJflowProcessService remoteJflowProcessService;
|
|
|
+ @Resource
|
|
|
+ private RemoteWechatService remoteWechatService;
|
|
|
+
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(TableServiceCmdService.class);
|
|
|
|
|
@@ -114,7 +117,7 @@ public class TableServiceCmdService {
|
|
|
//判断时候有定制新增接口
|
|
|
List<JSONObject> listData = new ArrayList<>();
|
|
|
listData.add(context.getCommitData());
|
|
|
- isCustomized(context.getTableName(),listData,"trigger_create");
|
|
|
+ isCustomized(context.getTableName(), listData, "trigger_create");
|
|
|
|
|
|
AjaxResult result;
|
|
|
// 新增
|
|
@@ -169,6 +172,8 @@ public class TableServiceCmdService {
|
|
|
List<AjaxResult> resultList = new ArrayList<>(result.size());
|
|
|
Map<String, Long> tableNameIdMap = new HashMap<>(result.size());
|
|
|
AjaxResult ajaxResult;
|
|
|
+ List<Long> receiveUserIds = new ArrayList<>();
|
|
|
+ Map<String, Object> messageInfo = new HashMap<>();
|
|
|
for (int i = 0; i < result.size(); i++) {
|
|
|
FormDataDto formDataDto = result.get(i);
|
|
|
boolean optPrimaryTable = i == 0;
|
|
@@ -188,8 +193,25 @@ public class TableServiceCmdService {
|
|
|
|
|
|
tableNameIdMap.put(tableName, fkId);
|
|
|
resultList.add(ajaxResult);
|
|
|
- }
|
|
|
|
|
|
+ if (dto.getTable().equals("boman_message")) {
|
|
|
+ if (optPrimaryTable) {
|
|
|
+ messageInfo.put("thing1", formDataDto.getFixedData().getString("message_title"));
|
|
|
+ messageInfo.put("thing2", formDataDto.getFixedData().getString("send_user_name"));
|
|
|
+ } else {
|
|
|
+ receiveUserIds.add(formDataDto.getFixedData().getLong("receive_user_id"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ // 获取发文相关信息
|
|
|
+ if (dto.getTable().equals("boman_message")) {
|
|
|
+ WxMsgDto wxMsgDto = new WxMsgDto();
|
|
|
+ wxMsgDto.setIds(receiveUserIds);
|
|
|
+ wxMsgDto.setParams(messageInfo);
|
|
|
+ LOGGER.info("收文人id:{}, 发送数据: {}", receiveUserIds, messageInfo);
|
|
|
+ remoteWechatService.pushMsg(wxMsgDto);
|
|
|
+ }
|
|
|
return AjaxResult.success(resultList);
|
|
|
}
|
|
|
|
|
@@ -467,8 +489,11 @@ public class TableServiceCmdService {
|
|
|
}
|
|
|
}
|
|
|
// dateTime
|
|
|
- if (NEED_CONVERT_DATE_LIST.contains(columnType)) {
|
|
|
+ // dateTime
|
|
|
+ if (DATE.equals(columnType)) {
|
|
|
column.setColumnValue(getStrDate(json.getTimestamp(columnName)));
|
|
|
+ } else if (DATETIME.equals(columnType)) {
|
|
|
+ column.setColumnValue(getStrTimeStamp(json.getTimestamp(columnName)));
|
|
|
}
|
|
|
// fk
|
|
|
if (isNotEmpty(column.getForeignKey())) {
|
|
@@ -576,7 +601,7 @@ public class TableServiceCmdService {
|
|
|
// dateTime
|
|
|
if (NEED_CONVERT_DATE_LIST.contains(columnType)) {
|
|
|
assert value instanceof Timestamp;
|
|
|
- column.setColumnValue(getStrDate((Timestamp)value));
|
|
|
+ column.setColumnValue(getStrDate((Timestamp) value));
|
|
|
}
|
|
|
// fk
|
|
|
if (isNotEmpty(column.getForeignKey())) {
|
|
@@ -586,7 +611,7 @@ public class TableServiceCmdService {
|
|
|
}
|
|
|
// annex
|
|
|
if (HTML_IMAGE_UPLOAD.equalsIgnoreCase(htmlType) || HTML_FILE_UPLOAD.equalsIgnoreCase(htmlType)) {
|
|
|
- column.setAnnex(getAnnex((String)value));
|
|
|
+ column.setAnnex(getAnnex((String) value));
|
|
|
}
|
|
|
|
|
|
children.add(column);
|
|
@@ -622,7 +647,7 @@ public class TableServiceCmdService {
|
|
|
GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, dto.getTable());
|
|
|
|
|
|
JSONObject jsonObject = selectService.selectById(dto.getTable(), IdUtils.getPkName(genTable.getColumns()), dto.getObjId(), dto.getOther());
|
|
|
- if(jsonObject == null) {
|
|
|
+ if (jsonObject == null) {
|
|
|
return AjaxResult.error("没有表单数据", jsonObject);
|
|
|
}
|
|
|
List<GenTableColumn> columns = genTable.getColumns();
|
|
@@ -648,7 +673,7 @@ public class TableServiceCmdService {
|
|
|
}
|
|
|
JSONObject result = new JSONObject();
|
|
|
result.put("childs", addcolums);
|
|
|
- result.put("size",columns.size());
|
|
|
+ result.put("size", columns.size());
|
|
|
|
|
|
JSONArray adc = new JSONArray();
|
|
|
adc.add(result);
|
|
@@ -876,9 +901,9 @@ public class TableServiceCmdService {
|
|
|
for (JSONObject commitDatum : commitData) {
|
|
|
String dbStatus = getStatusFromFormData(commitDatum, beforeList);
|
|
|
// 只能是未提交的状态下,才能调用提交
|
|
|
- if(StringUtils.isNotEmpty(condition.getSubmitSource())) {
|
|
|
+ if (StringUtils.isNotEmpty(condition.getSubmitSource())) {
|
|
|
handlerSubmit(tableName, pkName, commitDatum);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
if (isSubmit) {
|
|
|
// 只能是未提交的状态下,才能调用提交, 下面是不允许
|
|
|
if (!SubmitConstant.NOT_SUBMIT.equals(dbStatus)) {
|
|
@@ -913,7 +938,7 @@ public class TableServiceCmdService {
|
|
|
String tableName = requireNonNull(genTable.getTableName(), "tableName = [" + genTable.getTableName() + "] 此表不存在");
|
|
|
|
|
|
List<JSONObject> commitData = condition.getCommitData();
|
|
|
- for(JSONObject commitDatum : commitData) {
|
|
|
+ for (JSONObject commitDatum : commitData) {
|
|
|
Long foreignKey = Long.valueOf(commitDatum.get("foreignKey").toString());
|
|
|
String foreignKeyName = (String) commitDatum.get("foreignKeyName");
|
|
|
this.executeData(tableName, foreignKeyName, foreignKey, (Map<String, Object>) commitDatum.get("updateData"));
|
|
@@ -925,10 +950,10 @@ public class TableServiceCmdService {
|
|
|
/**
|
|
|
* 功能描述: 修改数据
|
|
|
*
|
|
|
- * @param tableName tableName
|
|
|
+ * @param tableName tableName
|
|
|
* @param foreignKeyName 外键名
|
|
|
- * @param foreignKey 外键值
|
|
|
- * @param commitDatum 返回给前台的数据
|
|
|
+ * @param foreignKey 外键值
|
|
|
+ * @param commitDatum 返回给前台的数据
|
|
|
*/
|
|
|
private void executeData(String tableName, String foreignKeyName, Long foreignKey, Map<String, Object> commitDatum) {
|
|
|
int effective = submitService.executeData(tableName, foreignKeyName, foreignKey, new JSONObject(commitDatum));
|
|
@@ -1127,7 +1152,7 @@ public class TableServiceCmdService {
|
|
|
}
|
|
|
|
|
|
private void addOtherColumn(List<GenTableColumn> columns, String other) {
|
|
|
- if(StringUtils.isEmpty(other)) {
|
|
|
+ if (StringUtils.isEmpty(other)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -1143,7 +1168,7 @@ public class TableServiceCmdService {
|
|
|
|
|
|
String dictType = column.getDictType();
|
|
|
String columnName = column.getColumnName();
|
|
|
- if(StringUtils.isEmpty(other)) {
|
|
|
+ if (StringUtils.isEmpty(other)) {
|
|
|
jo.put("valuedata", jsonObject.get(columnName));
|
|
|
return;
|
|
|
}
|
|
@@ -1153,7 +1178,7 @@ public class TableServiceCmdService {
|
|
|
List<SysDictData> sysDictData = column.getSysDictData();
|
|
|
//获取到字段的值
|
|
|
String value = String.valueOf(jsonObject.get(columnName));
|
|
|
- if (sysDictData != null && sysDictData.size() > 0){
|
|
|
+ if (sysDictData != null && sysDictData.size() > 0) {
|
|
|
for (SysDictData sysDictDatum : sysDictData) {
|
|
|
if (sysDictDatum.getDictValue().equals(value)) {
|
|
|
jo.put("valuedata", sysDictDatum.getDictLabel());
|
|
@@ -1161,7 +1186,7 @@ public class TableServiceCmdService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
jo.put("valuedata", jsonObject.get(columnName));
|
|
|
}
|
|
|
}
|