| | |
| | | names.add("云仓商品规格编码不能为空"); |
| | | continue; |
| | | } |
| | | if (StringUtils.isBlank(erpCloudGoodsExcel.getCloudGoodsId())) { |
| | | names.add("云仓商品ID不能为空"); |
| | | continue; |
| | | } |
| | | if (StringUtils.isBlank(erpCloudGoodsExcel.getCloudSpecId())) { |
| | | names.add("云仓商品规格ID不能为空"); |
| | | continue; |
| | | } |
| | | TErpGoods erpGoods = erpGoodsService.getOne(Wrappers.lambdaQuery(TErpGoods.class) |
| | | .eq(TErpGoods::getGoodsName, erpCloudGoodsExcel.getGoodsName()) |
| | | .last("LIMIT 1")); |
| | |
| | | erpGoods.setCloudWarehouse(cloudWarehouse); |
| | | erpGoods.setCloudGoodsCode(erpCloudGoodsExcel.getCloudGoodsCode()); |
| | | erpGoods.setCloudSpecCode(erpCloudGoodsExcel.getCloudSpecCode()); |
| | | erpGoods.setCloudGoodsId(erpCloudGoodsExcel.getCloudGoodsId()); |
| | | erpGoods.setCloudSpecId(erpCloudGoodsExcel.getCloudSpecId()); |
| | | tErpGoods.add(erpGoods); |
| | | } |
| | | erpGoodsService.updateBatchById(tErpGoods); |
| | |
| | | import com.ruoyi.system.service.TErpProcurementService; |
| | | import com.ruoyi.system.task.base.QuartzManager; |
| | | import com.ruoyi.system.task.base.TimeJobType; |
| | | import com.ruoyi.system.task.jobs.LivePushJob; |
| | | import com.ruoyi.system.task.jobs.RevenueSharingJob; |
| | | import com.ruoyi.web.core.config.LakalaConfig; |
| | | import com.ruoyi.web.listener.event.TradeOrderEvent; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.SneakyThrows; |
| | |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.DefaultHttpClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | |
| | | private final TCrmSupplierService crmSupplierService; |
| | | |
| | | private final TokenService tokenService; |
| | | |
| | | private final ApplicationContext applicationContext; |
| | | |
| | | @Autowired |
| | | public TOrderController(TErpProcurementService erpProcurementService, TokenService tokenService, TErpProcurementGoodsService erpProcurementGoodsService, TCrmSupplierService crmSupplierService) { |
| | | public TOrderController(TErpProcurementService erpProcurementService, TokenService tokenService, TErpProcurementGoodsService erpProcurementGoodsService, TCrmSupplierService crmSupplierService, ApplicationContext applicationContext) { |
| | | this.erpProcurementService = erpProcurementService; |
| | | this.tokenService = tokenService; |
| | | this.erpProcurementGoodsService = erpProcurementGoodsService; |
| | | this.crmSupplierService = crmSupplierService; |
| | | this.applicationContext = applicationContext; |
| | | } |
| | | |
| | | private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
| | |
| | | // erpProcurementService.updateById(erpProcurement); |
| | | // } |
| | | |
| | | // 执行的推送创建云仓订单 |
| | | applicationContext.publishEvent(new TradeOrderEvent(erpProcurement.getId()+"_1")); |
| | | |
| | | // 响应success |
| | | JSONObject responseJsonObject = new JSONObject(); |
| | | responseJsonObject.put("code", "SUCCESS"); |
| | |
| | | if ( erpProcurement!=null && "SUCCESS".equals(status)) { |
| | | erpProcurement.setStatus(6); |
| | | erpProcurementService.updateById(erpProcurement); |
| | | // 执行的推送取消云仓订单 |
| | | applicationContext.publishEvent(new TradeOrderEvent(erpProcurement.getId()+"_2")); |
| | | // 响应success |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", "SUCCESS"); |
| | |
| | | package com.ruoyi.web.controller.task; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.constant.Constants; |
| | |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.utils.util.AIUtil; |
| | | import com.ruoyi.system.vo.TCrmClinicVO; |
| | | import com.ruoyi.web.controller.yuncang.api.trade.LogisticsSyncAck; |
| | | import com.ruoyi.web.controller.yuncang.api.trade.LogisticsSyncQuery; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | * @author xiaochen |
| | | * @date 2023/7/11 8:39 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class TaskUtil { |
| | | |
| | |
| | | private TCrmSupplierVerifyService crmSupplierVerifyService; |
| | | @Autowired |
| | | private TSysOtherConfigService sysOtherConfigService; |
| | | @Autowired |
| | | private TSysCloudConfigService sysCloudConfigService; |
| | | |
| | | // @Scheduled(fixedRate = 86460000) |
| | | // @Scheduled(cron = "10 0 0 * * ?") |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 每小时更新订单云物流状态 |
| | | */ |
| | | @Scheduled(cron = "0 0 * * * ?") |
| | | public void hourUpdateOrderCloudLogisticsStatus() { |
| | | try { |
| | | TSysCloudConfig sysCloudConfig = sysCloudConfigService.getOne(Wrappers.lambdaQuery(TSysCloudConfig.class) |
| | | .eq(TSysCloudConfig::getCloudWarehouse, 1) |
| | | .last("LIMIT 1")); |
| | | |
| | | JSONObject jsonObject = LogisticsSyncQuery.logisticsSyncQuery(sysCloudConfig.getSid(), sysCloudConfig.getAppKey(), |
| | | sysCloudConfig.getAppSecret(), sysCloudConfig.getUrl(), ""); |
| | | if(Objects.nonNull(jsonObject)){ |
| | | JSONArray trades = jsonObject.getJSONArray("trades"); |
| | | Map<String, String> map = new HashMap<>(); |
| | | List<String> tidList = new ArrayList<>(); |
| | | List<Map<String, Object>> logistics_list = new ArrayList<>(); |
| | | for (int i = 0; i < trades.size(); i++) { |
| | | JSONObject trade_order = JSONObject.parseObject(JSONObject.toJSONString(trades.get(i))); |
| | | String rec_id = trade_order.getString("rec_id"); // 主键,用于logistics_sync_ack回写状态 |
| | | String tid = trade_order.getString("tid"); // 原始单号 |
| | | String logistics_no = trade_order.getString("logistics_no"); // 物流单号 |
| | | String logistics_name = trade_order.getString("logistics_name"); // 物流名称 |
| | | map.put(tid, logistics_no); |
| | | tidList.add(tid); |
| | | Map<String, Object> logistics_1 = new HashMap<>(); |
| | | logistics_1.put("rec_id", rec_id); |
| | | logistics_1.put("status", 0); |
| | | logistics_1.put("message", "同步成功"); |
| | | logistics_list.add(logistics_1); |
| | | } |
| | | |
| | | List<TErpProcurement> procurements = erpProcurementService.list(Wrappers.lambdaQuery(TErpProcurement.class) |
| | | .in(TErpProcurement::getProcurementCode, tidList)); |
| | | if(!CollectionUtils.isEmpty(procurements)){ |
| | | for (TErpProcurement procurement : procurements) { |
| | | procurement.setLogisticsNo(map.get(procurement.getProcurementCode())); |
| | | procurement.setStatus(4); |
| | | } |
| | | erpProcurementService.updateBatchById(procurements); |
| | | } |
| | | // 物流同步回写 |
| | | JSONObject logisticsSyncAck = LogisticsSyncAck.logisticsSyncAck(sysCloudConfig.getSid(), sysCloudConfig.getAppKey(), |
| | | sysCloudConfig.getAppSecret(), sysCloudConfig.getUrl(), logistics_list); |
| | | log.info("物流同步成功"); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 供应商周期核查 |
| | |
| | | Map<String, Object>[] goods_list = new Map[1]; |
| | | |
| | | goods_list[0] = new HashMap<String,Object>(); |
| | | goods_list[0].put("goods_id", "20260109100903"); |
| | | goods_list[0].put("spec_id","20260109100903"); |
| | | goods_list[0].put("goods_no", "stest"); |
| | | goods_list[0].put("spec_no", "stes12"); |
| | | goods_list[0].put("goods_id", "202602051455"); |
| | | goods_list[0].put("spec_id","20260205145501"); |
| | | goods_list[0].put("goods_no", "QTZL014A"); |
| | | goods_list[0].put("spec_no", "QTZL014A"); |
| | | goods_list[0].put("goods_name", "真露西柚13度360ml*20瓶箱装"); |
| | | goods_list[0].put("status", "1"); |
| | | |
| | | goods_list[0].put("stock_num", "99"); |
| | | goods_list[0].put("price", "1"); |
| | | |
| | | api_goods_info.put("platform_id", "127"); |
| | | api_goods_info.put("shop_no", "hytycw02-test"); |
| | | api_goods_info.put("goods_list", goods_list); |
| | |
| | | return null; |
| | | } |
| | | public static void main(String[] args) { |
| | | WdtClient client = new WdtClient("", "", "", ""); |
| | | WdtClient client = new WdtClient("apidevnew2", "hytycw02-test", "c7ae51196", "https://sandbox.wangdian.cn/openapi2/"); |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | params.put("logistics_no", "11"); |
| | | params.put("logistics_no", "SF1519018370586"); |
| | | |
| | | try { |
| | | String response = client.execute("logistics.php", params); |
| | |
| | | params.put("end_time", "2019-01-30 00:00:00"); |
| | | params.put("page_no", "0"); |
| | | params.put("page_size", "10"); |
| | | params.put("shop_no", "hytycw02-test"); try { |
| | | params.put("shop_no", "hytycw02-test"); |
| | | try { |
| | | String response = client.execute("vip_api_goods_query.php", params); |
| | | System.out.println(response); |
| | | } catch (IOException e) { |
| | |
| | | package com.ruoyi.web.controller.yuncang.api.trade; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.web.controller.yuncang.utils.WdtClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | * @param logistics_list 同步物流信息Ack列表 |
| | | * @return |
| | | */ |
| | | public static JSONObject logisticsSyncAck(String sid, String appkey, String appsecret, String url,List<Map<String, Object>> logistics_list) { |
| | | public static JSONObject logisticsSyncAck(String sid, String appkey, String appsecret, String url, |
| | | List<Map<String, Object>> logistics_list) { |
| | | WdtClient client = new WdtClient(sid, appkey, appsecret, url); |
| | | String logistics_list_json = JSON.toJSONString(logistics_list); |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | |
| | | package com.ruoyi.web.controller.yuncang.api.trade; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.web.controller.yuncang.utils.WdtClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | public class LogisticsSyncQuery { |
| | |
| | | String shop_no) { |
| | | WdtClient client = new WdtClient(sid, appkey, appsecret, url); |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | params.put("shop_no", shop_no); |
| | | if (StringUtils.isNotEmpty(shop_no)){ |
| | | params.put("shop_no", shop_no); |
| | | } |
| | | // params.put("is_part_sync_able", "0"); |
| | | params.put("limit", "100"); |
| | | try { |
| | |
| | | return null; |
| | | } |
| | | public static void main(String[] args) { |
| | | WdtClient client = new WdtClient("", "", "", ""); |
| | | WdtClient client = new WdtClient("apidevnew2", "hytycw02-test", "c7ae51196", "https://sandbox.wangdian.cn/openapi2/"); |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | params.put("shop_no", "mytest"); |
| | | // params.put("shop_no", "hytycw02-test"); |
| | | params.put("is_part_sync_able", "0"); |
| | | params.put("limit", "100"); |
| | | try { |
| | | String response = client.execute("logistics_sync_query.php", params); |
| | | System.out.println(response); |
| | | System.err.println(response); |
| | | JSONObject jsonObject = JSONObject.parseObject(response); |
| | | if(Objects.nonNull(jsonObject)){ |
| | | JSONArray trades = jsonObject.getJSONArray("trades"); |
| | | Map<String, String> map = new HashMap<>(); |
| | | List<String> tidList = new ArrayList<>(); |
| | | List<Map<String, Object>> logistics_list = new ArrayList<>(); |
| | | for (int i = 0; i < trades.size(); i++) { |
| | | JSONObject trade_order = JSONObject.parseObject(JSONObject.toJSONString(trades.get(i))); |
| | | String rec_id = trade_order.getString("rec_id"); // 主键,用于logistics_sync_ack回写状态 |
| | | String tid = trade_order.getString("tid"); // 原始单号 |
| | | String logistics_no = trade_order.getString("logistics_no"); // 物流单号 |
| | | String logistics_name = trade_order.getString("logistics_name"); // 物流名称 |
| | | map.put(tid, logistics_no); |
| | | tidList.add(tid); |
| | | Map<String, Object> logistics_1 = new HashMap<>(); |
| | | logistics_1.put("rec_id", rec_id); |
| | | logistics_1.put("status", 0); |
| | | logistics_1.put("message", "同步成功"); |
| | | logistics_list.add(logistics_1); |
| | | } |
| | | |
| | | System.err.println(map); |
| | | |
| | | JSONObject logisticsSyncAck = LogisticsSyncAck.logisticsSyncAck("apidevnew2", "hytycw02-test", "c7ae51196", "https://sandbox.wangdian.cn/openapi2/", logistics_list); |
| | | System.err.println(logisticsSyncAck); |
| | | } |
| | | } catch (IOException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | * @param status 平台子订单状态,子订单状态可以和主订单不一样,比如其中一个子订单退款完成,其状态是80,但主订单仍然是待发货,可选值同trade_status |
| | | * @param refund_status 0:无退款,1:取消退款,2:已申请退款,3:等待退货,4:等待收货,5:退款成功。本字段在售前退款的时候,根据不同的场景填写不同的值,eg:申请退款值为2,取消退款值为1…… |
| | | * @param shop_no 代表店铺所有属性的唯一编码,用于店铺区分,ERP内支持自定义(ERP店铺界面设置,查看路径ERP→设置→基本设置→店铺→店铺列表),用于创建指定店铺单据信息,测试环境店铺编号信息同接口账号。ERP内shop_no对应的“店铺平台”必须为“自有/其它”。正式环境店铺创建成功后ERP会自动授权,如果自动授权失败,在ERP店铺界面(路径ERP→设置→基本设置→店铺→店铺列表)选中授权失败的店铺,点击店铺界面提供的店铺授权按钮重新授权。 |
| | | * @param receiver_name 收件人姓名 |
| | | * @param receiver_province 收件人省份,传为中文名称需与旺店通地址库匹配 |
| | | * @param receiver_city 收件人城市,传为中文名称需与旺店通地址库匹配 |
| | | * @param receiver_district 收件人区县,传为中文名称需与旺店通地址库匹配 |
| | | * @param receiver_address 收件人地址详情,传为中文名称,需与旺店通地址库匹配,点击查看,如果不传省市区,则会尝试从详细地址解析省市区,必须是空格分隔的才能解析成功,需要注意直辖市的地址格式,举例“北京 北京市 海淀区 花园路xxxx” |
| | | * @param receiver_mobile 手机号码 |
| | | */ |
| | | public static JSONObject tradePush(String sid, String appkey, String appsecret, String url, |
| | | TErpProcurement erpProcurement, List<TErpProcurementGoods> erpProcurementGoods, |
| | | Integer trade_status,String clinicName,Integer status,Integer refund_status, |
| | | String shop_no,String goods_id,String spec_id,String goods_no,String spec_no, |
| | | String receiver_name,String receiver_province,String receiver_city, |
| | | String receiver_district,String receiver_address,String receiver_mobile) { |
| | | Integer trade_status,Integer status,Integer refund_status,String clinicName, |
| | | String shop_no,String receiver_name,String receiver_province, |
| | | String receiver_city,String receiver_district,String receiver_address, |
| | | String receiver_mobile) { |
| | | WdtClient client = new WdtClient(sid, appkey, appsecret, url); |
| | | //测试环境sid、appkey、密钥请到旺店通开放平台-自助对接-申请测试环境内查看,测试环境url=https://sandbox.wangdian.cn/openapi2/ |
| | | //调用正式环境时请将sid、appkey、appsecret切换为实际参数,参数在旺店通开放平台-自助对接-应用管理内应用状态为已上线的应用中查看,调用正式环境注意切换正式环境url=https://api.wangdian.cn/openapi2/ |
| | |
| | | order_1.put("price", erpProcurementGood.getPurchasePrice()); |
| | | order_1.put("status", status); |
| | | order_1.put("refund_status", refund_status); |
| | | order_1.put("goods_id", goods_id); |
| | | order_1.put("spec_id", spec_id); |
| | | order_1.put("goods_no", goods_no); |
| | | order_1.put("spec_no", spec_no); |
| | | order_1.put("goods_id", erpProcurementGood.getCloudGoodsId()); |
| | | order_1.put("spec_id", erpProcurementGood.getCloudSpecId()); |
| | | order_1.put("goods_no", erpProcurementGood.getCloudGoodsCode()); |
| | | order_1.put("spec_no", erpProcurementGood.getCloudSpecCode()); |
| | | order_1.put("goods_name", erpProcurementGood.getGoodsName()); |
| | | order_1.put("discount", 0); //子订单折扣 |
| | | order_1.put("adjust_amount", 0); //手工调整,特别注意:正的表示加价,负的表示减价 |
| | |
| | | trade_1.put("trade_status", trade_status); |
| | | trade_1.put("pay_status", "2"); |
| | | trade_1.put("delivery_term", 1); |
| | | trade_1.put("trade_time", DateUtils.localDateTimeToDate(erpProcurement.getCreateTime())); |
| | | trade_1.put("pay_time", DateUtils.localDateTimeToDate(erpProcurement.getPayTime())); |
| | | trade_1.put("trade_time", DateUtils.localDateTimeToString(erpProcurement.getCreateTime())); |
| | | trade_1.put("pay_time", DateUtils.localDateTimeToString(erpProcurement.getPayTime())); |
| | | trade_1.put("buyer_nick", clinicName); |
| | | trade_1.put("receiver_name", receiver_name); |
| | | trade_1.put("receiver_province", receiver_province); |
| | |
| | | return null; |
| | | } |
| | | public static void main(String[] args) { |
| | | WdtClient client = new WdtClient("传入sid", "传入appkey", "传入appsecret", "传入url"); |
| | | WdtClient client = new WdtClient("apidevnew2", "hytycw02-test", "c7ae51196", "https://sandbox.wangdian.cn/openapi2/"); |
| | | //测试环境sid、appkey、密钥请到旺店通开放平台-自助对接-申请测试环境内查看,测试环境url=https://sandbox.wangdian.cn/openapi2/ |
| | | //调用正式环境时请将sid、appkey、appsecret切换为实际参数,参数在旺店通开放平台-自助对接-应用管理内应用状态为已上线的应用中查看,调用正式环境注意切换正式环境url=https://api.wangdian.cn/openapi2/ |
| | | |
| | |
| | | List<Map<String, Object>> order_list = new ArrayList<Map<String, Object>>(); |
| | | |
| | | Map<String, Object> order_1 = new HashMap<String, Object>(); |
| | | order_1.put("oid", "ghsTest121101"); |
| | | order_1.put("oid", "2011681139470175424"); |
| | | order_1.put("num", 1); |
| | | order_1.put("price", 12); |
| | | order_1.put("status", 30); |
| | | order_1.put("refund_status", 0); |
| | | order_1.put("goods_id", "18344"); |
| | | order_1.put("spec_id", "18656"); |
| | | order_1.put("goods_no", "ghs2"); |
| | | order_1.put("spec_no", "ghs201812070212123"); |
| | | order_1.put("goods_name", "123"); |
| | | order_1.put("goods_id", "202602051455"); |
| | | order_1.put("spec_id","20260205145501"); |
| | | order_1.put("goods_no", "AL0204_QTZL014A"); |
| | | order_1.put("spec_no", "AL0204_QTZL014A"); |
| | | order_1.put("goods_name", "真露西柚13度360ml*20瓶箱装"); |
| | | order_1.put("discount", 0); //子订单折扣 |
| | | order_1.put("adjust_amount", 0); //手工调整,特别注意:正的表示加价,负的表示减价 |
| | | order_1.put("share_discount", 0); |
| | |
| | | order_list.add(order_1); |
| | | |
| | | Map<String, Object> trade_1 = new HashMap<String, Object>(); |
| | | trade_1.put("tid", "AT201812110002"); |
| | | trade_1.put("trade_status", 20); |
| | | trade_1.put("pay_status", "1"); |
| | | trade_1.put("delivery_term", 2); |
| | | trade_1.put("trade_time", "2018-12-11 14:21:00"); |
| | | trade_1.put("buyer_nick", "三国杀"); |
| | | trade_1.put("receiver_province", "河南省"); |
| | | trade_1.put("receiver_city", "周口市"); |
| | | trade_1.put("receiver_district", "川汇区"); |
| | | trade_1.put("receiver_mobile", "26283920011"); |
| | | trade_1.put("receiver_name", "123"); |
| | | trade_1.put("receiver_address", "123"); |
| | | trade_1.put("logistics_type", 4); |
| | | trade_1.put("post_amount", 12); |
| | | trade_1.put("cod_amount", 2); |
| | | trade_1.put("tid", "C2026011540514"); |
| | | trade_1.put("trade_status", 30); |
| | | trade_1.put("pay_status", "2"); |
| | | trade_1.put("delivery_term", 1); |
| | | trade_1.put("trade_time", "2026-02-05 11:21:01"); |
| | | trade_1.put("pay_time", "2026-02-05 11:21:01"); |
| | | trade_1.put("buyer_nick", "卡卡"); |
| | | trade_1.put("receiver_province", "四川省"); |
| | | trade_1.put("receiver_city", "成都市"); |
| | | trade_1.put("receiver_district", "武侯区"); |
| | | trade_1.put("receiver_address", "锦辉西二街天府新谷9号楼"); |
| | | trade_1.put("receiver_name", "卡卡"); |
| | | trade_1.put("receiver_mobile", "15731511105"); |
| | | // trade_1.put("logistics_type", 4); |
| | | trade_1.put("post_amount", 0); |
| | | trade_1.put("cod_amount", 0); |
| | | trade_1.put("ext_cod_fee", 0); |
| | | trade_1.put("other_amount", 1); |
| | | trade_1.put("paid", 0); |
| | | trade_1.put("other_amount", 0); |
| | | trade_1.put("paid", 12); |
| | | trade_1.put("order_list", order_list); |
| | | |
| | | |
| | | trade_list.add(trade_1); |
| | | |
| | | String trade_list_json = JSON.toJSONString(trade_list); |
| | | //System.out.println(purchase_info_json); |
| | | |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | params.put("shop_no", "ghs2test"); |
| | | params.put("shop_no", "hytycw02-test"); |
| | | params.put("trade_list", trade_list_json); |
| | | try { |
| | | String response = client.execute("trade_push.php", params); |
| | |
| | | * @param appkey 接口账号,接口请求的公共参数appkey |
| | | * @param appsecret 接口秘钥,接口请求的参数appsecret ,用于计算签名 |
| | | * @param url 接口地址,接口请求的公共参数url |
| | | * @param trade_no 订单编号 |
| | | * @param src_tid 原始单号 |
| | | * @param start_time 开始时间 |
| | | * @param end_time 结束时间 时间跨度不能超过60分钟 |
| | | * @return |
| | | */ |
| | | public static JSONObject tradeQuery(String sid, String appkey, String appsecret, String url, |
| | | String trade_no,String start_time,String end_time) { |
| | | String src_tid,String start_time,String end_time) { |
| | | WdtClient client = new WdtClient(sid, appkey, appsecret, url); |
| | | |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | params.put("start_time", start_time); |
| | | params.put("end_time", end_time); |
| | | params.put("trade_no", trade_no); |
| | | params.put("src_tid", src_tid); |
| | | // params.put("page_size", "40"); |
| | | // params.put("page_no", "0"); |
| | | |
| | |
| | | public static void main(String[] args) { |
| | | WdtClient client = new WdtClient("apidevnew2", "hytycw02-test", "c7ae51196", "https://sandbox.wangdian.cn/openapi2/"); |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | params.put("start_time", "2025-12-11 12:00:00"); |
| | | params.put("end_time", "2025-12-11 13:00:00"); |
| | | params.put("start_time", "2026-02-05 15:00:00"); |
| | | params.put("end_time", "2026-02-05 15:35:00"); |
| | | params.put("src_tid", "C2026011540514"); |
| | | params.put("page_size", "30"); |
| | | params.put("page_no", "0"); |
| | | |
| New file |
| | |
| | | package com.ruoyi.web.listener; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.web.controller.yuncang.api.trade.TradePush; |
| | | import com.ruoyi.web.listener.event.TradeOrderEvent; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.event.EventListener; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName PublishTopicUpdateCollectEventListener |
| | | * @Description |
| | | * @date 2021-08-11 18:44 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class TradeOrderEventListener { |
| | | |
| | | @Autowired |
| | | private TErpProcurementService erpProcurementService; |
| | | @Autowired |
| | | private TSysCloudConfigService sysCloudConfigService; |
| | | @Autowired |
| | | private TErpProcurementGoodsService erpProcurementGoodsService; |
| | | @Autowired |
| | | private TCrmSupplierService crmSupplierService; |
| | | @Autowired |
| | | private TCrmSupplierCloudShopService crmSupplierCloudShopService; |
| | | @Autowired |
| | | private TSysCloudMessageService sysCloudMessageService; |
| | | @Autowired |
| | | private TCrmClinicService crmClinicService; |
| | | @Autowired |
| | | private TCrmClinicCloudWarehouseService crmClinicCloudWarehouseService; |
| | | @Autowired |
| | | private TErpGoodsService erpGoodsService; |
| | | |
| | | @Async |
| | | @EventListener(TradeOrderEvent.class) |
| | | public void PublishTopicVipInfoEventListener(TradeOrderEvent event) { |
| | | log.info("进入云仓订单创建事件"); |
| | | String source = (String) event.getSource(); |
| | | String[] split = source.split("_"); |
| | | String erpProcurementId = split[0]; |
| | | String type = split[1]; |
| | | TErpProcurement erpProcurement = erpProcurementService.getById(erpProcurementId); |
| | | TSysCloudMessage tSysCloudMessage = new TSysCloudMessage(); |
| | | tSysCloudMessage.setErpProcurementId(erpProcurementId); |
| | | tSysCloudMessage.setCreateTime(LocalDateTime.now()); |
| | | tSysCloudMessage.setCommitType(1); |
| | | try { |
| | | log.info("开始推送"); |
| | | if (Objects.nonNull(erpProcurement)) { |
| | | TSysCloudConfig sysCloudConfig = sysCloudConfigService.getOne(Wrappers.lambdaQuery(TSysCloudConfig.class) |
| | | .eq(TSysCloudConfig::getCloudWarehouse, 1) |
| | | .last("LIMIT 1")); |
| | | log.info("查询到采购单信息"); |
| | | // 查询采购商品 |
| | | List<TErpProcurementGoods> erpProcurementGoodsList = erpProcurementGoodsService.list(Wrappers.lambdaQuery(TErpProcurementGoods.class) |
| | | .eq(TErpProcurementGoods::getProcurementId, erpProcurementId)); |
| | | if (Objects.isNull(erpProcurementGoodsList)) { |
| | | tSysCloudMessage.setErrorMessage("未查询到采购单商品信息"); |
| | | } |
| | | // 查询商品编码 |
| | | List<String> goodsIds = erpProcurementGoodsList.stream().map(TErpProcurementGoods::getGoodsId).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(goodsIds)) { |
| | | tSysCloudMessage.setErrorMessage("未查询到采购单商品id集合为空"); |
| | | } |
| | | List<TErpGoods> erpGoodsList = erpGoodsService.listByIds(goodsIds); |
| | | if (CollectionUtils.isEmpty(erpGoodsList)) { |
| | | tSysCloudMessage.setErrorMessage("未查询到采购单原商品信息的云仓商品编号"); |
| | | } |
| | | for (TErpProcurementGoods tErpProcurementGoods : erpProcurementGoodsList) { |
| | | List<TErpGoods> erpGoods = erpGoodsList.stream().filter(tErpGoods -> tErpGoods.getId().equals(tErpProcurementGoods.getGoodsId())).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(erpGoods)){ |
| | | tSysCloudMessage.setErrorMessage("未匹配到采购单商品信息的云仓商品编号"); |
| | | } |
| | | TErpGoods tErpGoods = erpGoods.get(0); |
| | | if(!StringUtils.hasLength(tErpGoods.getCloudGoodsId())){ |
| | | tSysCloudMessage.setErrorMessage("云仓商品ID为空"); |
| | | } |
| | | if(!StringUtils.hasLength(tErpGoods.getCloudSpecId())){ |
| | | tSysCloudMessage.setErrorMessage("云仓规格ID为空"); |
| | | } |
| | | if(!StringUtils.hasLength(tErpGoods.getCloudSpecCode())){ |
| | | tSysCloudMessage.setErrorMessage("云仓商品编号为空"); |
| | | } |
| | | if(!StringUtils.hasLength(tErpGoods.getCloudSpecCode())){ |
| | | tSysCloudMessage.setErrorMessage("云仓规格编号为空"); |
| | | } |
| | | tErpProcurementGoods.setCloudGoodsId(tErpGoods.getCloudGoodsId()); |
| | | tErpProcurementGoods.setCloudSpecId(tErpGoods.getCloudSpecId()); |
| | | tErpProcurementGoods.setCloudGoodsCode(tErpGoods.getCloudGoodsCode()); |
| | | tErpProcurementGoods.setCloudSpecCode(tErpGoods.getCloudSpecCode()); |
| | | } |
| | | log.info("查询到采购单商品信息"); |
| | | // 查询供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierService.getById(erpProcurement.getSupplierId()); |
| | | if (Objects.isNull(crmSupplier)) { |
| | | tSysCloudMessage.setErrorMessage("未查询到采购单供应商信息"); |
| | | } |
| | | // 查询供应商店铺 |
| | | TCrmSupplierCloudShop crmSupplierCloudShop = crmSupplierCloudShopService.getOne(Wrappers.lambdaQuery(TCrmSupplierCloudShop.class) |
| | | .eq(TCrmSupplierCloudShop::getSupplierId, erpProcurement.getSupplierId()) |
| | | .eq(TCrmSupplierCloudShop::getCloudWarehouse, 1) |
| | | .last("LIMIT 1")); |
| | | if (Objects.isNull(crmSupplierCloudShop)) { |
| | | tSysCloudMessage.setErrorMessage("未查询到采购单供应商云仓店铺信息"); |
| | | } |
| | | // 查询诊所信息 |
| | | TCrmClinic crmClinic = crmClinicService.getById(erpProcurement.getClinicId()); |
| | | if (Objects.isNull(crmClinic)) { |
| | | tSysCloudMessage.setErrorMessage("未查询到采购单诊所信息"); |
| | | } |
| | | // 查询诊所仓库 |
| | | TCrmClinicCloudWarehouse crmClinicCloudWarehouse = crmClinicCloudWarehouseService.getOne(Wrappers.lambdaQuery(TCrmClinicCloudWarehouse.class) |
| | | .eq(TCrmClinicCloudWarehouse::getClinicId, erpProcurement.getClinicId()) |
| | | .eq(TCrmClinicCloudWarehouse::getCloudWarehouse, 1) |
| | | .last("LIMIT 1")); |
| | | if (Objects.isNull(crmClinicCloudWarehouse)) { |
| | | tSysCloudMessage.setErrorMessage("未查询到采购单诊所云仓信息"); |
| | | } |
| | | if (!StringUtils.hasLength(tSysCloudMessage.getErrorMessage())){ |
| | | if("1".equals(type)){ |
| | | TradePush.tradePush(sysCloudConfig.getSid(), sysCloudConfig.getAppKey(), sysCloudConfig.getAppSecret(), sysCloudConfig.getUrl(), |
| | | erpProcurement,erpProcurementGoodsList,30,30,0,crmClinic.getPersonChargeName(),crmSupplierCloudShop.getCloudShopNo(), |
| | | crmClinic.getPersonChargeName(),crmClinic.getProvinceName(),crmClinic.getCityName(),crmClinic.getDistrictName(), |
| | | crmClinic.getClinicAddress(),crmClinic.getPhone()); |
| | | }else { |
| | | TradePush.tradePush(sysCloudConfig.getSid(), sysCloudConfig.getAppKey(), sysCloudConfig.getAppSecret(), sysCloudConfig.getUrl(), |
| | | erpProcurement,erpProcurementGoodsList,80,80,5,crmClinic.getPersonChargeName(),crmSupplierCloudShop.getCloudShopNo(), |
| | | crmClinic.getPersonChargeName(),crmClinic.getProvinceName(),crmClinic.getCityName(),crmClinic.getDistrictName(), |
| | | crmClinic.getClinicAddress(),crmClinic.getPhone()); |
| | | } |
| | | } |
| | | }else { |
| | | tSysCloudMessage.setErrorMessage("未查询到采购单信息"); |
| | | } |
| | | sysCloudMessageService.save(tSysCloudMessage); |
| | | } catch (Exception e) { |
| | | log.error("推送失败",e); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.web.listener.event; |
| | | |
| | | import org.springframework.context.ApplicationEvent; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName member微信用户信息的注册修改的发布事件 |
| | | * @Description 微信用户信息的注册修改的发布事件 |
| | | * @date 2021-06-24 15:04 |
| | | */ |
| | | public class TradeOrderEvent extends ApplicationEvent { |
| | | |
| | | public TradeOrderEvent(String source) { |
| | | super(source); |
| | | } |
| | | |
| | | } |
| | |
| | | @Excel(width = 30,name = "*商品名称") |
| | | private String goodsName; |
| | | |
| | | @Excel(width = 30,name = "*商品ID") |
| | | private String cloudGoodsId; |
| | | |
| | | @Excel(width = 30,name = "*规格ID") |
| | | private String cloudSpecId; |
| | | |
| | | @Excel(width = 30,name = "*商品编码") |
| | | private String cloudGoodsCode; |
| | | |
| New file |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.model.TSysCloudMessage; |
| | | |
| | | /** |
| | | * <p> |
| | | * AI推送消息表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2026-02-05 |
| | | */ |
| | | public interface TSysCloudMessageMapper extends BaseMapper<TSysCloudMessage> { |
| | | |
| | | } |
| | |
| | | @TableField("district_code") |
| | | private String districtCode; |
| | | |
| | | @ApiModelProperty(value = "详细地址") |
| | | @TableField("address") |
| | | private String address; |
| | | |
| | | } |
| | |
| | | @TableField("is_platform_commission") |
| | | private Integer isPlatformCommission; |
| | | |
| | | @ApiModelProperty(value = "物流单号") |
| | | @TableField("logistics_no") |
| | | private String logisticsNo; |
| | | |
| | | /** |
| | | * 新增执行 |
| | | */ |
| | |
| | | @TableField(exist = false) |
| | | private LocalDateTime payTime; |
| | | |
| | | |
| | | @ApiModelProperty(value = "云仓商品ID") |
| | | @TableField(exist = false) |
| | | private String cloudGoodsId; |
| | | @ApiModelProperty(value = "云仓规格ID") |
| | | @TableField(exist = false) |
| | | private String cloudSpecId; |
| | | @ApiModelProperty(value = "云仓商品编号") |
| | | @TableField(exist = false) |
| | | private String cloudGoodsCode; |
| | | @ApiModelProperty(value = "云仓规格编号") |
| | | @TableField(exist = false) |
| | | private String cloudSpecCode; |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * AI推送消息表 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2026-02-05 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_sys_cloud_message") |
| | | @ApiModel(value="TSysCloudMessage对象", description="AI推送消息表") |
| | | public class TSysCloudMessage implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId("id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "采购id") |
| | | @TableField("erp_procurement_id") |
| | | private String erpProcurementId; |
| | | |
| | | @ApiModelProperty(value = "推送时间") |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "推送类型 1=旺店通") |
| | | @TableField("commit_type") |
| | | private Integer commitType; |
| | | |
| | | @ApiModelProperty(value = "错误信息提示") |
| | | @TableField("error_message") |
| | | private String errorMessage; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.system.model.TSysCloudMessage; |
| | | |
| | | /** |
| | | * <p> |
| | | * AI推送消息表 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2026-02-05 |
| | | */ |
| | | public interface TSysCloudMessageService extends IService<TSysCloudMessage> { |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.mapper.TSysCloudMessageMapper; |
| | | import com.ruoyi.system.model.TSysCloudMessage; |
| | | import com.ruoyi.system.service.TSysCloudMessageService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * AI推送消息表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2026-02-05 |
| | | */ |
| | | @Service |
| | | public class TSysCloudMessageServiceImpl extends ServiceImpl<TSysCloudMessageMapper, TSysCloudMessage> implements TSysCloudMessageService { |
| | | |
| | | } |
| | |
| | | <result column="performance_count" property="performanceCount" /> |
| | | <result column="send_message_count" property="sendMessageCount" /> |
| | | <result column="qr_code" property="qrCode" /> |
| | | <result column="address" property="address" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="create_by" property="createBy" /> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.system.mapper.TSysCloudMessageMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.model.TSysCloudMessage"> |
| | | <id column="id" property="id" /> |
| | | <result column="erp_procurement_id" property="erpProcurementId" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="commit_type" property="commitType" /> |
| | | <result column="error_message" property="errorMessage" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, erp_procurement_id, create_time, commit_type, error_message |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | </if> |
| | | <if test="query.roleType != null and query.roleType == 5"> |
| | | AND show_type in (2,3) |
| | | AND status = 1 |
| | | </if> |
| | | AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |