1 files added
7 files modified
| | |
| | | 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.vo.SalesOrderVo; |
| | | import com.matrix.system.shopXcx.api.vo.ScoreUseRecordVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | |
| | | * @param scoreFlowDto |
| | | * @return |
| | | */ |
| | | IPage<ScoreUseRecord> selectFlowList(Page<SalesOrderVo> page, @Param("record")ScoreFlowDto scoreFlowDto); |
| | | IPage<ScoreUseRecordVo> selectFlowList(Page<ScoreUseRecordVo> page, @Param("record")ScoreFlowDto scoreFlowDto); |
| | | } |
| | |
| | | @TableName("score_use_record") |
| | | public class ScoreUseRecord extends BaseEntity{ |
| | | @Extend |
| | | private static final long serialVersionUID = 1L; |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | private Long businessId; |
| | | |
| | | /** |
| | | * 操作人id |
| | | */ |
| | | Long oprationUserId; |
| | | /** |
| | | * 积分卡ID |
| | | */ |
| | |
| | | private String openId; |
| | | |
| | | private Long vipId; |
| | | |
| | | |
| | | private Long shopId; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | |
| | | * @param type |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deductionScore(String openId, Long vipId, Integer score, Long businessId, int type) { |
| | | public void deductionScore(String openId, Long vipId,Long shopId, Integer score, Long businessId, int type) { |
| | | Long companyId=null; |
| | | if(openId!=null){ |
| | | companyId= bizUserDao.findByOpenId(openId).getCompanyId(); |
| | |
| | | scoreUseRecord.setBusinessId(businessId); |
| | | scoreUseRecord.setRecNum(-currentDedution); |
| | | scoreUseRecord.setRecType(type); |
| | | scoreUseRecord.setShopId(shopId); |
| | | scoreUseRecord.setOpenId(openId); |
| | | scoreUseRecord.setVipId(vipId); |
| | | scoreUseRecordDao.insert(scoreUseRecord); |
| | |
| | | * @param type |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addScore(String openId, Long vipId, Long oprationUserId, Integer score, Long businessId, int type) { |
| | | public void addScore(String openId, Long vipId, Long oprationUserId,Long shopId, Integer score, Long businessId, int type) { |
| | | Long companyId=null; |
| | | if(openId!=null){ |
| | | companyId= bizUserDao.findByOpenId(openId).getCompanyId(); |
| | |
| | | scoreUseRecord.setRecType(type); |
| | | scoreUseRecord.setOpenId(openId); |
| | | scoreUseRecord.setVipId(vipId); |
| | | scoreUseRecord.setShopId(shopId); |
| | | scoreUseRecord.setOprationUserId(oprationUserId); |
| | | scoreUseRecordDao.insert(scoreUseRecord); |
| | | |
| | | |
| | |
| | | |
| | | //扣除积分 |
| | | if(order.getScorePay()!=null){ |
| | | scoreVipDetailService.deductionScore(order.getUserId(),null,order.getScorePay(),Long.parseLong(order.getId()+""), ScoreVipDetail.SCORE_VIP_TYPE_CASH); |
| | | scoreVipDetailService.deductionScore(order.getUserId(),null,Long.parseLong(order.getStoreId()+""),order.getScorePay(),Long.parseLong(order.getId()+""), ScoreVipDetail.SCORE_VIP_TYPE_CASH); |
| | | } |
| | | |
| | | threadResult.putInMap("status", "success"); |
| | |
| | | import com.matrix.system.score.dao.ScoreUseRecordDao; |
| | | import com.matrix.system.score.entity.ScoreUseRecord; |
| | | import com.matrix.system.shopXcx.api.dto.ScoreFlowDto; |
| | | import com.matrix.system.shopXcx.api.vo.ScoreUseRecordVo; |
| | | import com.matrix.system.shopXcx.vo.SalesOrderVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | @ApiOperation(value = "获取积分流水", notes = "") |
| | | @PostMapping(value = "/getOrderList") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = ScoreUseRecord.class) |
| | | @ApiResponse(code = 200, message = "ok", response = ScoreUseRecordVo.class) |
| | | }) |
| | | AjaxResult getInvitationuserList(@RequestBody @Validated ScoreFlowDto scoreFlowDto) { |
| | | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | Page<SalesOrderVo> page=new Page<>(scoreFlowDto.getPageNum(),scoreFlowDto.getPageSize()); |
| | | Page<ScoreUseRecordVo> page=new Page<>(scoreFlowDto.getPageNum(),scoreFlowDto.getPageSize()); |
| | | scoreFlowDto.setUserId(loginUser.getOpenId()); |
| | | IPage<ScoreUseRecord> shopScoreRecord = scoreUseRecordDao.selectFlowList(page, scoreFlowDto); |
| | | IPage<ScoreUseRecordVo> shopScoreRecord = scoreUseRecordDao.selectFlowList(page, scoreFlowDto); |
| | | AjaxResult result=AjaxResult.buildSuccessInstance(shopScoreRecord.getRecords()); |
| | | return result; |
| | | } |
New file |
| | |
| | | package com.matrix.system.shopXcx.api.vo; |
| | | |
| | | 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 = "调整时间") |
| | | 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; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | <mapper namespace="com.matrix.system.score.dao.ScoreUseRecordDao"> |
| | | |
| | | <select id="selectFlowList" resultType="com.matrix.system.score.entity.ScoreUseRecord"> |
| | | select * from score_use_record |
| | | where open_id=#{record.userId} |
| | | and DATE_FORMAT(create_time,'%Y-%m')=#{record.queryTime} |
| | | |
| | | <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 rec_num>0 |
| | | and a.rec_num>0 |
| | | </if> |
| | | <if test="record.revenueType==2"> |
| | | <![CDATA[ and rec_num<0 ]]> |
| | | <![CDATA[ and a.rec_num<0 ]]> |
| | | </if> |
| | | order by create_time desc |
| | | order by a.create_time desc |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | | </mapper> |
| | |
| | | |
| | | @Test |
| | | public void scoreVipDetailService() throws InterruptedException { |
| | | scoreVipDetailService.addScore("oJkRK4yelehsY4S7I6Ee1ydWtQMI",null,null,15,1L,1); |
| | | scoreVipDetailService.addScore("oJkRK4yelehsY4S7I6Ee1ydWtQMI",null,null,null,15,1L,1); |
| | | } |
| | | |
| | | /** |