瀏覽代碼

Merge branch 'master' of xwh/kmall-pt-general into master

张创标 4 年之前
父節點
當前提交
719fbe62e8

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/GoodsTransportInfoDetailController.java

@@ -9,6 +9,7 @@ import com.kmall.common.constant.JxlsXmlTemplateName;
 import com.kmall.common.utils.PageUtils;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.R;
+import com.kmall.common.utils.RRException;
 import com.kmall.common.utils.excel.ExcelUtil;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;

+ 7 - 1
kmall-admin/src/main/java/com/kmall/admin/controller/OrderController.java

@@ -785,7 +785,7 @@ public class OrderController {
         ExcelExport ee = new ExcelExport("订单信息");
 
         String[] header = new String[]{"订单编号","商户订单编号", "所属门店", "供应商", "供应商第三方商户代码", "订单状态", "SKU", "商品名称", "数量", "销售价", "实际支付金额", "保税模式", "快递公司名称", "快递单编号", "海关清单编号", "收货人姓名", "收件人手机", "收件人省份", "收件人城市", "收件人区县", "收件人地址", "下单时间", "支付流水号","身份证号"
-                ,"原产国","规格型号","品牌","单位","毛重(kg)","净重"};
+                ,"原产国","规格型号","品牌","单位","毛重(kg)","净重","零售价","促销价","成交价"};
 
         List<Map<String, Object>> list = new ArrayList<>();
         if (orderList != null && orderList.size() != 0) {
@@ -827,12 +827,18 @@ public class OrderController {
                 map.put("GrossWeight", orderEntity.getGrossWeight());
                 map.put("NetWeight", orderEntity.getNetWeight());
 
+                // 零售价\促销价\成交价
+                map.put("SellPrice",orderEntity.getRetailPrice());
+                map.put("TopicPrice",orderEntity.getTopicPrice());
+                map.put("FinalPrice",orderEntity.getActualPrice());
+
                 list.add(map);
             }
         }
 
         ee.addSheetByMap("订单信息", list, header);
         ee.export(response);
+
         return R.ok();
     }
 

+ 2 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/GoodsTransportInfoDetailDao.java

@@ -20,4 +20,6 @@ public interface GoodsTransportInfoDetailDao extends BaseDao<GoodsTransportInfoD
     List<GoodsTransportInfoDetailEntity> searchListByStatusAndSku(@Param("query") Query query, @Param("wayStatus") Integer wayStatus, @Param("sku")String sku);
 
     int queryTotalByStatusAndSku(@Param("query") Query query, @Param("wayStatus") Integer wayStatus, @Param("sku")String sku);
+
+    Integer existGoodsBySkuAndsupplierId(@Param("sku") String sku,@Param("supplierId") Integer supplierId);
 }

+ 3 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/OrderDao.java

@@ -10,6 +10,7 @@ import com.kmall.common.utils.Query;
 import org.apache.ibatis.annotations.Param;
 import com.kmall.manager.dao.BaseDao;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -116,4 +117,6 @@ public interface OrderDao extends BaseDao<OrderEntity> {
     List<PurchaseSalesInStockDetail> purchaseSalesInStockDetailList(Query query);
 
     int purchaseSalesInStockDetailTotal(Query query);
+
+    BigDecimal queryTopicPriceByOrderSnAndSku(@Param("orderSn") String orderSn,@Param("sku") String sku);
 }

+ 2 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/OrderGoodsDao.java

@@ -6,6 +6,7 @@ import com.kmall.api.entity.OrderVo;
 import com.kmall.manager.dao.BaseDao;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -29,4 +30,5 @@ public interface OrderGoodsDao extends BaseDao<OrderGoodsEntity> {
     List<OrderGoodsEntity> queryHistoryPrice(Map map);
 
     Integer queryHistoryPriceTotal(Map<String, Object> map);
+
 }

+ 6 - 32
kmall-admin/src/main/java/com/kmall/admin/dto/GoodsTransportInfoDetailExcelDto.java

