Commit 4c6e9f72 authored by liwei's avatar liwei

修改了金币流水查询,增加了管理端删除留言功能

parent 7db707d8
......@@ -2,6 +2,7 @@ package org.rcisoft.business.memGoldCoinFlow.controller;
/*固定导入*/
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.Parameters;
......@@ -37,7 +38,7 @@ public class MemGoldCoinFlowController extends CyPaginationController<MemGoldCoi
@Autowired
private MemGoldCoinFlowService memGoldCoinFlowServiceImpl;
@PreAuthorize("@cyPerm.hasPerm('sys:goldCoinFlow:add')")
@PreAuthorize("@cyPerm.hasPerm('mem:goldCoinFlow:add')")
@CyOpeLogAnno(title = "system-金币流水表管理-新增金币流水表", businessType = CyLogTypeEnum.INSERT)
@Operation(summary="添加金币流水表", description="添加金币流水表")
@PostMapping(value = "/add")
......@@ -49,7 +50,7 @@ public class MemGoldCoinFlowController extends CyPaginationController<MemGoldCoi
memGoldCoinFlow);
}
@PreAuthorize("@cyPerm.hasPerm('sys:goldCoinFlow:delete')")
@PreAuthorize("@cyPerm.hasPerm('mem:goldCoinFlow:delete')")
@CyOpeLogAnno(title = "system-金币流水表管理-删除金币流水表", businessType = CyLogTypeEnum.DELETE)
@Operation(summary="逻辑删除金币流水表", description="逻辑删除金币流水表")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true, schema = @Schema(type = "string"))})
......@@ -62,7 +63,7 @@ public class MemGoldCoinFlowController extends CyPaginationController<MemGoldCoi
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
@PreAuthorize("@cyPerm.hasPerm('sys:goldCoinFlow:delete')")
@PreAuthorize("@cyPerm.hasPerm('mem:goldCoinFlow:delete')")
@CyOpeLogAnno(title = "system-金币流水表管理-删除金币流水表", businessType = CyLogTypeEnum.DELETE)
@Operation(summary="删除金币流水表", description="删除金币流水表")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true, schema = @Schema(type = "string"))})
......@@ -76,7 +77,7 @@ public class MemGoldCoinFlowController extends CyPaginationController<MemGoldCoi
businessId);
}
@PreAuthorize("@cyPerm.hasPerm('sys:goldCoinFlow:update')")
@PreAuthorize("@cyPerm.hasPerm('mem:goldCoinFlow:update')")
@CyOpeLogAnno(title = "system-金币流水表管理-修改金币流水表", businessType = CyLogTypeEnum.UPDATE)
@Operation(summary="修改金币流水表", description="修改金币流水表")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = false, schema = @Schema(type = "string"))})
......@@ -90,7 +91,7 @@ public class MemGoldCoinFlowController extends CyPaginationController<MemGoldCoi
memGoldCoinFlow);
}
@PreAuthorize("@cyPerm.hasPerm('sys:goldCoinFlow:query')")
@PreAuthorize("@cyPerm.hasPerm('mem:goldCoinFlow:query')")
@CyOpeLogAnno(title = "system-金币流水表管理-查询金币流水表", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="查询单一金币流水表", description="查询单一金币流水表")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true, schema = @Schema(type = "string"))})
......@@ -102,7 +103,7 @@ public class MemGoldCoinFlowController extends CyPaginationController<MemGoldCoi
memGoldCoinFlowServiceImpl.findById(businessId));
}
@PreAuthorize("@cyPerm.hasPerm('sys:goldCoinFlow:list')")
@PreAuthorize("@cyPerm.hasPerm('mem:goldCoinFlow:list')")
@CyOpeLogAnno(title = "system-金币流水表管理-查询金币流水表", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="查询金币流水表集合", description="查询金币流水表集合")
@GetMapping(value = "/listAll")
......@@ -113,7 +114,7 @@ public class MemGoldCoinFlowController extends CyPaginationController<MemGoldCoi
memGoldCoinFlowServiceImpl.findAll(memGoldCoinFlow));
}
@PreAuthorize("@cyPerm.hasPerm('sys:goldCoinFlow:list')")
@PreAuthorize("@cyPerm.hasPerm('mem:goldCoinFlow:list')")
@CyOpeLogAnno(title = "system-金币流水表管理-查询金币流水表", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="分页查询金币流水表集合", description="分页查询金币流水表集合")
@GetMapping(value = "/list")
......@@ -135,4 +136,13 @@ public class MemGoldCoinFlowController extends CyPaginationController<MemGoldCoi
List<MemGoldCoinFlow> memGoldCoinFlowList = memGoldCoinFlowServiceImpl.export(memGoldCoinFlow);
CyEpExcelUtil.exportExcel(memGoldCoinFlowList, "金币流水表信息", "金币流水表信息", MemGoldCoinFlow.class, excelName, response);
}
@PreAuthorize("@cyPerm.hasPerm('mem:goldCoinFlow:list')")
@CyOpeLogAnno(title = "system-金币流水表管理-查询单个会员金币流水表", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="分页查询单个会员金币流水表集合", description="分页查询金币流水表集合")
@GetMapping(value = "/queryMemGoldCoinFollowList")
public CyGridModel queryMemGoldCoinFlowByPagination(MemGoldCoinFlow memGoldCoinFlow) {
IPage<MemGoldCoinFlow> memGoldCoinFlowIPage = memGoldCoinFlowServiceImpl.queryMemGoldCoinFlowsByPagination(getPaginationUtility(), memGoldCoinFlow);
return getGridModelResponse();
}
}
......@@ -22,7 +22,7 @@ public interface MemGoldCoinFlowRepository extends CyBaseMapper<MemGoldCoinFlow>
* 管理端分页查询金币流水
*
*/
IPage<MemGoldCoinFlow> queryMemGoldCoinFlowsPaged(CyPageInfo cyPageInfo,@Param("entity") MemGoldCoinFlow memGoldCoinFlow);
IPage<MemGoldCoinFlow> queryGoldCoinFlowsPaged(CyPageInfo cyPageInfo,@Param("entity") MemGoldCoinFlow memGoldCoinFlow);
/**
* app分页查询金币流水
......@@ -35,6 +35,14 @@ public interface MemGoldCoinFlowRepository extends CyBaseMapper<MemGoldCoinFlow>
*/
Integer balance(Integer userId);
/**
* 新增金币流水记录
*/
int insertMemGoldCoinFlow(@Param("entity") MemGoldCoinFlow memGoldCoinFlow);
/**
* 查询单个用户的消费记录
*/
IPage<MemGoldCoinFlow> queryMemGoldCoinFlowsPaged(CyPageInfo<MemGoldCoinFlow> paginationUtility,@Param("entity") MemGoldCoinFlow memGoldCoinFlow);
}
......@@ -76,10 +76,14 @@ public class MemGoldCoinFlow extends CyIdIncreEntity<MemGoldCoinFlow> {
@TableField(exist = false)
private Integer memberId;
//用户
//用户昵称
@TableField(exist = false)
private String userNickName;
//目标用户昵称
@TableField(exist = false)
private String targetNickName;
/**
* 开始时间
*/
......
......@@ -74,4 +74,9 @@ public interface MemGoldCoinFlowService {
* 查询当前用户金币余额
*/
Integer balance();
/**
* 分页查询单个会员消费记录
*/
IPage<MemGoldCoinFlow> queryMemGoldCoinFlowsByPagination(CyPageInfo<MemGoldCoinFlow> paginationUtility, MemGoldCoinFlow memGoldCoinFlow);
}
......@@ -45,14 +45,19 @@ public class MemGoldCoinFlowServiceImpl extends ServiceImpl<MemGoldCoinFlowRepos
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel persist(MemGoldCoinFlow memGoldCoinFlow){
//查询用户信息
MemInfo memInfo = memInfoRepository.selectByUserId(String.valueOf(memGoldCoinFlow.getTargetId()));
//增加到金币流水表
memGoldCoinFlow.setEndCount(memGoldCoinFlow.getCount() + memGoldCoinFlow.getBalance());
String userId = CyUserUtil.getAuthenBusinessId();
memGoldCoinFlow.setCreateBy(userId);
memGoldCoinFlow.setType("1");
memGoldCoinFlow.setActionType("11");
memGoldCoinFlow.setCreateDate(new Date());
memGoldCoinFlow.setUpdateDate(new Date());
memGoldCoinFlow.setEndCount(memGoldCoinFlow.getCount() + memInfo.getGoldCoinsCount());
int line = baseMapper.insertMemGoldCoinFlow(memGoldCoinFlow);
//修改会员表的金币余额
MemInfo memInfo = new MemInfo();
memInfo.setBusinessId(memGoldCoinFlow.getMemberId());
memInfo.setGoldCoinsCount(memGoldCoinFlow.getCount() + memGoldCoinFlow.getBalance());
memInfo.setGoldCoinsCount(memGoldCoinFlow.getCount() + memInfo.getGoldCoinsCount());
memInfoRepository.updateById(memInfo);
//增加订单信息
return new CyPersistModel(line);
......@@ -128,7 +133,7 @@ public class MemGoldCoinFlowServiceImpl extends ServiceImpl<MemGoldCoinFlowRepos
return baseMapper.appQueryMemGoldCoinFlowsPaged(paginationUtility,memGoldCoinFlow);
} else {
//管理端
return baseMapper.queryMemGoldCoinFlowsPaged(paginationUtility, memGoldCoinFlow);
return baseMapper.queryGoldCoinFlowsPaged(paginationUtility, memGoldCoinFlow);
}
}
......@@ -163,4 +168,15 @@ public class MemGoldCoinFlowServiceImpl extends ServiceImpl<MemGoldCoinFlowRepos
Integer balance = baseMapper.balance(userId);
return balance;
}
/**
* 分页查询单个会员消费记录
* @param paginationUtility
* @param memGoldCoinFlow
*/
@Override
public IPage<MemGoldCoinFlow> queryMemGoldCoinFlowsByPagination(CyPageInfo<MemGoldCoinFlow> paginationUtility, MemGoldCoinFlow memGoldCoinFlow) {
memGoldCoinFlow.setCreateBy(String.valueOf(memGoldCoinFlow.getTargetId()));
return baseMapper.queryMemGoldCoinFlowsPaged(paginationUtility, memGoldCoinFlow);
}
}
......@@ -5,6 +5,9 @@ package org.rcisoft.business.memLeaveMessage.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import org.rcisoft.business.cmsActivity.entity.CmsActivity;
import org.rcisoft.business.memLeaveMessage.entity.MemLeaveMessage;
import org.rcisoft.business.memLeaveMessage.service.MemLeaveMessageService;
import org.rcisoft.core.anno.CyOpeLogAnno;
......@@ -36,7 +39,7 @@ public class MemLeaveMessageController extends CyPaginationController<MemLeaveMe
/**
* 用户详情/我的-留言
*/
@PreAuthorize("@cyPerm.hasPerm('app:mem:leaveMessage')")
@PreAuthorize("@cyPerm.hasPerm('sys:leaveMessage:add')")
@CyOpeLogAnno(title = "system-会员表管理-留言", businessType = CyLogTypeEnum.INSERT)
@Operation(summary="留言", description="留言")
@PostMapping(value = "/leaveMessage")
......@@ -51,7 +54,7 @@ public class MemLeaveMessageController extends CyPaginationController<MemLeaveMe
/**
* 分页查询对话列表
*/
@PreAuthorize("@cyPerm.hasPerm('app:mem:query')")
@PreAuthorize("@cyPerm.hasPerm('sys:leaveMessage:query')")
@CyOpeLogAnno(title = "system-会员表管理-查询对话表", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="分页查询对话列表", description="分页查询对话列表")
@GetMapping(value = "/talkList")
......@@ -63,7 +66,7 @@ public class MemLeaveMessageController extends CyPaginationController<MemLeaveMe
/**
* 查询留言列表详情 1对1的
*/
@PreAuthorize("@cyPerm.hasPerm('app:mem:query')")
@PreAuthorize("@cyPerm.hasPerm('mem:leaveMessage:query')")
@CyOpeLogAnno(title = "system-会员表管理-查询留言详情列表", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="分页查询留言详情列表", description="分页查询留言详情列表")
@GetMapping(value = "/leaveMessageDetailList")
......@@ -75,7 +78,7 @@ public class MemLeaveMessageController extends CyPaginationController<MemLeaveMe
/**
* 分页查询留言列表
*/
@PreAuthorize("@cyPerm.hasPerm('app:mem:query')")
@PreAuthorize("@cyPerm.hasPerm('mem:leaveMessage:query')")
@CyOpeLogAnno(title = "system-会员表管理-查询对话表", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="分页查询对话列表", description="分页查询对话列表")
@GetMapping(value = "/messageList")
......@@ -83,4 +86,18 @@ public class MemLeaveMessageController extends CyPaginationController<MemLeaveMe
IPage<MemLeaveMessage> memUserTalkIPage = memLeaveMessageServiceImpl.queryMessageByPagination(getPaginationUtility(), memLeaveMessage);
return getGridModelResponse();
}
@PreAuthorize("@cyPerm.hasPerm('mem:leaveMessage:delete')")
@CyOpeLogAnno(title = "system-活动管理-删除留言", businessType = CyLogTypeEnum.DELETE)
@Operation(summary = "删除留言", description = "删除留言")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true)})
@DeleteMapping("/delete/{businessId:\\w+}")
public CyResult delete(@PathVariable Integer businessId, MemLeaveMessage memLeaveMessage) {
memLeaveMessage.setBusinessId(businessId);
CyPersistModel data = memLeaveMessageServiceImpl.remove(memLeaveMessage);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
}
......@@ -39,4 +39,9 @@ public interface MemLeaveMessageService {
* 查询未读消息总数
*/
int noReadMessageAllCount();
/**
* 逻辑删除留言
*/
CyPersistModel remove(MemLeaveMessage memLeaveMessage);
}
......@@ -350,4 +350,18 @@ public class MemLeaveMessageServiceImpl extends ServiceImpl<MemLeaveMessageRepos
//查询未读的要微信请求数
return count1 + count2;
}
/**
* 逻辑删除留言
*
* @param memLeaveMessage
*/
@Override
public CyPersistModel remove(MemLeaveMessage memLeaveMessage) {
int line = baseMapper.realDelete(memLeaveMessage);
log.debug(CyUserUtil.getAuthenUsername() + "删除了ID为" +
memLeaveMessage.getBusinessId() + "的活动信息");
return new CyPersistModel(line);
}
}
......@@ -46,11 +46,13 @@
ORDER BY business_id DESC
</select>
<select id="queryMemGoldCoinFlowsPaged" resultMap="BaseResultMap">
<select id="queryGoldCoinFlowsPaged" resultType="org.rcisoft.business.memGoldCoinFlow.entity.MemGoldCoinFlow">
select mgcf.*,
su.nick_name as userNickName
mi.mem_nick_name as userNickName,
mi2.mem_nick_name as targetNickName
from mem_gold_coin_flow mgcf
left join sys_user su on su.business_id = mgcf.target_id
left join mem_info mi on mi.user_id = mgcf.create_by
left join mem_info mi2 on mi2.user_id = mgcf.target_id
where 1=1
and mgcf.del_flag = '0'
<if test="entity.beginTime !=null and entity.beginTime != '' ">
......@@ -81,8 +83,9 @@
select mgcf.*
from mem_gold_coin_flow mgcf
where 1=1
and mgcf.del_flag = '0'
and mgcf.flag = '1'
and mgcf.del_flag = '0'
and mgcf.action_type != '11'
and mgcf.create_by = #{entity.createBy}
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and mgcf.create_date &gt;= #{entity.beginTime}
......@@ -93,17 +96,84 @@
<if test="entity.type !=null and entity.type != '' ">
and mgcf.type = #{entity.type}
</if>
ORDER BY mgcf.business_id DESC
UNION ALL
(
SELECT
mgcf.*
FROM
mem_gold_coin_flow mgcf
WHERE
1 = 1
and mgcf.flag = '1'
AND mgcf.del_flag = '0'
AND mgcf.action_type = '11'
AND mgcf.target_id = #{entity.createBy}
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and mgcf.create_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and mgcf.create_date &lt;= #{entity.endTime}
</if>
<if test="entity.type !=null and entity.type != '' ">
and mgcf.type = #{entity.type}
</if>
)
ORDER BY create_date DESC
</select>
<select id="balance" resultType="java.lang.Integer">
select mi.gold_coins_count
from mem_info mi
where user_id = #{userId}
</select>
<select id="queryMemGoldCoinFlowsPaged"
resultType="org.rcisoft.business.memGoldCoinFlow.entity.MemGoldCoinFlow">
SELECT
mgcf.*,
mi.mem_nick_name AS userNickName,
mi2.mem_nick_name AS targetNickName
FROM
mem_gold_coin_flow mgcf
LEFT JOIN mem_info mi ON mi.user_id = mgcf.create_by
LEFT JOIN mem_info mi2 ON mi2.user_id = mgcf.target_id
WHERE
1 = 1
AND mgcf.del_flag = '0'
AND (mgcf.action_type != '11')
AND mgcf.create_by = #{entity.createBy}
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and mgcf.create_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and mgcf.create_date &lt;= #{entity.endTime}
</if>
UNION ALL
(
SELECT
mgcf.*,
mi.mem_nick_name AS userNickName,
mi2.mem_nick_name AS targetNickName
FROM
mem_gold_coin_flow mgcf
LEFT JOIN mem_info mi ON mi.user_id = mgcf.create_by
LEFT JOIN mem_info mi2 ON mi2.user_id = mgcf.target_id
WHERE
1 = 1
AND mgcf.del_flag = '0'
AND (mgcf.action_type = '11')
AND mgcf.target_id = #{entity.createBy}
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and mgcf.create_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and mgcf.create_date &lt;= #{entity.endTime}
</if>
)
ORDER BY create_date DESC
</select>
<insert id="insertMemGoldCoinFlow">
insert into mem_gold_coin_flow
(create_by, create_date, update_by, update_date, flag,del_flag, type, action_type, count, end_count, target_id)
values
(#{entity.targetId}, now(), #{entity.targetId}, now(), #{entity.flag},#{entity.delFlag} , #{entity.type}, #{entity.actionType}, #{entity.count}, #{entity.endCount}, #{entity.targetId})
(#{entity.createBy}, #{entity.createDate}, #{entity.createBy}, #{entity.updateDate}, #{entity.flag},#{entity.delFlag} , #{entity.type}, #{entity.actionType}, #{entity.count}, #{entity.endCount}, #{entity.targetId})
</insert>
</mapper>
......@@ -52,7 +52,7 @@
GROUP BY
mt.user_id, su.nick_name
ORDER BY
mt.user_id DESC
totalMemTraffic DESC
</select>
<update id="updateMemTraffic">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment