no message
This commit is contained in:
parent
de13b4e996
commit
869f189c4d
@ -175,6 +175,7 @@ export default {
|
|||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
// 获取光标所在位置
|
// 获取光标所在位置
|
||||||
let length = quill.getSelection().index;
|
let length = quill.getSelection().index;
|
||||||
|
console.log("这是一个url",res)
|
||||||
// 插入图片 res.url为服务器返回的图片地址
|
// 插入图片 res.url为服务器返回的图片地址
|
||||||
quill.insertEmbed(length, "image", res.data.url);
|
quill.insertEmbed(length, "image", res.data.url);
|
||||||
// 调整光标到最后
|
// 调整光标到最后
|
||||||
|
@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 礼品分类表(IntegralGiftCategory)表控制层
|
* 礼品分类表(IntegralGiftCategory)表控制层
|
||||||
@ -44,6 +45,13 @@ public class IntegralGiftCategoryController extends BaseController {
|
|||||||
return getSuccessResult(integralGiftCategoryIPage);
|
return getSuccessResult(integralGiftCategoryIPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("queryListByStoreId")
|
||||||
|
public ResponseObject queryListByStoreId(@Param("integralGiftCategory") IntegralGiftCategory integralGiftCategory) {
|
||||||
|
List<IntegralGiftCategory> integralGiftCategoryIPage = this.integralGiftCategoryService.queryListByStoreId(integralGiftCategory);
|
||||||
|
return getSuccessResult(integralGiftCategoryIPage);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过主键查询单条数据
|
* 通过主键查询单条数据
|
||||||
*
|
*
|
||||||
|
@ -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<IntegralGiftVO> integralGiftCategoryIPage = this.integralGiftService.queryByPageByStoreId(page, integralGift);
|
||||||
|
return getSuccessResult(integralGiftCategoryIPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过主键查询单条数据
|
* 通过主键查询单条数据
|
||||||
*
|
*
|
||||||
|
@ -7,6 +7,7 @@ import com.fuint.business.integral.entity.IntegralSettings;
|
|||||||
import com.fuint.business.integral.service.IntegralSettingsService;
|
import com.fuint.business.integral.service.IntegralSettingsService;
|
||||||
import com.fuint.framework.web.BaseController;
|
import com.fuint.framework.web.BaseController;
|
||||||
import com.fuint.framework.web.ResponseObject;
|
import com.fuint.framework.web.ResponseObject;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import io.lettuce.core.dynamic.annotation.Param;
|
import io.lettuce.core.dynamic.annotation.Param;
|
||||||
|
|
||||||
@ -110,5 +111,20 @@ public class IntegralSettingsController extends BaseController {
|
|||||||
return getSuccessResult(this.integralSettingsService.deleteById(id));
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public class IntegralDetail extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 积分变动的数量,可以是正数表示增加,负数表示减少
|
* 积分变动的数量,可以是正数表示增加,负数表示减少
|
||||||
*/
|
*/
|
||||||
private Integer pointsChange;
|
private Double pointsChange;
|
||||||
/**
|
/**
|
||||||
* 变动后用户的当前积分总数
|
* 变动后用户的当前积分总数
|
||||||
*/
|
*/
|
||||||
|
@ -81,5 +81,14 @@ public interface IntegralDetailMapper {
|
|||||||
*/
|
*/
|
||||||
int deleteById(Integer id);
|
int deleteById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当天数据
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<IntegralDetail> signInGifts(@Param("type") String type);
|
||||||
|
|
||||||
|
List<IntegralDetail> signInGiftsYesterday(@Param("type") String type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,11 @@ public interface IntegralGiftCategoryMapper {
|
|||||||
*/
|
*/
|
||||||
IPage<IntegralGiftCategory> queryAllByLimit(@Param("page") Page page, @Param("integralGiftCategory") IntegralGiftCategory integralGiftCategory);
|
IPage<IntegralGiftCategory> queryAllByLimit(@Param("page") Page page, @Param("integralGiftCategory") IntegralGiftCategory integralGiftCategory);
|
||||||
|
|
||||||
|
|
||||||
|
List<IntegralGiftCategory> queryAllByLimit(@Param("integralGiftCategory") IntegralGiftCategory integralGiftCategory);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计总行数
|
* 统计总行数
|
||||||
*
|
*
|
||||||
|
@ -22,7 +22,7 @@ public interface IntegralSettingsMapper {
|
|||||||
* @return 实例对象
|
* @return 实例对象
|
||||||
*/
|
*/
|
||||||
IntegralSettings queryById(Integer id);
|
IntegralSettings queryById(Integer id);
|
||||||
IntegralSettings getByStoreId(Integer id);
|
IntegralSettings getByStoreId(Integer storeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询指定行数据
|
* 查询指定行数据
|
||||||
|
@ -185,5 +185,28 @@
|
|||||||
delete from integral_detail where id = #{id}
|
delete from integral_detail where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<!--签到赠送-->
|
||||||
|
<select id="signInGifts" resultMap="IntegralDetailMap">
|
||||||
|
select
|
||||||
|
id, user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by,change_type
|
||||||
|
from integral_detail
|
||||||
|
WHERE DATE(create_time) = CURDATE()
|
||||||
|
<if test="type != null">
|
||||||
|
and type = #{type}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--查询昨天 签到赠送-->
|
||||||
|
<select id="signInGiftsYesterday" resultMap="IntegralDetailMap">
|
||||||
|
select
|
||||||
|
id, user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by,change_type
|
||||||
|
from integral_detail
|
||||||
|
WHERE DATE(create_time) = CURDATE() - INTERVAL 1 DAY
|
||||||
|
<if test="type != null">
|
||||||
|
and type = #{type}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ public interface IntegralDetailService {
|
|||||||
* @return 实例对象
|
* @return 实例对象
|
||||||
*/
|
*/
|
||||||
IntegralDetail insert(IntegralDetail integralDetail);
|
IntegralDetail insert(IntegralDetail integralDetail);
|
||||||
|
IntegralDetail insert2(IntegralDetail integralDetail);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改数据
|
* 修改数据
|
||||||
|
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.fuint.business.integral.entity.IntegralGiftCategory;
|
import com.fuint.business.integral.entity.IntegralGiftCategory;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 礼品分类表(IntegralGiftCategory)表服务接口
|
* 礼品分类表(IntegralGiftCategory)表服务接口
|
||||||
*
|
*
|
||||||
@ -30,6 +32,8 @@ public interface IntegralGiftCategoryService {
|
|||||||
*/
|
*/
|
||||||
IPage<IntegralGiftCategory> queryByPage(@Param("page") Page page, @Param("integralGiftCategory") IntegralGiftCategory integralGiftCategory);
|
IPage<IntegralGiftCategory> queryByPage(@Param("page") Page page, @Param("integralGiftCategory") IntegralGiftCategory integralGiftCategory);
|
||||||
|
|
||||||
|
|
||||||
|
List<IntegralGiftCategory> queryListByStoreId(@Param("integralGiftCategory") IntegralGiftCategory integralGiftCategory);
|
||||||
/**
|
/**
|
||||||
* 新增数据
|
* 新增数据
|
||||||
*
|
*
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package com.fuint.business.integral.service;
|
package com.fuint.business.integral.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
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.IntegralGift;
|
||||||
import com.fuint.business.integral.entity.IntegralGiftCategory;
|
|
||||||
import com.fuint.business.integral.vo.IntegralGiftVO;
|
import com.fuint.business.integral.vo.IntegralGiftVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (IntegralGift)表服务接口
|
* (IntegralGift)表服务接口
|
||||||
@ -32,7 +33,10 @@ public interface IntegralGiftService {
|
|||||||
* @param page 分页对象
|
* @param page 分页对象
|
||||||
* @return 查询结果
|
* @return 查询结果
|
||||||
*/
|
*/
|
||||||
IPage<IntegralGiftVO> queryByPage(@Param("page") com.baomidou.mybatisplus.extension.plugins.pagination.Page page, @Param("integralGift") IntegralGift integralGift);
|
IPage<IntegralGiftVO> queryByPage(@Param("page") Page page, @Param("integralGift") IntegralGift integralGift);
|
||||||
|
|
||||||
|
|
||||||
|
IPage<IntegralGiftVO> queryByPageByStoreId(@Param("page") Page page, @Param("integralGift") IntegralGift integralGift);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增数据
|
* 新增数据
|
||||||
|
@ -64,4 +64,9 @@ public interface IntegralSettingsService {
|
|||||||
*/
|
*/
|
||||||
boolean deleteById(Integer id);
|
boolean deleteById(Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
Integer todayIsSignIn(Integer storeId);
|
||||||
|
|
||||||
|
IntegralSettings signInFunction(IntegralSettings integralSettings);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,14 @@ public class IntegralDetailServiceImpl implements IntegralDetailService {
|
|||||||
return integralDetail;
|
return integralDetail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IntegralDetail insert2(IntegralDetail integralDetail) {
|
||||||
|
// integralDetail.setStoreId(nowAccountInfo.getStoreId());
|
||||||
|
// integralDetail.setCreateBy(nowAccountInfo.getStaffId().toString());
|
||||||
|
this.integralDetailMapper.insert(integralDetail);
|
||||||
|
return integralDetail;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改数据
|
* 修改数据
|
||||||
*
|
*
|
||||||
|
@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 礼品分类表(IntegralGiftCategory)表服务实现类
|
* 礼品分类表(IntegralGiftCategory)表服务实现类
|
||||||
@ -49,6 +50,11 @@ public class IntegralGiftCategoryServiceImpl implements IntegralGiftCategoryServ
|
|||||||
return integralGiftCategoryDao.queryAllByLimit(page, integralGiftCategory);
|
return integralGiftCategoryDao.queryAllByLimit(page, integralGiftCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IntegralGiftCategory> queryListByStoreId(IntegralGiftCategory integralGiftCategory) {
|
||||||
|
return integralGiftCategoryDao.queryAllByLimit(integralGiftCategory);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增数据
|
* 新增数据
|
||||||
*
|
*
|
||||||
|
@ -51,6 +51,12 @@ public class IntegralGiftServiceImpl implements IntegralGiftService {
|
|||||||
return integralGiftDao.queryAllByLimit(page, integralGift);
|
return integralGiftDao.queryAllByLimit(page, integralGift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<IntegralGiftVO> queryByPageByStoreId(@Param("page") Page page, @Param("integralGiftCategory") IntegralGift integralGift) {
|
||||||
|
return integralGiftDao.queryAllByLimit(page, integralGift);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增数据
|
* 新增数据
|
||||||
*
|
*
|
||||||
|
@ -258,10 +258,10 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
|||||||
private IntegralDetail changesInPoints(Double totalPoints,LJUserVo ljUserVos) {
|
private IntegralDetail changesInPoints(Double totalPoints,LJUserVo ljUserVos) {
|
||||||
IntegralDetail integralDetail = new IntegralDetail();
|
IntegralDetail integralDetail = new IntegralDetail();
|
||||||
integralDetail.setUserId(ljUserVos.getId());
|
integralDetail.setUserId(ljUserVos.getId());
|
||||||
integralDetail.setPointsChange(-totalPoints.intValue());
|
integralDetail.setPointsChange(-totalPoints);
|
||||||
// 计算积分
|
// 计算积分
|
||||||
BigDecimal bigPoints = new BigDecimal(ljUserVos.getPoints());
|
BigDecimal bigPoints = new BigDecimal(ljUserVos.getPoints().toString());
|
||||||
BigDecimal addPoints = bigPoints.subtract(new BigDecimal(totalPoints));
|
BigDecimal addPoints = bigPoints.subtract(new BigDecimal(totalPoints.toString()));
|
||||||
integralDetail.setChangeType("0");
|
integralDetail.setChangeType("0");
|
||||||
integralDetail.setCurrentPoints(addPoints.intValue());
|
integralDetail.setCurrentPoints(addPoints.intValue());
|
||||||
integralDetail.setChangeReason("收银台积分商城兑换");
|
integralDetail.setChangeReason("收银台积分商城兑换");
|
||||||
|
@ -3,23 +3,35 @@ package com.fuint.business.integral.service.impl;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
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.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
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.IntegralGift;
|
||||||
import com.fuint.business.integral.entity.IntegralSettings;
|
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.mapper.IntegralSettingsMapper;
|
||||||
|
import com.fuint.business.integral.service.IntegralDetailService;
|
||||||
import com.fuint.business.integral.service.IntegralSettingsService;
|
import com.fuint.business.integral.service.IntegralSettingsService;
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilNumber;
|
import com.fuint.business.petrolStationManagement.entity.OilNumber;
|
||||||
import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper;
|
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 org.springframework.stereotype.Service;
|
||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
import io.lettuce.core.dynamic.annotation.Param;
|
import io.lettuce.core.dynamic.annotation.Param;
|
||||||
import com.fuint.common.dto.AccountInfo;
|
import com.fuint.common.dto.AccountInfo;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -41,12 +53,12 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
|||||||
/**
|
/**
|
||||||
* 通过ID查询单条数据
|
* 通过ID查询单条数据
|
||||||
*
|
*
|
||||||
* @param id 主键
|
* @param storeId 主键
|
||||||
* @return 实例对象
|
* @return 实例对象
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IntegralSettings queryById(Integer id) {
|
public IntegralSettings queryById(Integer storeId) {
|
||||||
return this.integralSettingsMapper.queryById(id);
|
return this.integralSettingsMapper.queryById(storeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -167,4 +179,115 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
|
|||||||
public boolean deleteById(Integer id) {
|
public boolean deleteById(Integer id) {
|
||||||
return this.integralSettingsMapper.deleteById(id) > 0;
|
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<IntegralDetail> 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<IntegralDetail> 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<String, Object> 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
|||||||
private IntegralDetail changesInPoints(CardFuelRecord cardFuelRecord,LJUserVo ljUserVos) {
|
private IntegralDetail changesInPoints(CardFuelRecord cardFuelRecord,LJUserVo ljUserVos) {
|
||||||
IntegralDetail integralDetail = new IntegralDetail();
|
IntegralDetail integralDetail = new IntegralDetail();
|
||||||
integralDetail.setUserId(cardFuelRecord.getMtUserId());
|
integralDetail.setUserId(cardFuelRecord.getMtUserId());
|
||||||
integralDetail.setPointsChange(cardFuelRecord.getPoints());
|
integralDetail.setPointsChange(cardFuelRecord.getPoints().doubleValue());
|
||||||
|
|
||||||
// 计算积分
|
// 计算积分
|
||||||
BigDecimal bigPoints = new BigDecimal(cardFuelRecord.getPoints());
|
BigDecimal bigPoints = new BigDecimal(cardFuelRecord.getPoints());
|
||||||
|
@ -244,10 +244,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
|||||||
private IntegralDetail changesInPoints(CardValueRecord cardValueRecordDTO,LJUserVo ljUserVos) {
|
private IntegralDetail changesInPoints(CardValueRecord cardValueRecordDTO,LJUserVo ljUserVos) {
|
||||||
IntegralDetail integralDetail = new IntegralDetail();
|
IntegralDetail integralDetail = new IntegralDetail();
|
||||||
integralDetail.setUserId(cardValueRecordDTO.getMtUserId());
|
integralDetail.setUserId(cardValueRecordDTO.getMtUserId());
|
||||||
integralDetail.setPointsChange(cardValueRecordDTO.getPoints());
|
integralDetail.setPointsChange(cardValueRecordDTO.getPoints().doubleValue());
|
||||||
|
|
||||||
// 计算积分
|
// 计算积分
|
||||||
BigDecimal bigPoints = new BigDecimal(cardValueRecordDTO.getPoints());
|
BigDecimal bigPoints = new BigDecimal(cardValueRecordDTO.getPoints().toString());
|
||||||
BigDecimal addPoints = bigPoints.add(new BigDecimal(ljUserVos.getPoints()));
|
BigDecimal addPoints = bigPoints.add(new BigDecimal(ljUserVos.getPoints()));
|
||||||
integralDetail.setChangeType("1");
|
integralDetail.setChangeType("1");
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.fuint.business.storeInformation.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.fuint.business.storeInformation.entity.LJStore;
|
import com.fuint.business.storeInformation.entity.LJStore;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -16,6 +17,8 @@ public interface ILJStoreService extends IService<LJStore> {
|
|||||||
*/
|
*/
|
||||||
public LJStore selectStoreById();
|
public LJStore selectStoreById();
|
||||||
|
|
||||||
|
public LJStore selectStoreByIdUni(Integer storeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id查询店铺信息
|
* 根据id查询店铺信息
|
||||||
* @return
|
* @return
|
||||||
|
@ -10,6 +10,7 @@ import com.fuint.business.storeInformation.service.ILJStoreService;
|
|||||||
import com.fuint.common.dto.AccountInfo;
|
import com.fuint.common.dto.AccountInfo;
|
||||||
import com.fuint.common.util.StringUtils;
|
import com.fuint.common.util.StringUtils;
|
||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -32,6 +33,16 @@ public class LJStoreServiceImpl extends ServiceImpl<LJStoreMapper, LJStore> impl
|
|||||||
return store;
|
return store;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询店铺信息(小程序)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LJStore selectStoreByIdUni(Integer storeId) {
|
||||||
|
LJStore store = baseMapper.selectById(storeId);
|
||||||
|
return store;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LJStore selectStoreByStoreId(int storeId) {
|
public LJStore selectStoreByStoreId(int storeId) {
|
||||||
return baseMapper.selectById(storeId);
|
return baseMapper.selectById(storeId);
|
||||||
|
@ -61,5 +61,6 @@ public interface LJUserMapper extends BaseMapper<LJUser> {
|
|||||||
LJUserVo selectAllInfoById(@Param("userId") Integer userId);
|
LJUserVo selectAllInfoById(@Param("userId") Integer userId);
|
||||||
|
|
||||||
|
|
||||||
|
LJUserVo selectAllInfoById4Chain(@Param("userId") Integer userId, @Param("chainStoreId") Integer chainStoreId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,25 @@
|
|||||||
from mt_user mu
|
from mt_user mu
|
||||||
left join mt_user_balance mub on mu.id = mub.mt_user_id
|
left join mt_user_balance mub on mu.id = mub.mt_user_id
|
||||||
where mu.id = #{userId}
|
where mu.id = #{userId}
|
||||||
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectAllInfoById4Chain" resultType="com.fuint.business.userManager.vo.LJUserVo">
|
||||||
|
select mu.*,
|
||||||
|
mub.id balanceId,
|
||||||
|
mub.card_balance cardBalance,
|
||||||
|
mub.points,
|
||||||
|
mub.growth_value growthValue,
|
||||||
|
mub.refuel_money refuelMoney
|
||||||
|
from mt_user mu
|
||||||
|
left join mt_user_balance mub on mu.id = mub.mt_user_id
|
||||||
|
where mu.id = #{userId}
|
||||||
|
and mub.chain_store_id = #{chainStoreId}
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="selectUserById" resultType="com.fuint.business.userManager.vo.LJUserVo"
|
<select id="selectUserById" resultType="com.fuint.business.userManager.vo.LJUserVo"
|
||||||
parameterType="java.lang.Integer">
|
parameterType="java.lang.Integer">
|
||||||
<include refid="selectUser"></include>
|
<include refid="selectUser"></include>
|
||||||
|
Loading…
Reference in New Issue
Block a user