|
@@ -24,7 +24,6 @@ import com.malk.server.aliwork.YDParam;
|
|
|
import com.malk.server.common.McR;
|
|
import com.malk.server.common.McR;
|
|
|
import com.malk.server.dingtalk.DDR_New;
|
|
import com.malk.server.dingtalk.DDR_New;
|
|
|
import com.malk.server.teambition.TBConf;
|
|
import com.malk.server.teambition.TBConf;
|
|
|
-import com.malk.server.teambition.TBR;
|
|
|
|
|
import com.malk.service.aliwork.YDClient;
|
|
import com.malk.service.aliwork.YDClient;
|
|
|
import com.malk.service.aliwork.YDService;
|
|
import com.malk.service.aliwork.YDService;
|
|
|
import com.malk.service.dingtalk.DDClient;
|
|
import com.malk.service.dingtalk.DDClient;
|
|
@@ -37,11 +36,9 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
import org.apache.http.HttpEntity;
|
|
import org.apache.http.HttpEntity;
|
|
|
import org.apache.http.client.HttpClient;
|
|
import org.apache.http.client.HttpClient;
|
|
|
-import org.apache.http.client.methods.HttpGet;
|
|
|
|
|
import org.apache.http.client.methods.HttpPost;
|
|
import org.apache.http.client.methods.HttpPost;
|
|
|
import org.apache.http.entity.ContentType;
|
|
import org.apache.http.entity.ContentType;
|
|
|
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
|
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
|
|
-import org.apache.http.impl.client.HttpClients;
|
|
|
|
|
import org.apache.http.util.EntityUtils;
|
|
import org.apache.http.util.EntityUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -50,9 +47,7 @@ import org.springframework.stereotype.Service;
|
|
|
import java.io.*;
|
|
import java.io.*;
|
|
|
import java.net.HttpURLConnection;
|
|
import java.net.HttpURLConnection;
|
|
|
import java.net.URL;
|
|
import java.net.URL;
|
|
|
-import java.net.URLEncoder;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
|
-import java.nio.file.Files;
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
@@ -103,6 +98,30 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
@Value(value = "${erp_xg.filePath}")
|
|
@Value(value = "${erp_xg.filePath}")
|
|
|
private String filePathXg;
|
|
private String filePathXg;
|
|
|
|
|
|
|
|
|
|
+ @Value(value = "${erp_zj.url}")
|
|
|
|
|
+ private String erpUrlZj;
|
|
|
|
|
+
|
|
|
|
|
+ @Value(value = "${erp_zj.username}")
|
|
|
|
|
+ private String userNameZj;
|
|
|
|
|
+
|
|
|
|
|
+ @Value(value = "${erp_zj.password}")
|
|
|
|
|
+ private String passwordZj;
|
|
|
|
|
+
|
|
|
|
|
+ @Value(value = "${erp_zj.filePath}")
|
|
|
|
|
+ private String filePathZj;
|
|
|
|
|
+
|
|
|
|
|
+ @Value(value = "${erp_hz.url}")
|
|
|
|
|
+ private String erpUrlHz;
|
|
|
|
|
+
|
|
|
|
|
+ @Value(value = "${erp_hz.username}")
|
|
|
|
|
+ private String userNameHz;
|
|
|
|
|
+
|
|
|
|
|
+ @Value(value = "${erp_hz.password}")
|
|
|
|
|
+ private String passwordHz;
|
|
|
|
|
+
|
|
|
|
|
+ @Value(value = "${erp_hz.filePath}")
|
|
|
|
|
+ private String filePathHz;
|
|
|
|
|
+
|
|
|
private final Object $lock = new Object[0];
|
|
private final Object $lock = new Object[0];
|
|
|
|
|
|
|
|
private static final Long EXPIRES_IN = 7200000L;
|
|
private static final Long EXPIRES_IN = 7200000L;
|
|
@@ -281,8 +300,12 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
String erpUrl = "";
|
|
String erpUrl = "";
|
|
|
if ("深圳".equals(type)){
|
|
if ("深圳".equals(type)){
|
|
|
erpUrl = erpUrlSz;
|
|
erpUrl = erpUrlSz;
|
|
|
- }else {
|
|
|
|
|
|
|
+ }else if ("香港".equals(type)){
|
|
|
erpUrl = erpUrlXg;
|
|
erpUrl = erpUrlXg;
|
|
|
|
|
+ }else if ("浙江".equals(type)){
|
|
|
|
|
+ erpUrl = erpUrlZj;
|
|
|
|
|
+ }else if ("杭州".equals(type)){
|
|
|
|
|
+ erpUrl = erpUrlHz;
|
|
|
}
|
|
}
|
|
|
return erpUrl;
|
|
return erpUrl;
|
|
|
}
|
|
}
|
|
@@ -522,6 +545,10 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
|
//附件
|
|
//附件
|
|
|
List<Map> list2 = (List<Map>) formData.get("tableField_ly8fxusx");
|
|
List<Map> list2 = (List<Map>) formData.get("tableField_ly8fxusx");
|
|
|
|
|
+
|
|
|
|
|
+ String[] ERP_FILEPATHS = new String[]{filePathSz,filePathXg,filePathZj,filePathHz};
|
|
|
|
|
+ String[] ERP_ENVS = new String[]{"深圳","香港","浙江","杭州"};
|
|
|
|
|
+
|
|
|
if (Objects.nonNull(list2)){
|
|
if (Objects.nonNull(list2)){
|
|
|
List<Map> makSoFilesList = list2.stream().map(map1 -> {
|
|
List<Map> makSoFilesList = list2.stream().map(map1 -> {
|
|
|
Map detail = new HashMap();
|
|
Map detail = new HashMap();
|
|
@@ -535,7 +562,27 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
String ydDownloadUrl = fileList.get(0).get("downloadUrl").toString();
|
|
String ydDownloadUrl = fileList.get(0).get("downloadUrl").toString();
|
|
|
String fileName = fileList.get(0).get("name").toString();
|
|
String fileName = fileList.get(0).get("name").toString();
|
|
|
fileName = convertChineseToUtf8Hex(fileName);
|
|
fileName = convertChineseToUtf8Hex(fileName);
|
|
|
- if ("深圳".equals(type)){
|
|
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < ERP_ENVS.length; i++) {
|
|
|
|
|
+ if (ERP_ENVS[i].equals(type)){
|
|
|
|
|
+ //将downloadurl下载到本地
|
|
|
|
|
+ try {
|
|
|
|
|
+ downloadFile(ydDownloadUrl, ERP_FILEPATHS[i],fileName);
|
|
|
|
|
+ System.out.println("文件下载成功!");
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ //上传附件
|
|
|
|
|
+ try {
|
|
|
|
|
+ detail.put("files",postWithFile(getErpUrl(type) + "pws/sys/common/upload", ERP_FILEPATHS[i] + fileName,type));
|
|
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ /*if ("深圳".equals(type)){
|
|
|
//将downloadurl下载到本地
|
|
//将downloadurl下载到本地
|
|
|
try {
|
|
try {
|
|
|
downloadFile(ydDownloadUrl, filePathSz,fileName);
|
|
downloadFile(ydDownloadUrl, filePathSz,fileName);
|
|
@@ -549,7 +596,7 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
}
|
|
|
- }else {
|
|
|
|
|
|
|
+ }else if ("香港".equals(type)){
|
|
|
//将downloadurl下载到本地
|
|
//将downloadurl下载到本地
|
|
|
try {
|
|
try {
|
|
|
downloadFile(ydDownloadUrl, filePathXg,fileName);
|
|
downloadFile(ydDownloadUrl, filePathXg,fileName);
|
|
@@ -563,7 +610,21 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ }else if ("浙江".equals(type)){
|
|
|
|
|
+ //将downloadurl下载到本地
|
|
|
|
|
+ try {
|
|
|
|
|
+ downloadFile(ydDownloadUrl, filePathZj,fileName);
|
|
|
|
|
+ System.out.println("文件下载成功!");
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ //上传附件
|
|
|
|
|
+ try {
|
|
|
|
|
+ detail.put("files",postWithFile(getErpUrl(type) + "pws/sys/common/upload", filePathZj + fileName,type));
|
|
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }*/
|
|
|
|
|
|
|
|
return detail;
|
|
return detail;
|
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
@@ -834,8 +895,12 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
if ("深圳".equals(type)){
|
|
if ("深圳".equals(type)){
|
|
|
map = post(erpUrlSz + "pws/sys/mLogin", null, null,UtilMap.map("username, password", userNameSz, passwordSz));
|
|
map = post(erpUrlSz + "pws/sys/mLogin", null, null,UtilMap.map("username, password", userNameSz, passwordSz));
|
|
|
- }else {
|
|
|
|
|
|
|
+ }else if ("香港".equals(type)){
|
|
|
map = post(erpUrlXg + "pws/sys/mLogin", null, null,UtilMap.map("username, password", userNameXg, passwordXg));
|
|
map = post(erpUrlXg + "pws/sys/mLogin", null, null,UtilMap.map("username, password", userNameXg, passwordXg));
|
|
|
|
|
+ }else if ("浙江".equals(type)){
|
|
|
|
|
+ map = post(erpUrlZj + "pws/sys/mLogin", null, null,UtilMap.map("username, password", userNameZj, passwordZj));
|
|
|
|
|
+ }else if ("杭州".equals(type)){
|
|
|
|
|
+ map = post(erpUrlHz + "pws/sys/mLogin", null, null,UtilMap.map("username, password", userNameHz, passwordHz));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (Objects.nonNull(map.get("result"))){
|
|
if (Objects.nonNull(map.get("result"))){
|
|
@@ -1024,7 +1089,8 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
@Override
|
|
@Override
|
|
|
public void updateCurrency() {
|
|
public void updateCurrency() {
|
|
|
//获取erp币别列表
|
|
//获取erp币别列表
|
|
|
- String[] ERP_URLS = new String[]{erpUrlSz,erpUrlXg};
|
|
|
|
|
|
|
+ String[] ERP_URLS = new String[]{erpUrlSz,erpUrlXg,erpUrlZj, erpUrlHz};
|
|
|
|
|
+ String[] ERP_ENVS = new String[]{"深圳","香港","浙江","杭州"};
|
|
|
for (int i = 0; i < ERP_URLS.length; i++) {
|
|
for (int i = 0; i < ERP_URLS.length; i++) {
|
|
|
List<Map<String,String>> list = new ArrayList<>();
|
|
List<Map<String,String>> list = new ArrayList<>();
|
|
|
int pageNo = 1;
|
|
int pageNo = 1;
|
|
@@ -1034,7 +1100,7 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
Map param = new HashMap();
|
|
Map param = new HashMap();
|
|
|
param.put("pageNo",pageNo);
|
|
param.put("pageNo",pageNo);
|
|
|
param.put("pageSize",pageSize);
|
|
param.put("pageSize",pageSize);
|
|
|
- Map<String, Object> res = get(ERP_URLS[i] + "pws/fin/finCurrency/list", param, i == 0 ? getHeader("深圳") : getHeader("香港"));
|
|
|
|
|
|
|
+ Map<String, Object> res = get(ERP_URLS[i] + "pws/fin/finCurrency/list", param, getHeader(ERP_ENVS[i]));
|
|
|
result = (Map) res.get("result");
|
|
result = (Map) res.get("result");
|
|
|
List<Map> records = (List<Map>) result.get("records");
|
|
List<Map> records = (List<Map>) result.get("records");
|
|
|
int finalI = i;
|
|
int finalI = i;
|
|
@@ -1043,11 +1109,7 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
map.put("textField_m054h6gw",map1.get("currencyCode").toString());
|
|
map.put("textField_m054h6gw",map1.get("currencyCode").toString());
|
|
|
map.put("textField_m054h6gx",map1.get("currencyName").toString());
|
|
map.put("textField_m054h6gx",map1.get("currencyName").toString());
|
|
|
map.put("textField_m054h6gy",map1.get("active_dictText").toString());
|
|
map.put("textField_m054h6gy",map1.get("active_dictText").toString());
|
|
|
- if (finalI == 0){
|
|
|
|
|
- map.put("selectField_m3fgkfz9","深圳");
|
|
|
|
|
- }else {
|
|
|
|
|
- map.put("selectField_m3fgkfz9","香港");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ map.put("selectField_m3fgkfz9",ERP_ENVS[finalI]);
|
|
|
map.put("textField_m3fiygvb",map.get("selectField_m3fgkfz9") + map.get("textField_m054h6gw"));//唯一标识
|
|
map.put("textField_m3fiygvb",map.get("selectField_m3fgkfz9") + map.get("textField_m054h6gw"));//唯一标识
|
|
|
|
|
|
|
|
return map;
|
|
return map;
|
|
@@ -1065,7 +1127,8 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
@Override
|
|
@Override
|
|
|
public void updateTaxRate() {
|
|
public void updateTaxRate() {
|
|
|
//获取erp税率列表
|
|
//获取erp税率列表
|
|
|
- String[] ERP_URLS = new String[]{erpUrlSz,erpUrlXg};
|
|
|
|
|
|
|
+ String[] ERP_URLS = new String[]{erpUrlSz,erpUrlXg,erpUrlZj, erpUrlHz};
|
|
|
|
|
+ String[] ERP_ENVS = new String[]{"深圳","香港","浙江","杭州"};
|
|
|
for (int i = 0; i < ERP_URLS.length; i++) {
|
|
for (int i = 0; i < ERP_URLS.length; i++) {
|
|
|
List<Map<String,String>> list = new ArrayList<>();
|
|
List<Map<String,String>> list = new ArrayList<>();
|
|
|
int pageNo = 1;
|
|
int pageNo = 1;
|
|
@@ -1075,7 +1138,7 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
Map param = new HashMap();
|
|
Map param = new HashMap();
|
|
|
param.put("pageNo",pageNo);
|
|
param.put("pageNo",pageNo);
|
|
|
param.put("pageSize",pageSize);
|
|
param.put("pageSize",pageSize);
|
|
|
- Map<String, Object> res = get(ERP_URLS[i] + "pws/fin/finTax/list", param, i == 0 ? getHeader("深圳") : getHeader("香港"));
|
|
|
|
|
|
|
+ Map<String, Object> res = get(ERP_URLS[i] + "pws/fin/finTax/list", param, getHeader(ERP_ENVS[i]));
|
|
|
result = (Map) res.get("result");
|
|
result = (Map) res.get("result");
|
|
|
List<Map> records = (List<Map>) result.get("records");
|
|
List<Map> records = (List<Map>) result.get("records");
|
|
|
int finalI = i;
|
|
int finalI = i;
|
|
@@ -1084,11 +1147,7 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
map.put("textField_m0539uy1",map1.get("id").toString());
|
|
map.put("textField_m0539uy1",map1.get("id").toString());
|
|
|
map.put("numberField_m0539uy2",map1.get("taxValue").toString());
|
|
map.put("numberField_m0539uy2",map1.get("taxValue").toString());
|
|
|
map.put("textField_m0539uy4",map1.get("taxName").toString());
|
|
map.put("textField_m0539uy4",map1.get("taxName").toString());
|
|
|
- if (finalI == 0){
|
|
|
|
|
- map.put("selectField_m3fgkfz9","深圳");
|
|
|
|
|
- }else {
|
|
|
|
|
- map.put("selectField_m3fgkfz9","香港");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ map.put("selectField_m3fgkfz9",ERP_ENVS[finalI]);
|
|
|
map.put("textField_m3fiygvb",map.get("selectField_m3fgkfz9") + map.get("textField_m0539uy1"));//唯一标识
|
|
map.put("textField_m3fiygvb",map.get("selectField_m3fgkfz9") + map.get("textField_m0539uy1"));//唯一标识
|
|
|
return map;
|
|
return map;
|
|
|
}).collect(Collectors.toList()));
|
|
}).collect(Collectors.toList()));
|
|
@@ -1105,7 +1164,8 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
@Override
|
|
@Override
|
|
|
public void updateProcess() {
|
|
public void updateProcess() {
|
|
|
//获取erp工序列表
|
|
//获取erp工序列表
|
|
|
- String[] ERP_URLS = new String[]{erpUrlSz,erpUrlXg};
|
|
|
|
|
|
|
+ String[] ERP_URLS = new String[]{erpUrlSz,erpUrlXg,erpUrlZj, erpUrlHz};
|
|
|
|
|
+ String[] ERP_ENVS = new String[]{"深圳","香港","浙江","杭州"};
|
|
|
for (int i = 0; i < ERP_URLS.length; i++) {
|
|
for (int i = 0; i < ERP_URLS.length; i++) {
|
|
|
List<Map<String,String>> list = new ArrayList<>();
|
|
List<Map<String,String>> list = new ArrayList<>();
|
|
|
int pageNo = 1;
|
|
int pageNo = 1;
|
|
@@ -1116,7 +1176,7 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
Map param = new HashMap();
|
|
Map param = new HashMap();
|
|
|
param.put("pageNo",pageNo);
|
|
param.put("pageNo",pageNo);
|
|
|
param.put("pageSize",pageSize);
|
|
param.put("pageSize",pageSize);
|
|
|
- Map<String, Object> res = get(ERP_URLS[i] + "pws/pdm/pdmStation/list", param, i == 0 ? getHeader("深圳") : getHeader("香港"));
|
|
|
|
|
|
|
+ Map<String, Object> res = get(ERP_URLS[i] + "pws/pdm/pdmStation/list", param, getHeader(ERP_ENVS[i]));
|
|
|
result = (Map) res.get("result");
|
|
result = (Map) res.get("result");
|
|
|
List<Map> records = (List<Map>) result.get("records");
|
|
List<Map> records = (List<Map>) result.get("records");
|
|
|
int finalI = i;
|
|
int finalI = i;
|
|
@@ -1132,11 +1192,7 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
map.put("textField_m04yhw5d",getString(map1.get("stationType_dictText")));//工序类型
|
|
map.put("textField_m04yhw5d",getString(map1.get("stationType_dictText")));//工序类型
|
|
|
map.put("textField_m04yhw5e",getString(map1.get("comments")));//备注
|
|
map.put("textField_m04yhw5e",getString(map1.get("comments")));//备注
|
|
|
map.put("textField_m04yhw5f",getString(map1.get("active_dictText")));//审核状态
|
|
map.put("textField_m04yhw5f",getString(map1.get("active_dictText")));//审核状态
|
|
|
- if (finalI == 0){
|
|
|
|
|
- map.put("selectField_m3fgkfz9","深圳");
|
|
|
|
|
- }else {
|
|
|
|
|
- map.put("selectField_m3fgkfz9","香港");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ map.put("selectField_m3fgkfz9",ERP_ENVS[finalI]);
|
|
|
map.put("textField_m3fiygvb",map.get("selectField_m3fgkfz9") + map.get("textField_m04yhw4p"));//唯一标识
|
|
map.put("textField_m3fiygvb",map.get("selectField_m3fgkfz9") + map.get("textField_m04yhw4p"));//唯一标识
|
|
|
|
|
|
|
|
return map;
|
|
return map;
|