Forráskód Böngészése

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

张创标 4 éve
szülő
commit
1abad62cb9
22 módosított fájl, 428 hozzáadás és 40 törlés
  1. 15 0
      kmall-admin/src/main/java/com/kmall/admin/controller/shop/ShopErrorPriceRecordController.java
  2. 4 0
      kmall-admin/src/main/java/com/kmall/admin/dao/MkActivitiesPromotionDao.java
  3. 3 0
      kmall-admin/src/main/java/com/kmall/admin/dao/MkDailyActivitiesDao.java
  4. 2 0
      kmall-admin/src/main/java/com/kmall/admin/dao/ProductStoreRelaDao.java
  5. 37 0
      kmall-admin/src/main/java/com/kmall/admin/dto/UpdateGoodPriceDto.java
  6. 36 0
      kmall-admin/src/main/java/com/kmall/admin/entity/shop/ShopErrorPriceRecordEntity.java
  7. 8 0
      kmall-admin/src/main/java/com/kmall/admin/service/MkActivitiesPromotionService.java
  8. 8 0
      kmall-admin/src/main/java/com/kmall/admin/service/MkDailyActivitiesService.java
  9. 7 0
      kmall-admin/src/main/java/com/kmall/admin/service/ProductStoreRelaService.java
  10. 27 3
      kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java
  11. 12 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/MkActivitiesPromotionServiceImpl.java
  12. 12 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/MkDailyActivitiesServiceImpl.java
  13. 11 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductStoreRelaServiceImpl.java
  14. 76 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/shop/ShopErrorPriceRecordServiceImpl.java
  15. 7 0
      kmall-admin/src/main/java/com/kmall/admin/service/shop/ShopErrorPriceRecordService.java
  16. 11 11
      kmall-admin/src/main/java/com/kmall/admin/utils/CalculateTax.java
  17. 6 0
      kmall-admin/src/main/resources/mybatis/mapper/MkActivitiesPromotionDao.xml
  18. 6 1
      kmall-admin/src/main/resources/mybatis/mapper/MkDailyActivitiesDao.xml
  19. 4 0
      kmall-admin/src/main/resources/mybatis/mapper/ProductStoreRelaDao.xml
  20. 39 21
      kmall-admin/src/main/resources/mybatis/mapper/shop/ShopErrorPriceRecordDao.xml
  21. 29 1
      kmall-admin/src/main/webapp/WEB-INF/page/shop/shoperrorpricerecord.html
  22. 68 3
      kmall-admin/src/main/webapp/js/shop/shoperrorpricerecord.js

+ 15 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/shop/ShopErrorPriceRecordController.java

@@ -3,6 +3,7 @@ package com.kmall.admin.controller.shop;
 import java.util.List;
 import java.util.Map;
 
+import com.kmall.admin.dto.UpdateGoodPriceDto;
 import com.kmall.admin.entity.shop.ShopErrorPriceRecordEntity;
 import com.kmall.admin.service.shop.ShopErrorPriceRecordService;
 import com.kmall.common.utils.PageUtils;
@@ -99,4 +100,18 @@ public class ShopErrorPriceRecordController {
 
         return R.ok().put("list", list);
     }
+
+    @RequestMapping("/updateGoodsPrice")
+    @ResponseBody
+    public R updateGoodsPrice(@RequestBody UpdateGoodPriceDto updateGoodPriceDto ){
+
+
+        try {
+            shopErrorPriceRecordService.updateGoodsPrice(updateGoodPriceDto);
+        } catch (Exception e) {
+            return R.error("系统异常,请联系管理员!"+e.getMessage());
+        }
+
+        return R.ok("操作成功");
+    }
 }

+ 4 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/MkActivitiesPromotionDao.java

@@ -27,4 +27,8 @@ public interface MkActivitiesPromotionDao extends BaseDao<MkActivitiesPromotionE
                                                       @Param("currentTime") String currentTime,
                                                       @Param("topic") String topic,
                                                       @Param("prodBarcode") String prodBarcode);
+
+    void updatePriceBySku(@Param("updatePrice") String updatePrice,
+                          @Param("sku") String sku,
+                          @Param("mkaId") Long mkaId);
 }

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

@@ -28,4 +28,7 @@ public interface MkDailyActivitiesDao extends BaseDao<MkDailyActivitiesEntity> {
                                                   @Param("topic") String topic,
                                                   @Param("prodBarcode") String prodBarcode);
 
+    void updatePriceBySku(@Param("updatePrice") String updatePrice,
+                          @Param("sku") String sku,
+                          @Param("mkaId") Long mkaId);
 }

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

@@ -83,4 +83,6 @@ public interface ProductStoreRelaDao extends BaseDao<ProductStoreRelaEntity> {
      * @return
      */
     List<ProductStoreRelaEntity> queryExportList(Map<String, Object> params);
+
+    void updatePriceBySku(@Param("updatePrice") String updatePrice, @Param("sku") String sku);
 }

+ 37 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/UpdateGoodPriceDto.java

@@ -0,0 +1,37 @@
+package com.kmall.admin.dto;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2021-01-21 15:37
+ */
+public class UpdateGoodPriceDto {
+
+    private String mseprId;
+    private String type;
+    private String customPriceInput;
+
+    public String getMseprId() {
+        return mseprId;
+    }
+
+    public void setMseprId(String mseprId) {
+        this.mseprId = mseprId;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getCustomPriceInput() {
+        return customPriceInput;
+    }
+
+    public void setCustomPriceInput(String customPriceInput) {
+        this.customPriceInput = customPriceInput;
+    }
+}

+ 36 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/shop/ShopErrorPriceRecordEntity.java

@@ -80,6 +80,10 @@ public class ShopErrorPriceRecordEntity implements Serializable {
     private Date tstm;
 
     private String shopName;
+    private String lowestPrice;
+    private String highestPrice;
+    private String modify;
+    private Long mkaId;
 
     /**
      * 设置:异常记录id
@@ -297,4 +301,36 @@ public class ShopErrorPriceRecordEntity implements Serializable {
     public void setShopName(String shopName) {
         this.shopName = shopName;
     }
+
+    public String getLowestPrice() {
+        return lowestPrice;
+    }
+
+    public void setLowestPrice(String lowestPrice) {
+        this.lowestPrice = lowestPrice;
+    }
+
+    public String getHighestPrice() {
+        return highestPrice;
+    }
+
+    public void setHighestPrice(String highestPrice) {
+        this.highestPrice = highestPrice;
+    }
+
+    public String getModify() {
+        return modify;
+    }
+
+    public void setModify(String modify) {
+        this.modify = modify;
+    }
+
+    public Long getMkaId() {
+        return mkaId;
+    }
+
+    public void setMkaId(Long mkaId) {
+        this.mkaId = mkaId;
+    }
 }

+ 8 - 0
kmall-admin/src/main/java/com/kmall/admin/service/MkActivitiesPromotionService.java

@@ -96,4 +96,12 @@ public interface MkActivitiesPromotionService {
      * @return
      */
     MkActivitiesPromotionEntity queryByDateAndBarcode(String storeId, String format, String lscx, String prodBarcode);
+
+    /**
+     * 根据sku和活动id批量修改价格
+     * @param updatePrice
+     * @param sku
+     * @param mkaId
+     */
+    void updatePriceBySku(String updatePrice, String sku, Long mkaId);
 }

+ 8 - 0
kmall-admin/src/main/java/com/kmall/admin/service/MkDailyActivitiesService.java

@@ -97,4 +97,12 @@ public interface MkDailyActivitiesService {
      * @return
      */
     MkDailyActivitiesEntity queryByDateAndBarcode(String storeId, String format, String rchd, String prodBarcode);
+
+    /**
+     * 根据sku和活动id批量修改价格
+     * @param updatePrice
+     * @param sku
+     * @param mkaId
+     */
+    void updatePriceBySku(String updatePrice, String sku, Long mkaId);
 }

+ 7 - 0
kmall-admin/src/main/java/com/kmall/admin/service/ProductStoreRelaService.java

@@ -133,4 +133,11 @@ public interface ProductStoreRelaService {
      * @return
      */
     List<ProductStoreRelaEntity> queryExportList(Map<String, Object> params);
+
+    /**
+     * 根据sku批量修改价格
+     * @param updatePrice
+     * @param sku
+     */
+    void updatePriceBySku(String updatePrice, String sku);
 }

+ 27 - 3
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java

@@ -1965,7 +1965,15 @@ public class GoodsServiceImpl implements GoodsService {
             shopErrorPriceRecordEntity.setCreaterSn(user.getUserId()+"");
             shopErrorPriceRecordEntity.setCreateTime(new Date());
             shopErrorPriceRecordEntity.setCurrentPrice(goods.getActualPaymentAmount().toString());
-            shopErrorPriceRecordEntity.setSuggestedPrice(e.getMessage());
+            if(e.getMessage().contains("-")){
+                String suggestPrice = e.getMessage().split("-")[0];
+                String highestPrice = e.getMessage().split("-")[1];
+                String lowestPrice = e.getMessage().split("-")[2];
+                shopErrorPriceRecordEntity.setSuggestedPrice(suggestPrice);
+                shopErrorPriceRecordEntity.setLowestPrice(lowestPrice);
+                shopErrorPriceRecordEntity.setHighestPrice(highestPrice);
+            }
+            shopErrorPriceRecordEntity.setMkaId(promotionEntity.getMkaId());
             shopErrorPriceRecordEntities.add(shopErrorPriceRecordEntity);
         }
 
@@ -2007,7 +2015,15 @@ public class GoodsServiceImpl implements GoodsService {
             shopErrorPriceRecordEntity.setCreaterSn(user.getUserId()+"");
             shopErrorPriceRecordEntity.setCreateTime(new Date());
             shopErrorPriceRecordEntity.setCurrentPrice(goods.getActualPaymentAmount().toString());
-            shopErrorPriceRecordEntity.setSuggestedPrice(e.getMessage());
+            if(e.getMessage().contains("-")){
+                String suggestPrice = e.getMessage().split("-")[0];
+                String highestPrice = e.getMessage().split("-")[1];
+                String lowestPrice = e.getMessage().split("-")[2];
+                shopErrorPriceRecordEntity.setSuggestedPrice(suggestPrice);
+                shopErrorPriceRecordEntity.setLowestPrice(lowestPrice);
+                shopErrorPriceRecordEntity.setHighestPrice(highestPrice);
+            }
+            shopErrorPriceRecordEntity.setMkaId(dailyActivitiesEntity.getMkaId());
             shopErrorPriceRecordEntities.add(shopErrorPriceRecordEntity);
         }
 
@@ -2037,7 +2053,15 @@ public class GoodsServiceImpl implements GoodsService {
             shopErrorPriceRecordEntity.setCreaterSn(user.getUserId()+"");
             shopErrorPriceRecordEntity.setCreateTime(new Date());
             shopErrorPriceRecordEntity.setCurrentPrice(goods.getActualPaymentAmount().toString());
-            shopErrorPriceRecordEntity.setSuggestedPrice(e.getMessage());
+            if(e.getMessage().contains("-")){
+                String suggestPrice = e.getMessage().split("-")[0];
+                String highestPrice = e.getMessage().split("-")[1];
+                String lowestPrice = e.getMessage().split("-")[2];
+                shopErrorPriceRecordEntity.setSuggestedPrice(suggestPrice);
+                shopErrorPriceRecordEntity.setLowestPrice(lowestPrice);
+                shopErrorPriceRecordEntity.setHighestPrice(highestPrice);
+            }
+
             shopErrorPriceRecordEntities.add(shopErrorPriceRecordEntity);
         }
 

+ 12 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/MkActivitiesPromotionServiceImpl.java

@@ -144,4 +144,16 @@ public class MkActivitiesPromotionServiceImpl implements MkActivitiesPromotionSe
     public MkActivitiesPromotionEntity queryByDateAndBarcode(String storeId, String format, String lscx, String prodBarcode) {
         return mkActivitiesPromotionDao.queryByDateAndBarcode(storeId,format,lscx,prodBarcode);
     }
+
+    /**
+     * 根据sku和活动id批量修改价格
+     *
+     * @param updatePrice
+     * @param sku
+     * @param mkaId
+     */
+    @Override
+    public void updatePriceBySku(String updatePrice, String sku, Long mkaId) {
+        mkActivitiesPromotionDao.updatePriceBySku(updatePrice,sku,mkaId);
+    }
 }

