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