Merge branch 'score_shop' of http://120.27.238.55:7000/r/beauty-erp into score_shop
10 files added
5 files deleted
60 files modified
| | |
| | | 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入口 |
| | |
| | | * @author jiangyouyao |
| | | */ |
| | | @SpringBootApplication |
| | | |
| | | @ComponentScan(basePackages = {"com.matrix.**"}) |
| | | |
| | | public class ZqErpApplication { |
| | | |
| | | public static void main(String[] args) { |
| | |
| | | private Integer userType; |
| | | |
| | | |
| | | /** |
| | | * 用户总积分 |
| | | */ |
| | | private Integer totalScore; |
| | | |
| | | |
| | | /** |
| | |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | public Integer getTotalScore() { |
| | | return totalScore; |
| | | } |
| | | |
| | | public void setTotalScore(Integer totalScore) { |
| | | this.totalScore = totalScore; |
| | | } |
| | | |
| | | public Integer getCurrentScore() { |
| | | return currentScore; |
| | |
| | | public static final String MQ_EXCHANGE_TOPIC = "hive_exchange_fanout"; |
| | | |
| | | @Bean |
| | | ScoreOrderTask ScoreOrderTask() { |
| | | return new ScoreOrderTask(); |
| | | } |
| | | |
| | | @Bean |
| | | VipCreateTask VipCreateTask() { |
| | | return new VipCreateTask(); |
| | | } |
| | |
| | | //不同任务在不同的队列,但是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); |
| | |
| | | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | /** 扩展信息 **/ |
| | |
| | | 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; |
| | | } |
| | |
| | | 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 积分记录表 |
| | |
| | | */ |
| | | public interface ScoreUseRecordDao extends BaseMapper<ScoreUseRecord> { |
| | | |
| | | /** |
| | | * 查询收支记录 |
| | | * @param page |
| | | * @param scoreFlowDto |
| | | * @return |
| | | */ |
| | | IPage<ScoreUseRecordVo> selectFlowList(Page<ScoreUseRecordVo> page, @Param("record")ScoreFlowDto scoreFlowDto); |
| | | } |
| | |
| | | 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 客户积分余额 |
| | |
| | | */ |
| | | 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); |
| | | } |
| | |
| | | */ |
| | | |
| | | |
| | | private Integer recType; |
| | | private Integer type; |
| | | |
| | | /** |
| | | * 数量 |
| | |
| | | |
| | | |
| | | private Long businessId; |
| | | |
| | | /** |
| | | * 操作人id |
| | | */ |
| | | Long oprationUserId; |
| | | /** |
| | | * 积分卡ID |
| | | */ |
| | |
| | | /** |
| | | * 操作人ID |
| | | */ |
| | | private String openId; |
| | | |
| | | private Long vipId; |
| | | |
| | | private Long userId; |
| | | private Long shopId; |
| | | |
| | | /** |
| | | * 备注 |
| | |
| | | @Extend |
| | | 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; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | |
| | | |
| | | private String businessId; |
| | | private Long businessId; |
| | | |
| | | /** |
| | | * 所属公司_id |
| | |
| | | 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>{ |
| | | |
| | | @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); |
| | | } |
| | | } |
| | |
| | | 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; |
| | | |
| | | |
| | | /** |
| | |
| | | * 记录编辑前的值Before_Edit_Value |
| | | */ |
| | | public static final String BEV = "ShopBizUserScore_BEV"; |
| | | |
| | | |
| | | |
| | | |
| | | \ |
| | | |
| | | |
| | | } |
| | |
| | | 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); |
| | |
| | | |
| | | 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; |
| | | |
| | | |
| | | /** |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * 新增订单 |
| | | * |
| | | * @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; |
| | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | @Autowired |
| | | ScoreVipDetailService scoreVipDetailService; |
| | | |
| | | |
| | | |
| | |
| | | rabiitMqTemplate.sendTopicMsg(RabbitMqConfig.MQ_EXCHANGE_TOPIC +evn, MQTaskRouting.CREATE_ORDER+evn, orderId); |
| | | |
| | | |
| | | |
| | | threadResult.putInMap("status", "success"); |
| | | resXml = AppConstance.RESULT_XML_SUCCESS; |
| | | |
| | |
| | | @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,"属性编码不能为空"); |
| | |
| | | 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; |
| | |
| | | }) |
| | | 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); |
| | |
| | | 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; |
| | |
| | | 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: |
| | | //判断用户是否有确认收货的产品 |
New file |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @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) { |
| | |
| | | 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; |
| | | RedisUserLoginUtils redisUserLoginUtils; |
| | | |
| | | @Autowired |
| | | ScoreUseRecordDao scoreUseRecordDao; |
| | | |
| | | /** |
| | | * 查询我的获得积分列表 |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/getRecordList") |
| | | @ResponseBody |
| | | public AjaxResult getRecordList(@RequestBody PaginationVO pageVo) { |
| | | @Autowired |
| | | ScoreVipDetailDao scoreVipDetailDao; |
| | | |
| | | 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); |
| | | @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; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询我的积分兑换列表 |
| | | * @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); |
| | | @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; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | * @date 2019-06-12 19:15 |
| | | */ |
| | | @CrossOrigin(origins = "*", maxAge = 3600) |
| | | @Controller |
| | | @Api(tags = "购物车类") |
| | | @RestController |
| | | @RequestMapping(value = "wxapi/ShoppingCart") |
| | | public class WxShoppingCartAction { |
| | | @Autowired |
| | |
| | | @Autowired |
| | | ShopSkuDao skuDao; |
| | | |
| | | @Autowired |
| | | OrderCouponGroupService orderCouponGroupService; |
| | | |
| | | /** |
| | | * 根据ID删除购物车 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "根据ID删除购物车", notes = "") |
| | | @PostMapping("/deleteByCartId/{cartId}") |
| | | @ResponseBody |
| | | public AjaxResult deleteByCartId(@PathVariable("cartId") Integer cartId) { |
| | |
| | | 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()); |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | */ |
| | | |
| | | @ApiOperation(value = "批量删除", notes = "") |
| | | @PostMapping(value = "/delShoppingCart/{keys}") |
| | | public |
| | | @ResponseBody |
| | |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "查询微商城购物车数量", notes = "") |
| | | @PostMapping(value = "/getUserCartCount/{shopId}") |
| | | public |
| | | @ResponseBody |
| | |
| | | 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; |
| | |
| | | * @param |
| | | * @return |
| | | */ |
| | | @RequestMapping("/updateCartSelected") |
| | | @PostMapping("/updateCartSelected") |
| | | @ResponseBody |
| | | public AjaxResult updateCartSelected(@RequestBody ShopShoppingCart shoppingCart) { |
| | | Map<String, Object> modifyMap = new HashMap<>(); |
| | |
| | | * @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); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "修改成功"); |
| | |
| | | // 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())) {//目前还不是分销员 |
| | |
| | | queryWrapper.eq("apply_status", ShopSalesmanApply.APPLY_STATUS_DSH); |
| | | ShopSalesmanApply shopSalesmanApply = salesmanApplyDao.selectOne(queryWrapper); |
| | | if (shopSalesmanApply == null) {//没有待审核记录 |
| | | 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)); |
| | | } |
| | | |
| | | |
New file |
| | |
| | | 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; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | |
| | | } |
| | |
| | | /** |
| | | * 购买规格信息列表 |
| | | */ |
| | | private List<OrderProductSkuPOJO> skuList; |
| | | private List<OrderItemDto> skuList; |
| | | |
| | | |
| | | public Integer getAddrId() { |
| | |
| | | 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; |
| | | } |
| | | |
New file |
| | |
| | | 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; |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | @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; |
| | |
| | | shopCartBillVo.setBillCouponTotal(shopCartBillVo.getBillCouponTotal().add(shopCartVo.getCouponPrice())); |
| | | } |
| | | } |
| | | |
| | | |
| | | for (ShopShoppingCart shopCart : shopCartVo.getCartList()) { |
| | | if (shopCart.getIsSelected() == 1) { |
| | | selectCount += shopCart.getCartNumber(); |
| | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | private List<ShopCartVo> buildShopCart(List<ShopShoppingCart> list) { |
| | | public List<ShopCartVo> buildShopCart(List<ShopShoppingCart> list) { |
| | | |
| | | |
| | | //定义购物车优惠分组 |
| | |
| | | for (ShopShoppingCart shopShoppingCart : cartList) { |
| | | sum = sum.add(shopShoppingCart.getPrice().multiply(BigDecimal.valueOf(shopShoppingCart.getCartNumber()))); |
| | | if (shopShoppingCart.getIsSelected() == 1) { |
| | | 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()))); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | 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 |
| | |
| | | |
| | | /** |
| | | * 创建订单 |
| | | * @param addShopOrderPOJO |
| | | * @param shopOrderDto |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | AjaxResult createShopOrder(AddShopOrderPOJO addShopOrderPOJO) throws Exception; |
| | | AjaxResult createShopOrder(ShopOrderDto shopOrderDto) throws Exception; |
| | | |
| | | /** |
| | | * 订单结算 |
| | |
| | | */ |
| | | AjaxResult updateStockAndVolumeById(Integer orderId); |
| | | |
| | | DiscountExplain buildDiscountExplain(List<ShopCartVo> cartList, Integer id, Long companyId); |
| | | AjaxResult buildDiscountExplain(ShopOrderDto shopOrderDto); |
| | | } |
| | |
| | | |
| | | 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; |
| | | |
| | |
| | | * 根据购物车选中的产品 |
| | | * @return |
| | | */ |
| | | public List<CouponReceiveInfoVO> getCartVoCouponList(Long companyId,List<ShopShoppingCart> shopShoppingCarts); |
| | | public List<CouponReceiveInfoVO> getCartVoCouponList(Long companyId,List<OrderItemDto> OrderItemDtos); |
| | | |
| | | |
| | | /** |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author jyy |
| | |
| | | private ShopActivitiesGroupJoinUserDao shopActivitiesGroupJoinUserDao; |
| | | |
| | | @Autowired |
| | | OrderCouponGroupService orderCouponGroupService; |
| | | |
| | | @Autowired |
| | | CustomerDataDictionaryDao dataDictionaryDao; |
| | | @Value("${wx_pay_debug_onoff}") |
| | | private boolean isDebug; |
| | | |
| | | @Autowired |
| | | private BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | @Autowired |
| | | private ScoreVipDetailDao scoreVipDetailDao; |
| | | |
| | | @Override |
| | | public BigDecimal calculationPostage(BigDecimal payPrice,Long companyId) { |
| | |
| | | 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, "请选择正确的收获地址"); |
| | | } |
| | | |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //计算订单优惠信息 |
| | | DiscountExplain discountExplain = buildDiscountExplain(cartList, addShopOrderPOJO.getCouponReceiveId(), bizUser.getCompanyId()); |
| | | AjaxResult caculateResult= buildDiscountExplain(shopOrderDto); |
| | | DiscountExplain discountExplain= (DiscountExplain) caculateResult.getMapInfo().get("discountExplain"); |
| | | |
| | | if(discountExplain.getScorePay()!=null){ |
| | | //校验用户积分是否够用 |
| | | int score=scoreVipDetailDao.selectUserTotalScore(bizUser.getOpenId(),null); |
| | | if(score<discountExplain.getScorePay()){ |
| | | return AjaxResult.buildFailInstance("积分不足"); |
| | | } |
| | | } |
| | | |
| | | 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.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); |
| | | 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 { |
| | | |
| | | orderCount += shopOrderDetails.getCount(); |
| | | if(orderItemDto.getCartId()!=null){ |
| | | //删除用户购物车选中的产品 |
| | | shoppingCartDao.deleteById(orderItemDto.getCartId()); |
| | | } |
| | | } else { |
| | | shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | 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()); |
| | | //设置支付状态 |
| | |
| | | //客户姓名 |
| | | shopOrder.setUserName(shopReceiveAddress.getAddrLiaisonman()); |
| | | //备注 |
| | | shopOrder.setRemarks(addShopOrderPOJO.getRemarks()); |
| | | shopOrder.setRemarks(shopOrderDto.getRemarks()); |
| | | //删除标识 |
| | | shopOrder.setDelFlag(AppConstance.DATA_USEABLE); |
| | | //微信订单号 |
| | |
| | | //获取邮费 |
| | | 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()); |
| | |
| | | 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); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public DiscountExplain buildDiscountExplain(List<ShopCartVo> cartList, Integer receiveId, Long companyId) { |
| | | ShopCartBillVo shopCartBill = shoppingCartService.buildShopCartBillVo(cartList); |
| | | public AjaxResult buildDiscountExplain(ShopOrderDto shopOrderDto) { |
| | | |
| | | if(CollUtil.isEmpty(shopOrderDto.getOrderItemList())){ |
| | | return AjaxResult.buildFailInstance("请选择购买的明细"); |
| | | } |
| | | |
| | | //订单计价说明 |
| | | DiscountExplain discountExplain = new DiscountExplain(); |
| | | discountExplain.setActivity(shopCartBill.getBillCouponTotal()); |
| | | discountExplain.setBillPrice(shopCartBill.getSrcTotal()); |
| | | discountExplain.setPayPrice(shopCartBill.getBillTotal()); |
| | | //账单总金额 |
| | | BigDecimal billPrice = BigDecimal.ZERO; |
| | | //活动优惠金额 |
| | | BigDecimal activityTotal = BigDecimal.ZERO; |
| | | //优惠券惠金额 |
| | | BigDecimal couponPrice = BigDecimal.ZERO; |
| | | //支付总积分 |
| | | Integer scoreCount=0; |
| | | |
| | | 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 (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()); |
| | | if (shopCoupon.getCouponId() != null) { |
| | | couponPrice=shopCoupon.getOffsetAmount(); |
| | | } |
| | | //优惠券金额 |
| | | discountExplain.setCouponPrice(couponPrice); |
| | | } |
| | | |
| | | discountExplain.setPostage(calculationPostage(discountExplain.getPayPrice(),companyId)); |
| | | |
| | | //计算实际支付 |
| | | discountExplain.setPayPrice(discountExplain.getPayPrice().add(discountExplain.getPostage())); |
| | | return discountExplain; |
| | | |
| | | //计算运费 |
| | | 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; |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | 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()); |
| | |
| | | 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)); |
| | |
| | | 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)); |
| | |
| | | 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; |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | public List<CouponReceiveInfoVO> getCartVoCouponList(Long companyId,List<ShopShoppingCart> shopShoppingCarts) { |
| | | public List<CouponReceiveInfoVO> getCartVoCouponList(Long companyId,List<OrderItemDto> OrderItemDtos){ |
| | | |
| | | |
| | | //可用优惠券列表 |
| | | List<CouponReceiveInfoVO> shopCoupons = new ArrayList<>(); |
| | |
| | | |
| | | |
| | | //定义购物车优惠分组 |
| | | List<ShopCartVo> cartList = new ArrayList<>(); |
| | | List<OrderCouponGroup> cartList = new ArrayList<>(); |
| | | |
| | | // 记录所有优惠券,一个优惠券(活动)表示一组 |
| | | Map<Integer, ShopCoupon> shopCouponMap = new HashMap<>(); |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | //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()); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | * 通过优惠券标签获取优惠券列表 |
| | | * |
| | | * @param tag 标签名称 |
| | | * @param shopId |
| | | * @return |
| | | */ |
| | | @Override |
| | |
| | | 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; |
| | |
| | | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Boolean refundToUser(String id, ShopRefundRecord shopRefundRecord) { |
| | | LogUtil.debug("进入退款接口进行退款。。。", id); |
| | | Boolean flag = false; |
| | |
| | | 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){ |
| | |
| | | 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.*; |
| | |
| | | private WxShopMemberDayService wxShopMemberDayService; |
| | | @Autowired |
| | | private BizUserService bizUserService; |
| | | @Autowired |
| | | private ShopScoreRecordDao shopScoreRecordDao; |
| | | |
| | | |
| | | private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日"); |
| | |
| | | |
| | | /** |
| | | * 处理产品规格信息 |
| | | * @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; |
| | | } |
| | |
| | | //设置购买数量 |
| | | 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); |
| | |
| | | |
| | | 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); |
| | |
| | | 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); |
| | | |
New file |
| | |
| | | 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; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | * 未优惠之前的总金额 |
| | | */ |
| | | 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; |
New file |
| | |
| | | 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; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | 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; |
| | |
| | | /** |
| | | * 购物车前台展示对象 |
| | | */ |
| | | @Data |
| | | public class ShopCartVo { |
| | | |
| | | private ShopCoupon coupon; |
| | | |
| | | private CouponReceiveInfoVO couponReceiveInfoVO; |
| | | |
| | | public CouponReceiveInfoVO getCouponReceiveInfoVO() { |
| | | return couponReceiveInfoVO; |
| | | } |
| | | |
| | | public void setCouponReceiveInfoVO(CouponReceiveInfoVO couponReceiveInfoVO) { |
| | | this.couponReceiveInfoVO = couponReceiveInfoVO; |
| | | } |
| | | |
| | | //是否满足优惠 |
| | | private boolean satisfactionCoupon; |
| | |
| | | |
| | | //优惠金额 |
| | | private BigDecimal couponPrice=BigDecimal.ZERO; |
| | | /** |
| | | * 抵用积分 |
| | | */ |
| | | private BigDecimal scorePay = 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; |
| | | } |
| | | } |
| | |
| | | * 用户ID |
| | | */ |
| | | private String userId; |
| | | |
| | | /** |
| | | * 支付积分 |
| | | */ |
| | | private Integer scorePay; |
| | | |
| | | /** |
| | | * 下单时间 |
| | |
| | | return orderNo; |
| | | } |
| | | |
| | | public Integer getScorePay() { |
| | | return scorePay; |
| | | } |
| | | |
| | | public void setScorePay(Integer scorePay) { |
| | | this.scorePay = scorePay; |
| | | } |
| | | |
| | | public void setOrderNo(String orderNo) { |
| | | this.orderNo = orderNo; |
| | |
| | | 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; |
| | | |
| | |
| | | * @author jyy |
| | | * @date 2019-06-10 10:58 |
| | | */ |
| | | |
| | | public class ShopOrderDetails extends EntityDTO{ |
| | | @Extend |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | *支付方式-直接购买 |
| | | */ |
| | | public static final int PAYTYPE_MICRO = 1; |
| | | /** |
| | | *支付方式-积分兑换 |
| | | */ |
| | | public static final int PAYTYPE_SCORE=2; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | private BigDecimal price; |
| | | |
| | | /** |
| | | * 总价 |
| | | */ |
| | | private BigDecimal totalPrice; |
| | | |
| | | /** |
| | | * 支付积分单价 |
| | | */ |
| | | private BigDecimal scoreCount; |
| | | |
| | | /** |
| | | * 支付总积分 |
| | | */ |
| | | private BigDecimal totalScoreCount; |
| | | |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | private Integer count; |
| | | |
| | | |
| | | /** |
| | | * 总价 |
| | | * 支付方式1 直接购买 2,积分兑换 |
| | | */ |
| | | private BigDecimal totalPrice; |
| | | private Integer payType; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | 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; |
| | | } |
| | |
| | | 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() { |
| | |
| | | |
| | | import com.matrix.core.anotations.Extend; |
| | | import com.matrix.system.common.bean.EntityDTOExt; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @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; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | * 分类ID |
| | | */ |
| | | private Integer categoryId; |
| | | |
| | | /** |
| | | * 积分商城分类ID |
| | | */ |
| | | private Integer scoreCategoryId; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | private String imgMobile; |
| | | |
| | | /** |
| | | * 是否可用积分支付 1是,2不是 |
| | | */ |
| | | private Integer ableScorePay; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 是否为分销产品 1是2不是 |
| | | */ |
| | | private Integer ableSales; |
| | | |
| | | /** |
| | | * 原价 |
| | |
| | | */ |
| | | @Extend |
| | | private String paramRefs; |
| | | |
| | | @Extend |
| | | private List<ShopProductParamRef> params; |
| | | |
| | |
| | | |
| | | |
| | | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | @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; |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | public class ShopShoppingCart extends EntityDTOExt { |
| | | @Extend |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | *购物车类型-直接购买 |
| | | */ |
| | | public static final int CAR_TYPE_MICRO =1; |
| | | /** |
| | | *购物车类型-积分兑换 |
| | | */ |
| | | public static final int CAR_TYPE_SCORE=2; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | * 用户是否选中 1选中 2未选中 |
| | | */ |
| | | private Integer isSelected; |
| | | /** |
| | | * 购物车类型 1直接支付 2积分兑换 |
| | | */ |
| | | private Integer cartType; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 门店id |
| | |
| | | */ |
| | | @Extend |
| | | private BigDecimal price; |
| | | /** |
| | | * 积分兑换所需支付金额 |
| | | */ |
| | | @Extend |
| | | private BigDecimal scorePrice; |
| | | /** |
| | | * 积分兑换所需支付积分 |
| | | */ |
| | | @Extend |
| | | private Integer scoreCount; |
| | | |
| | | /** |
| | | * 产品手机端封面地址 |
| | |
| | | |
| | | public void setIncreaseAndDecrease(Integer increaseAndDecrease) { |
| | | 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 shopCoupons; |
| | | } |
| | | |
| | | public Integer getCartType() { |
| | | return cartType; |
| | | } |
| | | |
| | | public void setCartType(Integer cartType) { |
| | | this.cartType = cartType; |
| | | } |
| | | } |
| | |
| | | private BigDecimal invitationPrice; |
| | | |
| | | /** |
| | | * 积分 |
| | | * 消费可得积分 |
| | | */ |
| | | private Integer score; |
| | | |
| | | /** |
| | | * 积分兑换所需支付金额 |
| | | */ |
| | | private BigDecimal scorePrice; |
| | | /** |
| | | * 积分兑换所需支付积分 |
| | | */ |
| | | private Integer scoreCount; |
| | | |
| | | |
| | | /** |
| | | * 排序 |
| | |
| | | |
| | | @Extend |
| | | private String goodsName; |
| | | |
| | | |
| | | public Integer getScoreCount() { |
| | | return scoreCount; |
| | | } |
| | | |
| | | public void setScoreCount(Integer scoreCount) { |
| | | this.scoreCount = scoreCount; |
| | | } |
| | | |
| | | public BigDecimal getSealesPrice() { |
| | | return sealesPrice; |
| | |
| | | this.goodsName = goodsName; |
| | | } |
| | | |
| | | public BigDecimal getScorePrice() { |
| | | return scorePrice; |
| | | } |
| | | |
| | | public void setScorePrice(BigDecimal scorePrice) { |
| | | this.scorePrice = scorePrice; |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | //这里以name为判定标准。 |
| | |
| | | package com.matrix.system.shopXcx.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 订单优惠说明 |
| | | */ |
| | | @Data |
| | | public class DiscountExplain { |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 优惠券金额 |
| | | */ |
| | | private BigDecimal coupon=BigDecimal.ZERO; |
| | | private BigDecimal couponPrice =BigDecimal.ZERO; |
| | | |
| | | |
| | | /** |
| | | * 活动满减金额 |
| | | */ |
| | | private BigDecimal activity=BigDecimal.ZERO; |
| | | private BigDecimal activityPrice =BigDecimal.ZERO; |
| | | |
| | | /** |
| | | * 运费 |
| | |
| | | * 最终支付金额 |
| | | */ |
| | | 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; |
| | | } |
| | | } |
| | |
| | | |
| | | String CREATE_ORDER = "CREATE_ORDER"; |
| | | String SALES_ORDER = "SALES_ORDER"; |
| | | String SCORE_ORDER = "SCORE_ORDER"; |
| | | /** |
| | | * 发送微信消息 |
| | | */ |
| | |
| | | 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; |
| | |
| | | @Autowired |
| | | private ShopSalesmanOrderDao shopSalesmanOrderDao; |
| | | |
| | | @Autowired |
| | | private ShopOrderDao shopOrderDao; |
| | | |
| | | @Autowired |
| | | private ScoreVipDetailService scoreVipDetailService; |
| | | |
| | | @Autowired |
| | | ShopOrderDetailsDao shopOrderDetailsDao; |
| | | |
| | | |
| | | @Override |
| | |
| | | }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); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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, |
| | | "微商城消费"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | "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} 会替换成随机数,后面的数字是随机数的位数 */ |
| | |
| | | "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", /* 插入的图片浮动方式 */ |
| | | |
| | | /* 抓取远程图片配置 */ |
| | |
| | | "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"], /* 抓取图片格式显示 */ |
| | | |
| | |
| | | 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`; |
| | |
| | | |
| | | ALTER TABLE `sys_order_item` |
| | | ADD COLUMN `refundCount` int(11) NULL COMMENT '退款数量' AFTER `pay_method_detail`; |
| | | |
| | | |
| | |
| | | "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} 会替换成随机数,后面的数字是随机数的位数 */ |
| | |
| | | "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", /* 插入的图片浮动方式 */ |
| | | |
| | | /* 抓取远程图片配置 */ |
| | |
| | | "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"], /* 抓取图片格式显示 */ |
| | | |
| | |
| | | "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> |
| | |
| | | "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> |
| | | |
| | | <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> |
| | | |
| | | <!-- 定义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="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> |
| | |
| | | <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> |
| | | |
| | |
| | | <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" /> |
| | | <!--支付时间--> |
| | |
| | | postage, |
| | | order_type, |
| | | activity_type, |
| | | score_pay, |
| | | company_id |
| | | </sql> |
| | | |
| | |
| | | #{item.postage}, |
| | | #{item.orderType}, |
| | | #{item.activityType}, |
| | | #{item.scorePay}, |
| | | #{item.companyId} |
| | | </sql> |
| | | |
| | |
| | | <if test="_parameter.containsKey('orderType')"> |
| | | order_type = #{orderType}, |
| | | </if> |
| | | <if test="_parameter.containsKey('scorePay')"> |
| | | score_pay = #{scorePay}, |
| | | </if> |
| | | </set> |
| | | WHERE id=#{id} |
| | | </update> |
| | |
| | | </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(), |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | <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 --> |
| | |
| | | <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"> |
| | |
| | | total_price, |
| | | s_title, |
| | | discount_explain, |
| | | discount_amount |
| | | discount_amount, |
| | | pay_type, |
| | | score_count, |
| | | total_score_count |
| | | </sql> |
| | | |
| | | <!-- 属性sql --> |
| | |
| | | #{item.totalPrice}, |
| | | #{item.sTitle}, |
| | | #{item.discountExplain}, |
| | | #{item.discountAmount} |
| | | #{item.discountAmount}, |
| | | #{item.payType}, |
| | | #{item.scoreCount}, |
| | | #{item.totalScoreCount} |
| | | </sql> |
| | | |
| | | <!-- where sql --> |
| | |
| | | </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> |
| | | |
| | |
| | | <if test="_parameter.containsKey('discountAmount')"> |
| | | discount_amount = #{discountAmount}, |
| | | </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> |
| | |
| | | <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 |
| | |
| | | </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) "> |
| | |
| | | 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 |
| | |
| | | <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> |
| | |
| | | <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"> |
| | |
| | | is_service, |
| | | service_time, |
| | | shop_ids, |
| | | company_id |
| | | company_id, |
| | | able_score_pay, |
| | | able_sales, |
| | | score_category_id |
| | | |
| | | </sql> |
| | | |
| | | <!-- 属性sql --> |
| | |
| | | #{item.isService}, |
| | | #{item.serviceTime}, |
| | | #{item.shopIds}, |
| | | #{item.companyId} |
| | | #{item.companyId}, |
| | | #{item.ableScorePay}, |
| | | #{item.ableSales}, |
| | | #{item.scoreCategoryId} |
| | | |
| | | </sql> |
| | | <!-- where sql --> |
| | | <sql id="where_sql"> |
| | |
| | | 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> |
| | | |
| | |
| | | |
| | | 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> |
| | | |
| | |
| | | <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} |
| | |
| | | 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} |
| | |
| | | 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 |
| | |
| | | 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} |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | <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"> |
| | |
| | | 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 |
| | |
| | | <result property="isSelected" column="isSelected" /> |
| | | <result property="shopId" column="shop_id" /> |
| | | <result property="companyId" column="company_id" /> |
| | | <result property="cartType" column="cart_type" /> |
| | | </resultMap> |
| | | |
| | | |
| | |
| | | <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 --> |
| | |
| | | cart_number, |
| | | isSelected, |
| | | shop_id, |
| | | company_id |
| | | company_id, |
| | | cart_type |
| | | |
| | | </sql> |
| | | |
| | | <!-- 属性sql --> |
| | |
| | | #{item.cartNumber}, |
| | | #{item.isSelected}, |
| | | #{item.shopId}, |
| | | #{item.companyId} |
| | | #{item.companyId}, |
| | | #{item.cartType} |
| | | |
| | | </sql> |
| | | |
| | | <!-- where sql --> |
| | |
| | | <if test="record.companyId != null and record.companyId !='' "> |
| | | and c.company_id = #{record.companyId} |
| | | </if> |
| | | |
| | | |
| | | </if> |
| | | |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | <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 锁表查询--> |
| | |
| | | <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"/> |
| | | |
| | | |
| | | |
| | |
| | | <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 --> |
| | |
| | | stock_code, |
| | | shop_id, |
| | | seales_price, |
| | | invitation_price |
| | | invitation_price, |
| | | score_price, |
| | | score_count |
| | | |
| | | |
| | | </sql> |
| | | |
| | | <!-- 属性sql --> |
| | |
| | | #{item.stockCode}, |
| | | #{item.shopId}, |
| | | #{item.sealesPrice}, |
| | | #{item.invitationPrice} |
| | | #{item.invitationPrice}, |
| | | #{item.scorePrice}, |
| | | #{item.scoreCount} |
| | | |
| | | |
| | | </sql> |
| | | |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | 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} |
| | |
| | | |
| | | //改变编辑页面,切换页面元素 |
| | | changePage(index){ |
| | | |
| | | this.currentPage=this.pageList[index]; |
| | | this.currentPageCode=this.pageList[index].code; |
| | | console.log(this.currentPageCode); |
| | | this.loadPageAds(); |
| | | }, |
| | | loadPageAds() { |
| | |
| | | <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"> |
| | |
| | | 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"> |
| | |
| | | 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">限购数量 |
| | |
| | | </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" > |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | }); |
| | | $(function () { |
| | | initSeclect("#parentId",[[${obj.categoryId}]]); |
| | | initScoreSeclect("#scoreCategoryId",[[${obj.scoreCategoryId}]]); |
| | | |
| | | |
| | | initAttrSeclect("#attrIds"); |
| | | $("#mobileDetails").html(obj.mobileDetails); |
| | | $("#pcDetails").html(obj.pcDetails); |
| | |
| | | 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= |
| | |
| | | +'<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); |
| | |
| | | layer.msg(result.info, { |
| | | icon : 2, |
| | | time : 1000, |
| | | end:function(){ |
| | | parent.myGrid.serchData(); |
| | | MTools.closeForm() |
| | | } |
| | | }); |
| | | return null; |
| | | } |
| | |
| | | //初始化分类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, |
| | |
| | | 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); |
| | | } |
| | |
| | | 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) { |
| | |
| | | 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, |
| | |
| | | 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, |
| | |
| | | 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, |
| | |
| | | <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> |
| | |
| | | </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> |
| | |
| | | <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> |
| | | |
| | |
| | | //初始化属性下拉选 |
| | | 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, |
| | |
| | | }); |
| | | } |
| | | |
| | | function ableScorePay(value, row, index) { |
| | | var html = ""; |
| | | if (value ==1) { |
| | | html="可抵扣" |
| | | }else{ |
| | | html="不可抵扣" |
| | | } |
| | | return html; |
| | | } |
| | | |
| | | /** |
| | | * 格式化属性 |
| | | */ |
| | |
| | | <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"> |
| | |
| | | </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> |
| | |
| | | <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({ |
| | |
| | | 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; |
| | |
| | | @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")); |
| | | } |