|
@@ -146,6 +146,9 @@ public class GzwCommonUtils {
|
|
|
List<File> xmlFileList = new ArrayList<>();
|
|
List<File> xmlFileList = new ArrayList<>();
|
|
|
//生成单据数据XML文件
|
|
//生成单据数据XML文件
|
|
|
for (Map.Entry<String, Object> entry : xmlMap.entrySet()) {
|
|
for (Map.Entry<String, Object> entry : xmlMap.entrySet()) {
|
|
|
|
|
+ if(ObjectUtils.isEmpty(entry.getValue())){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
File xmlFile = GzwCommonUtils.createXMLFile(uscc, entry.getKey(), ver, cusDateStr, (List<LinkedHashMap<String, Object>>) entry.getValue());
|
|
File xmlFile = GzwCommonUtils.createXMLFile(uscc, entry.getKey(), ver, cusDateStr, (List<LinkedHashMap<String, Object>>) entry.getValue());
|
|
|
xmlFileList.add(xmlFile);
|
|
xmlFileList.add(xmlFile);
|
|
|
}
|
|
}
|
|
@@ -376,7 +379,7 @@ public class GzwCommonUtils {
|
|
|
* @param obj 业务数据
|
|
* @param obj 业务数据
|
|
|
* @return 获取数据标识( 1 表示新增,2 表示修改,3 表示删除 ),默认为 1
|
|
* @return 获取数据标识( 1 表示新增,2 表示修改,3 表示删除 ),默认为 1
|
|
|
*/
|
|
*/
|
|
|
- public static String getDataFlag(DynamicObject obj,String pushState) {
|
|
|
|
|
|
|
+ public static String getDataFlag(DynamicObject obj, String pushState) {
|
|
|
//是否推送
|
|
//是否推送
|
|
|
boolean isPush = obj.getBoolean("nckd_ispush");
|
|
boolean isPush = obj.getBoolean("nckd_ispush");
|
|
|
//元数据
|
|
//元数据
|
|
@@ -389,7 +392,7 @@ public class GzwCommonUtils {
|
|
|
String numberSign = properties.containsKey("number") ? "number" : "billno";
|
|
String numberSign = properties.containsKey("number") ? "number" : "billno";
|
|
|
//单据已审核 且 未推送单据 标识 = 新增。 如果已推送,说明不需要再次推送
|
|
//单据已审核 且 未推送单据 标识 = 新增。 如果已推送,说明不需要再次推送
|
|
|
if ((obj.getString(statusSign).equals("C") || obj.getString(statusSign).equals("E")) && !isPush) {
|
|
if ((obj.getString(statusSign).equals("C") || obj.getString(statusSign).equals("E")) && !isPush) {
|
|
|
- if(pushState.equals("ZCTS")){
|
|
|
|
|
|
|
+ if (pushState.equals("ZCTS")) {
|
|
|
//设置已推送
|
|
//设置已推送
|
|
|
obj.set("nckd_ispush", Boolean.TRUE);
|
|
obj.set("nckd_ispush", Boolean.TRUE);
|
|
|
}
|
|
}
|
|
@@ -397,7 +400,7 @@ public class GzwCommonUtils {
|
|
|
}
|
|
}
|
|
|
//单据非已审核 且 已推送 标识=删除。 如果未推送,说明数据还未审核过 或者 已进行过删除,也不需要再次推送
|
|
//单据非已审核 且 已推送 标识=删除。 如果未推送,说明数据还未审核过 或者 已进行过删除,也不需要再次推送
|
|
|
if (!obj.getString(statusSign).equals("C") && !obj.getString(statusSign).equals("E") && isPush) {
|
|
if (!obj.getString(statusSign).equals("C") && !obj.getString(statusSign).equals("E") && isPush) {
|
|
|
- if(pushState.equals("ZCTS")){
|
|
|
|
|
|
|
+ if (pushState.equals("ZCTS")) {
|
|
|
//设置未推送
|
|
//设置未推送
|
|
|
obj.set("nckd_ispush", Boolean.FALSE);
|
|
obj.set("nckd_ispush", Boolean.FALSE);
|
|
|
}
|
|
}
|
|
@@ -526,6 +529,11 @@ public class GzwCommonUtils {
|
|
|
public static File saveXmlToFile(String xmlContent, String filePath) {
|
|
public static File saveXmlToFile(String xmlContent, String filePath) {
|
|
|
File xmlFile = new File(filePath);
|
|
File xmlFile = new File(filePath);
|
|
|
|
|
|
|
|
|
|
+ File parentDir = xmlFile.getParentFile();
|
|
|
|
|
+ if (parentDir != null && !parentDir.exists()) {
|
|
|
|
|
+ parentDir.mkdirs();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
try (BufferedWriter writer = new BufferedWriter(
|
|
try (BufferedWriter writer = new BufferedWriter(
|
|
|
new OutputStreamWriter(new FileOutputStream(xmlFile), StandardCharsets.UTF_8))) {
|
|
new OutputStreamWriter(new FileOutputStream(xmlFile), StandardCharsets.UTF_8))) {
|
|
|
writer.write(xmlContent);
|
|
writer.write(xmlContent);
|