瀏覽代碼

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

songyang 1 年之前
父節點
當前提交
ee54e84ae7

+ 0 - 93
src/main/java/com/dk/mdm/controller/wxapi/basic/WechatPayController.java

@@ -1,93 +0,0 @@
-package com.dk.mdm.controller.wxapi.basic;
-
-import com.alibaba.fastjson.JSONObject;
-import com.dk.common.response.ResponseResultVO;
-import com.dk.mdm.service.wxapi.basic.WechatPayService;
-import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
-import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
-import com.github.binarywang.wxpay.exception.WxPayException;
-import com.github.binarywang.wxpay.service.WxPayService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-
-/**
- * @author : admin
- *  * 后台管理设置的金额 从dkic_ms里取数据 金额
- *  * 所以放到了 权限的oauth-server 的服务里240327--作废
- * @desc : 微信支付的接口
- * @date : 2024/2/22 17:21
- */
-@Api(tags = "微信支付的接口")
-@RestController
-@RequestMapping("/wxapi/basic/wechat/pay")
-@Slf4j
-public class WechatPayController {
-    private ExecutorService executorService = Executors.newFixedThreadPool(20);
-
-    @Autowired
-    private WechatPayService wechatPayService;
-
-    /**
-     * 商户 下单选取旗舰版或专业版的订单-预支付订单
-     *
-     * @param param
-     * @return
-     * @throws WxPayException
-     */
-    @ApiOperation(value = "下单选取旗舰版或专业版的订单预支付订单")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "openId", value = "openId"),
-            @ApiImplicitParam(name = "paymentSn", value = "支付单号")
-    })
-    @PostMapping("/unified_order")
-    public ResponseResultVO unifiedOrder(@RequestBody Map<String, Object> param)
-            throws WxPayException {
-        return wechatPayService.unifiedOrder(param);
-    }
-
-    /**
-     * @desc : 微信支付的回调
-     * @author : 姜永辉
-     * @date : 2024/03/06 11:20
-     */
-    @PostMapping("/notify/order/{appId}")
-    public String parseOrderNotifyResult(@PathVariable(value = "appId") String appId, @RequestBody String xmlData)
-            throws WxPayException {
-        log.info("parseOrderNotifyResult--0" + appId + "---" + xmlData);
-        WxPayService wxPayService = wechatPayService.getWxPayService();
-        final WxPayOrderNotifyResult notifyResult = wxPayService.parseOrderNotifyResult(xmlData);
-        // 另起线程处理业务
-        executorService.execute(new Runnable() {
-            @Override
-            public void run() {
-                String resultCode = notifyResult.getResultCode();
-                log.info("parseOrderNotifyResult--1" + resultCode );
-                // 支付成功
-                if (resultCode.equals("SUCCESS")) {
-                    // 处理支付成功逻辑
-                    try {
-                        wechatPayService.notifyWechatPay(notifyResult);
-                    } catch (Exception e) {
-                        log.error("微信回调业务处理报错,params:" + notifyResult, e);
-                    }
-                } else {
-                    log.error("没有处理微信回调业务,交易状态:{},params:{}", resultCode, JSONObject.toJSON(notifyResult));
-                }
-            }
-        });
-        log.info("parseOrderNotifyResult--10000-成功"  );
-        return WxPayNotifyResponse.success("成功");
-    }
-
-
-}

+ 14 - 1
src/main/java/com/dk/mdm/mapper/ivt/OutboundItemMapper.xml

@@ -101,6 +101,7 @@
         <result column="sku_images" property="skuImages" typeHandler="JsonTypeHandler"/>
         <result column="sku_images" property="skuImages" typeHandler="JsonTypeHandler"/>
         <result column="skuModel" property="skuModel"/>
         <result column="skuModel" property="skuModel"/>
         <result column="skuName" property="skuName"/>
         <result column="skuName" property="skuName"/>
+        <result column="priceStandard" property="priceStandard"/>
         <result column="brandName" property="brandName"/>
         <result column="brandName" property="brandName"/>
         <result column="brand_name" property="brandName"/>
         <result column="brand_name" property="brandName"/>
         <result column="shortName" property="shortName"/>
         <result column="shortName" property="shortName"/>
@@ -122,6 +123,10 @@
         <result column="sub_unit_code" property="subUnitCode"/>
         <result column="sub_unit_code" property="subUnitCode"/>
         <result column="sub_unit_name" property="subUnitName"/>
         <result column="sub_unit_name" property="subUnitName"/>
         <result column="pack_box" property="packBox"/>
         <result column="pack_box" property="packBox"/>