@@ -15,7 +15,7 @@ public class GoodsTransportInfoDetailExcelDto implements Serializable {
     /**
      * 供应商id
      */
-    private String supplierId;
+    private Integer supplierId;
     /**
      * 原产地
      */
@@ -23,7 +23,7 @@ public class GoodsTransportInfoDetailExcelDto implements Serializable {
     /**
      * 数量
      */
-    private String num;
+    private Integer num;
     /**
      * 创建人编号
      */
@@ -49,11 +49,11 @@ public class GoodsTransportInfoDetailExcelDto implements Serializable {
         this.sku = sku;
     }
 
-    public String getSupplierId() {
+    public Integer getSupplierId() {
         return supplierId;
     }
 
-    public void setSupplierId(String supplierId) {
+    public void setSupplierId(Integer supplierId) {
         this.supplierId = supplierId;
     }
 
@@ -65,11 +65,11 @@ public class GoodsTransportInfoDetailExcelDto implements Serializable {
         this.originCountry = originCountry;
     }
 
-    public String getNum() {
+    public Integer getNum() {
         return num;
     }
 
-    public void setNum(String num) {
+    public void setNum(Integer num) {
         this.num = num;
     }
 
@@ -88,30 +88,4 @@ public class GoodsTransportInfoDetailExcelDto implements Serializable {
     public void setModerSn(String moderSn) {
         this.moderSn = moderSn;
     }
-
-    @Override
-    public String toString() {
-        return "GoodsTransportInfoDetailExcelDto{" +
-                "wayStatus='" + wayStatus + '\'' +
-                ", sku='" + sku + '\'' +
-                ", supplierId='" + supplierId + '\'' +
-                ", originCountry='" + originCountry + '\'' +
-                ", num='" + num + '\'' +
-                ", createrSn='" + createrSn + '\'' +
-                ", moderSn='" + moderSn + '\'' +
-                '}';
-    }
-
-    public GoodsTransportInfoDetailExcelDto() {
-    }
-
-    public GoodsTransportInfoDetailExcelDto(String wayStatus, String sku, String supplierId, String originCountry, String num, String createrSn, String moderSn) {
-        this.wayStatus = wayStatus;
-        this.sku = sku;
-        this.supplierId = supplierId;
-        this.originCountry = originCountry;
-        this.num = num;
-        this.createrSn = createrSn;
-        this.moderSn = moderSn;
-    }
 }

+ 11 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/OrderEntity.java

@@ -194,12 +194,23 @@ public class OrderEntity implements Serializable {
 
     private String campName;
 
+    // 活动价
+    private BigDecimal topicPrice;
+
     //供应商第三方商户
     private String supplierThirdPartyMerchName;
 
     //供应商第三方商户
     private String supplierThirdPartyMerchCode;
 
+    public BigDecimal getTopicPrice() {
+        return topicPrice;
+    }
+
+    public void setTopicPrice(BigDecimal topicPrice) {
+        this.topicPrice = topicPrice;
+    }
+
     public String getSupplierThirdPartyMerchCode() {
         return supplierThirdPartyMerchCode;
     }

+ 41 - 2
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsTransportInfoDetailServiceImpl.java

@@ -7,6 +7,7 @@ import com.kmall.admin.service.GoodsTransportInfoDetailService;
 import com.kmall.admin.utils.ShiroUtils;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.RRException;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -44,11 +45,27 @@ public class GoodsTransportInfoDetailServiceImpl implements GoodsTransportInfoDe
 
     @Override
     public int save(GoodsTransportInfoDetailEntity goodsTransportInfoDetail) {
+        // 判断sku和供应商id是否存在
+        Integer exist = goodsTransportInfoDetailDao.existGoodsBySkuAndsupplierId(goodsTransportInfoDetail.getSku(), goodsTransportInfoDetail.getSupplierId());
+        if (exist==null){
+            throw new RRException("sku和供应商id不匹配");
+        }
+        if (goodsTransportInfoDetail.getNum()<=0){
+            throw new RRException("数量应该大于0");
+        }
         return goodsTransportInfoDetailDao.save(goodsTransportInfoDetail);
     }
 
     @Override
     public int update(GoodsTransportInfoDetailEntity goodsTransportInfoDetail) {
+        // 判断sku和供应商id是否存在
+        Integer exist = goodsTransportInfoDetailDao.existGoodsBySkuAndsupplierId(goodsTransportInfoDetail.getSku(), goodsTransportInfoDetail.getSupplierId());
+        if (exist==null){
+            throw new RRException("sku和供应商id不匹配");
+        }
+        if (goodsTransportInfoDetail.getNum()<=0){
+            throw new RRException("数量应该大于0");
+        }
         return goodsTransportInfoDetailDao.update(goodsTransportInfoDetail);
     }
 
@@ -79,6 +96,10 @@ public class GoodsTransportInfoDetailServiceImpl implements GoodsTransportInfoDe
     @Override
     @Transactional
     public void saveExcelDtoList(List<GoodsTransportInfoDetailExcelDto> goodsTransportInfoDetailExcelDtoList) {
+        if (goodsTransportInfoDetailExcelDtoList==null || goodsTransportInfoDetailExcelDtoList.size()==0){
+            throw new RRException("请填写至少一行数据");
+        }
+
         goodsTransportInfoDetailExcelDtoList.forEach(goodsTransportInfoDetailExcelDto -> {
             GoodsTransportInfoDetailEntity goodsTransportInfoDetailEntity = new GoodsTransportInfoDetailEntity();
             if (goodsTransportInfoDetailExcelDto.getWayStatus()==null ||
@@ -86,11 +107,29 @@ public class GoodsTransportInfoDetailServiceImpl implements GoodsTransportInfoDe
                             && Integer.parseInt(goodsTransportInfoDetailExcelDto.getWayStatus()) != 1)){
                 throw new RRException("是否在途必填,且只能填0或1");
             }
+            if (goodsTransportInfoDetailExcelDto.getSupplierId()==null){
+                throw new RRException("供应商id必填");
+            }
+            if (StringUtils.isEmpty(goodsTransportInfoDetailExcelDto.getSku())){
+                throw new RRException("sku必填");
+            }
+
+            // 判断sku和供应商id是否存在
+            Integer exist = goodsTransportInfoDetailDao.existGoodsBySkuAndsupplierId(goodsTransportInfoDetailExcelDto.getSku(), goodsTransportInfoDetailExcelDto.getSupplierId());
+            if (exist==null){
+                throw new RRException("sku和供应商id不匹配");
+            }
+            if (goodsTransportInfoDetailExcelDto.getNum()==null){
+                throw new RRException("数量必填");
+            }
+            if (goodsTransportInfoDetailExcelDto.getNum()<=0){
+                throw new RRException("数量要大于0");
+            }
             goodsTransportInfoDetailEntity.setWayStatus(Integer.parseInt(goodsTransportInfoDetailExcelDto.getWayStatus()));
             goodsTransportInfoDetailEntity.setSku(goodsTransportInfoDetailExcelDto.getSku());
-            goodsTransportInfoDetailEntity.setSupplierId(Integer.parseInt(goodsTransportInfoDetailExcelDto.getSupplierId()));
+            goodsTransportInfoDetailEntity.setSupplierId(goodsTransportInfoDetailExcelDto.getSupplierId());
             goodsTransportInfoDetailEntity.setOriginCountry(goodsTransportInfoDetailExcelDto.getOriginCountry());
-            goodsTransportInfoDetailEntity.setNum(Integer.parseInt(goodsTransportInfoDetailExcelDto.getNum()));
+            goodsTransportInfoDetailEntity.setNum(goodsTransportInfoDetailExcelDto.getNum());
             goodsTransportInfoDetailEntity.setCreaterSn(ShiroUtils.getUserId().toString());
             goodsTransportInfoDetailEntity.setModerSn(ShiroUtils.getUserId().toString());
             goodsTransportInfoDetailEntity.setTstm(new Date());

+ 3 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java

@@ -1412,6 +1412,9 @@ public class OrderServiceImpl implements OrderService {
         for (OrderEntity order : list) {
             OrderProcessRecordEntity orderProcessRecord = orderProcessRecordDao.queryObjectByOrderSn(order.getOrderSn());
             order.setOrderProcessRecord(orderProcessRecord);
+            // 查询活动价
+            BigDecimal topicPrice = orderDao.queryTopicPriceByOrderSnAndSku(order.getOrderSn(),order.getSku());
+            order.setTopicPrice(topicPrice);
         }
         return list;
     }

+ 4 - 1
kmall-admin/src/main/resources/mybatis/mapper/GoodsTransportInfoDetailDao.xml

@@ -102,8 +102,11 @@
 			AND sku LIKE CONCAT('%',#{sku},'%')
 		</if>
 	</select>
+    <select id="existGoodsBySkuAndsupplierId" resultType="java.lang.Integer">
+		select 1 from mall_goods where sku=#{sku} and supplier_id=#{supplierId} limit 1
+	</select>
 
-	<insert id="save" parameterType="com.kmall.admin.entity.GoodsTransportInfoDetailEntity" useGeneratedKeys="true" keyProperty="transItemId">
+    <insert id="save" parameterType="com.kmall.admin.entity.GoodsTransportInfoDetailEntity" useGeneratedKeys="true" keyProperty="transItemId">
 		insert into mall_goods_transport_info_detail(
 			`way_status`,
 			`sku`,

+ 6 - 11
kmall-admin/src/main/resources/mybatis/mapper/OrderDao.xml

@@ -536,17 +536,6 @@
         <if test="ids != null and ids.trim() != ''">
             AND o.id in (${ids})
         </if>
-        <choose>
-            <when test="sidx != null and sidx.trim() != ''">
-                order by ${sidx} ${order}
-            </when>
-            <otherwise>
-                order by o.id desc
-            </otherwise>
-        </choose>
-        <if test="offset != null and limit != null">
-            limit #{offset}, #{limit}
-        </if>
     </select>
 
     <insert id="save" parameterType="com.kmall.api.entity.OrderVo" useGeneratedKeys="true" keyProperty="id">
@@ -1770,5 +1759,11 @@
         group by substr(msmc.create_time,1,10)
         ) b
     </select>
+    <select id="queryTopicPriceByOrderSnAndSku" resultType="java.math.BigDecimal">
+        SELECT mst.topic_price FROM mall_order mo
+		LEFT JOIN mall_order_goods mog ON mo.id = mog.order_id
+		LEFT JOIN mall_store_topic mst ON mog.store_topic_id=mst.id
+		WHERE mo.order_sn=#{orderSn} AND mog.sku=#{sku};
+    </select>
 
 </mapper>

+ 3 - 0
kmall-admin/src/main/webapp/WEB-INF/page/shop/goodstransportinfodetail.html

@@ -19,6 +19,9 @@
                 <i-button @click="reloadSearch">重置</i-button>
             </div>
             <div class="buttons-group">
+                <a href="../statics/file/goods_transport_info_detail_import_yyyymmdd.v1.0.0.xls">
+                    <i-button type="ghost" icon="ios-cloud-upload-outline">在途商品明细模板下载</i-button>
+                </a>&nbsp;&nbsp;&nbsp;
                 <i-col style="display: inline-grid;">
                     <Upload :show-upload-list="false" :on-success="uploadExcelSuccess" :on-error="uploadExcelError" :on-format-error="uploadExcelFormatError"
                             :format="['xls','xlsx']"

+ 5 - 5
kmall-admin/src/main/webapp/WEB-INF/page/shop/order.html

@@ -81,14 +81,14 @@
                     #if($shiro.hasPermission("order:getLogistics"))
                     <i-button type="warning" @click="getLogistics">查看快递信息</i-button>
                     #end
-                    #if($shiro.hasPermission("order:confirm"))
-                    <i-button type="error" @click="confirm">确认收货</i-button>
+                    #if($shiro.hasPermission("order:updateExpressInfo"))
+                    <i-button type="warning" @click="getExpressInfo">修改快递信息</i-button>
                     #end
                     #if($shiro.hasPermission("shop:comment"))
-                    <i-button type="info" @click="openComment">评价</i-button>
+                    <i-button type="warning" @click="openComment">评价</i-button>
                     #end
-                    #if($shiro.hasPermission("order:updateExpressInfo"))
-                    <i-button type="info" @click="getExpressInfo">修改快递信息</i-button>
+                    #if($shiro.hasPermission("order:confirm"))
+                    <i-button type="error" @click="confirm">确认收货</i-button>
                     #end
                     #if($shiro.hasPermission("order:expressUpload"))
                     <i-col style="display: inline-grid;">

+ 4 - 2
kmall-admin/src/main/webapp/js/shop/goodstransportinfodetail.js

@@ -60,8 +60,10 @@ let vm = new Vue({
         title: null,
 		goodsTransportInfoDetail: {},
         ruleValidate: {
-            sku:{required: true, message: 'sku不能为空', trigger: 'blur'}
-            // wayStatus:{required: true, message: '是否在途不能为空', trigger: 'blur'}
+            sku:{required: true, message: 'sku不能为空', trigger: 'blur'},
+            supplierId:{required: true, message: '供应商id不能为空', trigger: 'blur'},
+            originCountry:{required: true, message: '原产地不能为空', trigger: 'blur'},
+            num:{required: true, message: '数量不能为空', trigger: 'blur'}
         },
 		q: {
             wayStatus: null,

二進制
kmall-admin/src/main/webapp/statics/file/goods_transport_info_detail_import_yyyymmdd.v1.0.0.xls