积分详情

This commit is contained in:
wangh 2023-12-05 15:16:15 +08:00
parent 72519e32b8
commit 6dd43b9d68
11 changed files with 155 additions and 55 deletions

View File

@ -19,7 +19,7 @@ import javax.annotation.Resource;
* @since 2023-11-10 17:52:32
*/
@RestController
@RequestMapping("integralDetail")
@RequestMapping("business/integral/integralDetail")
public class IntegralDetailController extends BaseController {
/**
* 服务对象
@ -42,6 +42,16 @@ public class IntegralDetailController extends BaseController {
IPage< IntegralDetail> iPageList = this.integralDetailService.queryByPage(page, integralDetail);
return getSuccessResult(iPageList);
}
@GetMapping("queryByPageUni")
public ResponseObject queryByPageUni(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("integralDetail") IntegralDetail integralDetail) {
Page page = new Page(pageNo, pageSize);
IPage< IntegralDetail> iPageList = this.integralDetailService.queryByPageUni(page, integralDetail);
return getSuccessResult(iPageList);
}

View File

@ -44,14 +44,10 @@ public class IntegralDetail extends BaseEntity {
*/
private Integer storeId;
/**
* 连锁店id
*/
private Integer chainStoreId;

View File

@ -30,7 +30,7 @@ public interface IntegralDetailMapper {
* @param page 分页对象
* @return 对象列表
*/
IPage<IntegralDetail> queryAllByLimit(@Param("page") Page page, IntegralDetail integralDetail);
IPage<IntegralDetail> queryAllByLimit(@Param("page") Page page,@Param("integralDetail") IntegralDetail integralDetail);
/**
* 统计总行数

View File

@ -31,41 +31,19 @@
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>
<if test="id != null">
and id = #{id}
<if test="integralDetail.chainStoreId != null">
and chain_store_id = #{integralDetail.chainStoreId}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="pointsChange != null">
and points_change = #{pointsChange}
</if>
<if test="currentPoints != null">
and current_points = #{currentPoints}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="changeReason != null and changeReason != ''">
and change_reason = #{changeReason}
</if>
<if test="storeId != null">
and store_id = #{storeId}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
<if test="integralDetail.storeId != null">
and store_id = #{integralDetail.storeId}
</if>
</where>
order by create_time desc
</select>
<!-- order by-->
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">

View File

@ -30,6 +30,7 @@ public interface IntegralDetailService {
* @return 查询结果
*/
IPage<IntegralDetail> queryByPage(@Param("page") Page page, IntegralDetail integralDetail);
IPage<IntegralDetail> queryByPageUni(@Param("page") Page page, IntegralDetail integralDetail);
/**
* 新增数据

View File

@ -50,6 +50,11 @@ public class IntegralDetailServiceImpl implements IntegralDetailService {
return this.integralDetailMapper.queryAllByLimit(page, integralDetail);
}
@Override
public IPage<IntegralDetail> queryByPageUni(@Param("page") Page page, IntegralDetail integralDetail) {
return this.integralDetailMapper.queryAllByLimit(page, integralDetail);
}
/**
* 新增数据
*

View File

@ -157,6 +157,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
@Override
@Transactional
public CardValueRecord checkTheStatusOfYourPayment(Integer id) {
CardValueRecord cardValueRecord = baseMapper.selectById(id);
// 支付成功之后
if ("paid".equals(cardValueRecord.getPayStatus())){
@ -207,6 +208,9 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
}
//用户余额表计算
private UserBalance balanceCalculation(CardValueRecord cardValueRecordDTO) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// nowAccountInfo
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById(cardValueRecordDTO.getMtUserId());
if (ObjectUtil.isEmpty(cardValueRecordDTO.getBidBalance())) cardValueRecordDTO.setBidBalance(0.00);

View File

@ -75,7 +75,6 @@ public class LJUserController extends BaseController {
@GetMapping("/getByUniApp")
public ResponseObject getByUniApp(Integer chainStoreId){
// todo wangh改为便利店id
LJUserVo user = userService.getByUniApp(chainStoreId);
return getSuccessResult(user);
}

View File

@ -0,0 +1,89 @@
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.client.exception.MQBrokerException;
import org.apache.rocketmq.common.message.Message;
import com.fuint.fuintApplication;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.remoting.exception.RemotingException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import java.io.UnsupportedEncodingException;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
//@RunWith(SpringRunner.class)
@SpringBootTest(classes = fuintApplication.class)
@Transactional
public class UserSeriviceTest {
@Test
public void test() throws MQClientException, UnsupportedEncodingException, MQBrokerException, RemotingException, InterruptedException {
//1.创建一个发送消息的对象Producer指定分组生产者分组 等会讲
DefaultMQProducer producer = new DefaultMQProducer("group1");
//2.设定发送的命名服务器地址连接上ns之后才能拿到broker地址发送消息
producer.setNamesrvAddr("39.104.58.101:9876");
//3.1启动发送的服务
producer.start();
//4.创建要发送的消息对象,指定topic指定内容body
Message msg = new Message("topic1","hello rocketmq".getBytes("UTF-8"));
//3.2发送消息这里是同步请求如果broker没有给出响应就拿不到返回值并且卡死在当前行代码
SendResult result = producer.send(msg);
System.out.println("返回结果:"+result);
//5.关闭连接
// producer.shutdown();
}
@Test
public void consumer() throws MQClientException {
//1.创建一个接收消息的对象Consumer
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("group1");
//2.设定接收的命名服务器地址
consumer.setNamesrvAddr("39.104.58.101:9876");
//3.设置接收消息对应的topic,对应的sub标签为任意*
// 如果想接收之前topic1的生产者发送的消息这里的就要订阅相同的topic才可以
try {
consumer.subscribe("topic1", "*");
} catch (MQClientException e) {
e.printStackTrace();
}
//4.开启监听用于接收消息
consumer.registerMessageListener(new MessageListenerConcurrently() {
/**
* 设置好监听之后只要有消息出现就会调用 consumeMessage方法
* @param list 所有的消息都会存入该集合供消费者消费
* @param consumeConcurrentlyContext 同时并行消费(多线程)的上下文
* @return
*/
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
//遍历消息
for (MessageExt msg : list) {
// System.out.println("收到消息:"+msg);
System.out.println("消息:" + new String(msg.getBody()));
}
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
});
//5.启动接收消息的服务
consumer.start();
System.out.println("接收消息服务已开启运行");
// 不能关闭消费者端服务器因为对broker中topic设置了监听
// 该topic中只要有了新消息就要通知消费者消费
// consumer.shutdown();
}
}