+        <result column="flgSubUnit" property="flgSubUnit"/>
+        <result column="subUnitName" property="subUnitName"/>
+        <result column="unitName" property="unitName"/>
+
     </resultMap>
     </resultMap>
 
 
     <!-- 通用条件列 -->
     <!-- 通用条件列 -->
@@ -371,7 +376,13 @@
                t.item_index,
                t.item_index,
                t.sku_id,
                t.sku_id,
                tmgs.sku_images,
                tmgs.sku_images,
-
+               tmgs.flg_sub_unit AS "flgSubUnit",
+               t.outing_box AS "outingBox",
+               t.outing_piece AS "outingPiece",
+               tmgs.price_standard AS "priceStandard",
+                tmgs.pack_box AS "packBox",
+                tmgus.unit_name         as "subUnitName",
+                tmgu.unit_name         as "unitName",
                tmgs.sku_code                                                             as "skuCode",
                tmgs.sku_code                                                             as "skuCode",
                tmgs.sku_model                                                            as "skuModel",
                tmgs.sku_model                                                            as "skuModel",
                tmgs.sku_name                                                             as "skuName",
                tmgs.sku_name                                                             as "skuName",
@@ -395,6 +406,8 @@
                  left join dkic_b.t_psi_order_item as tpoi on tpoi.item_id = t.from_item_id
                  left join dkic_b.t_psi_order_item as tpoi on tpoi.item_id = t.from_item_id
                  left join dkic_b.t_psi_order as tpo on tpo.order_id = t.from_id
                  left join dkic_b.t_psi_order as tpo on tpo.order_id = t.from_id
                  left join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
                  left join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
+                 left join dkic_b.t_mst_unit as tmgu on t.unit_id = tmgu.unit_id
+                 left join dkic_b.t_mst_unit as tmgus on t.sub_unit_id = tmgus.unit_id
                  left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = t.inv_id
                  left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = t.inv_id
                  left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
                  left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
                  left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
                  left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id

+ 19 - 0
src/main/java/com/dk/mdm/mapper/sale/OrderMapper.xml

@@ -175,6 +175,20 @@
             <result column="org_name" property="orgName"/>
             <result column="org_name" property="orgName"/>
             <result column="staff_name" property="staffName"/>
             <result column="staff_name" property="staffName"/>
 
 
+
+        <result column="cus_code" property="cusCode"/>
+        <result column="cus_name" property="cusName"/>
+        <result column="cus_phone" property="cusPhone"/>
+        <result column="address_area" property="addressArea" typeHandler="JsonTypeHandler"/>
+        <result column="address_name" property="addressName"/>
+        <result column="address_no" property="addressNo"/>
+        <result column="address_gcj02" property="addressGcj02" typeHandler="JsonTypeHandler"/>
+        <result column="address_full" property="addressFull"/>
+        <result column="contact_name" property="contactName"/>
+        <result column="contact_phone" property="contactPhone"/>
+        <result column="cus_from" property="cusFrom" typeHandler="UuidTypeHandler"/>
+        <result column="channel_id" property="channelId" typeHandler="UuidTypeHandler"/>
+
             <collection property="orderItemResponseList" resultMap="itemListMap" columnPrefix="list_"/>
             <collection property="orderItemResponseList" resultMap="itemListMap" columnPrefix="list_"/>
     </resultMap>
     </resultMap>
     <!--小程序用 关联映射-->
     <!--小程序用 关联映射-->
@@ -966,8 +980,13 @@
     <select id="selectByCondDetail" resultMap="BaseResultMapDetailResponse">
     <select id="selectByCondDetail" resultMap="BaseResultMapDetailResponse">
         SELECT
         SELECT
         <include refid="Base_Column_List_Detail_Join"/>,
         <include refid="Base_Column_List_Detail_Join"/>,
+        tmc.cus_code,tmc.cus_name, tmc.cus_phone, tmc.address_area, tmc.address_name, tmc.address_no,
+        tmc.address_gcj02, tmc.address_full, tmc.contact_name, tmc.contact_phone, tmc.cus_from, tmc.channel_id,
+
+
         <include refid="Base_Column_List_Item_Response_Detail_Join"/>
         <include refid="Base_Column_List_Item_Response_Detail_Join"/>
         FROM dkic_b.t_psi_order as t
         FROM dkic_b.t_psi_order as t