+ 12 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/MkDailyActivitiesServiceImpl.java

@@ -145,4 +145,16 @@ public class MkDailyActivitiesServiceImpl implements MkDailyActivitiesService {
     public MkDailyActivitiesEntity queryByDateAndBarcode(String storeId, String format, String topic, String prodBarcode) {
         return mkDailyActivitiesDao.queryByDateAndBarcode(storeId,format,topic,prodBarcode);
     }
+
+    /**
+     * 根据sku和活动id批量修改价格
+     *
+     * @param updatePrice
+     * @param sku
+     * @param mkaId
+     */
+    @Override
+    public void updatePriceBySku(String updatePrice, String sku, Long mkaId) {
+        mkDailyActivitiesDao.updatePriceBySku(updatePrice,sku,mkaId);
+    }
 }

+ 11 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductStoreRelaServiceImpl.java

@@ -830,6 +830,17 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
         return productStoreRelaDao.queryExportList(params);
     }
 
+    /**
+     * 根据sku批量修改价格
+     *
+     * @param updatePrice
+     * @param sku
+     */
+    @Override
+    public void updatePriceBySku(String updatePrice, String sku) {
+        productStoreRelaDao.updatePriceBySku(updatePrice,sku);
+    }
+
 
     @Override
     @Transactional

