From 869f189c4d5483b270bc256f431dfce7a44927df Mon Sep 17 00:00:00 2001 From: wangh <9483> Date: Tue, 5 Dec 2023 09:24:31 +0800 Subject: [PATCH] no message --- fuintAdmin/src/components/Editor/index.vue | 1 + .../IntegralGiftCategoryController.java | 8 ++ .../controller/IntegralGiftController.java | 17 +++ .../IntegralSettingsController.java | 16 +++ .../integral/entity/IntegralDetail.java | 2 +- .../integral/mapper/IntegralDetailMapper.java | 9 ++ .../mapper/IntegralGiftCategoryMapper.java | 5 + .../mapper/IntegralSettingsMapper.java | 2 +- .../mapper/xml/IntegralDetailMapper.xml | 23 +++ .../service/IntegralDetailService.java | 1 + .../service/IntegralGiftCategoryService.java | 4 + .../integral/service/IntegralGiftService.java | 12 +- .../service/IntegralSettingsService.java | 5 + .../impl/IntegralDetailServiceImpl.java | 8 ++ .../impl/IntegralGiftCategoryServiceImpl.java | 6 + .../service/impl/IntegralGiftServiceImpl.java | 6 + .../impl/IntegralOrdersServiceImpl.java | 6 +- .../impl/IntegralSettingsServiceImpl.java | 131 +++++++++++++++++- .../impl/CardFuelRecordServiceImpl.java | 2 +- .../impl/CardValueRecordServiceImpl.java | 4 +- .../service/ILJStoreService.java | 3 + .../service/impl/LJStoreServiceImpl.java | 11 ++ .../userManager/mapper/LJUserMapper.java | 1 + .../userManager/mapper/xml/LJUserMapper.xml | 18 +++ 24 files changed, 285 insertions(+), 16 deletions(-) diff --git a/fuintAdmin/src/components/Editor/index.vue b/fuintAdmin/src/components/Editor/index.vue index 8edb34edb..46b482388 100644 --- a/fuintAdmin/src/components/Editor/index.vue +++ b/fuintAdmin/src/components/Editor/index.vue @@ -175,6 +175,7 @@ export default { if (res.code == 200) { // 获取光标所在位置 let length = quill.getSelection().index; + console.log("这是一个url",res) // 插入图片 res.url为服务器返回的图片地址 quill.insertEmbed(length, "image", res.data.url); // 调整光标到最后 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralGiftCategoryController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralGiftCategoryController.java index ab46dd582..eb39317c4 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralGiftCategoryController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralGiftCategoryController.java @@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Param; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.List; /** * 礼品分类表(IntegralGiftCategory)表控制层 @@ -44,6 +45,13 @@ public class IntegralGiftCategoryController extends BaseController { return getSuccessResult(integralGiftCategoryIPage); } + + @GetMapping("queryListByStoreId") + public ResponseObject queryListByStoreId(@Param("integralGiftCategory") IntegralGiftCategory integralGiftCategory) { + List integralGiftCategoryIPage = this.integralGiftCategoryService.queryListByStoreId(integralGiftCategory); + return getSuccessResult(integralGiftCategoryIPage); + } + /** * 通过主键查询单条数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralGiftController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralGiftController.java index 7e0eaa96c..c29e1205d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralGiftController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralGiftController.java @@ -45,6 +45,23 @@ public class IntegralGiftController extends BaseController { } + /** + * 分页查询(uniapp使用) + * + * @param integralGift 筛选条件 + * @param pageNo 分页对象 + * @return 查询结果 + */ + @GetMapping("queryByPageByStoreId") + public ResponseObject queryByPageByStoreId(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize",defaultValue = "1000") Integer pageSize, + @Param("integralGift") IntegralGift integralGift) { + Page page = new Page(pageNo, pageSize); + IPage integralGiftCategoryIPage = this.integralGiftService.queryByPageByStoreId(page, integralGift); + return getSuccessResult(integralGiftCategoryIPage); + } + + /** * 通过主键查询单条数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralSettingsController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralSettingsController.java index 4b9ef0d0a..668ca2511 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralSettingsController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralSettingsController.java @@ -7,6 +7,7 @@ import com.fuint.business.integral.entity.IntegralSettings; import com.fuint.business.integral.service.IntegralSettingsService; import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; +import io.swagger.models.auth.In; import org.springframework.web.bind.annotation.*; import io.lettuce.core.dynamic.annotation.Param; @@ -110,5 +111,20 @@ public class IntegralSettingsController extends BaseController { return getSuccessResult(this.integralSettingsService.deleteById(id)); } + + /** + * 查询当前用户是否已经签到过 或者是否开启签到功能 + * @return + */ + @GetMapping("todayIsSignIn") + public ResponseObject todayIsSignIn(Integer storeId) { + return getSuccessResult(this.integralSettingsService.todayIsSignIn(storeId)); + } + + @PostMapping("signInFunction") + public ResponseObject signInFunction(@RequestBody IntegralSettings integralSettings) { + return getSuccessResult(this.integralSettingsService.signInFunction(integralSettings)); + } + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralDetail.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralDetail.java index ff62a8b78..bd846d7bb 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralDetail.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralDetail.java @@ -24,7 +24,7 @@ public class IntegralDetail extends BaseEntity { /** * 积分变动的数量,可以是正数表示增加,负数表示减少 */ - private Integer pointsChange; + private Double pointsChange; /** * 变动后用户的当前积分总数 */ diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralDetailMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralDetailMapper.java index 822c673b4..25cad5109 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralDetailMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralDetailMapper.java @@ -81,5 +81,14 @@ public interface IntegralDetailMapper { */ int deleteById(Integer id); + /** + * 查询当天数据 + * @param type + * @return + */ + List signInGifts(@Param("type") String type); + + List signInGiftsYesterday(@Param("type") String type); + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralGiftCategoryMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralGiftCategoryMapper.java index 8231fe547..945d84953 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralGiftCategoryMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralGiftCategoryMapper.java @@ -32,6 +32,11 @@ public interface IntegralGiftCategoryMapper { */ IPage queryAllByLimit(@Param("page") Page page, @Param("integralGiftCategory") IntegralGiftCategory integralGiftCategory); + + List queryAllByLimit(@Param("integralGiftCategory") IntegralGiftCategory integralGiftCategory); + + + /** * 统计总行数 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralSettingsMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralSettingsMapper.java index 0796c2b20..9985c0257 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralSettingsMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralSettingsMapper.java @@ -22,7 +22,7 @@ public interface IntegralSettingsMapper { * @return 实例对象 */ IntegralSettings queryById(Integer id); - IntegralSettings getByStoreId(Integer id); + IntegralSettings getByStoreId(Integer storeId); /** * 查询指定行数据 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml index c4410b839..a3ffc0dcd 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml @@ -185,5 +185,28 @@ delete from integral_detail where id = #{id} + + + + + + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralDetailService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralDetailService.java index 236cf6835..05c33fd99 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralDetailService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralDetailService.java @@ -38,6 +38,7 @@ public interface IntegralDetailService { * @return 实例对象 */ IntegralDetail insert(IntegralDetail integralDetail); + IntegralDetail insert2(IntegralDetail integralDetail); /** * 修改数据 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralGiftCategoryService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralGiftCategoryService.java index bc91505ff..ee387d7f0 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralGiftCategoryService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralGiftCategoryService.java @@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.integral.entity.IntegralGiftCategory; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 礼品分类表(IntegralGiftCategory)表服务接口 * @@ -30,6 +32,8 @@ public interface IntegralGiftCategoryService { */ IPage queryByPage(@Param("page") Page page, @Param("integralGiftCategory") IntegralGiftCategory integralGiftCategory); + + List queryListByStoreId(@Param("integralGiftCategory") IntegralGiftCategory integralGiftCategory); /** * 新增数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralGiftService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralGiftService.java index 965aab2c5..672230f2f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralGiftService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralGiftService.java @@ -1,12 +1,13 @@ package com.fuint.business.integral.service; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.integral.entity.IntegralGift; -import com.fuint.business.integral.entity.IntegralGiftCategory; + import com.fuint.business.integral.vo.IntegralGiftVO; import org.apache.ibatis.annotations.Param; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; + + /** * (IntegralGift)表服务接口 @@ -32,7 +33,10 @@ public interface IntegralGiftService { * @param page 分页对象 * @return 查询结果 */ - IPage queryByPage(@Param("page") com.baomidou.mybatisplus.extension.plugins.pagination.Page page, @Param("integralGift") IntegralGift integralGift); + IPage queryByPage(@Param("page") Page page, @Param("integralGift") IntegralGift integralGift); + + + IPage queryByPageByStoreId(@Param("page") Page page, @Param("integralGift") IntegralGift integralGift); /** * 新增数据 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralSettingsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralSettingsService.java index 4043519d3..d36e7cd1b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralSettingsService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/IntegralSettingsService.java @@ -64,4 +64,9 @@ public interface IntegralSettingsService { */ boolean deleteById(Integer id); + + Integer todayIsSignIn(Integer storeId); + + IntegralSettings signInFunction(IntegralSettings integralSettings); + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralDetailServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralDetailServiceImpl.java index f9881b1b6..56805f955 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralDetailServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralDetailServiceImpl.java @@ -65,6 +65,14 @@ public class IntegralDetailServiceImpl implements IntegralDetailService { return integralDetail; } + @Override + public IntegralDetail insert2(IntegralDetail integralDetail) { +// integralDetail.setStoreId(nowAccountInfo.getStoreId()); +// integralDetail.setCreateBy(nowAccountInfo.getStaffId().toString()); + this.integralDetailMapper.insert(integralDetail); + return integralDetail; + } + /** * 修改数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralGiftCategoryServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralGiftCategoryServiceImpl.java index f2482b5be..fa9f29b9b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralGiftCategoryServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralGiftCategoryServiceImpl.java @@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.List; /** * 礼品分类表(IntegralGiftCategory)表服务实现类 @@ -49,6 +50,11 @@ public class IntegralGiftCategoryServiceImpl implements IntegralGiftCategoryServ return integralGiftCategoryDao.queryAllByLimit(page, integralGiftCategory); } + @Override + public List queryListByStoreId(IntegralGiftCategory integralGiftCategory) { + return integralGiftCategoryDao.queryAllByLimit(integralGiftCategory); + } + /** * 新增数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralGiftServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralGiftServiceImpl.java index 294166425..681e677cb 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralGiftServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralGiftServiceImpl.java @@ -51,6 +51,12 @@ public class IntegralGiftServiceImpl implements IntegralGiftService { return integralGiftDao.queryAllByLimit(page, integralGift); } + + @Override + public IPage queryByPageByStoreId(@Param("page") Page page, @Param("integralGiftCategory") IntegralGift integralGift) { + return integralGiftDao.queryAllByLimit(page, integralGift); + } + /** * 新增数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralOrdersServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralOrdersServiceImpl.java index e51059dd6..dff473bf1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralOrdersServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralOrdersServiceImpl.java @@ -258,10 +258,10 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService { private IntegralDetail changesInPoints(Double totalPoints,LJUserVo ljUserVos) { IntegralDetail integralDetail = new IntegralDetail(); integralDetail.setUserId(ljUserVos.getId()); - integralDetail.setPointsChange(-totalPoints.intValue()); + integralDetail.setPointsChange(-totalPoints); // 计算积分 - BigDecimal bigPoints = new BigDecimal(ljUserVos.getPoints()); - BigDecimal addPoints = bigPoints.subtract(new BigDecimal(totalPoints)); + BigDecimal bigPoints = new BigDecimal(ljUserVos.getPoints().toString()); + BigDecimal addPoints = bigPoints.subtract(new BigDecimal(totalPoints.toString())); integralDetail.setChangeType("0"); integralDetail.setCurrentPoints(addPoints.intValue()); integralDetail.setChangeReason("收银台积分商城兑换"); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralSettingsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralSettingsServiceImpl.java index 817f8fa50..76d63edc7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralSettingsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralSettingsServiceImpl.java @@ -3,23 +3,35 @@ package com.fuint.business.integral.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fuint.business.integral.entity.IntegralDetail; import com.fuint.business.integral.entity.IntegralGift; import com.fuint.business.integral.entity.IntegralSettings; +import com.fuint.business.integral.mapper.IntegralDetailMapper; import com.fuint.business.integral.mapper.IntegralSettingsMapper; +import com.fuint.business.integral.service.IntegralDetailService; import com.fuint.business.integral.service.IntegralSettingsService; import com.fuint.business.petrolStationManagement.entity.OilNumber; import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper; +import com.fuint.business.storeInformation.entity.LJStore; +import com.fuint.business.storeInformation.service.ILJStoreService; +import com.fuint.business.userManager.entity.UserBalance; +import com.fuint.business.userManager.mapper.LJUserMapper; +import com.fuint.business.userManager.service.UserBalanceService; +import com.fuint.business.userManager.vo.LJUserVo; import org.springframework.stereotype.Service; import com.fuint.common.util.TokenUtil; import io.lettuce.core.dynamic.annotation.Param; import com.fuint.common.dto.AccountInfo; - +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -41,12 +53,12 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService { /** * 通过ID查询单条数据 * - * @param id 主键 + * @param storeId 主键 * @return 实例对象 */ @Override - public IntegralSettings queryById(Integer id) { - return this.integralSettingsMapper.queryById(id); + public IntegralSettings queryById(Integer storeId) { + return this.integralSettingsMapper.queryById(storeId); } @@ -167,4 +179,115 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService { public boolean deleteById(Integer id) { return this.integralSettingsMapper.deleteById(id) > 0; } + + + @Resource + IntegralDetailMapper integralDetailMapper; + @Resource + private LJUserMapper ljUserMapper; + @Resource + private ILJStoreService iljStoreService; + @Resource + private UserBalanceService userBalanceService; + @Resource + private IntegralDetailService integralDetailService; + /** + * 查询当前用户是否已经签到过 或者是否开启签到功能 + * @return + */ + @Override + public Integer todayIsSignIn(Integer storeId) { + // 查询是否开启签到功能 + IntegralSettings integralSettings = integralSettingsMapper.getByStoreId(storeId); + if (integralSettings.getSignInFunction() == 0 || integralSettings.getPointsObtained().length() > 10) { + List signInGifts = integralDetailMapper.signInGifts("签到赠送"); + if (signInGifts.size() > 0) { + // 已经签到过 + return -2; + }else { + return 0; + } + }else { + return -1; + } + } + + + + /** + * 签到功能 + * @param integralSettings + * @return + */ + @Override + @Transactional + public IntegralSettings signInFunction(IntegralSettings integralSettings) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + + Integer integer = todayIsSignIn(integralSettings.getStoreId()); + + if (integer == 0) { + + // 根据店铺id 查找连锁店id + LJStore ljStore = iljStoreService.selectStoreByIdUni(integralSettings.getStoreId()); + // 查询当前用户 + LJUserVo ljUserVos = ljUserMapper.selectAllInfoById4Chain(nowAccountInfo.getId(),ljStore.getChainStoreId()); + // 查询积分配置 + IntegralSettings integralSetting = integralSettingsMapper.getByStoreId(integralSettings.getStoreId()); + + // 签到规则 + JSONArray jsonArray = JSON.parseArray(integralSetting.getPointsObtained()); + // 查询昨天是否签到 + List signInGifts = integralDetailMapper.signInGiftsYesterday("签到赠送"); + + IntegralDetail integralDetail = new IntegralDetail(); + integralDetail.setStoreId(integralSettings.getStoreId()); + + if (ObjectUtil.isEmpty(signInGifts)) { + extracted(nowAccountInfo, ljUserVos, jsonArray, integralDetail, 0); + } else { + String changeReason = signInGifts.get(0).getChangeReason(); + + // 获取字符串的第4位字符(索引为3) + char dayChar = changeReason.charAt(3); + // 将字符转换为整数 + int dayInt = Character.getNumericValue(dayChar); + + // 签到超8天处理 + if (dayInt >= 8 && 8<= jsonArray.size()) { + extracted(nowAccountInfo, ljUserVos, jsonArray, integralDetail, dayInt); + } else if (dayInt >= 1 && dayInt <= jsonArray.size()) { + extracted(nowAccountInfo, ljUserVos, jsonArray, integralDetail, dayInt); + } + } + } + return null; + } + + private void extracted(AccountInfo nowAccountInfo, LJUserVo ljUserVos, JSONArray jsonArray, IntegralDetail integralDetail, int dayInt) { + JSONObject jsonObject = jsonArray.getJSONObject(dayInt); + Map map = new HashMap<>(jsonObject); + + String point = map.get("integral").toString(); // 获取积分 + + integralDetail.setUserId(nowAccountInfo.getId()); + integralDetail.setPointsChange(Double.valueOf(point)); + + // 计算积分 + BigDecimal bigPoints = new BigDecimal(point); + BigDecimal addPoints = bigPoints.add(new BigDecimal(ljUserVos.getPoints())); + integralDetail.setCurrentPoints(addPoints.intValue()); + integralDetail.setChangeType("1"); + integralDetail.setType("签到赠送"); + + integralDetail.setChangeReason("签到第"+ (dayInt +1)+"天获得"); + + integralDetailService.insert2(integralDetail); + + // 修改用户积分 + UserBalance userBalance = new UserBalance(); + userBalance.setId(ljUserVos.getBalanceId()); + userBalance.setPoints(addPoints.intValue()); + userBalanceService.updateUserBalance(userBalance); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java index 2a927bd6b..63de57574 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java @@ -298,7 +298,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService { private IntegralDetail changesInPoints(CardFuelRecord cardFuelRecord,LJUserVo ljUserVos) { IntegralDetail integralDetail = new IntegralDetail(); integralDetail.setUserId(cardFuelRecord.getMtUserId()); - integralDetail.setPointsChange(cardFuelRecord.getPoints()); + integralDetail.setPointsChange(cardFuelRecord.getPoints().doubleValue()); // 计算积分 BigDecimal bigPoints = new BigDecimal(cardFuelRecord.getPoints()); 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 c952e3d23..53100ec7d 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 @@ -244,10 +244,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl { */ public LJStore selectStoreById(); + public LJStore selectStoreByIdUni(Integer storeId); + /** * 根据id查询店铺信息 * @return diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java index 44e8c17f0..132dfd489 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java @@ -10,6 +10,7 @@ import com.fuint.business.storeInformation.service.ILJStoreService; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.StringUtils; import com.fuint.common.util.TokenUtil; +import io.swagger.models.auth.In; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -32,6 +33,16 @@ public class LJStoreServiceImpl extends ServiceImpl impl return store; } + /** + * 根据id查询店铺信息(小程序) + * @return + */ + @Override + public LJStore selectStoreByIdUni(Integer storeId) { + LJStore store = baseMapper.selectById(storeId); + return store; + } + @Override public LJStore selectStoreByStoreId(int storeId) { return baseMapper.selectById(storeId); 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 b48ba22e7..805ec9b23 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 @@ -61,5 +61,6 @@ public interface LJUserMapper extends BaseMapper { LJUserVo selectAllInfoById(@Param("userId") Integer userId); + LJUserVo selectAllInfoById4Chain(@Param("userId") Integer userId, @Param("chainStoreId") Integer chainStoreId); } 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 1a34fe05f..32c3c8d68 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 @@ -79,7 +79,25 @@ from mt_user mu left join mt_user_balance mub on mu.id = mub.mt_user_id where mu.id = #{userId} + limit 1 + + + + +