1
0
فهرست منبع

1.产品备案开发
2.打印小票时打印面单开发

yangbo 4 سال پیش
والد
کامیت
7cb6991dc6

+ 11 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/GoodsProductController.java

@@ -102,6 +102,7 @@ public class GoodsProductController {
         if (barcode!=null) {
             return R.error("此产品条码:"+barcode.getProdBarcode()+"以备案");
         }
+        goodsProduct.setStatus(Dict.productRecordStatus.item_00.getItem());
         goodsProductService.save(goodsProduct);
         return R.ok();
     }
@@ -528,6 +529,16 @@ public class GoodsProductController {
         String result = goodsProductService.sendAllProduct(Dict.operateFlag.item_2.getItem());
         return R.ok(result);
     }
+    /**
+     * 从oms拉取产品备案数据,然后更新
+     */
+    @RequestMapping("/pullFromOms")
+    @ResponseBody
+    public R pull() {
+        String result = goodsProductService.pullFromOms();
+        return R.ok(result);
+    }
+
 
 
 }

+ 10 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/GoodsProductEntity.java

@@ -216,6 +216,16 @@ public class GoodsProductEntity implements Serializable {
 
     private Date omsAuditTime;
 
+    private String status;
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
     public Date getOmsAuditTime() {
         return omsAuditTime;
     }

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/service/GoodsProductService.java

@@ -89,4 +89,5 @@ public interface GoodsProductService {
 
     int updateAuditInfo(String sku, String isAudit, Date auditTime, String auditRemark);
 
+    String pullFromOms();
 }

+ 134 - 33
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsProductServiceImpl.java

@@ -1,16 +1,19 @@
 package com.kmall.admin.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.google.common.base.Joiner;
 import com.google.gson.Gson;
 import com.kmall.admin.dao.GoodsProductDao;
 import com.kmall.admin.dto.GoodsProductDto;
 import com.kmall.admin.dto.PdProductDtoInfo;
 import com.kmall.admin.entity.GoodsProductEntity;
 import com.kmall.admin.service.GoodsProductService;
+import com.kmall.admin.service.GoodsService;
 import com.kmall.admin.utils.ShiroUtils;
 import com.kmall.admin.utils.data.response.ResponseMessage;
 import com.kmall.admin.utils.oms.OmsSign;
 import com.kmall.common.constant.Dict;
+import com.kmall.common.utils.R;
 import com.kmall.common.utils.RRException;
 import com.kmall.manager.manager.merch.OmsMerchProperties;
 import okhttp3.Request;
@@ -23,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 
 import java.math.BigDecimal;
+import java.net.URLEncoder;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -41,6 +45,9 @@ public class GoodsProductServiceImpl implements GoodsProductService {
     private GoodsProductDao goodsProductDao;
 
     @Autowired
+    private GoodsService goodsService;
+
+    @Autowired
     private OmsMerchProperties omsMerchProperties;
 
     @Override
@@ -60,11 +67,47 @@ public class GoodsProductServiceImpl implements GoodsProductService {
 
     @Override
     public int save(GoodsProductEntity goodsProduct) {
+        GoodsProductEntity entity = goodsProductDao.selectBySku(goodsProduct.getSku());
+        if (entity != null) {
+            throw new RRException("该sku已存在!");
+        }
+        entity = goodsProductDao.selectByBarcode(goodsProduct.getProdBarcode());
+        if (entity != null) {
+            throw new RRException("该产品条码已存在!");
+        }
+        goodsProduct.setStatus(Dict.productRecordStatus.item_00.getItem());
         return goodsProductDao.save(goodsProduct);
     }
 
+
     @Override
     public int update(GoodsProductEntity goodsProduct) {
+        GoodsProductEntity entity = goodsProductDao.selectBySku(goodsProduct.getSku());
+        if (entity == null) {
+            throw new RRException("该产品sku不存在!");
+        }
+        String status = entity.getStatus();
+        Map<String, String> restrictMsg = new HashMap<>();
+
+        restrictMsg.put(Dict.productRecordStatus.item_02.getItem(), "该数据正在审核中,无法修改");
+        restrictMsg.put(Dict.productRecordStatus.item_12.getItem(), "该数据正在审核中,无法修改");
+        restrictMsg.put(Dict.productRecordStatus.item_21.getItem(), "该数据已经备案成功,暂未更新,无法修改");
+
+        if (restrictMsg.containsKey(status)) {
+            throw new RRException(restrictMsg.get(status));
+        }
+
+        Set<String> addStatus = new HashSet<>();
+        addStatus.add(Dict.productRecordStatus.item_00.getItem());
+        addStatus.add(Dict.productRecordStatus.item_01.getItem());
+        addStatus.add(Dict.productRecordStatus.item_03.getItem());
+        if (addStatus.contains(status)) {
+            goodsProduct.setStatus(Dict.productRecordStatus.item_00.getItem());
+        } else {
+            goodsProduct.setStatus(Dict.productRecordStatus.item_10.getItem());
+        }
+
+
         return goodsProductDao.update(goodsProduct);
     }
 
@@ -74,15 +117,15 @@ public class GoodsProductServiceImpl implements GoodsProductService {
     }
 
     @Override
-    public int deleteBatch(Integer[]mallGoodsProductSns) {
+    public int deleteBatch(Integer[] mallGoodsProductSns) {
         return goodsProductDao.deleteBatch(mallGoodsProductSns);
     }
 
     @Override
     @Transactional
     public void uploadExcel(List<GoodsProductDto> goodsProductDtoList) {
-        if (Objects.nonNull(goodsProductDtoList) && goodsProductDtoList.size()>0){
-            int count =1;
+        if (Objects.nonNull(goodsProductDtoList) && goodsProductDtoList.size() > 0) {
+            int count = 1;
             for (GoodsProductDto goodsProductDto : goodsProductDtoList) {
                 if (StringUtils.isEmpty(goodsProductDto.getMerchSn())) {
                     throw new RRException("第" + count + "行的商户编号为空!");
@@ -109,10 +152,10 @@ public class GoodsProductServiceImpl implements GoodsProductService {
                     throw new RRException("第" + count + "行的品牌中文或品牌英文必填其中之一!");
                 }
                 if (!StringUtils.isEmpty(goodsProductDto.getProdBrandCn()) && !StringUtils.isEmpty(goodsProductDto.getProdBrandEn())) {
-                    goodsProductDto.setProdBrand(goodsProductDto.getProdBrandCn()+"#&#"+goodsProductDto.getProdBrandEn());
-                }else if (!StringUtils.isEmpty(goodsProductDto.getProdBrandCn()) && StringUtils.isEmpty(goodsProductDto.getProdBrandEn())){
+                    goodsProductDto.setProdBrand(goodsProductDto.getProdBrandCn() + "#&#" + goodsProductDto.getProdBrandEn());
+                } else if (!StringUtils.isEmpty(goodsProductDto.getProdBrandCn()) && StringUtils.isEmpty(goodsProductDto.getProdBrandEn())) {
                     goodsProductDto.setProdBrand(goodsProductDto.getProdBrandCn());
-                }else{
+                } else {
                     goodsProductDto.setProdBrand(goodsProductDto.getProdBrandEn());
                 }
                 if (StringUtils.isEmpty(goodsProductDto.getUnitCode())) {
@@ -148,12 +191,12 @@ public class GoodsProductServiceImpl implements GoodsProductService {
                 if (StringUtils.isEmpty(goodsProductDto.getLegalUnit2Qty())) {
                     throw new RRException("第" + count + "行的第二法定单位数量为空!");
                 }
-                GoodsProductEntity queryProduct = goodsProductDao.selectByParams(goodsProductDto.getSku(), goodsProductDto.getMerchSn(),goodsProductDto.getThirdMerchSn());
-                if (Objects.nonNull(queryProduct)){
-                    throw new RRException("该sku:"+queryProduct.getSku()+"已存在!");
+                GoodsProductEntity queryProduct = goodsProductDao.selectByParams(goodsProductDto.getSku(), goodsProductDto.getMerchSn(), goodsProductDto.getThirdMerchSn());
+                if (Objects.nonNull(queryProduct)) {
+                    throw new RRException("该sku:" + queryProduct.getSku() + "已存在!");
                 }
                 GoodsProductEntity goodsProductEntity = new GoodsProductEntity();
-                BeanUtils.copyProperties(goodsProductDto,goodsProductEntity);
+                BeanUtils.copyProperties(goodsProductDto, goodsProductEntity);
                 goodsProductEntity.setLegalUnit1Qty(new BigDecimal(goodsProductDto.getLegalUnit1Qty()));
                 goodsProductEntity.setLegalUnit2Qty(new BigDecimal(goodsProductDto.getLegalUnit2Qty()));
                 goodsProductEntity.setNetWeight(new BigDecimal(goodsProductDto.getNetWeight()));
@@ -165,20 +208,58 @@ public class GoodsProductServiceImpl implements GoodsProductService {
                 goodsProductEntity.setDeclPrice(new BigDecimal(goodsProductDto.getDeclPrice()));
                 goodsProductEntity.setCreateTime(new Date());
                 goodsProductEntity.setCreaterSn(ShiroUtils.getUserId().toString());
+                goodsProductEntity.setStatus(Dict.productRecordStatus.item_00.getItem());
                 goodsProductDao.save(goodsProductEntity);
-                count ++;
+                count++;
             }
         }
     }
 
     @Override
     @Transactional
-    public String sendSelectProduct(Integer[] mallGoodsProductSns,String operateFlag) {
+    public String sendSelectProduct(Integer[] mallGoodsProductSns, String operateFlag) {
+        if (!Dict.operateFlag.item_1.getItem().equals(operateFlag) && !Dict.operateFlag.item_2.getItem().equals(operateFlag)) {
+            return "操作标识无法识别,请联系管理员";
+        }
         List<GoodsProductEntity> goodsProductEntityList = goodsProductDao.selectByMallGoodsProductSns(mallGoodsProductSns);
+
+        Map<String, String> addRestrictMsg = new HashMap<>();
+        addRestrictMsg.put(Dict.productRecordStatus.item_02.getItem(), "sku:%s,该sku备案正在审核中,请勿再次发送!");
+        addRestrictMsg.put(Dict.productRecordStatus.item_03.getItem(), "sku:%s,该sku备案审核失败,请修改后再次发送!");
+        addRestrictMsg.put(Dict.productRecordStatus.item_10.getItem(), "sku:%s,该sku备案为重新备案,请选择修改发送!");
+        addRestrictMsg.put(Dict.productRecordStatus.item_11.getItem(), "sku:%s,该sku备案为重新备案,请选择修改发送!");
+        addRestrictMsg.put(Dict.productRecordStatus.item_12.getItem(), "sku:%s,该sku备案为重新备案,且正在审核中!");
+        addRestrictMsg.put(Dict.productRecordStatus.item_13.getItem(), "sku:%s,该sku备案为重新备案,请修改后选择修改发送!");
+        addRestrictMsg.put(Dict.productRecordStatus.item_21.getItem(), "sku:%s,该sku备案已经备案成功,请重新抓取!");
+        addRestrictMsg.put(Dict.productRecordStatus.item_22.getItem(), "sku:%s,该sku备案已经备案成功,无法新增,如需修改,请编辑后选择修改发送!");
+
+        Map<String, String> updateRestrictMsg = new HashMap<>();
+        updateRestrictMsg.put(Dict.productRecordStatus.item_00.getItem(), "sku:%s,该sku为新增备案,请选择新增发送!");
+        updateRestrictMsg.put(Dict.productRecordStatus.item_01.getItem(), "sku:%s,该sku为新增备案,请选择新增发送!");
+        updateRestrictMsg.put(Dict.productRecordStatus.item_02.getItem(), "sku:%s,该sku为新增备案,且正在审核中!");
+        updateRestrictMsg.put(Dict.productRecordStatus.item_03.getItem(), "sku:%s,该sku为新增备案,请修改后选择新增发送!");
+        updateRestrictMsg.put(Dict.productRecordStatus.item_12.getItem(), "sku:%s,该sku备案正在审核中,请勿再次发送!");
+        updateRestrictMsg.put(Dict.productRecordStatus.item_13.getItem(), "sku:%s,该sku备案审核失败,请修改后再次发送!");
+        updateRestrictMsg.put(Dict.productRecordStatus.item_21.getItem(), "sku:%s,该sku备案已经备案成功,请重新抓取!");
+        updateRestrictMsg.put(Dict.productRecordStatus.item_22.getItem(), "sku:%s,该sku备案已经备案成功,如需修改,请编辑后选择修改发送!");
+        for (GoodsProductEntity entity : goodsProductEntityList) {
+            String status = entity.getStatus();
+            if (Dict.operateFlag.item_1.getItem().equals(operateFlag)) {
+                if (addRestrictMsg.containsKey(status)) {
+                    String msg = addRestrictMsg.get(status);
+                    return String.format(msg, entity.getSku());
+                }
+            } else if (Dict.operateFlag.item_2.getItem().equals(operateFlag)) {
+                if (updateRestrictMsg.containsKey(status)) {
+                    String msg = updateRestrictMsg.get(status);
+                    return String.format(msg, entity.getSku());
+                }
+            }
+        }
         List<GoodsProductDto> goodsProductDtoList = new ArrayList<>();
         for (GoodsProductEntity goodsProductEntity : goodsProductEntityList) {
             GoodsProductDto dto = new GoodsProductDto();
-            BeanUtils.copyProperties(goodsProductEntity,dto);
+            BeanUtils.copyProperties(goodsProductEntity, dto);
             dto.setLegalUnit1Qty(goodsProductEntity.getLegalUnit1Qty().toString());
             dto.setLegalUnit2Qty(goodsProductEntity.getLegalUnit2Qty().toString());
             dto.setNetWeight(goodsProductEntity.getNetWeight().toString());
@@ -194,14 +275,14 @@ public class GoodsProductServiceImpl implements GoodsProductService {
             if (!"0".equals(result.getCode())) {
                 isPass = false;
             }
-            rollbackHandler(goodsProductDtoList, isPass);
+            callbackHandler(goodsProductDtoList, isPass);
             return result.getMsg();
-        }catch (Exception e){
+        } catch (Exception e) {
             isPass = false;
             e.printStackTrace();
             LOGGER.error(e.getMessage());
         }
-        rollbackHandler(goodsProductDtoList, isPass);
+        callbackHandler(goodsProductDtoList, isPass);
         return "请求失败,请联系管理员";
     }
 
@@ -210,15 +291,22 @@ public class GoodsProductServiceImpl implements GoodsProductService {
     public String sendAllProduct(String operateFlag) {
         // 查询所有发送失败或者未发送的
         Map<String, Object> condition = new HashMap<>();
-        condition.put("isSend", "0,2");
+        if (Dict.operateFlag.item_1.getItem().equals(operateFlag)) {
+            condition.put("status", Dict.productRecordStatus.item_00.getItem() + "," + Dict.productRecordStatus.item_01.getItem());
+        } else if (Dict.operateFlag.item_2.getItem().equals(operateFlag)) {
+            condition.put("status", Dict.productRecordStatus.item_10.getItem() + "," + Dict.productRecordStatus.item_11.getItem());
+        } else {
+            return "操作标识无法识别,请联系管理员";
+        }
+
         List<GoodsProductEntity> goodsProductEntityList = goodsProductDao.queryList(condition);
-        if (goodsProductEntityList == null || goodsProductEntityList.size()==0){
-            return "无数据,请添加数据";
+        if (goodsProductEntityList == null || goodsProductEntityList.size() == 0) {
+            return "没有要发送的数据";
         }
         List<GoodsProductDto> goodsProductDtoList = new ArrayList<>();
         for (GoodsProductEntity goodsProductEntity : goodsProductEntityList) {
             GoodsProductDto dto = new GoodsProductDto();
-            BeanUtils.copyProperties(goodsProductEntity,dto);
+            BeanUtils.copyProperties(goodsProductEntity, dto);
             dto.setLegalUnit1Qty(goodsProductEntity.getLegalUnit1Qty().toString());
             dto.setLegalUnit2Qty(goodsProductEntity.getLegalUnit2Qty().toString());
             dto.setNetWeight(goodsProductEntity.getNetWeight().toString());
@@ -234,14 +322,14 @@ public class GoodsProductServiceImpl implements GoodsProductService {
             if (!"0".equals(result.getCode())) {
                 isPass = false;
             }
-            rollbackHandler(goodsProductDtoList, isPass);
+            callbackHandler(goodsProductDtoList, isPass);
             return result.getMsg();
-        }catch (Exception e){
+        } catch (Exception e) {
             isPass = false;
             e.printStackTrace();
             LOGGER.error(e.getMessage());
         }
-        rollbackHandler(goodsProductDtoList, isPass);
+        callbackHandler(goodsProductDtoList, isPass);
         return "请求失败,请联系管理员";
     }
 
@@ -261,6 +349,7 @@ public class GoodsProductServiceImpl implements GoodsProductService {
         param.put("isSend", Dict.goodsProductIsSend.item_1.getItem());
         param.put("sendTime", new Date());
         param.put("omsAuditStatus", Dict.omsAuditStatus.item_0.getItem());
+        param.put("updateStatusMode", 1);
         return goodsProductDao.updateStatusBySkuBatch(skuList, param);
     }
 
@@ -270,6 +359,7 @@ public class GoodsProductServiceImpl implements GoodsProductService {
         param.put("isSend", Dict.goodsProductIsSend.item_2.getItem());
         param.put("sendTime", new Date());
         param.put("omsAuditStatus", Dict.omsAuditStatus.item_0.getItem());
+        param.put("updateStatusMode", 1);
         return goodsProductDao.updateStatusBySkuBatch(skuList, param);
     }
 
@@ -280,26 +370,38 @@ public class GoodsProductServiceImpl implements GoodsProductService {
         param.put("omsAuditRemark", auditRemark);
         param.put("omsCallbackTime", new Date());
         param.put("omsAuditTime", auditTime);
+        param.put("updateStatusMode", 2);
         return goodsProductDao.updateStatusBySkuBatch(Arrays.asList(sku), param);
     }
 
+    @Override
+    public String pullFromOms() {
+        try {
 
-    private ResponseMessage requestOmsProduct(List<GoodsProductDto> goodsProductDtoList){
+        }catch (Exception e){
+            e.printStackTrace();
+            return "同步产品备案信息失败,请联系管理员";
+        }
+        return "同步成功";
+    }
+
+
+    private ResponseMessage requestOmsProduct(List<GoodsProductDto> goodsProductDtoList) {
         Map<String, String> sParaTemp = new TreeMap<String, String>();
         PdProductDtoInfo pdProductDtoInfo = new PdProductDtoInfo();
         pdProductDtoInfo.setPdProductDtoList(goodsProductDtoList);
         sParaTemp.put("data", JSON.toJSONString(pdProductDtoInfo));
         LOGGER.info("请求omsdata数据:" + sParaTemp.get("data"));
-        sParaTemp.put("merchId",omsMerchProperties.getMerchSn());
-        String timestamp = String.valueOf(System.currentTimeMillis()/1000);
+        sParaTemp.put("merchId", omsMerchProperties.getMerchSn());
+        String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
         sParaTemp.put("timestamp", timestamp);
         //生成要请求给oms秘钥
 //        String sign = OmsSign.sign(sParaTemp,cus.getWaybill().get("secret-key"));
         LOGGER.info("md5混淆码参数:" + omsMerchProperties.getMd5Salt());
-        String sign = OmsSign.sign(sParaTemp,omsMerchProperties.getMd5Salt());
+        String sign = OmsSign.sign(sParaTemp, omsMerchProperties.getMd5Salt());
         sParaTemp.put("sign", sign);
         //构建Request
-        String  url = omsMerchProperties.getAddPdProductListUrl();
+        String url = omsMerchProperties.getAddPdProductListUrl();
         Request request = com.kmall.admin.utils.oms.OkHttpUtils.buildRequest(url, JSON.toJSONString(sParaTemp));
         LOGGER.info("oms的请求报文:" + request);
         // 同步访问,返回结果字符串
@@ -312,19 +414,19 @@ public class GoodsProductServiceImpl implements GoodsProductService {
             e.printStackTrace();
         }
 
-        LOGGER.info("oms的响应报文"+responseString);
+        LOGGER.info("oms的响应报文" + responseString);
         //解析响应数据
         Gson gson = new Gson();
         ResponseMessage result = gson.fromJson(responseString, ResponseMessage.class);
-        if(result == null){
+        if (result == null) {
             String info = "解析响应数据Result失败";
             LOGGER.error("--- {}", info);
             throw new RuntimeException(info);
         }
-       return result;
+        return result;
     }
 
-    private void rollbackHandler(List<GoodsProductDto> goodsProductDtoList, boolean pass){
+    private void callbackHandler(List<GoodsProductDto> goodsProductDtoList, boolean pass) {
         List<String> skuList = goodsProductDtoList.stream().map(GoodsProductDto::getSku).collect(Collectors.toList());
         if (pass) {
             this.updateSendOmsPassStatus(skuList);
@@ -334,5 +436,4 @@ public class GoodsProductServiceImpl implements GoodsProductService {
     }
 
 
-
 }

+ 17 - 1
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java

@@ -1,5 +1,6 @@
 package com.kmall.admin.service.impl;
 
+import cn.hutool.core.io.IoUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.ImmutableBiMap;
@@ -35,6 +36,7 @@ import com.kmall.admin.utils.ShiroUtils;
 import com.kmall.admin.utils.data.response.ResponseMessage;
 import com.kmall.admin.utils.data.response.ResponseMessageData;
 import com.kmall.admin.utils.oms.OmsSign;
+import com.kmall.admin.utils.pdf.BarcodeUtil;
 import com.kmall.admin.websocket.WebSocketServer;
 import com.kmall.api.entity.OrderGoodsVo;
 import com.kmall.api.entity.OrderVo;
@@ -67,11 +69,15 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.net.InetAddress;
 import java.net.URLDecoder;
+import java.nio.charset.Charset;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -475,7 +481,17 @@ public class OrderServiceImpl implements OrderService {
 //                e.printStackTrace();
 //            }
         }
-        return TicketPrintUtil.print(head, goodsList, cashInfo, cusListing);
+        TicketMailInfo mailInfo = new TicketMailInfo();
+        mailInfo.setExprNo(orderEntity.getShippingNo());
+        mailInfo.setExprLogoUrl("/statics/img/bestex_logo2.jpeg");
+        byte[] barCode128 = BarcodeUtil.generateBarCode128(orderEntity.getShippingNo(), null, null, true, false);
+        String exprNoBase64Img = new String(Base64.getEncoder().encode(barCode128));
+//            FileOutputStream fos = new FileOutputStream(new File("C:\\Users\\Administrator\\Desktop\\aaaaaaa.png"));
+            BarcodeUtil.byte2image(barCode128, "C:\\Users\\Administrator\\Desktop\\aaaaaaa.png");
+            mailInfo.setShopTel("0752 - 2688660");
+
+        mailInfo.setExprNoBase64Img(exprNoBase64Img);
+        return TicketPrintUtil.print(head, goodsList, cashInfo, cusListing, mailInfo);
     }
 
 

+ 63 - 13
kmall-admin/src/main/resources/mybatis/mapper/GoodsProductDao.xml

@@ -59,6 +59,7 @@
 		<result property="omsCallbackTime" column="oms_callback_time"/>
 		<result property="batchNo" column="batch_no"/>
 		<result property="omsAuditTime" column="oms_audit_time"/>
+		<result property="status" column="status"/>
     </resultMap>
 
 	<select id="queryObject" resultType="com.kmall.admin.entity.GoodsProductEntity">
@@ -117,7 +118,8 @@
 			`oms_audit_remark`,
 			`oms_callback_time`,
 			`batch_no`,
-            `oms_audit_time`
+            `oms_audit_time`,
+            `status`
      from mall_goods_product
      where mall_goods_product_sn = #{id}
 	</select>
@@ -178,7 +180,8 @@
 			`oms_audit_remark`,
 			`oms_callback_time`,
 			`batch_no`,
-			`oms_audit_time`
+			`oms_audit_time`,
+			`status`
 		from mall_goods_product
 		WHERE 1=1
 		<if test="name != null and name.trim() != ''">
@@ -187,6 +190,9 @@
 		<if test="isSend != null and isSend.trim() != ''">
 			AND `is_send` in (${isSend})
 		</if>
+		<if test="status != null and status.trim() != ''">
+			AND `status` in (${status})
+		</if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
                 order by ${sidx} ${order}
@@ -199,7 +205,7 @@
 			limit #{offset}, #{limit}
 		</if>
 	</select>
-	
+
  	<select id="queryTotal" resultType="int">
 		select count(*) from mall_goods_product
 		WHERE 1=1
@@ -263,7 +269,8 @@
 		`oms_audit_remark`,
 		`oms_callback_time`,
 		`batch_no`,
-		`oms_audit_time`
+		`oms_audit_time`,
+		`status`
 		from mall_goods_product
 		WHERE 1=1
 		<if test="sku != null and sku.trim() != ''">
@@ -332,7 +339,8 @@
 		`oms_audit_remark`,
 		`oms_callback_time`,
 		`batch_no`,
-		`oms_audit_time`
+		`oms_audit_time`,
+		`status`
 		from mall_goods_product
 		WHERE 1=1
 		<if test="mallGoodsProductSns != null">
@@ -399,7 +407,8 @@
 			`oms_audit_remark`,
 			`oms_callback_time`,
 			`batch_no`,
-			`oms_audit_time`
+			`oms_audit_time`,
+			`status`
 		from mall_goods_product
 		where sku = #{sku}
 	</select>
@@ -459,7 +468,8 @@
 			`oms_audit_remark`,
 			`oms_callback_time`,
 			`batch_no`,
-			`oms_audit_time`
+			`oms_audit_time`,
+			`status`
 		from mall_goods_product
 		where prod_barcode = #{barCode}
 	</select>
@@ -515,7 +525,8 @@
 			`right_img`,
 			`before_img`,
 			`after_img`,
-			`batch_no`)
+			`batch_no`,
+		    `status`)
 		values(
 			#{mallGoodsProductSn},
 			#{merchSn},
@@ -566,11 +577,12 @@
 			#{rightImg},
 			#{beforeImg},
 			#{afterImg},
-		    #{batchNo})
+		    #{batchNo},
+			#{status})
 	</insert>
 
 	<update id="update" parameterType="com.kmall.admin.entity.GoodsProductEntity">
-		update mall_goods_product 
+		update mall_goods_product
 		<set>
 			<if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
 			<if test="thirdMerchSn != null">`third_merch_sn` = #{thirdMerchSn}, </if>
@@ -625,6 +637,7 @@
 			<if test="omsAuditRemark != null">`oms_audit_remark` = #{omsAuditRemark}, </if>
 			<if test="omsAuditTime != null">`oms_audit_time` = #{omsAuditTime}, </if>
 			<if test="omsCallbackTime != null">`oms_callback_time` = #{omsCallbackTime}, </if>
+			<if test="status != null">`status` = #{status}, </if>
 		</set>
 		where mall_goods_product_sn = #{mallGoodsProductSn}
 	</update>
@@ -649,6 +662,43 @@
 			<if test="map.omsAuditRemark != null">`oms_audit_remark` = #{map.omsAuditRemark}, </if>
 			<if test="map.omsAuditTime != null">`oms_audit_time` = #{map.omsAuditTime}, </if>
 			<if test="map.omsCallbackTime != null">`oms_callback_time` = #{map.omsCallbackTime}, </if>
+			<if test="map.status != null">`status` = #{map.status}, </if>
+			<if test="map.updateStatusMode != null and map.updateStatusMode == 1 ">
+				`status` =
+				<if test="map.isSend == 1">
+					case status
+		            when '00' then '02'
+		            when '01' then '02'
+		            when '10' then '12'
+		            when '11' then '12'
+		            else '99' end
+				</if>
+				<if test="map.isSend == 2">
+					case status
+                    when '00' then '01'
+                    when '01' then '01'
+                    when '10' then '11'
+                    when '11' then '11'
+                    else '99' end
+				</if>
+				,
+			</if>
+            <if test="map.updateStatusMode != null and map.updateStatusMode == 2 ">
+                `status` =
+                <if test="map.omsAuditStatus == 2">
+                    case status
+                    when '02' then '21'
+                    when '12' then '21'
+                    else '88' end
+                </if>
+                <if test="map.omsAuditStatus == 3">
+                    case status
+                    when '02' then '03'
+                    when '12' then '23'
+                    else '88' end
+                </if>
+                ,
+            </if>
 		</set>
 		where sku in
 		<foreach collection="list" item="sku" open="(" separator="," close=")">
@@ -656,13 +706,13 @@
 		</foreach>
 
 	</update>
-	
+
 	<delete id="delete">
 		delete from mall_goods_product where mall_goods_product_sn = #{value}
 	</delete>
-	
+
 	<delete id="deleteBatch">
-		delete from mall_goods_product where mall_goods_product_sn in 
+		delete from mall_goods_product where mall_goods_product_sn in
 		<foreach item="mallGoodsProductSn" collection="array" open="(" separator="," close=")">
 			#{mallGoodsProductSn}
 		</foreach>

+ 10 - 0
kmall-admin/src/main/webapp/WEB-INF/page/shop/goodsproduct.html

@@ -21,9 +21,18 @@
                 <i-col span="4">
                     <i-input v-model="q.name" @on-enter="query" placeholder="中文名称"/>
                 </i-col>
+                <i-col span="3">
+                    <i-select v-model="q.status" placeholder="状态" filterable label-in-value>
+                        <i-option v-for="status in statusList" :value="status.id"
+                                  :key="status.id">{{status.name}}
+                        </i-option>
+                    </i-select>
+                </i-col>
                 <i-button @click="query">查询</i-button>
                 <i-button @click="reloadSearch">重置</i-button>
             </div>
+        </Row>
+            <Row :gutter="16">
             <div class="buttons-group">
                 <i-button type="info" @click="sendSelectProductByAdd"><i class="fa fa-plus"></i>&nbsp;选中发送(新增)</i-button>
                 <i-button type="info" @click="sendAllProductByAdd"><i class="fa fa-plus"></i>&nbsp;全部发送(新增)</i-button>
@@ -39,6 +48,7 @@
                 #if($shiro.hasPermission("goodsproduct:delete"))
                 <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                 #end
+                <i-button type="info" @click="pull"><i class="fa fa-plus"></i>&nbsp;拉取</i-button>
 
                 <i-col style="display: inline-grid;">
                     <Upload :show-upload-list="false" :on-success="uploadExcelSuccess" :on-error="uploadExcelError" :on-format-error="uploadExcelFormatError"

+ 57 - 1
kmall-admin/src/main/webapp/js/sale/sale.js

@@ -1280,7 +1280,7 @@ function openWebSocket() {
         //kmall正式环境
         // webSocket = new WebSocket("ws://8.135.102.238:8080//ws/server/"+storeId);
         //kmall本地环境
-        webSocket = new WebSocket("ws://127.0.0.1:8080//ws/server/"+163);
+        webSocket = new WebSocket("ws://127.0.0.1:9090//ws/server/"+163);
         // webSocket = new WebSocket("wss://cb.k1net.cn/ws/server/"+storeId);
         if (webSocket.readyState === webSocket.CONNECTING) {
             console.log('1.连接正在打开......');
@@ -1517,6 +1517,62 @@ function getPrintContentOrder(ticket) {
     content += "<div style=\"width: 100%;text-align: center;\">";
     content += "关注CW大药房客服号,获取更多优惠信息"
     content += "</div>";
+    content += "<div style=\"width: 100%;overflow:hidden;white-space: nowrap;\">--------------------------------------------------</div>";
+    // 面单打印
+    content += `
+    <div style="width: 200px; height: 78px; overflow: hidden;">
+        <div style="width: 100%;height: 78px; border: 1px solid black;">
+            <img src='${ticket.ticketMailInfo.exprLogoUrl}' style='max-width:220px; position: relative; top: -36px; left: -2px;' />
+        </div>
+    </div>
+
+    <!-- 面单条码 -->
+    <div style="width: 100%;height: 98px; border-width: 0 1px 1px 1px; border-style: solid; border-color: black;">
+        <div style="width: 200px; height: 78px; overflow: hidden;">
+            <img src='data:image/png;base64,${ticket.ticketMailInfo.exprNoBase64Img}' style='max-width:220px; position: relative; top: -36px; left: -2px;' />
+        </div>
+        <div style="width: 200px;text-align: center">
+            ${ticket.ticketMailInfo.exprNo}
+        </div>
+    </div>
+    <div style="width: 100%; border-width: 0 1px 1px 1px; border-style: solid; border-color: black;">
+        <div style="width: 65px; display: inline;">
+            收件人
+        </div>
+        <div style="width: 50px; display: inline;">
+            ${ticket.cusListing.consignee} ${ticket.cusListing.consigneeTel}
+        </div>
+        <div style="width: 100%">
+            ${ticket.cusListing.deliveryAddress}
+        </div>
+    </div>
+    <div style="width: 100%; border-width: 0 1px 1px 1px; border-style: solid; border-color: black;">
+        <div style="width: 65px; display: inline;">
+            发件人
+        </div>
+        <div style="width: 50px; display: inline;">
+            ${ticket.ticketMailInfo.shopTel}
+        </div>
+        <div style="width: 100%">
+            仓库地址 : 广东省深圳市南山区前海保税港区W104
+        </div>
+    </div>
+    <div
+        style="width: 100%; border-width: 0 1px 1px 1px; border-style: solid; border-color: black;">
+        <div style="text-align: left;width: 100%">
+            商品名称 数量
+        </div>
+    </div>`;
+    for (var i = 0;i < ticket.goods.length; i++){
+        content += `
+        <div
+            style="width: 100%; border-width: 0 1px 1px 1px; border-style: solid; border-color: black;">
+            <div style="text-align: left;width: 100%">
+                ${ticket.goods[i].gname} *${ticket.goods[i].num}
+            </div>
+        </div>`;
+
+    }
     return content;
 }
 

+ 61 - 5
kmall-admin/src/main/webapp/js/shop/goodsproduct.js

@@ -62,6 +62,32 @@ $(function () {
             {label: '园区商品序号', name: 'itemRecordNo', index: 'item_record_no', width: 140},
             {label: '账册分类代码', name: 'emsClassCode', index: 'ems_class_code', width: 140},
             {
+                label: '状态', name: 'status', index: 'status', width: 140, formatter: function (value) {
+                    if ( value == "00") {
+                        return "新增备案-待发送";
+                    } else if ( value == "01") {
+                        return "新增备案-发送失败";
+                    } else if ( value == "02") {
+                        return "新增备案-待审核";
+                    } else if ( value == "03") {
+                        return "新增备案-审核失败";
+                    } else if ( value == "10") {
+                        return "重新备案-待发送";
+                    } else if ( value == "11") {
+                        return "重新备案-发送失败";
+                    } else if ( value == "12") {
+                        return "重新备案-待审核";
+                    } else if ( value == "13") {
+                        return "重新备案-审核失败";
+                    } else if ( value == "21") {
+                        return "备案成功-待更新";
+                    } else if ( value == "22") {
+                        return "备案成功-更新完成";
+                    }
+                    return '';
+                }
+            },
+            {
                 label: '是否发送', name: 'isSend', index: 'is_send', width: 140, formatter: function (value) {
                     if (value == '0') {
                         return '未发送';
@@ -243,8 +269,21 @@ let vm = new Vue({
             ]
         },
         q: {
-            name: ''
-        }
+            name: '',
+            status: ''
+        },
+        statusList: [
+            {id: "00", name: "新增备案-待发送"},
+            {id: "01", name: "新增备案-发送失败"},
+            {id: "02", name: "新增备案-待审核"},
+            {id: "03", name: "新增备案-审核失败"},
+            {id: "10", name: "重新备案-待发送"},
+            {id: "11", name: "重新备案-发送失败"},
+            {id: "12", name: "重新备案-待审核"},
+            {id: "13", name: "重新备案-审核失败"},
+            {id: "21", name: "备案成功-待更新"},
+            {id: "22", name: "备案成功-更新完成"}
+        ]
     },
     methods: {
         query: function () {
@@ -265,6 +304,23 @@ let vm = new Vue({
 
             vm.getInfo(mallGoodsProductSn)
         },
+        pull: function (event) {
+            $.ajax({
+                type: "POST",
+                url: '../goodsproduct/pullFromOms',
+                contentType: "application/json",
+                data: "{}",
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('操作成功', function (index) {
+                            vm.reload();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+            });
+        },
         saveOrUpdate: function (event) {
             let url = vm.goodsProduct.mallGoodsProductSn == null ? "../goodsproduct/save" : "../goodsproduct/update";
             $.ajax({
@@ -322,7 +378,7 @@ let vm = new Vue({
             vm.showList = true;
             let page = $("#jqGrid").jqGrid('getGridParam', 'page');
             $("#jqGrid").jqGrid('setGridParam', {
-                postData: {'name': vm.q.name},
+                postData: {'name': vm.q.name, 'status': vm.q.status},
                 page: page
             }).trigger("reloadGrid");
             vm.handleReset('formValidate');
@@ -519,7 +575,7 @@ let vm = new Vue({
         },
         sendAllProductByAdd: function (event) {
 
-            confirm('确定要发送所有的产品备案信息?', function () {
+            confirm('全部发送(新增)将会发送所有待发送以及发送失败的新增备案数据,是否继续?', function () {
                 $.ajax({
                     type: "POST",
                     url: "../goodsproduct/sendAllProductByAdd",
@@ -563,7 +619,7 @@ let vm = new Vue({
         },
         sendAllProductByUpdate: function (event) {
 
-            confirm('确定要发送所有的产品备案信息?', function () {
+            confirm('全部发送(修改)将会发送所有待发送以及发送失败的重新备案数据,是否继续?', function () {
                 $.ajax({
                     type: "POST",
                     url: "../goodsproduct/sendAllProductByUpdate",

BIN
kmall-admin/src/main/webapp/statics/img/bestex_logo.jpeg


BIN
kmall-admin/src/main/webapp/statics/img/bestex_logo2.jpeg


+ 41 - 0
kmall-common/src/main/java/com/kmall/common/constant/Dict.java

@@ -1880,5 +1880,46 @@ public class Dict {
 
     }
 
+    /**
+     * 产品备案信息状态
+     */
+    public enum productRecordStatus {
+        item_00("00", "新增备案-待发送"),
+        item_01("01", "新增备案-发送失败"),
+        item_02("02", "新增备案-待审核"),
+        item_03("03", "新增备案-审核失败"),
+        item_10("10", "重新备案-待发送"),
+        item_11("11", "重新备案-发送失败"),
+        item_12("12", "重新备案-待审核"),
+        item_13("13", "重新备案-审核失败"),
+        item_21("21", "备案成功-待更新"),
+        item_22("22", "备案成功-更新完成");
+
+        private String item;
+        private String itemName;
+
+        productRecordStatus(String item, String itemName) {
+            this.item = item;
+            this.itemName = itemName;
+        }
+
+        public String getItem() {
+            return item;
+        }
+
+        public void setItem(String item) {
+            this.item = item;
+        }
+
+        public String getItemName() {
+            return itemName;
+        }
+
+        public void setItemName(String itemName) {
+            this.itemName = itemName;
+        }
+
+    }
+
 
 }

+ 9 - 0
kmall-common/src/main/java/com/kmall/common/utils/print/ticket/item/Ticket.java

@@ -30,6 +30,8 @@ public class Ticket implements Serializable {
     private CusListing cusListing;
     // 小票页脚
     private TicketFoot ticketFoot;
+    // 面单信息
+    private TicketMailInfo ticketMailInfo;
 
     //---------- 商品要素对齐方式 ----------
     private String goodsAlign = BOTTOM;
@@ -44,6 +46,13 @@ public class Ticket implements Serializable {
     private TicketCommonFont ticketCommonFont;
 
 
+    public TicketMailInfo getTicketMailInfo() {
+        return ticketMailInfo;
+    }
+
+    public void setTicketMailInfo(TicketMailInfo ticketMailInfo) {
+        this.ticketMailInfo = ticketMailInfo;
+    }
 
     public TicketHead getTicketHead() {
         return ticketHead;

+ 58 - 0
kmall-common/src/main/java/com/kmall/common/utils/print/ticket/item/TicketMailInfo.java

@@ -0,0 +1,58 @@
+package com.kmall.common.utils.print.ticket.item;
+
+import java.io.Serializable;
+
+public class TicketMailInfo implements Serializable {
+
+    /**
+     * 快递公司logo地址
+     */
+    private String exprLogoUrl;
+
+    /**
+     * 快递面单
+     */
+    private String exprNo;
+
+    /**
+     * 快递面单base64图片
+     */
+    private String exprNoBase64Img;
+
+    /**
+     * 门店电话
+     */
+    private String shopTel;
+
+    public String getShopTel() {
+        return shopTel;
+    }
+
+    public void setShopTel(String shopTel) {
+        this.shopTel = shopTel;
+    }
+
+    public String getExprLogoUrl() {
+        return exprLogoUrl;
+    }
+
+    public void setExprLogoUrl(String exprLogoUrl) {
+        this.exprLogoUrl = exprLogoUrl;
+    }
+
+    public String getExprNo() {
+        return exprNo;
+    }
+
+    public void setExprNo(String exprNo) {
+        this.exprNo = exprNo;
+    }
+
+    public String getExprNoBase64Img() {
+        return exprNoBase64Img;
+    }
+
+    public void setExprNoBase64Img(String exprNoBase64Img) {
+        this.exprNoBase64Img = exprNoBase64Img;
+    }
+}

+ 42 - 0
kmall-manager/src/main/java/com/kmall/manager/manager/print/ticket/TicketPrintUtil.java

@@ -51,4 +51,46 @@ public class TicketPrintUtil {
         return ticket;
     }
 
+    public static Ticket print(TicketHead head, List<Goods> goods, CashInfo cashInfo, CusListing cusListing, TicketMailInfo mailInfo) {
+        //---------- 小票字体 ----------
+        TicketHeadFont headFont = new TicketHeadFont();
+        headFont.setFamily("宋体");
+        headFont.setWeight(Font.BOLD);
+        headFont.setSize(12);
+
+        TicketGoodsTitleFont goodsTitleFont = new TicketGoodsTitleFont();
+        goodsTitleFont.setFamily("宋体");
+        goodsTitleFont.setWeight(Font.BOLD);
+        goodsTitleFont.setSize(8);
+
+        TicketCommonFont commonFont = new TicketCommonFont();
+        commonFont.setFamily("宋体");
+        commonFont.setWeight(Font.PLAIN);
+        commonFont.setSize(8);
+
+        // 小票脚
+        TicketFoot foot = new TicketFoot();
+        foot.setSummary(PrintTicketPropertiesBuilder.instance().getSummary());
+        foot.setServiceTel(PrintTicketPropertiesBuilder.instance().getServiceTel());
+        foot.setUrl1(PrintTicketPropertiesBuilder.instance().getUrl1());
+
+        //---------- 组装小票 ----------
+        Ticket ticket = new Ticket();
+        ticket.setTicketHead(head);
+        ticket.setGoodsAlign(Ticket.BOTTOM);
+        ticket.setGoods(goods);
+        ticket.setCashInfo(cashInfo);
+        ticket.setCusListing(cusListing);
+        ticket.setTicketFoot(foot);
+        ticket.setTicketMailInfo(mailInfo);
+
+        ticket.setTicketHeadFont(headFont);
+        ticket.setTicketGoodsTitleFont(goodsTitleFont);
+        ticket.setTicketCommonFont(commonFont);
+
+        // 打印
+        // TicketPrinter.print(ticket);
+        return ticket;
+    }
+
 }