View File

@ -213,7 +213,9 @@
request({
url: '/business/userManager/user/getByUniApp',
method: 'get',
// params:{}
params: {
chainStoreId: uni.getStorageSync('chainStoreId')
}
}).then((res) => {
if (res.code == 200) {
this.myPoints = res.data.points

View File

@ -7,19 +7,15 @@
<view class="my-icons"></view>
</view>
<!-- 顶部区域 -->
<view class="m-box" v-for="(item,index) in mingList" :key="index">
<view class="m-box" v-for="(item,index) in detailList" :key="index">
<view class="">
<view class="title">积分增加</view>
<view class="times">2023-07-30 12:00:00</view>
<view class="title" v-if="item.changeType == 1">{{item.changeReason}}</view>
<view class="title" v-else style="color: #F52D22;">积分支出</view>
<view class="times">{{item.createTime}}</view>
</view>
<view class="sr-nmb">+ 7</view>
</view>
<view class="m-box" v-for="(item,index) in mingList" :key="index">
<view class="">
<view class="title" style="color: #F52D22;">积分支出</view>
<view class="times">2023-07-30 12:00:00</view>
</view>
<view class="sc-nmb">+ 7</view>
<view class="sr-nmb" v-if="item.changeType == 1">+{{item.pointsChange}}</view>
<view class="sc-nmb" v-else>{{item.pointsChange}}</view>
</view>
<!-- 判断根据实际情况而改 -->
<u-empty text="积分明细" v-if="mingList.length == 0" icon="http://cdn.uviewui.com/uview/empty/list.png">
@ -31,10 +27,13 @@
</template>
<script>
import config from '@/config'
import request from '../../utils/request'
export default {
data() {
return {
title: '',
detailList: [],
mingList: [
"3", "4", "5", "6",
],
@ -45,11 +44,28 @@
components: {
},
onShow() {
this.getIntegralDetailList()
},
methods: {
goback() {
uni.navigateBack()
}
},
//
getIntegralDetailList() {
request({
url: 'business/integral/integralDetail/queryByPageUni',
method: 'get',
params: {
chainStoreId: uni.getStorageSync('chainStoreId')
}
}).then((res) => {
if (res.code == 200) {
this.detailList = res.data.records
}
})
},
}
}
</script>