Merge remote-tracking branch 'orinin/test' into test
This commit is contained in:
commit
7c5f442291
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@
|
||||
out/
|
||||
src/main/java/kd/cosmic/
|
||||
/font/
|
||||
*.iml
|
@ -164,7 +164,7 @@ public class ObjectToJsonUtils {
|
||||
}
|
||||
//是否附件
|
||||
if (yem_isattachment) {
|
||||
JSONArray jsonArray = CommonUtils.GetAttachment(entityName, pkid, yem_attachmentkey);
|
||||
JSONArray jsonArray = CommonUtils.GetAttachment(entityName, pkid, yem_attachmentkey,dataEntity);
|
||||
if (jsonArray != null && jsonArray.size() > 0) {
|
||||
widgetValueObject.put(yem_iaformid, jsonArray);
|
||||
}
|
||||
|
@ -286,7 +286,8 @@ public class CommonUtils {
|
||||
* @param attachKey 附件标识
|
||||
* @return JSONArray
|
||||
*/
|
||||
public static JSONArray GetAttachment(String formId, Object pkId, String attachKey) {
|
||||
public static JSONArray GetAttachment(String formId, Object pkId, String attachKey, DynamicObject dataEntity) {
|
||||
boolean yem_ispdf = dataEntity.getBoolean("yem_ispdf");
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
try {
|
||||
List<Map<String, Object>> attachments = AttachmentServiceHelper.getAttachments(formId, pkId, attachKey);
|
||||
@ -296,31 +297,56 @@ public class CommonUtils {
|
||||
for (int i = 0; i < attachments.size(); i++) {
|
||||
Map<String, Object> map = attachments.get(i);
|
||||
String fileurl = (String) map.get("url");
|
||||
String filename = (String) map.get("name");
|
||||
if (fileurl.contains("http://localhost:8080/ierp/")) {
|
||||
fileurl = fileurl.replace("http://localhost:8080/", "http://10.64.112.152:8022/");
|
||||
}
|
||||
|
||||
String result = YunzhijiaUtils.uploadfile(fileurl, accessToken, (String) map.get("name"));
|
||||
JSONObject json = JSONObject.parseObject(result);
|
||||
Boolean success = json.getBoolean("success");
|
||||
if (success) {
|
||||
JSONArray data = json.getJSONArray("data");
|
||||
for (int j = 0; j < data.size(); j++) {
|
||||
JSONObject object = new JSONObject();
|
||||
JSONObject jsonObject = data.getJSONObject(j);
|
||||
if (jsonObject != null) {
|
||||
if (yem_ispdf && filename.endsWith(".pdf")) {
|
||||
String result = YunzhijiaUtils.uploadfile(fileurl, accessToken, (String) map.get("name"));
|
||||
JSONObject json = JSONObject.parseObject(result);
|
||||
Boolean success = json.getBoolean("success");
|
||||
if (success) {
|
||||
JSONArray data = json.getJSONArray("data");
|
||||
for (int j = 0; j < data.size(); j++) {
|
||||
JSONObject object = new JSONObject();
|
||||
JSONObject jsonObject = data.getJSONObject(j);
|
||||
if (jsonObject != null) {
|
||||
// object.put("fileName", jsonObject.getString("fileName"));
|
||||
object.put("fileName", map.get("name").toString());
|
||||
object.put("fileId", jsonObject.getString("fileId"));
|
||||
object.put("fileSize", jsonObject.getString("length"));
|
||||
object.put("fileType", jsonObject.getString("fileType"));
|
||||
object.put("fileExt", map.get("type").toString());
|
||||
jsonArray.add(object);
|
||||
//创建ERP与云之家对照表
|
||||
Addattyunzhijia(formId, pkId, map, attachKey, jsonObject);
|
||||
object.put("fileName", map.get("name").toString());
|
||||
object.put("fileId", jsonObject.getString("fileId"));
|
||||
object.put("fileSize", jsonObject.getString("length"));
|
||||
object.put("fileType", jsonObject.getString("fileType"));
|
||||
object.put("fileExt", map.get("type").toString());
|
||||
jsonArray.add(object);
|
||||
//创建ERP与云之家对照表
|
||||
Addattyunzhijia(formId, pkId, map, attachKey, jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String result = YunzhijiaUtils.uploadfile(fileurl, accessToken, (String) map.get("name"));
|
||||
JSONObject json = JSONObject.parseObject(result);
|
||||
Boolean success = json.getBoolean("success");
|
||||
if (success) {
|
||||
JSONArray data = json.getJSONArray("data");
|
||||
for (int j = 0; j < data.size(); j++) {
|
||||
JSONObject object = new JSONObject();
|
||||
JSONObject jsonObject = data.getJSONObject(j);
|
||||
if (jsonObject != null) {
|
||||
// object.put("fileName", jsonObject.getString("fileName"));
|
||||
object.put("fileName", map.get("name").toString());
|
||||
object.put("fileId", jsonObject.getString("fileId"));
|
||||
object.put("fileSize", jsonObject.getString("length"));
|
||||
object.put("fileType", jsonObject.getString("fileType"));
|
||||
object.put("fileExt", map.get("type").toString());
|
||||
jsonArray.add(object);
|
||||
//创建ERP与云之家对照表
|
||||
Addattyunzhijia(formId, pkId, map, attachKey, jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -32,14 +32,12 @@ import java.util.*;
|
||||
* @Created by ZZSLL
|
||||
*/
|
||||
|
||||
public class ContractResignEdit extends AbstractFormPlugin implements UploadListener
|
||||
{
|
||||
public class ContractResignEdit extends AbstractFormPlugin implements UploadListener {
|
||||
private static final Log log = LogFactory.getLog(ContractResignEdit.class);
|
||||
|
||||
|
||||
@Override
|
||||
public void registerListener(EventObject e)
|
||||
{
|
||||
public void registerListener(EventObject e) {
|
||||
super.registerListener(e);
|
||||
|
||||
AttachmentPanel attachmentPanel = this.getView().getControl("yem_attachmentpanel");
|
||||
@ -123,8 +121,7 @@ public class ContractResignEdit extends AbstractFormPlugin implements UploadList
|
||||
}
|
||||
|
||||
@Override
|
||||
public void click(EventObject e)
|
||||
{
|
||||
public void click(EventObject e) {
|
||||
super.click(e);
|
||||
Control source = (Control) e.getSource();
|
||||
String key = source.getKey();
|
||||
@ -142,16 +139,21 @@ public class ContractResignEdit extends AbstractFormPlugin implements UploadList
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
IPageCache cache = this.getPageCache();
|
||||
List<Map<String, Object>> addAttachmentData = getCache(cache);
|
||||
hashMap.put("attach", addAttachmentData);
|
||||
long user = dataEntity.getLong("yem_user.id");
|
||||
Date date = dataEntity.getDate("yem_date");
|
||||
hashMap.put("user", user);
|
||||
hashMap.put("date", date);
|
||||
log.error("关闭界面之前:" + addAttachmentData);
|
||||
this.getView().returnDataToParent(hashMap);
|
||||
this.getView().close();
|
||||
addAttachmentData.clear();//关闭界面清空上传附件
|
||||
log.error("关闭界面:" + addAttachmentData);
|
||||
if (addAttachmentData.size() > 0) {
|
||||
hashMap.put("attach", addAttachmentData);
|
||||
long user = dataEntity.getLong("yem_user.id");
|
||||
Date date = dataEntity.getDate("yem_date");
|
||||
hashMap.put("user", user);
|
||||
hashMap.put("date", date);
|
||||
log.error("关闭界面之前:" + addAttachmentData);
|
||||
this.getView().returnDataToParent(hashMap);
|
||||
this.getView().close();
|
||||
addAttachmentData.clear();//关闭界面清空上传附件
|
||||
log.error("关闭界面:" + addAttachmentData);
|
||||
}
|
||||
else{
|
||||
this.getView().showErrorNotification("请上传附件或等待附件上传完毕后重试!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -171,7 +173,7 @@ public class ContractResignEdit extends AbstractFormPlugin implements UploadList
|
||||
AttachmentPanel panel = view.getControl("yem_attachmentpanel");
|
||||
for (Map<String, Object> map : attach) {
|
||||
map.put("lastModified", new Date().getTime());
|
||||
filtername.add((String)map.get("name"));
|
||||
filtername.add((String) map.get("name"));
|
||||
}
|
||||
panel.upload(attach);
|
||||
view.updateView("yem_attachmentpanel");
|
||||
@ -181,6 +183,7 @@ public class ContractResignEdit extends AbstractFormPlugin implements UploadList
|
||||
|
||||
/**
|
||||
* 从缓存中获取附件
|
||||
*
|
||||
* @param cache
|
||||
* @return
|
||||
*/
|
||||
@ -189,7 +192,7 @@ public class ContractResignEdit extends AbstractFormPlugin implements UploadList
|
||||
List<Map<String, Object>> addAttachmentData = null;
|
||||
if (attach != null) {
|
||||
addAttachmentData = getJson(attach) == null ? new ArrayList<>() : getJson(attach);
|
||||
}else {
|
||||
} else {
|
||||
addAttachmentData = new ArrayList<>();
|
||||
}
|
||||
return addAttachmentData;
|
||||
@ -197,6 +200,7 @@ public class ContractResignEdit extends AbstractFormPlugin implements UploadList
|
||||
|
||||
/**
|
||||
* 将从缓存中取到的附件转换成List<Map<String,Object>>
|
||||
*
|
||||
* @param attach
|
||||
* @return
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user