|
|
@@ -7,6 +7,7 @@ import com.uas.eis.dao.BaseDao;
|
|
|
import com.uas.eis.dao.SqlRowList;
|
|
|
import com.uas.eis.entity.GD.*;
|
|
|
import com.uas.eis.service.GDService;
|
|
|
+import com.uas.eis.utils.BaseUtil;
|
|
|
import com.uas.eis.utils.FlexJsonUtil;
|
|
|
import com.uas.eis.utils.HttpUtil;
|
|
|
import com.uas.eis.utils.StringUtil;
|
|
|
@@ -32,17 +33,17 @@ public class GDServiceImpl implements GDService {
|
|
|
SpObserver.putSp(master);
|
|
|
String actionUrl=gdConfig.getPosUrl()+"/http/Portal/POSEDIInput";
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
- String bearerToken= getToken();
|
|
|
+ String bearerToken =getToken();
|
|
|
List<String> restSqls=new ArrayList<>();
|
|
|
if(StringUtil.hasText(bearerToken)){
|
|
|
PosEdiRequest posEdiRequest=new PosEdiRequest();
|
|
|
SimpleDateFormat formatYMD = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
ArrayList<PosItem> posItems=new ArrayList<>();
|
|
|
- SqlRowList rs = baseDao.queryForRowSet("select * from POSREPORT_GD_DET where PD_PSID ="+id+" order by Pd_itemid");
|
|
|
+ SqlRowList rs = baseDao.queryForRowSet("select * from POSREPORT_GD_DET where id_error is not null and PD_PSID ="+id+" order by Pd_itemid");
|
|
|
while (rs.next()) {
|
|
|
PosItem posItem=new PosItem();
|
|
|
posItem.setItemId(rs.getInt("Pd_itemid"));
|
|
|
- posItem.setDistId(gdConfig.getDistiCode());
|
|
|
+ posItem.setDistiId(gdConfig.getDistiCode());
|
|
|
posItem.setCustomerId(rs.getGeneralString("PD_CUSTOMERID"));
|
|
|
posItem.setCpn(rs.getGeneralString("PD_CPN"));
|
|
|
posItem.setResaleCustomerID(rs.getGeneralString("PD_RESALE_CUSTOMERID"));
|
|
|
@@ -50,7 +51,8 @@ public class GDServiceImpl implements GDService {
|
|
|
posItem.setQuantity(rs.getDouble("PD_QUANTITY"));
|
|
|
posItem.setResalePrice(rs.getDouble("PD_RESALEPRICE"));
|
|
|
posItem.setDeliveryMarket(rs.getString("PD_DELIVERYMARKET"));
|
|
|
- posItem.setShippingDate(formatYMD.format(rs.getDate("PD_SHIPPINGDATE")));
|
|
|
+ //posItem.setShippingDate(formatYMD.format(rs.getDate("PD_SHIPPINGDATE")));
|
|
|
+ posItem.setShippingDate("2026-3-31");
|
|
|
posItem.setDelivery(rs.getGeneralString("PD_DELIVERY"));
|
|
|
posItem.setDeliveryItem(rs.getGeneralString("PD_DELIVERYITEM"));
|
|
|
posItem.setDistiResaleCustomerName(rs.getString("PD_DISTRICSRESCALECUSTOMERNAME"));
|
|
|
@@ -64,6 +66,7 @@ public class GDServiceImpl implements GDService {
|
|
|
int errCount=0;
|
|
|
if (response.getStatusCode()==200){
|
|
|
String respText=response.getResponseText();
|
|
|
+ logger.info("responseText:{} ",respText);
|
|
|
PosResponse posResponse=FlexJsonUtil.fromJson(respText, PosResponse.class);
|
|
|
for(PosRespItem item : posResponse.getData()){
|
|
|
if("failed".equals(item.getSyncStatus())){
|
|
|
@@ -97,7 +100,8 @@ public class GDServiceImpl implements GDService {
|
|
|
SpObserver.putSp(master);
|
|
|
String actionUrl=gdConfig.getPosUrl()+"/http/Portal/IREDIInput";
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
- String bearerToken= getToken();
|
|
|
+ String bearerToken //=getToken();
|
|
|
+ ="eyJhbGciOiJSUzI1NiIsIng1dSI6Imh0dHBzOi8vb2F1dGhhc3NlcnZpY2VzLmNuMS5wbGF0Zm9ybS5zYXBjbG91ZC5jbi9vYXV0aDIvYXBpL3YxL2p3dC9jZXJ0aWZpY2F0ZSIsInR5cCI6IkpXVCIsImtpZCI6IjIifQ.eyJpc3MiOiJodHRwczovL29hdXRoYXNzZXJ2aWNlcy5jbjEucGxhdGZvcm0uc2FwY2xvdWQuY24iLCJzdWIiOnsiY2xpZW50SWQiOiI2NmNlN2FhMi1mMmU5LTMxYzktYjM2My1jYTQ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ZFlwKFMo06khgbXMGrHdI8xdKURXseX59B8jdTgZXURp3DyuQorVTm515pAu5TWsBt1+HkXYsccU2TLXygRZ6Bek/jhBsWQvrbmxLYqK8g3aa1/MOC6KubPkb0YxnkHwBrLRanA7HsvGQ9PNDAayNXSnNNJDdXmLYcY36ogvGBmo5esNOeshtqep3FT9GVPRj9NJA91qbJ4NpiWIYSXkFBVoFtAmkn0S+LhsM8pIcIEeLFL/l0SQrz9Xoza0hmnBwZ5KFq5L/kds/6D/94";
|
|
|
if(StringUtil.hasText(bearerToken)) {
|
|
|
SimpleDateFormat formatYMD = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
ArrayList<InventoryItem> inventoryItems = new ArrayList<>();
|
|
|
@@ -120,6 +124,31 @@ public class GDServiceImpl implements GDService {
|
|
|
HttpUtil.Response response=HttpUtil.sendRequestWithBearerToken(actionUrl,bearerToken,body);
|
|
|
if (response.getStatusCode()==200){
|
|
|
logger.info("ResponseText:{}",response.getResponseText());
|
|
|
+ String respText=response.getResponseText();
|
|
|
+ InventoryResponse invResp=FlexJsonUtil.fromJson(respText, InventoryResponse.class);
|
|
|
+ if(invResp!=null){
|
|
|
+ if(invResp.getData()!=null){
|
|
|
+ if("true".equals(invResp.getData().getSuccess())){
|
|
|
+ baseDao.execute("update INVRPT_GD set IS_EDISENDSTATUS=-1 ,IS_ERR='' where Is_ID ="+id);
|
|
|
+ }else{
|
|
|
+ baseDao.execute("update INVRPT_GD set IS_ERR='"+(invResp.getData().getErrorMsg()==null?"发送失败":invResp.getData().getErrorMsg())+"' where Is_ID ="+id);
|
|
|
+ }
|
|
|
+ System.out.println();
|
|
|
+ }else{
|
|
|
+ logger.info("ResponseText-invResp.getData失败:{}",response.getResponseText());
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ logger.info("ResponseText转换失败:{}",response.getResponseText());
|
|
|
+ }
|
|
|
+ /* Map<Object, Object> resStore = BaseUtil.parseFormStoreToMap(respText);
|
|
|
+ if(resStore!=null && resStore.get("data")!=null){
|
|
|
+ Map<Object, Object> resData = BaseUtil.parseFormStoreToMap(resStore.get("data").toString());
|
|
|
+ if("true".equals(resData.get("success").toString())){
|
|
|
+ baseDao.execute("update INVRPT_GD set IS_EDISENDSTATUS=-1 ,IS_ERR='' where Is_ID ="+id);
|
|
|
+ }else{
|
|
|
+ baseDao.execute("update INVRPT_GD set IS_ERR='"+(resData.get("errorMsg")==null?"发送失败":resData.get("errorMsg").toString())+"' where Is_ID ="+id);
|
|
|
+ }
|
|
|
+ }*/
|
|
|
}else{
|
|
|
logger.info("sendPosToGD-failed:code:{} ,text:{}",response.getStatusCode(),response.getResponseText());
|
|
|
result.put("success", false);
|