From b0c5d432ec041221dcbe81ca5ae3aa20fe3bddc6 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 22 Mar 2021 20:17:58 +0800
Subject: [PATCH] Merge branch 'score_shop' of http://120.27.238.55:7000/r/beauty-erp into score_shop
---
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesSecKillServiceImpl.java | 4
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopCouponServiceImpl.java | 52
zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopOrder.java | 12
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopSkuDao.xml | 45
zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartVo.java | 94 -
zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProductComment.java | 17
zq-erp/src/main/resources/config/db/increment/推广员.sql | 29
zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java | 2
zq-erp/src/main/resources/mybatis/mapper/score/ScoreUseRecordDao.xml | 59
zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopSku.java | 31
zq-erp/src/main/java/com/matrix/system/shopXcx/dto/DiscountExplain.java | 50
zq-erp/src/main/java/com/matrix/biz/bean/BizUser.java | 10
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductCommentDao.xml | 3
zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartBillVo.java | 12
zq-erp/src/main/resources/templates/views/admin/shop/shopProductComment-list.html | 81
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesGroupServiceImpl.java | 4
zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-list.html | 37
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml | 22
zq-erp/src/main/resources/templates/views/admin/shop/shopAdvertisType-list.html | 3
zq-erp/src/main/java/com/matrix/system/score/entity/ScoreUseRecord.java | 17
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java | 228 ---
zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanOrderDao.java | 2
zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopOrderDetails.java | 71
zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java | 29
zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/OrderCouponGroup.java | 43
zq-erp/src/main/java/com/matrix/ZqErpApplication.java | 3
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopScoreAction.java | 137 -
zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ScoreUseRecordVo.java | 56
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java | 67
zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartGroupVo.java | 46
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java | 6
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WxShopCouponService.java | 6
zq-erp/src/main/resources/config/config.json | 8
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopOrderDao.xml | 12
zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml | 60
zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html | 189 ++
zq-erp/src/main/java/com/matrix/system/score/dao/ScoreVipDetailDao.java | 21
zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/OrderItemDto.java | 47
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java | 6
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml | 85 +
zq-erp/src/main/resources/config/test/config.json | 8
zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java | 142 +-
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java | 20
zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java | 236 +++
zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreProductDto.java | 20
zq-erp/src/main/resources/config/db/increment/美度业绩升级.sql | 2
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java | 43
zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/ShopOrderDto.java | 52
zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java | 404 -----
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java | 1
zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/CalculatePostagePOJO.java | 6
zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java | 80 +
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/OrderCouponGroupService.java | 282 ++++
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java | 4
zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java | 2
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxProductAttributeAction.java | 4
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxScoreProductAction.java | 72 +
zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreFlowDto.java | 26
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java | 11
zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopBizUserScoreAction.java | 20
zq-erp/src/main/java/com/matrix/system/shopXcx/api/tools/WxShopOrderUtil.java | 27
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java | 276 ++-
zq-erp/src/main/java/com/matrix/config/RabbitMqConfig.java | 6
/dev/null | 40
zq-erp/src/test/java/com/matrix/JyyTests.java | 16
zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java | 25
zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopShoppingCart.java | 101 +
zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/MQTaskRouting.java | 1
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WXShopOrderService.java | 15
zq-erp/src/main/java/com/matrix/system/score/dao/ScoreUseRecordDao.java | 16
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopOrderDetailsDao.xml | 62
71 files changed, 2,258 insertions(+), 1,468 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/ZqErpApplication.java b/zq-erp/src/main/java/com/matrix/ZqErpApplication.java
index 2941bcc..ff662ff 100644
--- a/zq-erp/src/main/java/com/matrix/ZqErpApplication.java
+++ b/zq-erp/src/main/java/com/matrix/ZqErpApplication.java
@@ -3,6 +3,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
+import org.springframework.scheduling.annotation.EnableAsync;
/**
* spring boot入口
@@ -10,9 +11,7 @@
* @author jiangyouyao
*/
@SpringBootApplication
-
@ComponentScan(basePackages = {"com.matrix.**"})
-
public class ZqErpApplication {
public static void main(String[] args) {
diff --git a/zq-erp/src/main/java/com/matrix/biz/bean/BizUser.java b/zq-erp/src/main/java/com/matrix/biz/bean/BizUser.java
index 0fa5868..8107216 100644
--- a/zq-erp/src/main/java/com/matrix/biz/bean/BizUser.java
+++ b/zq-erp/src/main/java/com/matrix/biz/bean/BizUser.java
@@ -172,10 +172,6 @@
private Integer userType;
- /**
- * 用户总积分
- */
- private Integer totalScore;
/**
@@ -475,13 +471,7 @@
this.endTime = endTime;
}
- public Integer getTotalScore() {
- return totalScore;
- }
- public void setTotalScore(Integer totalScore) {
- this.totalScore = totalScore;
- }
public Integer getCurrentScore() {
return currentScore;
diff --git a/zq-erp/src/main/java/com/matrix/config/RabbitMqConfig.java b/zq-erp/src/main/java/com/matrix/config/RabbitMqConfig.java
index 11f480b..0993a3f 100644
--- a/zq-erp/src/main/java/com/matrix/config/RabbitMqConfig.java
+++ b/zq-erp/src/main/java/com/matrix/config/RabbitMqConfig.java
@@ -39,6 +39,11 @@
public static final String MQ_EXCHANGE_TOPIC = "hive_exchange_fanout";
@Bean
+ ScoreOrderTask ScoreOrderTask() {
+ return new ScoreOrderTask();
+ }
+
+ @Bean
VipCreateTask VipCreateTask() {
return new VipCreateTask();
}
@@ -96,6 +101,7 @@
//不同任务在不同的队列,但是routingKey一样则可以收到生产者消息
taskList.add(new MqTask(MQ_EXCHANGE_TOPIC + evn, MQTaskRouting.CREATE_ORDER + evn,MQTaskRouting.CREATE_ORDER + evn,SalesOrderTask()));
taskList.add(new MqTask(MQ_EXCHANGE_TOPIC + evn, MQTaskRouting.SALES_ORDER + evn,MQTaskRouting.CREATE_ORDER + evn,OrderrCreateTask()));
+ taskList.add(new MqTask(MQ_EXCHANGE_TOPIC + evn, MQTaskRouting.SCORE_ORDER + evn,MQTaskRouting.CREATE_ORDER + evn,ScoreOrderTask()));
rabiitMqTemplate.binding(taskList);
diff --git a/zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanOrderDao.java b/zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanOrderDao.java
index 9d64d7a..c5b69cb 100644
--- a/zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanOrderDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanOrderDao.java
@@ -26,7 +26,7 @@
* @param saleOrderDto
* @return
*/
- IPage<SalesOrderVo> selectSalesManOrder(Page<SalesOrderVo> page, @Param("record")SaleOrderDto saleOrderDto);
+ IPage<SalesOrderVo> selectSalesManOrder(Page<SalesOrderVo> page, @Param("record") SaleOrderDto saleOrderDto);
LoadFenxiaoOrderBasicVo selectFenxiaoOrderBasicByCompanyId(@Param("companyId")Long companyId);
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java
index 308720b..63c91e7 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java
@@ -230,77 +230,6 @@
private SysOrder sysOrder;
- public String getProvince() {
- return province;
- }
-
- public void setProvince(String province) {
- this.province = province;
- }
-
- public String getCity() {
- return city;
- }
-
- public void setCity(String city) {
- this.city = city;
- }
-
- public String getArea() {
- return area;
- }
-
- public void setArea(String area) {
- this.area = area;
- }
-
- public Long getRecommendId() {
- return recommendId;
- }
-
- public void setRecommendId(Long recommendId) {
- this.recommendId = recommendId;
- }
-
- public SysOrder getSysOrder() {
- return sysOrder;
- }
-
- public void setSysOrder(SysOrder sysOrder) {
- this.sysOrder = sysOrder;
- }
-
- public Integer getIsDeal() {
- return isDeal;
- }
-
- public void setIsDeal(Integer isDeal) {
- this.isDeal = isDeal;
- }
-
- public Long getParentId() {
- return parentId;
- }
-
- public void setParentId(Long parentId) {
- this.parentId = parentId;
- }
-
- public Date getCreateDistributionTime() {
- return createDistributionTime;
- }
-
- public void setCreateDistributionTime(Date createDistributionTime) {
- this.createDistributionTime = createDistributionTime;
- }
-
- public Date getHandleTime() {
- return handleTime;
- }
-
- public void setHandleTime(Date handleTime) {
- this.handleTime = handleTime;
- }
/** 扩展信息 **/
@@ -452,6 +381,77 @@
this.openId = openId;
}
+ public String getProvince() {
+ return province;
+ }
+
+ public void setProvince(String province) {
+ this.province = province;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public Long getRecommendId() {
+ return recommendId;
+ }
+
+ public void setRecommendId(Long recommendId) {
+ this.recommendId = recommendId;
+ }
+
+ public SysOrder getSysOrder() {
+ return sysOrder;
+ }
+
+ public void setSysOrder(SysOrder sysOrder) {
+ this.sysOrder = sysOrder;
+ }
+
+ public Integer getIsDeal() {
+ return isDeal;
+ }
+
+ public void setIsDeal(Integer isDeal) {
+ this.isDeal = isDeal;
+ }
+
+ public Long getParentId() {
+ return parentId;
+ }
+
+ public void setParentId(Long parentId) {
+ this.parentId = parentId;
+ }
+
+ public Date getCreateDistributionTime() {
+ return createDistributionTime;
+ }
+
+ public void setCreateDistributionTime(Date createDistributionTime) {
+ this.createDistributionTime = createDistributionTime;
+ }
+
+ public Date getHandleTime() {
+ return handleTime;
+ }
+
+ public void setHandleTime(Date handleTime) {
+ this.handleTime = handleTime;
+ }
public String getPayTotal() {
return payTotal;
}
diff --git a/zq-erp/src/main/java/com/matrix/system/score/dao/ScoreUseRecordDao.java b/zq-erp/src/main/java/com/matrix/system/score/dao/ScoreUseRecordDao.java
index 2162dc5..dae783a 100644
--- a/zq-erp/src/main/java/com/matrix/system/score/dao/ScoreUseRecordDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/score/dao/ScoreUseRecordDao.java
@@ -1,11 +1,12 @@
package com.matrix.system.score.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Param;
-import java.util.List;
-import java.util.Map;
-import com.matrix.core.pojo.PaginationVO;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.matrix.system.score.entity.ScoreUseRecord;
+import com.matrix.system.shopXcx.api.dto.ScoreFlowDto;
+import com.matrix.system.shopXcx.api.vo.ScoreUseRecordVo;
+import org.apache.ibatis.annotations.Param;
/**
* @description 积分记录表
@@ -14,4 +15,11 @@
*/
public interface ScoreUseRecordDao extends BaseMapper<ScoreUseRecord> {
+ /**
+ * 查询收支记录
+ * @param page
+ * @param scoreFlowDto
+ * @return
+ */
+ IPage<ScoreUseRecordVo> selectFlowList(Page<ScoreUseRecordVo> page, @Param("record")ScoreFlowDto scoreFlowDto);
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/score/dao/ScoreVipDetailDao.java b/zq-erp/src/main/java/com/matrix/system/score/dao/ScoreVipDetailDao.java
index dc820d5..de52cc4 100644
--- a/zq-erp/src/main/java/com/matrix/system/score/dao/ScoreVipDetailDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/score/dao/ScoreVipDetailDao.java
@@ -1,11 +1,10 @@
package com.matrix.system.score.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Param;
-import java.util.List;
-import java.util.Map;
-import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.score.entity.ScoreVipDetail;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
* @description 客户积分余额
@@ -14,4 +13,18 @@
*/
public interface ScoreVipDetailDao extends BaseMapper<ScoreVipDetail> {
+ /**
+ * 查询用户总积分
+ * @param openId
+ * @param vipId
+ * @return
+ */
+ int selectUserTotalScore(@Param("openId") String openId, @Param("vipId")Long vipId);
+
+ /**
+ * 查询用户有效的积分,按时间顺序排
+ * @param
+ * @return
+ */
+ List<ScoreVipDetail> selectEffectiveScore(@Param("openId") String openId, @Param("vipId")Long vipId);
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreUseRecord.java b/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreUseRecord.java
index a95ffec..41cc47b 100644
--- a/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreUseRecord.java
+++ b/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreUseRecord.java
@@ -14,9 +14,9 @@
@TableName("score_use_record")
public class ScoreUseRecord extends BaseEntity{
@Extend
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
-
+
@@ -25,7 +25,7 @@
*/
- private Integer recType;
+ private Integer type;
/**
* 数量
@@ -40,7 +40,10 @@
private Long businessId;
-
+ /**
+ * 操作人id
+ */
+ Long oprationUserId;
/**
* 积分卡ID
*/
@@ -65,10 +68,12 @@
/**
* 操作人ID
*/
+ private String openId;
+ private Long vipId;
- private Long userId;
-
+ private Long shopId;
+
/**
* 备注
*/
diff --git a/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java b/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java
index 2526ee5..8c6b859 100644
--- a/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java
+++ b/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java
@@ -16,10 +16,33 @@
@TableName("score_vip_detail")
public class ScoreVipDetail extends BaseEntity{
@Extend
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
-
+ /**
+ * 获取类型(1:现金消费)
+ */
+ public static final int SCORE_VIP_TYPE_CASH=1;
+ /**
+ * 获取类型(2:赠送等)
+ */
+ public static final int SCORE_VIP_TYPE_CONSUME=2;
+ /** 有效*/
+ public static final int SCORE_STATUS_YX=1;
+ /** 无效*/
+ public static final int SCORE_STATUS_WX=2;
+
+
+
+ /**
+ * 用户openId
+ */
+ private String openId;
+
+ /**
+ * erp用户Id
+ */
+ private Long vipId;
/**
@@ -76,7 +99,7 @@
*/
- private String businessId;
+ private Long businessId;
/**
* 所属公司_id
diff --git a/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java b/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java
index 807819d..9002b42 100644
--- a/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java
+++ b/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java
@@ -1,20 +1,246 @@
package com.matrix.system.score.service;
-import com.matrix.system.score.dao.ScoreVipDetailDao;
-import com.matrix.system.score.entity.ScoreVipDetail;
+import cn.hutool.core.date.DateTime;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.matrix.biz.dao.BizUserDao;
+import com.matrix.core.constance.MatrixConstance;
+import com.matrix.core.exception.GlobleException;
+import com.matrix.core.tools.DateUtil;
+import com.matrix.system.common.bean.BusParameterSettings;
+import com.matrix.system.common.dao.BusParameterSettingsDao;
+import com.matrix.system.common.dao.SysUsersDao;
+import com.matrix.system.hive.dao.SysVipInfoDao;
+import com.matrix.system.score.constant.ScoreSettingConstant;
+import com.matrix.system.score.dao.ScoreUseRecordDao;
+import com.matrix.system.score.dao.ScoreVipDetailDao;
+import com.matrix.system.score.entity.ScoreUseRecord;
+import com.matrix.system.score.entity.ScoreVipDetail;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
/**
- * @description 客户积分余额
* @author jyy
+ * @description 客户积分余额
* @date 2021-02-26 15:26
*/
@Service
-public class ScoreVipDetailService extends ServiceImpl<ScoreVipDetailDao, ScoreVipDetail>{
+public class ScoreVipDetailService extends ServiceImpl<ScoreVipDetailDao, ScoreVipDetail> {
+
+ @Autowired
+ ScoreVipDetailDao scoreVipDetailDao;
+
+ @Autowired
+ ScoreUseRecordDao scoreUseRecordDao;
+
+ @Autowired
+ BizUserDao bizUserDao;
+
+ @Autowired
+ SysVipInfoDao vipInfoDao;
+
+ @Autowired
+ SysUsersDao sysUsersDao;
+
+ @Autowired
+ BusParameterSettingsDao busParameterSettingsDao;
+
+ /**
+ * 扣除用户积分
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public void deductionScore(String openId, Long vipId,Long shopId, Integer score, Long businessId, int type,String remark) {
+ Long companyId=null;
+ if(openId!=null){
+ companyId= bizUserDao.findByOpenId(openId).getCompanyId();
+ }else if(vipId!=null){
+ companyId= vipInfoDao.selectById(vipId).getCompanyId();
+ }else{
+ throw new IllegalArgumentException("vipId,openId必须有一个");
+ }
+
+ List<ScoreVipDetail> effectiveScoreList = scoreVipDetailDao.selectEffectiveScore(openId,null);
+
+ for (ScoreVipDetail scoreVipDetail : effectiveScoreList) {
+
+ ScoreUseRecord scoreUseRecord = new ScoreUseRecord();
+ scoreUseRecord.setPreScore(scoreVipDetail.getRemainScore());
+
+ int surplus = scoreVipDetail.getRemainScore() - score;
+ int currentDedution = 0;
+ if (surplus > 0 || surplus == 0) {
+ //余额充足
+ currentDedution = score;
+ scoreVipDetail.setRemainScore(surplus);
+ if(surplus==0){
+ scoreVipDetail.setState(ScoreVipDetail.SCORE_STATUS_WX);
+ }
+ scoreVipDetailDao.updateById(scoreVipDetail);
+ score=0;
+ } else {
+ currentDedution = scoreVipDetail.getRemainScore();
+ scoreVipDetail.setState(ScoreVipDetail.SCORE_STATUS_WX);
+ scoreVipDetail.setRemainScore(0);
+ scoreVipDetailDao.updateById(scoreVipDetail);
+ score=Math.abs(surplus);
+ }
+ //新增扣除记录
+ scoreUseRecord.setCreateBy(MatrixConstance.SYSTEM_USER);
+ scoreUseRecord.setUpdateBy(MatrixConstance.SYSTEM_USER);
+ scoreUseRecord.setCreateTime(DateTime.now());
+ scoreUseRecord.setUpdateTime(DateTime.now());
+ scoreUseRecord.setNowScore(scoreVipDetail.getRemainScore());
+ scoreUseRecord.setCompanyId(companyId);
+ scoreUseRecord.setScoreVipDetailId(scoreVipDetail.getId());
+ scoreUseRecord.setBusinessId(businessId);
+ scoreUseRecord.setRecNum(-currentDedution);
+ scoreUseRecord.setType(type);
+ scoreUseRecord.setShopId(shopId);
+ scoreUseRecord.setOpenId(openId);
+ scoreUseRecord.setVipId(vipId);
+ scoreUseRecord.setRemarks(remark);
+ scoreUseRecordDao.insert(scoreUseRecord);
+
+ if(surplus > 0 || surplus == 0){
+ break;
+ }
+ }
+ if(score>0){
+ throw new GlobleException("积分不足");
+ }
+ }
+
+ /**
+ * 新增用户积分
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public void addScore(String openId, Long vipId, Long oprationUserId,Long shopId, Integer score, Long businessId, int type,String remark) {
+ Long companyId=null;
+ if(openId!=null){
+ companyId= bizUserDao.findByOpenId(openId).getCompanyId();
+ }else if(vipId!=null){
+ companyId= vipInfoDao.selectById(vipId).getCompanyId();
+ }else{
+ throw new IllegalArgumentException("vipId,openId必须有一个");
+ }
+ if(score<0){
+ throw new IllegalArgumentException("score必须有为大于零的数");
+ }
+
+ String createBy=MatrixConstance.SYSTEM_USER;
+ if(oprationUserId!=null){
+ createBy=sysUsersDao.selectById(oprationUserId).getSuName();
+ }
+
+ //计算过期时间
+ BusParameterSettings yxqSetting = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.VALID_PERIOD_POINTS, companyId);
+ Calendar cal=Calendar.getInstance();
+ int year = cal.get(Calendar.YEAR);
+ int sxYear=year+(Integer.parseInt(yxqSetting.getParamValue())-1);
+ Date sxys=DateUtil.stringToDate(year+"-12-31 23:59",DateUtil.DATE_FORMAT_MM );
+
+ ScoreVipDetail scoreVipDetail=new ScoreVipDetail();
+
+ scoreVipDetail.setCreateBy(createBy);
+ scoreVipDetail.setUpdateBy(createBy);
+ scoreVipDetail.setCreateTime(DateTime.now());
+ scoreVipDetail.setUpdateTime(DateTime.now());
+ scoreVipDetail.setState(ScoreVipDetail.SCORE_STATUS_YX);
+ scoreVipDetail.setRemainScore(score);
+ scoreVipDetail.setUsedScore(0);
+ scoreVipDetail.setBusinessId(businessId);
+ scoreVipDetail.setValiditeTime(sxys);
+ scoreVipDetail.setOpenId(openId);
+ scoreVipDetail.setVipId(vipId);
+ scoreVipDetail.setGainTime(DateTime.now());
+ scoreVipDetail.setAllScore(score);
+ scoreVipDetail.setType(type);
+ scoreVipDetail.setCompanyId(companyId);
+ scoreVipDetailDao.insert(scoreVipDetail);
+
+ //新增添加记录
+ ScoreUseRecord scoreUseRecord = new ScoreUseRecord();
+ scoreUseRecord.setPreScore(score);
+ scoreUseRecord.setCreateBy(createBy);
+ scoreUseRecord.setUpdateBy(createBy);
+ scoreUseRecord.setCreateTime(DateTime.now());
+ scoreUseRecord.setUpdateTime(DateTime.now());
+ scoreUseRecord.setNowScore(score);
+ scoreUseRecord.setCompanyId(companyId);
+ scoreUseRecord.setScoreVipDetailId(scoreVipDetail.getId());
+ scoreUseRecord.setBusinessId(businessId);
+ scoreUseRecord.setRecNum(score);
+ scoreUseRecord.setType(type);
+ scoreUseRecord.setOpenId(openId);
+ scoreUseRecord.setVipId(vipId);
+ scoreUseRecord.setShopId(shopId);
+ scoreUseRecord.setOprationUserId(oprationUserId);
+ scoreUseRecord.setRemarks(remark);
+ scoreUseRecordDao.insert(scoreUseRecord);
+ }
+ /**
+ * 退积分
+ */
+ public void refundScore(String openId, Long vipId, Integer score, Long oldBusinessId, int type){
+ Long companyId=null;
+ if(openId!=null){
+ companyId= bizUserDao.findByOpenId(openId).getCompanyId();
+ }else if(vipId!=null){
+ companyId= vipInfoDao.selectById(vipId).getCompanyId();
+ }else{
+ throw new IllegalArgumentException("vipId,openId必须有一个");
+ }
+ if(score<0){
+ throw new IllegalArgumentException("score必须有为大于零的数");
+ }
-
+ //查询原始使用记录
+ QueryWrapper queryWrapper=new QueryWrapper();
+ queryWrapper.eq("business_id",oldBusinessId);
+ queryWrapper.eq("company_id",companyId);
+ queryWrapper.eq("type",type);
+ List<ScoreUseRecord> scoreUseRecordList = scoreUseRecordDao.selectList(queryWrapper);
+ scoreUseRecordList.forEach(scoreUseRecord -> {
+ ScoreVipDetail scoreVipDetail = scoreVipDetailDao.selectById(scoreUseRecord.getScoreVipDetailId());
+ if(scoreVipDetail!=null){
+ if(DateTime.now().isAfter(scoreVipDetail.getValiditeTime())){
+ //积分还有效
+ scoreVipDetail.setRemainScore( scoreVipDetail.getRemainScore()+score);
+ scoreVipDetail.setUsedScore(scoreVipDetail.getUsedScore()-score);
+ scoreVipDetail.setState(ScoreVipDetail.SCORE_STATUS_YX);
+ scoreVipDetailDao.updateById(scoreVipDetail);
+ scoreUseRecordDao.deleteById(scoreUseRecord.getId());
+ }
+ }
+
+ });
+ }
+
+ public void removeByBusinessId(String openId, Long vipId, Long oldBusinessId, int type){
+ Long companyId=null;
+ if(openId!=null){
+ companyId= bizUserDao.findByOpenId(openId).getCompanyId();
+ }else if(vipId!=null){
+ companyId= vipInfoDao.selectById(vipId).getCompanyId();
+ }else{
+ throw new IllegalArgumentException("vipId,openId必须有一个");
+ }
+ if(oldBusinessId==null){
+ throw new IllegalArgumentException("oldBusinessId必须有");
+ }
+ QueryWrapper queryWrapper=new QueryWrapper();
+ queryWrapper.eq("business_id",oldBusinessId);
+ queryWrapper.eq("company_id",companyId);
+ queryWrapper.eq("type",type);
+ scoreVipDetailDao.delete(queryWrapper);
+ scoreUseRecordDao.delete(queryWrapper);
+ }
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopBizUserScoreAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopBizUserScoreAction.java
index 2097b6c..3480da7 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopBizUserScoreAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopBizUserScoreAction.java
@@ -1,25 +1,10 @@
package com.matrix.system.shopXcx.action;
-import com.matrix.biz.bean.BizUser;
import com.matrix.biz.service.BizUserService;
-import com.matrix.core.anotations.RemoveRequestToken;
-import com.matrix.core.anotations.SaveRequestToken;
-import com.matrix.core.constance.MatrixConstance;
-import com.matrix.core.pojo.AjaxResult;
-import com.matrix.core.tools.StringUtils;
-import com.matrix.core.tools.WebUtil;
-import com.matrix.system.common.bean.SysUsers;
-import com.matrix.system.shopXcx.bean.ShopScoreExchange;
import com.matrix.system.shopXcx.dao.ShopScoreExchangeDao;
-import com.matrix.system.shopXcx.pojo.ExchangeScorePOJO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
-import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.servlet.ModelAndView;
-
-import java.util.Date;
/**
@@ -40,11 +25,6 @@
* 记录编辑前的值Before_Edit_Value
*/
public static final String BEV = "ShopBizUserScore_BEV";
-
-
-
-
-\
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java
index dd0c18a..69fbbab 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java
@@ -529,7 +529,7 @@
modifyMap.put("refundCharge", shopRefundRecord.getRefundMoney());
shopOrderDao.updateByMap(modifyMap);
- rabiitMqTemplate.sendMsg(MQTaskRouting.SHOP_ORDER_REFUND+evn,shopOrder.getId()+"");
+ rabiitMqTemplate.sendMsg(MQTaskRouting.SHOP_ORDER_REFUND+evn,shopRefundRecord.getOrderId()+"");
}catch (Exception e){
LogUtil.debug("退款成功,修改退款表和订单表状态出错。。。", id);
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopShoppingCartAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopShoppingCartAction.java
deleted file mode 100644
index c7e50a8..0000000
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopShoppingCartAction.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.matrix.system.shopXcx.action;
-
-import com.matrix.core.constance.MatrixConstance;
-import com.matrix.core.constance.SystemMessageCode;
-import com.matrix.core.pojo.PaginationVO;
-import com.matrix.core.tools.ModelUtils;
-import com.matrix.core.tools.StringUtils;
-import com.matrix.core.constance.SystemErrorCode;
-import com.matrix.core.anotations.RemoveRequestToken;
-import com.matrix.system.common.bean.SysUsers;
-import com.matrix.system.hive.action.util.QueryUtil;
-import com.matrix.system.shopXcx.dao.ShopShoppingCartDao;
-import org.springframework.stereotype.Controller;
-import com.matrix.core.exception.GlobleException;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import com.matrix.core.anotations.SaveRequestToken;
-import com.matrix.core.pojo.AjaxResult;
-import com.matrix.core.tools.WebUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.List;
-import java.util.Map;
-import com.matrix.system.shopXcx.bean.ShopShoppingCart;
-import org.springframework.web.servlet.ModelAndView;
-
-/**
- * @description 购物车
- * @author jiangyouyao
- * @date 2019-06-12 19:09
- */
-@Controller
-@RequestMapping(value = "admin/shopShoppingCart")
-public class ShopShoppingCartAction {
-
- @Autowired
- private ShopShoppingCartDao shopShoppingCartDao;
-
- //记录编辑前的值Before_Edit_Value
- public static final String BEV="ShopShoppingCart_BEV";
-
-
- /**
- * 列表显示
- */
- @RequestMapping(value = "/showList")
- public @ResponseBody AjaxResult showList(ShopShoppingCart shopShoppingCart, PaginationVO pageVo) {
- QueryUtil.setQueryLimitCom(shopShoppingCart);
- List<ShopShoppingCart> dataList = shopShoppingCartDao.selectInPage(shopShoppingCart, pageVo);
- AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList,
- shopShoppingCartDao.selectTotalRecord(shopShoppingCart));
- return result;
- }
-
- /**
- * 新增
- */
- @RemoveRequestToken
- @RequestMapping(value = "/addShopShoppingCart")
- public @ResponseBody AjaxResult addShopShoppingCart(ShopShoppingCart shopShoppingCart) {
- SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
- shopShoppingCart.setCreateBy(user.getSuName());
- shopShoppingCart.setUpdateBy(user.getSuName());
- shopShoppingCart.setCompanyId(user.getCompanyId());
- int i=shopShoppingCartDao.insert(shopShoppingCart);
- if(i > 0){
- return new AjaxResult(AjaxResult.STATUS_SUCCESS, SystemMessageCode.ADD_SUCCES, "购物车");
- }else {
- throw new GlobleException(SystemErrorCode.DATA_ADD_FAIL);
- }
- }
-
-
-
-
-
- /**
- * 修改
- */
- @RemoveRequestToken
- @RequestMapping(value = "/modifyShopShoppingCart")
- public @ResponseBody AjaxResult modifyShopShoppingCart(ShopShoppingCart newShopShoppingCart) {
- ShopShoppingCart oldShopShoppingCart = WebUtil.getSessionAttribute(BEV);
- int i = 0;
- Map<String, Object> modifyMap = null;
- try {
- if (!ModelUtils.isModified(oldShopShoppingCart, newShopShoppingCart)) {
- i = MatrixConstance.DML_SUCCESSS;
- }
- modifyMap = ModelUtils.comparePojo2Map(oldShopShoppingCart, newShopShoppingCart);
- } catch (Exception e) {
- throw new GlobleException(SystemErrorCode.DATA_UPDATE_FAIL, e, newShopShoppingCart);
- }
- if (modifyMap.size() > 0) {
- modifyMap.put("cartId", oldShopShoppingCart.getCartId());
- shopShoppingCartDao.updateByMap(modifyMap);
- }
- i = MatrixConstance.DML_SUCCESSS;
- WebUtil.removeSessionAttribute(BEV);
- if (i > 0) {
- return new AjaxResult(AjaxResult.STATUS_SUCCESS, SystemMessageCode.UPDATE_SUCCES, "购物车");
- } else {
- throw new GlobleException(SystemErrorCode.DATA_UPDATE_FAIL);
- }
- }
-
-
-
-
- /**
- * 进入修改界面
- */
- @SaveRequestToken
- @RequestMapping(value = "/editForm")
- public ModelAndView editForm(Integer id) {
- ShopShoppingCart shopShoppingCart = new ShopShoppingCart();
- ModelAndView modelAndView = new ModelAndView("admin/shopShoppingCart-form");
- if (id != null) {
- shopShoppingCart = shopShoppingCartDao.selectById(id);
- WebUtil.setSessionAttribute(BEV, shopShoppingCart);
- }
- modelAndView.addObject("obj",shopShoppingCart);
- return modelAndView;
- }
-
-
- /**
- * 删除
- */
- @RequestMapping(value = "/del")
- public @ResponseBody AjaxResult del(String keys) {
- List<String> ids = StringUtils.strToCollToString(keys, ",");
- int i = shopShoppingCartDao.deleteByIds(ids);
- if (i > 0) {
- return new AjaxResult(AjaxResult.STATUS_SUCCESS, SystemMessageCode.DELETE_SUCCES, i);
- } else {
- throw new GlobleException(SystemErrorCode.DATA_DELETE_FAIL);
- }
- }
-
-}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java
index 7c7577a..f1e3fe5 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java
@@ -2,40 +2,28 @@
import com.matrix.biz.bean.BizUser;
import com.matrix.component.redis.RedisUserLoginUtils;
-import com.matrix.component.tools.WxUtils;
import com.matrix.component.wechat.externalInterface.protocol.paramProtocol.BrandWCPayRequestData;
import com.matrix.component.wechat.externalInterface.weixinUtil.WeixinServiceUtil;
import com.matrix.core.constance.SystemErrorCode;
import com.matrix.core.exception.GlobleException;
import com.matrix.core.pojo.AjaxResult;
-import com.matrix.core.tools.StringUtils;
-import com.matrix.system.common.constance.AppConstance;
-import com.matrix.system.constance.Dictionary;
-import com.matrix.system.hive.bean.ShoppingGoods;
import com.matrix.system.hive.dao.ShoppingGoodsDao;
-import com.matrix.system.shopXcx.api.pojo.AddShopOrderPOJO;
-import com.matrix.system.shopXcx.api.pojo.CreateOrderDto;
import com.matrix.system.shopXcx.api.pojo.OrderInfoQueryPOJO;
+import com.matrix.system.shopXcx.api.pojo.ShopOrderDto;
+import com.matrix.system.shopXcx.api.service.OrderCouponGroupService;
import com.matrix.system.shopXcx.api.service.ShoppingCartService;
import com.matrix.system.shopXcx.api.service.WXShopOrderService;
import com.matrix.system.shopXcx.api.service.WxShopCouponService;
import com.matrix.system.shopXcx.api.tools.WxShopCouponUtil;
import com.matrix.system.shopXcx.api.tools.WxShopOrderUtil;
-import com.matrix.system.shopXcx.api.vo.CouponReceiveInfoVO;
-import com.matrix.system.shopXcx.api.vo.ShopCartVo;
-import com.matrix.system.shopXcx.bean.*;
+import com.matrix.system.shopXcx.bean.ShopOrder;
import com.matrix.system.shopXcx.dao.*;
-import com.matrix.system.shopXcx.dto.DiscountExplain;
-import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
/**
@@ -82,105 +70,25 @@
private ShopOrderDetailsDao shopOrderDetailsDao;
@Autowired
+ OrderCouponGroupService orderCouponGroupService;
+
+ @Autowired
ShopOrderDao shopOrderDao;
/**
* 计算购物车订单价格
*
- * @param addShopOrderPOJO
+ * @param shopOrderDto
* @return
* @throws Exception
*/
@PostMapping(value = "/calculationCartOrder")
public
@ResponseBody
- AjaxResult calculationCartOrder(@RequestBody AddShopOrderPOJO addShopOrderPOJO) throws Exception {
- BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); //计算购物车中物品的优惠信息
-
- List<ShopCartVo> cartList = shoppingCartService.findUserCartList(addShopOrderPOJO.getShopId());
+ AjaxResult calculationCartOrder(@RequestBody ShopOrderDto shopOrderDto) throws Exception {
- //取出购物车中选中的产品
- List<ShopShoppingCart> buyCart = new ArrayList<>();
-
- //取出购物车中没有参加店铺活动的产品,和参加了店铺活动但是活动没有达到标准的产品,用来计算是否可以使用优惠券
- List<ShopShoppingCart> notCouponuyCart = new ArrayList<>();
- for (ShopCartVo shopCartVo : cartList) {
- for (ShopShoppingCart shopShoppingCart : shopCartVo.getCartList()) {
- if (shopShoppingCart.getIsSelected() == 1) {
- buyCart.add(shopShoppingCart);
- if (shopCartVo.getCoupon() == null || !shopCartVo.isSatisfactionCoupon()) {
- notCouponuyCart.add(shopShoppingCart);
- }
- }
- }
- }
- //获取当前购物车产品可用的优惠券
- List<CouponReceiveInfoVO> usefulCoupon = wxShopCouponService.getCartVoCouponList(bizUser.getCompanyId(),notCouponuyCart);
-
- //获取用户使用的优惠券
- CouponReceiveInfoVO shopCoupon = new CouponReceiveInfoVO();
- if (addShopOrderPOJO.getCouponReceiveId() == null) {
- //如果用户没有选择优惠券则默认选优惠金额最高的
- //计算使用优惠券后的价格
- if (CollectionUtils.isNotEmpty(usefulCoupon)) {
- //根据优惠券ID用户ID查询优惠券信息
- shopCoupon = usefulCoupon.get(0);
- }
- } else if (addShopOrderPOJO.getCouponReceiveId() != 1) {
- //用户选择了优惠券
- shopCoupon = shopCouponRecordDao.selectMyCouponByReceiveId(addShopOrderPOJO.getCouponReceiveId());
- } else {
- //用户不使用优惠券
- }
-
-
- //计算收货地址:
-
- ShopReceiveAddress shopReceiveAddress = null;
- if (addShopOrderPOJO.getReceiveAddrId() == null) {
- //如果没有传收货地址则默认收货地址
- shopReceiveAddress = shopReceiveAddressDao.selectDefaultAddress(bizUser.getOpenId());
- if (shopReceiveAddress != null) {
- addShopOrderPOJO.setReceiveAddrId(shopReceiveAddress.getAddrId());
- }
- } else {
- shopReceiveAddress = shopReceiveAddressDao.selectById(addShopOrderPOJO.getReceiveAddrId());
- addShopOrderPOJO.setReceiveAddrId(shopReceiveAddress.getAddrId());
-
- }
-
-
- //得到订单计价说明
- DiscountExplain discountExplain = shopOrderService.buildDiscountExplain(cartList, shopCoupon.getReceiveId(), bizUser.getCompanyId());
-
- AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, buyCart, buyCart.size());
- //结算金额信息
- result.putInMap("discountExplain", discountExplain);
-
-
- //用户优惠券
- result.putInMap("usefulCoupon", usefulCoupon);
- //用户选中的优惠券
- result.putInMap("shopCoupon", shopCoupon);
-
-
- //默认地址
- String deliverySelect = "立即配送";
- if (shopReceiveAddress != null) {
- if (StringUtils.isNotBlank(shopReceiveAddress.getSchool())) {
- deliverySelect = "立即配送";
- } else {
- deliverySelect = "物流配送";
- }
- }
- result.putInMap("defaultAddress", shopReceiveAddress);
- //配送方式
- result.putInMap("deliverySelect", deliverySelect);
-
-
- result.setRows(buyCart);
- return result;
+ return shopOrderService.buildDiscountExplain(shopOrderDto);
}
@@ -190,129 +98,17 @@
/**
* 新增订单
*
- * @param addShopOrderPOJO
+ * @param shopOrderDto
* @return
*/
@PostMapping(value = "/addShopOrder")
public
@ResponseBody
- AjaxResult addShopOrder(@RequestBody AddShopOrderPOJO addShopOrderPOJO) throws Exception {
- return shopOrderService.createShopOrder(addShopOrderPOJO);
+ AjaxResult addShopOrder(@RequestBody ShopOrderDto shopOrderDto) throws Exception {
+ return shopOrderService.createShopOrder(shopOrderDto);
}
- /**
- * 新增订单
- * 本方法抛弃,不再使用,本方法是单单个产品购买
- * 在多产品的时候不适合
- * @return
- */
- @Deprecated
- @PostMapping(value = "/addShopOrder2")
- public
- @ResponseBody
- AjaxResult addShopOrder2(@RequestBody CreateOrderDto createOrderDto) throws Exception {
-
-
- //校验收货地址
- ShopReceiveAddress shopReceiveAddress = shopReceiveAddressDao.selectById(createOrderDto.getReceiveAddrId());
- if (shopReceiveAddress == null) {
- return new AjaxResult(AjaxResult.STATUS_FAIL, "请选择正确的收获地址");
- }
-
-
- BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class);
- ShopSku shopSku = shopSkuDao.selectById(createOrderDto.getSkuId());
- ShopProduct shopProduct = shopProductDao.selectById(createOrderDto.getProductId());
- String stokCode = shopSku.getStockCode();
-
- ShopOrder shopOrder = new ShopOrder();
- //查询绑定的产品是否为家居产品
- if (StringUtils.isNotBlank(stokCode)) {
- ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(Long.parseLong(stokCode));
- if (shoppingGoods != null) {
- //根据购买的产品设置订单类型
- if (Dictionary.SHOPPING_GOODS_TYPE_JJCP.equals(shoppingGoods.getGoodType())) {
- shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS);
- } else {
- shopOrder.setOrderType(ShopOrder.ORDER_TYPE_SERVICE);
- }
- } else {
- shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS);
- }
- }
-
- List<ShopOrderDetails> details = new ArrayList<>();
- Integer cartCount = 0;
- ShopOrderDetails shopOrderDetails = new ShopOrderDetails();
- shopOrderDetails.setCreateBy(AppConstance.SYSTEM_USER);
- shopOrderDetails.setUpdateBy(AppConstance.SYSTEM_USER);
- shopOrderDetails.setpId(createOrderDto.getProductId());
- shopOrderDetails.setsId(createOrderDto.getSkuId());
- shopOrderDetails.setPrice(shopSku.getPrice());
- shopOrderDetails.setCount(createOrderDto.getNumber());
- shopOrderDetails.setsTitle(shopProduct.getTitle() + shopSku.getName());
- shopOrderDetails.setDiscountAmount(BigDecimal.ZERO);
- shopOrderDetails.setTotalPrice(shopOrderDetails.getPrice().multiply(BigDecimal.valueOf(shopOrderDetails.getCount())));
- details.add(shopOrderDetails);
- cartCount += shopOrderDetails.getCount();
-
-
- //TODO 更新库存和销量[考虑和erp库存联动]
- wxShopOrderUtil.updateProductAndSkuInfo(details);
-
- //用户openId
- shopOrder.setUserId(bizUser.getOpenId());
- shopOrder.setCreateBy("微信小程序生成");
- shopOrder.setUpdateBy("微信小程序生成");
- shopOrder.setCommodityPrice(shopOrderDetails.getTotalPrice());
- shopOrder.setPurchaseQuantity(cartCount);
- //购买方式
- shopOrder.setShippingMethod("物流配送");
- //生成订单号
- shopOrder.setOrderNo(WxUtils.getOrderNum());
- //设置支付状态
- shopOrder.setPayStatus(ShopOrder.ORDER_STATUS_WAIT_PAY);
- //设置订单状态
- shopOrder.setOrderStatus(ShopOrder.ORDER_STATUS_WAIT_SEND);
-
- //设置退款费用(注:下次优化从数据字典表获取)
- shopOrder.setRefundCharge(BigDecimal.ZERO);
- //客户电话
- shopOrder.setUserTel(shopReceiveAddress.getAddrTelephone());
- //客户姓名
- shopOrder.setUserName(shopReceiveAddress.getAddrLiaisonman());
- //备注
- shopOrder.setRemarks(createOrderDto.getRemarks());
- //删除标识
- shopOrder.setDelFlag(AppConstance.DATA_USEABLE);
- //微信订单号
- shopOrder.setWxOrderNo("");
- //微信支付结果
- shopOrder.setPayResult(ShopOrder.ORDER_WX_STATUS_WAIT_PAY);
- //如果没有提交购买方式或配送方式不是物流
- //获取邮费
- shopOrder.setOrderMoney(shopOrderDetails.getTotalPrice());
- shopOrder.setStoreId(createOrderDto.getShopId());
-
- shopOrderDao.insert(shopOrder);
-
- wxShopOrderUtil.insertSendPackageInfo(shopOrder, "物流配送", shopReceiveAddress);
-
- //给订单详情表添加订单ID
- shopOrderDetails.setOrderId(shopOrder.getId());
-
- shopOrderDetailsDao.insert(shopOrderDetails);
-
-
- BrandWCPayRequestData payData = startPayment(shopOrder);
- AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, Arrays.asList(payData));
- result.putInMap("orderId", shopOrder.getId());
-
- return result;
-
-
- }
@Value("${wx_pay_debug_onoff}")
private boolean isDebug;
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java
index 508d4e7..d5423a3 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java
@@ -12,6 +12,8 @@
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.hive.bean.SysVipInfo;
import com.matrix.system.hive.dao.SysVipInfoDao;
+import com.matrix.system.score.entity.ScoreVipDetail;
+import com.matrix.system.score.service.ScoreVipDetailService;
import com.matrix.system.shopXcx.bean.ShopActivitiesGroupJoin;
import com.matrix.system.shopXcx.bean.ShopActivitiesGroupJoinUser;
import com.matrix.system.shopXcx.bean.ShopOrder;
@@ -78,6 +80,9 @@
@Autowired
BusParameterSettingsDao busParameterSettingsDao;
+
+ @Autowired
+ ScoreVipDetailService scoreVipDetailService;
@@ -196,6 +201,7 @@
rabiitMqTemplate.sendTopicMsg(RabbitMqConfig.MQ_EXCHANGE_TOPIC +evn, MQTaskRouting.CREATE_ORDER+evn, orderId);
+
threadResult.putInMap("status", "success");
resXml = AppConstance.RESULT_XML_SUCCESS;
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxProductAttributeAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxProductAttributeAction.java
index 2adf5f8..07dbded 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxProductAttributeAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxProductAttributeAction.java
@@ -28,9 +28,9 @@
@Autowired
private ShopProductAttributeDao shopProductAttributeDao;
- @RequestMapping("/getByCode/{shopId}/{attrCode}")
+ @RequestMapping("/getByCode/{attrCode}")
@ResponseBody
- public AjaxResult getProductAttributeByCode(@PathVariable("shopId") Long shopId, @PathVariable("attrCode") String attrCode){
+ public AjaxResult getProductAttributeByCode(@PathVariable("attrCode") String attrCode){
if(!StringUtils.isNotBlank(attrCode)){
return new AjaxResult(AjaxResult.STATUS_FAIL,"属性编码不能为空");
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java
index b89cac9..611820b 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java
@@ -5,7 +5,6 @@
import com.matrix.system.common.interceptor.HostInterceptor;
import com.matrix.system.shopXcx.api.dto.SaleProductDto;
import com.matrix.system.shopXcx.bean.ShopProduct;
-import com.matrix.system.shopXcx.bean.ShopProductAttribute;
import com.matrix.system.shopXcx.dao.ShopProductAttributeDao;
import com.matrix.system.shopXcx.dao.ShopProductDao;
import com.matrix.system.shopXcx.dao.ShopSkuDao;
@@ -47,14 +46,13 @@
})
public AjaxResult getShopProductShowList(@RequestBody @Validated SaleProductDto saleProductDto) {
ShopProduct shopProduct=new ShopProduct();
-
- ShopProductAttribute fxsc = shopProductAttributeDao.selectByCode("fxsc", HostInterceptor.getCompanyId());
shopProduct.setLimit(saleProductDto.getPageSize());
shopProduct.setOffset((saleProductDto.getPageNum()-1)* saleProductDto.getPageSize());
+ shopProduct.setCategoryId(saleProductDto.getCategoryId());
shopProduct.setDelFlag(AppConstance.DATA_USEABLE);
shopProduct.setStatus(AppConstance.IS_PUTAWAY);
+ shopProduct.setAbleSales(ShopProduct.ABLE_SALES);
shopProduct.setCompanyId(HostInterceptor.getCompanyId());
- shopProduct.setAttrs(fxsc.getAttrId()+"");
List<ShopProduct> shopProducts = shopProductDao.selectByModelWx(shopProduct);
shopProducts.forEach(item->item.setSkus(shopSkuDao.selectByPid(item.getId())));
AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, shopProducts);
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java
index d2d94e3..7e81a21 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java
@@ -23,6 +23,7 @@
import com.matrix.system.fenxiao.dao.ShopSalesmanApplyDao;
import com.matrix.system.fenxiao.entity.ShopSalesmanApply;
import com.matrix.system.fenxiao.service.ShopSalesmanApplyService;
+import com.matrix.system.hive.plugin.util.CollectionUtils;
import com.matrix.system.shopXcx.api.WeChatApiTools;
import com.matrix.system.shopXcx.dao.ShopProductDao;
import com.matrix.system.shopXcx.vo.SalesmanApplyCondition;
@@ -294,9 +295,13 @@
case FenxiaoSettingConstant.FX_APPLY_CONDITION_XFZDCP:
applyConditionInfo.setCondition("消费指定产品并确认收货");
List<String> strings = StringUtils.strToColl(applyCondition.getParamValue1(), ",");
- applyConditionInfo.setProductList(
- shopProductDao.selectByIds(
- strings.stream().filter(i->StringUtils.isNotBlank(i)).map(i -> Integer.parseInt(i + "")).distinct().collect(Collectors.toList())));
+ List<Integer> ids = strings.stream().filter(i -> StringUtils.isNotBlank(i)).map(i -> Integer.parseInt(i + "")).distinct().collect(Collectors.toList());
+ if(CollectionUtils.isNotEmpty(ids)){
+ applyConditionInfo.setProductList(shopProductDao.selectByIds(ids));
+ }else{
+ return AjaxResult.buildFailInstance("未配置消费产品,请联系管理员");
+ }
+
break;
case FenxiaoSettingConstant.FX_APPLY_CONDITION_XFRYCP:
//判断用户是否有确认收货的产品
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxScoreProductAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxScoreProductAction.java
new file mode 100644
index 0000000..ebdc64d
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxScoreProductAction.java
@@ -0,0 +1,72 @@
+package com.matrix.system.shopXcx.api.action;
+
+import com.matrix.core.pojo.AjaxResult;
+import com.matrix.core.tools.StringUtils;
+import com.matrix.system.common.constance.AppConstance;
+import com.matrix.system.common.interceptor.HostInterceptor;
+import com.matrix.system.shopXcx.api.dto.SaleProductDto;
+import com.matrix.system.shopXcx.api.dto.ScoreProductDto;
+import com.matrix.system.shopXcx.bean.ShopProduct;
+import com.matrix.system.shopXcx.bean.ShopProductAttribute;
+import com.matrix.system.shopXcx.dao.ShopProductAttributeDao;
+import com.matrix.system.shopXcx.dao.ShopProductDao;
+import com.matrix.system.shopXcx.dao.ShopSkuDao;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author jyy
+ * @date 2021-03-10
+ **/
+@Api(tags = "积分商品类")
+@RestController
+@RequestMapping(value = "/wxapi/scoreProduct")
+public class WxScoreProductAction {
+
+ @Autowired
+ private ShopProductDao shopProductDao;
+
+ @Autowired
+ private ShopSkuDao shopSkuDao;
+
+ @Autowired
+ ShopProductAttributeDao shopProductAttributeDao;
+
+ @ApiOperation(value = "查询积分商品", notes = "")
+ @PostMapping(value = "/getScoreProductList")
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "ok", response=SaleProductDto.class)
+ })
+ public AjaxResult getShopProductShowList(@RequestBody @Validated ScoreProductDto scoreProductDto) {
+ ShopProduct shopProduct=new ShopProduct();
+ shopProduct.setLimit(scoreProductDto.getPageSize());
+ shopProduct.setOffset((scoreProductDto.getPageNum()-1)* scoreProductDto.getPageSize());
+ shopProduct.setScoreCategoryId(scoreProductDto.getScoreCategoryId());
+ shopProduct.setDelFlag(AppConstance.DATA_USEABLE);
+ shopProduct.setStatus(AppConstance.IS_PUTAWAY);
+ shopProduct.setAbleScorePay(ShopProduct.PAYFOR_SCORE);
+ shopProduct.setCompanyId(HostInterceptor.getCompanyId());
+ //根据属性查询
+ if(StringUtils.isNotBlank(scoreProductDto.getAttrCode())){
+ ShopProductAttribute jfscrmtj = shopProductAttributeDao.selectByCode("jfscrmtj", HostInterceptor.getCompanyId());
+ if(jfscrmtj!=null){
+ shopProduct.setAttrs(jfscrmtj.getAttrId()+"");
+ }
+ }
+ List<ShopProduct> shopProducts = shopProductDao.selectByModelWx(shopProduct);
+ shopProducts.forEach(item->item.setSkus(shopSkuDao.selectByPid(item.getId())));
+ return AjaxResult.buildSuccessInstance(shopProducts);
+ }
+
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java
index 3e3e4d5..8b408f8 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java
@@ -146,7 +146,6 @@
@ResponseBody
public AjaxResult getShopProductShowList(@RequestBody ShopProduct shopProduct) {
List<ShopProduct> shopProducts = null;
-
//查询是否匹配优惠条件
ShopCoupon shopCoupon = shopCouponDao.getCouponByTitle(shopProduct.getTitle(),HostInterceptor.getCompanyId());
if (shopCoupon != null && shopProduct.getOffset() < 1) {
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopScoreAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopScoreAction.java
index 5fc88e7..9dc6cea 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopScoreAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopScoreAction.java
@@ -1,104 +1,67 @@
package com.matrix.system.shopXcx.api.action;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.matrix.biz.bean.BizUser;
-import com.matrix.biz.service.BizUserService;
import com.matrix.component.redis.RedisUserLoginUtils;
import com.matrix.core.pojo.AjaxResult;
-import com.matrix.core.pojo.PaginationVO;
-import com.matrix.component.redis.RedisUserLoginUtils;
-import com.matrix.system.shopXcx.bean.ShopScoreExchange;
-import com.matrix.system.shopXcx.bean.ShopScoreRecord;
-import com.matrix.system.shopXcx.dao.ShopScoreExchangeDao;
-import com.matrix.system.shopXcx.dao.ShopScoreRecordDao;
+import com.matrix.system.score.dao.ScoreUseRecordDao;
+import com.matrix.system.score.dao.ScoreVipDetailDao;
+import com.matrix.system.shopXcx.api.dto.ScoreFlowDto;
+import com.matrix.system.shopXcx.api.vo.ScoreUseRecordVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import java.util.List;
+import org.springframework.web.bind.annotation.RestController;
/**
- * @description 用户积分控制器
* @author jyy
- * @date 2019-08-09 15:10
+ * @date 2021-03-22 15:10
*/
-@Controller
-@RequestMapping(value="/wxapi/shopScoreRecord")
-@CrossOrigin(origins = "*", maxAge = 3600)
+@Api(tags = "用户积分接口类")
+@RestController
+@RequestMapping(value = "/wxapi/score")
public class WxShopScoreAction {
- @Autowired
- private ShopScoreRecordDao shopScoreRecordDao;
- @Autowired
- private ShopScoreExchangeDao shopScoreExchangeDao;
- @Autowired
- private RedisUserLoginUtils redisUserLoginUtils;
- @Autowired
- private BizUserService bizUserService;
+ @Autowired
+ RedisUserLoginUtils redisUserLoginUtils;
+
+ @Autowired
+ ScoreUseRecordDao scoreUseRecordDao;
+
+ @Autowired
+ ScoreVipDetailDao scoreVipDetailDao;
+
+ @ApiOperation(value = "获取积分流水", notes = "")
+ @PostMapping(value = "/getFlowList")
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "ok", response = ScoreUseRecordVo.class)
+ })
+ AjaxResult getFlowList(@RequestBody @Validated ScoreFlowDto scoreFlowDto) {
+ BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class);
+ Page<ScoreUseRecordVo> page=new Page<>(scoreFlowDto.getPageNum(),scoreFlowDto.getPageSize());
+ scoreFlowDto.setUserId(loginUser.getOpenId());
+ IPage<ScoreUseRecordVo> shopScoreRecord = scoreUseRecordDao.selectFlowList(page, scoreFlowDto);
+ AjaxResult result=AjaxResult.buildSuccessInstance(shopScoreRecord.getRecords());
+ return result;
+ }
+
+ @ApiOperation(value = "获取用户积分", notes = "")
+ @PostMapping(value = "/getUserScore")
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "ok", response = AjaxResult.class)
+ })
+ AjaxResult getUserScore() {
+ BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class);
+ AjaxResult result=AjaxResult.buildSuccessInstance(scoreVipDetailDao.selectUserTotalScore(loginUser.getOpenId(),null));
+ return result;
+ }
- /**
- * 查询我的获得积分列表
- * @return
- */
- @RequestMapping(value = "/getRecordList")
- @ResponseBody
- public AjaxResult getRecordList(@RequestBody PaginationVO pageVo) {
-
- pageVo.setSort("create_time");
- pageVo.setOrder("desc");
- BizUser loginBizUser = redisUserLoginUtils.getLoginUser(BizUser.class);
- ShopScoreRecord params = new ShopScoreRecord();
- params.setBeneficiaryId(loginBizUser.getOpenId());
- List<ShopScoreRecord> dataList = shopScoreRecordDao.selectInPage(params, pageVo);
- int total = shopScoreRecordDao.selectTotalRecord(params);
- AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, total);
- //查询用户总积分
- BizUser user = bizUserService.findById(loginBizUser.getUserId());
- Integer totalScore = 0;
- if (user != null && user.getTotalScore() != null) {
- totalScore = user.getTotalScore();
- }
- result.putInMap("totalScore", totalScore);
- //查询下级总人数
- BizUser peopleSumParams = new BizUser();
- peopleSumParams.setParentOpenId(loginBizUser.getOpenId());
- int peopleSum = bizUserService.findTotal(peopleSumParams);
- result.putInMap("peopleSum", peopleSum);
- return result;
- }
-
-
- /**
- * 查询我的积分兑换列表
- * @return
- */
- @RequestMapping(value = "/getChangeRecordList")
- @ResponseBody
- public AjaxResult getChangeRecordList(@RequestBody PaginationVO pageVo) {
-
- //不分页
- pageVo.setOffset(null);
- pageVo.setLimit(null);
- //按生成时间倒序排列
- pageVo.setSort("create_time");
- pageVo.setOrder("desc");
- BizUser loginBizUser = redisUserLoginUtils.getLoginUser(BizUser.class);
- ShopScoreExchange params = new ShopScoreExchange();
- params.setUserId(loginBizUser.getOpenId());
- List<ShopScoreExchange> dataList = shopScoreExchangeDao.selectInPage(params, pageVo);
- int total = shopScoreExchangeDao.selectTotalRecord(params);
- AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, total);
- //查询用户当前积分
- BizUser user = bizUserService.findById(loginBizUser.getUserId());
- Integer currentScore = 0;
- if (user != null && user.getCurrentScore() != null) {
- currentScore = user.getCurrentScore();
- }
- result.putInMap("currentScore", currentScore);
- return result;
- }
-
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java
index 1afabd6..4508e1c 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java
@@ -1,25 +1,27 @@
package com.matrix.system.shopXcx.api.action;
+import com.matrix.biz.bean.BizUser;
+import com.matrix.component.redis.RedisUserLoginUtils;
import com.matrix.core.constance.SystemErrorCode;
import com.matrix.core.constance.SystemMessageCode;
import com.matrix.core.exception.GlobleException;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.StringUtils;
-import com.matrix.biz.bean.BizUser;
-import com.matrix.component.redis.RedisUserLoginUtils;
import com.matrix.system.common.constance.AppConstance;
-
-import com.matrix.system.shopXcx.bean.ShopShoppingCart;
-import com.matrix.system.shopXcx.bean.ShopSku;
-import com.matrix.system.shopXcx.dao.ShopShoppingCartDao;
-import com.matrix.system.shopXcx.dao.ShopSkuDao;
+import com.matrix.system.common.interceptor.HostInterceptor;
+import com.matrix.system.shopXcx.api.service.OrderCouponGroupService;
import com.matrix.system.shopXcx.api.service.ShoppingCartService;
import com.matrix.system.shopXcx.api.service.WxShopCouponService;
import com.matrix.system.shopXcx.api.vo.ShopCartBillVo;
import com.matrix.system.shopXcx.api.vo.ShopCartVo;
+import com.matrix.system.shopXcx.bean.ShopShoppingCart;
+import com.matrix.system.shopXcx.bean.ShopSku;
+import com.matrix.system.shopXcx.dao.ShopShoppingCartDao;
+import com.matrix.system.shopXcx.dao.ShopSkuDao;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
@@ -32,7 +34,8 @@
* @date 2019-06-12 19:15
*/
@CrossOrigin(origins = "*", maxAge = 3600)
-@Controller
+@Api(tags = "购物车类")
+@RestController
@RequestMapping(value = "wxapi/ShoppingCart")
public class WxShoppingCartAction {
@Autowired
@@ -49,13 +52,10 @@
@Autowired
ShopSkuDao skuDao;
+ @Autowired
+ OrderCouponGroupService orderCouponGroupService;
- /**
- * 根据ID删除购物车
- *
- * @param
- * @return
- */
+ @ApiOperation(value = "根据ID删除购物车", notes = "")
@PostMapping("/deleteByCartId/{cartId}")
@ResponseBody
public AjaxResult deleteByCartId(@PathVariable("cartId") Integer cartId) {
@@ -66,18 +66,17 @@
return new AjaxResult(AjaxResult.STATUS_SUCCESS, "删除成功");
}
- /**
- * 根据用户ID查询购物车 没有分页
- *
- * @param
- * @return
- */
+
+ @ApiOperation(value = "根据用户ID查询购物车 没有分页", notes = "")
@PostMapping("/findShoppingCart")
@ResponseBody
public AjaxResult getShoppingCartByUserId(@RequestBody ShopShoppingCart shoppingCart) {
- List<ShopCartVo> cartList = shoppingCartService.findUserCartList(shoppingCart.getShopId());
- AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, cartList, cartList.size());
- ShopCartBillVo shopCartBill = shoppingCartService.buildShopCartBillVo(cartList);
+ BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class);
+ String userId = loginUser.getOpenId();
+ List<ShopShoppingCart> list = shoppingCartDao.selectByCartUserId(shoppingCart.getShopId(),userId);
+ List<ShopCartVo> shopCartVoList = shoppingCartService.buildShopCart(list);
+ AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, shopCartVoList, shopCartVoList.size());
+ ShopCartBillVo shopCartBill = shoppingCartService.buildShopCartBillVo(shopCartVoList);
result.putInMap("billTotal", shopCartBill.getBillTotal().stripTrailingZeros().toPlainString());
result.putInMap("selectCount", shopCartBill.getSelectCount());
result.putInMap("cartCount", shopCartBill.getCartCount());
@@ -86,9 +85,8 @@
return result;
}
- /**
- * 批量删除
- */
+
+ @ApiOperation(value = "批量删除", notes = "")
@PostMapping(value = "/delShoppingCart/{keys}")
public
@ResponseBody
@@ -102,6 +100,7 @@
}
}
+ @ApiOperation(value = "查询微商城购物车数量", notes = "")
@PostMapping(value = "/getUserCartCount/{shopId}")
public
@ResponseBody
@@ -125,9 +124,9 @@
AjaxResult saveShoppingCart(@RequestBody ShopShoppingCart shoppingCart) {
//查询到sku设置对应的产品id
- ShopSku sku= skuDao.selectById(shoppingCart.getCartSkuId());
- if(sku==null){
- return new AjaxResult(AjaxResult.STATUS_FAIL,"无效的产品id");
+ ShopSku sku = skuDao.selectById(shoppingCart.getCartSkuId());
+ if (sku == null) {
+ return new AjaxResult(AjaxResult.STATUS_FAIL, "无效的产品id");
}
shoppingCart.setCartProductId(sku.getpId());
@@ -136,6 +135,7 @@
shoppingCart.setCreateBy(loginUser.getOpenId());
shoppingCart.setUpdateBy(loginUser.getOpenId());
shoppingCart.setCartUserId(loginUser.getOpenId());
+ shoppingCart.setCompanyId(HostInterceptor.getCompanyId());
ShopShoppingCart shoppCartLimt = shoppingCartDao.selectBuyLimit(shoppingCart.getCartProductId(),
shoppingCart.getCartSkuId());
// Integer buyLimitNum = 0;
@@ -258,7 +258,7 @@
* @param
* @return
*/
- @RequestMapping("/updateCartSelected")
+ @PostMapping("/updateCartSelected")
@ResponseBody
public AjaxResult updateCartSelected(@RequestBody ShopShoppingCart shoppingCart) {
Map<String, Object> modifyMap = new HashMap<>();
@@ -274,13 +274,12 @@
* @param
* @return
*/
- @RequestMapping("/updateCartAllSelected/{shopId}/{isSelected}")
+ @PostMapping("/updateCartAllSelected/{shopId}/{isSelected}")
@ResponseBody
public AjaxResult updateCartAllSelected(@PathVariable("isSelected") Integer isSelected,
@PathVariable("shopId") Long shopId) {
- Map<String, Object> modifyMap = new HashMap<>();
BizUser user = redisUserLoginUtils.getLoginUser(BizUser.class);
- shoppingCartDao.updateAllSelected(user.getOpenId(),shopId, isSelected);
+ shoppingCartDao.updateAllSelected(user.getOpenId(), shopId, isSelected);
return new AjaxResult(AjaxResult.STATUS_SUCCESS, "修改成功");
}
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
index a428860..e34da97 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
@@ -168,7 +168,16 @@
// TODO 赋值操作
int i = bizUserService.saveUserInfo(bizUser);
+ checkNeedToBeSalesman(bizUser, loginUser);
+ if (i == 0) {
+ return new AjaxResult(AjaxResult.STATUS_FAIL, "更新失败");
+ }
+ return new AjaxResult(AjaxResult.STATUS_SUCCESS, Collections.singletonList(bizUser));
+ }
+
+
+ void checkNeedToBeSalesman(BizUser bizUser, BizUser loginUser) {
//查询是否需要自动成为分销员
if ((loginUser.getIsSales() == null || loginUser.getIsSales() == 2)
&& StringUtils.isNotBlank(bizUser.getNickName())) {//目前还不是分销员
@@ -181,15 +190,16 @@
queryWrapper.eq("apply_status", ShopSalesmanApply.APPLY_STATUS_DSH);
ShopSalesmanApply shopSalesmanApply = salesmanApplyDao.selectOne(queryWrapper);
if (shopSalesmanApply == null) {//没有待审核记录
- shopSalesmanApplyService.applyToBeAnSalesman(loginUser.getOpenId(), null, null, 2);
+ try {
+ shopSalesmanApplyService.applyToBeAnSalesman(loginUser.getOpenId(), null, null, 2);
+ }catch (Exception e){
+ LogUtil.debug(e.getMessage());
+ }
+
}
}
}
}
- if (i == 0) {
- return new AjaxResult(AjaxResult.STATUS_FAIL, "更新失败");
- }
- return new AjaxResult(AjaxResult.STATUS_SUCCESS, Collections.singletonList(bizUser));
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreFlowDto.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreFlowDto.java
new file mode 100644
index 0000000..b1a94b3
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreFlowDto.java
@@ -0,0 +1,26 @@
+package com.matrix.system.shopXcx.api.dto;
+
+import com.matrix.core.pojo.BasePageQueryDto;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Data
+@ApiModel(value = "ScoreFlowDto", description = "积分流水查询参数接收类")
+public class ScoreFlowDto extends BasePageQueryDto {
+
+ @NotNull(message = "查询月份不能为空")
+ @ApiModelProperty(value = "查询月份",example = "2021-03")
+ private String queryTime;
+
+
+ @ApiModelProperty(value = "收支类型 不传全部,1,收入,2支出", example = "1")
+ private Integer revenueType;
+
+ @ApiModelProperty(hidden = true)
+ private String userId;
+
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreProductDto.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreProductDto.java
new file mode 100644
index 0000000..cbb8a51
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreProductDto.java
@@ -0,0 +1,20 @@
+package com.matrix.system.shopXcx.api.dto;
+
+import com.matrix.core.pojo.BasePageQueryDto;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "ScoreProductDto", description = "积分产品查询参数接收类")
+public class ScoreProductDto extends BasePageQueryDto {
+
+ @ApiModelProperty(value = "产品分类", example = "1")
+ private Integer scoreCategoryId;
+
+
+ @ApiModelProperty(value = "属性编码", example = "jfscrmtj")
+ private String attrCode;
+
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/AddShopOrderPOJO.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/AddShopOrderPOJO.java
deleted file mode 100644
index 3398072..0000000
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/AddShopOrderPOJO.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.matrix.system.shopXcx.api.pojo;
-
-import java.util.List;
-
-/**
- * @author jyy
- */
-public class AddShopOrderPOJO {
-
-
- /**
- * 收货地址ID
- */
- private Integer receiveAddrId;
-
- /**
- * 配送方式(1=物流,2=门店自取)
- */
- private String deliverySelect;
-
- /**
- * 配送门店ID
- */
- private Long shopId;
-
- /**
- * 优惠券记录id
- */
- private Integer couponReceiveId;
-
-
-
- /**
- * 订单备注
- */
- private String remarks;
-
- /**
- * 购买商品规格列表详情
- */
- private List<OrderProductSkuPOJO> skuList;
-
-
- public Integer getReceiveAddrId() {
- return receiveAddrId;
- }
-
- public void setReceiveAddrId(Integer receiveAddrId) {
- this.receiveAddrId = receiveAddrId;
- }
-
- public String getDeliverySelect() {
- return deliverySelect;
- }
-
- public void setDeliverySelect(String deliverySelect) {
- this.deliverySelect = deliverySelect;
- }
-
- public Long getShopId() {
- return shopId;
- }
-
- public void setShopId(Long shopId) {
- this.shopId = shopId;
- }
-
- public Integer getCouponReceiveId() {
- return couponReceiveId;
- }
-
- public void setCouponReceiveId(Integer couponReceiveId) {
- this.couponReceiveId = couponReceiveId;
- }
-
- public String getRemarks() {
- return remarks;
- }
-
- public void setRemarks(String remarks) {
- this.remarks = remarks;
- }
-
- public List<OrderProductSkuPOJO> getSkuList() {
- return skuList;
- }
-
- public void setSkuList(List<OrderProductSkuPOJO> skuList) {
- this.skuList = skuList;
- }
-}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/CalculatePostagePOJO.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/CalculatePostagePOJO.java
index ca95377..ccf8fef 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/CalculatePostagePOJO.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/CalculatePostagePOJO.java
@@ -19,7 +19,7 @@
/**
* 购买规格信息列表
*/
- private List<OrderProductSkuPOJO> skuList;
+ private List<OrderItemDto> skuList;
public Integer getAddrId() {
@@ -38,11 +38,11 @@
this.couponId = couponId;
}
- public List<OrderProductSkuPOJO> getSkuList() {
+ public List<OrderItemDto> getSkuList() {
return skuList;
}
- public void setSkuList(List<OrderProductSkuPOJO> skuList) {
+ public void setSkuList(List<OrderItemDto> skuList) {
this.skuList = skuList;
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/OrderCouponGroup.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/OrderCouponGroup.java
new file mode 100644
index 0000000..7de34e4
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/OrderCouponGroup.java
@@ -0,0 +1,43 @@
+package com.matrix.system.shopXcx.api.pojo;
+
+import com.matrix.system.shopXcx.api.vo.CouponReceiveInfoVO;
+import com.matrix.system.shopXcx.bean.ShopCoupon;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 购物车前台展示对象
+ */
+@Data
+public class OrderCouponGroup {
+
+ private ShopCoupon coupon;
+
+ //是否满足优惠
+ private boolean satisfactionCoupon;
+
+ private List<OrderItemDto> orderItemDtos;
+
+ //提示语
+ private String msg="";
+
+ //优惠小计金额
+ private BigDecimal subtotal=BigDecimal.ZERO;
+
+ //原价
+ private BigDecimal srcPrice=BigDecimal.ZERO;
+
+ //优惠金额
+ private BigDecimal couponPrice=BigDecimal.ZERO;
+ /**
+ * 抵用积分
+ */
+ private BigDecimal scorePay = BigDecimal.ZERO;
+
+ private CouponReceiveInfoVO couponReceiveInfoVO;
+
+
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/OrderItemDto.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/OrderItemDto.java
new file mode 100644
index 0000000..de86b06
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/OrderItemDto.java
@@ -0,0 +1,47 @@
+package com.matrix.system.shopXcx.api.pojo;
+
+import com.matrix.system.shopXcx.bean.ShopCoupon;
+import com.matrix.system.shopXcx.bean.ShopProduct;
+import com.matrix.system.shopXcx.bean.ShopSku;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author jyy
+ */
+@Data
+public class OrderItemDto {
+ /**
+ * 产品ID
+ */
+ private Integer productId;
+ /**
+ * 产品规格ID
+ */
+ private Integer skuId;
+
+ private ShopProduct shopProduct;
+
+ private ShopSku shopSku;
+
+ /**
+ * 购买数量
+ */
+ private Integer count;
+
+ /**
+ * 支付方式1 直接购买 2,积分兑换
+ */
+ private Integer payType;
+
+ /**
+ * 购物车id
+ */
+ private Integer cartId;
+
+
+ private List<ShopCoupon> shopCoupons;
+
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/OrderProductSkuPOJO.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/OrderProductSkuPOJO.java
deleted file mode 100644
index 3e0b92b..0000000
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/OrderProductSkuPOJO.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.matrix.system.shopXcx.api.pojo;
-
-/**
- * @author jyy
- */
-public class OrderProductSkuPOJO {
-
- /**
- * 产品规格ID
- */
- private Integer skuId;
-
- /**
- * 购买数量
- */
- private Integer count;
-
-
- public Integer getSkuId() {
- return skuId;
- }
-
- public void setSkuId(Integer skuId) {
- this.skuId = skuId;
- }
-
- public Integer getCount() {
- return count;
- }
-
- public void setCount(Integer count) {
- this.count = count;
- }
-}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/ShopOrderDto.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/ShopOrderDto.java
new file mode 100644
index 0000000..ad131b4
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/pojo/ShopOrderDto.java
@@ -0,0 +1,52 @@
+package com.matrix.system.shopXcx.api.pojo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author jyy
+ */
+@Data
+public class ShopOrderDto {
+
+
+ public static final Integer JOIN_ACTIVE = 1;
+ /**
+ * 收货地址ID
+ */
+ private Integer receiveAddrId;
+
+ /**
+ * 配送方式(1=物流,2=门店自取)
+ */
+ private String deliverySelect;
+
+ /**
+ * 配送门店ID
+ */
+ private Long shopId;
+
+ /**
+ * 优惠券记录id
+ */
+ private Integer couponReceiveId;
+
+ /**
+ * 参加店铺活动 1参加 2不参加
+ */
+ private Integer joinActive;
+
+
+
+ /**
+ * 订单备注
+ */
+ private String remarks;
+
+ /**
+ * 购买商品规格列表详情
+ */
+ private List<OrderItemDto> orderItemList;
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/OrderCouponGroupService.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/OrderCouponGroupService.java
new file mode 100644
index 0000000..8519518
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/OrderCouponGroupService.java
@@ -0,0 +1,282 @@
+package com.matrix.system.shopXcx.api.service;
+
+import com.matrix.component.redis.RedisUserLoginUtils;
+import com.matrix.core.exception.GlobleException;
+import com.matrix.core.tools.LogUtil;
+import com.matrix.system.common.dao.BusParameterSettingsDao;
+import com.matrix.system.shopXcx.api.pojo.OrderCouponGroup;
+import com.matrix.system.shopXcx.api.pojo.OrderItemDto;
+import com.matrix.system.shopXcx.bean.ShopCoupon;
+import com.matrix.system.shopXcx.bean.ShopShoppingCart;
+import com.matrix.system.shopXcx.dao.ShopProductDao;
+import com.matrix.system.shopXcx.dao.ShopShoppingCartDao;
+import com.matrix.system.shopXcx.dao.ShopSkuDao;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+/**
+ * 购物车前台展示对象
+ */
+@Service
+public class OrderCouponGroupService {
+ @Autowired
+ private ShopShoppingCartDao shoppingCartDao;
+ @Autowired
+ private RedisUserLoginUtils redisUserLoginUtils;
+
+ @Autowired
+ WxShopCouponService shopCouponService;
+
+ @Autowired
+ BusParameterSettingsDao busParameterSettingsDao;
+
+ @Autowired
+ ShopProductDao shopProductDao;
+
+ @Autowired
+ ShopSkuDao shopSkuDao;
+
+ /**
+ * 初始化OrderCouponElement
+ * @param skuId
+ * @param count
+ * @param payType
+ * @return
+ */
+ public OrderItemDto buildOrderCouponElement(OrderItemDto orderItemDto){
+ orderItemDto.setShopSku(shopSkuDao.selectById(orderItemDto.getSkuId()));
+ orderItemDto.setShopProduct(shopProductDao.selectById(orderItemDto.getProductId()));
+ return orderItemDto;
+ }
+
+ /**
+ * 计算用户的产品可以参与的店铺优惠活动分组
+ */
+ public List<OrderCouponGroup> buildOrderCouponGroupList(List<OrderItemDto> list) {
+
+ //定义购物车优惠分组
+ List<OrderCouponGroup> orderCouponGroupList = new ArrayList<>();
+ // 1表示没有优惠的默认分组
+ OrderCouponGroup def = new OrderCouponGroup();
+ def.setSatisfactionCoupon(true);
+ def.setMsg("商城");
+ def.setOrderItemDtos(new ArrayList<>());
+ // 组合默认分组
+ orderCouponGroupList.add(def);
+
+ // 记录所有优惠券,一个优惠券(活动)表示一组
+ Map<Integer, ShopCoupon> shopCouponMap = new HashMap<>();
+
+ //查询购物车中的产品匹配上的所有优惠活动
+ for (OrderItemDto orderItemDto : list) {
+
+ if(orderItemDto.getPayType()== ShopShoppingCart.CAR_TYPE_SCORE){
+ // 积分兑换产品不参加优惠
+ def.getOrderItemDtos().add(orderItemDto);
+ }else{
+ List<ShopCoupon> shopCouponList = shopCouponService.getHdListByProductId(orderItemDto.getProductId());
+ if (CollectionUtils.isNotEmpty(shopCouponList)) {
+ // 把所有的优惠券和购物车条目先关联一下,后续可以计算优惠升级的情况
+ orderItemDto.setShopCoupons(shopCouponList);
+ for (ShopCoupon shopCoupon : shopCouponList) {
+ shopCouponMap.put(shopCoupon.getId(), shopCoupon);
+ }
+ } else {
+ // 该产品没有参加优惠券
+ def.getOrderItemDtos().add(orderItemDto);
+ }
+ }
+
+ }
+
+ //计算没有优惠组的价格
+ countPrice(def);
+
+
+ /*
+ * 计算优惠券分组 1、获取到所有的优惠券,从最高满减开始,找寻合适的产品,找到后加入对应的购物车组
+ * 2、计算组内价格
+ */
+ Set<Integer> keys = shopCouponMap.keySet();
+ List<ShopCoupon> allShopCoupons = new ArrayList<>();
+ for (Integer key : keys) {
+ allShopCoupons.add(shopCouponMap.get(key));
+ }
+
+ //根据优惠力度排序,优惠力度大的先参与计算
+ Collections.sort(allShopCoupons, new Comparator() {
+ @Override
+ public int compare(Object o1, Object o2) {
+ ShopCoupon e1 = (ShopCoupon) o1;
+ ShopCoupon e2 = (ShopCoupon) o2;
+ return e2.getMinAmount().compareTo(e1.getMinAmount());
+ }
+ });
+
+
+ // 进行购物车和优惠券的匹配,匹配成功的加入到优惠组中,
+ for (int i = 0; i < allShopCoupons.size(); i++) {
+ ShopCoupon shopCoupon = allShopCoupons.get(i);
+ OrderCouponGroup shopCarVo = new OrderCouponGroup();
+ shopCarVo.setCoupon(shopCoupon);
+ shopCarVo.setOrderItemDtos(new ArrayList<>());
+ orderCouponGroupList.add(i, shopCarVo);
+
+ // 获取所有购物车条目
+ for (OrderItemDto orderItemDto : list) {
+ // 如果匹配到的产品已经出现在其他优惠组中,则需要判断是否移除之前的组
+ boolean needRemove = false;
+
+ // 判断当前购物车条目是否已经在合适的组里了
+ if (isInGroupAndSatisfaction(orderItemDto, orderCouponGroupList)) {
+ continue;
+
+ } else if (isInGroupNotSatisfaction(orderItemDto, orderCouponGroupList)) {
+ needRemove = true;
+ }
+
+ List<ShopCoupon> cartCouons = orderItemDto.getShopCoupons();
+ if (cartCouons != null) {
+ // 获取每个购物车条目满足的优惠
+ for (ShopCoupon cartCouon : cartCouons) {
+ if (cartCouon.getId().equals(shopCoupon.getId())) {
+ //匹配成功,加入本组
+ LogUtil.debug("购物车" + orderItemDto.getProductId() + "和优惠券" + cartCouon.getCName() + "匹配");
+ if (needRemove) {
+ removeNotSatisfaction(orderItemDto, orderCouponGroupList);
+ }
+ shopCarVo.getOrderItemDtos().add(orderItemDto);
+ break;
+ }
+ }
+ }
+
+ }
+
+ // 计算本组优惠券是否已经满足优惠条件
+ countPrice(shopCarVo);
+ }
+
+
+ // 因为有些优惠中可能没有产品,所以要去除cartList中没有产品的分组
+ List<OrderCouponGroup> cartListCopy = new ArrayList<>();
+ for (OrderCouponGroup orderCouponGroup : orderCouponGroupList) {
+ if (CollectionUtils.isNotEmpty(orderCouponGroup.getOrderItemDtos())) {
+ cartListCopy.add(orderCouponGroup);
+ }
+ }
+ return cartListCopy;
+ }
+
+
+ /**
+ * 购车条目在组中并且组是否已经满足优惠的
+ *
+ * @param cartList
+ * @return
+ */
+ private boolean isInGroupAndSatisfaction(OrderItemDto orderItemDto, List<OrderCouponGroup> cartList) {
+ boolean result = false;
+ for (OrderCouponGroup cartVo : cartList) {
+ if (cartVo.isSatisfactionCoupon() && cartVo.getOrderItemDtos().contains(orderItemDto)) {
+ result = true;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * 购物车条目在组中,但是组中产品没有达到优惠条件
+ * @param cartList
+ * @return
+ */
+ private boolean isInGroupNotSatisfaction(OrderItemDto orderItemDto, List<OrderCouponGroup> cartList) {
+ boolean result = false;
+ for (OrderCouponGroup cartVo : cartList) {
+ if (!cartVo.isSatisfactionCoupon() && cartVo.getOrderItemDtos().contains(orderItemDto)) {
+ result = true;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * 删除购物车条目所在分组中的引用
+ *
+ * @param cartList
+ */
+ private void removeNotSatisfaction(OrderItemDto orderItemDto, List<OrderCouponGroup> cartList) {
+ for (OrderCouponGroup cartVo : cartList) {
+ if (cartVo.getOrderItemDtos().remove(orderItemDto)) {
+ LogUtil.debug("删除购物车所在组" + cartVo.getCoupon().getCName() + "," + orderItemDto.getProductId());
+ }
+ }
+ }
+
+ /**
+ * 计算购物车价格和优惠信息
+ *
+ * @author JIANGYOUYAO
+ * @email 935090232@qq.com
+ * @date 2019年8月27日
+ */
+ private void countPrice(OrderCouponGroup orderCouponGroup) {
+ List<OrderItemDto> orderItemDtoList = orderCouponGroup.getOrderItemDtos();
+ // 计算总价
+ BigDecimal sum = BigDecimal.ZERO;
+ //抵扣总积分
+ BigDecimal scoreSum = BigDecimal.ZERO;
+
+ for (OrderItemDto orderCouponElement : orderItemDtoList) {
+ if(ShopShoppingCart.CAR_TYPE_MICRO==orderCouponElement.getPayType()){
+ //直接购买
+ sum = sum.add(orderCouponElement.getShopSku().getPrice().multiply(BigDecimal.valueOf(orderCouponElement.getCount())));
+
+ }else if(ShopShoppingCart.CAR_TYPE_SCORE==orderCouponElement.getPayType()){
+ //积分兑换
+ sum = sum.add(orderCouponElement.getShopSku().getScorePrice().multiply(BigDecimal.valueOf(orderCouponElement.getCount())));
+ scoreSum = scoreSum.add(new BigDecimal(orderCouponElement.getShopSku().getScoreCount() * orderCouponElement.getCount()));
+ }else{
+ throw new GlobleException("参数错误");
+ }
+ }
+
+ if (orderCouponGroup.getCoupon() != null) {
+ // 存在优惠券
+ if (sum.compareTo(orderCouponGroup.getCoupon().getMinAmount()) >= 0) {
+ //标记为合理分组
+ orderCouponGroup.setSatisfactionCoupon(true);
+ if (sum.compareTo(orderCouponGroup.getCoupon().getMinAmount()) >= 0) {
+ orderCouponGroup.setSubtotal(sum.subtract(orderCouponGroup.getCoupon().getOffsetAmount()));
+ orderCouponGroup.setSrcPrice(sum);
+ orderCouponGroup.setCouponPrice(orderCouponGroup.getCoupon().getOffsetAmount());
+ orderCouponGroup.setMsg(orderCouponGroup.getCoupon().getCName() + ",已优惠"
+ + orderCouponGroup.getCoupon().getOffsetAmount().stripTrailingZeros().toPlainString() + "元");
+ }
+ }
+ if (sum.compareTo(orderCouponGroup.getCoupon().getMinAmount()) < 0) {
+ orderCouponGroup.setSatisfactionCoupon(false);
+ orderCouponGroup.setSubtotal(sum);
+ orderCouponGroup.setSrcPrice(sum);
+ orderCouponGroup.setMsg(orderCouponGroup.getCoupon().getCName());
+ if (sum.doubleValue() > 0) {
+ orderCouponGroup.setMsg(orderCouponGroup.getCoupon().getCName() + ",再买"
+ + (orderCouponGroup.getCoupon().getMinAmount().subtract(sum)).stripTrailingZeros()
+ .toPlainString()
+ + "元立减" + orderCouponGroup.getCoupon().getOffsetAmount().stripTrailingZeros().toPlainString()
+ + "元");
+ }
+ }
+ } else {
+ orderCouponGroup.setSubtotal(sum);
+ orderCouponGroup.setSrcPrice(sum);
+ orderCouponGroup.setSatisfactionCoupon(true);
+ }
+ orderCouponGroup.setScorePay(scoreSum);
+ }
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java
index 5180721..ba08465 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java
@@ -1,6 +1,5 @@
package com.matrix.system.shopXcx.api.service;
-import com.matrix.biz.bean.BizUser;
import com.matrix.component.redis.RedisUserLoginUtils;
import com.matrix.core.tools.LogUtil;
import com.matrix.system.common.dao.BusParameterSettingsDao;
@@ -32,15 +31,11 @@
@Autowired
BusParameterSettingsDao busParameterSettingsDao;
-
+ //计算购车选中项总价以及优惠金额
public ShopCartBillVo buildShopCartBillVo(List<ShopCartVo> cartList) {
ShopCartBillVo shopCartBillVo = new ShopCartBillVo();
- //计算购车选中项总价以及优惠金额
- BigDecimal billTotal = BigDecimal.ZERO;
- BigDecimal billCouponTotal = BigDecimal.ZERO;
- //未优惠之前的金额
- BigDecimal srcTotal = BigDecimal.ZERO;
+
//计算是否存在选中的产品
Integer selectCount = 0;
@@ -59,8 +54,6 @@
shopCartBillVo.setBillCouponTotal(shopCartBillVo.getBillCouponTotal().add(shopCartVo.getCouponPrice()));
}
}
-
-
for (ShopShoppingCart shopCart : shopCartVo.getCartList()) {
if (shopCart.getIsSelected() == 1) {
selectCount += shopCart.getCartNumber();
@@ -73,19 +66,7 @@
return shopCartBillVo;
}
- /**
- * 计算用户的购物车产品优惠分组
- *
- * @return
- * @param shopId
- */
- public List<ShopCartVo> findUserCartList(Long shopId) {
- BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class);
- String userId = loginUser.getOpenId();
- List<ShopShoppingCart> list = shoppingCartDao.selectByCartUserId(shopId,userId);
- List<ShopCartVo> cartList = buildShopCart(list);
- return cartList;
- }
+
/**
@@ -95,7 +76,7 @@
* @return
*/
@SuppressWarnings("unchecked")
- private List<ShopCartVo> buildShopCart(List<ShopShoppingCart> list) {
+ public List<ShopCartVo> buildShopCart(List<ShopShoppingCart> list) {
//定义购物车优惠分组
@@ -275,8 +256,14 @@
for (ShopShoppingCart shopShoppingCart : cartList) {
sum = sum.add(shopShoppingCart.getPrice().multiply(BigDecimal.valueOf(shopShoppingCart.getCartNumber())));
if (shopShoppingCart.getIsSelected() == 1) {
- selectSum = selectSum
- .add(shopShoppingCart.getPrice().multiply(BigDecimal.valueOf(shopShoppingCart.getCartNumber())));
+ if(shopShoppingCart.getCartType()==ShopShoppingCart.CAR_TYPE_MICRO){
+ selectSum = selectSum
+ .add(shopShoppingCart.getPrice().multiply(BigDecimal.valueOf(shopShoppingCart.getCartNumber())));
+ }else {
+ selectSum = selectSum
+ .add(shopShoppingCart.getScorePrice().multiply(BigDecimal.valueOf(shopShoppingCart.getCartNumber())));
+ }
+
}
}
@@ -307,9 +294,9 @@
}
}
} else {
- shopCartVo.setSubtotal(selectSum);
- shopCartVo.setSrcPrice(selectSum);
- shopCartVo.setSatisfactionCoupon(true);
+ shopCartVo.setSubtotal(selectSum);
+ shopCartVo.setSrcPrice(selectSum);
+ shopCartVo.setSatisfactionCoupon(true);
}
}
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WXShopOrderService.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WXShopOrderService.java
index 3dabe15..da0f5e4 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WXShopOrderService.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WXShopOrderService.java
@@ -1,15 +1,12 @@
package com.matrix.system.shopXcx.api.service;
-import com.matrix.core.pojo.AjaxResult;
import com.matrix.component.wechat.externalInterface.protocol.paramProtocol.BrandWCPayRequestData;
-import com.matrix.system.shopXcx.bean.ShopOrder;
-import com.matrix.system.shopXcx.dto.DiscountExplain;
-import com.matrix.system.shopXcx.api.pojo.AddShopOrderPOJO;
+import com.matrix.core.pojo.AjaxResult;
import com.matrix.system.shopXcx.api.pojo.OrderInfoQueryPOJO;
-import com.matrix.system.shopXcx.api.vo.ShopCartVo;
+import com.matrix.system.shopXcx.api.pojo.ShopOrderDto;
+import com.matrix.system.shopXcx.bean.ShopOrder;
import java.math.BigDecimal;
-import java.util.List;
/**
* @author jyy
@@ -22,11 +19,11 @@
/**
* 创建订单
- * @param addShopOrderPOJO
+ * @param shopOrderDto
* @return
* @throws Exception
*/
- AjaxResult createShopOrder(AddShopOrderPOJO addShopOrderPOJO) throws Exception;
+ AjaxResult createShopOrder(ShopOrderDto shopOrderDto) throws Exception;
/**
* 订单结算
@@ -93,5 +90,5 @@
*/
AjaxResult updateStockAndVolumeById(Integer orderId);
- DiscountExplain buildDiscountExplain(List<ShopCartVo> cartList, Integer id, Long companyId);
+ AjaxResult buildDiscountExplain(ShopOrderDto shopOrderDto);
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WxShopCouponService.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WxShopCouponService.java
index 13d6e99..fd92862 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WxShopCouponService.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WxShopCouponService.java
@@ -2,9 +2,9 @@
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.pojo.PaginationVO;
-import com.matrix.system.shopXcx.bean.ShopCoupon;
-import com.matrix.system.shopXcx.bean.ShopShoppingCart;
+import com.matrix.system.shopXcx.api.pojo.OrderItemDto;
import com.matrix.system.shopXcx.api.vo.CouponReceiveInfoVO;
+import com.matrix.system.shopXcx.bean.ShopCoupon;
import java.util.List;
@@ -18,7 +18,7 @@
* 根据购物车选中的产品
* @return
*/
- public List<CouponReceiveInfoVO> getCartVoCouponList(Long companyId,List<ShopShoppingCart> shopShoppingCarts);
+ public List<CouponReceiveInfoVO> getCartVoCouponList(Long companyId,List<OrderItemDto> OrderItemDtos);
/**
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
index dce9db6..70bb8d6 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
@@ -1,5 +1,6 @@
package com.matrix.system.shopXcx.api.service.impl;
+import cn.hutool.core.collection.CollUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.matrix.biz.bean.BizUser;
@@ -11,26 +12,25 @@
import com.matrix.core.exception.GlobleException;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.LogUtil;
-import com.matrix.core.tools.StringUtils;
import com.matrix.system.common.bean.BusParameterSettings;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.common.dao.CustomerDataDictionaryDao;
import com.matrix.system.common.interceptor.HostInterceptor;
-import com.matrix.system.constance.Dictionary;
-import com.matrix.system.hive.bean.ShoppingGoods;
import com.matrix.system.hive.dao.ShoppingGoodsDao;
+import com.matrix.system.score.dao.ScoreVipDetailDao;
import com.matrix.system.shopXcx.api.action.PayThreadPool;
-import com.matrix.system.shopXcx.api.pojo.AddShopOrderPOJO;
+import com.matrix.system.shopXcx.api.pojo.OrderCouponGroup;
import com.matrix.system.shopXcx.api.pojo.OrderInfoQueryPOJO;
+import com.matrix.system.shopXcx.api.pojo.OrderItemDto;
+import com.matrix.system.shopXcx.api.pojo.ShopOrderDto;
+import com.matrix.system.shopXcx.api.service.OrderCouponGroupService;
import com.matrix.system.shopXcx.api.service.ShoppingCartService;
import com.matrix.system.shopXcx.api.service.WXShopOrderService;
import com.matrix.system.shopXcx.api.service.WxShopCouponService;
import com.matrix.system.shopXcx.api.tools.WxShopCouponUtil;
import com.matrix.system.shopXcx.api.tools.WxShopOrderUtil;
import com.matrix.system.shopXcx.api.vo.CouponReceiveInfoVO;
-import com.matrix.system.shopXcx.api.vo.ShopCartBillVo;
-import com.matrix.system.shopXcx.api.vo.ShopCartVo;
import com.matrix.system.shopXcx.bean.*;
import com.matrix.system.shopXcx.dao.*;
import com.matrix.system.shopXcx.dto.DiscountExplain;
@@ -42,6 +42,7 @@
import java.math.BigDecimal;
import java.util.*;
+import java.util.stream.Collectors;
/**
* @author jyy
@@ -90,6 +91,9 @@
private ShopActivitiesGroupJoinUserDao shopActivitiesGroupJoinUserDao;
@Autowired
+ OrderCouponGroupService orderCouponGroupService;
+
+ @Autowired
CustomerDataDictionaryDao dataDictionaryDao;
@Value("${wx_pay_debug_onoff}")
private boolean isDebug;
@@ -97,110 +101,90 @@
@Autowired
private BusParameterSettingsDao busParameterSettingsDao;
+ @Autowired
+ private ScoreVipDetailDao scoreVipDetailDao;
+
@Override
- public BigDecimal calculationPostage(BigDecimal payPrice,Long companyId) {
+ public BigDecimal calculationPostage(BigDecimal payPrice, Long companyId) {
BigDecimal postage = BigDecimal.ZERO;
BusParameterSettings yf = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.PACKAGE_PRICE, companyId);
BusParameterSettings myje = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.FREE_PACKAGE_PRICE, companyId);
- if(yf!=null&&myje!=null){
+ if (yf != null && myje != null) {
if (Double.parseDouble(myje.getParamValue()) > payPrice.doubleValue()) {
postage = new BigDecimal(yf.getParamValue());
}
}
-
return postage;
}
-
-
/**
* 创建订单
*
- * @param addShopOrderPOJO
+ * @param shopOrderDto
* @return
* @throws Exception
*/
@Transactional(rollbackFor = Exception.class)
@Override
- public AjaxResult createShopOrder(AddShopOrderPOJO addShopOrderPOJO) throws Exception {
+ public AjaxResult createShopOrder(ShopOrderDto shopOrderDto) throws Exception {
BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class);
//校验收货地址
- ShopReceiveAddress shopReceiveAddress = shopReceiveAddressDao.selectById(addShopOrderPOJO.getReceiveAddrId());
+ ShopReceiveAddress shopReceiveAddress = shopReceiveAddressDao.selectById(shopOrderDto.getReceiveAddrId());
if (shopReceiveAddress == null) {
return new AjaxResult(AjaxResult.STATUS_FAIL, "请选择正确的收获地址");
}
+ //计算订单优惠信息
+ AjaxResult caculateResult= buildDiscountExplain(shopOrderDto);
+ DiscountExplain discountExplain= (DiscountExplain) caculateResult.getMapInfo().get("discountExplain");
- List<ShopCartVo> cartList = shoppingCartService.findUserCartList(addShopOrderPOJO.getShopId());
- //购物车不能为空
- if (CollectionUtils.isEmpty(cartList)) {
- return new AjaxResult(AjaxResult.STATUS_FAIL, "请选择您需要购买的产品");
- }
-
-
- //取出购物车中选中的产品
- List<ShopShoppingCart> buyCart = new ArrayList<>();
- //取出购物车中没有参加店铺活动的产品,和参加了店铺活动但是活动没有达到标准的产品,用来计算是否可以使用优惠券
- List<ShopShoppingCart> notCouponuyCart = new ArrayList<>();
- for (ShopCartVo shopCartVo : cartList) {
- for (ShopShoppingCart shopShoppingCart : shopCartVo.getCartList()) {
- if (shopShoppingCart.getIsSelected() == 1) {
- buyCart.add(shopShoppingCart);
- if (shopCartVo.getCoupon() == null || !shopCartVo.isSatisfactionCoupon()) {
- notCouponuyCart.add(shopShoppingCart);
- }
- }
+ if(discountExplain.getScorePay()!=null){
+ //校验用户积分是否够用
+ int score=scoreVipDetailDao.selectUserTotalScore(bizUser.getOpenId(),null);
+ if(score<discountExplain.getScorePay()){
+ return AjaxResult.buildFailInstance("积分不足");
}
}
- //计算订单优惠信息
- DiscountExplain discountExplain = buildDiscountExplain(cartList, addShopOrderPOJO.getCouponReceiveId(), bizUser.getCompanyId());
-
-
ShopOrder shopOrder = new ShopOrder();
shopOrder.setCompanyId(bizUser.getCompanyId());
- shopOrder.setStoreId(Integer.parseInt(addShopOrderPOJO.getShopId().toString()));
+ shopOrder.setStoreId(Integer.parseInt(shopOrderDto.getShopId().toString()));
//默认设置为产品类型
shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS);
List<ShopOrderDetails> details = new ArrayList<>();
- Integer cartCount = 0;
- for (ShopShoppingCart shopShoppingCart : buyCart) {
+ Integer orderCount = 0;
+ for (OrderItemDto orderItemDto : shopOrderDto.getOrderItemList()) {
ShopOrderDetails shopOrderDetails = new ShopOrderDetails();
shopOrderDetails.setCreateBy(AppConstance.SYSTEM_USER);
shopOrderDetails.setUpdateBy(AppConstance.SYSTEM_USER);
- shopOrderDetails.setpId(shopShoppingCart.getCartProductId());
- shopOrderDetails.setsId(shopShoppingCart.getCartSkuId());
- shopOrderDetails.setPrice(shopShoppingCart.getPrice());
- shopOrderDetails.setCount(shopShoppingCart.getCartNumber());
- shopOrderDetails.setsTitle(shopShoppingCart.getTitle() + shopShoppingCart.getName());
- shopOrderDetails.setDiscountAmount(BigDecimal.ZERO);
- shopOrderDetails.setTotalPrice(shopOrderDetails.getPrice().multiply(BigDecimal.valueOf(shopOrderDetails.getCount())));
- details.add(shopOrderDetails);
- cartCount += shopOrderDetails.getCount();
-
- //查询绑定的产品是否为家居产品,如果已经含家具产品则不再比较
- if (ShopOrder.ORDER_TYPE_GOODS != shopOrder.getOrderType()) {
- ShopSku shopSku = shopSkuDao.selectById(shopShoppingCart.getCartSkuId());
- String stokCode = shopSku.getStockCode();
- if (StringUtils.isNotBlank(stokCode)) {
- ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(Long.parseLong(stokCode));
- if (shoppingGoods != null) {
- //根据购买的产品设置订单类型
- if (Dictionary.SHOPPING_GOODS_TYPE_JJCP.equals(shoppingGoods.getGoodType())) {
- shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS);
- } else {
-
- }
- } else {
- shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS);
- }
- }
+ shopOrderDetails.setpId(orderItemDto.getProductId());
+ shopOrderDetails.setsId(orderItemDto.getSkuId());
+ shopOrderDetails.setCount(orderItemDto.getCount());
+ if(ShopOrderDetails.PAYTYPE_MICRO==orderItemDto.getPayType()){
+ shopOrderDetails.setPrice(orderItemDto.getShopSku().getPrice());
+ }else{
+ shopOrderDetails.setPrice(orderItemDto.getShopSku().getScorePrice());
+ shopOrderDetails.setScoreCount(BigDecimal.valueOf(orderItemDto.getShopSku().getScoreCount()));
+ shopOrderDetails.setTotalScoreCount(shopOrderDetails.getScoreCount().multiply(BigDecimal.valueOf(shopOrderDetails.getCount())));
}
+ shopOrderDetails.setTotalPrice(shopOrderDetails.getPrice().multiply(BigDecimal.valueOf(shopOrderDetails.getCount())));
+ shopOrderDetails.setPayType(orderItemDto.getPayType());
+
+ shopOrderDetails.setsTitle(orderItemDto.getShopProduct().getTitle() + orderItemDto.getShopSku().getName());
+
+ shopOrderDetails.setDiscountAmount(BigDecimal.ZERO);
+
+ details.add(shopOrderDetails);
+ orderCount += shopOrderDetails.getCount();
+ if(orderItemDto.getCartId()!=null){
+ //删除用户购物车选中的产品
+ shoppingCartDao.deleteById(orderItemDto.getCartId());
+ }
}
@@ -213,9 +197,10 @@
shopOrder.setCreateBy("微信小程序生成");
shopOrder.setUpdateBy("微信小程序生成");
shopOrder.setCommodityPrice(discountExplain.getBillPrice());
- shopOrder.setPurchaseQuantity(cartCount);
+ shopOrder.setPurchaseQuantity(orderCount);
+ shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS);
//购买方式
- shopOrder.setShippingMethod(addShopOrderPOJO.getDeliverySelect());
+ shopOrder.setShippingMethod(shopOrderDto.getDeliverySelect());
//生成订单号
shopOrder.setOrderNo(WxUtils.getOrderNum());
//设置支付状态
@@ -230,7 +215,7 @@
//客户姓名
shopOrder.setUserName(shopReceiveAddress.getAddrLiaisonman());
//备注
- shopOrder.setRemarks(addShopOrderPOJO.getRemarks());
+ shopOrder.setRemarks(shopOrderDto.getRemarks());
//删除标识
shopOrder.setDelFlag(AppConstance.DATA_USEABLE);
//微信订单号
@@ -241,13 +226,14 @@
//获取邮费
shopOrder.setPostage(discountExplain.getPostage());
shopOrder.setOrderMoney(discountExplain.getPayPrice());
+ shopOrder.setScorePay(discountExplain.getScorePay());
Gson g = new GsonBuilder().create();
shopOrder.setDiscountExplain(g.toJson(discountExplain));
- shopOrder.setDiscountAmount(discountExplain.getActivity().add(discountExplain.getCoupon()));
+ shopOrder.setDiscountAmount(discountExplain.getActivityPrice().add(discountExplain.getCouponPrice()));
shopOrder.setCompanyId(HostInterceptor.getCompanyId());
shopOrderDao.insert(shopOrder);
- wxShopOrderUtil.insertSendPackageInfo(shopOrder, addShopOrderPOJO.getDeliverySelect(), shopReceiveAddress);
+ wxShopOrderUtil.insertSendPackageInfo(shopOrder, shopOrderDto.getDeliverySelect(), shopReceiveAddress);
//给订单详情表添加订单ID
for (ShopOrderDetails shopOrderDetails : details) {
shopOrderDetails.setOrderId(shopOrder.getId());
@@ -256,16 +242,14 @@
shopOrderDetailsDao.batchInsert(details);
}
//更新使用的优惠券状态
- if (addShopOrderPOJO.getCouponReceiveId() != null) {
+ if (shopOrderDto.getCouponReceiveId() != null) {
ShopCouponRecord record = new ShopCouponRecord();
record.setIsUsing(AppConstance.MY_COUPON_USE);
record.setOrderId(shopOrder.getId());
- record.setId(addShopOrderPOJO.getCouponReceiveId());
+ record.setId(shopOrderDto.getCouponReceiveId());
shopCouponRecordDao.updateByModel(record);
}
- //删除用户购物车选中的产品
- shoppingCartDao.deleteUserSelectCart(bizUser.getOpenId());
BrandWCPayRequestData payData = startPayment(shopOrder);
@@ -276,28 +260,121 @@
}
@Override
- public DiscountExplain buildDiscountExplain(List<ShopCartVo> cartList, Integer receiveId, Long companyId) {
- ShopCartBillVo shopCartBill = shoppingCartService.buildShopCartBillVo(cartList);
- DiscountExplain discountExplain = new DiscountExplain();
- discountExplain.setActivity(shopCartBill.getBillCouponTotal());
- discountExplain.setBillPrice(shopCartBill.getSrcTotal());
- discountExplain.setPayPrice(shopCartBill.getBillTotal());
- //计算优惠券
- if (receiveId != null) {
- CouponReceiveInfoVO couponReceiveInfoVO = shopCouponRecordDao.selectMyCouponByReceiveId(receiveId);
- if (couponReceiveInfoVO != null) {
- BigDecimal payPrice = discountExplain.getPayPrice().subtract(couponReceiveInfoVO.getOffsetAmount());
- payPrice = payPrice.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : payPrice;
- discountExplain.setPayPrice(payPrice);
- discountExplain.setCoupon(couponReceiveInfoVO.getOffsetAmount());
- }
+ public AjaxResult buildDiscountExplain(ShopOrderDto shopOrderDto) {
+
+ if(CollUtil.isEmpty(shopOrderDto.getOrderItemList())){
+ return AjaxResult.buildFailInstance("请选择购买的明细");
}
- discountExplain.setPostage(calculationPostage(discountExplain.getPayPrice(),companyId));
+ //订单计价说明
+ DiscountExplain discountExplain = new DiscountExplain();
+ //账单总金额
+ BigDecimal billPrice = BigDecimal.ZERO;
+ //活动优惠金额
+ BigDecimal activityTotal = BigDecimal.ZERO;
+ //优惠券惠金额
+ BigDecimal couponPrice = BigDecimal.ZERO;
+ //支付总积分
+ Integer scoreCount=0;
- //计算实际支付
- discountExplain.setPayPrice(discountExplain.getPayPrice().add(discountExplain.getPostage()));
- return discountExplain;
+ BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class);
+
+ //计算购物车中物品的优惠信息
+ List<OrderItemDto> orderItemDtos = shopOrderDto.getOrderItemList()
+ .stream().map(orderItemDto -> {
+ return orderCouponGroupService.buildOrderCouponElement(orderItemDto);
+ })
+ .collect(Collectors.toList());
+ //计算未优惠的总金额
+ for (OrderItemDto orderItemDto :orderItemDtos ){
+ if(orderItemDto.getPayType()==ShopShoppingCart.CAR_TYPE_MICRO){
+ billPrice=billPrice.add(orderItemDto.getShopSku().getPrice().multiply(new BigDecimal(orderItemDto.getCount())));
+ }else{
+ billPrice=billPrice.add(orderItemDto.getShopSku().getScorePrice().multiply(new BigDecimal(orderItemDto.getCount())));
+ scoreCount+=orderItemDto.getShopSku().getScoreCount()*orderItemDto.getCount();
+ }
+ }
+ discountExplain.setScorePay(scoreCount);
+
+
+ //计算用户的产品可以参与的店铺优惠活动分组
+ List<ShopCoupon> shopActiveList = new ArrayList<>();//记录用户可以参与的门店活动
+ List<OrderCouponGroup> orderCouponGroupList = new ArrayList<>();
+ int conditionsGroupCount = 0;
+ if (shopOrderDto.getJoinActive() == ShopOrderDto.JOIN_ACTIVE) {//用户参与优惠活动
+ orderCouponGroupList = orderCouponGroupService.buildOrderCouponGroupList(orderItemDtos);
+ conditionsGroupCount = orderCouponGroupList.stream().map(orderCouponGroup -> {
+ if (orderCouponGroup.isSatisfactionCoupon()&&orderCouponGroup.getCoupon()!=null) {
+ shopActiveList.add(orderCouponGroup.getCoupon());
+ return 1;
+ } else {
+ return 0;
+ }
+ }).mapToInt(Integer::intValue).sum();
+ }
+ if(CollUtil.isNotEmpty(shopActiveList)){
+ activityTotal=shopActiveList.stream().map(ShopCoupon:: getOffsetAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
+ }
+
+ //门店活动优惠金额
+ discountExplain.setActivityPrice(activityTotal);
+
+
+ List<CouponReceiveInfoVO> usefulCoupon = new ArrayList<>();
+ CouponReceiveInfoVO shopCoupon = new CouponReceiveInfoVO();
+ //满足店铺活动的订单不能使用优惠券
+ if (conditionsGroupCount > 0) {
+ //计算可用优惠券
+ usefulCoupon = wxShopCouponService.getCartVoCouponList(bizUser.getCompanyId(), orderItemDtos);
+ //获取用户使用的优惠券
+ if (shopOrderDto.getCouponReceiveId() == null) {
+ //如果用户没有选择优惠券则默认选优惠金额最高的
+ //计算使用优惠券后的价格
+ if (CollectionUtils.isNotEmpty(usefulCoupon)) {
+ //根据优惠券ID用户ID查询优惠券信息
+ shopCoupon = usefulCoupon.get(0);
+ }
+ } else if (shopOrderDto.getCouponReceiveId() != 1) {
+ //用户选择了优惠券
+ shopCoupon = shopCouponRecordDao.selectMyCouponByReceiveId(shopOrderDto.getCouponReceiveId());
+ } else {
+ //用户不使用优惠券
+ }
+ //计算优惠券
+ if (shopCoupon.getCouponId() != null) {
+ couponPrice=shopCoupon.getOffsetAmount();
+ }
+ //优惠券金额
+ discountExplain.setCouponPrice(couponPrice);
+ }
+
+
+
+ //计算运费
+ discountExplain.setPostage(calculationPostage(discountExplain.getPayPrice(), HostInterceptor.getCompanyId()));
+
+
+
+ //账单总金额
+ discountExplain.setBillPrice(billPrice.add(discountExplain.getPostage()));
+
+ BigDecimal payPrice=discountExplain.getBillPrice().subtract(activityTotal).subtract(couponPrice);
+ //应付金额
+ discountExplain.setPayPrice(payPrice.doubleValue()>0?payPrice:BigDecimal.ONE);
+
+ AjaxResult result = AjaxResult.buildSuccessInstance("");
+ //结算金额信息
+ result.putInMap("discountExplain", discountExplain);
+ //用户优惠券
+ result.putInMap("usefulCoupon", usefulCoupon);
+ //用户选中的优惠券
+ result.putInMap("shopCoupon", shopCoupon);
+
+ //店铺优惠活动
+ result.putInMap("shopActiveList", shopActiveList);
+
+ return result;
+
}
@@ -317,6 +394,15 @@
if (!shopOrder.getPayResult().equals(ShopOrder.ORDER_PAY_STATUS_WAIT)) {
throw new GlobleException("该订单不是待支付状态!");
}
+
+ if(shopOrder.getScorePay()!=null){
+ //校验用户积分是否够用
+ int score=scoreVipDetailDao.selectUserTotalScore(shopOrder.getUserId(),null);
+ if(score<shopOrder.getScorePay()){
+ return AjaxResult.buildFailInstance("积分不足");
+ }
+ }
+
BrandWCPayRequestData payData = startPayment(shopOrder);
AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, Arrays.asList(payData));
result.putInMap("orderId", shopOrder.getId());
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesGroupServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesGroupServiceImpl.java
index 755f560..0e06b76 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesGroupServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesGroupServiceImpl.java
@@ -396,8 +396,8 @@
DiscountExplain discountExplain = new DiscountExplain();
discountExplain.setPayPrice(payPrice);
discountExplain.setPostage(postPrice);
- discountExplain.setActivity(BigDecimal.ZERO);
- discountExplain.setCoupon(BigDecimal.ZERO);
+ discountExplain.setActivityPrice(BigDecimal.ZERO);
+ discountExplain.setCouponPrice(BigDecimal.ZERO);
discountExplain.setBillPrice(payPrice);
Gson g = new GsonBuilder().create();
shopOrder.setDiscountExplain(g.toJson(discountExplain));
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesSecKillServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesSecKillServiceImpl.java
index 1453dca..b79a20b 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesSecKillServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesSecKillServiceImpl.java
@@ -210,8 +210,8 @@
DiscountExplain discountExplain = new DiscountExplain();
discountExplain.setPayPrice(payPrice);
discountExplain.setPostage(postPrice);
- discountExplain.setActivity(BigDecimal.ZERO);
- discountExplain.setCoupon(BigDecimal.ZERO);
+ discountExplain.setActivityPrice(BigDecimal.ZERO);
+ discountExplain.setCouponPrice(BigDecimal.ZERO);
discountExplain.setBillPrice(payPrice);
Gson g = new GsonBuilder().create();
shopOrder.setDiscountExplain(g.toJson(discountExplain));
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopCouponServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopCouponServiceImpl.java
index bf87285..088d320 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopCouponServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopCouponServiceImpl.java
@@ -1,20 +1,20 @@
package com.matrix.system.shopXcx.api.service.impl;
+import com.matrix.biz.bean.BizUser;
+import com.matrix.component.redis.RedisUserLoginUtils;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.core.tools.LogUtil;
import com.matrix.core.tools.StringUtils;
-import com.matrix.biz.bean.BizUser;
-import com.matrix.component.redis.RedisUserLoginUtils;
import com.matrix.system.common.constance.AppConstance;
-
-import com.matrix.system.shopXcx.bean.*;
-import com.matrix.system.shopXcx.dao.*;
+import com.matrix.system.shopXcx.api.pojo.OrderCouponGroup;
+import com.matrix.system.shopXcx.api.pojo.OrderItemDto;
import com.matrix.system.shopXcx.api.service.WxShopCouponService;
import com.matrix.system.shopXcx.api.tools.WxShopCouponUtil;
import com.matrix.system.shopXcx.api.tools.WxShopOrderUtil;
import com.matrix.system.shopXcx.api.vo.CouponReceiveInfoVO;
-import com.matrix.system.shopXcx.api.vo.ShopCartVo;
+import com.matrix.system.shopXcx.bean.*;
+import com.matrix.system.shopXcx.dao.*;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -54,9 +54,10 @@
*
* @return
*/
- public List<CouponReceiveInfoVO> getCartVoCouponList(Long companyId,List<ShopShoppingCart> shopShoppingCarts) {
+ public List<CouponReceiveInfoVO> getCartVoCouponList(Long companyId,List<OrderItemDto> OrderItemDtos){
- //可用优惠券列表
+
+ //可用优惠券列表
List<CouponReceiveInfoVO> shopCoupons = new ArrayList<>();
@@ -77,7 +78,7 @@
//定义购物车优惠分组
- List<ShopCartVo> cartList = new ArrayList<>();
+ List<OrderCouponGroup> cartList = new ArrayList<>();
// 记录所有优惠券,一个优惠券(活动)表示一组
Map<Integer, ShopCoupon> shopCouponMap = new HashMap<>();
@@ -86,24 +87,24 @@
for (int i = 0; i < userAllCoupon.size(); i++) {
CouponReceiveInfoVO couponReceiveInfoVO = userAllCoupon.get(i);
- ShopCartVo shopCarVo = new ShopCartVo();
+ OrderCouponGroup shopCarVo = new OrderCouponGroup();
shopCarVo.setCouponReceiveInfoVO(couponReceiveInfoVO);
- shopCarVo.setCartList(new ArrayList<>());
+ shopCarVo.setOrderItemDtos(new ArrayList<>());
cartList.add(i, shopCarVo);
- for (ShopShoppingCart shoppingCart : shopShoppingCarts) {
+ for (OrderItemDto orderItemDto : OrderItemDtos) {
// 如果匹配到的产品已经出现在其他优惠组中,则需要判断是否移除之前的组
boolean needRemove = false;
//找到产品所有的优惠券
- List<ShopCoupon> productShopCoupons = getCouponListByProductId(shoppingCart.getCartProductId());
+ List<ShopCoupon> productShopCoupons = getCouponListByProductId(orderItemDto.getProductId());
for (ShopCoupon productShopCoupon : productShopCoupons) {
if (couponReceiveInfoVO.getCouponId().equals(productShopCoupon.getId())) {
- LogUtil.debug("购物车" + shoppingCart.getName() + "和优惠券" + couponReceiveInfoVO.getcName() + "匹配");
- shopCarVo.getCartList().add(shoppingCart);
+ LogUtil.debug("购物车" + orderItemDto.getProductId() + "和优惠券" + couponReceiveInfoVO.getcName() + "匹配");
+ shopCarVo.getOrderItemDtos().add(orderItemDto);
break;
}
}
@@ -113,9 +114,9 @@
}
//3.计算各组的金额是否满足,把满足的优惠券全部返回
- for (ShopCartVo shopCartVo : cartList) {
- if (shopCartVo.isSatisfactionCoupon() && CollectionUtils.isNotEmpty(shopCartVo.getCartList())) {
- shopCoupons.add(shopCartVo.getCouponReceiveInfoVO());
+ for (OrderCouponGroup orderCouponGroup : cartList) {
+ if (orderCouponGroup.isSatisfactionCoupon() && CollectionUtils.isNotEmpty(orderCouponGroup.getOrderItemDtos())) {
+ shopCoupons.add(orderCouponGroup.getCouponReceiveInfoVO());
}
}
}
@@ -125,19 +126,19 @@
- private void countPrice(ShopCartVo shopCartVo) {
- List<ShopShoppingCart> cartList = shopCartVo.getCartList();
+ private void countPrice(OrderCouponGroup orderCouponGroup) {
+ List<OrderItemDto> orderItemDtoList = orderCouponGroup.getOrderItemDtos();
// 计算总价
BigDecimal sum = BigDecimal.ZERO;
- for (ShopShoppingCart shopShoppingCart : cartList) {
- sum = sum.add(shopShoppingCart.getPrice().multiply(BigDecimal.valueOf(shopShoppingCart.getCartNumber())));
+ for (OrderItemDto orderItemDto : orderItemDtoList) {
+ sum = sum.add(orderItemDto.getShopSku().getPrice().multiply(BigDecimal.valueOf(orderItemDto.getCount())));
}
// 存在优惠券
- if (sum.compareTo(shopCartVo.getCouponReceiveInfoVO().getMinAmount()) >= 0) {
+ if (sum.compareTo(orderCouponGroup.getCouponReceiveInfoVO().getMinAmount()) >= 0) {
//标记为合理分组
- shopCartVo.setSatisfactionCoupon(true);
+ orderCouponGroup.setSatisfactionCoupon(true);
} else {
- shopCartVo.setSatisfactionCoupon(false);
+ orderCouponGroup.setSatisfactionCoupon(false);
}
}
@@ -299,7 +300,6 @@
* 通过优惠券标签获取优惠券列表
*
* @param tag 标签名称
- * @param shopId
* @return
*/
@Override
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java
index 7597ba7..2895e24 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java
@@ -16,6 +16,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -58,6 +59,7 @@
@Override
+ @Transactional
public Boolean refundToUser(String id, ShopRefundRecord shopRefundRecord) {
LogUtil.debug("进入退款接口进行退款。。。", id);
Boolean flag = false;
@@ -143,7 +145,7 @@
modifyMap.put("refundCharge", shopRefundRecord.getRefundMoney());
shopOrderDao.updateByMap(modifyMap);
- rabiitMqTemplate.sendMsg(MQTaskRouting.SHOP_ORDER_REFUND+evn,shopOrder.getId()+"");
+ rabiitMqTemplate.sendMsg(MQTaskRouting.SHOP_ORDER_REFUND+evn,shopRefundRecord.getOrderId()+"");
}catch (Exception e){
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/tools/WxShopOrderUtil.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/tools/WxShopOrderUtil.java
index 7c9a66b..283da6a 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/tools/WxShopOrderUtil.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/tools/WxShopOrderUtil.java
@@ -1,16 +1,15 @@
package com.matrix.system.shopXcx.api.tools;
import com.matrix.system.common.bean.CustomerDataDictionary;
-import com.matrix.system.common.dao.CustomerDataDictionaryDao;
import com.matrix.biz.service.BizUserService;
import com.matrix.component.tools.WxTempLateMsgUtil;
import com.matrix.core.exception.GlobleException;
import com.matrix.core.tools.LogUtil;
import com.matrix.core.tools.StringUtils;
import com.matrix.system.common.constance.AppConstance;
-import com.matrix.system.shopXcx.api.pojo.AddShopOrderPOJO;
+import com.matrix.system.shopXcx.api.pojo.ShopOrderDto;
import com.matrix.system.shopXcx.api.pojo.OrderPostageInfoPOJO;
-import com.matrix.system.shopXcx.api.pojo.OrderProductSkuPOJO;
+import com.matrix.system.shopXcx.api.pojo.OrderItemDto;
import com.matrix.system.shopXcx.api.service.WxShopMemberDayService;
import com.matrix.system.shopXcx.bean.*;
import com.matrix.system.shopXcx.dao.*;
@@ -47,8 +46,6 @@
private WxShopMemberDayService wxShopMemberDayService;
@Autowired
private BizUserService bizUserService;
- @Autowired
- private ShopScoreRecordDao shopScoreRecordDao;
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
@@ -95,12 +92,12 @@
/**
* 处理产品规格信息
- * @param addShopOrderPOJO
+ * @param shopOrderDto
*/
- public List<ShopOrderDetails> processProductSkuInfo(ShopOrder shopOrder, AddShopOrderPOJO addShopOrderPOJO,
+ public List<ShopOrderDetails> processProductSkuInfo(ShopOrder shopOrder, ShopOrderDto shopOrderDto,
ShopCoupon shopCoupon) {
List<ShopOrderDetails> resList = new ArrayList<>();
- List<OrderProductSkuPOJO> skuList = addShopOrderPOJO.getSkuList();
+ List<OrderItemDto> skuList = shopOrderDto.getOrderItemList();
if (CollectionUtils.isEmpty(skuList)) {
return resList;
}
@@ -108,9 +105,9 @@
//设置购买数量
int total = 0;
BigDecimal commodityMoney = new BigDecimal("0");
- for (OrderProductSkuPOJO orderProductSkuPOJO : skuList) {
- ids.add(orderProductSkuPOJO.getSkuId());
- total += orderProductSkuPOJO.getCount();
+ for (OrderItemDto orderItemDto : skuList) {
+ ids.add(orderItemDto.getSkuId());
+ total += orderItemDto.getCount();
}
shopOrder.setPurchaseQuantity(total);
List<ShopSku> contrastList = shopSkuDao.selectByIds(ids);
@@ -131,10 +128,10 @@
BigDecimal couponTotalMoney = new BigDecimal("0");
Double discountRate = wxShopMemberDayService.getMemberDay();
- for (OrderProductSkuPOJO orderProductSkuPOJO : skuList) {
+ for (OrderItemDto orderItemDto : skuList) {
boolean isExist = false;
for (ShopSku shopSku : contrastList) {
- if (shopSku.getId().equals(orderProductSkuPOJO.getSkuId())) {
+ if (shopSku.getId().equals(orderItemDto.getSkuId())) {
isExist = true;
ShopOrderDetails shopOrderDetails = new ShopOrderDetails();
shopOrderDetails.setCreateBy(AppConstance.SYSTEM_USER);
@@ -142,9 +139,9 @@
shopOrderDetails.setpId(shopSku.getPId());
shopOrderDetails.setsId(shopSku.getId());
shopOrderDetails.setPrice(shopSku.getPrice());
- shopOrderDetails.setCount(orderProductSkuPOJO.getCount());
+ shopOrderDetails.setCount(orderItemDto.getCount());
BigDecimal price = new BigDecimal(shopSku.getPrice().toString());
- BigDecimal count = new BigDecimal(orderProductSkuPOJO.getCount().toString());
+ BigDecimal count = new BigDecimal(orderItemDto.getCount().toString());
shopOrderDetails.setsTitle(shopSku.getName());
resList.add(shopOrderDetails);
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ScoreUseRecordVo.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ScoreUseRecordVo.java
new file mode 100644
index 0000000..c687093
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ScoreUseRecordVo.java
@@ -0,0 +1,56 @@
+package com.matrix.system.shopXcx.api.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.matrix.core.anotations.Extend;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @description 积分记录表页面展示对象
+ */
+@Data
+@ApiModel(value = "ScoreUseRecordVo", description = "积分记录")
+public class ScoreUseRecordVo {
+
+ @Extend
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "ID")
+ private Integer id;
+
+ @ApiModelProperty(value = "记录类型(1:现金消费2:员工划扣3赠送等)")
+ private Integer recType;
+
+ @ApiModelProperty(value = "调整时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone="GMT+8")
+ private Date createTime;
+
+
+ @ApiModelProperty(value = "调整数量")
+ private Integer recNum;
+
+ @ApiModelProperty(value = "业务记录ID")
+ private Long businessId;
+
+
+
+ @ApiModelProperty(value = "调整后余额")
+ private Integer nowScore;
+
+ @ApiModelProperty(value = "操作人")
+ private String optionName;
+
+ @ApiModelProperty(value = "调整门店")
+ private String shopName;
+
+
+ @ApiModelProperty(value = "备注")
+ private String remarks;
+
+
+
+
+}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartBillVo.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartBillVo.java
index 6e5c3c1..fca4eb3 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartBillVo.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartBillVo.java
@@ -26,6 +26,18 @@
* 未优惠之前的总金额
*/
private BigDecimal srcTotal = BigDecimal.ZERO;
+ /**
+ * 抵用积分
+ */
+ private BigDecimal scorePay = BigDecimal.ZERO;
+
+ public BigDecimal getScorePay() {
+ return scorePay;
+ }
+
+ public void setScorePay(BigDecimal scorePay) {
+ this.scorePay = scorePay;
+ }
public BigDecimal getBillTotal() {
return billTotal;
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartGroupVo.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartGroupVo.java
new file mode 100644
index 0000000..0658267
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartGroupVo.java
@@ -0,0 +1,46 @@
+package com.matrix.system.shopXcx.api.vo;
+
+import com.matrix.system.shopXcx.bean.ShopCoupon;
+import com.matrix.system.shopXcx.bean.ShopShoppingCart;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 购物车前台展示对象
+ */
+@Data
+public class ShopCartGroupVo {
+
+ private ShopCoupon coupon;
+
+ //是否满足优惠
+ private boolean satisfactionCoupon;
+
+
+ private List<ShopShoppingCart> cartList=new ArrayList<>();
+
+
+ //提示语
+ private String msg="";
+
+ //优惠小计金额
+ private BigDecimal subtotal=BigDecimal.ZERO;
+
+ //原价
+ private BigDecimal srcPrice=BigDecimal.ZERO;
+
+ //优惠金额
+ private BigDecimal couponPrice=BigDecimal.ZERO;
+ /**
+ * 抵用积分
+ */
+ private BigDecimal scorePay = BigDecimal.ZERO;
+
+ private CouponReceiveInfoVO couponReceiveInfoVO;
+
+
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartVo.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartVo.java
index 185f984..6d1733e 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartVo.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ShopCartVo.java
@@ -2,6 +2,7 @@
import com.matrix.system.shopXcx.bean.ShopCoupon;
import com.matrix.system.shopXcx.bean.ShopShoppingCart;
+import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@@ -9,90 +10,33 @@
/**
* 购物车前台展示对象
*/
+@Data
public class ShopCartVo {
- private ShopCoupon coupon;
+ private ShopCoupon coupon;
- private CouponReceiveInfoVO couponReceiveInfoVO;
+ private CouponReceiveInfoVO couponReceiveInfoVO;
- public CouponReceiveInfoVO getCouponReceiveInfoVO() {
- return couponReceiveInfoVO;
- }
- public void setCouponReceiveInfoVO(CouponReceiveInfoVO couponReceiveInfoVO) {
- this.couponReceiveInfoVO = couponReceiveInfoVO;
- }
+ //是否满足优惠
+ private boolean satisfactionCoupon;
- //是否满足优惠
- private boolean satisfactionCoupon;
+ private List<ShopShoppingCart> cartList;
- private List<ShopShoppingCart> cartList;
+ //提示语
+ private String msg = "";
- //提示语
- private String msg="";
+ //优惠小计金额
+ private BigDecimal subtotal = BigDecimal.ZERO;
- //优惠小计金额
- private BigDecimal subtotal=BigDecimal.ZERO;
+ //原价
+ private BigDecimal srcPrice = BigDecimal.ZERO;
- //原价
- private BigDecimal srcPrice=BigDecimal.ZERO;
+ //优惠金额
+ private BigDecimal couponPrice = BigDecimal.ZERO;
+ /**
+ * 抵用积分
+ */
+ private BigDecimal scorePay = BigDecimal.ZERO;
- //优惠金额
- private BigDecimal couponPrice=BigDecimal.ZERO;
-
- public ShopCoupon getCoupon() {
- return coupon;
- }
-
- public void setCoupon(ShopCoupon coupon) {
- this.coupon = coupon;
- }
-
- public boolean isSatisfactionCoupon() {
- return satisfactionCoupon;
- }
-
- public void setSatisfactionCoupon(boolean satisfactionCoupon) {
- this.satisfactionCoupon = satisfactionCoupon;
- }
-
- public List<ShopShoppingCart> getCartList() {
- return cartList;
- }
-
- public void setCartList(List<ShopShoppingCart> cartList) {
- this.cartList = cartList;
- }
-
- public String getMsg() {
- return msg;
- }
-
- public void setMsg(String msg) {
- this.msg = msg;
- }
-
- public BigDecimal getSubtotal() {
- return subtotal;
- }
-
- public void setSubtotal(BigDecimal subtotal) {
- this.subtotal = subtotal;
- }
-
- public BigDecimal getSrcPrice() {
- return srcPrice;
- }
-
- public void setSrcPrice(BigDecimal srcPrice) {
- this.srcPrice = srcPrice;
- }
-
- public BigDecimal getCouponPrice() {
- return couponPrice;
- }
-
- public void setCouponPrice(BigDecimal couponPrice) {
- this.couponPrice = couponPrice;
- }
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopOrder.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopOrder.java
index 46da7f2..4ae3a9a 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopOrder.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopOrder.java
@@ -141,7 +141,10 @@
* 用户ID
*/
private String userId;
-
+ /**
+ * 支付积分
+ */
+ private Integer scorePay;
/**
* 下单时间
@@ -336,6 +339,13 @@
return orderNo;
}
+ public Integer getScorePay() {
+ return scorePay;
+ }
+
+ public void setScorePay(Integer scorePay) {
+ this.scorePay = scorePay;
+ }
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopOrderDetails.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopOrderDetails.java
index f250956..073eb07 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopOrderDetails.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopOrderDetails.java
@@ -1,7 +1,7 @@
package com.matrix.system.shopXcx.bean;
-import com.matrix.core.pojo.EntityDTO;
import com.matrix.core.anotations.Extend;
+import com.matrix.core.pojo.EntityDTO;
import java.math.BigDecimal;
@@ -10,9 +10,18 @@
* @author jyy
* @date 2019-06-10 10:58
*/
+
public class ShopOrderDetails extends EntityDTO{
@Extend
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
+ /**
+ *支付方式-直接购买
+ */
+ public static final int PAYTYPE_MICRO = 1;
+ /**
+ *支付方式-积分兑换
+ */
+ public static final int PAYTYPE_SCORE=2;
/**
@@ -43,19 +52,33 @@
* 单价
*/
private BigDecimal price;
-
+
+ /**
+ * 总价
+ */
+ private BigDecimal totalPrice;
+
+ /**
+ * 支付积分单价
+ */
+ private BigDecimal scoreCount;
+
+ /**
+ * 支付总积分
+ */
+ private BigDecimal totalScoreCount;
+
/**
* 数量
*/
private Integer count;
-
-
/**
- * 总价
+ * 支付方式1 直接购买 2,积分兑换
*/
- private BigDecimal totalPrice;
-
+ private Integer payType;
+
+
/**
* 规格标题
@@ -132,6 +155,30 @@
this.price = price;
}
+ public BigDecimal getTotalPrice() {
+ return totalPrice;
+ }
+
+ public void setTotalPrice(BigDecimal totalPrice) {
+ this.totalPrice = totalPrice;
+ }
+
+ public BigDecimal getScoreCount() {
+ return scoreCount;
+ }
+
+ public void setScoreCount(BigDecimal scoreCount) {
+ this.scoreCount = scoreCount;
+ }
+
+ public BigDecimal getTotalScoreCount() {
+ return totalScoreCount;
+ }
+
+ public void setTotalScoreCount(BigDecimal totalScoreCount) {
+ this.totalScoreCount = totalScoreCount;
+ }
+
public Integer getCount() {
return count;
}
@@ -140,12 +187,12 @@
this.count = count;
}
- public BigDecimal getTotalPrice() {
- return totalPrice;
+ public Integer getPayType() {
+ return payType;
}
- public void setTotalPrice(BigDecimal totalPrice) {
- this.totalPrice = totalPrice;
+ public void setPayType(Integer payType) {
+ this.payType = payType;
}
public String getsTitle() {
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java
index ca48c7e..440cac1 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java
@@ -2,6 +2,7 @@
import com.matrix.core.anotations.Extend;
import com.matrix.system.common.bean.EntityDTOExt;
+import lombok.Data;
import java.util.List;
@@ -10,13 +11,27 @@
* @author jyy
* @date 2019-06-10 10:58
*/
+@Data
public class ShopProduct extends EntityDTOExt {
+ /**
+ * 可用积分
+ */
+ public static final int PAYFOR_SCORE =1;
+ /**
+ * 不用积分
+ */
+ public static final int NOT_PAYFOR_SCORE =2;
/**
- * 产品类型-服务
+ * 可分销
*/
- public static final int IS_SERVICE_Y=1;
- public static final int IS_SERVICE_N=2;
+ public static final int ABLE_SALES =1;
+ /**
+ * 不可分销
+ */
+ public static final int NOT_ABLE_SALES=2;
+
+
/**
* 主键
@@ -28,7 +43,12 @@
* 分类ID
*/
private Integer categoryId;
-
+
+ /**
+ * 积分商城分类ID
+ */
+ private Integer scoreCategoryId;
+
/**
* 标题
@@ -58,10 +78,17 @@
* 手机端封面
*/
private String imgMobile;
-
-
-
+ /**
+ * 是否可用积分支付 1是,2不是
+ */
+ private Integer ableScorePay;
+
+
+ /**
+ * 是否为分销产品 1是2不是
+ */
+ private Integer ableSales;
/**
* 原价
@@ -161,6 +188,7 @@
*/
@Extend
private String paramRefs;
+
@Extend
private List<ShopProductParamRef> params;
@@ -246,366 +274,4 @@
- public Long getCompanyId() {
- return companyId;
- }
-
- public void setCompanyId(Long companyId) {
- this.companyId = companyId;
- }
-
- public String getBrand() {
- return brand;
- }
-
- public void setBrand(String brand) {
- this.brand = brand;
- }
-
- public String getShopIds() {
- return shopIds;
- }
-
- public void setShopIds(String shopIds) {
- this.shopIds = shopIds;
- }
-
- public ShopCoupon getShopCoupon() {
- return shopCoupon;
- }
-
- public void setShopCoupon(ShopCoupon shopCoupon) {
- this.shopCoupon = shopCoupon;
- }
-
- public Integer getCouponId() {
- return couponId;
- }
-
- public void setCouponId(Integer couponId) {
- this.couponId = couponId;
- }
-
- public String getStockNum() {
- return stockNum;
- }
-
- public void setStockNum(String stockNum) {
- this.stockNum = stockNum;
- }
-
- public Integer getIsService() {
- return isService;
- }
-
- public void setIsService(Integer isService) {
- this.isService = isService;
- }
-
- public Integer getIsSpecialPrice() {
- return isSpecialPrice;
- }
-
- public void setIsSpecialPrice(Integer isSpecialPrice) {
- this.isSpecialPrice = isSpecialPrice;
- }
-
- public Double getMarkedPrice() {
- return markedPrice;
- }
-
- public void setMarkedPrice(Double markedPrice) {
- this.markedPrice = markedPrice;
- }
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id=id;
- }
-
-
- public Integer getCategoryId() {
- return categoryId;
- }
-
- public void setCategoryId(Integer categoryId) {
- this.categoryId=categoryId;
- }
-
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title=title;
- }
-
-
- public String getBriefIntroduction() {
- return briefIntroduction;
- }
-
- public void setBriefIntroduction(String briefIntroduction) {
- this.briefIntroduction=briefIntroduction;
- }
-
-
- public Integer getCarriage() {
- return carriage;
- }
-
- public void setCarriage(Integer carriage) {
- this.carriage=carriage;
- }
-
-
- public String getImgPc() {
- return imgPc;
- }
-
- public void setImgPc(String imgPc) {
- this.imgPc=imgPc;
- }
-
-
- public String getImgMobile() {
- return imgMobile;
- }
-
- public void setImgMobile(String imgMobile) {
- this.imgMobile=imgMobile;
- }
-
-
-
- public Double getPrice() {
- return price;
- }
-
- public void setPrice(Double price) {
- this.price=price;
- }
-
-
- public String getPcDetails() {
- return pcDetails;
- }
-
- public void setPcDetails(String pcDetails) {
- this.pcDetails=pcDetails;
- }
-
-
- public String getMobileDetails() {
- return mobileDetails;
- }
-
- public void setMobileDetails(String mobileDetails) {
- this.mobileDetails=mobileDetails;
- }
-
-
- public Integer getBuyLimit() {
- return buyLimit;
- }
-
- public void setBuyLimit(Integer buyLimit) {
- this.buyLimit=buyLimit;
- }
-
-
- public Integer getLimitCycle() {
- return limitCycle;
- }
-
- public void setLimitCycle(Integer limitCycle) {
- this.limitCycle=limitCycle;
- }
-
-
- public Integer getIsCanComment() {
- return isCanComment;
- }
-
- public void setIsCanComment(Integer isCanComment) {
- this.isCanComment=isCanComment;
- }
-
-
- public String getMnemonicCode() {
- return mnemonicCode;
- }
-
- public void setMnemonicCode(String mnemonicCode) {
- this.mnemonicCode=mnemonicCode;
- }
-
-
- public Integer getStatus() {
- return status;
- }
-
- public void setStatus(Integer status) {
- this.status=status;
- }
-
-
- public Integer getDsVolume() {
- return dsVolume;
- }
-
- public void setDsVolume(Integer dsVolume) {
- this.dsVolume=dsVolume;
- }
-
-
- public Integer getRsVolume() {
- return rsVolume;
- }
-
- public void setRsVolume(Integer rsVolume) {
- this.rsVolume=rsVolume;
- }
-
-
- public Integer getDelFlag() {
- return delFlag;
- }
-
- public void setDelFlag(Integer delFlag) {
- this.delFlag=delFlag;
- }
-
-
- public String getParamRefs() {
- return paramRefs;
- }
-
- public void setParamRefs(String paramRefs) {
- this.paramRefs = paramRefs;
- }
-
- public String getAttrs() {
- return attrs;
- }
-
- public void setAttrs(String attrs) {
- this.attrs = attrs;
- }
-
- public String getShopSku() {
- return shopSku;
- }
-
- public void setShopSku(String shopSku) {
- this.shopSku = shopSku;
- }
-
- public String getShopProductImg() {
- return shopProductImg;
- }
-
- public void setShopProductImg(String shopProductImg) {
- this.shopProductImg = shopProductImg;
- }
-
- public List<ShopProductParamRef> getParams() {
- return params;
- }
-
- public void setParams(List<ShopProductParamRef> params) {
- this.params = params;
- }
-
- public List<ShopProductAttrRef> getAttrRefs() {
- return attrRefs;
- }
-
- public void setAttrRefs(List<ShopProductAttrRef> attrRefs) {
- this.attrRefs = attrRefs;
- }
-
- public List<ShopSku> getSkus() {
- return skus;
- }
-
- public void setSkus(List<ShopSku> skus) {
- this.skus = skus;
- }
-
- public List<ShopProductImg> getProductImgs() {
- return productImgs;
- }
-
- public void setProductImgs(List<ShopProductImg> productImgs) {
- this.productImgs = productImgs;
- }
-
- public Integer getStartPrice() {
- return startPrice;
- }
-
- public void setStartPrice(Integer startPrice) {
- this.startPrice = startPrice;
- }
-
- public Integer getEndPrice() {
- return endPrice;
- }
-
- public void setEndPrice(Integer endPrice) {
- this.endPrice = endPrice;
- }
-
- public String getSortType() {
- return sortType;
- }
-
- public void setSortType(String sortType) {
- this.sortType = sortType;
- }
-
- public String getQueryType() {
- return queryType;
- }
-
- public void setQueryType(String queryType) {
- this.queryType = queryType;
- }
-
- public String getAttrValues() {
- return attrValues;
- }
-
- public void setAttrValues(String attrValues) {
- this.attrValues = attrValues;
- }
-
- public String getAtrid() {
- return atrid;
- }
-
- public void setAtrid(String atrid) {
- this.atrid = atrid;
- }
-
- public String getScore() {
- return score;
- }
-
- public Integer getServiceTime() {
- return serviceTime;
- }
-
- public void setServiceTime(Integer serviceTime) {
- this.serviceTime = serviceTime;
- }
-
- public void setScore(String score) {
- this.score = score;
- }
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProductComment.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProductComment.java
index 811dd40..9c9557d 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProductComment.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProductComment.java
@@ -3,6 +3,7 @@
import com.matrix.core.anotations.Extend;
import com.matrix.core.tools.DateUtil;
import com.matrix.system.common.bean.EntityDTOExt;
+import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@@ -130,14 +131,14 @@
/**
* 开始时间
*/
- @Extend
- private String commentBeginTime;
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+ private Date commentBeginTime;
/**
* 结束时间
*/
- @Extend
- private String commentEndTime;
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+ private Date commentEndTime;
private Long companyId;
public Long getCompanyId() {
return companyId;
@@ -157,19 +158,19 @@
this.dateToStrTime = dateToStrTime;
}
- public String getCommentBeginTime() {
+ public Date getCommentBeginTime() {
return commentBeginTime;
}
- public void setCommentBeginTime(String commentBeginTime) {
+ public void setCommentBeginTime(Date commentBeginTime) {
this.commentBeginTime = commentBeginTime;
}
- public String getCommentEndTime() {
+ public Date getCommentEndTime() {
return commentEndTime;
}
- public void setCommentEndTime(String commentEndTime) {
+ public void setCommentEndTime(Date commentEndTime) {
this.commentEndTime = commentEndTime;
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopScoreRecord.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopScoreRecord.java
deleted file mode 100644
index 59de19f..0000000
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopScoreRecord.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package com.matrix.system.shopXcx.bean;
-
-import com.matrix.core.pojo.EntityDTO;
-import com.matrix.core.anotations.Extend;
-import com.matrix.core.tools.DateUtil;
-
-import java.math.BigDecimal;
-
-/**
- * @description 用户积分获取记录
- * @author jyy
- * @date 2019-08-09 15:10
- */
-public class ShopScoreRecord extends EntityDTO{
- @Extend
- private static final long serialVersionUID = 1L;
-
-
- /**
- * 主键
- */
- private Integer id;
-
-
- /**
- * 受益人openID
- */
- private String beneficiaryId;
-
-
- /**
- * 购买人openID
- */
- private String buyerId;
-
-
- /**
- * 购买人名称
- */
- private String buyerName;
-
-
- /**
- * 购买人头像地址
- */
- private String buyerAvatarUrl;
-
-
- /**
- * 订单ID
- */
- private Integer orderId;
-
-
- /**
- * 订单金额
- */
- private BigDecimal amount;
-
-
- /**
- * 获得积分
- */
- private Integer score;
-
-
- /**
- * 创建时间格式化成字符串
- */
- @Extend
- private String createTimeStr;
-
-
- public String getCreateTimeStr() {
- if (this.getCreateTime() == null) {
- return "";
- }
- return DateUtil.dateToString(this.getCreateTime(), DateUtil.DATE_FORMAT_DD);
- }
-
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id=id;
- }
-
-
- public String getBeneficiaryId() {
- return beneficiaryId;
- }
-
- public void setBeneficiaryId(String beneficiaryId) {
- this.beneficiaryId=beneficiaryId;
- }
-
-
- public String getBuyerId() {
- return buyerId;
- }
-
- public void setBuyerId(String buyerId) {
- this.buyerId=buyerId;
- }
-
-
- public String getBuyerName() {
- return buyerName;
- }
-
- public void setBuyerName(String buyerName) {
- this.buyerName=buyerName;
- }
-
-
- public String getBuyerAvatarUrl() {
- return buyerAvatarUrl;
- }
-
- public void setBuyerAvatarUrl(String buyerAvatarUrl) {
- this.buyerAvatarUrl = buyerAvatarUrl;
- }
-
- public Integer getOrderId() {
- return orderId;
- }
-
- public void setOrderId(Integer orderId) {
- this.orderId=orderId;
- }
-
-
- public BigDecimal getAmount() {
- return amount;
- }
-
- public void setAmount(BigDecimal amount) {
- this.amount=amount;
- }
-
-
- public Integer getScore() {
- return score;
- }
-
- public void setScore(Integer score) {
- this.score=score;
- }
-
-
-
-
-}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopShoppingCart.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopShoppingCart.java
index 7259104..e39c2d4 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopShoppingCart.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopShoppingCart.java
@@ -14,33 +14,42 @@
*/
public class ShopShoppingCart extends EntityDTOExt {
@Extend
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
+ /**
+ *购物车类型-直接购买
+ */
+ public static final int CAR_TYPE_MICRO =1;
+ /**
+ *购物车类型-积分兑换
+ */
+ public static final int CAR_TYPE_SCORE=2;
-
+
+
/**
* 主键
*/
private Integer cartId;
-
-
+
+
/**
* 用户ID
*/
private String cartUserId;
-
-
+
+
/**
* 产品ID
*/
private Integer cartProductId;
-
-
+
+
/**
* 规格ID
*/
private Integer cartSkuId;
-
-
+
+
/**
* 数量
*/
@@ -50,6 +59,12 @@
* 用户是否选中 1选中 2未选中
*/
private Integer isSelected;
+ /**
+ * 购物车类型 1直接支付 2积分兑换
+ */
+ private Integer cartType;
+
+
/**
* 门店id
@@ -67,6 +82,16 @@
*/
@Extend
private BigDecimal price;
+ /**
+ * 积分兑换所需支付金额
+ */
+ @Extend
+ private BigDecimal scorePrice;
+ /**
+ * 积分兑换所需支付积分
+ */
+ @Extend
+ private Integer scoreCount;
/**
* 产品手机端封面地址
@@ -165,6 +190,22 @@
this.increaseAndDecrease = increaseAndDecrease;
}
+ public BigDecimal getScorePrice() {
+ return scorePrice;
+ }
+
+ public void setScorePrice(BigDecimal scorePrice) {
+ this.scorePrice = scorePrice;
+ }
+
+ public Integer getScoreCount() {
+ return scoreCount;
+ }
+
+ public void setScoreCount(Integer scoreCount) {
+ this.scoreCount = scoreCount;
+ }
+
public Integer getModifyCartNumber() {
return modifyCartNumber;
}
@@ -251,44 +292,44 @@
public Integer getCartId() {
return cartId;
}
-
- public void setCartId(Integer cartId) {
+
+ public void setCartId(Integer cartId) {
this.cartId=cartId;
}
-
+
public String getCartUserId() {
return cartUserId;
}
-
- public void setCartUserId(String cartUserId) {
+
+ public void setCartUserId(String cartUserId) {
this.cartUserId=cartUserId;
}
-
+
public Integer getCartProductId() {
return cartProductId;
}
-
- public void setCartProductId(Integer cartProductId) {
+
+ public void setCartProductId(Integer cartProductId) {
this.cartProductId=cartProductId;
}
-
+
public Integer getCartSkuId() {
return cartSkuId;
}
-
- public void setCartSkuId(Integer cartSkuId) {
+
+ public void setCartSkuId(Integer cartSkuId) {
this.cartSkuId=cartSkuId;
}
-
+
public Integer getCartNumber() {
return cartNumber;
}
-
- public void setCartNumber(Integer cartNumber) {
+
+ public void setCartNumber(Integer cartNumber) {
this.cartNumber=cartNumber;
}
@@ -318,12 +359,18 @@
public void setShopCoupons(List<ShopCoupon> shopCoupons) {
this.shopCoupons=shopCoupons;
-
+
}
public List<ShopCoupon> getShopCoupons() {
return shopCoupons;
}
-
-
+
+ public Integer getCartType() {
+ return cartType;
+ }
+
+ public void setCartType(Integer cartType) {
+ this.cartType = cartType;
+ }
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopSku.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopSku.java
index 4e53f55..e33cd09 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopSku.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopSku.java
@@ -12,7 +12,7 @@
*/
public class ShopSku extends EntityDTO{
@Extend
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
/**
@@ -59,9 +59,19 @@
private BigDecimal invitationPrice;
/**
- * 积分
+ * 消费可得积分
*/
private Integer score;
+
+ /**
+ * 积分兑换所需支付金额
+ */
+ private BigDecimal scorePrice;
+ /**
+ * 积分兑换所需支付积分
+ */
+ private Integer scoreCount;
+
/**
* 排序
@@ -89,6 +99,15 @@
@Extend
private String goodsName;
+
+
+ public Integer getScoreCount() {
+ return scoreCount;
+ }
+
+ public void setScoreCount(Integer scoreCount) {
+ this.scoreCount = scoreCount;
+ }
public BigDecimal getSealesPrice() {
return sealesPrice;
@@ -249,6 +268,14 @@
this.goodsName = goodsName;
}
+ public BigDecimal getScorePrice() {
+ return scorePrice;
+ }
+
+ public void setScorePrice(BigDecimal scorePrice) {
+ this.scorePrice = scorePrice;
+ }
+
@Override
public boolean equals(Object obj) {
//这里以name为判定标准。
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopScoreRecordDao.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopScoreRecordDao.java
deleted file mode 100644
index 9475abe..0000000
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopScoreRecordDao.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.matrix.system.shopXcx.dao;
-
-import org.apache.ibatis.annotations.Param;
-import java.util.List;
-import java.util.Map;
-import com.matrix.core.pojo.PaginationVO;
-import com.matrix.system.shopXcx.bean.ShopScoreRecord;
-
-/**
- * @description 用户积分获取记录
- * @author jyy
- * @date 2019-08-09 15:10
- */
-public interface ShopScoreRecordDao{
-
- public int insert(@Param("item") ShopScoreRecord shopScoreRecord);
-
- public int batchInsert(@Param("list") List<ShopScoreRecord> shopScoreRecordList);
-
- public int updateByMap(Map<String, Object> modifyMap);
-
- public int updateByModel(@Param("record") ShopScoreRecord shopScoreRecord);
-
- public int deleteByIds(@Param("list") List<String> list);
-
- public int deleteById(Integer id);
-
- public int deleteByModel(@Param("record") ShopScoreRecord shopScoreRecord);
-
- public List<ShopScoreRecord> selectInPage(@Param("record") ShopScoreRecord shopScoreRecord, @Param("pageVo") PaginationVO pageVo);
-
- public List<ShopScoreRecord> selectByModel(@Param("record") ShopScoreRecord shopScoreRecord);
-
- public int selectTotalRecord(@Param("record") ShopScoreRecord shopScoreRecord);
-
- public ShopScoreRecord selectById(Integer id);
-
- public ShopScoreRecord selectForUpdate(Integer id);
-
-}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java
index bc4a432..c568f5b 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java
@@ -44,7 +44,7 @@
public Integer selectUserCartCount(@Param("shopId")Long shopId, @Param("openId")String openId);
- public int updateAllSelected(@Param("openId") String openId,@Param("shopId") Long shopId, @Param("isSelected") Integer isSelected);
+ public int updateAllSelected(@Param("openId") String openId, @Param("shopId") Long shopId, @Param("isSelected") Integer isSelected);
/**
* 删除用户选中的购物车明细
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/dto/DiscountExplain.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/dto/DiscountExplain.java
index fb48cdf..a9519aa 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/dto/DiscountExplain.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/dto/DiscountExplain.java
@@ -1,10 +1,13 @@
package com.matrix.system.shopXcx.dto;
+import lombok.Data;
+
import java.math.BigDecimal;
/**
* 订单优惠说明
*/
+@Data
public class DiscountExplain {
/**
@@ -15,13 +18,13 @@
/**
* 优惠券金额
*/
- private BigDecimal coupon=BigDecimal.ZERO;
+ private BigDecimal couponPrice =BigDecimal.ZERO;
/**
* 活动满减金额
*/
- private BigDecimal activity=BigDecimal.ZERO;
+ private BigDecimal activityPrice =BigDecimal.ZERO;
/**
* 运费
@@ -32,44 +35,9 @@
* 最终支付金额
*/
private BigDecimal payPrice=BigDecimal.ZERO;
+ /**
+ * 最终支付积分
+ */
+ private Integer scorePay;
- public BigDecimal getBillPrice() {
- return billPrice;
- }
-
- public void setBillPrice(BigDecimal billPrice) {
- this.billPrice = billPrice;
- }
-
- public BigDecimal getCoupon() {
- return coupon;
- }
-
- public void setCoupon(BigDecimal coupon) {
- this.coupon = coupon;
- }
-
- public BigDecimal getActivity() {
- return activity;
- }
-
- public void setActivity(BigDecimal activity) {
- this.activity = activity;
- }
-
- public BigDecimal getPostage() {
- return postage;
- }
-
- public void setPostage(BigDecimal postage) {
- this.postage = postage;
- }
-
- public BigDecimal getPayPrice() {
- return payPrice;
- }
-
- public void setPayPrice(BigDecimal payPrice) {
- this.payPrice = payPrice;
- }
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/MQTaskRouting.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/MQTaskRouting.java
index 2b548ed..8bd67c4 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/MQTaskRouting.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/MQTaskRouting.java
@@ -9,6 +9,7 @@
String CREATE_ORDER = "CREATE_ORDER";
String SALES_ORDER = "SALES_ORDER";
+ String SCORE_ORDER = "SCORE_ORDER";
/**
* 发送微信消息
*/
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java
index 2b56f6b..b345782 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java
@@ -5,6 +5,11 @@
import com.matrix.core.tools.LogUtil;
import com.matrix.system.fenxiao.dao.ShopSalesmanOrderDao;
import com.matrix.system.fenxiao.entity.ShopSalesmanOrder;
+import com.matrix.system.score.entity.ScoreVipDetail;
+import com.matrix.system.score.service.ScoreVipDetailService;
+import com.matrix.system.shopXcx.bean.ShopOrder;
+import com.matrix.system.shopXcx.dao.ShopOrderDao;
+import com.matrix.system.shopXcx.dao.ShopOrderDetailsDao;
import com.rabbitmq.client.DeliverCallback;
import com.rabbitmq.client.Delivery;
import org.springframework.beans.factory.annotation.Autowired;
@@ -22,6 +27,14 @@
@Autowired
private ShopSalesmanOrderDao shopSalesmanOrderDao;
+ @Autowired
+ private ShopOrderDao shopOrderDao;
+
+ @Autowired
+ private ScoreVipDetailService scoreVipDetailService;
+
+ @Autowired
+ ShopOrderDetailsDao shopOrderDetailsDao;
@Override
@@ -38,6 +51,18 @@
}else{
LogUtil.debug("改订单为生成分销订单={}", orderId);
}
+ ShopOrder order=shopOrderDao.selectById(Integer.parseInt(orderId));
+
+ //如果是积分支付则需要返还积分
+ if(order.getScorePay()!=null && order.getScorePay()>0){
+ LogUtil.debug("处理积分退款={}", orderId);
+ scoreVipDetailService.refundScore(order.getUserId(),null,order.getScorePay(),Long.parseLong(order.getId()+""), ScoreVipDetail.SCORE_VIP_TYPE_CASH);
+ }
+
+ //消费获得积分返还,如果本订单获得了积分则要扣除获得积分
+ scoreVipDetailService.removeByBusinessId(order.getUserId(),null,Long.parseLong(order.getId()+""), ScoreVipDetail.SCORE_VIP_TYPE_CASH);
+
+
}
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java
new file mode 100644
index 0000000..f099fdc
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java
@@ -0,0 +1,80 @@
+package com.matrix.system.shopXcx.mqTask;
+
+
+import com.matrix.biz.service.BizUserService;
+import com.matrix.core.tools.LogUtil;
+import com.matrix.system.score.entity.ScoreVipDetail;
+import com.matrix.system.score.service.ScoreVipDetailService;
+import com.matrix.system.shopXcx.bean.ShopOrder;
+import com.matrix.system.shopXcx.bean.ShopOrderDetails;
+import com.matrix.system.shopXcx.dao.ShopOrderDao;
+import com.matrix.system.shopXcx.dao.ShopOrderDetailsDao;
+import com.rabbitmq.client.DeliverCallback;
+import com.rabbitmq.client.Delivery;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * 订单创建积分事件处理
+ */
+@Component
+public class ScoreOrderTask implements DeliverCallback {
+
+
+ @Autowired
+ ShopOrderDao shopOrderDao;
+ @Autowired
+ ShopOrderDetailsDao shopOrderDetailsDao;
+
+ @Autowired
+ BizUserService bizUserService;
+
+ @Autowired
+ ScoreVipDetailService scoreVipDetailService;
+
+
+
+ @Override
+ public void handle(String consumerTag, Delivery message) throws IOException {
+
+ String orderId = new String(message.getBody(), "UTF-8");
+ LogUtil.debug("收到订单积分任务orderId={}", orderId);
+ //获取订单信息
+ ShopOrder order = shopOrderDao.selectById(Integer.valueOf(orderId));
+ //获取订单详情
+ List<ShopOrderDetails> orderDetails = shopOrderDetailsDao.selectByOrderId(Integer.valueOf(orderId));
+ order.setDetails(orderDetails);
+ //扣除积分
+ if(order.getScorePay()!=null&&order.getScorePay()>0){
+ scoreVipDetailService.deductionScore(order.getUserId(),null,Long.parseLong(order.getStoreId()+""),order.getScorePay(),Long.parseLong(order.getId()+""), ScoreVipDetail.SCORE_VIP_TYPE_CASH,"商城积分抵扣");
+ }else{
+ //消费获得积分
+ int addScore=0;
+ for(ShopOrderDetails shopOrderDetail : orderDetails) {
+ if(shopOrderDetail.getPayType()==ShopOrderDetails.PAYTYPE_MICRO){
+ Integer xfkdScore= shopOrderDetail.getShopSku().getScore();
+ if(xfkdScore!=null && xfkdScore>0){
+ addScore+=xfkdScore;
+ }
+ }
+ }
+ if(addScore>0){
+ //插入新的积分
+ scoreVipDetailService.addScore(
+ order.getUserId(),null,
+ null,
+ Long.parseLong(order.getStoreId()+""),
+ addScore,
+ Long.parseLong(orderId+""),
+ ScoreVipDetail.SCORE_VIP_TYPE_CASH,
+ "微商城消费");
+ }
+ }
+
+
+ }
+
+}
diff --git a/zq-erp/src/main/resources/config/config.json b/zq-erp/src/main/resources/config/config.json
index 1b5f059..e308302 100644
--- a/zq-erp/src/main/resources/config/config.json
+++ b/zq-erp/src/main/resources/config/config.json
@@ -8,7 +8,7 @@
"imageCompressEnable": true, /* 是否压缩图片,默认是true */
"imageCompressBorder": 1600, /* 图片压缩最长边限制 */
"imageInsertAlign": "none", /* 插入的图片浮动方式 */
- "imageUrlPrefix": "http://resource.hive.jyymatrix.cc/uploadeFile", /* 图片访问路径前缀 */
+ "imageUrlPrefix": "http://testfile.hive.jyymatrix.cc/uploadeFile", /* 图片访问路径前缀 */
"imagePathFormat": "/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
/* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */
/* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */
@@ -28,13 +28,13 @@
"scrawlFieldName": "upfile", /* 提交的图片表单名称 */
"scrawlPathFormat": "/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
"scrawlMaxSize": 2048000, /* 上传大小限制,单位B */
- "scrawlUrlPrefix": "http://resource.hive.jyymatrix.cc/uploadeFile", /* 图片访问路径前缀 */
+ "scrawlUrlPrefix": "http://testfile.hive.jyymatrix.cc/uploadeFile", /* 图片访问路径前缀 */
"scrawlInsertAlign": "none",
/* 截图工具上传 */
"snapscreenActionName": "uploadimage", /* 执行上传截图的action名称 */
"snapscreenPathFormat": "/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
- "snapscreenUrlPrefix": "http://resource.hive.jyymatrix.cc/uploadeFile", /* 图片访问路径前缀 */
+ "snapscreenUrlPrefix": "http://testfile.hive.jyymatrix.cc/uploadeFile", /* 图片访问路径前缀 */
"snapscreenInsertAlign": "none", /* 插入的图片浮动方式 */
/* 抓取远程图片配置 */
@@ -42,7 +42,7 @@
"catcherActionName": "catchimage", /* 执行抓取远程图片的action名称 */
"catcherFieldName": "source", /* 提交的图片列表表单名称 */
"catcherPathFormat": "/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
- "catcherUrlPrefix": "http://resource.hive.jyymatrix.cc/uploadeFile", /* 图片访问路径前缀 */
+ "catcherUrlPrefix": "http://testfile.hive.jyymatrix.cc/uploadeFile", /* 图片访问路径前缀 */
"catcherMaxSize": 2048000, /* 上传大小限制,单位B */
"catcherAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 抓取图片格式显示 */
diff --git "a/zq-erp/src/main/resources/config/db/increment/\346\216\250\345\271\277\345\221\230.sql" "b/zq-erp/src/main/resources/config/db/increment/\346\216\250\345\271\277\345\221\230.sql"
index fc225f3..54180a7 100644
--- "a/zq-erp/src/main/resources/config/db/increment/\346\216\250\345\271\277\345\221\230.sql"
+++ "b/zq-erp/src/main/resources/config/db/increment/\346\216\250\345\271\277\345\221\230.sql"
@@ -180,3 +180,32 @@
PRIMARY KEY(id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分销订单';
+biz_user原来的userId改成了自增长的bigint
+
+
+ALTER TABLE `shop_sku`
+ ADD COLUMN `score_price` decimal(10, 2) NULL COMMENT '积分兑换价格' AFTER `invitation_price`;
+
+ALTER TABLE `shop_product`
+ ADD COLUMN `score_category_id` bigint(20) NULL COMMENT '积分商城分类ID' AFTER `company_id`,
+ADD COLUMN `able_sales` int(2) NULL COMMENT '是否为分销产品1是2不是' AFTER `score_category_id`,
+ADD COLUMN `able_score_pay` int(2) NULL COMMENT '是否可用积分支付1是2不是' AFTER `able_sales`;
+
+ALTER TABLE `shop_shopping_cart`
+ ADD COLUMN `cart_type` int(2) NOT NULL COMMENT '购物车类型 1微商城 2积分商城' AFTER `company_id`;
+
+update shop_product set able_score_pay=1;
+update shop_product set able_sales=2;
+
+ALTER TABLE `shop_sku`
+ MODIFY COLUMN `score_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '兑换所需支付价格' AFTER `invitation_price`,
+ ADD COLUMN `score_count` decimal(10, 2) NULL COMMENT '兑换所需积分数量' AFTER `score_price`;
+
+ALTER TABLE `shop_order_details`
+ ADD COLUMN `pay_type` int(2) NULL COMMENT '支付方式1 直接购买 2,积分兑换' AFTER `company_id`,
+ADD COLUMN `score_count` decimal(20, 2) NULL COMMENT '支付积分单价' AFTER `pay_type`,
+ADD COLUMN `total_score_count` decimal(20, 2) NULL COMMENT '支付总积分' AFTER `score_count`;
+
+ALTER TABLE `shop_order`
+DROP COLUMN `score_pay`,
+ADD COLUMN `score_pay` int(20) NULL COMMENT '支付积分' AFTER `company_id`;
diff --git "a/zq-erp/src/main/resources/config/db/increment/\347\276\216\345\272\246\344\270\232\347\273\251\345\215\207\347\272\247.sql" "b/zq-erp/src/main/resources/config/db/increment/\347\276\216\345\272\246\344\270\232\347\273\251\345\215\207\347\272\247.sql"
index dd65cdc..0a352f7 100644
--- "a/zq-erp/src/main/resources/config/db/increment/\347\276\216\345\272\246\344\270\232\347\273\251\345\215\207\347\272\247.sql"
+++ "b/zq-erp/src/main/resources/config/db/increment/\347\276\216\345\272\246\344\270\232\347\273\251\345\215\207\347\272\247.sql"
@@ -11,3 +11,5 @@
ALTER TABLE `sys_order_item`
ADD COLUMN `refundCount` int(11) NULL COMMENT '退款数量' AFTER `pay_method_detail`;
+
+
diff --git a/zq-erp/src/main/resources/config/test/config.json b/zq-erp/src/main/resources/config/test/config.json
index 1b5f059..5b0e824 100644
--- a/zq-erp/src/main/resources/config/test/config.json
+++ b/zq-erp/src/main/resources/config/test/config.json
@@ -8,7 +8,7 @@
"imageCompressEnable": true, /* 是否压缩图片,默认是true */
"imageCompressBorder": 1600, /* 图片压缩最长边限制 */
"imageInsertAlign": "none", /* 插入的图片浮动方式 */
- "imageUrlPrefix": "http://resource.hive.jyymatrix.cc/uploadeFile", /* 图片访问路径前缀 */
+ "imageUrlPrefix": "http://testfile.hive.jyymatrix.cc", /* 图片访问路径前缀 */
"imagePathFormat": "/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
/* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */
/* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */
@@ -28,13 +28,13 @@
"scrawlFieldName": "upfile", /* 提交的图片表单名称 */
"scrawlPathFormat": "/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
"scrawlMaxSize": 2048000, /* 上传大小限制,单位B */
- "scrawlUrlPrefix": "http://resource.hive.jyymatrix.cc/uploadeFile", /* 图片访问路径前缀 */
+ "scrawlUrlPrefix": "http://testfile.hive.jyymatrix.cc", /* 图片访问路径前缀 */
"scrawlInsertAlign": "none",
/* 截图工具上传 */
"snapscreenActionName": "uploadimage", /* 执行上传截图的action名称 */
"snapscreenPathFormat": "/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
- "snapscreenUrlPrefix": "http://resource.hive.jyymatrix.cc/uploadeFile", /* 图片访问路径前缀 */
+ "snapscreenUrlPrefix": "http://testfile.hive.jyymatrix.cc", /* 图片访问路径前缀 */
"snapscreenInsertAlign": "none", /* 插入的图片浮动方式 */
/* 抓取远程图片配置 */
@@ -42,7 +42,7 @@
"catcherActionName": "catchimage", /* 执行抓取远程图片的action名称 */
"catcherFieldName": "source", /* 提交的图片列表表单名称 */
"catcherPathFormat": "/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
- "catcherUrlPrefix": "http://resource.hive.jyymatrix.cc/uploadeFile", /* 图片访问路径前缀 */
+ "catcherUrlPrefix": "http://testfile.hive.jyymatrix.cc", /* 图片访问路径前缀 */
"catcherMaxSize": 2048000, /* 上传大小限制,单位B */
"catcherAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 抓取图片格式显示 */
diff --git a/zq-erp/src/main/resources/mybatis/mapper/score/ScoreUseRecordDao.xml b/zq-erp/src/main/resources/mybatis/mapper/score/ScoreUseRecordDao.xml
index ca3b694..cb50621 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/score/ScoreUseRecordDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/score/ScoreUseRecordDao.xml
@@ -3,41 +3,28 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.matrix.system.score.dao.ScoreUseRecordDao">
- <!-- 定义ScoreUseRecord 的复杂关联map -->
- <resultMap type="com.matrix.system.score.entity.ScoreUseRecord" id="ScoreUseRecordMap">
- <id property="id" column="id" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="recType" column="rec_type" />
- <result property="recNum" column="rec_num" />
- <result property="businessId" column="business_id" />
- <result property="scoreVipDetailId" column="score_vip_detail_id" />
- <result property="preScore" column="pre_score" />
- <result property="nowScore" column="now_score" />
- <result property="userId" column="user_id" />
- <result property="remarks" column="remarks" />
- <result property="companyId" column="company_id" />
- </resultMap>
-
-
- <!-- 定义ScoreUseRecord 的简单map ,本map不添加其他的关联属性 -->
- <resultMap type="com.matrix.system.score.entity.ScoreUseRecord" id="ScoreUseRecordSimpleMap">
- <id property="id" column="id" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="recType" column="rec_type" />
- <result property="recNum" column="rec_num" />
- <result property="businessId" column="business_id" />
- <result property="scoreVipDetailId" column="score_vip_detail_id" />
- <result property="preScore" column="pre_score" />
- <result property="nowScore" column="now_score" />
- <result property="userId" column="user_id" />
- <result property="remarks" column="remarks" />
- <result property="companyId" column="company_id" />
- </resultMap>
+
+
+ <select id="selectFlowList" resultType="com.matrix.system.shopXcx.api.vo.ScoreUseRecordVo">
+
+ select a.*,
+ b.SHOP_NAME,
+ c.su_name as optionName
+ from score_use_record a
+ left join sys_shop_info b on a.shop_id=b.id
+ left join sys_users c on a.opration_user_id=c.su_id
+ where a.open_id=#{record.userId}
+ and DATE_FORMAT(a.create_time,'%Y-%m')=#{record.queryTime}
+ <if test="record.revenueType==1">
+ and a.rec_num>0
+ </if>
+ <if test="record.revenueType==2">
+ <![CDATA[ and a.rec_num<0 ]]>
+ </if>
+ order by a.create_time desc
+
+ </select>
+
+
</mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml b/zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml
index f7fe0c0..3f9fa59 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml
@@ -3,41 +3,29 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.matrix.system.score.dao.ScoreVipDetailDao">
- <!-- 定义ScoreVipDetail 的复杂关联map -->
- <resultMap type="com.matrix.system.score.entity.ScoreVipDetail" id="ScoreVipDetailMap">
- <id property="id" column="id" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="type" column="type" />
- <result property="allScore" column="all_score" />
- <result property="usedScore" column="used_score" />
- <result property="remainScore" column="remain_score" />
- <result property="gainTime" column="gain_time" />
- <result property="validiteTime" column="validite_time" />
- <result property="state" column="state" />
- <result property="businessId" column="business_id" />
- <result property="companyId" column="company_id" />
- </resultMap>
-
-
- <!-- 定义ScoreVipDetail 的简单map ,本map不添加其他的关联属性 -->
- <resultMap type="com.matrix.system.score.entity.ScoreVipDetail" id="ScoreVipDetailSimpleMap">
- <id property="id" column="id" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="type" column="type" />
- <result property="allScore" column="all_score" />
- <result property="usedScore" column="used_score" />
- <result property="remainScore" column="remain_score" />
- <result property="gainTime" column="gain_time" />
- <result property="validiteTime" column="validite_time" />
- <result property="state" column="state" />
- <result property="businessId" column="business_id" />
- <result property="companyId" column="company_id" />
- </resultMap>
+
+ <select id="selectUserTotalScore" resultType="java.lang.Integer">
+ select IFNULL(sum(IFNULL( remain_score, 0 )),0) from score_vip_detail
+ <where>
+ and state=1
+ <if test="openId !=null">
+ and open_id=#{openId}
+ </if>
+ <if test="vipId !=null">
+ and vip_id=#{vipId}
+ </if>
+ </where>
+ </select>
+
+ <select id="selectEffectiveScore" resultType="com.matrix.system.score.entity.ScoreVipDetail">
+ select * from score_vip_detail where state=1
+ <if test="openId !=null">
+ and open_id=#{openId}
+ </if>
+ <if test="vipId !=null">
+ and vip_id=#{vipId}
+ </if> order by create_time
+
+ </select>
</mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopOrderDao.xml b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopOrderDao.xml
index 8ec31fb..c699faf 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopOrderDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopOrderDao.xml
@@ -33,6 +33,7 @@
<result property="storeName" column="shop_name" />
<result property="orderType" column="order_type" />
<result property="applyStatus" column="apply_status" />
+ <result property="scorePay" column="score_pay" />
<result property="companyId" column="company_id" />
</resultMap>
@@ -66,6 +67,7 @@
<result property="postage" column="postage" />
<result property="orderType" column="order_type" />
<result property="storeName" column="shop_name" />
+ <result property="scorePay" column="score_pay" />
<result property="companyId" column="company_id" />
<result property="activityType" column="activity_type" />
<!--支付时间-->
@@ -127,6 +129,7 @@
postage,
order_type,
activity_type,
+score_pay,
company_id
</sql>
@@ -159,6 +162,7 @@
#{item.postage},
#{item.orderType},
#{item.activityType},
+ #{item.scorePay},
#{item.companyId}
</sql>
@@ -337,6 +341,9 @@
<if test="_parameter.containsKey('orderType')">
order_type = #{orderType},
</if>
+ <if test="_parameter.containsKey('scorePay')">
+ score_pay = #{scorePay},
+ </if>
</set>
WHERE id=#{id}
</update>
@@ -405,6 +412,9 @@
</if>
<if test="record.postage != null and record.postage != '' ">
postage = #{record.postage},
+ </if>
+ <if test="record.scorePay != null and record.scorePay != '' ">
+ score_pay = #{record.scorePay},
</if>
<if test="true">
update_time = now(),
@@ -558,6 +568,7 @@
o.postage,
s.shop_name,
o.order_type,
+ o.score_pay,
o.apply_status
from shop_order o
INNER JOIN sys_shop_info s on o.store_id = s.ID
@@ -629,6 +640,7 @@
o.pay_result,
o.postage,
s.store_name,
+ s.score_pay,
o.order_type
from shop_order o
LEFT JOIN shop_store s on o.store_id = s.store_id
diff --git a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopOrderDetailsDao.xml b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopOrderDetailsDao.xml
index c1263ab..46254ee 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopOrderDetailsDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopOrderDetailsDao.xml
@@ -19,6 +19,9 @@
<result property="sTitle" column="s_title" />
<result property="discountExplain" column="discount_explain" />
<result property="discountAmount" column="discount_amount" />
+ <result property="payType" column="pay_type" />
+ <result property="scoreCount" column="score_count" />
+ <result property="totalScoreCount" column="total_score_count" />
</resultMap>
<!-- 定义ShopOrderDetails 的复杂map -->
@@ -37,22 +40,19 @@
<result property="sTitle" column="s_title" />
<result property="discountExplain" column="discount_explain" />
<result property="discountAmount" column="discount_amount" />
+ <result property="payType" column="pay_type" />
+ <result property="scoreCount" column="score_count" />
+ <result property="totalScoreCount" column="total_score_count" />
+
<!--产品信息-->
<association property="shopProduct" column="p_id"
select="com.matrix.system.shopXcx.dao.ShopProductDao.selectById"/>
<!--规格信息-->
<association property="shopSku" column="s_id"
select="com.matrix.system.shopXcx.dao.ShopSkuDao.selectById"/>
- <!--查询生产企业-->
- <association property="productionEnterprise" column="{pId=p_id}"
- select="selectProductionEnterpriseByPid"/>
+
</resultMap>
- <!--查询产品生产企业-->
- <select id="selectProductionEnterpriseByPid" resultType="java.lang.String">
- select ifnull(param_value, '') from shop_product_param_ref
- where p_id = ${pId} and param_name = '生产企业'
- </select>
<!-- 字段sql -->
<sql id="columns">
@@ -69,7 +69,10 @@
total_price,
s_title,
discount_explain,
- discount_amount
+ discount_amount,
+ pay_type,
+ score_count,
+ total_score_count
</sql>
<!-- 属性sql -->
@@ -87,7 +90,10 @@
#{item.totalPrice},
#{item.sTitle},
#{item.discountExplain},
- #{item.discountAmount}
+ #{item.discountAmount},
+ #{item.payType},
+ #{item.scoreCount},
+ #{item.totalScoreCount}
</sql>
<!-- where sql -->
@@ -123,6 +129,17 @@
</if>
<if test="(record.discountAmount!=null and record.discountAmount!='') or (record.discountAmount!='' and record.discountAmount==0) ">
and discount_amount = #{record.discountAmount}
+ </if>
+ <if test="(record.payType!=null and record.payType!='') or (record.payType!='' and record.payType==0) ">
+ and pay_type = #{record.payType}
+ </if>
+
+ <if test="(record.scoreCount!=null and record.scoreCount!='') or (record.scoreCount!='' and record.scoreCount==0) ">
+ and score_count = #{record.scoreCount}
+ </if>
+
+ <if test="(record.totalScoreCount!=null and record.totalScoreCount!='') or (record.totalScoreCount!='' and record.totalScoreCount==0) ">
+ and total_score_count = #{record.totalScoreCount}
</if>
</if>
@@ -186,7 +203,20 @@
</if>
<if test="_parameter.containsKey('discountAmount')">
discount_amount = #{discountAmount},
- </if>
+ </if>
+
+ <if test="_parameter.containsKey('payType')">
+ pay_type = #{payType},
+ </if>
+
+ <if test="_parameter.containsKey('scoreCount')">
+ score_count = #{scoreCount},
+ </if>
+
+ <if test="_parameter.containsKey('totalScoreCount')">
+ total_score_count = #{totalScoreCount},
+ </if>
+
</set>
WHERE id=#{id}
</update>
@@ -223,10 +253,18 @@
<if test="record.discountAmount != null ">
discount_amount = #{record.discountAmount},
</if>
+ <if test="record.payType != null ">
+ pay_type = #{record.payType},
+ </if>
+ <if test="record.scoreCount != null ">
+ score_count = #{record.scoreCount},
+ </if>
+ <if test="record.totalScoreCount != null ">
+ total_score_count = #{record.totalScoreCount},
+ </if>
</set>
WHERE id=#{record.id}
</update>
-
<!-- 批量删除 -->
<delete id="deleteByIds" parameterType="java.util.List">
delete from shop_order_details where id in
diff --git a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductCommentDao.xml b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductCommentDao.xml
index c32a212..9935dd4 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductCommentDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductCommentDao.xml
@@ -104,7 +104,7 @@
</if>
<if test="record.companyId != null and record.companyId !='' ">
- and company_id = #{record.companyId}
+ and c.company_id = #{record.companyId}
</if>
<if test="(record.comContent!=null and record.comContent!='') or (record.comContent!='' and record.comContent==0) ">
@@ -455,6 +455,7 @@
and c.product_id = #{record.productId}
</if>
</if>
+ and c.com_audit_status=1
AND p.del_flag = 2
AND o.del_flag = 2
AND c.del_flag = 2
diff --git a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml
index 2c2cf8c..91c105d 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml
@@ -42,6 +42,10 @@
<result property="couponId" column="couponId"></result>
<result property="serviceTime" column="service_time"></result>
<result property="companyId" column="company_id"/>
+ <result property="ableScorePay" column="able_score_pay"/>
+ <result property="ableSales" column="able_sales"/>
+ <result property="scoreCategoryId" column="score_category_id"/>
+
<association property="shopCoupon" select="com.matrix.system.shopXcx.dao.ShopCouponDao.selectById"
column="{id=couponId}"></association>
</resultMap>
@@ -80,6 +84,9 @@
<result property="couponId" column="couponId"></result>
<result property="serviceTime" column="service_time"></result>
<result property="companyId" column="company_id"/>
+ <result property="ableScorePay" column="able_score_pay"/>
+ <result property="ableSales" column="able_sales"/>
+ <result property="scoreCategoryId" column="score_category_id"/>
</resultMap>
<sql id="columns">
@@ -113,7 +120,11 @@
is_service,
service_time,
shop_ids,
- company_id
+ company_id,
+ able_score_pay,
+ able_sales,
+ score_category_id
+
</sql>
<!-- 属性sql -->
@@ -148,7 +159,11 @@
#{item.isService},
#{item.serviceTime},
#{item.shopIds},
- #{item.companyId}
+ #{item.companyId},
+ #{item.ableScorePay},
+ #{item.ableSales},
+ #{item.scoreCategoryId}
+
</sql>
<!-- where sql -->
<sql id="where_sql">
@@ -237,6 +252,15 @@
and a.company_id = #{record.companyId}
</if>
+ <if test="record.ableScorePay != null and record.ableScorePay !='' ">
+ and a.able_score_pay = #{record.ableScorePay}
+ </if>
+ <if test="record.ableSales != null and record.ableSales !='' ">
+ and a.able_sales = #{record.ableSales}
+ </if>
+ <if test="record.scoreCategoryId != null and record.scoreCategoryId ">
+ and a.score_category_id = #{record.scoreCategoryId}
+ </if>
</if>
@@ -311,6 +335,17 @@
and b.attr_full_path like concat('%/',#{record.attrs},'/%')
</if>
+
+ <if test="record.ableScorePay != null and record.ableScorePay !='' ">
+ and a.able_score_pay = #{record.ableScorePay}
+ </if>
+ <if test="record.ableSales != null and record.ableSales !='' ">
+ and a.able_sales = #{record.ableSales}
+ </if>
+ <if test="record.scoreCategoryId != null and record.scoreCategoryId ">
+ and a.score_category_id = #{record.scoreCategoryId}
+ </if>
+
</if>
@@ -418,6 +453,16 @@
<if test="_parameter.containsKey('companyId')">
company_id = #{companyId},
</if>
+ <if test="_parameter.containsKey('scoreCategoryId')">
+ score_category_id = #{scoreCategoryId},
+ </if>
+ <if test="_parameter.containsKey('ableSales')">
+ able_sales = #{ableSales},
+ </if>
+ <if test="_parameter.containsKey('ableScorePay')">
+ able_score_pay = #{ableScorePay},
+ </if>
+
</set>
WHERE id=#{id}
@@ -500,6 +545,15 @@
shop_ids = #{record.shopIds},
</if>
+ <if test="record.ableScorePay != null and record.ableScorePay !='' ">
+ able_score_pay = #{record.ableScorePay},
+ </if>
+ <if test="record.ableSales != null and record.ableSales !='' ">
+ able_sales = #{record.ableSales},
+ </if>
+ <if test="record.scoreCategoryId != null and record.scoreCategoryId ">
+ score_category_id = #{record.scoreCategoryId},
+ </if>
</set>
WHERE id=#{record.id}
@@ -588,6 +642,9 @@
a.marked_price,
b.attr_full_path,
a.couponId,
+ a.able_score_pay,
+ a.able_sales,
+ a.score_category_id,
(SELECT ROUND(SUM(ss.stock),2) from shop_sku ss where ss.p_id = a.id) as stockNum,
GROUP_CONCAT(DISTINCT(s.atrid) order by a.id SEPARATOR ',') atrid
from shop_product a left join shop_product_attr_ref b on a.id = b.p_id
@@ -628,6 +685,9 @@
a.marked_price,
a.service_time,
a.couponId,
+ a.able_score_pay,
+ a.able_sales,
+ a.score_category_id,
(SELECT ROUND(SUM(ss.stock),2) from shop_sku ss where ss.p_id = a.id) as stockNum
from shop_product a
where a.id in (${productIds}) and shop_ids=#{shopId}
@@ -665,6 +725,9 @@
a.marked_price,
b.attr_full_path,
a.couponId,
+ a.able_score_pay,
+ a.able_sales,
+ a.score_category_id,
a.service_time,
(SELECT ROUND(SUM(ss.stock),2) from shop_sku ss where ss.p_id = a.id) as stockNum,
GROUP_CONCAT(DISTINCT(s.atrid) order by a.id SEPARATOR ',') atrid
@@ -730,6 +793,9 @@
b.attr_full_path,
a.service_time,
a.couponId,
+ a.able_score_pay,
+ a.able_sales,
+ a.score_category_id,
(SELECT ROUND(SUM(s.stock),2) from shop_sku s where s.p_id = a.id) as stockNum,
(SELECT COUNT(p.com_id) from shop_product_comment p where p.product_id=a.id and p.del_flag=2 and p.com_audit_status=1 and p.com_score=5) as comment
from shop_product a
@@ -771,6 +837,18 @@
<if test="(record.shopIds!=null and record.shopIds!='') or (record.shopIds!='' and record.shopIds==0) ">
and find_in_set(#{record.shopIds}, a.shop_ids)
</if>
+
+ <if test="record.ableScorePay != null and record.ableScorePay !='' ">
+ and a.able_score_pay = #{record.ableScorePay}
+ </if>
+ <if test="record.ableSales != null and record.ableSales !='' ">
+ and a.able_sales = #{record.ableSales}
+ </if>
+ <if test="record.scoreCategoryId != null and record.scoreCategoryId ">
+ and a.score_category_id = #{record.scoreCategoryId}
+ </if>
+
+
</where>
GROUP BY a.id
<if test="record.queryType != null and record.queryType == 1">
@@ -828,6 +906,9 @@
is_special_price,
marked_price,
couponId,
+ a.able_score_pay,
+ a.able_sales,
+ a.score_category_id,
(SELECT SUM(s.stock) from shop_sku s where s.p_id = a.id) as stockNum,
(SELECT ROUND(SUM(s.stock),2) from shop_sku s where s.p_id = a.id) as stockNum,
shop_ids
diff --git a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml
index 8e59026..4cf0397 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml
@@ -27,6 +27,7 @@
<result property="isSelected" column="isSelected" />
<result property="shopId" column="shop_id" />
<result property="companyId" column="company_id" />
+ <result property="cartType" column="cart_type" />
</resultMap>
@@ -44,6 +45,8 @@
<result property="isSelected" column="isSelected" />
<result property="shopId" column="shop_id" />
<result property="companyId" column="company_id" />
+ <result property="cartType" column="cart_type" />
+
</resultMap>
<!-- 字段sql -->
@@ -59,7 +62,9 @@
cart_number,
isSelected,
shop_id,
- company_id
+ company_id,
+ cart_type
+
</sql>
<!-- 属性sql -->
@@ -75,7 +80,9 @@
#{item.cartNumber},
#{item.isSelected},
#{item.shopId},
- #{item.companyId}
+ #{item.companyId},
+ #{item.cartType}
+
</sql>
<!-- where sql -->
@@ -122,6 +129,7 @@
<if test="record.companyId != null and record.companyId !='' ">
and c.company_id = #{record.companyId}
</if>
+
</if>
@@ -268,7 +276,8 @@
p.img_mobile,
p.img_pc,
u.nick_name,
- s.NAME
+ s.NAME,
+ c.cart_type,
from shop_shopping_cart c
LEFT JOIN shop_product p ON c.cart_product_id = p.id
LEFT JOIN shop_sku s ON c.cart_sku_id = s.id
@@ -325,7 +334,10 @@
p.img_pc,
p.buy_limit,
s.NAME,
- s.stock
+ s.stock,
+ s.score_count,
+ s.score_price,
+ c.cart_type
from shop_shopping_cart c
LEFT JOIN shop_product p ON c.cart_product_id = p.id
LEFT JOIN shop_sku s ON c.cart_sku_id = s.id
@@ -351,7 +363,7 @@
<select id="selectUserCartCount" resultType="java.lang.Integer" >
select sum(cart_number) from shop_shopping_cart c
LEFT JOIN shop_product p on p.id = c.cart_product_id
-where c.shop_Id=#{shopId} and p.del_flag = 2 and cart_user_id=#{openId};
+where c.shop_Id=#{shopId} and p.del_flag = 2 and cart_user_id=#{openId}
</select>
<!-- 根据id 锁表查询-->
diff --git a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopSkuDao.xml b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopSkuDao.xml
index 1c85265..7d6030d 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopSkuDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopSkuDao.xml
@@ -24,6 +24,8 @@
<result property="shopId" column="shop_id"/>
<result property="sealesPrice" column="seales_price"/>
<result property="invitationPrice" column="invitation_price"/>
+ <result property="scorePrice" column="score_price"/>
+ <result property="scoreCount" column="score_count"/>
@@ -50,6 +52,8 @@
<result property="shopId" column="shop_id"/>
<result property="sealesPrice" column="seales_price"/>
<result property="invitationPrice" column="invitation_price"/>
+ <result property="scorePrice" column="score_price"/>
+ <result property="scoreCount" column="score_count"/>
</resultMap>
<!-- 字段sql -->
@@ -72,7 +76,11 @@
stock_code,
shop_id,
seales_price,
-invitation_price
+invitation_price,
+ score_price,
+score_count
+
+
</sql>
<!-- 属性sql -->
@@ -95,7 +103,10 @@
#{item.stockCode},
#{item.shopId},
#{item.sealesPrice},
- #{item.invitationPrice}
+ #{item.invitationPrice},
+ #{item.scorePrice},
+ #{item.scoreCount}
+
</sql>
@@ -136,6 +147,18 @@
<if test="(record.shopId!=null and record.shopId!='') or (record.shopId!='' and record.shopId==0) ">
and shop_id = #{record.shopId}
</if>
+
+ <if test="(record.scorePrice!=null and record.scorePrice!='') or (record.scorePrice!='' and record.scorePrice==0) ">
+ and score_price = #{record.scorePrice}
+ </if>
+
+
+ <if test="(record.scoreCount!=null and record.scoreCount!='') or (record.scoreCount!='' and record.scoreCount==0) ">
+ and score_count = #{record.scoreCount}
+ </if>
+
+
+
</if>
</sql>
@@ -202,6 +225,16 @@
<if test="_parameter.containsKey('sealesPrice')">
seales_price = #{sealesPrice},
</if>
+
+ <if test="_parameter.containsKey('scorePrice')">
+ score_price = #{scorePrice},
+ </if>
+
+ <if test="_parameter.containsKey('scoreCount')">
+ score_count = #{scoreCount},
+ </if>
+
+
</set>
WHERE id=#{id}
</update>
@@ -252,6 +285,14 @@
invitation_price = #{record.invitationPrice},
</if>
+ <if test="record.scorePrice != null ">
+ score_price = #{record.scorePrice},
+ </if>
+
+ <if test="record.scoreCount != null ">
+ score_count = #{record.scoreCount},
+ </if>
+
</set>
WHERE id=#{record.id}
diff --git a/zq-erp/src/main/resources/templates/views/admin/shop/shopAdvertisType-list.html b/zq-erp/src/main/resources/templates/views/admin/shop/shopAdvertisType-list.html
index 020f4fc..ef02fde 100644
--- a/zq-erp/src/main/resources/templates/views/admin/shop/shopAdvertisType-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/shop/shopAdvertisType-list.html
@@ -518,7 +518,10 @@
//改变编辑页面,切换页面元素
changePage(index){
+
this.currentPage=this.pageList[index];
+ this.currentPageCode=this.pageList[index].code;
+ console.log(this.currentPageCode);
this.loadPageAds();
},
loadPageAds() {
diff --git a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html
index dec22fc..fe12dac 100644
--- a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html
@@ -42,7 +42,7 @@
<div class="panel-heading">基本信息</div>
<div class="panel-body">
<div class="form-group">
- <label class="col-sm-2 control-label">分类ID
+ <label class="col-sm-2 control-label">产品分类
<span class="text-danger">*</span>
</label>
<div class="col-sm-4">
@@ -69,6 +69,40 @@
maxLength="1000" dataType="*"
th:value="${obj.briefIntroduction}" nullmsg="产品简介不能为空">
</div>
+ <label class="col-sm-2 control-label">是否可分销
+ <span class="text-danger">*</span>
+ </label>
+ <div class="col-sm-4">
+ <select th:field="${obj.ableSales}" class="form-control select2 " size="1"
+ name="ableSales"
+ id="ableSales" style="width: 100%">
+ <option value="1" th:selected="${obj.ableSales == '1'}">可分销</option>
+ <option value="2" th:selected="${obj.ableSales == '2'}">不可分销</option>
+ </option>
+ </select>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="col-sm-2 control-label">是否积分抵
+ <span class="text-danger">*</span>
+ </label>
+ <div class="col-sm-4">
+ <select th:field="${obj.ableScorePay}" class="form-control select2 " size="1"
+ name="ableScorePay"
+ id="ableScorePay" style="width: 100%">
+ <option value="2" th:selected="${obj.ableScorePay == '2'}">不可抵扣</option>
+ <option value="1" th:selected="${obj.ableScorePay == '1'}">可抵扣</option>
+ </option>
+ </select>
+ </div>
+ <label class="col-sm-2 control-label">积分商城分类
+ <span class="text-danger">*</span>
+ </label>
+ <div class="col-sm-4">
+ <select class="form-control select2 " size="1" name="scoreCategoryId"
+ id="scoreCategoryId" style="width: 100%">
+ </select>
+ </div>
</div>
<div class="form-group">
@@ -87,14 +121,7 @@
dataType="n" nullmsg="展示销量不能为空"
th:value="${obj.dsVolume}" errormsg="请填写数字">
</div>
- <!--<label class="col-sm-2 control-label">运费
- <span class="text-danger">*</span>
- </label>
- <div class="col-sm-4">
- <input autocomplete="off" type="text" class="form-control" name="carriage"
- maxLength="250" datatype="*"
- th:value="${obj.carriage}" nullmsg="运费不能为空">
- </div>-->
+
</div>
<div class="form-group">
<label class="col-sm-2 control-label">限购数量
@@ -117,42 +144,7 @@
</div>
</div>
- <div class="form-group">
- <label class="col-sm-2 control-label">是否为服务项目
- </label>
- <div class="col-sm-4">
- <select th:field="${obj.isService}" class="form-control " size="1"
- name="isService"
- id="isService" style="width: 100%">
- <option value="2" th:selected="${obj.isService == '2'}">否</option>
- <option value="1" th:selected="${obj.isService == '1'}">是</option>
- </option>
-
- </select>
- </div>
-
- <label class="col-sm-2 control-label">服务时长
- </label>
- <div class="col-sm-4">
- <input autocomplete="off" type="text" class="form-control" name="serviceTime"
- maxLength="50"
- th:value="${obj.serviceTime}" >
- </div>
-
-
- </div>
-
- <!--<div class="form-group">
-
- <label class="col-sm-2 control-label">真实销量
- </label>
- <div class="col-sm-4">
- <input autocomplete="off" type="text" class="form-control" name="rsVolume"
-
- th:value="${obj.rsVolume}" errormsg="请填写数字">
- </div>
- </div>-->
<div class="form-group">
<label class="col-sm-2 control-label">属性设置 </label>
<input autocomplete="off" name="attrs" id="attrs" type="hidden" >
@@ -226,11 +218,13 @@
<th>规格图片地址<span class="text-danger">*</span></th>
<th>库存<span class="text-danger">*</span></th>
<th>价格<span class="text-danger">*</span></th>
- <th>积分</th>
+ <th>消费可得积分</th>
<th>关联ERP产品</th>
<th>排序</th>
<th>推广提成</th>
<th>邀请提成</th>
+ <th>兑换所需金额</th>
+ <th>兑换所需积分</th>
<th>操作</th>
</tr>
</table>
@@ -361,6 +355,8 @@
<td><input autocomplete="off" type="text" class="form-control" name=""></td>
<td><input autocomplete="off" type="text" class="form-control" name=""></td>
<td><input autocomplete="off" type="text" class="form-control" name=""></td>
+ <td><input autocomplete="off" type="text" class="form-control" name=""></td>
+ <td><input autocomplete="off" type="text" class="form-control" name=""></td>
<td><i class="fa fa-trash form-control-static" onclick="delThis('trId')"></i></td>
</tr>
</script>
@@ -395,6 +391,9 @@
});
$(function () {
initSeclect("#parentId",[[${obj.categoryId}]]);
+ initScoreSeclect("#scoreCategoryId",[[${obj.scoreCategoryId}]]);
+
+
initAttrSeclect("#attrIds");
$("#mobileDetails").html(obj.mobileDetails);
$("#pcDetails").html(obj.pcDetails);
@@ -538,6 +537,14 @@
if (invitationPrice == null || typeof invitationPrice == 'undefined') {
invitationPrice = "";
}
+ var scorePrice = shopSkus[c].scorePrice;
+ if (scorePrice == null || typeof scorePrice == 'undefined') {
+ scorePrice = "";
+ }
+ var scoreCount = shopSkus[c].scoreCount;
+ if (scoreCount == null || typeof scoreCount == 'undefined') {
+ scoreCount = "";
+ }
var html=
@@ -554,6 +561,8 @@
+'<td><input autocomplete="off" type="text" class="form-control" value="'+sort+'" name=""></td>'
+'<td><input autocomplete="off" type="text" class="form-control" value="'+sealesPrice+'" name=""></td>'
+'<td><input autocomplete="off" type="text" class="form-control" value="'+invitationPrice+'" name=""></td>'
+ +'<td><input autocomplete="off" type="text" class="form-control" value="'+scorePrice+'" name=""></td>'
+ +'<td><input autocomplete="off" type="text" class="form-control" value="'+scoreCount+'" name=""></td>'
+'<td><i class="fa fa-trash form-control-static" onclick="delThis(\''+trId+'\')"></i></td>'
+'</tr>';
$("#skutable").find("tbody").append(html);
@@ -617,10 +626,6 @@
layer.msg(result.info, {
icon : 2,
time : 1000,
- end:function(){
- parent.myGrid.serchData();
- MTools.closeForm()
- }
});
return null;
}
@@ -655,6 +660,22 @@
//初始化分类ID
function initSeclect(seler, def) {
$.AjaxProxy().invoke(basePath + "/admin/shopProductAttribute/showSonAttribute?attrCode=cpfl&status=1",
+ function (loj) {
+ $(seler).createSelectTree(
+ loj.attr("result").rows,
+ {
+ id: "attrId",
+ parent: "parentId",
+ value: "attrName",
+ append: false,
+ defaultValue: def,
+ defaultHtml: ''
+ });
+ });
+ }
+ //初始化分积分商城分类ID
+ function initScoreSeclect(seler, def) {
+ $.AjaxProxy().invoke(basePath + "/admin/shopProductAttribute/showSonAttribute?attrCode=jfsccpfl&status=1",
function (loj) {
$(seler).createSelectTree(
loj.attr("result").rows,
@@ -724,68 +745,75 @@
if (i != 0) {
var tds = $(this).find("td");
var length = tds.length - 1;
- var id = tds.eq(length - 10).find("input").val();
+ var id = tds.eq(length - 12).find("input").val();
if(id == null){
id ="";
}
sku.id = id;
//规格名称
- var name = tds.eq(length - 9).find("input").val();
+ var name = tds.eq(length - 11).find("input").val();
if(name == null){
name = "";
}
sku.name = name;
//图片地址
- var path = tds.eq(length - 8).find("img").attr("src");
+ var path = tds.eq(length - 10).find("img").attr("src");
if(path == null){
path = "";
}
sku.imgPath = path;
//库存
- var stock = tds.eq(length - 7).find("input").val();
+ var stock = tds.eq(length - 9).find("input").val();
if(stock == ""){
stock = 0;
}
sku.stock = stock;
//价格
- var price = tds.eq(length -6).find("input").val();
+ var price = tds.eq(length -8).find("input").val();
if(price == ""){
price =0;
}
sku.price = price;
//积分
- var score = tds.eq(length - 5).find("input").val();
+ var score = tds.eq(length - 7).find("input").val();
if(score == ""){
score = 0;
}
sku.score = score;
//品种编码
- var stockCode = tds.eq(length - 4).find("input").val();
+ var stockCode = tds.eq(length - 6).find("input").val();
if(stockCode == null || typeof stockCode == 'undefined'){
stockCode = '';
}
sku.stockCode = stockCode;
//排序
- var sort = tds.eq(length - 3).find("input").val();
+ var sort = tds.eq(length - 5).find("input").val();
if(sort == ""){
sort = 0;
}
sku.sort = sort;
//推广提成
- var sealesPrice = tds.eq(length - 2).find("input").val();
+ var sealesPrice = tds.eq(length - 4).find("input").val();
sku.sealesPrice = sealesPrice;
//邀请提成
- var invitationPrice = tds.eq(length - 1).find("input").val();
+ var invitationPrice = tds.eq(length - 3).find("input").val();
sku.invitationPrice = invitationPrice;
+
+ //兑换所需金额
+ var scorePrice = tds.eq(length - 2).find("input").val();
+ sku.scorePrice = scorePrice;
+ //兑换所需积分
+ var scoreCount = tds.eq(length - 1).find("input").val();
+ sku.scoreCount = scoreCount;
skus.push(sku);
}
@@ -794,8 +822,14 @@
return skus;
}
+
/*验证sku表格中的参数*/
function getSkusValues() {
+
+ var ableScorePay=$("#ableScorePay").val();
+ var ableSales=$("#ableSales").val();
+
+
var flag = false;
var reg = new RegExp("(^[1-9]([0-9]+)?(\\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\\.[0-9]([0-9])?$)");
$("#skutable tbody").find("tr").each(function(i) {
@@ -803,7 +837,38 @@
if (i != 0) {
var tds = $(this).find("td");
var length = tds.length - 1;
- var name = tds.eq(length - 9).find("input").val();
+
+ if(ableSales==1){
+ //推广提成
+ var sealesPrice = tds.eq(length - 4).find("input").val();
+ //邀请提成
+ var invitationPrice = tds.eq(length - 3).find("input").val();
+ if(sealesPrice == ""||invitationPrice==""){
+ layer.msg("请填写推广提成和邀请提成",{
+ icon : 2,
+ time : 2000
+ });
+ flag = true;
+ return false;
+ }
+ }
+
+ if(ableScorePay==1){
+ //兑换所需金额
+ var scorePrice = tds.eq(length - 2).find("input").val();
+ //兑换所需积分
+ var scoreCount = tds.eq(length - 1).find("input").val();
+ if(scorePrice == ""||scoreCount==""){
+ layer.msg("请填写兑换所需金额和积分",{
+ icon : 2,
+ time : 2000
+ });
+ flag = true;
+ return false;
+ }
+ }
+
+ var name = tds.eq(length - 11).find("input").val();
if(name == ""){
layer.msg("请填写规格名称",{
icon : 2,
@@ -821,7 +886,7 @@
return false;
}
- var stock = tds.eq(length -7).find("input").val();
+ var stock = tds.eq(length -9).find("input").val();
if(stock == ""){
layer.msg("请填写库存",{
icon : 2,
@@ -830,7 +895,7 @@
flag = true;
return false;
}
- var price = tds.eq(length - 6).find("input").val();
+ var price = tds.eq(length - 8 ).find("input").val();
if(price == ""){
layer.msg("请填写价格",{
icon : 2,
diff --git a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-list.html b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-list.html
index a7e7d16..6f7468a 100644
--- a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-list.html
@@ -35,10 +35,18 @@
<input autocomplete="off" id="search-text" name="title" placeholder="输入查询关键词"
type="text" class="form-control">
</div>
-
+ <div class="form-group">
+ <label class="control-label">积分抵扣</label>
+ <select style="width:100px;" class="form-control select2" size="1"
+ name="ableScorePay" >
+ <option value="">请选择</option>
+ <option value="1">可抵扣</option>
+ <option value="2">不可抵扣</option>
+ </select>
+ </div>
<div class="form-group">
<label class="control-label">是否上架</label>
- <select style="width:200px;" class="form-control select2" size="1"
+ <select style="width:100px;" class="form-control select2" size="1"
name="status"
id="status">
<option value="">请选择</option>
@@ -47,10 +55,10 @@
</select>
</div>
<div class="form-group">
- <label class="control-label">是否为服务</label>
- <select style="width:200px;" class="form-control select2" size="1"
- name="isService"
- id="isService">
+ <label class="control-label">是否可分销</label>
+ <select style="width:100px;" class="form-control select2" size="1"
+ name="ableSales"
+ id="ableSales">
<option value="">请选择</option>
<option value="1">是</option>
<option value="2">否</option>
@@ -114,12 +122,13 @@
<tr>
<th data-checkbox="true"></th>
<th data-formatter="MGrid.indexfn" data-align="center">序号</th>
- <th data-field="id" data-align="center">产品ID</th>
+ <th data-field="id" data-align="center" >ID</th>
+ <th data-field="ableScorePay" data-align="center" data-formatter="ableScorePay">积分抵扣</th>
<th data-field="title" data-align="center">产品名称</th>
<th data-field="imgMobile" data-align="center" data-formatter="MGrid.getImage">产品图片</th>
<th data-field="attrValues" data-align="center" data-formatter="formatAttr">产品属性</th>
<th data-field="price" data-align="center">价格</th>
- <th data-field="score" data-align="center">积分</th>
+ <th data-field="scorePrice" data-align="center">兑换所需积分</th>
<th data-field="status" data-align="center" data-formatter="isStatus">是否上架</th>
<th data-field="rsVolume" data-align="center">真实销量</th>
@@ -275,7 +284,7 @@
//初始化属性下拉选
function initAttrsSeclect(seler, def) {
console.log(1);
- $.AjaxProxy().invoke(basePath + "/admin/shopProductAttribute/showSonAttribute?attrCode=cpfl",
+ $.AjaxProxy().invoke(basePath + "/admin/shopProductAttribute/showSonAttribute?attrCode=productColumn",
function (loj) {
$(seler).createSelectTree(
loj.attr("result").rows,
@@ -290,6 +299,16 @@
});
}
+ function ableScorePay(value, row, index) {
+ var html = "";
+ if (value ==1) {
+ html="可抵扣"
+ }else{
+ html="不可抵扣"
+ }
+ return html;
+ }
+
/**
* 格式化属性
*/
diff --git a/zq-erp/src/main/resources/templates/views/admin/shop/shopProductComment-list.html b/zq-erp/src/main/resources/templates/views/admin/shop/shopProductComment-list.html
index 4bbe610..c2634e8 100644
--- a/zq-erp/src/main/resources/templates/views/admin/shop/shopProductComment-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/shop/shopProductComment-list.html
@@ -52,6 +52,22 @@
<input autocomplete="off" id="search-text" name="nickName" placeholder="输入查询关键词"
type="text" class="form-control">
</div>
+ <div class="form-group mr-20 ml-20">
+ <select class="form-control select2" size="1"
+ name="comAuditStatus"
+ id="comAuditStatus" style="width: 98%">
+ <option value="">请选择</option>
+ <option value="0" >未审核</option>
+ <option value="1" >审核通过</option>
+ <option value="2" >审核不通过</option>
+ </select>
+ </div>
+ <div class="form-group mr-20 ml-20">
+ <input autocomplete="off" name="commentBeginTime"
+ type="text" class="form-control datetimepicker" >
+ <input autocomplete="off" name="commentEndTime"
+ type="text" class="form-control datetimepicker">
+ </div>
<div class="form-group">
<button onclick="myGrid.serchData(1)" type="button"
class="btn btn-info">
@@ -62,64 +78,10 @@
</button>
</div>
</div>
- <!-- 高级搜索 -->
- <div class="senior-content">
- <!-- <div><a class="serch-close closestyle">×</a></div> -->
- <div class="serch-headline">高级搜索</div>
- <div>
- <div style="margin-bottom: 20px!important;">
- <div class="col-sm-6" style="text-align: right!important;">
- <label class="col-sm-12 control-label">
- 开始日期:
- </label>
- </div>
- <div class="col-sm-6">
- <input autocomplete="off" name="commentBeginTime" readonly="readonly"
- type="text" class="form-control datetimepicker" style="width: 98%">
- </div>
- </div>
- <div style="margin-bottom: 20px!important;">
- <div class="col-sm-6" style="text-align: right!important;">
- <label class="col-sm-12 control-label">
- 结束日期:
- </label>
- </div>
- <div class="col-sm-6">
- <input autocomplete="off" name="commentEndTime" readonly="readonly"
- type="text" class="form-control datetimepicker" style="width: 98%">
- </div>
- </div>
-
- <div style="margin-bottom: 20px!important;">
- <div class="col-sm-6" style="text-align: right!important;">
- <label class="col-sm-12 control-label">
- 审核状态:
- </label>
- </div>
- <div class="col-sm-6">
- <select class="form-control select2" size="1"
- name="comAuditStatus"
- id="comAuditStatus" style="width: 98%">
- <option value="">请选择</option>
- <option value="0" >未审核</option>
- <option value="1" >审核通过</option>
- <option value="2" >审核不通过</option>
- </select>
- </div>
- </div>
-
- </div>
- <div class="button col-sm-12">
- <button type="button" class="btn btn-sm btn-info mr20" onclick="myGrid.serchData()">确认</button>
- <button type="button" class="btn btn-warning serch-close">取消</button>
- </div>
- </div>
</form>
</div>
- <div class="col-md-1 text-r layui-anim" data-anim="layui-anim-up">
- <a class="senior-serch">高级搜索</a>
- </div>
+
</div>
</div>
</div>
@@ -151,7 +113,14 @@
<script type="text/javascript">
var myGrid;
$(function(){
- MTools.ininDatetimepicker(".datetimepicker");
+ var _initParam = {format : 'yyyy-mm-dd hh:ii',
+ todayBtn : true,
+ autoclose : true,
+ startView : 2,
+ maxView : 3,
+ minView : 0};
+ MTools.ininDatetimepicker(_initParam);
+ MTools.limitStartEndTime(_initParam);
var delUrl="";
delUrl=basePath+"/admin/shopProductComment/del" ;
myGrid=MGrid.initGrid({
diff --git a/zq-erp/src/test/java/com/matrix/JyyTests.java b/zq-erp/src/test/java/com/matrix/JyyTests.java
index b2b3243..744c5e5 100644
--- a/zq-erp/src/test/java/com/matrix/JyyTests.java
+++ b/zq-erp/src/test/java/com/matrix/JyyTests.java
@@ -1,5 +1,7 @@
package com.matrix;
+import com.matrix.system.score.dao.ScoreVipDetailDao;
+import com.matrix.system.score.service.ScoreVipDetailService;
import com.matrix.system.shopXcx.dao.ShopOrderV2Dao;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -22,12 +24,26 @@
@Autowired
private ShopOrderV2Dao shopOrderV2Dao;
+ @Autowired
+ ScoreVipDetailDao scoreVipDetailDao;
+ @Autowired
+ ScoreVipDetailService scoreVipDetailService;
+
+ @Test
+ public void scoreVipDetailService() throws InterruptedException {
+ scoreVipDetailService.addScore("oJkRK4yelehsY4S7I6Ee1ydWtQMI",null,null,null,15,1L,1,"测试");
+ }
/**
*
*/
@Test
+ public void scoreVipDetailDao() throws InterruptedException {
+ System.out.println( scoreVipDetailDao.selectUserTotalScore("oJkRK4yelehsY4S7I6Ee1ydWtQMI",null));
+ }
+
+ @Test
public void testSelectReceivedOrderCount() throws InterruptedException {
System.out.println( shopOrderV2Dao.selectReceivedOrderCount("oJkRK4yelehsY4S7I6Ee1ydWtQMI"));
}
--
Gitblit v1.9.1