From 47afd60a1fce2cb022e4f3985e0663838f37fa39 Mon Sep 17 00:00:00 2001 From: e Date: Tue, 24 Dec 2019 10:12:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E6=9E=B6=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../md/controller/MdCusOtherController.java | 25 ++- .../wm/controller/WmOmNoticeHController.java | 6 + .../java/com/zzjee/wmutil/dsc/dscUtil.java | 169 +++++++++++++----- src/main/java/test/HttpUtil.java | 2 +- .../webpage/com/zzjee/md/mdCusOtherList.jsp | 6 +- 5 files changed, 159 insertions(+), 49 deletions(-) diff --git a/src/main/java/com/zzjee/md/controller/MdCusOtherController.java b/src/main/java/com/zzjee/md/controller/MdCusOtherController.java index 82c6e100..d82611f7 100644 --- a/src/main/java/com/zzjee/md/controller/MdCusOtherController.java +++ b/src/main/java/com/zzjee/md/controller/MdCusOtherController.java @@ -7,7 +7,9 @@ import java.text.SimpleDateFormat; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.zzjee.wmutil.dsc.dscUtil; import com.zzjee.wmutil.wmIntUtil; +import com.zzjee.wmutil.yyUtil; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -209,10 +211,27 @@ public class MdCusOtherController extends BaseController { message = "读取成功"; try { - if(StringUtil.isEmpty(formDate)){ - formDate = "2011-01-01"; + + + + + if ("UAS".equals(ResourceUtil.getConfigByName("interfacetype"))){ + if(StringUtil.isEmpty(formDate)){ + formDate = "2011-01-01"; + } + wmIntUtil.getCus(formDate); + } - wmIntUtil.getCus(formDate); + if ("DSC".equals(ResourceUtil.getConfigByName("interfacetype"))){ + + dscUtil.updateCusFromDsc(); + + } + + + + + systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO); } catch (Exception e) { diff --git a/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java b/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java index 5bb848a4..b91e7e61 100644 --- a/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java +++ b/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java @@ -21,6 +21,7 @@ import javax.validation.Validator; import com.zzjee.md.entity.MdGoodsEntity; import com.zzjee.tms.entity.TmsYwDingdanEntity; import com.zzjee.wm.page.*; +import com.zzjee.wmutil.dsc.dscUtil; import org.apache.commons.collections.CollectionUtils; import org.apache.log4j.Logger; import org.apache.poi.hssf.usermodel.HSSFCellStyle; @@ -981,6 +982,11 @@ public class WmOmNoticeHController extends BaseController { } yyUtil.getSdvl(formDate); + } + if ("DSC".equals(ResourceUtil.getConfigByName("interfacetype"))){ + + dscUtil.updateorderFromDsc(); + } if ("UAS".equals(ResourceUtil.getConfigByName("interfacetype"))) { String masterbill[] = {"XKN_TEST", "XKN_TEST"}; diff --git a/src/main/java/com/zzjee/wmutil/dsc/dscUtil.java b/src/main/java/com/zzjee/wmutil/dsc/dscUtil.java index 29563a35..669926cd 100644 --- a/src/main/java/com/zzjee/wmutil/dsc/dscUtil.java +++ b/src/main/java/com/zzjee/wmutil/dsc/dscUtil.java @@ -3,13 +3,18 @@ package com.zzjee.wmutil.dsc; import com.xiaoleilu.hutool.http.HttpUtil; import com.zzjee.md.entity.MdCusOtherEntity; import com.zzjee.md.entity.MdGoodsEntity; +import com.zzjee.md.entity.MvGoodsEntity; +import com.zzjee.wm.entity.WmOmNoticeHEntity; +import com.zzjee.wm.entity.WmOmNoticeIEntity; +import com.zzjee.wm.service.WmOmNoticeHServiceI; import com.zzjee.wmutil.uasloginres; -import org.jeecgframework.core.util.ApplicationContextUtil; -import org.jeecgframework.core.util.JSONHelper; -import org.jeecgframework.core.util.ResourceUtil; +import com.zzjee.wmutil.wmUtil; +import org.jeecgframework.core.util.*; import org.jeecgframework.web.system.service.SystemService; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -59,6 +64,21 @@ public class dscUtil { } } + public static void updateorderFromDsc(){ + String res = getOrderList("1","",""); + System.out.println(res); + int pagecount = 1; + orderListRes reslist = JSONHelper.fromJsonToObject(res,orderListRes.class); + saveordertowm(reslist); + pagecount = reslist.getInfo().getPageCount(); + for(int i =2;i<=pagecount;i++){ + String page = Integer.toString(i); + res = getOrderList(page,"",""); + reslist = JSONHelper.fromJsonToObject(res,orderListRes.class); + saveordertowm(reslist); + } + } + public static String getGoods(String page){ String baseurl = ResourceUtil.getConfigByName("dsc.url"); @@ -78,12 +98,20 @@ public class dscUtil { return res; } - public static String getOrderList(String page){ + public static String getOrderList(String page,String startAddTime,String endAddTime){ String baseurl = ResourceUtil.getConfigByName("dsc.url"); Map paramMap = getbasepara(); paramMap.put("method","dsc.order.list.get"); paramMap.put("page",page); -// paramMap.put("order_status","1"); + if(StringUtil.isNotEmpty(startAddTime)){ + paramMap.put("start_add_time",startAddTime); + + } + if(StringUtil.isNotEmpty(endAddTime)){ + paramMap.put("end_add_time",endAddTime); + + } +// paramMap.put("order_status","1");//只取已确认的订单 String res = HttpUtil.get(baseurl,paramMap); return res; } @@ -96,29 +124,39 @@ public class dscUtil { String res = HttpUtil.get(baseurl,paramMap); return res; } - + public static String getOrderGoods(int orderId){ + String baseurl = ResourceUtil.getConfigByName("dsc.url"); + Map paramMap = getbasepara(); + paramMap.put("method","dsc.order.goods.info.get"); + paramMap.put("order_id",orderId); + String res = HttpUtil.get(baseurl,paramMap); + return res; + } public static void savegoodstowm(goodsListRes reslist){ String cusCode = ResourceUtil.getConfigByName("dsc.cuscode"); SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class); for( goodsListRes.InfoBean.ListBean t:reslist.getInfo().getList()){ - MdGoodsEntity mdgoos = systemService.findUniqueByProperty(MdGoodsEntity.class,"shpBianMakh",t.getGoodsSn()); - if(mdgoos==null){ - mdgoos = new MdGoodsEntity(); + try{ + MdGoodsEntity mdgoos = systemService.findUniqueByProperty(MdGoodsEntity.class,"shpBianMakh",t.getGoodsSn()); + if(mdgoos==null){ + mdgoos = new MdGoodsEntity(); + } + mdgoos.setSuoShuKeHu(cusCode); + mdgoos.setShpBianMakh(t.getGoodsSn()); + mdgoos.setShpBianMa(t.getGoodsSn()); + mdgoos.setShpMingCheng(unicodeDecode(t.getGoodsName())); + mdgoos.setShpTiaoMa(t.getBarCode()); + mdgoos.setChlKongZhi("N"); + mdgoos.setChlShl("1"); + mdgoos.setShlDanWei("个"); + mdgoos.setJshDanWei("个"); + mdgoos.setBzhiQi("360"); + mdgoos.setChpShuXing(t.getCatId()); + mdgoos.setCfWenCeng("常温"); + systemService.saveOrUpdate(mdgoos); + }catch (Exception e){ } - mdgoos.setSuoShuKeHu(cusCode); - mdgoos.setShpBianMakh(t.getGoodsSn()); - mdgoos.setShpBianMa(t.getGoodsSn()); - mdgoos.setShpMingCheng(unicodeDecode(t.getGoodsName())); - mdgoos.setShpTiaoMa(t.getBarCode()); - mdgoos.setChlKongZhi("N"); - mdgoos.setChlShl("1"); - mdgoos.setShlDanWei("个"); - mdgoos.setJshDanWei("个"); - mdgoos.setBzhiQi("360"); - mdgoos.setChpShuXing(t.getCatId()); - mdgoos.setCfWenCeng("常温"); - systemService.saveOrUpdate(mdgoos); } } @@ -127,32 +165,81 @@ public class dscUtil { String cusCode = ResourceUtil.getConfigByName("dsc.cuscode"); SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class); for( customerListRes.InfoBean.ListBean t:reslist.getInfo().getList()){ - MdCusOtherEntity md = systemService.findUniqueByProperty(MdCusOtherEntity.class,"keHuBianMa",t.getUserId()); - if(md==null){ - md = new MdCusOtherEntity(); + try{ + MdCusOtherEntity md = systemService.findUniqueByProperty(MdCusOtherEntity.class,"keHuBianMa",t.getUserId()); + if(md==null){ + md = new MdCusOtherEntity(); + } + md.setSuoShuKeHu(cusCode); + md.setKeHuBianMa(t.getUserId()); + md.setZhongWenQch(unicodeDecode(t.getUserName()+t.getNickName())); + md.setDianHua(t.getMobilePhone()); + systemService.saveOrUpdate(md); + }catch (Exception e){ } - md.setSuoShuKeHu(cusCode); - md.setKeHuBianMa(t.getUserId()); - md.setZhongWenQch(unicodeDecode(t.getUserName()+t.getNickName())); - md.setDianHua(t.getMobilePhone()); - systemService.saveOrUpdate(md); } } - public static void saveordertowm(customerListRes reslist){ + public static void saveordertowm(orderListRes reslist){ String cusCode = ResourceUtil.getConfigByName("dsc.cuscode"); SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class); - for( customerListRes.InfoBean.ListBean t:reslist.getInfo().getList()){ -// MdCusOtherEntity md = systemService.findUniqueByProperty(MdCusOtherEntity.class,"keHuBianMa",t.getUserId()); -// if(md==null){ -// md = new MdCusOtherEntity(); -// } -// md.setSuoShuKeHu(cusCode); -// md.setKeHuBianMa(t.getUserId()); -// md.setZhongWenQch(unicodeDecode(t.getUserName()+t.getNickName())); -// md.setDianHua(t.getMobilePhone()); -// systemService.saveOrUpdate(md); + for( orderListRes.InfoBean.ListBean t:reslist.getInfo().getList()){ + try{ + String orderSn = t.getOrderSn(); + String orderRes = getOrder(orderSn); + orderRes order = JSONHelper.fromJsonToObject(orderRes,orderRes.class); + saveOneOrder(order); + }catch (Exception e){ + + } } + } + public static void saveOneOrder(orderRes orderhead) { + String cusCode = ResourceUtil.getConfigByName("dsc.cuscode"); + String imcuscode = orderhead.getInfo().getOrderSn(); + SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class); + WmOmNoticeHServiceI wmOmNoticeHService =ApplicationContextUtil.getContext().getBean(WmOmNoticeHServiceI.class); + WmOmNoticeHEntity wmimh = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "imCusCode", imcuscode); + if (wmimh == null) { + WmOmNoticeHEntity wmOmNoticeH = new WmOmNoticeHEntity(); + List wmomNoticeIListnew = new ArrayList(); + wmOmNoticeH.setOrderTypeCode("11"); + wmOmNoticeH.setCusCode(cusCode); + String noticeid = wmUtil.getNextomNoticeId(wmOmNoticeH.getOrderTypeCode()); + wmOmNoticeH.setOmNoticeId(noticeid); + wmOmNoticeH.setOcusCode(orderhead.getInfo().getUserId()); + MdCusOtherEntity mdcusother = systemService.findUniqueByProperty(MdCusOtherEntity.class, "keHuBianMa", wmOmNoticeH.getOcusCode()); + if (mdcusother != null) { + wmOmNoticeH.setOcusName(mdcusother.getZhongWenQch()); + } + wmOmNoticeH.setImCusCode(imcuscode); + wmOmNoticeH.setOmBeizhu(orderhead.getInfo().getHowOos()); + wmOmNoticeH.setDelvMember(orderhead.getInfo().getConsignee()); + wmOmNoticeH.setDelvMobile(orderhead.getInfo().getMobile()); + wmOmNoticeH.setDelvAddr(orderhead.getInfo().getAddress()); +// for (int k = 0; k getbasepara(){ diff --git a/src/main/java/test/HttpUtil.java b/src/main/java/test/HttpUtil.java index 422a64c0..c8adef64 100644 --- a/src/main/java/test/HttpUtil.java +++ b/src/main/java/test/HttpUtil.java @@ -110,7 +110,7 @@ public class HttpUtil { public static void main(String args[]){ // dscUtil.updateGoodsFromDsc(); // String res = dscUtil.getOrderList("1"); - String res = dscUtil.getOrder("2019122311217330866"); + String res = dscUtil.getOrderGoods(4); System.out.println(res); diff --git a/src/main/webapp/webpage/com/zzjee/md/mdCusOtherList.jsp b/src/main/webapp/webpage/com/zzjee/md/mdCusOtherList.jsp index be99e24c..e6687406 100644 --- a/src/main/webapp/webpage/com/zzjee/md/mdCusOtherList.jsp +++ b/src/main/webapp/webpage/com/zzjee/md/mdCusOtherList.jsp @@ -83,9 +83,7 @@ function otherimp() { var batchdate; batchdate = $('input[name="batchdate"]').attr("value"); - if(batchdate==""){ - alert("日期不能为空"); - }else{ + var url = "mdCusOtherController.do?doGet&formDate="+batchdate; $.ajax({ async : false, @@ -103,7 +101,7 @@ }); tip("获取成功"); $('#mdCusOtherList').datagrid('reload',{}); - } + }