上下架读取商品名称

master
e 2019-12-24 10:12:00 +08:00
parent 29ae7a1a9b
commit 47afd60a1f
5 changed files with 159 additions and 49 deletions

View File

@ -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) {

View File

@ -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"};

View File

@ -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<String, Object> 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<String, Object> 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<WmOmNoticeIEntity> wmomNoticeIListnew = new ArrayList<WmOmNoticeIEntity>();
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 <order.getInfo().; k++) {
// WmOmNoticeIEntity wmi = new WmOmNoticeIEntity();
// wmi.setGoodsId(billResult.getData().get(s).getDetail().get(k).getPdProdcode());
// MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class, "goodsCode", wmi.getGoodsId());
// if (mvgoods != null) {
// wmi.setGoodsName(mvgoods.getGoodsName());
// wmi.setGoodsUnit(mvgoods.getShlDanWei());
// }
//// wmi.setGoodsProData(DateUtils.str2Date(billResult.getData().get(s).getDetail().get(k).getPdProdmadedate(), DateUtils.date_sdf));
// wmi.setGoodsQua(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdPurcoutqty()));
//// wmi.setGoodsPrdData(billResult.getData().get(s).getDetail().get(k).getPdProdmadedate2User());
// wmi.setOtherId(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdPdno()));
//
// wmomNoticeIListnew.add(wmi);
// }
wmOmNoticeHService.addMain(wmOmNoticeH, wmomNoticeIListnew);
}
}
public static Map<String, Object> getbasepara(){

View File

@ -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);

View File

@ -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',{});
}
}