+        left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
         left join dkic_b.t_psi_order_item toi on toi.order_id  = t.order_id
         left join dkic_b.t_psi_order_item toi on toi.order_id  = t.order_id
         inner join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id  = toi.sku_id
         inner join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id  = toi.sku_id
         left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id  = tmgs.brand_id
         left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id  = tmgs.brand_id

+ 2 - 2
src/main/java/com/dk/mdm/model/pojo/mst/Staff.java

@@ -194,9 +194,9 @@ public class Staff extends PageInfo<Staff> implements Serializable {
     private Boolean flgCanLogin;
     private Boolean flgCanLogin;
 
 
     /**
     /**
-     * 登录系统 0:PC端,1:移动端,2:PC+移动端
+     * 1:PC端,2:移动端,3:PC+移动端
      */
      */
-    @ApiModelProperty(value = "登录系统 0:PC端,1:移动端,2:PC+移动端")
+    @ApiModelProperty(value = "1:PC端,2:移动端,3:PC+移动端")
     private Integer loginType;
     private Integer loginType;
 
 
 
 

+ 4 - 1
src/main/java/com/dk/mdm/model/response/ivt/OutboundItemResponse.java

@@ -318,6 +318,9 @@ public class OutboundItemResponse {
     @ApiModelProperty(value = "已出库数量")
     @ApiModelProperty(value = "已出库数量")
     private BigDecimal outboundOutQty;
     private BigDecimal outboundOutQty;
 
 
+    @ApiModelProperty(value = "标价")
+    private BigDecimal priceStandard;
+
     @ApiModelProperty(value = "可退货数量")
     @ApiModelProperty(value = "可退货数量")
     private BigDecimal canReturnQty;
     private BigDecimal canReturnQty;
 
 
@@ -369,7 +372,7 @@ public class OutboundItemResponse {
     private String subUnitName;
     private String subUnitName;
 
 
 
 
-
+    private Boolean flgSubUnit;
 
 
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 

+ 2 - 0
src/main/java/com/dk/mdm/model/response/sale/OrderResponse.java

@@ -398,6 +398,8 @@ public class OrderResponse extends PageInfo<OrderResponse> implements Serializab
     @ApiModelProperty(value = "实收金额")
     @ApiModelProperty(value = "实收金额")
     private BigDecimal amtFactReceipt;
     private BigDecimal amtFactReceipt;
 
 
+    private String channelId;
+
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
 }
 }

+ 124 - 96
src/main/java/com/dk/mdm/service/mst/StaffService.java

@@ -1,5 +1,6 @@
 package com.dk.mdm.service.mst;
 package com.dk.mdm.service.mst;
 
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.dk.common.exception.BaseBusinessException;
 import com.dk.common.exception.BaseBusinessException;
 import com.dk.common.infrastructure.annotaiton.Pagination;
 import com.dk.common.infrastructure.annotaiton.Pagination;
@@ -12,6 +13,7 @@ import com.dk.common.model.vo.core.StaffEntity;
 import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.common.response.ResponseResultVO;
+import com.dk.common.util.AESUtil;
 import com.dk.mdm.feign.CompanyFeign;
 import com.dk.mdm.feign.CompanyFeign;
 import com.dk.mdm.feign.UserFeign;
 import com.dk.mdm.feign.UserFeign;
 import com.dk.mdm.infrastructure.convert.mst.StaffConvert;
 import com.dk.mdm.infrastructure.convert.mst.StaffConvert;
@@ -126,6 +128,16 @@ public class StaffService extends BaseService<Staff> {
             Integer cpId = authUtils.getStaff().getCpId();
             Integer cpId = authUtils.getStaff().getCpId();
             staffQuery.setCpId(cpId);
             staffQuery.setCpId(cpId);
         }
         }
+//        Map<String,Object> map = new HashMap<>();
+//        map.put("grade_code","STD");
+//        map.put("end_date","2099-09-01");
+//        map.put("web_max_num",1);
+//        map.put("wx_max_num",1);
+//        String s1 = JSON.toJSONString(map);
+//        // 加密
+//        String s = AESUtil.aesEncrypt(s1);
+//        // 解密
+//        Map<String,Object> ss = JSON.parseObject(AESUtil.desEncrypt(s),Map.class) ;
         return super.mergeListWithCount(staffQuery, staffMapper.selectByCond(staffQuery),
         return super.mergeListWithCount(staffQuery, staffMapper.selectByCond(staffQuery),
                 staffMapper.countByCond(staffQuery));
                 staffMapper.countByCond(staffQuery));
     }
     }