+ 76 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/shop/ShopErrorPriceRecordServiceImpl.java

@@ -1,10 +1,15 @@
 package com.kmall.admin.service.impl.shop;
 
 import com.kmall.admin.dao.shop.ShopErrorPriceRecordDao;
+import com.kmall.admin.dto.UpdateGoodPriceDto;
 import com.kmall.admin.entity.shop.ShopErrorPriceRecordEntity;
+import com.kmall.admin.service.MkActivitiesPromotionService;
+import com.kmall.admin.service.MkDailyActivitiesService;
+import com.kmall.admin.service.ProductStoreRelaService;
 import com.kmall.admin.service.shop.ShopErrorPriceRecordService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 import java.util.Map;
@@ -22,6 +27,13 @@ public class ShopErrorPriceRecordServiceImpl implements ShopErrorPriceRecordServ
     @Autowired
     private ShopErrorPriceRecordDao shopErrorPriceRecordDao;
 
+    @Autowired
+    private ProductStoreRelaService productStoreRelaService;
+    @Autowired
+    private MkActivitiesPromotionService mkActivitiesPromotionService;
+    @Autowired
+    private MkDailyActivitiesService dailyActivitiesService;
+
     @Override
     public ShopErrorPriceRecordEntity queryObject(Integer mseprId) {
         return shopErrorPriceRecordDao.queryObject(mseprId);
@@ -66,4 +78,68 @@ public class ShopErrorPriceRecordServiceImpl implements ShopErrorPriceRecordServ
     public void saveBatch(List<ShopErrorPriceRecordEntity> shopErrorPriceRecordEntities) {
         shopErrorPriceRecordDao.saveBatch(shopErrorPriceRecordEntities);
     }
+
+    /**
+     * 修改价格
+     *
+     * @param updateGoodPriceDto
+     */
+    @Override
+    @Transactional
+    public void updateGoodsPrice(UpdateGoodPriceDto updateGoodPriceDto) {
+        ShopErrorPriceRecordEntity shopErrorPriceRecordEntity = queryObject(Integer.valueOf(updateGoodPriceDto.getMseprId()));
+
+        // 价格异常类型
+        Integer priceType = shopErrorPriceRecordEntity.getPriceType();
+        // 修改价格类型
+        String type = updateGoodPriceDto.getType();
+
+        // 确认是最高价还是最低价
+        String updatePrice = "";
+        if("highest".equals(type)){
+            updatePrice = shopErrorPriceRecordEntity.getHighestPrice();
+        }else if("lowest".equals(type)){
+            updatePrice = shopErrorPriceRecordEntity.getLowestPrice();
+        }else if("custom".equals(type)){
+            updatePrice = updateGoodPriceDto.getCustomPriceInput();
+        }
+
+        // 根据类型决定是什么操作
+        // 门店商品
+        if(priceType == 1){
+//        productStoreRelaService;
+            handlePrice(updatePrice,productStoreRelaService,shopErrorPriceRecordEntity);
+        // 日常活动
+        }else if(priceType == 2){
+//        dailyActivitiesService;
+            handlePrice(updatePrice,dailyActivitiesService,shopErrorPriceRecordEntity);
+        // 临时促销
+        }else if(priceType == 3){
+//        mkActivitiesPromotionService;
+            handlePrice(updatePrice,mkActivitiesPromotionService,shopErrorPriceRecordEntity);
+
+        }
+    }
+
+    private void handlePrice(String updatePrice,Object service,ShopErrorPriceRecordEntity shopErrorPriceRecordEntity){
+
+        String sku = shopErrorPriceRecordEntity.getSku();
+
+        // 修改门店商品价格
+        if(service instanceof ProductStoreRelaService){
+            ProductStoreRelaService productStoreRelaService = (ProductStoreRelaService) service;
+            productStoreRelaService.updatePriceBySku(updatePrice,sku);
+        // 修改日常活动价格
+        }else if(service instanceof MkActivitiesPromotionService){
+            MkActivitiesPromotionService mkActivitiesPromotionService = (MkActivitiesPromotionService) service;
+            mkActivitiesPromotionService.updatePriceBySku(updatePrice,sku,shopErrorPriceRecordEntity.getMkaId());
+        // 修改临时促销价格
+        }else if(service instanceof MkDailyActivitiesService){
+            MkDailyActivitiesService mkDailyActivitiesService = (MkDailyActivitiesService)service;
+            mkDailyActivitiesService.updatePriceBySku(updatePrice,sku,shopErrorPriceRecordEntity.getMkaId());
+        }
+
+
+
+    }
 }

