1
0
zhangchuangbiao 4 роки тому
батько
коміт
e00d027581
19 змінених файлів з 1346 додано та 79 видалено
  1. 145 0
      kmall-admin/src/main/java/com/kmall/admin/controller/MkActivitiesHalfPriceController.java
  2. 17 0
      kmall-admin/src/main/java/com/kmall/admin/controller/OrderController.java
  3. 27 0
      kmall-admin/src/main/java/com/kmall/admin/dao/MkActivitiesHalfPriceDao.java
  4. 274 0
      kmall-admin/src/main/java/com/kmall/admin/entity/MkActivitiesHalfPriceEntity.java
  5. 89 0
      kmall-admin/src/main/java/com/kmall/admin/service/MkActivitiesHalfPriceService.java
  6. 18 1
      kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java
  7. 143 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/MkActivitiesHalfPriceServiceImpl.java
  8. 1 1
      kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java
  9. 19 0
      kmall-admin/src/main/resources/XmlTemplate/HalfPriceDtoList.xml
  10. 77 72
      kmall-admin/src/main/resources/mybatis/mapper/MkActivitiesFullReductionDao.xml
  11. 195 0
      kmall-admin/src/main/resources/mybatis/mapper/MkActivitiesHalfPriceDao.xml
  12. 2 2
      kmall-admin/src/main/resources/spring/spring-shiro.xml
  13. 63 0
      kmall-admin/src/main/webapp/WEB-INF/page/mk/mkactivitieshalfprice.html
  14. 2 1
      kmall-admin/src/main/webapp/WEB-INF/page/sale/sale.html
  15. 210 0
      kmall-admin/src/main/webapp/js/mk/mkactivitieshalfprice.js
  16. 8 1
      kmall-admin/src/main/webapp/js/mk/mkactivityform.js
  17. 54 1
      kmall-admin/src/main/webapp/js/sale/sale.js
  18. BIN
      kmall-admin/src/main/webapp/statics/file/activities_half_price_yyyy_mm_dd_v1.0.0.xlsx
  19. 2 0
      kmall-common/src/main/java/com/kmall/common/constant/JxlsXmlTemplateName.java

+ 145 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/MkActivitiesHalfPriceController.java

@@ -0,0 +1,145 @@
+package com.kmall.admin.controller;
+
+import com.kmall.admin.dto.FullReductionDto;
+import com.kmall.admin.entity.MkActivitiesHalfPriceEntity;
+import com.kmall.admin.service.MkActivitiesFullReductionService;
+import com.kmall.admin.service.MkActivitiesHalfPriceService;
+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.excel.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 商品编码为主要匹配/上传依据,商品条形码为辅助查看而已活动方式满减,满xxx元立减xx元(xController
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-09-23 10:43:25
+ */
+@Controller
+@RequestMapping("mkactivitieshalfprice")
+public class MkActivitiesHalfPriceController {
+    @Autowired
+    private MkActivitiesHalfPriceService mkActivitiesFullReductionService;
+    @Autowired
+    private ExcelUtil excelUtil;
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+//    @RequiresPermissions("mkactivitiesfullreduction:list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<MkActivitiesHalfPriceEntity> mkActivitiesFullReductionList = mkActivitiesFullReductionService.queryList(query);
+        int total = mkActivitiesFullReductionService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(mkActivitiesFullReductionList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{mafrId}")
+//    @RequiresPermissions("mkactivitiesfullreduction:info")
+    @ResponseBody
+    public R info(@PathVariable("mafrId") Long mafrId) {
+        MkActivitiesHalfPriceEntity mkActivitiesFullReduction = mkActivitiesFullReductionService.queryObject(mafrId);
+
+        return R.ok().put("mkActivitiesFullReduction", mkActivitiesFullReduction);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+//    @RequiresPermissions("mkactivitiesfullreduction:save")
+    @ResponseBody
+    public R save(@RequestBody MkActivitiesHalfPriceEntity mkActivitiesFullReduction) {
+        mkActivitiesFullReductionService.save(mkActivitiesFullReduction);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+//    @RequiresPermissions("mkactivitiesfullreduction:update")
+    @ResponseBody
+    public R update(@RequestBody MkActivitiesHalfPriceEntity mkActivitiesFullReduction) {
+        mkActivitiesFullReductionService.update(mkActivitiesFullReduction);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+//    @RequiresPermissions("mkactivitiesfullreduction:delete")
+    @ResponseBody
+    public R delete(@RequestBody Long[]mafrIds) {
+        mkActivitiesFullReductionService.deleteBatch(mafrIds);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<MkActivitiesHalfPriceEntity> list = mkActivitiesFullReductionService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+
+    /**
+     * 导入excel
+     */
+    @PostMapping("/upload")
+    @ResponseBody
+    public R storeUpload(@RequestParam("file") MultipartFile file, String storeId, String mkaId) {
+        List<FullReductionDto> fullReductionDtoList = new ArrayList<>();//信息
+        try {
+
+            FullReductionDto fullReductionDto= new FullReductionDto();
+            Map<String, Object> beans = new HashMap<String, Object>();
+            beans.put("FullReductionDto", fullReductionDto);
+            beans.put("FullReductionDtoList", fullReductionDtoList);
+            if (file.isEmpty()) {
+                return R.error("文件不能为空!");
+            }
+            excelUtil.readExcel(JxlsXmlTemplateName.HALF_PRICE_DTO_LIST, beans, file.getInputStream());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error("导入失败!");
+        }
+        try {
+            mkActivitiesFullReductionService.uploadExcel(fullReductionDtoList,storeId,mkaId);
+        } catch (RuntimeException e){
+            e.printStackTrace();
+            return R.error(e.getMessage());
+        }
+        //上传文件
+        return R.ok("导入成功!");
+    }
+
+}

+ 17 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/OrderController.java

@@ -17,6 +17,7 @@ import com.kmall.common.utils.wechat.WechatRefundApiResult;
 import com.kmall.common.utils.wechat.WechatReverseApiResult;
 import com.kmall.manager.manager.alipay.AliPayMicropayApiResult;
 import com.kmall.manager.manager.alipay.AliPayUtil;
+import com.kmall.manager.manager.merch.OmsMerchPropertiesBuilder;
 import com.kmall.manager.manager.pingan.PinganUtil;
 import com.kmall.manager.manager.pingan.dto.PinganResponseDto;
 import com.kmall.manager.manager.wechat.WechatGlobalUtil;
@@ -1047,12 +1048,28 @@ public class OrderController {
             orderGoodsEntity.setTax(goodsTax);
             tax = tax.add(goodsTax);
         }
+        String response = null;
+
+        try {
+            // 查询失败原因
+            String url = OmsMerchPropertiesBuilder.instance().getWxOrderResendUrl();
+            url = "";
+            // 同步访问,返回结果字符串
+            response = OkHttpUtils.post(map, url, "SSL");
+            ResponseData responseData = JacksonUtils.fromStringJson(response, ResponseData.class);
+            if(responseData.getCode().equalsIgnoreCase("0")){
+                List<WxOrderEntity> list = responseData.getData().getRows();
+            }
+        } catch (Exception e) {
+            logger.error("查询失败。"+e.getMessage());
+        }
 
         Map<String,Object> result = new HashMap<>();
         result.put("orderProcessRecordEntity",orderProcessRecordEntity);
         result.put("orderEntity",orderEntity);
         result.put("goodsList",goodsList);
         result.put("tax",tax.setScale(2, RoundingMode.HALF_DOWN).toString());
+        result.put("response",response);
 
         return R.ok().put("resultObj", result);
     }

+ 27 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/MkActivitiesHalfPriceDao.java

@@ -0,0 +1,27 @@
+package com.kmall.admin.dao;
+
+
+import com.kmall.admin.entity.MkActivitiesFullReductionEntity;
+import com.kmall.admin.entity.MkActivitiesHalfPriceEntity;
+import com.kmall.manager.dao.BaseDao;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 商品编码为主要匹配/上传依据,商品条形码为辅助查看而已活动方式满减,满xxx元立减xx元(xDao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-09-23 10:43:25
+ */
+public interface MkActivitiesHalfPriceDao extends BaseDao<MkActivitiesHalfPriceEntity> {
+
+    /**
+     * 根据品牌或条形码查询是否有对应的满减活动
+     * @param mkaId
+     * @param prodBarcode
+     * @param brandName
+     * @return
+     */
+    MkActivitiesHalfPriceEntity queryByCodeOrBrand(@Param("mkaId") Long mkaId,
+                                                       @Param("prodBarcode") String prodBarcode);
+}

+ 274 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/MkActivitiesHalfPriceEntity.java

@@ -0,0 +1,274 @@
+package com.kmall.admin.entity;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 商品编码为主要匹配/上传依据,商品条形码为辅助查看而已活动方式满减,满xxx元立减xx元(x实体
+ * 表名 mk_activities_full_reduction
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-09-23 10:43:25
+ */
+public class MkActivitiesHalfPriceEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private Long mafrId;
+    /**
+     * 产品中文名
+     */
+    private String productName;
+    /**
+     * 门店编号
+     */
+    private String shopSn;
+    /**
+     * 商品编码
+     */
+    private String goodsSn;
+    /**
+     * 条形码
+     */
+    private String barcode;
+    /**
+     * 商品品牌
+     */
+    private String productBrand;
+    /**
+     * 商品系列
+     */
+    private String productSeries;
+    /**
+     * 满足条件金额
+     */
+    private BigDecimal qualifiedAmount;
+    /**
+     * 减扣金额
+     */
+    private BigDecimal deductionAmount;
+    /**
+     * 营销活动编号
+     */
+    private Long mkaId;
+    /**
+     * 截止日期
+     */
+    private String deadline;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 创建人编号
+     */
+    private String createrSn;
+    /**
+     * 修改人编号
+     */
+    private String moderSn;
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+
+    /**
+     * 设置:编号
+     */
+    public void setMafrId(Long mafrId) {
+        this.mafrId = mafrId;
+    }
+
+    /**
+     * 获取:编号
+     */
+    public Long getMafrId() {
+        return mafrId;
+    }
+    /**
+     * 设置:产品中文名
+     */
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    /**
+     * 获取:产品中文名
+     */
+    public String getProductName() {
+        return productName;
+    }
+    /**
+     * 设置:门店编号
+     */
+    public void setShopSn(String shopSn) {
+        this.shopSn = shopSn;
+    }
+
+    /**
+     * 获取:门店编号
+     */
+    public String getShopSn() {
+        return shopSn;
+    }
+    /**
+     * 设置:商品编码
+     */
+    public void setGoodsSn(String goodsSn) {
+        this.goodsSn = goodsSn;
+    }
+
+    /**
+     * 获取:商品编码
+     */
+    public String getGoodsSn() {
+        return goodsSn;
+    }
+    /**
+     * 设置:条形码
+     */
+    public void setBarcode(String barcode) {
+        this.barcode = barcode;
+    }
+
+    /**
+     * 获取:条形码
+     */
+    public String getBarcode() {
+        return barcode;
+    }
+    /**
+     * 设置:商品品牌
+     */
+    public void setProductBrand(String productBrand) {
+        this.productBrand = productBrand;
+    }
+
+    /**
+     * 获取:商品品牌
+     */
+    public String getProductBrand() {
+        return productBrand;
+    }
+    /**
+     * 设置:商品系列
+     */
+    public void setProductSeries(String productSeries) {
+        this.productSeries = productSeries;
+    }
+
+    /**
+     * 获取:商品系列
+     */
+    public String getProductSeries() {
+        return productSeries;
+    }
+    /**
+     * 设置:满足条件金额
+     */
+    public void setQualifiedAmount(BigDecimal qualifiedAmount) {
+        this.qualifiedAmount = qualifiedAmount;
+    }
+
+    /**
+     * 获取:满足条件金额
+     */
+    public BigDecimal getQualifiedAmount() {
+        return qualifiedAmount;
+    }
+    /**
+     * 设置:减扣金额
+     */
+    public void setDeductionAmount(BigDecimal deductionAmount) {
+        this.deductionAmount = deductionAmount;
+    }
+
+    /**
+     * 获取:减扣金额
+     */
+    public BigDecimal getDeductionAmount() {
+        return deductionAmount;
+    }
+    /**
+     * 设置:营销活动编号
+     */
+    public void setMkaId(Long mkaId) {
+        this.mkaId = mkaId;
+    }
+
+    /**
+     * 获取:营销活动编号
+     */
+    public Long getMkaId() {
+        return mkaId;
+    }
+    /**
+     * 设置:截止日期
+     */
+    public void setDeadline(String deadline) {
+        this.deadline = deadline;
+    }
+
+    /**
+     * 获取:截止日期
+     */
+    public String getDeadline() {
+        return deadline;
+    }
+    /**
+     * 设置:创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取:创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+    /**
+     * 设置:创建人编号
+     */
+    public void setCreaterSn(String createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    /**
+     * 获取:创建人编号
+     */
+    public String getCreaterSn() {
+        return createrSn;
+    }
+    /**
+     * 设置:修改人编号
+     */
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    /**
+     * 获取:修改人编号
+     */
+    public String getModerSn() {
+        return moderSn;
+    }
+    /**
+     * 设置:修改时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    /**
+     * 获取:修改时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+}

+ 89 - 0
kmall-admin/src/main/java/com/kmall/admin/service/MkActivitiesHalfPriceService.java

@@ -0,0 +1,89 @@
+package com.kmall.admin.service;
+
+import com.kmall.admin.dto.FullReductionDto;
+import com.kmall.admin.entity.MkActivitiesHalfPriceEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 商品编码为主要匹配/上传依据,商品条形码为辅助查看而已活动方式满减,满xxx元立减xx元(xService接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-09-23 10:43:25
+ */
+public interface MkActivitiesHalfPriceService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param id 主键
+     * @return 实体
+     */
+    MkActivitiesHalfPriceEntity queryObject(Long mafrId);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<MkActivitiesHalfPriceEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param mkActivitiesFullReduction 实体
+     * @return 保存条数
+     */
+    int save(MkActivitiesHalfPriceEntity mkActivitiesFullReduction);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param mkActivitiesFullReduction 实体
+     * @return 更新条数
+     */
+    int update(MkActivitiesHalfPriceEntity mkActivitiesFullReduction);
+
+    /**
+     * 根据主键删除
+     *
+     * @param mafrId
+     * @return 删除条数
+     */
+    int delete(Long mafrId);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param mafrIds
+     * @return 删除条数
+     */
+    int deleteBatch(Long[] mafrIds);
+
+    /**
+     * 上传活动商品
+     * @param fullReductionDtoList
+     * @param storeId
+     * @param mkaId
+     */
+    void uploadExcel(List<FullReductionDto> fullReductionDtoList, String storeId, String mkaId);
+
+    /**
+     * 根据品牌或条形码查询是否有对应的满减活动
+     * @param mkaId
+     * @param prodBarcode
+     * @return
+     */
+    MkActivitiesHalfPriceEntity queryByCodeOrBrand(Long mkaId, String prodBarcode);
+}

+ 18 - 1
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java

@@ -101,6 +101,8 @@ public class GoodsServiceImpl implements GoodsService {
     @Autowired
     private MkActivitiesPromotionService promotionService; // 临时促销
     @Autowired
+    private MkActivitiesHalfPriceService halfPriceService; // 第二份半价
+    @Autowired
     private BrandService brandService;
 
 
@@ -1173,7 +1175,7 @@ public class GoodsServiceImpl implements GoodsService {
         // 遍历活动集合,查询有哪些活动是开启的
         boolean daily = false,coupon = false,combinationPrice = false
                 ,discount = false,fullGift = false,fullReduction = false
-                ,getOneFree = false,promotion = false;
+                ,getOneFree = false,promotion = false,halfPrice = false;
 
         List<String> topicList = new ArrayList<>(); // 记录有哪些营销活动的topic
         Map<String,Long> mkaIdMap = new HashMap<>(); // 记录topic跟mkaId的关系
@@ -1199,6 +1201,8 @@ public class GoodsServiceImpl implements GoodsService {
             coupon = true;
         if(topicList.contains("lscx")) // 临时促销
             promotion = true;
+        if(topicList.contains("drjbj"))
+            halfPrice = true;
 
 
         // 获取未优惠前的商品价格
@@ -1310,6 +1314,19 @@ public class GoodsServiceImpl implements GoodsService {
             }
         }
 
+
+        // 第二份半价
+        if(halfPrice){
+            Long mkaId = mkaIdMap.get("drjbj");
+            MkActivitiesHalfPriceEntity activitiesHalfPriceEntity = halfPriceService.queryByCodeOrBrand(mkaId,prodBarcode);
+            if(activitiesHalfPriceEntity != null){
+                skuActivitiesMap.put("drjbj",activitiesHalfPriceEntity);
+
+            }
+
+        }
+
+
         // --------------------------------------------------------------------------------------
 
         /**

+ 143 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/MkActivitiesHalfPriceServiceImpl.java

@@ -0,0 +1,143 @@
+package com.kmall.admin.service.impl;
+
+import com.google.common.collect.ImmutableBiMap;
+import com.kmall.admin.dao.MkActivitiesFullReductionDao;
+import com.kmall.admin.dao.MkActivitiesHalfPriceDao;
+import com.kmall.admin.dto.FullReductionDto;
+import com.kmall.admin.entity.MkActivitiesHalfPriceEntity;
+import com.kmall.admin.service.MkActivitiesFullReductionService;
+import com.kmall.admin.service.MkActivitiesHalfPriceService;
+import com.kmall.common.utils.MapBeanUtil;
+import com.kmall.common.utils.R;
+import com.kmall.common.utils.RRException;
+import com.kmall.common.utils.ValidatorUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 商品编码为主要匹配/上传依据,商品条形码为辅助查看而已活动方式满减,满xxx元立减xx元(xService实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-09-23 10:43:25
+ */
+@Service("mkActivitiesHalfPriceService")
+public class MkActivitiesHalfPriceServiceImpl implements MkActivitiesHalfPriceService {
+    @Autowired
+    private MkActivitiesHalfPriceDao mkActivitiesFullReductionDao;
+
+    @Override
+    public MkActivitiesHalfPriceEntity queryObject(Long mafrId) {
+        return mkActivitiesFullReductionDao.queryObject(mafrId);
+    }
+
+    @Override
+    public List<MkActivitiesHalfPriceEntity> queryList(Map<String, Object> map) {
+        return mkActivitiesFullReductionDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return mkActivitiesFullReductionDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(MkActivitiesHalfPriceEntity mkActivitiesFullReduction) {
+        return mkActivitiesFullReductionDao.save(mkActivitiesFullReduction);
+    }
+
+    @Override
+    public int update(MkActivitiesHalfPriceEntity mkActivitiesFullReduction) {
+        return mkActivitiesFullReductionDao.update(mkActivitiesFullReduction);
+    }
+
+    @Override
+    public int delete(Long mafrId) {
+        return mkActivitiesFullReductionDao.delete(mafrId);
+    }
+
+    @Override
+    public int deleteBatch(Long[]mafrIds) {
+        return mkActivitiesFullReductionDao.deleteBatch(mafrIds);
+    }
+
+    /**
+     * 上传活动商品
+     *
+     * @param fullReductionDtoList
+     * @param storeId
+     * @param mkaId
+     */
+    @Override
+    @Transactional
+    public void uploadExcel(List<FullReductionDto> fullReductionDtoList, String storeId, String mkaId) {
+
+        // TODO 查询所有的品牌
+
+
+        if (fullReductionDtoList != null && fullReductionDtoList.size() > 0) {
+            for (int i = 0; i < fullReductionDtoList.size(); i++) {
+                FullReductionDto fullReductionDto = fullReductionDtoList.get(i);
+                Map<String, Object> valideDate = MapBeanUtil.fromObject(fullReductionDto);
+                // 校验excel传入的数据
+                ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
+                builder.put("storeId", "门店编号");
+                builder.put("goodsSn", "商品编码");
+                builder.put("barCode", "商品条码");
+//                builder.put("brand", "商品品牌");
+//                builder.put("fullReductionPrice", "满减达到金额");
+//                builder.put("discountedPrice", "优惠金额");
+//                builder.put("deadline", "截止日期");
+
+                R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
+                if (Integer.valueOf(r.get("code").toString()) != 0) {
+                    throw new RRException(r.get("msg").toString());
+                }
+
+                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+                String nowTime = format.format(new Date());
+
+                MkActivitiesHalfPriceEntity old =  mkActivitiesFullReductionDao.queryByCodeOrBrand(Long.parseLong(mkaId),fullReductionDto.getBarCode());
+                if(old != null){
+                    throw new RRException("该商品或者该品牌已经参与本次活动,商品{"+fullReductionDto.getBarCode()+"},品牌,{"+fullReductionDto.getBrand()+"}",500);
+                }
+
+                // 保存日常活动商品
+                MkActivitiesHalfPriceEntity MkActivitiesHalfPriceEntity = new MkActivitiesHalfPriceEntity();
+//                MkActivitiesHalfPriceEntity.setQualifiedAmount(new BigDecimal(fullReductionDto.getFullReductionPrice())); // 满减达到金额
+//                MkActivitiesHalfPriceEntity.setDeductionAmount(new BigDecimal(fullReductionDto.getDiscountedPrice())); // 优惠金额
+//                MkActivitiesHalfPriceEntity.setProductBrand(fullReductionDto.getBrand()); // 商品品牌
+                MkActivitiesHalfPriceEntity.setGoodsSn(fullReductionDto.getGoodsSn()); // 商品编号
+                MkActivitiesHalfPriceEntity.setBarcode(fullReductionDto.getBarCode()); // 商品条码
+//                MkActivitiesHalfPriceEntity.setDeadline(fullReductionDto.getDeadline());
+                MkActivitiesHalfPriceEntity.setShopSn(storeId); // 门店编号
+                MkActivitiesHalfPriceEntity.setMkaId(Long.parseLong(mkaId));
+
+
+                mkActivitiesFullReductionDao.save(MkActivitiesHalfPriceEntity);
+
+
+            }
+        }
+
+    }
+
+    /**
+     * 根据品牌或条形码查询是否有对应的满减活动
+     *
+     * @param mkaId
+     * @param prodBarcode
+     * @return
+     */
+    @Override
+    public MkActivitiesHalfPriceEntity queryByCodeOrBrand(Long mkaId, String prodBarcode) {
+        return mkActivitiesFullReductionDao.queryByCodeOrBrand(mkaId,prodBarcode);
+    }
+}

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

@@ -1805,7 +1805,7 @@ public class OrderServiceImpl implements OrderService {
                         goodsEntity.setRetailPrice(new BigDecimal((Float)goodsDto.get("retailPrice")));
                     }
                     if(goodsDto.get("discountedPrice") instanceof Double){
-                        goodsEntity.setDiscountedPrice(new BigDecimal((Integer)goodsDto.get("discountedPrice"))); // 优惠金额
+                        goodsEntity.setDiscountedPrice(new BigDecimal((Double)goodsDto.get("discountedPrice"))); // 优惠金额
                     }else if(goodsDto.get("discountedPrice") instanceof Integer){
                         goodsEntity.setDiscountedPrice(new BigDecimal((Integer)goodsDto.get("discountedPrice")));
                     }else if(goodsDto.get("discountedPrice") instanceof Float){

+ 19 - 0
kmall-admin/src/main/resources/XmlTemplate/HalfPriceDtoList.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workbook>
+    <worksheet name="Sheet1">
+        <section startRow="0" endRow="0"/>
+        <loop startRow="1" endRow="1" items="FullReductionDtoList" var="FullReductionDto"
+              varType="com.kmall.admin.dto.FullReductionDto">
+            <section startRow="1" endRow="1">
+                <mapping row="1" col="0">FullReductionDto.storeId</mapping>
+                <mapping row="1" col="1">FullReductionDto.goodsSn</mapping>
+                <mapping row="1" col="2">FullReductionDto.barCode</mapping>
+            </section>
+            <loopbreakcondition>
+                <rowcheck offset="0">
+                    <cellcheck offset="0"></cellcheck>
+                </rowcheck>
+            </loopbreakcondition>
+        </loop>
+    </worksheet>
+</workbook>

+ 77 - 72
kmall-admin/src/main/resources/mybatis/mapper/MkActivitiesFullReductionDao.xml

@@ -23,59 +23,62 @@
 
 	<select id="queryObject" resultType="com.kmall.admin.entity.MkActivitiesFullReductionEntity">
 		select
-			`mafr_id`,
-			`product_name`,
-			`shop_sn`,
-			`goods_sn`,
-			`barcode`,
-			`product_brand`,
-			`product_series`,
-			`qualified_amount`,
-			`deduction_amount`,
-			`mka_id`,
-			`deadline`,
-			`create_time`,
-			`creater_sn`,
-			`moder_sn`,
-			`update_time`
-		from mk_activities_full_reduction
-		where mafr_id = #{id}
+			m.mafr_id,
+			goods.name as productName,
+			m.shop_sn,
+			m.goods_sn,
+			m.barcode,
+			m.product_brand,
+			m.product_series,
+			m.qualified_amount,
+			m.deduction_amount,
+			m.mka_id,
+			m.deadline,
+			m.create_time,
+			m.creater_sn,
+			m.moder_sn,
+			m.update_time
+		from mk_activities_full_reduction  m ,
+		mall_goods goods
+		where mafr_id = #{id} and  m.goods_sn = goods.goods_sn
 	</select>
 
 	<select id="queryList" resultType="com.kmall.admin.entity.MkActivitiesFullReductionEntity">
 		select
-    		`mafr_id`,
-    		`product_name`,
-    		`shop_sn`,
-    		`goods_sn`,
-    		`barcode`,
-    		`product_brand`,
-    		`product_series`,
-    		`qualified_amount`,
-    		`deduction_amount`,
-    		`mka_id`,
-    		`deadline`,
-    		`create_time`,
-    		`creater_sn`,
-    		`moder_sn`,
-    		`update_time`
-		from mk_activities_full_reduction
-		WHERE 1=1
+    		m.mafr_id,
+    		goods.name as productName,
+    		m.shop_sn,
+    		m.goods_sn,
+    		m.barcode,
+    		m.product_brand,
+    		m.product_series,
+    		m.qualified_amount,
+    		m.deduction_amount,
+    		m.mka_id,
+    		m.deadline,
+    		m.create_time,
+    		m.creater_sn,
+    		m.moder_sn,
+    		m.update_time
+		from mk_activities_full_reduction m ,
+		mall_goods goods
+		WHERE 1=1 and
+		m.goods_sn = goods.goods_sn
 		<if test="name != null and name.trim() != ''">
-			AND barcode LIKE concat('%',#{name},'%')
+			AND m.barcode LIKE concat('%',#{name},'%')
 		</if>
 		<if test="storeId != null and storeId.trim() != ''">
-			AND shop_sn = #{storeId}
+			AND m.shop_sn = #{storeId}
 		</if>
 		<if test="mkaId != null">
-			AND mka_id = #{mkaId}
+			AND m.mka_id = #{mkaId}
 		</if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
                 order by ${sidx} ${order}
             </when>
 			<otherwise>
-                order by mafr_id desc
+                order by m.mafr_id desc
 			</otherwise>
         </choose>
 		<if test="offset != null and limit != null">
@@ -84,35 +87,37 @@
 	</select>
 
  	<select id="queryTotal" resultType="int">
-		select count(*) from mk_activities_full_reduction
-		WHERE 1=1
-        <if test="name != null and name.trim() != ''">
-            AND barcode LIKE concat('%',#{name},'%')
+		select count(*) from mk_activities_full_reduction m ,
+		mall_goods goods
+		WHERE 1=1 and
+		m.goods_sn = goods.goods_sn
+		<if test="name != null and name.trim() != ''">
+            AND m.barcode LIKE concat('%',#{name},'%')
         </if>
 		<if test="storeId != null and storeId.trim() != ''">
-			AND shop_sn = #{storeId}
+			AND m.shop_sn = #{storeId}
 		</if>
 		<if test="mkaId != null">
-			AND mka_id = #{mkaId}
+			AND m.mka_id = #{mkaId}
 		</if>
 	</select>
 
 	<insert id="save" parameterType="com.kmall.admin.entity.MkActivitiesFullReductionEntity" useGeneratedKeys="true" keyProperty="mafrId">
 		insert into mk_activities_full_reduction(
-			`product_name`,
-			`shop_sn`,
-			`goods_sn`,
-			`barcode`,
-			`product_brand`,
-			`product_series`,
-			`qualified_amount`,
-			`deduction_amount`,
-			`mka_id`,
-			`deadline`,
-			`create_time`,
-			`creater_sn`,
-			`moder_sn`,
-			`update_time`)
+			product_name,
+			shop_sn,
+			goods_sn,
+			barcode,
+			product_brand,
+			product_series,
+			qualified_amount,
+			deduction_amount,
+			mka_id,
+			deadline,
+			create_time,
+			creater_sn,
+			moder_sn,
+			update_time)
 		values(
 			#{productName},
 			#{shopSn},
@@ -133,20 +138,20 @@
 	<update id="update" parameterType="com.kmall.admin.entity.MkActivitiesFullReductionEntity">
 		update mk_activities_full_reduction
 		<set>
-			<if test="productName != null">`product_name` = #{productName}, </if>
-			<if test="shopSn != null">`shop_sn` = #{shopSn}, </if>
-			<if test="goodsSn != null">`goods_sn` = #{goodsSn}, </if>
-			<if test="barcode != null">`barcode` = #{barcode}, </if>
-			<if test="productBrand != null">`product_brand` = #{productBrand}, </if>
-			<if test="productSeries != null">`product_series` = #{productSeries}, </if>
-			<if test="qualifiedAmount != null">`qualified_amount` = #{qualifiedAmount}, </if>
-			<if test="deductionAmount != null">`deduction_amount` = #{deductionAmount}, </if>
-			<if test="mkaId != null">`mka_id` = #{mkaId}, </if>
-			<if test="deadline != null">`deadline` = #{deadline}, </if>
-			<if test="createTime != null">`create_time` = #{createTime}, </if>
-			<if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
-			<if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
-			<if test="updateTime != null">`update_time` = #{updateTime}</if>
+			<if test="productName != null">product_name = #{productName}, </if>
+			<if test="shopSn != null">shop_sn = #{shopSn}, </if>
+			<if test="goodsSn != null">goods_sn = #{goodsSn}, </if>
+			<if test="barcode != null">barcode = #{barcode}, </if>
+			<if test="productBrand != null">product_brand = #{productBrand}, </if>
+			<if test="productSeries != null">product_series = #{productSeries}, </if>
+			<if test="qualifiedAmount != null">qualified_amount = #{qualifiedAmount}, </if>
+			<if test="deductionAmount != null">deduction_amount = #{deductionAmount}, </if>
+			<if test="mkaId != null">mka_id = #{mkaId}, </if>
+			<if test="deadline != null">deadline = #{deadline}, </if>
+			<if test="createTime != null">create_time = #{createTime}, </if>
+			<if test="createrSn != null">creater_sn = #{createrSn}, </if>
+			<if test="moderSn != null">moder_sn = #{moderSn}, </if>
+			<if test="updateTime != null">update_time = #{updateTime}</if>
 		</set>
 		where mafr_id = #{mafrId}
 	</update>

+ 195 - 0
kmall-admin/src/main/resources/mybatis/mapper/MkActivitiesHalfPriceDao.xml

@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.kmall.admin.dao.MkActivitiesHalfPriceDao">
+
+    <resultMap type="com.kmall.admin.entity.MkActivitiesHalfPriceEntity" id="mkActivitiesHalfPriceMap">
+        <result property="mafrId" column="mafr_id"/>
+        <result property="productName" column="product_name"/>
+        <result property="shopSn" column="shop_sn"/>
+        <result property="goodsSn" column="goods_sn"/>
+        <result property="barcode" column="barcode"/>
+        <result property="productBrand" column="product_brand"/>
+        <result property="productSeries" column="product_series"/>
+        <result property="qualifiedAmount" column="qualified_amount"/>
+        <result property="deductionAmount" column="deduction_amount"/>
+        <result property="mkaId" column="mka_id"/>
+        <result property="deadline" column="deadline"/>
+        <result property="createTime" column="create_time"/>
+        <result property="createrSn" column="creater_sn"/>
+        <result property="moderSn" column="moder_sn"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+	<select id="queryObject" resultType="com.kmall.admin.entity.MkActivitiesHalfPriceEntity">
+		select
+			m.mafr_id,
+			goods.name as productName,
+			m.shop_sn,
+			m.goods_sn,
+			m.barcode,
+			m.product_brand,
+			m.product_series,
+			m.qualified_amount,
+			m.deduction_amount,
+			m.mka_id,
+			m.deadline,
+			m.create_time,
+			m.creater_sn,
+			m.moder_sn,
+			m.update_time
+		from mk_activities_full_reduction m ,
+		mall_goods goods
+		where m.mafr_id = #{id}
+	</select>
+
+	<select id="queryList" resultType="com.kmall.admin.entity.MkActivitiesHalfPriceEntity">
+		select
+			m.mafr_id,
+			goods.name as productName,
+			m.shop_sn,
+			m.goods_sn,
+			m.barcode,
+			m.product_brand,
+			m.product_series,
+			m.qualified_amount,
+			m.deduction_amount,
+			m.mka_id,
+			m.deadline,
+			m.create_time,
+			m.creater_sn,
+			m.moder_sn,
+			m.update_time
+		from mk_activities_full_reduction m ,
+		mall_goods goods
+		WHERE 1=1 and
+		m.goods_sn = goods.goods_sn
+		<if test="name != null and name.trim() != ''">
+			AND m.barcode LIKE concat('%',#{name},'%')
+		</if>
+		<if test="storeId != null and storeId.trim() != ''">
+			AND m.shop_sn = #{storeId}
+		</if>
+		<if test="mkaId != null">
+			AND m.mka_id = #{mkaId}
+		</if>
+		<choose>
+			<when test="sidx != null and sidx.trim() != ''">
+				order by ${sidx} ${order}
+			</when>
+			<otherwise>
+				order by m.mafr_id desc
+			</otherwise>
+		</choose>
+		<if test="offset != null and limit != null">
+			limit #{offset}, #{limit}
+		</if>
+	</select>
+
+ 	<select id="queryTotal" resultType="int">
+		select count(*) from mk_activities_full_reduction m ,
+		mall_goods goods
+		WHERE 1=1 and
+		m.goods_sn = goods.goods_sn
+		<if test="name != null and name.trim() != ''">
+			AND m.barcode LIKE concat('%',#{name},'%')
+		</if>
+		<if test="storeId != null and storeId.trim() != ''">
+			AND m.shop_sn = #{storeId}
+		</if>
+		<if test="mkaId != null">
+			AND m.mka_id = #{mkaId}
+		</if>
+	</select>
+
+	<insert id="save" parameterType="com.kmall.admin.entity.MkActivitiesHalfPriceEntity" useGeneratedKeys="true" keyProperty="mafrId">
+		insert into mk_activities_full_reduction(
+			product_name,
+			shop_sn,
+			goods_sn,
+			barcode,
+			product_brand,
+			product_series,
+			qualified_amount,
+			deduction_amount,
+			mka_id,
+			deadline,
+			create_time,
+			creater_sn,
+			moder_sn,
+			update_time)
+		values(
+			#{productName},
+			#{shopSn},
+			#{goodsSn},
+			#{barcode},
+			#{productBrand},
+			#{productSeries},
+			#{qualifiedAmount},
+			#{deductionAmount},
+			#{mkaId},
+			#{deadline},
+			#{createTime},
+			#{createrSn},
+			#{moderSn},
+			#{updateTime})
+	</insert>
+
+	<update id="update" parameterType="com.kmall.admin.entity.MkActivitiesHalfPriceEntity">
+		update mk_activities_full_reduction
+		<set>
+			<if test="productName != null">product_name = #{productName}, </if>
+			<if test="shopSn != null">shop_sn = #{shopSn}, </if>
+			<if test="goodsSn != null">goods_sn = #{goodsSn}, </if>
+			<if test="barcode != null">barcode = #{barcode}, </if>
+			<if test="productBrand != null">product_brand = #{productBrand}, </if>
+			<if test="productSeries != null">product_series = #{productSeries}, </if>
+			<if test="qualifiedAmount != null">qualified_amount = #{qualifiedAmount}, </if>
+			<if test="deductionAmount != null">deduction_amount = #{deductionAmount}, </if>
+			<if test="mkaId != null">mka_id = #{mkaId}, </if>
+			<if test="deadline != null">deadline = #{deadline}, </if>
+			<if test="createTime != null">create_time = #{createTime}, </if>
+			<if test="createrSn != null">creater_sn = #{createrSn}, </if>
+			<if test="moderSn != null">moder_sn = #{moderSn}, </if>
+			<if test="updateTime != null">update_time = #{updateTime}</if>
+		</set>
+		where mafr_id = #{mafrId}
+	</update>
+
+	<delete id="delete">
+		delete from mk_activities_full_reduction where mafr_id = #{value}
+	</delete>
+
+	<delete id="deleteBatch">
+		delete from mk_activities_full_reduction where mafr_id in
+		<foreach item="mafrId" collection="array" open="(" separator="," close=")">
+			#{mafrId}
+		</foreach>
+	</delete>
+
+	<select id="queryByCodeOrBrand" resultType="com.kmall.admin.entity.MkActivitiesHalfPriceEntity">
+		select
+			mafr_id,
+			product_name,
+			shop_sn,
+			goods_sn,
+			barcode,
+			product_brand,
+			product_series,
+			qualified_amount,
+			deduction_amount,
+			mka_id,
+			deadline,
+			create_time,
+			creater_sn,
+			moder_sn,
+			update_time
+		from mk_activities_full_reduction
+		where
+			mka_id = #{mkaId}
+			and barcode = #{prodBarcode}
+
+		limit 1
+	</select>
+
+</mapper>

+ 2 - 2
kmall-admin/src/main/resources/spring/spring-shiro.xml

@@ -16,12 +16,12 @@
 
     <bean id="sessionManager" class="com.kmall.common.security.SessionManager">
         <!-- 设置session过期时间为1小时(单位:毫秒),默认为30分钟 -->
-        <property name="globalSessionTimeout" value="3600000"></property>
+        <property name="globalSessionTimeout" value="36000000"></property>
         <property name="sessionIdUrlRewritingEnabled" value="false"></property>
         <property name="sessionDAO" ref="sessionDAO"></property>
 
         <!-- 定时清理失效会话, 清理用户直接关闭浏览器造成的孤立会话   -->
-        <property name="sessionValidationInterval" value="1800000"/>
+        <property name="sessionValidationInterval" value="36000000"/>
         <property name="sessionValidationSchedulerEnabled" value="true"/>
 
         <!-- 删除失效的session -->

+ 63 - 0
kmall-admin/src/main/webapp/WEB-INF/page/mk/mkactivitieshalfprice.html

@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>商品编码为主要匹配/上传依据,商品条形码为辅助查看而已活动方式满减,满xxx元立减xx元(x</title>
+    #parse("sys/header.html")
+</head>
+<body>
+<div id="rrapp" v-cloak>
+	<Card v-show="showList">
+        <p slot="title">第二件半价</p>
+        <Row :gutter="16">
+            <div class="search-group">
+                <i-col span="4">
+                    <i-input v-model="q.name" @on-enter="query" placeholder="商品编码"/>
+                </i-col>
+                <i-button @click="query">查询</i-button>
+                <i-button @click="reloadSearch">重置</i-button>
+            </div>
+            <div class="buttons-group" style="width: 100%;margin-top: 8px;">
+                <i-col style="display: inline-grid;">
+                    <Upload :show-upload-list="false" :on-success="uploadExcelSuccess" :on-error="uploadExcelError" :on-format-error="uploadExcelFormatError"
+                            :format="['xls','xlsx']"
+                            action="../mkactivitieshalfprice/upload" :before-upload="beforeUpload"  :data="uploadData" >
+                        <i-button type="ghost" icon="ios-cloud-upload-outline">导入</i-button>
+                    </Upload>
+                </i-col>
+                <a href="../statics/file/activities_half_price_yyyy_mm_dd_v1.0.0.xlsx">第二件半价模板下载</a>
+            </div>
+            <div class="buttons-group">
+                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
+                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
+                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
+                <i-button type="warning" @click="reloadMkactivities" v-show="!isMkactivitiesShow">返回营销方式页</i-button>
+            </div>
+        </Row>
+	    <table id="jqGrid"></table>
+	    <div id="jqGridPager"></div>
+    </Card>
+
+    <Card v-show="!showList">
+        <p slot="title">{{title}}</p>
+		<i-form ref="formValidate" :model="mkActivitiesHalfPrice" :rules="ruleValidate" :label-width="80">
+            <Form-item label="产品中文名" prop="productName">
+                <i-input v-model="mkActivitiesHalfPrice.productName" placeholder="产品中文名"/>
+            </Form-item>
+            <Form-item label="商品编码" prop="goodsSn">
+                <i-input v-model="mkActivitiesHalfPrice.goodsSn" placeholder="商品编码"/>
+            </Form-item>
+            <Form-item label="条形码" prop="barcode">
+                <i-input v-model="mkActivitiesHalfPrice.barcode" placeholder="条形码"/>
+            </Form-item>
+            <Form-item>
+                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
+                <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
+                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
+            </Form-item>
+        </i-form>
+	</Card>
+</div>
+
+<script src="${rc.contextPath}/js/mk/mkactivitieshalfprice.js?_${date.systemTime}"></script>
+</body>
+</html>

+ 2 - 1
kmall-admin/src/main/webapp/WEB-INF/page/sale/sale.html

@@ -213,6 +213,7 @@
                         <i-button data-toggle="modal" data-target="#orderDetail" style="width: 110px;font-family: 微软雅黑" @click="queryOrderDetail(item.orderSn)" v-if="item.pickUpCodeStatus == 0"  >&nbsp;{{item.pickUpCodeSn}}</i-button>
                         <i-button data-toggle="modal" data-target="#orderDetail" style="background-color:#83e7b4;width: 110px;font-family: 微软雅黑" @click="queryOrderDetail(item.orderSn)" v-if="item.pickUpCodeStatus == 1" >{{item.pickUpCodeSn}}</i-button>
                         <i-button data-toggle="modal" data-target="#orderDetail" style="background-color:#808080;width: 110px;font-family: 微软雅黑" @click="queryOrderDetail(item.orderSn)" v-if="item.pickUpCodeStatus == 2" >{{item.pickUpCodeSn}}</i-button>
+                        <i-button data-toggle="modal" data-target="#orderDetail" style="background-color:#FF0000;width: 110px;font-family: 微软雅黑" @click="queryOrderDetail(item.orderSn)" v-if="item.pickUpCodeStatus == 4" >{{item.pickUpCodeSn}}</i-button>
                     </div>
                 </div>
             </div>
@@ -270,7 +271,7 @@
                                 <div class="col-md-3" id="orderTaxes">订单预估税费: {{tax}}</div>
                             </div>
                             <div class="row" style="border:0">
-                                <div class="col-md-12" id="invetoryReceipt">清关回执: <!--{{orderProcessRecord.eleOrderStartTime}}--></div>
+                                <div class="col-md-12" id="invetoryReceipt">失败原因: {{response}}</div>
                             </div>
                             <table id="goodsDetailTable" class="table .table-striped" style="margin-top: 50px;">
                                 <tr style="border: white;background-color: orange">

+ 210 - 0
kmall-admin/src/main/webapp/js/mk/mkactivitieshalfprice.js

@@ -0,0 +1,210 @@
+$(function () {
+
+
+	let flag = getQueryString("flag");
+	if(flag != null && flag == "false"){
+		vm.isMkactivitiesShow = false;
+	}
+	let mkCode = getQueryString("mkCode");
+	if(mkCode){
+		vm.mkCode = mkCode;
+	}
+
+	let storeId = getQueryString("storeId");
+	console.log(storeId);
+	if(storeId){
+		vm.storeId = storeId;
+	}
+	let mkaId = getQueryString("mkaId");
+	if(mkaId){
+		vm.mkaId = mkaId;
+	}
+
+    $("#jqGrid").jqGrid({
+        url: '../mkactivitieshalfprice/list',
+        datatype: "json",
+        colModel: [
+			{label: 'mafrId', name: 'mafrId', index: 'mafr_id', key: true, hidden: true},
+			{label: '产品中文名', name: 'productName', index: 'product_name', width: 80, align: 'center'},
+			{label: '商品编码', name: 'goodsSn', index: 'goods_sn', width: 80, align: 'center'},
+			{label: '条形码', name: 'barcode', index: 'barcode', width: 80, align: 'center'},],
+		viewrecords: true,
+		postData: {'mkaId': vm.mkaId},
+        height: 550,
+        rowNum: 10,
+        rowList: [10, 30, 50],
+        rownumbers: true,
+        rownumWidth: 25,
+        autowidth: true,
+        multiselect: true,
+        pager: "#jqGridPager",
+        jsonReader: {
+            root: "page.list",
+            page: "page.currPage",
+            total: "page.totalPage",
+            records: "page.totalCount"
+        },
+        prmNames: {
+            page: "page",
+            rows: "limit",
+            order: "order"
+        },
+        gridComplete: function () {
+            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
+        }
+    });
+
+
+});
+
+let vm = new Vue({
+	el: '#rrapp',
+	data: {
+        showList: true,
+        title: null,
+		mkActivitiesHalfPrice: {},
+		ruleValidate: {
+			name: [
+				{required: true, message: '名称不能为空', trigger: 'blur'}
+			]
+		},
+		q: {
+		    name: ''
+		},
+        isMkactivitiesShow: true,
+        mkCode: '',
+		uploadData:[],
+		storeId : '',
+		mkaId : ''
+	},
+	methods: {
+		query: function () {
+			vm.reload();
+		},
+		add: function () {
+			vm.showList = false;
+			vm.title = "新增";
+			vm.mkActivitieshalfprice = {};
+		},
+		update: function (event) {
+            let mafrId = getSelectedRow();
+			if (mafrId == null) {
+				return;
+			}
+			vm.showList = false;
+            vm.title = "修改";
+
+            vm.getInfo(mafrId)
+		},
+		saveOrUpdate: function (event) {
+            let url = vm.mkActivitieshalfprice.mafrId == null ? "../mkactivitieshalfprice/save" : "../mkactivitieshalfprice/update";
+
+			//添加上层的门店编号与营销方式编号
+			vm.mkActivitieshalfprice.shopSn = vm.storeId;
+			vm.mkActivitieshalfprice.mkaId = vm.mkaId;
+
+            $.ajax({
+				type: "POST",
+			    url: url,
+			    contentType: "application/json",
+			    data: JSON.stringify(vm.mkActivitieshalfprice),
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('操作成功', function (index) {
+                            vm.reload();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+			});
+		},
+		del: function (event) {
+            let mafrIds = getSelectedRows();
+			if (mafrIds == null){
+				return;
+			}
+
+			confirm('确定要删除选中的记录?', function () {
+				$.ajax({
+					type: "POST",
+				    url: "../mkactivitieshalfprice/delete",
+				    contentType: "application/json",
+				    data: JSON.stringify(mafrIds),
+				    success: function (r) {
+						if (r.code == 0) {
+							alert('操作成功', function (index) {
+								$("#jqGrid").trigger("reloadGrid");
+							});
+						} else {
+							alert(r.msg);
+						}
+					}
+				});
+			});
+		},
+		getInfo: function(mafrId){
+			$.get("../mkactivitieshalfprice/info/"+mafrId, function (r) {
+                vm.mkActivitieshalfprice = r.mkActivitieshalfprice;
+            });
+		},
+        reloadSearch: function() {
+            vm.q = {
+                name: ''
+            }
+            vm.reload();
+		},
+		reload: function (event) {
+			vm.showList = true;
+            let page = $("#jqGrid").jqGrid('getGridParam', 'page');
+			$("#jqGrid").jqGrid('setGridParam', {
+                postData: {'name': vm.q.name},
+                page: page
+            }).trigger("reloadGrid");
+            vm.handleReset('formValidate');
+		},
+        handleSubmit: function (name) {
+            handleSubmitValidate(this, name, function () {
+                vm.saveOrUpdate()
+            });
+        },
+        handleReset: function (name) {
+            handleResetForm(this, name);
+        },
+        //返回营销方式页
+        reloadMkactivities: function () {
+            window.location.href = "/mk/mkactivityform.html?mkCode="+vm.mkCode;
+        },
+		uploadExcelSuccess: function (data) {
+			// console.log(data);
+			if(data.code==0){
+				alert('导入成功', function (index) {
+					$("#jqGrid").trigger("reloadGrid");
+				});
+			}else{
+				alert(data.msg);
+			}
+		},
+		uploadExcelError: function () {
+			alert('上传出现异常,请重试!');
+		},
+		uploadExcelFormatError: function (file) {
+			this.$Notice.warning({
+				title: '文件格式不正确',
+				desc: '文件 ' + file.name + ' 格式不正确,请上传 xls 或 xlsx 格式的文件。'
+			});
+		},beforeUpload(){
+			vm.uploadData = {
+				storeId: vm.storeId,
+				mkaId : vm.mkaId
+			}
+			let promise = new Promise((resolve) => {
+				this.$nextTick(function () {
+					resolve(true);
+				});
+			});
+			return promise; //通过返回一个promis对象解决
+
+		},
+	}
+});

+ 8 - 1
kmall-admin/src/main/webapp/js/mk/mkactivityform.js

@@ -47,7 +47,7 @@ $(function () {
     });
 
     var marketing =
-        {'lscx': '临时促销','yhq': '优惠券','rchd': '日常活动','mysy': '买一送一','mj': '满减', 'mz': '满赠','dz': '打折','zhjsp': '组合价商品'};
+        {'lscx': '临时促销','yhq': '优惠券','rchd': '日常活动','mysy': '买一送一','mj': '满减', 'mz': '满赠','dz': '打折','zhjsp': '组合价商品','drjbj':'第二件半价'};
 
 
     let mkCode = getQueryString("mkCode");
@@ -78,6 +78,8 @@ $(function () {
                         mkaTopicName = marketing.dz;
                     else if(value === 'zhjsp')
                         mkaTopicName = marketing.zhjsp;
+                    else if(value === 'drjbj')
+                        mkaTopicName = marketing.drjbj;
                     return mkaTopicName == null? value : mkaTopicName;
                 }},
             {label: '商户名称', name: 'merchName', width: 80, align: 'center'},
@@ -202,6 +204,9 @@ let vm = new Vue({
             }, {
                 id: 'zhjsp',
                 name: '组合价商品'
+            }, {
+                id: 'drjbj',
+                name: '第二件半价'
             }
         ],
 	},
@@ -509,6 +514,8 @@ let vm = new Vue({
                 url = "/mk/mkactivitiesdiscount.html";
             else if(mkaTopic === 'zhjsp')
                 url = "/mk/mkactivitiescombinationprice.html";
+            else if(mkaTopic === 'drjbj')
+                url = "/mk/mkactivitieshalfprice.html"
             window.location.href =  url+"?flag=false&mkCode="+vm.mkCode+"&mkaId="+mkaId+"&storeId="+storeId;
         }
 	}

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

@@ -55,6 +55,15 @@ function calculateGoodsPrice(r){
             vm.mz.set(brand,rMap.mz[brand]);
         }
     }
+
+    if(rMap.drjbj){
+        if(!vm.halfPrice.get(rMap.drjbj.barcode)){
+            vm.halfPrice.set(rMap.drjbj.barcode,1);
+        }
+
+    }
+
+
     // if(rMap.zhjsp){
     //     // 遍历该商品所有可能的组合价商品类型
     //     for(var data in rMap.zhjsp){
@@ -77,6 +86,7 @@ function calculateGoodsPrice(r){
     // calculateGoodsByMj(r.goodsDetails,"add");
     calculateGoodsByMysy(r.goodsDetails,"add");
     calculateGoodsByMz(r.goodsDetails,"add");
+    calculateGoodsByHalfPrice(r.goodsDetails,"add");
     // calculateGoodsByZhjsp(r);
 
 }
@@ -112,6 +122,36 @@ function fullReduction(goodsDetails,key){
     }
 }
 
+
+// ============================= 第二件半价==========================
+function calculateGoodsByHalfPrice(goodsDetails,type){
+    var half = vm.halfPrice.get(goodsDetails.prodBarcode);
+    if(half){
+        var discountPrice = goodsDetails.retailPrice / 2;
+        if(type == "add"){
+            // 等于一的话,不满足条件
+            if(half == 1){
+                vm.halfPrice.set(goodsDetails.prodBarcode,2);
+            }else if(half == 2){
+                goodsDetails.actualPaymentAmount = discountPrice;
+                goodsDetails.discountedPrice = discountPrice;
+                vm.halfPrice.set(goodsDetails.prodBarcode,1);
+            }
+        }else if(type == "minus"){
+            if(half == 2){
+                goodsDetails.actualPaymentAmount = goodsDetails.actualPaymentAmount ;
+                vm.halfPrice.set(goodsDetails.prodBarcode,1);
+            }else if(half == 1){
+                goodsDetails.actualPaymentAmount = goodsDetails.actualPaymentAmount - discountPrice;
+                goodsDetails.discountedPrice =  discountPrice;
+                vm.halfPrice.set(goodsDetails.prodBarcode,2);
+
+            }
+        }
+
+    }
+}
+
 // ============================= 满赠 ==============================
 
 // 满赠
@@ -119,6 +159,7 @@ function calculateGoodsByMz(goodsDetails,type){
     // 判断当前支付金额是否满足满赠金额,若满足,直接修改金额为1
     var mzGoods = vm.mz.get(goodsDetails.prodBarcode);
     if(mzGoods){
+
         var mzPrice = mzGoods.qualifiedAmount;
         if(mzPrice <  vm.actualPrice && !mzGoods.useMz){
             mzGoods.useMz = true;
@@ -468,6 +509,9 @@ let vm = new Vue({
         q: {
             name: ''
         },
+        // 第二件半价
+        halfPrice:new Map(),
+
         // 买一送一
         mysy: [],
         freeBardcode : new Map(),
@@ -499,6 +543,7 @@ let vm = new Vue({
         pendingOrderKeys:[],
         // 存储商品信息
         goodsMap:new Map(),
+        response: "",
     },
     methods: {
         query: function () {
@@ -528,6 +573,7 @@ let vm = new Vue({
                     var goodsDetails = JSON.parse(JSON.stringify(vm.goodsMap.get(this.goodsList[i].goodsSn)));
                     calculateGoodsByMj(goodsDetails,"add");
                     calculateGoodsByMysy(goodsDetails,"add");
+                    calculateGoodsByHalfPrice(goodsDetails,"add");
                     // calculateGoodsByMz(goodsDetails,"add");
                     handle(goodsDetails,"add");
                     break;
@@ -560,6 +606,7 @@ let vm = new Vue({
                         goodsDetails.sellVolume = g.sellVolume;
                         calculateGoodsByMj(goodsDetails,"minus");
                         calculateGoodsByMysy(goodsDetails,"minus");
+                        calculateGoodsByHalfPrice(goodsDetails,"minus");
                         // calculateGoodsByMz(goodsDetails,"minus");
                         goodsDetails.sellVolume = -1;
                         goodsDetails.actualPaymentAmount = -goodsDetails.actualPaymentAmount;
@@ -605,6 +652,9 @@ let vm = new Vue({
                         }
 
                     }
+                    if(vm.halfPrice.get(this.goodsList[i].prodBarcode)){
+                        vm.halfPrice.set(this.goodsList[i].prodBarcode,1);
+                    }
                     var goods = this.goodsList[i];
                     console.log(goods);
                     vm.totalPrice = vm.totalPrice - (goods.retailPrice * goods.sellVolume);
@@ -721,6 +771,9 @@ let vm = new Vue({
             vm.actualPrice = 0;
             vm.goods={};
             vm.goodsDetail = false;
+            // 第二件半价
+            vm.halfPrice = new Map();
+
             // 买一送一
             vm.mysy = [];
             vm.freeBardcode = new Map();
@@ -860,7 +913,7 @@ let vm = new Vue({
                     vm.goodsDetailList = r.resultObj.goodsList;
                     vm.currentOrderNo = r.resultObj.orderEntity.id;
                     vm.tax = r.resultObj.tax;
-
+                    vm.response = r.resultObj.response;
                     if(vm.orderProcessRecord.eleOrderStartTime){
                         vm.orderProcessRecord.eleOrderStartTime = parsedate(vm.orderProcessRecord.eleOrderStartTime);
                     }

BIN
kmall-admin/src/main/webapp/statics/file/activities_half_price_yyyy_mm_dd_v1.0.0.xlsx


+ 2 - 0
kmall-common/src/main/java/com/kmall/common/constant/JxlsXmlTemplateName.java

@@ -34,6 +34,8 @@ public class JxlsXmlTemplateName {
     public static final String BUY_ONE_GET_ONE_FREE_DTO_LIST = "/XmlTemplate/BuyOneGetOneFreeDtoList.xml";
     // 满减商品导入
     public static final String FULL_REDUCTION_DTO_LIST = "/XmlTemplate/FullReductionDtoList.xml";
+    // 第二件半价商品导入
+    public static final String HALF_PRICE_DTO_LIST = "/XmlTemplate/HalfPriceDtoList.xml";
     // 满赠商品导入
     public static final String FREE_GOODS_DTO_LIST = "/XmlTemplate/FreeGoodsDtoList.xml";
     // 优惠券商品导入