@@ -292,7 +304,7 @@ public class StaffService extends BaseService<Staff> {
             role.setRoleName(m.get("roleName").toString());
             role.setRoleName(m.get("roleName").toString());
             role.setDisplayNo((Integer) m.get("displayNo"));
             role.setDisplayNo((Integer) m.get("displayNo"));
             role.setCpId(cpId);
             role.setCpId(cpId);
-            role.setOpCreateUserId(m.get("opCreateUserId").toString());
+            role.setOpCreateUserId(staffId);
             listR.add(role);
             listR.add(role);
         }
         }
         roleMapper.insertBatch(listR);
         roleMapper.insertBatch(listR);
@@ -310,128 +322,144 @@ public class StaffService extends BaseService<Staff> {
         // 仓库
         // 仓库
         List<Map<String, Object>> listWarehouses = map.get("warehouses");
         List<Map<String, Object>> listWarehouses = map.get("warehouses");
         List<Warehouse> listW = new ArrayList<>();
         List<Warehouse> listW = new ArrayList<>();
-        for (int i = 0; i < listWarehouses.size(); i++) {
-            Map<String, Object> m = listWarehouses.get(i);
-            Warehouse warehouse = new Warehouse();
-            warehouse.setWhCode(m.get("whCode").toString());
-            warehouse.setWhName(m.get("whName").toString());
-            warehouse.setDisplayNo((Integer) m.get("displayNo"));
-            warehouse.setFlgDefault((Boolean) m.get("flgDefault"));
-            warehouse.setCpId(cpId);
-            warehouse.setOpCreateUserId(m.get("opCreateUserId").toString());
-            listW.add(warehouse);
+        if (listWarehouses != null && listWarehouses.size() > 0) {
+            for (int i = 0; i < listWarehouses.size(); i++) {
+                Map<String, Object> m = listWarehouses.get(i);
+                Warehouse warehouse = new Warehouse();
+                warehouse.setWhCode(m.get("whCode").toString());
+                warehouse.setWhName(m.get("whName").toString());
+                warehouse.setDisplayNo((Integer) m.get("displayNo"));
+                warehouse.setFlgDefault((Boolean) m.get("flgDefault"));
+                warehouse.setCpId(cpId);
+                warehouse.setOpCreateUserId(staffId);
+                listW.add(warehouse);
+            }
+            warehouseMapper.insertBatch(listW);
         }
         }
-        warehouseMapper.insertBatch(listW);
+
         // 渠道
         // 渠道
         List<Map<String, Object>> listSaleChannels = map.get("saleChannels");
         List<Map<String, Object>> listSaleChannels = map.get("saleChannels");
         List<SaleChannel> listSc = new ArrayList<>();
         List<SaleChannel> listSc = new ArrayList<>();
-        for (int i = 0; i < listSaleChannels.size(); i++) {
-            Map<String, Object> m = listSaleChannels.get(i);
-            SaleChannel saleChannel = new SaleChannel();
-            saleChannel.setChannelCode(m.get("channelCode").toString());
-            saleChannel.setChannelName(m.get("channelName").toString());
-            saleChannel.setDisplayNo((Integer) m.get("displayNo"));
-            saleChannel.setFlgDefault((Boolean) m.get("flgDefault"));
-            saleChannel.setCpId(cpId);
-            saleChannel.setOpCreateUserId(m.get("opCreateUserId").toString());
-            listSc.add(saleChannel);
+        if (listSaleChannels != null && listSaleChannels.size() > 0) {
+            for (int i = 0; i < listSaleChannels.size(); i++) {
+                Map<String, Object> m = listSaleChannels.get(i);
+                SaleChannel saleChannel = new SaleChannel();
+                saleChannel.setChannelCode(m.get("channelCode").toString());
+                saleChannel.setChannelName(m.get("channelName").toString());
+                saleChannel.setDisplayNo((Integer) m.get("displayNo"));
+                saleChannel.setFlgDefault((Boolean) m.get("flgDefault"));
+                saleChannel.setCpId(cpId);
+                saleChannel.setOpCreateUserId(staffId);
+                listSc.add(saleChannel);
+            }
+            saleChannelMapper.insertBatch(listSc);
         }
         }
-        saleChannelMapper.insertBatch(listSc);
+
         // 基础资料
         // 基础资料
         List<Map<String, Object>> listDictionaryDatas = map.get("dictionaryDatas");
         List<Map<String, Object>> listDictionaryDatas = map.get("dictionaryDatas");
         List<DictionaryData> listDD = new ArrayList<>();
         List<DictionaryData> listDD = new ArrayList<>();
-        for (int i = 0; i < listDictionaryDatas.size(); i++) {
-            Map<String, Object> m = listDictionaryDatas.get(i);
-            DictionaryData dictionaryData = new DictionaryData();
-            dictionaryData.setDictCode(m.get("dictCode").toString());
-            dictionaryData.setDataCode(m.get("dataCode").toString());
-            dictionaryData.setDataValue(m.get("dataValue").toString());
-            dictionaryData.setDisplayNo((Integer) m.get("displayNo"));
-            dictionaryData.setFlgDefault((Boolean) m.get("flgDefault"));
-            dictionaryData.setCpId(cpId);
-            dictionaryData.setOpCreateUserId(m.get("opCreateUserId").toString());
-            listDD.add(dictionaryData);
+        if (listDictionaryDatas != null && listDictionaryDatas.size() > 0) {
+            for (int i = 0; i < listDictionaryDatas.size(); i++) {
+                Map<String, Object> m = listDictionaryDatas.get(i);
+                DictionaryData dictionaryData = new DictionaryData();
+                dictionaryData.setDictCode(m.get("dictCode").toString());
+                dictionaryData.setDataCode(m.get("dataCode").toString());
+                dictionaryData.setDataValue(m.get("dataValue").toString());
+                dictionaryData.setDisplayNo((Integer) m.get("displayNo"));
+                dictionaryData.setFlgDefault((Boolean) m.get("flgDefault"));
+                dictionaryData.setCpId(cpId);
+                dictionaryData.setOpCreateUserId(staffId);
+                listDD.add(dictionaryData);
+            }
+            dictionaryDataMapper.insertBatch(listDD);
         }
         }
-        dictionaryDataMapper.insertBatch(listDD);
+
         // 资金账户
         // 资金账户
         List<Map<String, Object>> listMoneyAccounts = map.get("moneyAccounts");
         List<Map<String, Object>> listMoneyAccounts = map.get("moneyAccounts");
         List<MoneyAccount> listMa = new ArrayList<>();
         List<MoneyAccount> listMa = new ArrayList<>();
-        for (int i = 0; i < listMoneyAccounts.size(); i++) {
-            Map<String, Object> m = listMoneyAccounts.get(i);
-            MoneyAccount moneyAccount = new MoneyAccount();
-            moneyAccount.setMacCode(m.get("macCode").toString());
-            moneyAccount.setMacName(m.get("macName").toString());
-            moneyAccount.setMacType(m.get("macType").toString());
-            moneyAccount.setBalance((BigDecimal) m.get("balance"));
-            moneyAccount.setFlgDefault((Boolean) m.get("flgDefault"));
-            moneyAccount.setDisplayNo((Integer) m.get("displayNo"));
-            moneyAccount.setCpId(cpId);
-            listMa.add(moneyAccount);
+        if (listMoneyAccounts != null && listMoneyAccounts.size() > 0) {
+            for (int i = 0; i < listMoneyAccounts.size(); i++) {
+                Map<String, Object> m = listMoneyAccounts.get(i);
+                MoneyAccount moneyAccount = new MoneyAccount();
+                moneyAccount.setMacCode(m.get("macCode").toString());
+                moneyAccount.setMacName(m.get("macName").toString());
+                moneyAccount.setMacType(m.get("macType").toString());
+                moneyAccount.setBalance((BigDecimal) m.get("balance"));
+                moneyAccount.setFlgDefault((Boolean) m.get("flgDefault"));
+                moneyAccount.setDisplayNo((Integer) m.get("displayNo"));
+                moneyAccount.setCpId(cpId);
+                listMa.add(moneyAccount);
+            }
+            moneyAccountMapper.insertBatch(listMa);
         }
         }
-        moneyAccountMapper.insertBatch(listMa);
         // 计量单位
         // 计量单位
         List<Map<String, Object>> listUnits = map.get("units");
         List<Map<String, Object>> listUnits = map.get("units");
         List<Unit> listU = new ArrayList<>();
         List<Unit> listU = new ArrayList<>();
-        for (int i = 0; i < listUnits.size(); i++) {
-            Map<String, Object> m = listUnits.get(i);
-            Unit unit = new Unit();
-            unit.setUnitCode(m.get("unitCode").toString());
-            unit.setUnitName(m.get("unitName").toString());
-            unit.setDecimalPlaces((Integer) m.get("decimalPlaces"));
-            unit.setDisplayNo((Integer) m.get("displayNo"));
-            unit.setCpId(cpId);
-            unit.setOpCreateUserId(m.get("opCreateUserId").toString());
-            listU.add(unit);
+        if (listUnits != null && listUnits.size() > 0) {
+            for (int i = 0; i < listUnits.size(); i++) {
+                Map<String, Object> m = listUnits.get(i);
+                Unit unit = new Unit();
+                unit.setUnitCode(m.get("unitCode").toString());
+                unit.setUnitName(m.get("unitName").toString());
+                unit.setDecimalPlaces((Integer) m.get("decimalPlaces"));
+                unit.setDisplayNo((Integer) m.get("displayNo"));
+                unit.setCpId(cpId);
+                unit.setOpCreateUserId(staffId);
+                listU.add(unit);
+            }
+            unitMapper.insertBatch(listU);
         }
         }
-        unitMapper.insertBatch(listU);
+
         // 种类
         // 种类
         List<Map<String, Object>> listGoodsCategorys = map.get("goodsCategorys");
         List<Map<String, Object>> listGoodsCategorys = map.get("goodsCategorys");
         List<GoodsCategory> listG = new ArrayList<>();
         List<GoodsCategory> listG = new ArrayList<>();
-        for (int i = 0; i < listGoodsCategorys.size(); i++) {
-            Map<String, Object> m = listGoodsCategorys.get(i);
-            GoodsCategory goodsCategory = new GoodsCategory();
-            goodsCategory.setCatCode(m.get("catCode") + "");
-            goodsCategory.setCatName(m.get("catName") + "");
-            if (m.get("parentId") != null) {
-                goodsCategory.setParentId(m.get("parentId") + "");
-            }
-            if (m.get("topId") != null) {
-                goodsCategory.setTopId(m.get("topId") + "");
-            }
-            if (m.get("levelUpper") != null) {
-                goodsCategory.setLevelUpper(m.get("levelUpper") + "");
-            }
-            if (m.get("levelLower") != null) {
-                goodsCategory.setLevelLower(m.get("levelLower") + "");
+        if (listGoodsCategorys != null && listGoodsCategorys.size() > 0) {
+            for (int i = 0; i < listGoodsCategorys.size(); i++) {
+                Map<String, Object> m = listGoodsCategorys.get(i);
+                GoodsCategory goodsCategory = new GoodsCategory();
+                goodsCategory.setCatCode(m.get("catCode") + "");
+                goodsCategory.setCatName(m.get("catName") + "");
+                if (m.get("parentId") != null) {
+                    goodsCategory.setParentId(m.get("parentId") + "");
+                }
+                if (m.get("topId") != null) {
+                    goodsCategory.setTopId(m.get("topId") + "");
+                }
+                if (m.get("levelUpper") != null) {
+                    goodsCategory.setLevelUpper(m.get("levelUpper") + "");
+                }
+                if (m.get("levelLower") != null) {
+                    goodsCategory.setLevelLower(m.get("levelLower") + "");
+                }
+                goodsCategory.setLevelLeaf((Boolean) m.get("levelLeaf"));
+                goodsCategory.setLevelNo((Integer) m.get("levelNo"));
+                goodsCategory.setLevelCode(m.get("levelCode") + "");
+                goodsCategory.setLevelName(m.get("levelName") + "");
+                goodsCategory.setDisplayNo((Integer) m.get("displayNo"));
+                goodsCategory.setCpId(cpId);
+                goodsCategory.setOpCreateUserId(staffId);
+                listG.add(goodsCategory);
             }
             }
-            goodsCategory.setLevelLeaf((Boolean) m.get("levelLeaf"));
-            goodsCategory.setLevelNo((Integer) m.get("levelNo"));
-            goodsCategory.setLevelCode(m.get("levelCode") + "");
-            goodsCategory.setLevelName(m.get("levelName") + "");
-            goodsCategory.setDisplayNo((Integer) m.get("displayNo"));
-            goodsCategory.setCpId(cpId);
-            goodsCategory.setOpCreateUserId(m.get("opCreateUserId").toString());
-            listG.add(goodsCategory);
+            goodsCategoryMapper.insertBatch(listG);
         }
         }
-        goodsCategoryMapper.insertBatch(listG);
 
 
         // 打印票据
         // 打印票据
         List<Map<String, Object>> listPrintLayout = map.get("printLayout");
         List<Map<String, Object>> listPrintLayout = map.get("printLayout");
         List<PrintLayout> listP = new ArrayList<>();
         List<PrintLayout> listP = new ArrayList<>();
-        for (int i = 0; i < listPrintLayout.size(); i++) {
-            Map<String, Object> m = listPrintLayout.get(i);
-            PrintLayout printLayout = new PrintLayout();
-            printLayout.setLayoutName(m.get("layoutName") + "");
-            printLayout.setLayoutData(JSONObject.parseObject(JSONObject.toJSONString(m.get("layoutData"))));
-            printLayout.setDisplayNo((Integer) m.get("displayNo"));
-            printLayout.setDocName(m.get("docName") + "");
-            printLayout.setCpId(cpId);
-            printLayout.setOpCreateUserId(m.get("opCreateUserId").toString());
-            listP.add(printLayout);
+        if (listPrintLayout != null && listPrintLayout.size() > 0) {
+            for (int i = 0; i < listPrintLayout.size(); i++) {
+                Map<String, Object> m = listPrintLayout.get(i);
+                PrintLayout printLayout = new PrintLayout();
+                printLayout.setLayoutName(m.get("layoutName") + "");
+                printLayout.setLayoutData(JSONObject.parseObject(JSONObject.toJSONString(m.get("layoutData"))));
+                printLayout.setDisplayNo((Integer) m.get("displayNo"));
+                printLayout.setDocName(m.get("docName") + "");
+                printLayout.setCpId(cpId);
+                printLayout.setOpCreateUserId(staffId);
+                listP.add(printLayout);
+            }
+            printLayoutMapper.insertBatch(listP);
         }
         }
-        printLayoutMapper.insertBatch(listP);
-
-
         return ResponseResultUtil.success();
         return ResponseResultUtil.success();
     }
     }
 
 