+ 7 - 0
kmall-admin/src/main/java/com/kmall/admin/service/shop/ShopErrorPriceRecordService.java

@@ -1,6 +1,7 @@
 package com.kmall.admin.service.shop;
 
 
+import com.kmall.admin.dto.UpdateGoodPriceDto;
 import com.kmall.admin.entity.shop.ShopErrorPriceRecordEntity;
 
 import java.util.List;
@@ -76,4 +77,10 @@ public interface ShopErrorPriceRecordService {
      * @param shopErrorPriceRecordEntities
      */
     void saveBatch(List<ShopErrorPriceRecordEntity> shopErrorPriceRecordEntities);
+
+    /**
+     * 修改价格
+     * @param params
+     */
+    void updateGoodsPrice(UpdateGoodPriceDto params);
 }

+ 11 - 11
kmall-admin/src/main/java/com/kmall/admin/utils/CalculateTax.java

@@ -277,10 +277,10 @@ public class CalculateTax {
                             if (gramOrMlUnitPrice.compareTo(cosmThresholdValue) >= 0) {
 
 
-//                                GoodsEntity updateGoods = new GoodsEntity();
-//                                updateGoods.setGoodsRate(consumerGoodsRate);
-//                                updateGoods.setId(goods.getId());
-//                                goodsService.updateByEntity(updateGoods);
+                                GoodsEntity updateGoods = new GoodsEntity();
+                                updateGoods.setGoodsRate(consumerGoodsRate);
+                                updateGoods.setId(goods.getId());
+                                goodsService.updateByEntity(updateGoods);
                                 // 如果用23.06去计算,还是大于阈值,那就是用23.06去计税
                                 return getTax(retailPrice, consumerGoodsRate);
                             }else{
@@ -309,10 +309,10 @@ public class CalculateTax {
 //                                return tax;
 
                             }else{
-//                                GoodsEntity updateGoods = new GoodsEntity();
-//                                updateGoods.setGoodsRate(noConsumerGoodsRate);
-//                                updateGoods.setId(goods.getId());
-//                                goodsService.updateByEntity(updateGoods);
+                                GoodsEntity updateGoods = new GoodsEntity();
+                                updateGoods.setGoodsRate(noConsumerGoodsRate);
+                                updateGoods.setId(goods.getId());
+                                goodsService.updateByEntity(updateGoods);
                                 return getTax(retailPrice, noConsumerGoodsRate);
                             }
 
@@ -376,7 +376,7 @@ public class CalculateTax {
             if (qty2 != null) {
 
                 // 计算最高价格  法二 * 阈值 * (1+税率)
-                maxPrice = qty2.multiply(cosmThresholdValue).multiply(new BigDecimal(1).add(consumerGoodsRate)).setScale(2,RoundingMode.HALF_UP);
+                maxPrice = qty2.multiply(cosmThresholdValue).multiply(new BigDecimal(1).add(consumerGoodsRate)).subtract(new BigDecimal("0.2")).setScale(2,RoundingMode.HALF_UP);
                 minPrice = qty2.multiply(cosmThresholdValue).multiply(new BigDecimal(1).add(noConsumerGoodsRate)).setScale(2,RoundingMode.HALF_UP);
             }
         } else {
@@ -384,11 +384,11 @@ public class CalculateTax {
             if (qty1 != null) {
                 BigDecimal gramOrMl = qty1.multiply(new BigDecimal(1000));
 //                unit1Price = productUnitPrice.divide(gramOrMl, 5, BigDecimal.ROUND_HALF_UP);
-                maxPrice = gramOrMl.multiply(cosmThresholdValue).multiply(new BigDecimal(1).add(consumerGoodsRate)).setScale(2,RoundingMode.HALF_UP);
+                maxPrice = gramOrMl.multiply(cosmThresholdValue).multiply(new BigDecimal(1).add(consumerGoodsRate)).subtract(new BigDecimal("0.2")).setScale(2,RoundingMode.HALF_UP);
                 minPrice = gramOrMl.multiply(cosmThresholdValue).multiply(new BigDecimal(1).add(noConsumerGoodsRate)).setScale(2,RoundingMode.HALF_UP);
             }
         }
-        throw new RuntimeException("商品:"+goods.getSku()+" 价格有误!价格应调整为大于"+maxPrice+"元或小于"+minPrice+"元。");
+        throw new RuntimeException("商品:"+goods.getSku()+" 定价有误,导致无法清关!定价应介于大于"+maxPrice+"元或小于"+minPrice+"元。-"+maxPrice+"-"+minPrice);
     }
 
 

+ 6 - 0
kmall-admin/src/main/resources/mybatis/mapper/MkActivitiesPromotionDao.xml

@@ -204,4 +204,10 @@
 		and activity.mka_store_id = #{storeId}
 	</select>
 
+
+	<update id="updatePriceBySku" >
+		update mk_activities_promotion set activity_price = #{updatePrice} where goods_sn = #{sku}
+		and mka_id = #{mkaId}
+	</update>
+
 </mapper>

+ 6 - 1
kmall-admin/src/main/resources/mybatis/mapper/MkDailyActivitiesDao.xml

@@ -152,7 +152,8 @@
 		where mda_id = #{mdaId}
 	</update>
 
-	<delete id="delete">
+
+    <delete id="delete">
 		delete from mk_daily_activities where mda_id = #{value}
 	</delete>
 
@@ -213,5 +214,9 @@
 		and activity.mka_store_id = #{storeId}
 	</select>
 
+	<update id="updatePriceBySku">
+		update mk_daily_activities set activity_price = #{updatePrice}
+		where goods_sn = #{sku} and mka_id = #{mkaId}
+	</update>
 
 </mapper>

+ 4 - 0
kmall-admin/src/main/resources/mybatis/mapper/ProductStoreRelaDao.xml

@@ -868,4 +868,8 @@
         </if>
     </select>
 
+    <update id="updatePriceBySku" >
+        update mall_product_store_rela set retail_price = #{updatePrice} where sku = #{sku}
+    </update>
+
 </mapper>

+ 39 - 21
kmall-admin/src/main/resources/mybatis/mapper/shop/ShopErrorPriceRecordDao.xml

@@ -20,26 +20,15 @@
         <result property="moderSn" column="moder_sn"/>
         <result property="modTime" column="mod_time"/>
         <result property="tstm" column="tstm"/>
+        <result property="lowestPrice" column="lowest_price"/>
+        <result property="highestPrice" column="highest_price"/>
+        <result property="modify" column="modify"/>
+        <result property="mkaId" column="mka_id"/>
     </resultMap>
 
 	<select id="queryObject" resultType="com.kmall.admin.entity.shop.ShopErrorPriceRecordEntity">
 		select
-			`msepr_id`,
-			`merch_sn`,
-			`third_merch_sn`,
-			`shop_sn`,
-			`barcode`,
-			`sku`,
-			`current_price`,
-			`price_type`,
-			`suggested_price`,
-			`check_time`,
-			`verifier`,
-			`creater_sn`,
-			`create_time`,
-			`moder_sn`,
-			`mod_time`,
-			`tstm`
+			*
 		from mall_shop_error_price_record
 		where msepr_id = #{id}
 	</select>
@@ -62,6 +51,9 @@
     		record.moder_sn,
     		record.mod_time,
     		record.tstm,
+    		record.lowest_price,
+    		record.highest_price,
+    		record.modify,
     		store.store_name as shopName
 		from mall_shop_error_price_record record,
 		mall_store store
@@ -106,7 +98,12 @@
 			`create_time`,
 			`moder_sn`,
 			`mod_time`,
-			`tstm`)
+			`tstm`,
+			 lowest_price,
+    		 highest_price,
+    		 modify,
+    		 mka_id
+			)
 		values(
 			#{merchSn},
 			#{thirdMerchSn},
@@ -122,7 +119,12 @@
 			#{createTime},
 			#{moderSn},
 			#{modTime},
-			#{tstm})
+			#{tstm},
+			#{lowestPrice},
+    		#{highestPrice},
+    		#{modify},
+    		#{mkaId}
+			)
 	</insert>
 
 	<update id="update" parameterType="com.kmall.admin.entity.shop.ShopErrorPriceRecordEntity">
