From 8fe74ad372762785e8e52d3feb0bb1ead330ed87 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Tue, 20 Jun 2023 11:26:29 +0800 Subject: [PATCH] IM后台 --- src/main/java/cc/mrbird/febs/mall/mapper/ChatUserMapper.java | 36 + src/main/java/cc/mrbird/febs/mall/service/impl/AdminChatServiceImpl.java | 137 ++++ src/main/java/cc/mrbird/febs/mall/GenderEnum.java | 28 src/main/java/cc/mrbird/febs/mall/vo/AdminChatAmountFlowVo.java | 38 + src/main/java/cc/mrbird/febs/system/controller/LoginController.java | 54 - src/test/java/cc/mrbird/febs/ProfitTest.java | 19 src/main/resources/templates/error/404.html | 2 src/main/resources/application-prod.yml | 20 src/main/java/cc/mrbird/febs/mall/controller/AdminChatController.java | 127 +++ src/main/resources/mapper/modules/ChatUserMapper.xml | 157 ++++ src/main/resources/templates/error/403.html | 2 src/main/java/cc/mrbird/febs/mall/dto/AdminSystemPayDto.java | 17 src/main/resources/templates/febs/views/modules/chat/userList.html | 205 ++++++ src/main/java/cc/mrbird/febs/mall/service/IAdminChatService.java | 33 + src/main/resources/application-dev.yml | 10 src/main/java/cc/mrbird/febs/mall/vo/AdminChatWalletVo.java | 16 src/main/resources/templates/error/500.html | 2 src/main/resources/templates/index.html | 2 src/main/resources/templates/febs/views/modules/chat/chatWithDrawList.html | 193 +++++ src/main/java/cc/mrbird/febs/common/runner/FebsStartedUpRunner.java | 2 src/main/java/cc/mrbird/febs/common/utils/ZzSmsSend.java | 2 src/main/java/cc/mrbird/febs/mall/controller/ViewChatController.java | 81 ++ src/main/resources/templates/febs/views/modules/chat/mallSystemPay.html | 90 ++ src/main/java/cc/mrbird/febs/mall/entity/MemberCoinWithdraw.java | 43 + /dev/null | 101 --- src/main/java/cc/mrbird/febs/mall/vo/AdminChatCahrgeVo.java | 28 src/main/resources/templates/febs/views/modules/chat/chatChargeList.html | 129 +++ src/main/java/cc/mrbird/febs/mall/vo/AdminChatUserVo.java | 35 + src/main/java/cc/mrbird/febs/mall/quartz/ProfitJob.java | 43 - src/main/java/cc/mrbird/febs/mall/entity/ChatUser.java | 106 +++ src/main/java/cc/mrbird/febs/mall/vo/AdminChatWithDrawVo.java | 35 + src/main/java/cc/mrbird/febs/mall/YesOrNoEnum.java | 27 src/main/resources/application.yml | 2 src/main/resources/templates/febs/views/modules/chat/chatAmountFlow.html | 146 ++++ src/main/resources/templates/febs/views/layout.html | 2 src/main/resources/templates/febs/views/login.html | 4 36 files changed, 1,733 insertions(+), 241 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/common/runner/FebsStartedUpRunner.java b/src/main/java/cc/mrbird/febs/common/runner/FebsStartedUpRunner.java index 35e131b..02ba872 100644 --- a/src/main/java/cc/mrbird/febs/common/runner/FebsStartedUpRunner.java +++ b/src/main/java/cc/mrbird/febs/common/runner/FebsStartedUpRunner.java @@ -63,7 +63,7 @@ log.info("/ /` / / \\ | |\\/| | |_) | | | |_ | | | |_ "); log.info("\\_\\_, \\_\\_/ |_| | |_| |_|__ |_|__ |_| |_|__ "); log.info(" "); - log.info("国致优品商城 权限系统启动完毕,地址:{}", url); + log.info("IM 权限系统启动完毕,地址:{}", url); boolean auto = febsProperties.isAutoOpenBrowser(); if (auto && StringUtils.equalsIgnoreCase(active, FebsConstant.DEVELOP)) { diff --git a/src/main/java/cc/mrbird/febs/common/utils/ZzSmsSend.java b/src/main/java/cc/mrbird/febs/common/utils/ZzSmsSend.java index c508be5..5dde0ad 100644 --- a/src/main/java/cc/mrbird/febs/common/utils/ZzSmsSend.java +++ b/src/main/java/cc/mrbird/febs/common/utils/ZzSmsSend.java @@ -26,7 +26,7 @@ private static final String PWD = "1369815429"; public static boolean sendVerifyCode(String telphone, String code, int time) { - String content = "【国致优品】您的验证码是{},请在{}分钟内输入,请勿泄露给他人,如非本人操作,请及时修改密码。"; + String content = "【IM】您的验证码是{},请在{}分钟内输入,请勿泄露给他人,如非本人操作,请及时修改密码。"; return send(telphone, StrUtil.format(content, code, time)); } diff --git a/src/main/java/cc/mrbird/febs/mall/GenderEnum.java b/src/main/java/cc/mrbird/febs/mall/GenderEnum.java new file mode 100644 index 0000000..0032e9c --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/GenderEnum.java @@ -0,0 +1,28 @@ +package cc.mrbird.febs.mall; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; + +public enum GenderEnum { + UNKNOWN("0", "未知"), + MALE("1", "男"), + FEMALE("2", "女"); + + @EnumValue + @JsonValue + private final String code; + private final String info; + + private GenderEnum(String code, String info) { + this.code = code; + this.info = info; + } + + public String getCode() { + return this.code; + } + + public String getInfo() { + return this.info; + } +} \ No newline at end of file diff --git a/src/main/java/cc/mrbird/febs/mall/YesOrNoEnum.java b/src/main/java/cc/mrbird/febs/mall/YesOrNoEnum.java new file mode 100644 index 0000000..c66d061 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/YesOrNoEnum.java @@ -0,0 +1,27 @@ +package cc.mrbird.febs.mall; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; + +public enum YesOrNoEnum { + YES("Y", "是"), + NO("N", "否"); + + @EnumValue + @JsonValue + private final String code; + private final String info; + + private YesOrNoEnum(String code, String info) { + this.code = code; + this.info = info; + } + + public String getCode() { + return this.code; + } + + public String getInfo() { + return this.info; + } +} diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminChatController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminChatController.java new file mode 100644 index 0000000..aec2763 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminChatController.java @@ -0,0 +1,127 @@ +package cc.mrbird.febs.mall.controller; + +import cc.mrbird.febs.common.annotation.ControllerEndpoint; +import cc.mrbird.febs.common.controller.BaseController; +import cc.mrbird.febs.common.entity.FebsResponse; +import cc.mrbird.febs.common.entity.QueryRequest; +import cc.mrbird.febs.mall.dto.AdminSystemPayDto; +import cc.mrbird.febs.mall.dto.MallSystemPayDto; +import cc.mrbird.febs.mall.entity.ChatUser; +import cc.mrbird.febs.mall.entity.MallMember; +import cc.mrbird.febs.mall.service.IAdminChatService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.Map; + +@Slf4j +@Validated +@RestController +@RequiredArgsConstructor +@RequestMapping(value = "/admin/chat") +public class AdminChatController extends BaseController { + + @Resource + private IAdminChatService iAdminChatService; + + /** + * 用户列表 + * + * @param chatUser + * @param request + * @return + */ + @GetMapping("getUserList") + public FebsResponse getUserList(ChatUser chatUser, QueryRequest request) { + Map<String, Object> data = getDataTable(iAdminChatService.getUserList(chatUser, request)); + return new FebsResponse().success().data(data); + } + + /** + * 用户列表---开启 + * + * @param userId + * @return + */ + @GetMapping("openAccount/{userId}") + @ControllerEndpoint(operation = "会员列表---开启", exceptionMessage = "操作失败") + public FebsResponse openAccount(@NotNull(message = "{required}") @PathVariable String userId) { + return iAdminChatService.openAccount(userId); + } + /** + * 用户列表---关闭 + * + * @param userId + * @return + */ + @GetMapping("closeAccount/{userId}") + @ControllerEndpoint(operation = "会员列表---关闭", exceptionMessage = "操作失败") + public FebsResponse closeAccount(@NotNull(message = "{required}") @PathVariable String userId) { + return iAdminChatService.closeAccount(userId); + } + + /** + * 用户列表-系统拨付 + */ + @PostMapping("updateSystemPay") + @ControllerEndpoint(operation = "会员列表-系统拨付", exceptionMessage = "操作失败") + public FebsResponse updateSystemPay(@Valid AdminSystemPayDto adminSystemPayDto) { + return iAdminChatService.updateSystemPay(adminSystemPayDto); + } + + /** + * 资金流水 + */ + @GetMapping("getFlowList") + public FebsResponse getFlowList(ChatUser chatUser, QueryRequest request) { + Map<String, Object> data = getDataTable(iAdminChatService.getFlowList(chatUser, request)); + return new FebsResponse().success().data(data); + } + + /** + * 会员充值 + */ + @GetMapping("getChargeList") + public FebsResponse getChargeList(ChatUser chatUser, QueryRequest request) { + Map<String, Object> data = getDataTable(iAdminChatService.getChargeList(chatUser, request)); + return new FebsResponse().success().data(data); + } + + /** + * 会员提现 + */ + @GetMapping("getWithdrawList") + public FebsResponse getWithdrawList(ChatUser chatUser, QueryRequest request) { + Map<String, Object> data = getDataTable(iAdminChatService.getWithdrawList(chatUser, request)); + return new FebsResponse().success().data(data); + } + + /** + * 会员提现-同意 + * + * @param id + * @return + */ + @GetMapping("agreeEvent/{id}") + @ControllerEndpoint(operation = "会员提现-同意", exceptionMessage = "操作失败") + public FebsResponse agreeEvent(@NotNull(message = "{required}") @PathVariable String id) { + return iAdminChatService.agreeEvent(id); + } + + /** + * 会员提现-拒绝 + * + * @param id + * @return + */ + @GetMapping("disagreeEvent/{id}") + @ControllerEndpoint(operation = "会员提现-拒绝", exceptionMessage = "操作失败") + public FebsResponse disagreeEvent(@NotNull(message = "{required}") @PathVariable String id) { + return iAdminChatService.disagreeEvent(id); + } +} diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ViewChatController.java b/src/main/java/cc/mrbird/febs/mall/controller/ViewChatController.java new file mode 100644 index 0000000..cebaa2f --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/controller/ViewChatController.java @@ -0,0 +1,81 @@ +package cc.mrbird.febs.mall.controller; + +import cc.mrbird.febs.common.controller.BaseController; +import cc.mrbird.febs.common.entity.FebsConstant; +import cc.mrbird.febs.common.utils.FebsUtil; +import cc.mrbird.febs.mall.mapper.ChatUserMapper; +import cc.mrbird.febs.mall.service.IAdminMallMemberService; +import cc.mrbird.febs.mall.vo.AdminChatWalletVo; +import cc.mrbird.febs.mall.vo.MallMemberVo; +import lombok.RequiredArgsConstructor; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.annotation.Resource; + +@Controller("chatView") +@RequestMapping(FebsConstant.VIEW_PREFIX + "modules/chat") +@RequiredArgsConstructor +public class ViewChatController extends BaseController { + + @Resource + private ChatUserMapper chatUserMapper; + + /** + * 用户列表 + * @return + */ + @GetMapping("userList") + @RequiresPermissions("userList:view") + public String userList() { + return FebsUtil.view("modules/chat/userList"); + } + + /** + * 用户列表-系统拨付 + * @param userId + * @param model + * @return + */ + @GetMapping("mallSystemPay/{userId}") + @RequiresPermissions("mallSystemPay:update") + public String systemPay(@PathVariable String userId, Model model) { + AdminChatWalletVo data = chatUserMapper.selectTotalAmountByUserIdAndType(userId); + model.addAttribute("systemPay", data); + return FebsUtil.view("modules/chat/mallSystemPay"); + } + + /** + * 资金流水 + * @return + */ + @GetMapping("chatAmountFlow") + @RequiresPermissions("chatAmountFlow:view") + public String chatAmountFlow() { + return FebsUtil.view("modules/chat/chatAmountFlow"); + } + + /** + * 会员充值 + * @return + */ + @GetMapping("chatChargeList") + @RequiresPermissions("chatChargeList:view") + public String chatChargeList() { + return FebsUtil.view("modules/chat/chatChargeList"); + } + + /** + * 会员提现 + * @return + */ + @GetMapping("chatWithDrawList") + @RequiresPermissions("chatWithDrawList:view") + public String chatWithDrawList() { + return FebsUtil.view("modules/chat/chatWithDrawList"); + } +} diff --git a/src/main/java/cc/mrbird/febs/mall/dto/AdminSystemPayDto.java b/src/main/java/cc/mrbird/febs/mall/dto/AdminSystemPayDto.java new file mode 100644 index 0000000..1fd50cd --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/dto/AdminSystemPayDto.java @@ -0,0 +1,17 @@ +package cc.mrbird.febs.mall.dto; + +import lombok.Data; + +import java.math.BigDecimal; +@Data +public class AdminSystemPayDto { + /** + * userId + */ + private String id; + + private BigDecimal balance; + + private BigDecimal addBalance; + +} diff --git a/src/main/java/cc/mrbird/febs/mall/entity/ChatUser.java b/src/main/java/cc/mrbird/febs/mall/entity/ChatUser.java new file mode 100644 index 0000000..a84807a --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/entity/ChatUser.java @@ -0,0 +1,106 @@ +package cc.mrbird.febs.mall.entity; + +import cc.mrbird.febs.mall.GenderEnum; +import cc.mrbird.febs.mall.YesOrNoEnum; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; + +import java.util.Date; + +@Data +@TableName("chat_user") +public class ChatUser { + private static final long serialVersionUID = 1L; + + @TableId(value = "id",type = IdType.AUTO) + private Long userId; + /** + * 昵称 + */ + private String nickName; + /** + * 介绍 + */ + private String intro; + /** + * 性别1男0女 + */ + private String gender; + /** + * 头像 + */ + private String portrait; + /** + * 封面 + */ + private String cover; + /** + * 手机号 + */ + private String phone; + /** + * 省份 + */ + private String provinces; + /** + * 城市 + */ + private String city; + /** + * 微聊号 + */ + private String chatNo; + /** + * 密码 + */ + private String password; + /** + * 资金密码 + */ + private String tradePassword; + /** + * 盐 + */ + private String salt; + /** + * 状态Y正常N禁用 + */ + private String status; + /** + * 推送id + */ + private String cid; + /** + * 用户token + */ + private String token; + /** + * 版本信息 + */ + private String version; + /** + * 注册时间 + */ + @TableField(updateStrategy = FieldStrategy.NEVER) + private Date createTime; + /** + * 注销0正常null注销 + */ + @TableLogic + private Integer deleted; + /** + * 注销时间 + */ + private Date deletedTime; + + @TableField(exist = false) + private Integer type; + + @TableField(exist = false) + private String address; + + @TableField(exist = false) + private Integer state; + + +} diff --git a/src/main/java/cc/mrbird/febs/mall/entity/MemberCoinWithdraw.java b/src/main/java/cc/mrbird/febs/mall/entity/MemberCoinWithdraw.java new file mode 100644 index 0000000..429bd1b --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/entity/MemberCoinWithdraw.java @@ -0,0 +1,43 @@ +package cc.mrbird.febs.mall.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +@TableName("member_coin_withdraw") +public class MemberCoinWithdraw { + private static final long serialVersionUID = 1L; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createdTime = new Date(); + /** + * 主键 + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + + private String userId; + /** + * 提现金额 + */ + private BigDecimal amount; + /** + * 1:内转 2:外转提现 + */ + private Integer type; + /** + * 提现地址 + */ + private String address; + /** + * 1:成功 2:失败 3:进行中 + */ + private Integer state; + +} diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/ChatUserMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/ChatUserMapper.java new file mode 100644 index 0000000..cd987c5 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/mapper/ChatUserMapper.java @@ -0,0 +1,36 @@ +package cc.mrbird.febs.mall.mapper; + +import cc.mrbird.febs.mall.entity.ChatUser; +import cc.mrbird.febs.mall.entity.MemberCoinWithdraw; +import cc.mrbird.febs.mall.vo.*; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; + +public interface ChatUserMapper extends BaseMapper<ChatUser> { + + IPage<AdminChatUserVo> selectUserListInPage(Page<AdminChatUserVo> page, @Param("record")ChatUser chatUser); + + ChatUser selectByUserId(@Param("userId")String userId); + + void updateStatusByUserId(@Param("userId")String userId, @Param("status")String code); + + AdminChatWalletVo selectTotalAmountByUserIdAndType(@Param("userId")String userId); + + void updateBalanceByUserId(@Param("userId")String userId, @Param("addBalance")BigDecimal addBalance); + + IPage<AdminChatAmountFlowVo> selectAmountFlowListInPage(Page<AdminChatAmountFlowVo> page, @Param("record")ChatUser chatUser); + + IPage<AdminChatCahrgeVo> selectChargeListInPage(Page<AdminChatCahrgeVo> page, @Param("record")ChatUser chatUser); + + IPage<AdminChatWithDrawVo> selectWithdrawListInPage(Page<AdminChatWithDrawVo> page, @Param("record")ChatUser chatUser); + + MemberCoinWithdraw selectWithdrawInfoById(@Param("id")String id); + + void updateWithdrawStateById(@Param("state")int i,@Param("id")String id); + + void updateAmountFlowListByWithdrawId(@Param("id")String id, @Param("userId")String userId, @Param("state")int i); +} diff --git a/src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java b/src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java deleted file mode 100644 index c9ca6a6..0000000 --- a/src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java +++ /dev/null @@ -1,45 +0,0 @@ -package cc.mrbird.febs.mall.quartz; - -import cc.mrbird.febs.common.enumerates.OrderStatusEnum; -import cc.mrbird.febs.mall.entity.MallOrderInfo; -import cc.mrbird.febs.mall.mapper.MallOrderInfoMapper; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.DateUnit; -import cn.hutool.core.date.DateUtil; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.util.Date; -import java.util.List; - -/** - * @author wzy - * @date 2021-09-25 - **/ -@Slf4j -@Component -public class OrderOvertimeJob { - - @Autowired - private MallOrderInfoMapper orderInfoMapper; - - @Scheduled(cron = "0 0/5 * * * ? ") - public void overtimeJob() { - log.info("订单超时任务执行"); - List<MallOrderInfo> orderList = orderInfoMapper.selectOrderInfoByStatus(OrderStatusEnum.WAIT_PAY.getValue()); - if (CollUtil.isNotEmpty(orderList)) { - for (MallOrderInfo orderInfo : orderList) { - long subTime = DateUtil.between(orderInfo.getOrderTime(), new Date(), DateUnit.MINUTE, false); - - if (subTime > 15) { - orderInfo.setStatus(OrderStatusEnum.CANCEL.getValue()); - orderInfo.setCancelType(MallOrderInfo.CANCEL_OVERTIME_NO_PAY); - orderInfoMapper.updateById(orderInfo); - } - } - } - - } -} diff --git a/src/main/java/cc/mrbird/febs/mall/quartz/OrderSettlementJob.java b/src/main/java/cc/mrbird/febs/mall/quartz/OrderSettlementJob.java deleted file mode 100644 index e13295f..0000000 --- a/src/main/java/cc/mrbird/febs/mall/quartz/OrderSettlementJob.java +++ /dev/null @@ -1,101 +0,0 @@ -package cc.mrbird.febs.mall.quartz; - -import cc.mrbird.febs.common.enumerates.AgentLevelEnum; -import cc.mrbird.febs.common.enumerates.FlowTypeEnum; -import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; -import cc.mrbird.febs.mall.entity.MallGoodsSku; -import cc.mrbird.febs.mall.entity.MallMember; -import cc.mrbird.febs.mall.entity.MallOrderInfo; -import cc.mrbird.febs.mall.entity.MallOrderItem; -import cc.mrbird.febs.mall.mapper.MallGoodsSkuMapper; -import cc.mrbird.febs.mall.mapper.MallMemberMapper; -import cc.mrbird.febs.mall.mapper.MallOrderInfoMapper; -import cc.mrbird.febs.mall.mapper.MallOrderItemMapper; -import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; -import cc.mrbird.febs.mall.service.IMallAchieveService; -import cc.mrbird.febs.mall.service.IMallMoneyFlowService; -import cc.mrbird.febs.mall.service.IMemberProfitService; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.DateTime; -import cn.hutool.core.date.DateUtil; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; - -/** - * @author wzy - * @date 2022-06-15 - **/ -@Slf4j -@Component -public class OrderSettlementJob { - - @Autowired - private MallOrderInfoMapper mallOrderInfoMapper; - - @Autowired - private IApiMallMemberWalletService memberWalletService; - - @Autowired - private IMallMoneyFlowService mallMoneyFlowService; - - @Autowired - private MallMemberMapper mallMemberMapper; - - @Autowired - private MallGoodsSkuMapper mallGoodsSkuMapper; - - @Autowired - private IMemberProfitService memberProfitService; - - @Autowired - private IMallAchieveService mallAchieveService; - - /** - * 普通商品结算 -- 10天结算一次 - */ -// @Scheduled(cron = "0 0 0 * * ?") - @Transactional(rollbackFor = Exception.class) - public void normalGoodsSettlementJob() { - log.info("普通商品结算"); - List<MallOrderInfo> orderInfos = mallOrderInfoMapper.selectOrderInfoWithNormalGoods(DateUtil.offsetDay(new Date(), -10)); - if (CollUtil.isEmpty(orderInfos)) { - return; - } - - for (MallOrderInfo orderInfo : orderInfos) { - MallMember member = mallMemberMapper.selectById(orderInfo.getMemberId()); - if (AgentLevelEnum.ZERO_LEVEL.name().equals(member.getLevel())) { - continue; - } - - for (MallOrderItem item : orderInfo.getItems()) { - MallGoodsSku sku = mallGoodsSkuMapper.selectById(item.getSkuId()); - BigDecimal score = sku.getPresentPrice(); - - memberWalletService.add(score, member.getId(), "score"); - mallMoneyFlowService.addMoneyFlow(member.getId(), score, MoneyFlowTypeEnum.STATIC_BONUS.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.SCORE.getValue()); - - mallAchieveService.add(item.getId()); - } - - // 普通商品动态分红结算 - memberProfitService.dynamicProfit(orderInfo.getId(), 1); - } - } - - /** - * 自动确认收货 - */ - @Scheduled(cron = "0 0 0 * * ?") - public void orderAutoConfirmJob() { - log.info("自动确认收货"); - mallOrderInfoMapper.updateOrderConfirmStatus(DateUtil.offsetDay(new Date(), -7)); - } -} diff --git a/src/main/java/cc/mrbird/febs/mall/quartz/ProfitJob.java b/src/main/java/cc/mrbird/febs/mall/quartz/ProfitJob.java index 77ff326..34290df 100644 --- a/src/main/java/cc/mrbird/febs/mall/quartz/ProfitJob.java +++ b/src/main/java/cc/mrbird/febs/mall/quartz/ProfitJob.java @@ -34,8 +34,8 @@ @Component public class ProfitJob { - @Autowired - private IMemberProfitService memberProfitService; +// @Autowired +// private IMemberProfitService memberProfitService; /** * 代理分红 @@ -43,44 +43,5 @@ // @Scheduled(cron = "0 30 0 * * ?") // public void profitJob() { // memberProfitService.agentProfit(null); -// } -// -// @Scheduled(cron = "0 30 1 * * ?") -// public void storeAndDirectorJob() { -// memberProfitService.storeAndDirectorProfit(null); -// } -// -// /** -// * 感恩奖 -// */ -// @Scheduled(cron = "0 0 1 * * ?") -// public void thankfulJob() { -// memberProfitService.thankfulProfit(null); -// } -// -// -// /** -// * 静态分红 -// */ -//// @Scheduled(cron = "0 0 0 * * ?") -//// public void staticProfitJob() { -//// memberProfitService.staticProfit(null); -//// } -// -// /** -// * 排名奖 每月1号 -// */ -// @Scheduled(cron = "0 30 0 1 * ?") -// public void rankJob() { -// memberProfitService.rankProfit(); -// } -// -// /** -// * 积分池,所有消费拿出10%放到积分池,然后按1%每天释放加权平分 -// */ -// @Scheduled(cron = "0 0 2 * * ?") -//// @Scheduled(cron = "0 0/5 * * * ? ") -// public void scorePool() { -// memberProfitService.scorePool(); // } } diff --git a/src/main/java/cc/mrbird/febs/mall/service/IAdminChatService.java b/src/main/java/cc/mrbird/febs/mall/service/IAdminChatService.java new file mode 100644 index 0000000..197a51d --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/service/IAdminChatService.java @@ -0,0 +1,33 @@ +package cc.mrbird.febs.mall.service; + +import cc.mrbird.febs.common.entity.FebsResponse; +import cc.mrbird.febs.common.entity.QueryRequest; +import cc.mrbird.febs.mall.dto.AdminSystemPayDto; +import cc.mrbird.febs.mall.entity.ChatUser; +import cc.mrbird.febs.mall.vo.AdminChatAmountFlowVo; +import cc.mrbird.febs.mall.vo.AdminChatCahrgeVo; +import cc.mrbird.febs.mall.vo.AdminChatUserVo; +import cc.mrbird.febs.mall.vo.AdminChatWithDrawVo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; + +public interface IAdminChatService extends IService<ChatUser> { + + IPage<AdminChatUserVo> getUserList(ChatUser chatUser, QueryRequest request); + + FebsResponse openAccount(String userId); + + FebsResponse closeAccount(String userId); + + FebsResponse updateSystemPay(AdminSystemPayDto adminSystemPayDto); + + IPage<AdminChatAmountFlowVo> getFlowList(ChatUser chatUser, QueryRequest request); + + IPage<AdminChatCahrgeVo> getChargeList(ChatUser chatUser, QueryRequest request); + + IPage<AdminChatWithDrawVo> getWithdrawList(ChatUser chatUser, QueryRequest request); + + FebsResponse agreeEvent(String id); + + FebsResponse disagreeEvent(String id); +} diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminChatServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminChatServiceImpl.java new file mode 100644 index 0000000..cd559c9 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminChatServiceImpl.java @@ -0,0 +1,137 @@ +package cc.mrbird.febs.mall.service.impl; + +import cc.mrbird.febs.common.entity.FebsResponse; +import cc.mrbird.febs.common.entity.QueryRequest; +import cc.mrbird.febs.mall.YesOrNoEnum; +import cc.mrbird.febs.mall.dto.AdminSystemPayDto; +import cc.mrbird.febs.mall.entity.ChatUser; +import cc.mrbird.febs.mall.entity.MemberCoinWithdraw; +import cc.mrbird.febs.mall.mapper.ChatUserMapper; +import cc.mrbird.febs.mall.service.IAdminChatService; +import cc.mrbird.febs.mall.vo.AdminChatAmountFlowVo; +import cc.mrbird.febs.mall.vo.AdminChatCahrgeVo; +import cc.mrbird.febs.mall.vo.AdminChatUserVo; +import cc.mrbird.febs.mall.vo.AdminChatWithDrawVo; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; + +@Slf4j +@Service +@RequiredArgsConstructor +@Transactional +public class AdminChatServiceImpl extends ServiceImpl<ChatUserMapper, ChatUser> implements IAdminChatService { + + @Override + public IPage<AdminChatUserVo> getUserList(ChatUser chatUser, QueryRequest request) { + Page<AdminChatUserVo> page = new Page<>(request.getPageNum(), request.getPageSize()); + IPage<AdminChatUserVo> chatUserIPage = this.baseMapper.selectUserListInPage(page, chatUser); + return chatUserIPage; + } + + @Override + public FebsResponse openAccount(String userId) { + ChatUser chatUser = this.baseMapper.selectByUserId(userId); + if(ObjectUtil.isEmpty(chatUser)) { + return new FebsResponse().fail().message("会员信息不存在"); + } + this.baseMapper.updateStatusByUserId(userId,YesOrNoEnum.YES.getCode()); + return new FebsResponse().success(); + } + + @Override + public FebsResponse closeAccount(String userId) { + ChatUser chatUser = this.baseMapper.selectByUserId(userId); + if(ObjectUtil.isEmpty(chatUser)) { + return new FebsResponse().fail().message("会员信息不存在"); + } + this.baseMapper.updateStatusByUserId(userId,YesOrNoEnum.NO.getCode()); + return new FebsResponse().success(); + } + + @Override + public FebsResponse updateSystemPay(AdminSystemPayDto adminSystemPayDto) { + + ChatUser chatUser = this.baseMapper.selectByUserId(adminSystemPayDto.getId()); + if(ObjectUtil.isEmpty(chatUser)) { + return new FebsResponse().fail().message("会员信息不存在"); + } + BigDecimal addBalance = adminSystemPayDto.getAddBalance(); + BigDecimal balance = adminSystemPayDto.getBalance(); + if(BigDecimal.ZERO.compareTo(addBalance) > 0){ + //减少余额,则判断增加数量的绝对值是否大于余额,避免出现负数 + if(addBalance.negate().compareTo(balance) > 0){ + return new FebsResponse().fail().message("余额不能为负数,请调整拨付数量"); + } + } + //增加用户的余额 + this.baseMapper.updateBalanceByUserId(adminSystemPayDto.getId(),addBalance); + return new FebsResponse().success(); + } + + @Override + public IPage<AdminChatAmountFlowVo> getFlowList(ChatUser chatUser, QueryRequest request) { + Page<AdminChatAmountFlowVo> page = new Page<>(request.getPageNum(), request.getPageSize()); + IPage<AdminChatAmountFlowVo> chatUserIPage = this.baseMapper.selectAmountFlowListInPage(page, chatUser); + return chatUserIPage; + } + + @Override + public IPage<AdminChatCahrgeVo> getChargeList(ChatUser chatUser, QueryRequest request) { + Page<AdminChatCahrgeVo> page = new Page<>(request.getPageNum(), request.getPageSize()); + IPage<AdminChatCahrgeVo> adminChatCahrgeVos = this.baseMapper.selectChargeListInPage(page, chatUser); + return adminChatCahrgeVos; + } + + @Override + public IPage<AdminChatWithDrawVo> getWithdrawList(ChatUser chatUser, QueryRequest request) { + Page<AdminChatWithDrawVo> page = new Page<>(request.getPageNum(), request.getPageSize()); + IPage<AdminChatWithDrawVo> adminChatWithDrawVos = this.baseMapper.selectWithdrawListInPage(page, chatUser); + return adminChatWithDrawVos; + } + + @Override + public FebsResponse agreeEvent(String id) { + MemberCoinWithdraw memberCoinWithdraw = this.baseMapper.selectWithdrawInfoById(id); + if(ObjectUtil.isEmpty(memberCoinWithdraw)) { + return new FebsResponse().fail().message("提现记录不存在"); + } + Integer state = memberCoinWithdraw.getState(); + if(3 != state){ + return new FebsResponse().fail().message("提现记录不是进行中的状态"); + } + + this.baseMapper.updateWithdrawStateById(1,id); + + this.baseMapper.updateAmountFlowListByWithdrawId(id,memberCoinWithdraw.getUserId(),1); + return new FebsResponse().success(); + } + + @Override + public FebsResponse disagreeEvent(String id) { + MemberCoinWithdraw memberCoinWithdraw = this.baseMapper.selectWithdrawInfoById(id); + if(ObjectUtil.isEmpty(memberCoinWithdraw)) { + return new FebsResponse().fail().message("提现记录不存在"); + } + Integer state = memberCoinWithdraw.getState(); + if(3 != state){ + return new FebsResponse().fail().message("提现记录不是进行中的状态"); + } + this.baseMapper.updateWithdrawStateById(2,id); + + //增加用户的余额 + this.baseMapper.updateBalanceByUserId(memberCoinWithdraw.getUserId(),memberCoinWithdraw.getAmount()); + + this.baseMapper.updateAmountFlowListByWithdrawId(id,memberCoinWithdraw.getUserId(),2); + return new FebsResponse().success(); + } + +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/AdminChatAmountFlowVo.java b/src/main/java/cc/mrbird/febs/mall/vo/AdminChatAmountFlowVo.java new file mode 100644 index 0000000..1a0dd9c --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/AdminChatAmountFlowVo.java @@ -0,0 +1,38 @@ +package cc.mrbird.febs.mall.vo; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class AdminChatAmountFlowVo { + /** + * 1:充值 2:提现 3:红包 4:转账 5:创建群聊 + */ + private Integer type; + /** + * 金额 + */ + private BigDecimal amount; + /** + * 昵称 + */ + private String nickName; + /** + * 创建时间 + */ + private Date createTime; + /** + * 当前余额 + */ + private BigDecimal avaAmount; + /** + * 1 :成功 2:失败 3:进行中 + */ + private Integer state; + /** + * 说明 + */ + private String remark; +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/AdminChatCahrgeVo.java b/src/main/java/cc/mrbird/febs/mall/vo/AdminChatCahrgeVo.java new file mode 100644 index 0000000..17a3e8b --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/AdminChatCahrgeVo.java @@ -0,0 +1,28 @@ +package cc.mrbird.febs.mall.vo; + +import lombok.Data; +import java.math.BigDecimal; + +@Data +public class AdminChatCahrgeVo { + + private String createdTime; + /** + * 昵称 + */ + private String nickName; + + private BigDecimal amount; + + private BigDecimal lastAmount; + + private int status; + + private String symbol; + + private String address; + + private String tag; + + private String hash; +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/AdminChatUserVo.java b/src/main/java/cc/mrbird/febs/mall/vo/AdminChatUserVo.java new file mode 100644 index 0000000..4e200c6 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/AdminChatUserVo.java @@ -0,0 +1,35 @@ +package cc.mrbird.febs.mall.vo; + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class AdminChatUserVo { + + private String userId; + /** + * 昵称 + */ + private String nickName; + /** + * 微聊号 + */ + private String chatNo; + /** + * 状态Y正常N禁用 + */ + private String status; + /** + * 注册时间 + */ + private String createTime; + /** + * 账户总额 + */ + private BigDecimal totalAmount; + /** + * 账户可用 + */ + private BigDecimal avaAmount; +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/AdminChatWalletVo.java b/src/main/java/cc/mrbird/febs/mall/vo/AdminChatWalletVo.java new file mode 100644 index 0000000..091bf63 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/AdminChatWalletVo.java @@ -0,0 +1,16 @@ +package cc.mrbird.febs.mall.vo; + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class AdminChatWalletVo { + + private String id; + /** + * 总金额 + */ + private BigDecimal balance; + +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/AdminChatWithDrawVo.java b/src/main/java/cc/mrbird/febs/mall/vo/AdminChatWithDrawVo.java new file mode 100644 index 0000000..b7e1c21 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/AdminChatWithDrawVo.java @@ -0,0 +1,35 @@ +package cc.mrbird.febs.mall.vo; + +import lombok.Data; +import java.math.BigDecimal; + +@Data +public class AdminChatWithDrawVo { + + private String createdTime; + /** + * 主键 + */ + private String id; + + /** + * 昵称 + */ + private String nickName; + /** + * 提现金额 + */ + private BigDecimal amount; + /** + * 1:内转 2:外转提现 + */ + private Integer type; + /** + * 提现地址 + */ + private String address; + /** + * 1:成功 2:失败 3:进行中 + */ + private Integer state; +} diff --git a/src/main/java/cc/mrbird/febs/system/controller/LoginController.java b/src/main/java/cc/mrbird/febs/system/controller/LoginController.java index c99e8d9..9811cc6 100644 --- a/src/main/java/cc/mrbird/febs/system/controller/LoginController.java +++ b/src/main/java/cc/mrbird/febs/system/controller/LoginController.java @@ -89,60 +89,6 @@ // 更新登录时间 this.userService.updateLoginTime(username); Map<String, Object> data = new HashMap<>(5); - // 获取系统访问记录 -// Long totalVisitCount = this.loginLogService.findTotalVisitCount(); -// data.put("totalVisitCount", totalVisitCount); -// Long todayVisitCount = this.loginLogService.findTodayVisitCount(); -// data.put("todayVisitCount", todayVisitCount); -// Long todayIp = this.loginLogService.findTodayIp(); -// data.put("todayIp", todayIp); - - //积分池数据 - data.put("scorePool",redisUtils.get("scorePool")); - //支付统计 - List<Long> states = new ArrayList(); - states.add(2L); - states.add(3L); - states.add(4L); -// data.put("wechatPay",mallOrderInfoMapper.selectSumAmountByPayMethodAndStatue(OrderPayMethodEnum.WECHAT.getName(), OrderStatusEnum.FINISH.getValue())); - data.put("wechatPay",mallOrderInfoMapper.selectSumAmountByPayMethodAndSomeStatue(OrderPayMethodEnum.WECHAT.getName(), states)); -// data.put("alipayPay",mallOrderInfoMapper.selectSumAmountByPayMethodAndStatue(OrderPayMethodEnum.ALIPAY.getName(), OrderStatusEnum.FINISH.getValue())); - data.put("alipayPay",mallOrderInfoMapper.selectSumAmountByPayMethodAndSomeStatue(OrderPayMethodEnum.ALIPAY.getName(), states)); -// data.put("scorePay",mallOrderInfoMapper.selectSumAmountByPayMethodAndStatue(OrderPayMethodEnum.SCORE.getName(), OrderStatusEnum.FINISH.getValue())); - data.put("scorePay",mallOrderInfoMapper.selectSumAmountByPayMethodAndSomeStatue(OrderPayMethodEnum.BANK.getName(), states)); -// data.put("balancePay",mallOrderInfoMapper.selectSumAmountByPayMethodAndStatue(OrderPayMethodEnum.BALANCE.getName(), OrderStatusEnum.FINISH.getValue())); - data.put("balancePay",mallOrderInfoMapper.selectSumAmountByPayMethodAndSomeStatue(OrderPayMethodEnum.BALANCE.getName(), states)); - - - data.put("lastDay", mallAchieveRecordMapper.selectAchieveTotal("D", DateUtil.offsetDay(new Date(), -1))); - data.put("today", mallAchieveRecordMapper.selectAchieveTotal("D", new Date())); - data.put("lastMonth", mallAchieveRecordMapper.selectAchieveTotal("M", DateUtil.offsetMonth(new Date(), -1))); - data.put("thisMonth", mallAchieveRecordMapper.selectAchieveTotal("M", new Date())); - - //会员数据 - data.put("totalMember",mallMemberMapper.selectCount(new QueryWrapper<>()) ); - QueryWrapper<MallMember> formalMember = new QueryWrapper<>(); - formalMember.ne("level", AgentLevelEnum.ZERO_LEVEL.name()); - data.put("formalMember",mallMemberMapper.selectCount(formalMember)); - - QueryWrapper<MallMember> informalMember = new QueryWrapper<>(); - informalMember.eq("level", AgentLevelEnum.ZERO_LEVEL.name()); - data.put("informalMember",mallMemberMapper.selectCount(informalMember)); - - QueryWrapper<MallMember> todayMember = new QueryWrapper<>(); - todayMember.like("CREATED_TIME", DateUtil.today()); -// todayMember.ne("level", AgentLevelEnum.ZERO_LEVEL.name()); - data.put("todayMember",mallMemberMapper.selectCount(todayMember)); - - QueryWrapper<MallMember> thisMonthMember = new QueryWrapper<>(); - thisMonthMember.like("CREATED_TIME", DateUtil.format(DateUtil.date(),"yyyy-MM")); -// thisMonthMember.ne("level", AgentLevelEnum.ZERO_LEVEL.name()); - data.put("thisMonthMember",mallMemberMapper.selectCount(thisMonthMember)); - - QueryWrapper<MallMember> lastMonthMember = new QueryWrapper<>(); - lastMonthMember.like("CREATED_TIME", DateUtil.format(DateUtil.offsetMonth(new Date(), -1),"yyyy-MM")); -// lastMonthMember.ne("level", AgentLevelEnum.ZERO_LEVEL.name()); - data.put("lastMonthMember",mallMemberMapper.selectCount(lastMonthMember)); // 获取近期系统访问记录 List<Map<String, Object>> lastSevenVisitCount = this.loginLogService.findLastSevenDaysVisitCount(null); diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 954e7e8..13e201b 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -15,14 +15,10 @@ datasource: # 数据源-1,名称为 base base: - username: ct_test - password: 123456 + username: boot_im + password: boot_im!@#123 driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://120.27.238.55:3406/db_hnto?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 -# username: db_mall -# password: mall!@#123 -# driver-class-name: com.mysql.cj.jdbc.Driver -# url: jdbc:mysql://47.111.90.145:3306/db_mall?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 + url: jdbc:mysql://154.91.195.148:3306/boot_im?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 redis: # Redis数据库索引(默认为 0) diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 27eef32..3095258 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -15,20 +15,20 @@ datasource: # 数据源-1,名称为 base base: - username: db_gzyp_prd - password: gzyp123!@#123 + username: boot_im + password: boot_im!@#123 driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://121.43.43.93:3306/db_gzyp_prd?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 + url: jdbc:mysql://154.91.195.148:3306/boot_im?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 redis: # Redis数据库索引(默认为 0) - database: 0 + database: 7 # Redis服务器地址 - host: 121.43.43.93 + host: 127.0.0.1 # Redis服务器连接端口 port: 6379 # Redis 密码 - password: gzyp-mall=-0 + password: dapp!@#123 lettuce: pool: # 连接池中的最小空闲连接 @@ -41,11 +41,13 @@ max-wait: 10000 # 连接超时时间(毫秒) timeout: 5000 + + # rabbitmq 配置 rabbitmq: - host: 121.43.43.93 + host: 127.0.0.1 port: 5672 - username: ct_rabbit - password: 123456 + username: xc_rabbit + password: xuncong123 publisher-confirm-type: correlated pay: diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index a4a3d86..3538ebe 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,5 +1,5 @@ server: - port: 8186 + port: 8098 tomcat: uri-encoding: utf-8 diff --git a/src/main/resources/mapper/modules/ChatUserMapper.xml b/src/main/resources/mapper/modules/ChatUserMapper.xml new file mode 100644 index 0000000..b040b45 --- /dev/null +++ b/src/main/resources/mapper/modules/ChatUserMapper.xml @@ -0,0 +1,157 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="cc.mrbird.febs.mall.mapper.ChatUserMapper"> + + <select id="selectUserListInPage" resultType="cc.mrbird.febs.mall.vo.AdminChatUserVo"> + select + a.user_id userId, + a.nick_name nickName, + a.chat_no chatNo, + a.status status, + date_format(a.create_time, '%Y-%m-%d %H:%m:%s') createTime, + IFNULL(sum(b.total_amount), 0) totalAmount, + IFNULL(sum(b.ava_amount), 0) avaAmount + from chat_user a + left join chat_wallet b on b.user_id = a.user_id and type = 'USDT' + <where> + <if test="record != null"> + <if test="record.nickName != null and record.nickName != ''"> + and a.nick_name like CONCAT('%', CONCAT(#{record.nickName}, '%')) + </if> + <if test="record.chatNo != null and record.chatNo != ''"> + and a.chat_no = #{record.chatNo} + </if> + <if test="record.status != null and record.status != ''"> + and a.status = #{record.status} + </if> + </if> + </where> + group by a.user_id + order by a.create_time desc + </select> + + <select id="selectByUserId" resultType="cc.mrbird.febs.mall.entity.ChatUser"> + select + a.* + from chat_user a + where a.user_id = #{userId} + </select> + + <update id="updateStatusByUserId"> + update chat_user + set + status = #{status} + where user_id = #{userId} + </update> + + <select id="selectTotalAmountByUserIdAndType" resultType="cc.mrbird.febs.mall.vo.AdminChatWalletVo"> + select + a.user_id id, + a.total_amount balance + from chat_wallet a + where a.user_id = #{userId} + and a.type = 'USDT' + </select> + + <update id="updateBalanceByUserId"> + update chat_wallet + set + total_amount = total_amount + #{addBalance}, + ava_amount = ava_amount + #{addBalance} + where user_id = #{userId} + and type = 'USDT' + </update> + + <select id="selectAmountFlowListInPage" resultType="cc.mrbird.febs.mall.vo.AdminChatAmountFlowVo"> + select + a.type type, + a.amount amount, + b.nick_name nickName, + date_format(a.create_time, '%Y-%m-%d %H:%m:%s') createTime, + a.ava_amount avaAmount, + a.state state, + a.remark remark + from chat_amount_flow a + left join chat_user b on b.user_id = a.user_id + <where> + <if test="record != null"> + <if test="record.nickName != null and record.nickName != ''"> + and b.nick_name like CONCAT('%', CONCAT(#{record.nickName}, '%')) + </if> + <if test="record.type != null and record.type != ''"> + and a.type = #{record.type} + </if> + </if> + </where> + order by a.create_time desc + </select> + + <select id="selectChargeListInPage" resultType="cc.mrbird.febs.mall.vo.AdminChatCahrgeVo"> + select + date_format(a.created_time, '%Y-%m-%d %H:%m:%s') createdTime, + b.nick_name nickName, + a.amount amount, + a.last_amount lastAmount, + a.status status, + a.symbol symbol, + a.tag tag, + a.hash hash, + a.address address + from member_coin_charge a + left join chat_user b on b.user_id = a.user_id + <where> + <if test="record != null"> + <if test="record.nickName != null and record.nickName != ''"> + and b.nick_name like CONCAT('%', CONCAT(#{record.nickName}, '%')) + </if> + <if test="record.address != null and record.address != ''"> + and a.address = #{record.address} + </if> + </if> + </where> + order by a.created_time desc + </select> + + <select id="selectWithdrawListInPage" resultType="cc.mrbird.febs.mall.vo.AdminChatWithDrawVo"> + select + date_format(a.created_time, '%Y-%m-%d %H:%m:%s') createdTime, + b.nick_name nickName, + a.id id, + a.amount amount, + a.type type, + a.address address, + a.state state + from member_coin_withdraw a + left join chat_user b on b.user_id = a.user_id + <where> + <if test="record != null"> + <if test="record.nickName != null and record.nickName != ''"> + and b.nick_name like CONCAT('%', CONCAT(#{record.nickName}, '%')) + </if> + <if test="record.address != null and record.address != ''"> + and a.address = #{record.address} + </if> + <if test="record.state != null and record.state != ''"> + and a.state = #{record.state} + </if> + <if test="record.type != null and record.type != ''"> + and a.type = #{record.type} + </if> + </if> + </where> + order by a.created_time desc + </select> + + <select id="selectWithdrawInfoById" resultType="cc.mrbird.febs.mall.entity.MemberCoinWithdraw"> + select * from member_coin_withdraw a where a.id = #{id} + </select> + + <update id="updateWithdrawStateById"> + update member_coin_withdraw set state = #{state} where id = #{id} + </update> + + <update id="updateAmountFlowListByWithdrawId"> + update chat_amount_flow set state = #{state} where user_id = #{userId} and relation_id = #{id} + </update> + +</mapper> \ No newline at end of file diff --git a/src/main/resources/templates/error/403.html b/src/main/resources/templates/error/403.html index de2892a..bde822e 100644 --- a/src/main/resources/templates/error/403.html +++ b/src/main/resources/templates/error/403.html @@ -2,7 +2,7 @@ <html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="utf-8"> - <title>国致优品商城 权限系统</title> + <title>IM 权限系统</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> diff --git a/src/main/resources/templates/error/404.html b/src/main/resources/templates/error/404.html index 5b71790..68c50d9 100644 --- a/src/main/resources/templates/error/404.html +++ b/src/main/resources/templates/error/404.html @@ -2,7 +2,7 @@ <html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="utf-8"> - <title>国致优品商城 权限系统</title> + <title>IM 权限系统</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> diff --git a/src/main/resources/templates/error/500.html b/src/main/resources/templates/error/500.html index 08482be..9fe2d98 100644 --- a/src/main/resources/templates/error/500.html +++ b/src/main/resources/templates/error/500.html @@ -2,7 +2,7 @@ <html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="utf-8"> - <title>国致优品商城 权限系统</title> + <title>IM 权限系统</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> diff --git a/src/main/resources/templates/febs/views/layout.html b/src/main/resources/templates/febs/views/layout.html index ae2be6b..f89506c 100644 --- a/src/main/resources/templates/febs/views/layout.html +++ b/src/main/resources/templates/febs/views/layout.html @@ -64,7 +64,7 @@ <div class="layui-side-scroll"> <div class="layui-logo" style="cursor: pointer"> <img data-th-src="@{febs/images/logo.png}"> - <span>国致优品商城 权限系统</span> + <span>IM 权限系统</span> </div> <script type="text/html" diff --git a/src/main/resources/templates/febs/views/login.html b/src/main/resources/templates/febs/views/login.html index 3f3f2db..37ef274 100644 --- a/src/main/resources/templates/febs/views/login.html +++ b/src/main/resources/templates/febs/views/login.html @@ -2,7 +2,7 @@ <html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="utf-8"> - <title>国致优品商城 权限系统</title> + <title>IM 权限系统</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> @@ -19,7 +19,7 @@ <div class="layui-container"> <div class="layui-row"> <div class="layui-col-xs12 layui-col-lg4 layui-col-lg-offset4 febs-tc"> - <div class="layui-logo"><span><b>国致优品商城</b> 权限系统</span></div> + <div class="layui-logo"><span><b>IM</b> 权限系统</span></div> </div> <div class="layui-col-xs12 layui-col-lg4 layui-col-lg-offset4" id="login-div"> <div class="layui-form" lay-filter="login-form"> diff --git a/src/main/resources/templates/febs/views/modules/chat/chatAmountFlow.html b/src/main/resources/templates/febs/views/modules/chat/chatAmountFlow.html new file mode 100644 index 0000000..80b2a9b --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/chat/chatAmountFlow.html @@ -0,0 +1,146 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-chat-flow-list" lay-title="资金流水"> + <div class="layui-row febs-container"> + <div class="layui-col-md12"> + <div class="layui-card"> + <div class="layui-card-body febs-table-full"> + <form class="layui-form layui-table-form" lay-filter="user-table-form"> + <div class="layui-row"> + <div class="layui-col-md10"> + <div class="layui-form-item"> + <div class="layui-inline"> + <label class="layui-form-label">昵称:</label> + <div class="layui-input-inline"> + <input type="text" placeholder="昵称" name="nickName" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-inline"> + <label class="layui-form-label">操作类型:</label> + <div class="layui-input-inline"> + <select name="type"> + <!--1:充值 2:提现 3:红包 4:转账 5:创建群聊--> + <option value="">请选择</option> + <option value="1">充值</option> + <option value="2">提现</option> + <option value="3">红包</option> + <option value="4">转账</option> + <option value="5">创建群聊</option> + <option value="6">系统拨付</option> + </select> + </div> + </div> + </div> + </div> + <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> + <i class="layui-icon"></i> + </div> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> + <i class="layui-icon"></i> + </div> + </div> + </div> + </form> + <table lay-filter="userChatFlowTable" lay-data="{id: 'userChatFlowTable'}"></table> + </div> + </div> + </div> + </div> +</div> +<!-- 表格操作栏 start --> +<script type="text/html" id="user-option"> + <span shiro:lacksPermission="user:view,user:update,user:delete"> + <span class="layui-badge-dot febs-bg-orange"></span> 无权限 + </span> + <a lay-event="edit" shiro:hasPermission="user:update"><i + class="layui-icon febs-edit-area febs-blue"></i></a> +</script> +<!--1:充值 2:提现 3:红包 4:转账 5:创建群聊--> +<script type="text/html" id="flow-type"> + {{# + var type = { + 1: {title: '充值', color: 'orange'}, + 2: {title: '提现', color: 'green'}, + 3: {title: '红包', color: 'blue'}, + 4: {title: '转账', color: 'orange'}, + 5: {title: '创建群聊', color: 'green'}, + 6: {title: '系统拨付', color: 'blue'}, + }[d.type]; + }} + <span class="layui-badge febs-bg-{{type.color}}">{{ type.title }}</span> +</script> +<style> + .layui-form-onswitch { + background-color: #5FB878 !important; + } +</style> +<!-- 表格操作栏 end --> +<script data-th-inline="none" type="text/javascript"> + // 引入组件并初始化 + layui.use([ 'jquery', 'form', 'table', 'febs'], function () { + var $ = layui.jquery, + febs = layui.febs, + form = layui.form, + table = layui.table, + $view = $('#febs-chat-flow-list'), + $query = $view.find('#query'), + $reset = $view.find('#reset'), + $searchForm = $view.find('form'), + sortObject = {field: 'phone', type: null}, + tableIns; + + form.render(); + + // 表格初始化 + initTable(); + + // 查询按钮 + $query.on('click', function () { + var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); + tableIns.reload({where: params, page: {curr: 1}}); + }); + + // 刷新按钮 + $reset.on('click', function () { + $searchForm[0].reset(); + sortObject.type = 'null'; + tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); + }); + + // 获取查询参数 + function getQueryParams() { + return { + nickName: $searchForm.find('input[name="nickName"]').val().trim(), + type: $searchForm.find("select[name='type']").val() + }; + } + + function initTable() { + tableIns = febs.table.init({ + elem: $view.find('table'), + id: 'userChatFlowTable', + url: ctx + 'admin/chat/getFlowList', + // toolbar:"#toolbar", + // defaultToolbar:[], + totalRow: true ,// 开启合计行 + cols: [[ + {field: 'nickName', title: '昵称', minWidth: 150,align:'center', totalRowText: '合计:',align:'center'}, + {title: '操作类型', minWidth: 150,templet: '#flow-type',align:'center'}, + {field: 'amount', title: '金额', minWidth: 100,align:'center',align:'center',totalRow: '{{= parseInt(d.amount) }}'}, + {field: 'state', title: '状态', + templet: function (d) { + if (d.state === 1) { + return '<span class="layui-badge febs-bg-green">成功</span>' + } else if (d.state === 2) { + return '<span class="layui-badge febs-bg-red">失败</span>' + }else{ + return '<span class="layui-badge febs-bg-orange">进行中</span>' + } + }, minWidth: 120,align:'center'}, + {field: 'createTime', title: '操作时间', minWidth: 180,align:'center'}, + {field: 'remark', title: '说明', minWidth: 80,align:'center',align:'center'} + ]] + }); + } + + }) +</script> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/chat/chatChargeList.html b/src/main/resources/templates/febs/views/modules/chat/chatChargeList.html new file mode 100644 index 0000000..1b58f88 --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/chat/chatChargeList.html @@ -0,0 +1,129 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-chat-charge-list" lay-title="充值记录"> + <div class="layui-row febs-container"> + <div class="layui-col-md12"> + <div class="layui-card"> + <div class="layui-card-body febs-table-full"> + <form class="layui-form layui-table-form" lay-filter="user-table-form"> + <div class="layui-row"> + <div class="layui-col-md10"> + <div class="layui-form-item"> + <div class="layui-inline"> + <label class="layui-form-label">昵称:</label> + <div class="layui-input-inline"> + <input type="text" placeholder="昵称" name="nickName" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-inline"> + <label class="layui-form-label">地址:</label> + <div class="layui-input-inline"> + <input type="text" placeholder="地址" name="address" autocomplete="off" class="layui-input"> + </div> + </div> + </div> + </div> + <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> + <i class="layui-icon"></i> + </div> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> + <i class="layui-icon"></i> + </div> + </div> + </div> + </form> + <table lay-filter="userChatChargeTable" lay-data="{id: 'userChatChargeTable'}"></table> + </div> + </div> + </div> + </div> +</div> +<!-- 表格操作栏 start --> +<script type="text/html" id="user-option"> + <span shiro:lacksPermission="user:view,user:update,user:delete"> + <span class="layui-badge-dot febs-bg-orange"></span> 无权限 + </span> + <a lay-event="edit" shiro:hasPermission="user:update"><i + class="layui-icon febs-edit-area febs-blue"></i></a> +</script> +<!--1:成功 2:失败 3:进行中--> +<script type="text/html" id="status-type"> + {{# + var status = { + 1: {title: '-', color: ''}, + 2: {title: '成功', color: 'green'}, + 3: {title: '进行中', color: 'orange'}, + }[d.status]; + }} + <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span> +</script> +<style> + .layui-form-onswitch { + background-color: #5FB878 !important; + } +</style> +<!-- 表格操作栏 end --> +<script data-th-inline="none" type="text/javascript"> + // 引入组件并初始化 + layui.use([ 'jquery', 'form', 'table', 'febs'], function () { + var $ = layui.jquery, + febs = layui.febs, + form = layui.form, + table = layui.table, + $view = $('#febs-chat-charge-list'), + $query = $view.find('#query'), + $reset = $view.find('#reset'), + $searchForm = $view.find('form'), + sortObject = {field: 'phone', type: null}, + tableIns; + + form.render(); + + // 表格初始化 + initTable(); + + // 查询按钮 + $query.on('click', function () { + var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); + tableIns.reload({where: params, page: {curr: 1}}); + }); + + // 刷新按钮 + $reset.on('click', function () { + $searchForm[0].reset(); + sortObject.type = 'null'; + tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); + }); + + // 获取查询参数 + function getQueryParams() { + return { + nickName: $searchForm.find('input[name="nickName"]').val().trim(), + address: $searchForm.find('input[name="address"]').val().trim() + }; + } + + function initTable() { + tableIns = febs.table.init({ + elem: $view.find('table'), + id: 'userChatChargeTable', + url: ctx + 'admin/chat/getChargeList', + // toolbar:"#toolbar", + // defaultToolbar:[], + totalRow: true ,// 开启合计行 + cols: [[ + {field: 'nickName', title: '昵称', minWidth: 150,align:'center', totalRowText: '合计:',align:'center'}, + {field: 'amount', title: '金额', minWidth: 100,align:'center',align:'center',totalRow: '{{= parseInt(d.amount) }}'}, + {field: 'lastAmount', title: '充值前金额', minWidth: 100,align:'center',align:'center',totalRow: '{{= parseInt(d.amount) }}'}, + // {field: 'avaAmount', title: '操作前余额', minWidth: 150,align:'center',align:'center',totalRow: '{{= parseInt(d.avaAmount) }}'}, + {title: '状态', minWidth: 150,templet: '#status-type',align:'center'}, + {field: 'symbol', title: '币种', minWidth: 180,align:'center'}, + {field: 'address', title: '地址', minWidth: 180,align:'center'}, + {field: 'hash', title: 'HASH', minWidth: 180,align:'center'}, + {field: 'createdTime', title: '操作时间', minWidth: 180,align:'center'}, + {field: 'remark', title: '说明', minWidth: 80,align:'center',align:'center'} + ]] + }); + } + + }) +</script> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/chat/chatWithDrawList.html b/src/main/resources/templates/febs/views/modules/chat/chatWithDrawList.html new file mode 100644 index 0000000..8f3b2c7 --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/chat/chatWithDrawList.html @@ -0,0 +1,193 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-chat-withdraw-list" lay-title="提现记录"> + <div class="layui-row febs-container"> + <div class="layui-col-md12"> + <div class="layui-card"> + <div class="layui-card-body febs-table-full"> + <form class="layui-form layui-table-form" lay-filter="user-table-form"> + <div class="layui-row"> + <div class="layui-col-md10"> + <div class="layui-form-item"> + <div class="layui-inline"> + <label class="layui-form-label">昵称:</label> + <div class="layui-input-inline"> + <input type="text" placeholder="昵称" name="nickName" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-inline"> + <label class="layui-form-label">地址:</label> + <div class="layui-input-inline"> + <input type="text" placeholder="地址" name="address" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-inline"> + <label class="layui-form-label">类型:</label> + <div class="layui-input-inline"> + <select name="type"> + <option value="">请选择</option> + <option value="1">转账</option> + <option value="2">提现</option> + </select> + </div> + </div> + <div class="layui-inline"> + <label class="layui-form-label">状态:</label> + <div class="layui-input-inline"> + <select name="state"> + <option value="">请选择</option> + <option value="1">成功</option> + <option value="2">失败</option> + <option value="3">进行中</option> + </select> + </div> + </div> + </div> + </div> + <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> + <i class="layui-icon"></i> + </div> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> + <i class="layui-icon"></i> + </div> + </div> + </div> + </form> + <table lay-filter="userChatWithdrawTable" lay-data="{id: 'userChatWithdrawTable'}"></table> + </div> + </div> + </div> + </div> +</div> +<!-- 表格操作栏 start --> +<script type="text/html" id="user-option"> + <span shiro:lacksPermission="user:view,user:update,user:delete"> + <span class="layui-badge-dot febs-bg-orange"></span> 无权限 + </span> + <a lay-event="edit" shiro:hasPermission="user:update"><i + class="layui-icon febs-edit-area febs-blue"></i></a> +</script> +<style> + .layui-form-onswitch { + background-color: #5FB878 !important; + } +</style> +<!-- 表格操作栏 end --> +<script data-th-inline="none" type="text/javascript"> + // 引入组件并初始化 + layui.use([ 'jquery', 'form', 'table', 'febs'], function () { + var $ = layui.jquery, + febs = layui.febs, + form = layui.form, + table = layui.table, + $view = $('#febs-chat-withdraw-list'), + $query = $view.find('#query'), + $reset = $view.find('#reset'), + $searchForm = $view.find('form'), + sortObject = {field: 'phone', type: null}, + tableIns; + + form.render(); + + // 表格初始化 + initTable();table.on('tool(userChatWithdrawTable)', function (obj) { + var data = obj.data, + layEvent = obj.event; + if (layEvent === 'agree') { + febs.modal.confirm('同意', '通过提现?', function () { + agreeEvent(data.id); + }); + } + if (layEvent === 'disagree') { + febs.modal.confirm('拒绝', '拒绝提现?', function () { + disagreeEvent(data.id); + }); + } + + function agreeEvent(id) { + febs.get(ctx + 'admin/chat/agreeEvent/' + id, null, function () { + febs.alert.success('操作成功'); + $query.click(); + }); + } + + function disagreeEvent(id) { + febs.get(ctx + 'admin/chat/disagreeEvent/' + id, null, function () { + febs.alert.success('操作成功'); + $query.click(); + }); + } + + }); + + // 查询按钮 + $query.on('click', function () { + var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); + tableIns.reload({where: params, page: {curr: 1}}); + }); + + // 刷新按钮 + $reset.on('click', function () { + $searchForm[0].reset(); + sortObject.type = 'null'; + tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); + }); + + // 获取查询参数 + function getQueryParams() { + return { + nickName: $searchForm.find('input[name="nickName"]').val().trim(), + address: $searchForm.find('input[name="address"]').val().trim(), + state: $searchForm.find("select[name='state']").val(), + type: $searchForm.find("select[name='type']").val() + }; + } + + function initTable() { + tableIns = febs.table.init({ + elem: $view.find('table'), + id: 'userChatWithdrawTable', + url: ctx + 'admin/chat/getWithdrawList', + // toolbar:"#toolbar", + // defaultToolbar:[], + totalRow: true ,// 开启合计行 + cols: [[ + {field: 'id', title: '', minWidth: 150,align:'center', totalRowText: '合计:',align:'center'}, + {field: 'nickName', title: '昵称', minWidth: 150,align:'center'}, + {field: 'amount', title: '金额', minWidth: 100,align:'center',align:'center',totalRow: '{{= parseInt(d.amount) }}'}, + {field: 'type', title: '类型', + templet: function (d) { + if (d.type === 1) { + return '<span style="color:green;">转账</span>' + } else if (d.type === 2) { + return '<span style="color:blue;">提现</span>' + }else{ + return '-' + } + }, minWidth: 120,align:'center'}, + {field: 'state', title: '状态', + templet: function (d) { + if (d.state === 1) { + return '<span class="layui-badge febs-bg-green">成功</span>' + } else if (d.state === 2) { + return '<span class="layui-badge febs-bg-red">失败</span>' + }else{ + return '<span class="layui-badge febs-bg-orange">进行中</span>' + } + }, minWidth: 120,align:'center'}, + {field: 'address', title: '地址', minWidth: 180,align:'center'}, + {field: 'createdTime', title: '操作时间', minWidth: 180,align:'center'}, + {title: '操作', + templet: function (d) { + if (d.state === 3 && d.type == 2) { + return '<button class="layui-btn layui-btn-normal layui-btn-xs layui-btn-success" lay-event="agree" shiro:hasPermission="withdraw:info">同意</button>' + +'<button class="layui-btn layui-btn-normal layui-btn-xs layui-btn-fail" lay-event="disagree" shiro:hasPermission="withdraw:info">拒绝</button>' + }else{ + return '' + } + },minWidth: 200,align:'center'} + ]] + }); + } + + }) +</script> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/chat/mallSystemPay.html b/src/main/resources/templates/febs/views/modules/chat/mallSystemPay.html new file mode 100644 index 0000000..23dcf5b --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/chat/mallSystemPay.html @@ -0,0 +1,90 @@ +<style> + #chat-systemPay-update { + padding: 20px 25px 25px 0; + } + + #chat-systemPay-update .layui-treeSelect .ztree li a, .ztree li span { + margin: 0 0 2px 3px !important; + } + #chat-systemPay-update #data-permission-tree-block { + border: 1px solid #eee; + border-radius: 2px; + padding: 3px 0; + } + #chat-systemPay-update .layui-treeSelect .ztree li span.button.switch { + top: 1px; + left: 3px; + } + #chat-systemPay-update img{ + max-width:100px + } + +</style> +<div class="layui-fluid" id="chat-systemPay-update"> + <form class="layui-form" action="" lay-filter="chat-systemPay-update-form"> + <div class="layui-form-item febs-hide"> + <label class="layui-form-label febs-form-item-require">id:</label> + <div class="layui-input-block"> + <input type="text" name="id"> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label febs-form-item-require">当前余额:</label> + <div class="layui-input-block"> + <input type="number" name="balance" lay-verify="required" autocomplete="off" class="layui-input" readonly> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label febs-form-item-require">拨付数目:</label> + <div class="layui-input-block"> + <input type="number" name="addBalance" lay-verify="required" autocomplete="off" class="layui-input"> + <div class="layui-word-aux">输入负数即减少数量</div> + </div> + </div> + <div class="layui-form-item febs-hide"> + <button class="layui-btn" lay-submit="" lay-filter="chat-systemPay-update-form-submit" id="submit"></button> + </div> + </form> +</div> + +<script data-th-inline="javascript"> + layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree', 'laydate'], function () { + var $ = layui.$, + febs = layui.febs, + layer = layui.layer, + formSelects = layui.formSelects, + treeSelect = layui.treeSelect, + form = layui.form, + laydate = layui.laydate, + eleTree = layui.eleTree, + systemPay = [[${systemPay}]], + $view = $('#chat-systemPay-update'), + validate = layui.validate; + + form.render(); + laydate.render({ + elem: '#febs-form-group-date' + }); + + formSelects.render(); + + + initUserValue(); + + function initUserValue() { + form.val("chat-systemPay-update-form", { + "id": systemPay.id, + "balance": systemPay.balance + }); + } + + form.on('submit(chat-systemPay-update-form-submit)', function (data) { + febs.post(ctx + 'admin/chat/updateSystemPay', data.field, function () { + layer.closeAll(); + febs.alert.success('操作成功'); + $('#febs-chat-user-list').find('#query').click(); + }); + return false; + }); + }); +</script> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/chat/userList.html b/src/main/resources/templates/febs/views/modules/chat/userList.html new file mode 100644 index 0000000..8f7e381 --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/chat/userList.html @@ -0,0 +1,205 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-chat-user-list" lay-title="用户列表"> + <div class="layui-row febs-container"> + <div class="layui-col-md12"> + <div class="layui-card"> + <div class="layui-card-body febs-table-full"> + <form class="layui-form layui-table-form" lay-filter="user-table-form"> + <div class="layui-row"> + <div class="layui-col-md10"> + <div class="layui-form-item"> + <div class="layui-inline"> + <label class="layui-form-label">昵称:</label> + <div class="layui-input-inline"> + <input type="text" placeholder="昵称" name="nickName" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-inline"> + <label class="layui-form-label">微聊号:</label> + <div class="layui-input-inline"> + <input type="text" placeholder="微聊号" name="chatNo" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-inline"> + <label class="layui-form-label">账号状态:</label> + <div class="layui-input-inline"> + <select name="status"> + <option value="">请选择</option> + <option value="Y">正常</option> + <option value="N">禁用</option> + </select> + </div> + </div> + </div> + </div> + <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> + <i class="layui-icon"></i> + </div> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> + <i class="layui-icon"></i> + </div> + </div> + </div> + </form> + <table lay-filter="userChatTable" lay-data="{id: 'userChatTable'}"></table> + </div> + </div> + </div> + </div> +</div> +<!-- 表格操作栏 start --> +<script type="text/html" id="user-option"> + <span shiro:lacksPermission="user:view,user:update,user:delete"> + <span class="layui-badge-dot febs-bg-orange"></span> 无权限 + </span> + <a lay-event="edit" shiro:hasPermission="user:update"><i + class="layui-icon febs-edit-area febs-blue"></i></a> +</script> +<script type="text/html" id="switchStatus"> + {{# if(d.status === 'Y') { }} + <input type="checkbox" value={{d.userId}} lay-text="正常|禁用" checked lay-skin="switch" lay-filter="switchStatus"> + {{# } else { }} + <input type="checkbox" value={{d.userId}} lay-text="正常|禁用" lay-skin="switch" lay-filter="switchStatus"> + {{# } }} +</script> +<style> + .layui-form-onswitch { + background-color: #5FB878 !important; + } +</style> +<script type="text/html" id="toolbar"> + <div class="layui-btn-container"> +<!-- <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="registMember">添加会员</button>--> + <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="balance">拨付余额</button> + </div> +</script> +<!-- 表格操作栏 end --> +<script data-th-inline="none" type="text/javascript"> + // 引入组件并初始化 + layui.use([ 'jquery', 'form', 'table', 'febs'], function () { + var $ = layui.jquery, + febs = layui.febs, + form = layui.form, + table = layui.table, + $view = $('#febs-chat-user-list'), + $query = $view.find('#query'), + $reset = $view.find('#reset'), + $searchForm = $view.find('form'), + sortObject = {field: 'phone', type: null}, + tableIns; + + form.render(); + + // 表格初始化 + initTable(); + + // 查询按钮 + $query.on('click', function () { + var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); + tableIns.reload({where: params, page: {curr: 1}}); + }); + + // 刷新按钮 + $reset.on('click', function () { + $searchForm[0].reset(); + sortObject.type = 'null'; + tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); + }); + + // 获取查询参数 + function getQueryParams() { + return { + nickName: $searchForm.find('input[name="nickName"]').val().trim(), + chatNo: $searchForm.find('input[name="chatNo"]').val().trim(), + status: $searchForm.find("select[name='status']").val() + }; + } + + function initTable() { + tableIns = febs.table.init({ + elem: $view.find('table'), + id: 'userChatTable', + url: ctx + 'admin/chat/getUserList', + toolbar:"#toolbar", + defaultToolbar:[], + totalRow: true ,// 开启合计行 + cols: [[ + {type: 'checkbox'}, + {field: 'userId', title: '标识', minWidth: 150,align:'left', totalRowText: '合计:',align:'center'}, + {field: 'nickName', title: '昵称', minWidth: 100,align:'left',align:'center'}, + {field: 'chatNo', title: '微聊号', minWidth: 150,align:'left',align:'center'}, + {field: 'totalAmount', title: '账户总额', minWidth: 80,align:'left',totalRow: '{{= parseInt(d.totalAmount) }}',align:'center'}, + {field: 'avaAmount', title: '账户余额', minWidth: 80,align:'left',totalRow: '{{= parseInt(d.avaAmount) }}',align:'center'}, + {field: 'status', title: '账号状态', templet: '#switchStatus', minWidth: 80,align:'center'}, + {field: 'createTime', title: '注册时间', minWidth: 180,align:'center'}, + ]] + }); + } + + table.on('toolbar(userChatTable)', function(obj){ + var data = obj.data, + layEvent = obj.event; + + // if (layEvent === 'registMember') { + // febs.modal.open( '添加会员', 'modules/mallMember/addMember', { + // btn: ['提交', '取消'], + // yes: function (index, layero) { + // $('#member-add').find('#submit').trigger('click'); + // }, + // btn2: function () { + // layer.closeAll(); + // } + // }); + // + // return; + // } + + var checkData = table.checkStatus('userChatTable').data; + if (checkData.length <= 0) { + febs.alert.warn('请选择需要的用户'); + return; + } + + if (layEvent === 'balance') { + if (checkData.length > 1) { + febs.alert.warn('请选择一个用户'); + return; + } + systemPay("修改余额", checkData[0].userId, 1); + } + }); + + function systemPay(text, userId, type) { + febs.modal.open(text, 'modules/chat/mallSystemPay/'+ userId, { + btn: ['提交', '取消'], + yes: function (index, layero) { + $('#chat-systemPay-update').find('#submit').trigger('click'); + }, + btn2: function () { + layer.closeAll(); + } + }); + } + + form.on('switch(switchStatus)', function (data) { + if (data.elem.checked) { + openAccount(data.value); + } else { + closeAccount(data.value); + } + }) + function openAccount(userId) { + febs.get(ctx + 'admin/chat/openAccount/' + userId, null, function () { + febs.alert.success('操作成功'); + $query.click(); + }); + } + function closeAccount(userId) { + febs.get(ctx + 'admin/chat/closeAccount/' + userId, null, function () { + febs.alert.success('操作成功'); + $query.click(); + }); + } + + }) +</script> \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index ce16f3d..3f695cd 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -3,7 +3,7 @@ xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <head> <meta charset="utf-8"> - <title>国致优品商城 权限系统</title> + <title>IM 权限系统</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> diff --git a/src/test/java/cc/mrbird/febs/ProfitTest.java b/src/test/java/cc/mrbird/febs/ProfitTest.java index 09bb277..4b8e7e2 100644 --- a/src/test/java/cc/mrbird/febs/ProfitTest.java +++ b/src/test/java/cc/mrbird/febs/ProfitTest.java @@ -1,28 +1,9 @@ package cc.mrbird.febs; -import cc.mrbird.febs.common.entity.FebsResponse; -import cc.mrbird.febs.common.utils.MallUtils; -import cc.mrbird.febs.mall.entity.MallOrderItem; -import cc.mrbird.febs.mall.mapper.MallOrderInfoMapper; -import cc.mrbird.febs.mall.mapper.MallOrderItemMapper; -import cc.mrbird.febs.mall.quartz.OrderSettlementJob; import cc.mrbird.febs.mall.service.IAgentService; -import cc.mrbird.febs.mall.service.IMallAchieveService; -import cc.mrbird.febs.mall.service.IMemberProfitService; -import cc.mrbird.febs.pay.model.*; -import cc.mrbird.febs.pay.service.UnipayService; -import cc.mrbird.febs.rabbit.consumer.AgentConsumer; -import cn.hutool.core.date.DateUtil; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; - -import java.math.BigDecimal; -import java.text.DecimalFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; /** * @author wzy -- Gitblit v1.9.1