diff --git a/fuintAdmin/src/api/staff/user/user.js b/fuintAdmin/src/api/staff/user/user.js index 9a4171acb..c780ce0fd 100644 --- a/fuintAdmin/src/api/staff/user/user.js +++ b/fuintAdmin/src/api/staff/user/user.js @@ -42,6 +42,14 @@ export function getUserMobile(data) { data: data }) } +// 根据手机号查询会员详细 +export function getUserPhone(data) { + return request({ + url: '/business/userManager/user/phone' , + method: 'post', + data: data + }) +} // 新增会员 export function addUser(data) { diff --git a/fuintAdmin/src/main.js b/fuintAdmin/src/main.js index a6311e836..24a55cf50 100644 --- a/fuintAdmin/src/main.js +++ b/fuintAdmin/src/main.js @@ -49,7 +49,6 @@ Vue.prototype.addDateRange = addDateRange Vue.prototype.getName = getName Vue.prototype.download = download Vue.prototype.handleTree = handleTree - // 全局组件挂载 Vue.component('DictTag', DictTag) Vue.component('Pagination', Pagination) diff --git a/fuintAdmin/src/views/index.vue b/fuintAdmin/src/views/index.vue index 459db8391..336478847 100644 --- a/fuintAdmin/src/views/index.vue +++ b/fuintAdmin/src/views/index.vue @@ -35,6 +35,7 @@ export default { created() { // this.getHomeData(); this.getChartsData(); + }, methods: { // 查询首页数据 diff --git a/fuintAdmin/src/views/member/fixingLevel.vue b/fuintAdmin/src/views/member/fixingLevel.vue index 372c53b6d..7bf02fcee 100644 --- a/fuintAdmin/src/views/member/fixingLevel.vue +++ b/fuintAdmin/src/views/member/fixingLevel.vue @@ -38,18 +38,18 @@ /> - - - + + + + + + + + + + + + 搜索 @@ -73,18 +73,18 @@ /> - - - + + + + + + + + + + + + 搜索 diff --git a/fuintAdmin/src/views/member/index.vue b/fuintAdmin/src/views/member/index.vue index f5b5950dc..e1bf90fe3 100644 --- a/fuintAdmin/src/views/member/index.vue +++ b/fuintAdmin/src/views/member/index.vue @@ -2,11 +2,11 @@
- - - - - + + + + + { - if(response.data!=null){ + getUserPhone({mobile:this.form.mobile}).then( response => { + if(response.data){ this.$modal.msgError("手机号已存在"); }else { addUser(this.form).then(response => { diff --git a/fuintAdmin/src/views/member/userInfo.vue b/fuintAdmin/src/views/member/userInfo.vue index 581a1758f..b6aee601f 100644 --- a/fuintAdmin/src/views/member/userInfo.vue +++ b/fuintAdmin/src/views/member/userInfo.vue @@ -14,7 +14,7 @@
- +
绑定实体卡
@@ -29,7 +29,7 @@ {{form.name ? form.name : "--"}} {{form.idcard ? form.idcard : "--"}} - -- + @@ -43,10 +43,10 @@ {{ grade.name }} - -- - - 跟随全局总配置 - + + + + {{form.fixingLevel ? fixingLevelinfo(fixingLevelList,form.fixingLevel) : "--"}} @@ -716,6 +716,7 @@ export default { dicts: ['official','zhzt','zcrzdj','payment_type'], data(){ return{ + baseUrl:process.env.VUE_APP_BASE_API, flag:null, fixingLevelList:[], // 充值余额列表 diff --git a/fuintAdmin/src/views/staff/list.vue b/fuintAdmin/src/views/staff/list.vue index b797f9420..a8e53cec6 100644 --- a/fuintAdmin/src/views/staff/list.vue +++ b/fuintAdmin/src/views/staff/list.vue @@ -166,18 +166,18 @@ - - - - - - + v-for="item in roleList" + :key="item.dutyId" + :label="item.dutyName" + :value="item.dutyId" + > + + + + + + @@ -569,7 +569,7 @@ :title="title" :visible.sync="dialogVisible" style="margin-top: 100px" - width="20%"> + width="23%">
@@ -987,8 +987,8 @@ export default { margin-bottom: 20px; } .qrcode{ - width: 200px; - height: 300px; + width: 80%; + margin: 0 auto; margin-top: 15px; } diff --git a/fuintAdmin_zt/src/api/indexBanner/indexBanner.js b/fuintAdmin_zt/src/api/indexBanner/indexBanner.js index 1a6dccc18..22dc0e19f 100644 --- a/fuintAdmin_zt/src/api/indexBanner/indexBanner.js +++ b/fuintAdmin_zt/src/api/indexBanner/indexBanner.js @@ -29,7 +29,7 @@ export function addIndexBanner(data) { // 修改首页轮播图信息 export function updateIndexBanner(data) { return request({ - url: '/business/indexBanner/lists', + url: '/business/indexBanner', method: 'put', data: data }) diff --git a/fuintAdmin_zt/src/views/indexBanner/imgUpload/imgUpload.vue b/fuintAdmin_zt/src/views/indexBanner/imgUpload/imgUpload.vue new file mode 100644 index 000000000..95efb7dde --- /dev/null +++ b/fuintAdmin_zt/src/views/indexBanner/imgUpload/imgUpload.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/fuintAdmin_zt/src/views/indexBanner/index.vue b/fuintAdmin_zt/src/views/indexBanner/index.vue index c98fa5f54..ff255dec4 100644 --- a/fuintAdmin_zt/src/views/indexBanner/index.vue +++ b/fuintAdmin_zt/src/views/indexBanner/index.vue @@ -2,19 +2,18 @@
- - + + + + - + {{scope.row.storeId ? storeName(storeList,scope.row.storeId) : "--"}} - + + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/MerchantConfigServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/MerchantConfigServiceImpl.java index b4544a89a..a99c41769 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/MerchantConfigServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/MerchantConfigServiceImpl.java @@ -131,7 +131,12 @@ public class MerchantConfigServiceImpl extends ServiceImpl { //主键id @@ -29,7 +31,7 @@ public class ActiveConsumption extends Model { //活动名称 private String name; //满足金额 - private String participationConditionMoney; + private Double participationConditionMoney; //活动开始时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date activeStartTime; @@ -74,215 +76,5 @@ public class ActiveConsumption extends Model { //更新时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; - - public String getParticipationConditionMoney() { - return participationConditionMoney; - } - - public void setParticipationConditionMoney(String participationConditionMoney) { - this.participationConditionMoney = participationConditionMoney; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getChainStorId() { - return chainStorId; - } - - public void setChainStorId(Integer chainStorId) { - this.chainStorId = chainStorId; - } - - public Integer getStoreId() { - return storeId; - } - - public void setStoreId(Integer storeId) { - this.storeId = storeId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Date getActiveStartTime() { - return activeStartTime; - } - - public void setActiveStartTime(Date activeStartTime) { - this.activeStartTime = activeStartTime; - } - - public Date getActiveEndTime() { - return activeEndTime; - } - - public void setActiveEndTime(Date activeEndTime) { - this.activeEndTime = activeEndTime; - } - - public String getAdaptOil() { - return adaptOil; - } - - public void setAdaptOil(String adaptOil) { - this.adaptOil = adaptOil; - } - - public String getMember_type() { - return member_type; - } - - public void setMember_type(String member_type) { - this.member_type = member_type; - } - - public String getAdaptUserType() { - return adaptUserType; - } - - public void setAdaptUserType(String adaptUserType) { - this.adaptUserType = adaptUserType; - } - - public String getDieselUserLevel() { - return dieselUserLevel; - } - - public void setDieselUserLevel(String dieselUserLevel) { - this.dieselUserLevel = dieselUserLevel; - } - - public String getGasolineUserLevel() { - return gasolineUserLevel; - } - - public void setGasolineUserLevel(String gasolineUserLevel) { - this.gasolineUserLevel = gasolineUserLevel; - } - - public String getNaturalUserLevel() { - return naturalUserLevel; - } - - public void setNaturalUserLevel(String naturalUserLevel) { - this.naturalUserLevel = naturalUserLevel; - } - - public String getPaymentType() { - return paymentType; - } - - public void setPaymentType(String paymentType) { - this.paymentType = paymentType; - } - - public String getParticipationCondition() { - return participationCondition; - } - - public void setParticipationCondition(String participationCondition) { - this.participationCondition = participationCondition; - } - - public String getParticipationAcount() { - return participationAcount; - } - - public void setParticipationAcount(String participationAcount) { - this.participationAcount = participationAcount; - } - - public Integer getLimitAcount() { - return limitAcount; - } - - public void setLimitAcount(Integer limitAcount) { - this.limitAcount = limitAcount; - } - - public String getActiveGift() { - return activeGift; - } - - public void setActiveGift(String activeGift) { - this.activeGift = activeGift; - } - - public Integer getPoints() { - return points; - } - - public void setPoints(Integer points) { - this.points = points; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getIsonline() { - return isonline; - } - - public void setIsonline(String isonline) { - this.isonline = isonline; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public String getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveConsumptionVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveConsumptionVO.java new file mode 100644 index 000000000..d67709986 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveConsumptionVO.java @@ -0,0 +1,26 @@ +package com.fuint.business.marketingActivity.activeDiscount.vo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ActiveConsumptionVO implements Serializable { + + //活动id + private Integer activeId; + //活动名称 + private String activeName; + //适用会员 + private String adaptUser; + //可用油品 + private String oilId; + //积分 + private Integer points; + //满足金额 + private double amount; + //折扣 + private String activeGift; + //券id + private Integer vouchersId; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveDiscountPayVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveDiscountPayVO.java index 45b0253c3..b1224241d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveDiscountPayVO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveDiscountPayVO.java @@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.activeDiscount.vo; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; @Data public class ActiveDiscountPayVO implements Serializable { @@ -11,9 +12,9 @@ public class ActiveDiscountPayVO implements Serializable { //活动名称 private String activeName; //满足金额 - private double amount; + private BigDecimal amount; //折扣 - private double discount; + private BigDecimal discount; //可用油品 private String oilId; //适用会员 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/dto/PaymentActiveDTO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/dto/PaymentActiveDTO.java index aa72d52a1..96c0d148a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/dto/PaymentActiveDTO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/dto/PaymentActiveDTO.java @@ -3,13 +3,14 @@ package com.fuint.business.marketingActivity.activeExchange.dto; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; @Data public class PaymentActiveDTO implements Serializable { //支付类型 0:储值卡 1:囤油卡 2:现金 private String type; //支付金额 - private double amount; + private BigDecimal amount; //可用油品Id private Integer oilId; //店铺id diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java index 7e1923370..d4d6cf1cf 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java @@ -11,6 +11,7 @@ import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount import com.fuint.business.marketingActivity.activeDiscount.mapper.ActiveDiscountMapper; import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountChildService; import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountService; +import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveConsumptionVO; import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountAppletVO; import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountPayVO; import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountVO; @@ -38,15 +39,24 @@ import com.fuint.business.marketingActivity.cardValue.vo.CardValueAppletVO; import com.fuint.business.order.mapper.OilOrderMapper; import com.fuint.business.petrolStationManagement.entity.OilName; import com.fuint.business.petrolStationManagement.service.OilNameService; +import com.fuint.business.storeInformation.service.ILJStoreService; +import com.fuint.business.userManager.entity.LJUser; +import com.fuint.business.userManager.entity.UserBalance; +import com.fuint.business.userManager.mapper.LJUserMapper; import com.fuint.business.userManager.service.LJUserGradeService; +import com.fuint.business.userManager.service.LJUserService; +import com.fuint.business.userManager.service.UserBalanceService; +import com.fuint.business.userManager.vo.LJUserVo; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.TokenUtil; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -79,9 +89,15 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { @Resource private CardValueService cardValueService; @Resource - private ActiveDiscountMapper activeDiscountMapper; - @Resource private OilOrderMapper oilOrderMapper; + @Resource + private LJUserMapper ljUserMapper; + @Resource + private UserBalanceService userBalanceService; + @Resource + private ILJStoreService iljStoreService; + @Autowired + private LJUserService userService; /** * 分页查询所有 * @param @@ -394,19 +410,21 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { public PaymentActiveVO paymentActive(PaymentActiveDTO paymentActiveDTO) { PaymentActiveVO paymentActiveVO = new PaymentActiveVO(); Integer storeId = paymentActiveDTO.getStoreId(); - double amount = 0.0; - double fullAmount = 0.0; + BigDecimal amount = new BigDecimal(0.00); + BigDecimal fullAmount = new BigDecimal(0.00); + BigDecimal a = new BigDecimal(0.1); + BigDecimal b = new BigDecimal(10); //折扣 List activeDiscountVOList = oilOrderMapper.selectActiveDiscount(storeId,paymentActiveDTO.getAmount()); if (CollectionUtils.isNotEmpty(activeDiscountVOList)){ for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOList) { if (activeDiscountPayVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) && activeDiscountPayVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString())){ - if (activeDiscountPayVO.getDiscount() * activeDiscountPayVO.getAmount() > amount){ - amount = paymentActiveDTO.getAmount() - ((10-activeDiscountPayVO.getDiscount()) * activeDiscountPayVO.getAmount() * 0.1); + if (activeDiscountPayVO.getAmount().multiply(activeDiscountPayVO.getDiscount()).compareTo(amount) > 0){ + amount = paymentActiveDTO.getAmount().subtract(((b.subtract(activeDiscountPayVO.getDiscount())).multiply(activeDiscountPayVO.getAmount()).multiply(a))); paymentActiveVO.setActiveId(activeDiscountPayVO.getActiveId()); paymentActiveVO.setAmount(amount); - paymentActiveVO.setFavorableAmount((10-activeDiscountPayVO.getDiscount()) * activeDiscountPayVO.getAmount() * 0.1); + paymentActiveVO.setFavorableAmount((b.subtract(activeDiscountPayVO.getDiscount())).multiply(activeDiscountPayVO.getAmount()).multiply(a)); } } } @@ -418,18 +436,76 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { if (activeDiscountPayVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) && activeDiscountPayVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString())){ //如果满足条件 - if (paymentActiveDTO.getAmount() >= activeDiscountPayVO.getAmount()){ - fullAmount = paymentActiveDTO.getAmount() - activeDiscountPayVO.getDiscount(); - if (amount > fullAmount){ - amount = paymentActiveDTO.getAmount() - fullAmount; + if ((paymentActiveDTO.getAmount()).compareTo(activeDiscountPayVO.getAmount()) >= 0){ + fullAmount = paymentActiveDTO.getAmount().subtract(activeDiscountPayVO.getDiscount()); + if (amount.compareTo(fullAmount) > 0){ + amount = paymentActiveDTO.getAmount().subtract(fullAmount); paymentActiveVO.setActiveId(activeDiscountPayVO.getActiveId()); paymentActiveVO.setAmount(amount); - paymentActiveVO.setFavorableAmount(paymentActiveDTO.getAmount() - activeDiscountPayVO.getDiscount()); + paymentActiveVO.setFavorableAmount(paymentActiveDTO.getAmount().subtract(activeDiscountPayVO.getDiscount())); } } } } } + //消费有礼 + List activeConsumptionVOS = oilOrderMapper.selectActiveConsumption(storeId, paymentActiveDTO.getAmount()); + //连锁店信息 + LJUser ljUserVo = userService.queryUserByUserId(TokenUtil.getNowAccountInfo().getId()); + String accountName = TokenUtil.getNowAccountInfo().getAccountName(); + Integer storeId1 = paymentActiveDTO.getStoreId(); + Integer chainStoreId = iljStoreService.selectStoreByStoreId(storeId1).getChainStoreId(); + //用户余额 + UserBalance userBalance = userBalanceService.selectUserBalance(TokenUtil.getNowAccountInfo().getId(),chainStoreId); + UserBalance userBalance1 = new UserBalance(); + if (CollectionUtils.isNotEmpty(activeConsumptionVOS)){ + for (ActiveConsumptionVO activeConsumptionVO : activeConsumptionVOS) { + if (activeConsumptionVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) && + activeConsumptionVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString())){ + //如果满足条件/给当前用户加积分 + //用户 (新用户新建 老用户叠加) + if (ObjectUtils.isNotEmpty(userBalance)){ + //积分 + if (ObjectUtils.isNotEmpty(userBalance.getPoints()) && ObjectUtils.isNotEmpty(activeConsumptionVO.getPoints())){ + userBalance.setPoints(userBalance.getPoints() + activeConsumptionVO.getPoints()); + } + userBalanceService.updateUserBalance(userBalance); + }else { + userBalance1.setMtUserId(TokenUtil.getNowAccountInfo().getId()); + userBalance1.setChainStoreId(chainStoreId); + //积分 + if (ObjectUtils.isNotEmpty(activeConsumptionVO.getPoints())){ + userBalance1.setPoints(activeConsumptionVO.getPoints()); + } + userBalanceService.save(userBalance1); + } + //优惠券 + if (activeConsumptionVO.getActiveGift().equals("1")){ + CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); + cardFavorableRecord.setCardFavorableId(activeConsumptionVO.getVouchersId()); + cardFavorableRecord.setStoreId(storeId1); + cardFavorableRecord.setMtUserId(TokenUtil.getNowAccountInfo().getId()); + cardFavorableRecord.setName(ljUserVo.getName()); + cardFavorableRecord.setMobile(ljUserVo.getMobile()); + cardFavorableRecord.setStatus("0"); + cardFavorableRecord.setExchangeFrom("充值送券"); + cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord); + //兑换券 + }else if (activeConsumptionVO.getActiveGift().equals("2")){ + CardExchangeRecord cardExchangeRecord = new CardExchangeRecord(); + cardExchangeRecord.setCardExchangeId(activeConsumptionVO.getVouchersId()); + cardExchangeRecord.setStoreId(storeId1); + cardExchangeRecord.setMtUserId(ljUserVo.getId()); + cardExchangeRecord.setName(ljUserVo.getName()); + cardExchangeRecord.setMobile(ljUserVo.getMobile()); + cardExchangeRecord.setPhoto(ljUserVo.getAvatar()); + cardExchangeRecord.setStatus("0"); + cardExchangeRecord.setExchangeFrom("充值送券"); + cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord); + } + } + } + } return paymentActiveVO; } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/vo/PaymentActiveVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/vo/PaymentActiveVO.java index 0c6ea9f09..cafd9e95d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/vo/PaymentActiveVO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/vo/PaymentActiveVO.java @@ -3,13 +3,14 @@ package com.fuint.business.marketingActivity.activeExchange.vo; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; @Data public class PaymentActiveVO implements Serializable { //活动id private Integer activeId; //应付金额 - private double amount; + private BigDecimal amount; //优惠金额 - private double favorableAmount; + private BigDecimal favorableAmount; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/controller/ActiveRecommendRecordsController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/controller/ActiveRecommendRecordsController.java index f22f8664f..a6af53691 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/controller/ActiveRecommendRecordsController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/controller/ActiveRecommendRecordsController.java @@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.activeRecommend.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.marketingActivity.activeRecommend.dto.ActiveRecommendRecordsDTO; import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords; import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendRecordsService; import com.fuint.framework.web.BaseController; @@ -49,8 +50,8 @@ public class ActiveRecommendRecordsController extends BaseController { * @return */ @GetMapping("selectAllAmount") - public ResponseObject selectAllAmount() { - return getSuccessResult(this.activeRecommendRecordsService.selectAllAmount()); + public ResponseObject selectAllAmount(@Param("activeRecommendRecords") ActiveRecommendRecords activeRecommendRecords) { + return getSuccessResult(this.activeRecommendRecordsService.selectAllAmount(activeRecommendRecords)); } /** @@ -66,12 +67,12 @@ public class ActiveRecommendRecordsController extends BaseController { /** * 新增邀请记录接口 - * @param activeRecommendRecords 实体对象 + * @param activeRecommendRecordsDTO 实体对象 * @return 新增结果 */ @PostMapping - public ResponseObject insert(@RequestBody ActiveRecommendRecords activeRecommendRecords) { - return getSuccessResult(this.activeRecommendRecordsService.add(activeRecommendRecords)); + public ResponseObject insert(@RequestBody ActiveRecommendRecordsDTO activeRecommendRecordsDTO) { + return getSuccessResult(this.activeRecommendRecordsService.add(activeRecommendRecordsDTO)); } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/dto/ActiveRecommendRecordsDTO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/dto/ActiveRecommendRecordsDTO.java new file mode 100644 index 000000000..40b0d4b7f --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/dto/ActiveRecommendRecordsDTO.java @@ -0,0 +1,12 @@ +package com.fuint.business.marketingActivity.activeRecommend.dto; + +import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ActiveRecommendRecordsDTO extends ActiveRecommendRecords implements Serializable { + private Integer storeId; + private String type; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommend.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommend.java index d0a8dfd0a..9c0b50405 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommend.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommend.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; import java.io.Serializable; @@ -16,6 +17,7 @@ import java.io.Serializable; * @since 2023-11-13 15:09:50 */ @SuppressWarnings("serial") +@Data public class ActiveRecommend extends Model { //主键id @TableId(type = IdType.AUTO) @@ -58,167 +60,5 @@ public class ActiveRecommend extends Model { //更新时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; - - public String getTitleUrl() { - return titleUrl; - } - - public void setTitleUrl(String titleUrl) { - this.titleUrl = titleUrl; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getChainStoreId() { - return chainStoreId; - } - - public void setChainStoreId(Integer chainStoreId) { - this.chainStoreId = chainStoreId; - } - - public Integer getStoreId() { - return storeId; - } - - public void setStoreId(Integer storeId) { - this.storeId = storeId; - } - - public String getActivePictureUrl() { - return activePictureUrl; - } - - public void setActivePictureUrl(String activePictureUrl) { - this.activePictureUrl = activePictureUrl; - } - - public String getInviterGiftType() { - return inviterGiftType; - } - - public void setInviterGiftType(String inviterGiftType) { - this.inviterGiftType = inviterGiftType; - } - - public Integer getPoints() { - return points; - } - - public void setPoints(Integer points) { - this.points = points; - } - - public Integer getGrowthValue() { - return growthValue; - } - - public void setGrowthValue(Integer growthValue) { - this.growthValue = growthValue; - } - - public String getNewuserGiftType() { - return newuserGiftType; - } - - public void setNewuserGiftType(String newuserGiftType) { - this.newuserGiftType = newuserGiftType; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getInvitationCodeType() { - return invitationCodeType; - } - - public void setInvitationCodeType(String invitationCodeType) { - this.invitationCodeType = invitationCodeType; - } - - public String getRewardDisplay() { - return rewardDisplay; - } - - public void setRewardDisplay(String rewardDisplay) { - this.rewardDisplay = rewardDisplay; - } - - public String getActiveRule() { - return activeRule; - } - - public void setActiveRule(String activeRule) { - this.activeRule = activeRule; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getIsonline() { - return isonline; - } - - public void setIsonline(String isonline) { - this.isonline = isonline; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public String getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java index 06fee4766..dea0a7671 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java @@ -28,7 +28,7 @@ public class ActiveRecommendRecords extends Model { private Integer chainStoreId; //所属店铺id private Integer storeId; - //用户id + //邀请人id private String userId; //被邀请人id private String inviteeUserId; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/ActiveRecommendRecordsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/ActiveRecommendRecordsService.java index 9c9957f34..e03671f15 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/ActiveRecommendRecordsService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/ActiveRecommendRecordsService.java @@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.activeRecommend.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import com.fuint.business.marketingActivity.activeRecommend.dto.ActiveRecommendRecordsDTO; import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords; /** @@ -25,13 +26,13 @@ public interface ActiveRecommendRecordsService extends IService queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(ActiveRecommendRecords::getUserId,userId); queryWrapper.eq(ActiveRecommendRecords::getStoreId,storeId); @@ -83,12 +108,12 @@ public class ActiveRecommendRecordsServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(ActiveRecommendRecords::getUserId,userId); queryWrapper.eq(ActiveRecommendRecords::getStoreId,storeId); @@ -97,7 +122,9 @@ public class ActiveRecommendRecordsServiceImpl extends ServiceImpl activeRecommendChildList = activeRecommendVO.getActiveRecommendChildList(); if(CollectionUtils.isNotEmpty(activeRecommendChildList)){ @@ -118,21 +145,83 @@ public class ActiveRecommendRecordsServiceImpl extends ServiceImpl activeRecommendChildList = activeRecommendVO.getActiveRecommendChildList(); + if(CollectionUtils.isNotEmpty(activeRecommendChildList)){ + for (ActiveRecommendChild activeRecommendChild : activeRecommendChildList) { + //优惠券 + if (activeRecommendChild.getGiftUserType().equals("0") && activeRecommendChild.getActiveGift().equals("1")){ + CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); + cardFavorableRecord.setCardFavorableId(activeRecommendChild.getVouchersId()); + cardFavorableRecord.setStoreId(activeRecommendRecordsDTO.getStoreId()); + cardFavorableRecord.setMtUserId(ljUser1.getId()); + cardFavorableRecord.setName(ljUser1.getName()); + cardFavorableRecord.setMobile(ljUser1.getMobile()); + cardFavorableRecord.setStatus("0"); + cardFavorableRecord.setExchangeFrom("邀请新人送券"); + cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord); + } + //兑换券 + if (activeRecommendChild.getGiftUserType().equals("0") && activeRecommendChild.getActiveGift().equals("2")){ + CardExchangeRecord cardExchangeRecord = new CardExchangeRecord(); + cardExchangeRecord.setCardExchangeId(activeRecommendChild.getVouchersId()); + cardExchangeRecord.setStoreId(activeRecommendRecordsDTO.getStoreId()); + cardExchangeRecord.setMtUserId(ljUser1.getId()); + cardExchangeRecord.setName(ljUser1.getName()); + cardExchangeRecord.setMobile(ljUser1.getMobile()); + cardExchangeRecord.setPhoto(ljUser1.getAvatar()); + cardExchangeRecord.setStatus("0"); + cardExchangeRecord.setExchangeFrom("邀请新人送券"); + cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord); + } + //被邀请人优惠券 + if (activeRecommendChild.getGiftUserType().equals("1") && activeRecommendChild.getActiveGift().equals("1")){ + CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); + cardFavorableRecord.setCardFavorableId(activeRecommendChild.getVouchersId()); + cardFavorableRecord.setStoreId(activeRecommendRecordsDTO.getStoreId()); + cardFavorableRecord.setMtUserId(ljUser.getId()); + cardFavorableRecord.setName(ljUser.getName()); + cardFavorableRecord.setMobile(ljUser.getMobile()); + cardFavorableRecord.setStatus("0"); + cardFavorableRecord.setExchangeFrom("新人送券"); + cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord); + } + } + } + userBalanceService.updateById(userBalance); + //被邀请人 + activeRecommendRecords.setInviteeUserId(userId.toString()); + activeRecommendRecords.setInviteeUserName(ljUser.getName()); + return save(activeRecommendRecords); + } + return false; } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/vo/ActiveRecommendVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/vo/ActiveRecommendVO.java index 9c1eb40ad..852ea842e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/vo/ActiveRecommendVO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/vo/ActiveRecommendVO.java @@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.activeRecommend.vo; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fasterxml.jackson.annotation.JsonFormat; import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendChild; +import lombok.Data; import java.io.Serializable; import java.util.Date; @@ -15,6 +16,7 @@ import java.util.List; * @since 2023-11-13 15:09:50 */ @SuppressWarnings("serial") +@Data public class ActiveRecommendVO extends Model { //主键id private Integer id; @@ -58,175 +60,5 @@ public class ActiveRecommendVO extends Model { //更新时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; - - public String getTitleUrl() { - return titleUrl; - } - - public void setTitleUrl(String titleUrl) { - this.titleUrl = titleUrl; - } - - public String[] getInviterGiftType() { - return inviterGiftType; - } - - public void setInviterGiftType(String[] inviterGiftType) { - this.inviterGiftType = inviterGiftType; - } - - public List getActiveRecommendChildList() { - return activeRecommendChildList; - } - - public void setActiveRecommendChildList(List activeRecommendChildList) { - this.activeRecommendChildList = activeRecommendChildList; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getChainStoreId() { - return chainStoreId; - } - - public void setChainStoreId(Integer chainStoreId) { - this.chainStoreId = chainStoreId; - } - - public Integer getStoreId() { - return storeId; - } - - public void setStoreId(Integer storeId) { - this.storeId = storeId; - } - - public String getActivePictureUrl() { - return activePictureUrl; - } - - public void setActivePictureUrl(String activePictureUrl) { - this.activePictureUrl = activePictureUrl; - } - - public Integer getPoints() { - return points; - } - - public void setPoints(Integer points) { - this.points = points; - } - - public Integer getGrowthValue() { - return growthValue; - } - - public void setGrowthValue(Integer growthValue) { - this.growthValue = growthValue; - } - - public String getNewuserGiftType() { - return newuserGiftType; - } - - public void setNewuserGiftType(String newuserGiftType) { - this.newuserGiftType = newuserGiftType; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getInvitationCodeType() { - return invitationCodeType; - } - - public void setInvitationCodeType(String invitationCodeType) { - this.invitationCodeType = invitationCodeType; - } - - public String getRewardDisplay() { - return rewardDisplay; - } - - public void setRewardDisplay(String rewardDisplay) { - this.rewardDisplay = rewardDisplay; - } - - public String getActiveRule() { - return activeRule; - } - - public void setActiveRule(String activeRule) { - this.activeRule = activeRule; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getIsonline() { - return isonline; - } - - public void setIsonline(String isonline) { - this.isonline = isonline; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public String getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java index d3280652c..b8245c543 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java @@ -177,10 +177,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl implemen */ @Override public List selectDutyList() { - return baseMapper.selectList(null); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("duty_type","4"); + return baseMapper.selectList(queryWrapper); } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/service/impl/LJStaffServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/service/impl/LJStaffServiceImpl.java index 45565136a..7ff4952f7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/service/impl/LJStaffServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/service/impl/LJStaffServiceImpl.java @@ -108,7 +108,7 @@ public class LJStaffServiceImpl extends ServiceImpl impl @Override public void deleteStaffByIds(Integer[] ids) { for (int id : ids){ - baseMapper.deleteById(id); + this.deleteStaffById(id); } } @@ -118,6 +118,8 @@ public class LJStaffServiceImpl extends ServiceImpl impl */ @Override public void deleteStaffById(Integer id) { + LJStaff staff = this.selectStaffById(id); + accountService.deleteAccountByUserName(staff.getMobile()); baseMapper.deleteById(id); } @@ -152,7 +154,7 @@ public class LJStaffServiceImpl extends ServiceImpl impl account.setAccountName(staff.getMobile()); account.setAccountStatus(1); account.setRealName(staff.getRealName()); - account.setRoleIds("0"); + account.setRoleIds(staff.getRoleId()); account.setStaffId(staff1.getId()); account.setCreateTime(new Date()); account.setUpdateTime(new Date()); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/OilOrderMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/OilOrderMapper.java index 4d06ba36e..fb99640e9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/OilOrderMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/OilOrderMapper.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.largeSscreen.vo.OilOrderVO; +import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveConsumptionVO; import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountPayVO; import com.fuint.business.order.entity.OilOrder; import com.fuint.business.order.vo.Excel.OilOrderExcel; @@ -11,6 +12,7 @@ import com.fuint.business.order.vo.OilOrderVo; import com.fuint.business.petrolStationManagement.entity.OilNumber; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -81,7 +83,7 @@ public interface OilOrderMapper extends BaseMapper { * @param amount * @return */ - List selectActiveDiscount(@Param("storeId") Integer storeId, @Param("amount")double amount); + List selectActiveDiscount(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount); /** * 满减 @@ -89,5 +91,13 @@ public interface OilOrderMapper extends BaseMapper { * @param amount * @return */ - List selectActiveFule(@Param("storeId") Integer storeId, @Param("amount")double amount); + List selectActiveFule(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount); + + /** + * 消费有礼 + * @param storeId + * @param amount + * @return + */ + List selectActiveConsumption(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml index eeab45c4d..1bdcb5adb 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml @@ -371,4 +371,21 @@ and adc.amount <= #{amount} + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java index 3592729a1..e5280584c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java @@ -743,8 +743,8 @@ public class OilOrderServiceImpl extends ServiceImpl i oilOrder.setTankId(tankId); - Map applet = null; - + Map applet = new HashMap<>(); + applet.put("success",""); if (!map.get("payAmount").equals("0")) { // 调用支付接口 // 判断是否开启支付规则 @@ -777,6 +777,7 @@ public class OilOrderServiceImpl extends ServiceImpl i oilOrder.setPayTime(new Date()); oilOrder.setOrderStatus("paid"); baseMapper.updateById(oilOrder); + applet.put("success","ok"); } return applet; } @@ -885,7 +886,7 @@ public class OilOrderServiceImpl extends ServiceImpl i Integer dieselGrowthValue = null; Integer naturalGrowthValue = null; LJStore store = storeService.selectStoreByStoreId(storeId); - UserBalance balance = userBalanceService.selectUserBalanceByStorId(userid,storeId); + UserBalance balance = userBalanceService.selectUserBalance(userid,store.getChainStoreId()); int growth = balance.getGrowthValue(); balance.setRefuelMoney(refuelMoney); // 查询会员等级列表信息 @@ -944,15 +945,18 @@ public class OilOrderServiceImpl extends ServiceImpl i AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); // 根据用户id查询用户余额信息 LJStore store = storeService.selectStoreByStoreId(storeId); - UserBalance balance = userBalanceService.selectUserBalanceByStorId(userId,storeId); -// 修改余额信息 - Double beforeBalance = balance.getCardBalance(); - Double afterBalance = beforeBalance - amount; - balance.setCardBalance(afterBalance); + UserBalance balance = userBalanceService.selectUserBalance(userId,store.getChainStoreId()); + if (ObjectUtil.isNotEmpty(balance)){ + // 修改余额信息 + Double beforeBalance = balance.getCardBalance(); + Double afterBalance = beforeBalance - amount; + balance.setCardBalance(afterBalance); // 修改加油次数 - Integer consumeNum = balance.getConsumeNum(); - balance.setConsumeNum(consumeNum+1); - userBalanceService.updateUserBalance(balance); + Integer consumeNum = balance.getConsumeNum(); + balance.setConsumeNum(consumeNum+1); + userBalanceService.updateUserBalance(balance); + } + // 添加余额记录信息 CardBalanceChange cardBalanceChange = new CardBalanceChange(); cardBalanceChange.setUserId(userId); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/ExportController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/ExportController.java index e1f584a3f..7ce8af284 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/ExportController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/ExportController.java @@ -57,7 +57,7 @@ public class ExportController extends BaseController{ if (list.size() >= 1) { for (int i = 0; i < list.size(); i++) { LJUserVo user = (LJUserVo) list.get(i); - LJUser user1 = service.selectUserByMobile(user.getMobile()); + LJUserVo user1 = service.selectUserByMobileAndChantStoreId(user.getMobile()); if (user1!=null){ repeat += 1; }else { diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserController.java index 263b6be9f..b547f876b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserController.java @@ -113,6 +113,17 @@ public class LJUserController extends BaseController { return getSuccessResult(user); } + /** + * 根据storeId查询会员信息 + * @param storeId + * @return + */ + @GetMapping("/storeUser/{storeId}") + public ResponseObject userVoInfo(@PathVariable Integer storeId){ + LJUserVo user = userService.queryUserByStoreId(storeId); + return getSuccessResult(user); + } + @GetMapping("/getByUniApp") public ResponseObject getByUniApp(Integer chainStoreId){ LJUserVo user = userService.getByUniApp(chainStoreId); @@ -128,6 +139,18 @@ public class LJUserController extends BaseController { return getSuccessResult(userBalanceService.getUserBalance()); } + /** + * 根据手机号查询会员信息 + * @param map + * @return + */ + @PostMapping("/phone") + public ResponseObject userInfoByPhone(@Validated @RequestBody Map map){ + String mobile = map.get("mobile"); + LJUserVo user = userService.selectUserByMobileAndChantStoreId(mobile); + return getSuccessResult(user); + } + /** * 根据手机号查询会员信息 * @param map diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserGradeController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserGradeController.java index 5fd7678dd..f3f2f3564 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserGradeController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/LJUserGradeController.java @@ -6,16 +6,19 @@ import com.fuint.business.userManager.entity.LJUserGrade; import com.fuint.business.userManager.service.LJUserGradeService; import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.HashMap; import java.util.Map; /** * 会员等级信息 controller层 */ @RestController +@Slf4j @RequestMapping("/business/userManager/userGrade") public class LJUserGradeController extends BaseController { @Autowired @@ -72,13 +75,21 @@ public class LJUserGradeController extends BaseController { /** * 根据id查询会员等级信息 - * @param id + * @param map * @return */ - @GetMapping("/isUse/{id}") - public ResponseObject userGrade(@PathVariable Integer id){ - LJUserGrade userGrade = userGradeService.selectUserGradeByIdIsUse(id); - return getSuccessResult(userGrade); + @PostMapping("/isUse") + public ResponseObject userGrade(@RequestBody Map map){ + Map map1 =new HashMap<>(); + try { + Integer userId = Integer.valueOf(map.get("userId")); + String storeId = map.get("storeId"); + String gradeId = map.get("gradeId"); + map1 = userGradeService.selectUserGradeByIdIsUse(userId, storeId, gradeId); + }catch (Exception e){ + log.error(e.getMessage()); + } + return getSuccessResult(map1); } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/LJUserMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/LJUserMapper.java index 2a860228c..05a76cf3a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/LJUserMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/LJUserMapper.java @@ -28,6 +28,13 @@ public interface LJUserMapper extends BaseMapper { */ public List queryUserList(@Param("storeId") int storeId); + /** + * 根据手机号和连锁店id查询会员信息 + * @param mobile + * @return + */ + public LJUserVo selectUserByMobileAndChantStoreId(@Param("mobile") String mobile,@Param("chainStoreId") int chainStoreId); + /** * 根据id查询用户信息 * @param id @@ -35,6 +42,13 @@ public interface LJUserMapper extends BaseMapper { */ public LJUserVo selectUserById(@Param("id") Integer id); + /** + * 根据连锁店id查询用户信息 + * @param chainStoreId + * @return + */ + public LJUserVo queryUserByChainStoreId(@Param("userId") int userId,@Param("chainStoreId") int chainStoreId); + /** * uniapp使用 * @param id diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/LJUserMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/LJUserMapper.xml index 3bf11ae1c..18a2feca5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/LJUserMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/LJUserMapper.xml @@ -4,22 +4,25 @@ select mu.*,mub.grade_id,mub.card_balance,mub.points,mub.consume_num,mub.growth_value,mub.refuel_money, mub.second_card,mub.fixing_level, - mi.storeId,mi.staffId,mi.inviterId,mi.chain_store_id from mt_user mu - left join mt_user_balance mub on mu.id = mub.mt_user_id - left join mt_invitation mi on mu.id = mi.userId + mi.storeId,mi.staffId,mi.inviterId,mub.chain_store_id from mt_user mu + inner join mt_user_balance mub on mu.id = mub.mt_user_id + inner join mt_invitation mi on mu.id = mi.userId + + + select mu.*,mub.grade_id,mub.card_balance,mub.points,mub.consume_num,mub.growth_value,mub.refuel_money, + mub.second_card,mub.fixing_level + FROM mt_user mu + LEFT JOIN mt_user_balance mub ON mu.id = mub.mt_user_id - + mu.mobile = #{mobile} @@ -70,6 +73,24 @@ + + + +