@@ -142,7 +144,11 @@
 			<if test="createTime != null">`create_time` = #{createTime}, </if>
 			<if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
 			<if test="modTime != null">`mod_time` = #{modTime}, </if>
-			<if test="tstm != null">`tstm` = #{tstm}</if>
+			<if test="tstm != null">`tstm` = #{tstm},</if>
+			<if test="lowestPrice != null">`lowest_price` = #{lowestPrice},</if>
+			<if test="highestPrice != null">`highest_price` = #{highestPrice},</if>
+			<if test="modify != null">`modify` = #{modify},</if>
+			<if test="mkaId != null">`mka_id` = #{mkaId}</if>
 		</set>
 		where msepr_id = #{mseprId}
 	</update>
@@ -175,7 +181,13 @@
 		`create_time`,
 		`moder_sn`,
 		`mod_time`,
-		`tstm`)
+		`tstm`,
+		lowest_price,
+		highest_price,
+		modify,
+		mka_id
+
+		)
 		values
 		<foreach collection="list" index="index" item="item" separator=",">
 		(
@@ -193,7 +205,13 @@
 		#{item.createTime},
 		#{item.moderSn},
 		#{item.modTime},
-		#{item.tstm})
+		#{item.tstm},
+		#{item.lowestPrice},
+		#{item.highestPrice},
+		#{item.modify},
+		#{item.mkaId}
+
+		)
 		</foreach>
 
 	</insert>

+ 29 - 1
kmall-admin/src/main/webapp/WEB-INF/page/shop/shoperrorpricerecord.html

@@ -25,12 +25,40 @@
                 #if($shiro.hasPermission("shoperrorpricerecord:delete"))
                 <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                 #end
+                <i-button type="info" @click="appHighPrice"><i class="fa fa-plus"></i>&nbsp;应用最高价</i-button>
+                <i-button type="info" @click="appLowestPrice"><i class="fa fa-plus"></i>&nbsp;应用最低价</i-button>
+                <i-button type="info" @click="customPrice"><i class="fa fa-pencil-square-o"></i>&nbsp;自定义价格</i-button>
             </div>
         </Row>
 	    <table id="jqGrid"></table>
 	    <div id="jqGridPager"></div>
     </div>
 
+
+    <div class="modal fade" id="myModal"  role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+        <div class="modal-dialog">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+                    <h4 class="modal-title" id="exampleModalLabel">自定义价格</h4>
+                </div>
+                <div class="modal-body">
+                    <form>
+                        <div class="form-group">
+                            <label for="customPriceInput" class="control-label">请输入价格:</label>
+                            <input type="text" class="form-control" ref="customPriceInput" id="customPriceInput" />
+                        </div>
+                    </form>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
+                    <button type="button" class="btn btn-primary" @click="submitCustomPrice" data-dismiss="modal">提交</button>
+                </div>
+            </div>
+        </div>
+    </div>
+
+
     <Card v-show="!showList">
         <p slot="title">{{title}}</p>
 		<i-form ref="formValidate" :model="shopErrorPriceRecord" :rules="ruleValidate" :label-width="80">
@@ -90,4 +118,4 @@
 
 <script src="${rc.contextPath}/js/shop/shoperrorpricerecord.js?_${date.systemTime}"></script>
 </body>
-</html>
+</html>

+ 68 - 3
kmall-admin/src/main/webapp/js/shop/shoperrorpricerecord.js

@@ -10,7 +10,7 @@ $(function () {
 			{label: '条码', name: 'barcode', index: 'barcode', width: 60, align: 'center'},
 			{label: 'sku', name: 'sku', index: 'sku', width: 80, align: 'center'},
 			{label: '当前价格', name: 'currentPrice', index: 'current_price', width: 40, align: 'center'},
-			{label: '价格来源', name: 'priceType', index: 'price_type', width: 80, align: 'center',formatter:function(value ){
+			{label: '价格来源', name: 'priceType', index: 'price_type', width: 50, align: 'center',formatter:function(value ){
 				if (value == 1){
 					return "门店商品";
 				}else if (value == 2){
@@ -19,7 +19,9 @@ $(function () {
 					return "临时促销";
 				}
 				}},
-			{label: '建议价格', name: 'suggestedPrice', index: 'suggested_price', width: 220},
+			{label: '建议价格', name: 'suggestedPrice', index: 'suggested_price', width: 220, align: 'center'},
+			{label: '建议最高价格', name: 'highestPrice', index: 'highestPrice', width: 50, align: 'center'},
+			{label: '建议最低价格', name: 'lowestPrice', index: 'lowestPrice', width: 50, align: 'center'},
 			{label: '校验时间', name: 'checkTime', index: 'check_time', width: 70, align: 'center',formatter:function(value){
 
 					var time = new Date(value);
@@ -73,7 +75,9 @@ let vm = new Vue({
 		},
 		q: {
 		    name: ''
-		}
+		},
+		customPriceInput:'',
+		mseprId:''
 	},
 	methods: {
 		query: function () {
@@ -147,6 +151,67 @@ let vm = new Vue({
             }
             vm.reload();
 		},
+		appHighPrice:function(){
+			let mseprId = getSelectedRow();
+			if (mseprId == null) {
+				return;
+			}
+			confirm('确定要应用最高价吗?',function(){
+				vm.updateGoodsPrice("highest",mseprId);
+			});
+		},
+		appLowestPrice:function(){
+			let mseprId = getSelectedRow();
+			if (mseprId == null) {
+				return;
+			}
+			confirm('确定要应用最低价吗?',function(){
+			vm.updateGoodsPrice("lowest",mseprId);
+
+			});
+		},
+		customPrice:function(){
+			let mseprId = getSelectedRow();
+			if (mseprId == null) {
+				return;
+			}
+			vm.mseprId = mseprId;
+			$('#myModal').modal('show');
+		},
+		submitCustomPrice:function(){
+			vm.customPriceInput = this.$refs.customPriceInput.value
+			confirm('确定要应用此价格吗?',function(){
+				vm.updateGoodsPrice("custom",vm.mseprId);
+				$(".form-group input[type=text]").each(function(){
+					this.value = '';
+				})
+
+			});
+
+		},
+		updateGoodsPrice:function(type,mseprId){
+
+			var param = {'mseprId':mseprId,'type':type,'customPriceInput':vm.customPriceInput};
+
+			$.ajax({
+				type: "POST",
+				url: "../shoperrorpricerecord/updateGoodsPrice",
+				contentType: "application/json",
+				data: JSON.stringify(param),
+				success: function (r) {
+					console.log(r);
+					if (r.code === 0) {
+						alert('操作成功', function (index) {
+							vm.reload();
+						});
+						vm.mseprId = '';
+					} else {
+						alert(r.msg);
+					}
+				}
+			});
+		},
+
 		reload: function (event) {
 			vm.showList = true;
             let page = $("#jqGrid").jqGrid('getGridParam', 'page');