Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
6b4e8083a6
|
@ -1,10 +1,14 @@
|
|||
package nccloud.api.impl.so.m30;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import nc.bd.itf.tools.BFPubTools;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.logging.Logger;
|
||||
import nc.bs.trade.business.HYSuperDMO;
|
||||
import nc.bs.uapbd.bip.workplugin.IgnoreSslUtil;
|
||||
import nc.impl.pubapp.pattern.data.bill.BillQuery;
|
||||
import nc.itf.scmpub.reference.uap.bd.customer.CustomerPubService;
|
||||
import nc.itf.scmpub.reference.uap.pf.PfServiceScmUtil;
|
||||
|
@ -51,8 +55,17 @@ import nccloud.openapi.scmpub.pub.TransferMapToVOTool;
|
|||
import nccloud.putitf.riart.billtype.IBilltypeService;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
* @Description: 销售订单维护实现类
|
||||
|
@ -61,7 +74,6 @@ import java.util.*;
|
|||
* @Copyright:
|
||||
*/
|
||||
public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
||||
|
||||
private static String BODYTABLE = "so_saleorder_b";
|
||||
private static String HEADTABLE = "so_saleorder";
|
||||
|
||||
|
@ -551,7 +563,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
if (vtrantypecode != null && !vtrantypecode.isEmpty()) {
|
||||
targetHVO.setVtrantypecode(vtrantypecode);
|
||||
}
|
||||
//订单关联合同号
|
||||
// 订单关联合同号
|
||||
|
||||
String vdef19 = sourceHVO.getVdef19();
|
||||
if (vdef19 != null && !vdef19.isEmpty()) {
|
||||
|
@ -1175,15 +1187,15 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
newBvo.setNqtunitnum(nastnum);// 报价单位数量
|
||||
|
||||
// 自定义项赋值
|
||||
String vbdef1 = bodydata.getOrDefault("vbdef1","") + "";// 合同编号
|
||||
String vbdef1 = bodydata.getOrDefault("vbdef1", "") + "";// 合同编号
|
||||
Map<String, String> defList = getDefList("zdy-001");
|
||||
newBvo.setVbdef1(defList.getOrDefault(vbdef1, ""));
|
||||
String vbdef5 = bodydata.getOrDefault("vbdef5","") + "";// 合同销售订单号
|
||||
String vbdef5 = bodydata.getOrDefault("vbdef5", "") + "";// 合同销售订单号
|
||||
defList.clear();
|
||||
defList = getDefList("BIP-ddh");
|
||||
newBvo.setVbdef5(defList.getOrDefault(vbdef5, ""));
|
||||
newBvo.setVbdef10(bodydata.getOrDefault("vbdef10","") + "");// 项目名称
|
||||
newBvo.setVbdef13(bodydata.getOrDefault("vbdef13","") + "");// 国网行项目号
|
||||
newBvo.setVbdef10(bodydata.getOrDefault("vbdef10", "") + "");// 项目名称
|
||||
newBvo.setVbdef13(bodydata.getOrDefault("vbdef13", "") + "");// 国网行项目号
|
||||
|
||||
bvoList.add(newBvo);
|
||||
}
|
||||
|
@ -1253,4 +1265,280 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
|||
return new UFDouble(value.toString().trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* 回写BIP旗舰版的合同销售订单
|
||||
*
|
||||
* @author mzr
|
||||
* @date 2025/5/23
|
||||
*/
|
||||
@Override
|
||||
public void updateBipFlagSo(Map<String, Object> paramMap) throws Exception {
|
||||
String csaleorderbid = (String) paramMap.get("csaleorderbid");
|
||||
Map<String, Object> soMap = getSaleOrderInfo(csaleorderbid);
|
||||
// 如果没有存合同销售订单信息则不回写
|
||||
if (soMap.get("vbdef11") == null || soMap.get("vdef9") == null) {
|
||||
return;
|
||||
}
|
||||
Map<String, String> bipParamMap = checkBipParam();
|
||||
if (bipParamMap.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String baseUrl = bipParamMap.get("baseUrl");
|
||||
String soUpdateUrl = bipParamMap.get("contractSaleOrder");
|
||||
if (StringUtils.isEmpty(soUpdateUrl)) {
|
||||
return;
|
||||
}
|
||||
String accessToken = getAccessToken(baseUrl, bipParamMap);
|
||||
Map<String, String> tokenParam = new HashMap<>();
|
||||
tokenParam.put("access_token", accessToken);
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("Content-Type", "application/json");
|
||||
String updateUrl = baseUrl + soUpdateUrl;
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
JSONObject updateJson = new JSONObject();
|
||||
List<Map<String, Object>> l_map_f = new ArrayList<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// bomConfigureFinishDate BOM配置完成日期
|
||||
map.put("bomConfigureFinishDate", paramMap.get("vbdef16"));
|
||||
// craftConfigureFinishDate 工艺配置完成日期
|
||||
map.put("craftConfigureFinishDate", paramMap.get("vbdef17"));
|
||||
// BIP合同销售订单更新 子表id
|
||||
map.put("id", soMap.get("vbdef11"));
|
||||
l_map_f.add(map);
|
||||
updateJson.put("contractOrdersList", l_map_f);
|
||||
// BIP合同销售订单更新 主表id
|
||||
updateJson.put("id", soMap.get("vdef9"));
|
||||
bodyJson.put("HTXSDD", updateJson);
|
||||
String resultString = doSendHttp(updateUrl, "POST", tokenParam, "", headers, bodyJson.toJSONString());
|
||||
NCCForUAPLogger.debug("updateBipFlagSo-resultString:" + resultString);
|
||||
Logger.error("updateBipFlagSo-resultString:" + resultString);
|
||||
}
|
||||
|
||||
private Map<String, Object> getSaleOrderInfo(String csaleorderbid) throws BusinessException {
|
||||
IUAPQueryBS queryBS = NCLocator.getInstance().lookup(IUAPQueryBS.class);
|
||||
String sql = " select s.vdef9,s.csaleorderid," +
|
||||
" sb.csaleorderbid,sb.vbdef11" +
|
||||
" from so_saleorder_b sb" +
|
||||
" inner join so_saleorder s on sb.csaleorderid=s.csaleorderid" +
|
||||
" where sb.csaleorderbid='" + csaleorderbid + "' ";
|
||||
return (Map<String, Object>) queryBS.executeQuery(sql, new MapProcessor());
|
||||
}
|
||||
|
||||
private Map<String, String> checkBipParam() {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
String strWhere = " pk_defdoclist in (select pk_defdoclist from bd_defdoclist where code='BIP-sq' and dr=0 ) and dr=0";
|
||||
try {
|
||||
DefdocVO[] defdocVOs = (DefdocVO[]) new HYSuperDMO().queryByWhereClause(DefdocVO.class, strWhere);
|
||||
if (defdocVOs != null && defdocVOs.length > 0) {
|
||||
for (DefdocVO defdocVO : defdocVOs) {
|
||||
map.put(defdocVO.getCode().trim(), defdocVO.getName());
|
||||
}
|
||||
}
|
||||
} catch (DAOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
private String getAccessToken(String baseUrl, Map<String, String> bipParamMap) throws Exception {
|
||||
String tokenUrl = baseUrl + "/iuap-api-auth/open-auth/selfAppAuth/getAccessToken";
|
||||
// String appKey = "f10c4bf17b1d4e1fb08eb82bf8540eab";
|
||||
String appKey = bipParamMap.get("appKey");
|
||||
|
||||
// String appSecret = "71dc2a58ca378c1a1143231a62e73e75a60e9236";
|
||||
String appSecret = bipParamMap.get("appSecret");
|
||||
String accessToken = "";
|
||||
Map<String, String> params = new HashMap<>();
|
||||
|
||||
|
||||
params.put("appKey", appKey);
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
params.put("timestamp", timestamp);
|
||||
// 计算签名
|
||||
Map<String, String> treeMap;
|
||||
if (params instanceof TreeMap) {
|
||||
treeMap = params;
|
||||
} else {
|
||||
treeMap = new TreeMap<>(params);
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : treeMap.entrySet()) {
|
||||
stringBuilder.append(entry.getKey()).append(entry.getValue());
|
||||
}
|
||||
Mac mac = Mac.getInstance("HmacSHA256");
|
||||
|
||||
mac.init(new SecretKeySpec(appSecret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
|
||||
byte[] signData = mac.doFinal(stringBuilder.toString().getBytes(StandardCharsets.UTF_8));
|
||||
String base64String = Base64.getEncoder().encodeToString(signData);
|
||||
String signature = URLEncoder.encode(base64String, "UTF-8");
|
||||
params.put("signature", signature);
|
||||
|
||||
String responseString = doGet(tokenUrl, params);
|
||||
|
||||
Gson gson = new Gson();
|
||||
Map result = gson.fromJson(responseString, Map.class);
|
||||
if (com.yonyou.cloud.utils.StringUtils.equals("00000", result.get("code").toString())) {
|
||||
Map<String, Object> tokenInfo = (Map<String, Object>) result.get("data");
|
||||
accessToken = (String) tokenInfo.get("access_token");
|
||||
|
||||
}
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public static String doSendHttp(String baseUrl, String method, Map<String, String> paramMap, String mediaType, Map<String, String> headers, String json) {
|
||||
HttpURLConnection urlConnection = null;
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
BufferedReader bufferedReader = null;
|
||||
String result = null;
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(baseUrl);
|
||||
if (paramMap != null) {
|
||||
sb.append("?");
|
||||
for (Map.Entry<String, String> entry : paramMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = entry.getValue();
|
||||
sb.append(key).append("=").append(value).append("&");
|
||||
baseUrl = sb.substring(0, sb.toString().length() - 1);
|
||||
}
|
||||
}
|
||||
URL urlobj = new URL(baseUrl);
|
||||
if ("https".equalsIgnoreCase(urlobj.getProtocol())) {// 判定网址是否信任,不信任则调用忽略信任工具类SslUtil
|
||||
IgnoreSslUtil.ignoreSsl();
|
||||
}
|
||||
urlConnection = (HttpURLConnection) urlobj.openConnection();
|
||||
urlConnection.setConnectTimeout(50000);
|
||||
urlConnection.setRequestMethod(method);
|
||||
urlConnection.setDoInput(true);
|
||||
urlConnection.setUseCaches(false);
|
||||
// 如果设置了自定义头,则打印它们
|
||||
if (headers != null && !headers.isEmpty()) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
urlConnection.addRequestProperty(entry.getKey(), entry.getValue());
|
||||
// log.error("Request Header: " + entry.getKey() + ": " + entry.getValue());
|
||||
}
|
||||
}
|
||||
if (json != null && !json.isEmpty()) {
|
||||
// log.error("Request Body: " + json);
|
||||
urlConnection.setDoInput(true);
|
||||
urlConnection.setDoOutput(true);
|
||||
out = urlConnection.getOutputStream();
|
||||
out.write(json.getBytes(StandardCharsets.UTF_8));
|
||||
out.flush();
|
||||
}
|
||||
int resCode = urlConnection.getResponseCode();
|
||||
String ecod = urlConnection.getContentEncoding();
|
||||
if (resCode == HttpURLConnection.HTTP_OK || resCode == HttpURLConnection.HTTP_CREATED
|
||||
|| resCode == HttpURLConnection.HTTP_ACCEPTED) {
|
||||
if (com.yonyou.cloud.utils.StringUtils.isNotEmpty(ecod) && ecod.equals("gzip")) {
|
||||
in = new GZIPInputStream(urlConnection.getInputStream());
|
||||
} else {
|
||||
in = urlConnection.getInputStream();
|
||||
}
|
||||
} else {
|
||||
in = urlConnection.getErrorStream();
|
||||
}
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
|
||||
StringBuilder temp = new StringBuilder();
|
||||
String line = bufferedReader.readLine();
|
||||
while (line != null) {
|
||||
temp.append(line).append("\r\n");
|
||||
line = bufferedReader.readLine();
|
||||
}
|
||||
if (ecod == null || ecod.equals("gzip")) {
|
||||
ecod = StandardCharsets.UTF_8.name();
|
||||
}
|
||||
result = new String(temp.toString().getBytes(StandardCharsets.UTF_8), ecod);
|
||||
} catch (Exception e) {
|
||||
JSONObject js = new JSONObject();
|
||||
js.put("", -1);
|
||||
js.put("message", "调用外系统接口失败:" + e.getMessage());
|
||||
result = js.toString();
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (null != bufferedReader) {
|
||||
try {
|
||||
bufferedReader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (null != out) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (null != in) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
urlConnection.disconnect();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static String doGet(String path, Map<String, String> params) throws Exception {
|
||||
HttpURLConnection conn = null;
|
||||
InputStream is = null;
|
||||
BufferedReader br = null;
|
||||
StringBuilder result = new StringBuilder();
|
||||
try {
|
||||
if (params != null) {
|
||||
String paramStr = "";
|
||||
for (String key : params.keySet()) {
|
||||
if (!paramStr.isEmpty()) {
|
||||
paramStr += '&';
|
||||
}
|
||||
paramStr += key + '=' + params.get(key);
|
||||
}
|
||||
|
||||
if (path.indexOf('?') > 0) {
|
||||
path += '&' + paramStr;
|
||||
} else {
|
||||
path += '?' + paramStr;
|
||||
}
|
||||
}
|
||||
// 创建远程url连接对象
|
||||
URL url = new URL(path);
|
||||
if ("https".equalsIgnoreCase(url.getProtocol())) {// 判定网址是否信任,不信任则调用忽略信任工具类SslUtil
|
||||
IgnoreSslUtil.ignoreSsl();
|
||||
}
|
||||
// 通过远程url连接对象打开一个连接,强转成HTTPURLConnection类
|
||||
conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("GET");
|
||||
// 设置连接超时时间和读取超时时间
|
||||
conn.setConnectTimeout(120000);
|
||||
conn.setReadTimeout(120000);
|
||||
conn.setRequestProperty("Accept", "application/json");
|
||||
// 发送请求
|
||||
conn.connect();
|
||||
// 通过conn取得输入流,并使用Reader读取
|
||||
if (200 == conn.getResponseCode()) {
|
||||
is = conn.getInputStream();
|
||||
br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
result.append(line);
|
||||
System.out.println(line);
|
||||
}
|
||||
} else {
|
||||
System.out.println("ResponseCode is an error code:" + conn.getResponseCode());
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,4 +21,6 @@ public interface IAPISaleOrderMaitain {
|
|||
SaleOrderVO[] unApprove(String[] paramArrayOfString) throws BusinessException;
|
||||
|
||||
public SaleOrderVO[] save(SaleOrderVO[] vos) throws BusinessException;
|
||||
|
||||
public void updateBipFlagSo(Map<String, Object> paramMap) throws Exception;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package nccloud.openapi.so.m30;
|
||||
|
||||
import nc.bd.itf.tools.BFPubTools;
|
||||
|
@ -75,8 +74,7 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
}
|
||||
}
|
||||
|
||||
IAPISaleOrderMaitain service = (IAPISaleOrderMaitain) NCLocator.getInstance()
|
||||
.lookup(IAPISaleOrderMaitain.class);
|
||||
IAPISaleOrderMaitain service = (IAPISaleOrderMaitain) NCLocator.getInstance().lookup(IAPISaleOrderMaitain.class);
|
||||
SaleOrderVO[] results = service.save(paramList);
|
||||
|
||||
return ResultMessageUtil.toJSON(results, "销售订单新增保存成功");
|
||||
|
@ -143,16 +141,14 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
List<Object> bodyArr = (List<Object>) map.get(BODYTABLE);
|
||||
for (Object body : bodyArr) {
|
||||
Map<String, Object> bodydata = (Map<String, Object>) body;
|
||||
String sql = " select pk_project from bd_project where project_code='" + headdata.get("vdef6")
|
||||
+ "' and nvl(dr,0)=0 ";
|
||||
String sql = " select pk_project from bd_project where project_code='" + headdata.get("vdef6") + "' and nvl(dr,0)=0 ";
|
||||
String o_pk_project = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
|
||||
bodydata.put("cprojectid", o_pk_project);
|
||||
}
|
||||
}
|
||||
|
||||
// 参数形式转换为vo并翻译
|
||||
List<SaleOrderVO> vosList =
|
||||
TransferMapToVOTool.transferMapToAggVO(paramList, SaleOrderVO.class);
|
||||
List<SaleOrderVO> vosList = TransferMapToVOTool.transferMapToAggVO(paramList, SaleOrderVO.class);
|
||||
vosList = TransferCodeToPKTool.transferAggVO(vosList);
|
||||
SaleOrderVO[] vos = vosList.toArray(new SaleOrderVO[vosList.size()]);
|
||||
|
||||
|
@ -171,8 +167,7 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
ArrayList<String> arrhth = new ArrayList<String>();
|
||||
ArrayList<String> arrxmh = new ArrayList<String>();
|
||||
ArrayList<String> arrxsddh = new ArrayList<String>();
|
||||
String sql = " select pk_org,pk_vid from org_orgs where org_orgs.code='" + salevos[0].getParentVO().getPk_org()
|
||||
+ "' and nvl(dr,0)=0 and isbusinessunit='Y' ";
|
||||
String sql = " select pk_org,pk_vid from org_orgs where org_orgs.code='" + salevos[0].getParentVO().getPk_org() + "' and nvl(dr,0)=0 and isbusinessunit='Y' ";
|
||||
|
||||
Map map = (Map) baseDAO.executeQuery(sql, new MapProcessor());
|
||||
if (map == null) {
|
||||
|
@ -183,8 +178,7 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
String cprocode = salevos[0].getChildrenVO()[0].getCprojectid();
|
||||
String cproname = salevos[0].getChildrenVO()[0].getVbdef10();
|
||||
if (!BFPubTools.getString_TrimAsNull(cprocode).equals("")) {
|
||||
sql = " select pk_project from bd_project where project_code='" + cprocode + "' and pk_duty_org='" + o
|
||||
+ "' and nvl(dr,0)=0 ";
|
||||
sql = " select pk_project from bd_project where project_code='" + cprocode + "' and pk_duty_org='" + o + "' and nvl(dr,0)=0 ";
|
||||
String o_pk_project = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
|
||||
if (o_pk_project == null) {
|
||||
// 新增项目档案
|
||||
|
@ -210,8 +204,7 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
|
||||
}
|
||||
if (arrhth.size() > 0) {
|
||||
sql = " select code from bd_defdoc where pk_defdoclist in(select pk_defdoclist from bd_defdoclist where code='zdy-001') and pk_org='"
|
||||
+ o + "' and ";
|
||||
sql = " select code from bd_defdoc where pk_defdoclist in(select pk_defdoclist from bd_defdoclist where code='zdy-001') and pk_org='" + o + "' and ";
|
||||
sql += BFPubTools.getInSqlWithOutAnd("code", arrhth, 0, arrhth.size());
|
||||
ArrayList<String> obj_arrhth = (ArrayList<String>) baseDAO.executeQuery(sql, new ColumnListProcessor());
|
||||
if (obj_arrhth != null && obj_arrhth.size() > 0) {
|
||||
|
@ -221,13 +214,11 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
|
||||
// 组装销售订单数据
|
||||
if (arrhth.size() > 0) {
|
||||
NCLocator.getInstance().lookup(IDefdocService.class).insertDefdocs(o,
|
||||
createDefVO(arrhth, "zdy-001", o.toString()));
|
||||
NCLocator.getInstance().lookup(IDefdocService.class).insertDefdocs(o, createDefVO(arrhth, "zdy-001", o.toString()));
|
||||
}
|
||||
|
||||
if (arrxmh.size() > 0) {
|
||||
sql = " select code from bd_defdoc where pk_defdoclist in(select pk_defdoclist from bd_defdoclist where code='BQxmh') and pk_org='"
|
||||
+ o + "' and ";
|
||||
sql = " select code from bd_defdoc where pk_defdoclist in(select pk_defdoclist from bd_defdoclist where code='BQxmh') and pk_org='" + o + "' and ";
|
||||
sql += BFPubTools.getInSqlWithOutAnd("code", arrxmh, 0, arrxmh.size());
|
||||
ArrayList<String> obj_arrhth = (ArrayList<String>) baseDAO.executeQuery(sql, new ColumnListProcessor());
|
||||
|
||||
|
@ -238,13 +229,11 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
|
||||
}
|
||||
if (arrxmh.size() > 0) {
|
||||
NCLocator.getInstance().lookup(IDefdocService.class).insertDefdocs(o,
|
||||
createDefVO(arrxmh, "BQxmh", o.toString()));
|
||||
NCLocator.getInstance().lookup(IDefdocService.class).insertDefdocs(o, createDefVO(arrxmh, "BQxmh", o.toString()));
|
||||
}
|
||||
|
||||
if (arrxsddh.size() > 0) {
|
||||
sql = " select code from bd_defdoc where pk_defdoclist in( select pk_defdoclist from bd_defdoclist where code='BIP-ddh') and pk_org='"
|
||||
+ o + "' and ";
|
||||
sql = " select code from bd_defdoc where pk_defdoclist in( select pk_defdoclist from bd_defdoclist where code='BIP-ddh') and pk_org='" + o + "' and ";
|
||||
sql += BFPubTools.getInSqlWithOutAnd("code", arrxsddh, 0, arrxsddh.size());
|
||||
ArrayList<String> obj_arrhth = (ArrayList<String>) baseDAO.executeQuery(sql, new ColumnListProcessor());
|
||||
if (obj_arrhth != null && obj_arrhth.size() > 0) {
|
||||
|
@ -252,8 +241,7 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
}
|
||||
}
|
||||
if (arrxsddh.size() > 0) {
|
||||
NCLocator.getInstance().lookup(IDefdocService.class).insertDefdocs(o,
|
||||
createDefVO(arrxsddh, "BIP-ddh", o.toString()));
|
||||
NCLocator.getInstance().lookup(IDefdocService.class).insertDefdocs(o, createDefVO(arrxsddh, "BIP-ddh", o.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -307,8 +295,7 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
}
|
||||
|
||||
private void setMaterl(Map<String, Object> bodydata) throws BusinessException {
|
||||
String sql = " select a.pk_material,a.pk_source, a.pk_measdoc cunitid,nvl(b.pk_measdoc,a.pk_measdoc) castunitid,nvl(b.measrate,'1/1') measrate from bd_material a left join bd_materialconvert b on a.pk_material=b.pk_material where a.code='"
|
||||
+ bodydata.get("cmaterialvid") + "' ";
|
||||
String sql = " select a.pk_material,a.pk_source, a.pk_measdoc cunitid,nvl(b.pk_measdoc,a.pk_measdoc) castunitid,nvl(b.measrate,'1/1') measrate from bd_material a left join bd_materialconvert b on a.pk_material=b.pk_material where a.code='" + bodydata.get("cmaterialvid") + "' ";
|
||||
Map map = (Map) getDao().executeQuery(sql, new MapProcessor());
|
||||
if (map == null) {
|
||||
throw new BusinessException(bodydata.get("cmaterialvid") + "物料未查到");
|
||||
|
@ -322,13 +309,10 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
bodydata.put("cmaterialid", map.get("pk_material"));
|
||||
bodydata.put("cmaterialvid", map.get("pk_source"));
|
||||
|
||||
bodydata.put("nqtunitnum", BFPubTools.getUFDouble_NullAsZero(bodydata.get("nnum"))
|
||||
.div(BFPubTools.getUFDouble_NullAsZero(map.get("measrate").toString().split("/")[0])));
|
||||
bodydata.put("nqtunitnum", BFPubTools.getUFDouble_NullAsZero(bodydata.get("nnum")).div(BFPubTools.getUFDouble_NullAsZero(map.get("measrate").toString().split("/")[0])));
|
||||
|
||||
bodydata.put("nastnum", BFPubTools.getUFDouble_NullAsZero(bodydata.get("nnum"))
|
||||
.div(BFPubTools.getUFDouble_NullAsZero(map.get("measrate").toString().split("/")[0])));
|
||||
sql = "select sl.pk_taxcode from bd_taxrate sl inner join bd_taxcode sm on sl.pk_taxcode=sm.pk_taxcode where sl.taxrate="
|
||||
+ bodydata.get("ntaxrate") + " and sm.pk_group<>'~' " + "";
|
||||
bodydata.put("nastnum", BFPubTools.getUFDouble_NullAsZero(bodydata.get("nnum")).div(BFPubTools.getUFDouble_NullAsZero(map.get("measrate").toString().split("/")[0])));
|
||||
sql = "select sl.pk_taxcode from bd_taxrate sl inner join bd_taxcode sm on sl.pk_taxcode=sm.pk_taxcode where sl.taxrate=" + bodydata.get("ntaxrate") + " and sm.pk_group<>'~' " + "";
|
||||
|
||||
String o_pk_project = (String) getDao().executeQuery(sql, new ColumnProcessor());
|
||||
bodydata.put("ctaxcodeid", o_pk_project);
|
||||
|
@ -348,14 +332,12 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
|
||||
paramList.add(paramMap);
|
||||
|
||||
IAPISaleOrderMaitain service = (IAPISaleOrderMaitain) NCLocator.getInstance()
|
||||
.lookup(IAPISaleOrderMaitain.class);
|
||||
IAPISaleOrderMaitain service = (IAPISaleOrderMaitain) NCLocator.getInstance().lookup(IAPISaleOrderMaitain.class);
|
||||
SaleOrderVO[] results = service.update(paramList);
|
||||
|
||||
// return ResultMessageUtil.toJSON(results, "销售订单修改成功");
|
||||
// 包装返回信息
|
||||
return NCCRestUtils.toJSONString(CallReturnBuildUtil.buildSuccessResult(
|
||||
results, "ÏúÊÛ¶©µ¥Ð޸ijɹ¦"));
|
||||
return NCCRestUtils.toJSONString(CallReturnBuildUtil.buildSuccessResult(results, "销售订单修改成功"));
|
||||
} catch (Exception e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
|
@ -397,8 +379,7 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
SaleOrderVO[] resultVOs = null;
|
||||
|
||||
try {
|
||||
resultVOs = ((IAPISaleOrderQuery) NCLocator.getInstance().lookup(IAPISaleOrderQuery.class))
|
||||
.queryByScheme(paramMap);
|
||||
resultVOs = ((IAPISaleOrderQuery) NCLocator.getInstance().lookup(IAPISaleOrderQuery.class)).queryByScheme(paramMap);
|
||||
|
||||
return ResultMessageUtil.toJSON(resultVOs, "查询销售订单成功");
|
||||
} catch (Exception e) {
|
||||
|
@ -419,8 +400,7 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
}
|
||||
|
||||
try {
|
||||
sendApprove = ((IAPISaleOrderMaitain) NCLocator.getInstance().lookup(IAPISaleOrderMaitain.class))
|
||||
.sendApprove(hids);
|
||||
sendApprove = ((IAPISaleOrderMaitain) NCLocator.getInstance().lookup(IAPISaleOrderMaitain.class)).sendApprove(hids);
|
||||
return ResultMessageUtil.toJSON(sendApprove, "销售订单提交成功");
|
||||
} catch (BusinessException e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
|
@ -440,8 +420,7 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
}
|
||||
|
||||
try {
|
||||
unSend = ((IAPISaleOrderMaitain) NCLocator.getInstance().lookup(IAPISaleOrderMaitain.class))
|
||||
.unSendApprove(hids);
|
||||
unSend = ((IAPISaleOrderMaitain) NCLocator.getInstance().lookup(IAPISaleOrderMaitain.class)).unSendApprove(hids);
|
||||
return ResultMessageUtil.toJSON(unSend, "销售订单收回成功");
|
||||
} catch (BusinessException e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
|
@ -479,8 +458,7 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
return ResultMessageUtil.exceptionToJSON("传入参数为空,请检查", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||
}
|
||||
try {
|
||||
unaprove = ((IAPISaleOrderMaitain) NCLocator.getInstance().lookup(IAPISaleOrderMaitain.class))
|
||||
.unApprove(hids);
|
||||
unaprove = ((IAPISaleOrderMaitain) NCLocator.getInstance().lookup(IAPISaleOrderMaitain.class)).unApprove(hids);
|
||||
return ResultMessageUtil.toJSON(unaprove, "销售订单取消审批成功");
|
||||
} catch (BusinessException e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
|
@ -521,8 +499,12 @@ public class SaleOrderResource extends NCCPubRestResource {
|
|||
parameter.addParam(csaleorderbid);
|
||||
BaseDAO baseDAO = new BaseDAO();
|
||||
int num = baseDAO.executeUpdate(sql.toString(), parameter);
|
||||
if (num > 0) {
|
||||
// 回写合同平台的对应字段
|
||||
NCLocator.getInstance().lookup(IAPISaleOrderMaitain.class).updateBipFlagSo(paramMap);
|
||||
}
|
||||
return ResultMessageUtil.toJSON(num, "销售订单修改成功");
|
||||
} catch (BusinessException e) {
|
||||
} catch (Exception e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue