saleUpdateLJpc接口的返回值调整
This commit is contained in:
parent
33bb0d8c2a
commit
ce5886c7b5
|
@ -6,14 +6,15 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.itf.uap.IUAPQueryBS;
|
||||
import nc.jdbc.framework.ConnectionFactory;
|
||||
import nc.jdbc.framework.JdbcSession;
|
||||
import nc.jdbc.framework.PersistenceManager;
|
||||
import nc.jdbc.framework.exception.DbException;
|
||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||
import nc.jdbc.framework.processor.MapListProcessor;
|
||||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||
import nccloud.commons.lang.StringUtils;
|
||||
import nccloud.ws.rest.resource.AbstractNCCRestResource;
|
||||
import org.json.JSONString;
|
||||
|
||||
|
@ -34,8 +35,10 @@ public class saleUpdateLJpc extends AbstractNCCRestResource {
|
|||
public String getModule() {
|
||||
return "so";
|
||||
}
|
||||
|
||||
// 用于存储手工维护的必填字段和字段说明
|
||||
private Map<String, String> requiredFields;
|
||||
|
||||
// 构造方法,初始化必填字段及其说明
|
||||
public saleUpdateLJpc() {
|
||||
// 初始化必填字段列表及字段说明
|
||||
|
@ -59,7 +62,7 @@ public class saleUpdateLJpc extends AbstractNCCRestResource {
|
|||
}
|
||||
// 校验必填字段
|
||||
String tipsStr = checkRequiredFields(object);
|
||||
if (!tipsStr.equals("")) {
|
||||
if (!tipsStr.isEmpty()) {
|
||||
return ResultMessageUtil.exceptionToJSON(new NullPointerException(tipsStr));
|
||||
}
|
||||
String pk_org = (String) object.getOrDefault("pk_org", "");
|
||||
|
@ -72,10 +75,11 @@ public class saleUpdateLJpc extends AbstractNCCRestResource {
|
|||
|
||||
// StringBuilder sqlStr = new StringBuilder();
|
||||
List sqlStr = new ArrayList();
|
||||
List<JSONObject> resList = new ArrayList<>();
|
||||
for (int i = 0; i < arrayList.size(); i++) {
|
||||
Map dataMap = (Map) arrayList.get(i);
|
||||
|
||||
String sqlser="SELECT b.csaleorderid, b.vbdef6, b.vbdef12 "
|
||||
String sqlser = "SELECT b.csaleorderid, b.vbdef6, b.vbdef12 "
|
||||
+ "FROM so_saleorder_b b "
|
||||
+ "LEFT JOIN so_saleorder h ON b.csaleorderid = h.csaleorderid "
|
||||
+ "LEFT JOIN org_salesorg o ON h.pk_org = o.pk_salesorg "
|
||||
|
@ -83,14 +87,14 @@ public class saleUpdateLJpc extends AbstractNCCRestResource {
|
|||
+ "AND o.code = '" + pk_org + "' "
|
||||
+ "AND b.csaleorderbid = '" + dataMap.get("crowno") + "'";
|
||||
List<Map<String, Object>> results = (List<Map<String, Object>>) getQueryService().executeQuery(sqlser, new MapListProcessor());
|
||||
if (results.size()==0){
|
||||
if (results.size() == 0) {
|
||||
returnJson.put("state", 'N');
|
||||
returnJson.put("msg", "失败,单据"+dataMap.get("vbillcode")+"行号:"+dataMap.get("crowno")+"不存在");
|
||||
returnJson.put("msg", "失败,单据" + dataMap.get("vbillcode") + "行号:" + dataMap.get("crowno") + "不存在");
|
||||
return ResultMessageUtil.toJSON(returnJson);
|
||||
}
|
||||
if (dataMap.get("sendQty")!=null){
|
||||
if (dataMap.get("sendQty") != null) {
|
||||
sqlStr.add("UPDATE so_saleorder_b b "
|
||||
+ "SET b.vbdef6 = '1001A11000000C0W6P7S',b.vbdef12 = '"+dataMap.get("sendQty")+"'"
|
||||
+ "SET b.vbdef6 = '1001A11000000C0W6P7S',b.vbdef12 = '" + dataMap.get("sendQty") + "'"
|
||||
+ "WHERE b.csaleorderid IN ("
|
||||
+ " SELECT h.csaleorderid"
|
||||
+ " FROM so_saleorder h"
|
||||
|
@ -100,6 +104,17 @@ public class saleUpdateLJpc extends AbstractNCCRestResource {
|
|||
+ " AND b.csaleorderbid = '" + dataMap.get("crowno") + "' and b.dr=0 "
|
||||
+ ");");
|
||||
}
|
||||
JSONObject resJson = new JSONObject(dataMap);
|
||||
String csaleorderbid = dataMap.getOrDefault("csaleorderbid", "") + "";
|
||||
if (StringUtils.isNotEmpty(csaleorderbid)) {
|
||||
String sql = " select sb.csaleorderbid,sb.vbdef19,sb.vbdef20" +
|
||||
" from so_saleorder_b sb" +
|
||||
" where sb.csaleorderbid='" + csaleorderbid + "' ";
|
||||
Map<String, Object> soMap = (Map<String, Object>) getQueryService().executeQuery(sql, new MapProcessor());
|
||||
resJson.put("vbdef19", soMap.getOrDefault("vbdef19", ""));
|
||||
resJson.put("vbdef20", soMap.getOrDefault("vbdef20", ""));
|
||||
}
|
||||
resList.add(resJson);
|
||||
}
|
||||
|
||||
// int succState = updateSaleBSQty(sqlStr.toString());
|
||||
|
@ -107,15 +122,14 @@ public class saleUpdateLJpc extends AbstractNCCRestResource {
|
|||
|
||||
if (succState == arrayList.size()) {
|
||||
returnJson.put("state", 'Y');
|
||||
returnJson.put("msg", "成功,已修改"+succState+"行");
|
||||
returnJson.put("msg", "成功,已修改" + succState + "行");
|
||||
|
||||
}else {
|
||||
} else {
|
||||
returnJson.put("state", 'N');
|
||||
returnJson.put("msg", "失败,已修改"+succState+"行");
|
||||
returnJson.put("msg", "失败,已修改" + succState + "行");
|
||||
}
|
||||
returnJson.put("resList", resList);
|
||||
return ResultMessageUtil.toJSON(returnJson);
|
||||
} catch (DbException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue