| | |
| | | * 新增用户积分 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addScore(String openId, Long vipId, Long oprationUserId,Long shopId, Integer score, Long businessId, int type) { |
| | | 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(); |
| | |
| | | scoreUseRecord.setVipId(vipId); |
| | | scoreUseRecord.setShopId(shopId); |
| | | scoreUseRecord.setOprationUserId(oprationUserId); |
| | | scoreUseRecord.setRemarks(remark); |
| | | scoreUseRecordDao.insert(scoreUseRecord); |
| | | |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(DateTime.now().isAfter(DateTime.of("2020-11-11 23:22","yyyy-MM-dd HH:mm"))); |
| | | 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); |
| | | } |
| | | |
| | | } |
| | |
| | | ScoreVipDetailDao scoreVipDetailDao; |
| | | |
| | | @ApiOperation(value = "获取积分流水", notes = "") |
| | | @PostMapping(value = "/getOrderList") |
| | | @PostMapping(value = "/getFlowList") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = ScoreUseRecordVo.class) |
| | | }) |
| | | AjaxResult getInvitationuserList(@RequestBody @Validated ScoreFlowDto scoreFlowDto) { |
| | | 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()); |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | private Integer recType; |
| | | |
| | | @ApiModelProperty(value = "调整时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone="GMT+8") |
| | | private Date createTime; |
| | | |
| | | |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 分销订单退款 |
| | |
| | | @Autowired |
| | | private ScoreVipDetailService scoreVipDetailService; |
| | | |
| | | @Autowired |
| | | ShopOrderDetailsDao shopOrderDetailsDao; |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | 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){ |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | Long.parseLong(order.getStoreId()+""), |
| | | addScore, |
| | | Long.parseLong(orderId+""), |
| | | ScoreVipDetail.SCORE_VIP_TYPE_CASH); |
| | | ScoreVipDetail.SCORE_VIP_TYPE_CASH, |
| | | "微商城消费"); |
| | | } |
| | | }); |
| | | |
| | |
| | | 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`; |
| | |
| | | |
| | | @Test |
| | | public void scoreVipDetailService() throws InterruptedException { |
| | | scoreVipDetailService.addScore("oJkRK4yelehsY4S7I6Ee1ydWtQMI",null,null,null,15,1L,1); |
| | | scoreVipDetailService.addScore("oJkRK4yelehsY4S7I6Ee1ydWtQMI",null,null,null,15,1L,1,"测试"); |
| | | } |
| | | |
| | | /** |