+ 0 - 148
src/main/java/com/dk/mdm/service/wxapi/basic/WechatPayService.java

@@ -1,148 +0,0 @@
-package com.dk.mdm.service.wxapi.basic;
-
-import com.dk.common.response.ResponseResultUtil;
-import com.dk.common.response.ResponseResultVO;
-import com.dk.common.util.*;
-import com.dk.mdm.infrastructure.config.WechatPayConfigInfo;
-import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
-import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
-import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
-import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderResult;
-import com.github.binarywang.wxpay.config.WxPayConfig;
-import com.github.binarywang.wxpay.exception.WxPayException;
-import com.github.binarywang.wxpay.service.WxPayService;
-import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-
-import java.math.BigDecimal;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 微信支付服务
- * 后台管理设置的金额 从dkic_ms里取数据 金额
- * 所以放到了 权限的oauth-server 的服务里240327--作废
- * @author 姜永辉
- * @since 20223-07-01 09:41:05
- */
-@Service("wechatPayService")
-@Slf4j
-public class WechatPayService {
-    @Autowired
-    private WechatPayConfigInfo wechatPayConfigInfo;
-
-    /**
-     * 商户 下单选取旗舰版或专业版的订单
-     *
-     * @param param
-     * @return
-     * @throws WxPayException
-     */
-    public ResponseResultVO unifiedOrder(Map<String, Object> param) throws WxPayException {
-        String paymentSn = param.get("paymentSn").toString();
-        String openId = param.get("openId").toString();
-        log.info("下单选取旗舰版或专业版的订单1----------" + param.toString());
-        try {
-            // 获取单据的金额 --后台管理设置的金额 从dkic_ms里取数据 金额
-            // 所以放到了 权限的oauth-server 的服务里
-            // todo。。。。。。。。。。。。
-
-            String payFee = "0.01";
-            WxPayService wxPayService = this.getWxPayService();
-            WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
-            orderRequest.setBody("商品测试");
-            orderRequest.setOutTradeNo(paymentSn);
-            orderRequest.setTotalFee(BaseWxPayRequest.yuanToFen(payFee.toString()));//元转成分
-            orderRequest.setOpenid(openId);
-            orderRequest.setSpbillCreateIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
-            orderRequest.setNotifyUrl(wechatPayConfigInfo.getWechatNotifyUrl() + "/" + wechatPayConfigInfo.getAppId());
-            orderRequest.setTradeType("JSAPI");
-            // 生成预支付订单
-            WxPayUnifiedOrderResult wxPayUnifiedOrderResult = wxPayService.unifiedOrder(orderRequest);
-            String prepay_id = wxPayUnifiedOrderResult.getPrepayId();
-            String timeStamp = new Date().getTime() + "";
-            String nonceStr = UUID.fastUUID().toString(true);
-            String pack = "prepay_id=" + prepay_id;
-            String signType = "MD5";
-            String paySign = "";
-            String sigmTemp = "appId=" + wxPayUnifiedOrderResult.getAppid() + "&nonceStr=" + nonceStr + "&package="
-                    + pack + "&signType=" + signType + "&timeStamp=" + timeStamp;
-            sigmTemp = sigmTemp + "&key=" + wechatPayConfigInfo.getMchKey();
-            paySign = Md5Utils.hash(sigmTemp);
-            log.info("下单选取旗舰版或专业版的订单2----------" + prepay_id + "--" + sigmTemp + "--");
-            Map<String, Object> params = new HashMap<String, Object>();
-            params.put("appId", wxPayUnifiedOrderResult.getAppid());
-            params.put("timeStamp", timeStamp);
-            params.put("nonceStr", nonceStr);
-            params.put("pack", pack);
-            params.put("signType", signType);
-            params.put("paySign", paySign);
-            log.info("下单选取旗舰版或专业版的订单3----------" + params.toString());
-            return ResponseResultUtil.success(params);
-        } catch (Exception e) {
-            log.error("unifiedOrder--微信支付失败!支付单号:{},原因:{}", paymentSn, e.getMessage());
-            return ResponseResultUtil.error("支付失败,请稍后重试!");
-        }
-    }
-
-    /**
-     * @desc : 处理支付成功逻辑
-     * @author : 姜永辉
-     * @date : 2024/03/06 11:29
-     */
-    public ResponseResultVO notifyWechatPay(WxPayOrderNotifyResult info) {
-        log.info("处理支付成功逻辑----------" + info.getOutTradeNo() + "---------" + info.toString());
-
-//  判断支付金额是否一致
-//        ShopOrderPaymentDto sop = new ShopOrderPaymentDto();
-//        sop.setPaymentsn(info.getOutTradeNo());
-//        sop.setPaystatus(0L);
-//        ShopOrderPayment shopOrderPaymentReturn = shopOrderPaymentMapper.selectEntity(sop);
-//        log.info("从订单流水表没有查到数据----------" + info.getOutTradeNo());
-//        if (shopOrderPaymentReturn == null) {
-//            log.error("从订单流水表没有查到数据----------" + info.getOutTradeNo());
-//            return ResponseResultUtil.error("从订单流水表没有查到数据----------" + info.getOutTradeNo());
-//        }
-//        // //  230918  在生成 微信码时候插入 待支付的 数据
-//        BigDecimal payFee = new BigDecimal(info.getTotalFee()).divide(new BigDecimal(100), 2, RoundingMode.HALF_EVEN);
-//        log.info("微信扫码和插入待支付订单的钱不符-------" + shopOrderPaymentReturn.getAmount()
-//                + "--" + payFee);
-//        if (shopOrderPaymentReturn.getAmount().compareTo(payFee) != 0) {
-//            log.error("微信扫码和插入待支付订单的钱不符-------" + shopOrderPaymentReturn.getAmount()
-//                    + "--" + payFee);
-//            return CommonResult.fail("微信扫码和插入待支付订单的钱不符-------" + shopOrderPaymentReturn.getAmount()
-//                    + "--" + payFee);
-//
-//        }
-        //判断是否已经做支付处理
-//        log.info("判断是否已经做支付处理----------" + shopOrderPaymentReturn.getPaystatus().toString());
-
-        return ResponseResultUtil.success();
-    }
-
-    /**
-     * @desc : 获取商户配置信息
-     * @author : 姜永辉
-     * @date : 2023-08-02 17:30
-     */
-    public WxPayService getWxPayService() {
-        log.info("getWxPayService----------" + wechatPayConfigInfo.toString());
-        WxPayConfig payConfig = new WxPayConfig();
-        payConfig.setAppId(StringUtils.trimToNull(wechatPayConfigInfo.getAppId()));
-        payConfig.setMchId(StringUtils.trimToNull(wechatPayConfigInfo.getMchId()));
-        payConfig.setMchKey(StringUtils.trimToNull(wechatPayConfigInfo.getMchKey()));
-//        payConfig.setSubAppId(null);
-//        payConfig.setSubMchId(null);
-//        payConfig.setKeyPath(StringUtils.trimToNull(wechatPayConfigInfo.getKeyPath()));
-        // 可以指定是否使用沙箱环境
-        payConfig.setUseSandboxEnv(false);
-        WxPayService wxPayService = new WxPayServiceImpl();
-        wxPayService.setConfig(payConfig);
-        return wxPayService;
-    }
-}