init
This commit is contained in:
@@ -91,16 +91,6 @@ redisson:
|
|||||||
# 发布和订阅连接池大小
|
# 发布和订阅连接池大小
|
||||||
subscriptionConnectionPoolSize: 50
|
subscriptionConnectionPoolSize: 50
|
||||||
|
|
||||||
--- # mail 邮件发送
|
|
||||||
mail:
|
|
||||||
enabled: false
|
|
||||||
agora:
|
|
||||||
app-id: 13e7c8066b9a4b2488eeffd66a9ab29c
|
|
||||||
key: 9087bf18d142410ea113b60e8fbed8c9
|
|
||||||
secret: f8c048e0b2f247409b42395efb846cba·
|
|
||||||
yunxin:
|
|
||||||
app-key: 748496374b04344194c68b53e411e09c
|
|
||||||
app-secret: 77c09917d2de
|
|
||||||
knife4j:
|
knife4j:
|
||||||
enable: true
|
enable: true
|
||||||
insight:
|
insight:
|
||||||
|
|||||||
@@ -90,12 +90,3 @@ redisson:
|
|||||||
timeout: 3000
|
timeout: 3000
|
||||||
# 发布和订阅连接池大小
|
# 发布和订阅连接池大小
|
||||||
subscriptionConnectionPoolSize: 50
|
subscriptionConnectionPoolSize: 50
|
||||||
mail:
|
|
||||||
enabled: false
|
|
||||||
agora:
|
|
||||||
app-id: 13e7c8066b9a4b2488eeffd66a9ab29c
|
|
||||||
key: 9087bf18d142410ea113b60e8fbed8c9
|
|
||||||
secret: f8c048e0b2f247409b42395efb846cba·
|
|
||||||
yunxin:
|
|
||||||
app-key: 748496374b04344194c68b53e411e09c
|
|
||||||
app-secret: 77c09917d2de
|
|
||||||
|
|||||||
@@ -255,3 +255,13 @@ management:
|
|||||||
# show-details: ALWAYS
|
# show-details: ALWAYS
|
||||||
# logfile:
|
# logfile:
|
||||||
# external-file: ./logs/sys-console.log
|
# external-file: ./logs/sys-console.log
|
||||||
|
--- # mail 邮件发送
|
||||||
|
mail:
|
||||||
|
enabled: false
|
||||||
|
agora:
|
||||||
|
app-id: 13e7c8066b9a4b2488eeffd66a9ab29c
|
||||||
|
key: 9087bf18d142410ea113b60e8fbed8c9
|
||||||
|
secret: f8c048e0b2f247409b42395efb846cba·
|
||||||
|
yunxin:
|
||||||
|
app-key: 748496374b04344194c68b53e411e09c123
|
||||||
|
app-secret: 77c09917d2de
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import com.ruoyi.common.core.validate.AddGroup;
|
|||||||
import com.ruoyi.common.core.validate.EditGroup;
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.xq.domain.SysPush;
|
import com.ruoyi.xq.domain.SysPush;
|
||||||
|
import com.ruoyi.xq.dto.admin.syspush.SysPushParams;
|
||||||
|
import com.ruoyi.xq.dto.app.common.IdReq;
|
||||||
import com.ruoyi.xq.service.SysPushService;
|
import com.ruoyi.xq.service.SysPushService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -42,7 +44,7 @@ public class SysPushController extends BaseController {
|
|||||||
@SaCheckPermission("xq:sysPush:list")
|
@SaCheckPermission("xq:sysPush:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<SysPush> list(SysPush bo, PageQuery pageQuery) {
|
public TableDataInfo<SysPush> list(SysPush bo, PageQuery pageQuery) {
|
||||||
Page<SysPush> page = sysPushService.page(pageQuery.build(), Wrappers.lambdaQuery(bo));
|
Page<SysPush> page = sysPushService.page(pageQuery.build(), Wrappers.lambdaQuery(bo).orderByDesc(SysPush::getCreateTime));
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,26 +60,31 @@ public class SysPushController extends BaseController {
|
|||||||
return R.ok(sysPushService.getById(id));
|
return R.ok(sysPushService.getById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@SaCheckPermission("xq:sysPush:run")
|
||||||
* 新增推送系统消息
|
@Log(title = "推送系统消息执行", businessType = BusinessType.INSERT)
|
||||||
*/
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/run")
|
||||||
|
public R<Void> run(@RequestBody IdReq idRes) {
|
||||||
|
sysPushService.handStart(idRes.getId());
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SaCheckPermission("xq:sysPush:close")
|
||||||
|
@Log(title = "取消定时系统消息执行", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/close")
|
||||||
|
public R<Void> close(@RequestBody IdReq idRes) {
|
||||||
|
sysPushService.closeSysPush(idRes.getId());
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
@SaCheckPermission("xq:sysPush:add")
|
@SaCheckPermission("xq:sysPush:add")
|
||||||
@Log(title = "推送系统消息", businessType = BusinessType.INSERT)
|
@Log(title = "推送系统消息", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysPush bo) {
|
public R<Void> add(@RequestBody SysPushParams params) {
|
||||||
return toAjax(sysPushService.save(bo));
|
sysPushService.saveSysPush(params);
|
||||||
}
|
return R.ok();
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改推送系统消息
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("xq:sysPush:edit")
|
|
||||||
@Log(title = "推送系统消息", businessType = BusinessType.UPDATE)
|
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping()
|
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysPush bo) {
|
|
||||||
return toAjax(sysPushService.updateById(bo));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.ruoyi.common.enums.BusinessType;
|
|||||||
import com.ruoyi.xq.domain.UserExtend;
|
import com.ruoyi.xq.domain.UserExtend;
|
||||||
import com.ruoyi.xq.dto.admin.user.UserExtendAdminVo;
|
import com.ruoyi.xq.dto.admin.user.UserExtendAdminVo;
|
||||||
import com.ruoyi.xq.dto.admin.user.req.UpdateIncomeCoinReq;
|
import com.ruoyi.xq.dto.admin.user.req.UpdateIncomeCoinReq;
|
||||||
|
import com.ruoyi.xq.dto.admin.user.req.UpdateWxTransNumReq;
|
||||||
import com.ruoyi.xq.service.UserExtendService;
|
import com.ruoyi.xq.service.UserExtendService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -69,4 +70,13 @@ public class UserExtendController extends BaseController {
|
|||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SaCheckPermission("xq:userExtend:edit")
|
||||||
|
@Log(title = "调整用户微信次数", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/updateWxTransNum")
|
||||||
|
public R<Void> updateWxTransNum(@RequestBody UpdateWxTransNumReq bo) {
|
||||||
|
userExtendService.updateWxTransNum(bo);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.ruoyi.common.core.validate.AddGroup;
|
|||||||
import com.ruoyi.common.core.validate.EditGroup;
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.xq.domain.WxTransOrder;
|
import com.ruoyi.xq.domain.WxTransOrder;
|
||||||
|
import com.ruoyi.xq.dto.admin.wxtrans.WxTransOrderAdminVo;
|
||||||
import com.ruoyi.xq.service.WxTransOrderService;
|
import com.ruoyi.xq.service.WxTransOrderService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -41,8 +42,8 @@ public class WxTransOrderController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("xq:wxTransOrder:list")
|
@SaCheckPermission("xq:wxTransOrder:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<WxTransOrder> list(WxTransOrder bo, PageQuery pageQuery) {
|
public TableDataInfo<WxTransOrderAdminVo> list(WxTransOrderAdminVo bo, PageQuery pageQuery) {
|
||||||
Page<WxTransOrder> page = wxTransOrderService.page(pageQuery.build(), Wrappers.lambdaQuery(bo));
|
Page<WxTransOrderAdminVo> page = wxTransOrderService.pageAdmin(pageQuery, bo);
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.ruoyi.xq.dto.admin.syspush;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysPushImageContextDTO {
|
||||||
|
private String title;
|
||||||
|
private String image;
|
||||||
|
private Integer linkType;
|
||||||
|
private String linkUrl;
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.ruoyi.xq.dto.admin.syspush;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ruoyi.common.constant.DateConstant;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysPushMasterDTO {
|
||||||
|
private Integer groupId;
|
||||||
|
private String usercode;
|
||||||
|
private String onlyText;
|
||||||
|
|
||||||
|
private String textText1;
|
||||||
|
private String textText2;
|
||||||
|
private Integer textLinkType;
|
||||||
|
private String textLinkUrl;
|
||||||
|
|
||||||
|
private Integer oneImageTitleType;
|
||||||
|
private String oneImageImage;
|
||||||
|
private String oneImageText;
|
||||||
|
private Integer oneImageLinkType;
|
||||||
|
private String oneImageLinkUrl;
|
||||||
|
|
||||||
|
private String onlyImage;
|
||||||
|
|
||||||
|
private Integer sendTimeType;
|
||||||
|
@DateTimeFormat(pattern = DateConstant.PATTERN_DATETIME)
|
||||||
|
@JsonFormat(pattern = DateConstant.PATTERN_DATETIME)
|
||||||
|
private LocalDateTime sendTime;
|
||||||
|
private String title;
|
||||||
|
private Integer type;
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.ruoyi.xq.dto.admin.syspush;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysPushParams {
|
||||||
|
private SysPushMasterDTO master;
|
||||||
|
private List<SysPushTextContextDTO> textContext;
|
||||||
|
private List<SysPushImageContextDTO> imageContext;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.ruoyi.xq.dto.admin.syspush;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysPushTextContextDTO {
|
||||||
|
private String n;
|
||||||
|
private String v;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.ruoyi.xq.dto.admin.user.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UpdateWxTransNumReq {
|
||||||
|
private String usercode;
|
||||||
|
private String remark;
|
||||||
|
private Integer number;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.ruoyi.xq.dto.admin.wxtrans;
|
||||||
|
|
||||||
|
import com.ruoyi.xq.domain.WxTransOrder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WxTransOrderAdminVo extends WxTransOrder {
|
||||||
|
private String nickname;
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
private String avatar;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.ruoyi.xq.dto.common.syspush;
|
||||||
|
|
||||||
|
import com.ruoyi.yunxin.resp.YxCommonR;
|
||||||
|
import com.ruoyi.yunxin.resp.YxDataR;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SendSysPushResp {
|
||||||
|
|
||||||
|
private YxDataR<YxCommonR> imResp;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.xq.dto.common.user;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MinUserDTO {
|
||||||
|
private Long userId;
|
||||||
|
private String usercode;
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
public MinUserDTO(Long userId, String usercode, String nickname) {
|
||||||
|
this.userId = userId;
|
||||||
|
this.usercode = usercode;
|
||||||
|
this.nickname = nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MinUserDTO() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import lombok.Getter;
|
|||||||
public enum OrderTypeEnum {
|
public enum OrderTypeEnum {
|
||||||
VIP("V"),
|
VIP("V"),
|
||||||
WITHDRAW("W"),
|
WITHDRAW("W"),
|
||||||
|
WX_TRANS("X"),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String type;
|
private final String type;
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi.xq.enums.pay;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum PlatformTypeEnum {
|
||||||
|
ALI("ALI"),
|
||||||
|
WX("WX"),
|
||||||
|
ADMIN("ADMIN"),
|
||||||
|
SYS("SYS"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
|
||||||
|
PlatformTypeEnum(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.ruoyi.xq.enums.syspush;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum SystemPushGroupIdEnum {
|
||||||
|
// 群体类型: 0=单个用户,1=全部用户,2=男用户,3=女用户, 4 =认证女神
|
||||||
|
ONE_USER(0,"单个用户"),
|
||||||
|
ALL_USER(1,"全部用户"),
|
||||||
|
MEN_USER(2,"男用户"),
|
||||||
|
WOMEN_USER(3,"女用户"),
|
||||||
|
ANCHOR_USER(4,"认证女神"),
|
||||||
|
;
|
||||||
|
private final Integer code;
|
||||||
|
private final String text;
|
||||||
|
|
||||||
|
SystemPushGroupIdEnum(Integer code, String text) {
|
||||||
|
this.code = code;
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SystemPushGroupIdEnum getByCode(Integer groupId) {
|
||||||
|
SystemPushGroupIdEnum[] values = SystemPushGroupIdEnum.values();
|
||||||
|
for (SystemPushGroupIdEnum value : values) {
|
||||||
|
if(value.getCode().equals(groupId)){
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.xq.enums.syspush;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
// 推送状态:0=未推送,1=推送中,2=推送失败,3=推送成功
|
||||||
|
@Getter
|
||||||
|
public enum SystemPushLogStatusEnum {
|
||||||
|
NO_SEND(0,"未推送"),
|
||||||
|
SENDING(1,"推送中"),
|
||||||
|
SEND_FAIL(2,"推送失败"),
|
||||||
|
SEND_SUCCESS(3,"推送成功"),
|
||||||
|
;
|
||||||
|
private final Integer code;
|
||||||
|
private final String text;
|
||||||
|
|
||||||
|
SystemPushLogStatusEnum(Integer code, String text) {
|
||||||
|
this.code = code;
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.xq.enums.syspush;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum SystemPushSendTimeTypeEnum {
|
||||||
|
// 发送类型:0=手动发送,1=定时发送
|
||||||
|
HAND_SEND(0,"手动发送"),
|
||||||
|
SCHEDULED_SEND(1,"定时发送"),
|
||||||
|
|
||||||
|
;
|
||||||
|
private final Integer code;
|
||||||
|
private final String text;
|
||||||
|
|
||||||
|
SystemPushSendTimeTypeEnum(Integer code, String text) {
|
||||||
|
this.code = code;
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SystemPushSendTimeTypeEnum getByCode(Integer sendTimeType) {
|
||||||
|
SystemPushSendTimeTypeEnum[] values = SystemPushSendTimeTypeEnum.values();
|
||||||
|
for (SystemPushSendTimeTypeEnum value : values) {
|
||||||
|
if(value.getCode().equals(sendTimeType)){
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.ruoyi.xq.enums.syspush;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum SystemPushStatusEnum {
|
||||||
|
// 状态:0=未执行,1=执行中,2=队列执行中,3=已完成
|
||||||
|
NO_RUN(0,"未执行"),
|
||||||
|
RUNNING(1,"执行中"),
|
||||||
|
QUEUE_RUNNING(2,"队列执行中"),
|
||||||
|
COMPLETE(3,"已完成"),
|
||||||
|
CLOSE(4,"已取消"),
|
||||||
|
FAIL(10,"执行失败"),
|
||||||
|
;
|
||||||
|
private final Integer code;
|
||||||
|
private final String text;
|
||||||
|
|
||||||
|
SystemPushStatusEnum(Integer code, String text) {
|
||||||
|
this.code = code;
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.ruoyi.xq.enums.syspush;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum SystemPushTypeEnum {
|
||||||
|
// 消息类型:0=纯文字消息,1=文本消息,2=单图文消息,3=多图文消息
|
||||||
|
SIMPLE_TEXT(0,"纯文字消息"),
|
||||||
|
TEXT(1,"文本消息"),
|
||||||
|
SIMPLE_IMAGE_TEXT(2,"单图文消息"),
|
||||||
|
IMAGE_TEXT(3,"多图文消息"),
|
||||||
|
ONLY_IMAGE(4,"纯图文消息"),
|
||||||
|
;
|
||||||
|
private final Integer code;
|
||||||
|
private final String text;
|
||||||
|
|
||||||
|
SystemPushTypeEnum(Integer code, String text) {
|
||||||
|
this.code = code;
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SystemPushTypeEnum getByCode(Integer type) {
|
||||||
|
SystemPushTypeEnum[] values = SystemPushTypeEnum.values();
|
||||||
|
for (SystemPushTypeEnum value : values) {
|
||||||
|
if(value.getCode().equals(type)){
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,8 +20,11 @@ public interface UserExtendMapper extends BaseMapper<UserExtend> {
|
|||||||
|
|
||||||
boolean incrIncome(@Param("userId") Long userId, @Param("price") BigDecimal price);
|
boolean incrIncome(@Param("userId") Long userId, @Param("price") BigDecimal price);
|
||||||
|
|
||||||
|
boolean incrWxTransNum(@Param("userId") Long userId, @Param("wxTransNum") Integer wxTransNum);
|
||||||
|
|
||||||
Page<UserExtendAdminVo> pageAdmin(@Param("build") Page<Object> build, @Param("bo") UserExtendAdminVo bo);
|
Page<UserExtendAdminVo> pageAdmin(@Param("build") Page<Object> build, @Param("bo") UserExtendAdminVo bo);
|
||||||
|
|
||||||
boolean incsWithdrawCount(@Param("userId") Long userId, @Param("withdrawMonty") BigDecimal withdrawMonty);
|
boolean incsWithdrawCount(@Param("userId") Long userId, @Param("withdrawMonty") BigDecimal withdrawMonty);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.ruoyi.xq.mapper;
|
package com.ruoyi.xq.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.xq.domain.WxTransOrder;
|
import com.ruoyi.xq.domain.WxTransOrder;
|
||||||
|
import com.ruoyi.xq.dto.admin.wxtrans.WxTransOrderAdminVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信交换订单Mapper接口
|
* 微信交换订单Mapper接口
|
||||||
@@ -11,4 +14,5 @@ import com.ruoyi.xq.domain.WxTransOrder;
|
|||||||
*/
|
*/
|
||||||
public interface WxTransOrderMapper extends BaseMapper<WxTransOrder> {
|
public interface WxTransOrderMapper extends BaseMapper<WxTransOrder> {
|
||||||
|
|
||||||
|
Page<WxTransOrderAdminVo> pageAdmin(@Param("build") Page<Object> build, @Param("bo") WxTransOrderAdminVo bo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.ruoyi.xq.notice.data;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ExtNoticeData {
|
||||||
|
private Integer action = 1;
|
||||||
|
private String title = "";
|
||||||
|
private String date;
|
||||||
|
private String txt1 = "";
|
||||||
|
private List<MessageExtDataList> fields = new ArrayList<>();
|
||||||
|
private String txt2 = "";
|
||||||
|
private Integer link_type = 0;
|
||||||
|
private String link_url = "";
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class MessageExtDataList {
|
||||||
|
private String n;
|
||||||
|
private String v;
|
||||||
|
|
||||||
|
public MessageExtDataList(String n, String v) {
|
||||||
|
this.n = n;
|
||||||
|
this.v = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageExtDataList() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentDate(){
|
||||||
|
this.date = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addFields(String n,String v){
|
||||||
|
fields.add(new MessageExtDataList(n,v));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.ruoyi.xq.notice.data;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MultipleImageTextData {
|
||||||
|
private List<MultipleImageTextNode> list;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.ruoyi.xq.notice.data;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MultipleImageTextNode {
|
||||||
|
private String image;
|
||||||
|
private String title;
|
||||||
|
private Integer link_type;
|
||||||
|
private String link_url;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.xq.notice.data;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class NoticeMsgR {
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
public static NoticeMsgR ok(String msg){
|
||||||
|
NoticeMsgR r = new NoticeMsgR();
|
||||||
|
r.setMsg(msg);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.ruoyi.xq.notice.data;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class NoticeOnlyImageR {
|
||||||
|
private String url;
|
||||||
|
}
|
||||||
29
ruoyi-xq/src/main/java/com/ruoyi/xq/notice/data/NoticeR.java
Normal file
29
ruoyi-xq/src/main/java/com/ruoyi/xq/notice/data/NoticeR.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.xq.notice.data;
|
||||||
|
|
||||||
|
import com.ruoyi.xq.notice.enums.MessageBaseTypeEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class NoticeR<T> implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public static <T> NoticeR<T> ok(MessageBaseTypeEnum typeEnum, T data) {
|
||||||
|
return restResult(typeEnum.getCode(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static <T> NoticeR<T> restResult(Integer type, T data) {
|
||||||
|
NoticeR<T> r = new NoticeR<>();
|
||||||
|
r.setType(type);
|
||||||
|
r.setData(data);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.ruoyi.xq.notice.data;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单图文消息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SimpleImageTextData {
|
||||||
|
private Integer act_type;
|
||||||
|
private String act_string;
|
||||||
|
private String title;
|
||||||
|
private String txt;
|
||||||
|
private String image;
|
||||||
|
private Integer link_type;
|
||||||
|
private String link_url;
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.ruoyi.xq.notice.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum MessageBaseTypeEnum {
|
||||||
|
/**
|
||||||
|
* 发送文本消息
|
||||||
|
* 使用地方:
|
||||||
|
* 付费图片分成、系统奖励、注册奖励云贝、充值云贝发消息、收到礼物发送消息
|
||||||
|
* 提现审核失败、提现审核成功、邀请奖励、举报发送消息、未通过女神认证发送消息
|
||||||
|
* 通过女神认证发送消息、更改女神邀请比例、收到守护符通知、收到一级vip充值奖励通知
|
||||||
|
* 收到男用户购买微信/QQ分成通知、后台视频审核被拒绝的时候,发一个被拒绝的系统通知
|
||||||
|
* 用户充值,邀请人返现, 群打招呼审核失败
|
||||||
|
*/
|
||||||
|
TXT(11,"文本消息"),
|
||||||
|
SIMPLE_IMAGE_TEXT(12,"单图文消息"),
|
||||||
|
MULTIPLE_IMAGE_TEXT(13,"创建多图片消息"),
|
||||||
|
SEND_GIFT_MESSAGE(14,"发送礼物自定义消息"),
|
||||||
|
IM_VIDEO_MESSAGE(15,"通话通知"),
|
||||||
|
SEND_FOLLOW(16,"自定义被关注消息"),
|
||||||
|
SEND_FOLLOW_DYNAMIC(17,"关注动态"),
|
||||||
|
SEND_ONLINE_ATTENTION(18,"上线了通知"),
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
RECHARGE_WINDOWS_AMOUNT(12,"发送充值飘窗提醒"),
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
SEND_GIFT_WINDOWS_AMOUNT(13,"礼物飘窗"),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
private final Integer code;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
MessageBaseTypeEnum(Integer code, String name) {
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,10 @@ package com.ruoyi.xq.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.xq.domain.SysPush;
|
import com.ruoyi.xq.domain.SysPush;
|
||||||
|
import com.ruoyi.xq.dto.admin.syspush.SysPushParams;
|
||||||
|
import com.ruoyi.xq.dto.common.syspush.SendSysPushResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送系统消息Service接口
|
* 推送系统消息Service接口
|
||||||
@@ -11,4 +15,15 @@ import com.ruoyi.xq.domain.SysPush;
|
|||||||
*/
|
*/
|
||||||
public interface SysPushService extends IService<SysPush> {
|
public interface SysPushService extends IService<SysPush> {
|
||||||
|
|
||||||
|
void handStart(Long id);
|
||||||
|
|
||||||
|
void fastStart(Long id);
|
||||||
|
|
||||||
|
void doRun(Long id);
|
||||||
|
|
||||||
|
SendSysPushResp sendSysPush(SysPush sysPush, List<Long> userIds);
|
||||||
|
|
||||||
|
void closeSysPush(Long id);
|
||||||
|
|
||||||
|
void saveSysPush(SysPushParams params);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import com.ruoyi.common.core.domain.PageQuery;
|
|||||||
import com.ruoyi.xq.domain.UserExtend;
|
import com.ruoyi.xq.domain.UserExtend;
|
||||||
import com.ruoyi.xq.dto.admin.user.UserExtendAdminVo;
|
import com.ruoyi.xq.dto.admin.user.UserExtendAdminVo;
|
||||||
import com.ruoyi.xq.dto.admin.user.req.UpdateIncomeCoinReq;
|
import com.ruoyi.xq.dto.admin.user.req.UpdateIncomeCoinReq;
|
||||||
|
import com.ruoyi.xq.dto.admin.user.req.UpdateWxTransNumReq;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@@ -26,5 +28,5 @@ public interface UserExtendService extends IService<UserExtend> {
|
|||||||
|
|
||||||
void updateIncomeCoin(UpdateIncomeCoinReq bo);
|
void updateIncomeCoin(UpdateIncomeCoinReq bo);
|
||||||
|
|
||||||
|
void updateWxTransNum(UpdateWxTransNumReq bo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.ruoyi.xq.service;
|
package com.ruoyi.xq.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.xq.domain.WxTransOrder;
|
import com.ruoyi.xq.domain.WxTransOrder;
|
||||||
|
import com.ruoyi.xq.dto.admin.wxtrans.WxTransOrderAdminVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信交换订单Service接口
|
* 微信交换订单Service接口
|
||||||
@@ -12,4 +15,6 @@ import com.ruoyi.xq.domain.WxTransOrder;
|
|||||||
public interface WxTransOrderService extends IService<WxTransOrder> {
|
public interface WxTransOrderService extends IService<WxTransOrder> {
|
||||||
|
|
||||||
WxTransOrder createVipOrder(Long userId, Integer wxTransNum);
|
WxTransOrder createVipOrder(Long userId, Integer wxTransNum);
|
||||||
|
|
||||||
|
Page<WxTransOrderAdminVo> pageAdmin(PageQuery pageQuery, WxTransOrderAdminVo bo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,42 @@
|
|||||||
package com.ruoyi.xq.service.impl;
|
package com.ruoyi.xq.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.TypeReference;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.common.utils.BeanConvertUtil;
|
||||||
import com.ruoyi.xq.domain.SysPush;
|
import com.ruoyi.xq.domain.SysPush;
|
||||||
|
import com.ruoyi.xq.domain.SysPushLog;
|
||||||
|
import com.ruoyi.xq.domain.User;
|
||||||
|
import com.ruoyi.xq.dto.admin.syspush.SysPushImageContextDTO;
|
||||||
|
import com.ruoyi.xq.dto.admin.syspush.SysPushMasterDTO;
|
||||||
|
import com.ruoyi.xq.dto.admin.syspush.SysPushParams;
|
||||||
|
import com.ruoyi.xq.dto.common.syspush.SendSysPushResp;
|
||||||
|
import com.ruoyi.xq.dto.common.user.MinUserDTO;
|
||||||
|
import com.ruoyi.xq.enums.syspush.*;
|
||||||
|
import com.ruoyi.xq.enums.userinfo.UserGenderEnum;
|
||||||
import com.ruoyi.xq.mapper.SysPushMapper;
|
import com.ruoyi.xq.mapper.SysPushMapper;
|
||||||
|
import com.ruoyi.xq.notice.data.*;
|
||||||
|
import com.ruoyi.xq.notice.enums.MessageBaseTypeEnum;
|
||||||
|
import com.ruoyi.xq.service.SysPushLogService;
|
||||||
import com.ruoyi.xq.service.SysPushService;
|
import com.ruoyi.xq.service.SysPushService;
|
||||||
|
import com.ruoyi.xq.service.UserService;
|
||||||
|
import com.ruoyi.xq.util.Date77Util;
|
||||||
|
import com.ruoyi.yunxin.Yunxin;
|
||||||
|
import com.ruoyi.yunxin.enums.YxImTypeEnum;
|
||||||
|
import com.ruoyi.yunxin.resp.YxCommonR;
|
||||||
|
import com.ruoyi.yunxin.resp.YxDataR;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送系统消息Service业务层处理
|
* 推送系统消息Service业务层处理
|
||||||
*
|
*
|
||||||
@@ -13,6 +44,309 @@ import org.springframework.stereotype.Service;
|
|||||||
* @date 2024-03-20
|
* @date 2024-03-20
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class SysPushServiceImpl extends ServiceImpl<SysPushMapper,SysPush> implements SysPushService {
|
public class SysPushServiceImpl extends ServiceImpl<SysPushMapper,SysPush> implements SysPushService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
@Autowired
|
||||||
|
private Yunxin yunxin;
|
||||||
|
@Autowired
|
||||||
|
private SysPushLogService sysPushLogService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handStart(Long id) {
|
||||||
|
boolean update = this.update(Wrappers.lambdaUpdate(SysPush.class)
|
||||||
|
.eq(SysPush::getId, id)
|
||||||
|
.eq(SysPush::getStatus, SystemPushStatusEnum.NO_RUN.getCode())
|
||||||
|
.set(SysPush::getStatus, SystemPushStatusEnum.RUNNING.getCode()));
|
||||||
|
if(!update){
|
||||||
|
throw new ServiceException("正在执行中,请稍等");
|
||||||
|
}
|
||||||
|
// SysPushNotifyDTO sysPush = new SysPushNotifyDTO();
|
||||||
|
// sysPush.setSysPushId(id);
|
||||||
|
// amqpProducer.sendCommonMq(sysPush);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fastStart(Long id){
|
||||||
|
boolean update = this.update(Wrappers.lambdaUpdate(SysPush.class)
|
||||||
|
.eq(SysPush::getId, id)
|
||||||
|
.eq(SysPush::getStatus, SystemPushStatusEnum.NO_RUN.getCode())
|
||||||
|
.set(SysPush::getStatus, SystemPushStatusEnum.RUNNING.getCode()));
|
||||||
|
if(!update){
|
||||||
|
throw new ServiceException("正在执行中,请稍等");
|
||||||
|
}
|
||||||
|
this.doRun(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doRun(Long id){
|
||||||
|
SysPush sysPush = this.getById(id);
|
||||||
|
Integer status = sysPush.getStatus();
|
||||||
|
if(SystemPushStatusEnum.COMPLETE.getCode().equals(status)){
|
||||||
|
throw new ServiceException("不允许重复执行");
|
||||||
|
}
|
||||||
|
boolean update = this.update(Wrappers.lambdaUpdate(SysPush.class)
|
||||||
|
.eq(SysPush::getId, sysPush.getId())
|
||||||
|
.eq(SysPush::getStatus, SystemPushStatusEnum.RUNNING.getCode())
|
||||||
|
.set(SysPush::getStatus, SystemPushStatusEnum.COMPLETE.getCode()));
|
||||||
|
if(!update){
|
||||||
|
throw new ServiceException("队列正在执行中");
|
||||||
|
}
|
||||||
|
SystemPushGroupIdEnum groupId = SystemPushGroupIdEnum.getByCode(sysPush.getGroupId());
|
||||||
|
if(groupId == null){
|
||||||
|
this.update(Wrappers.lambdaUpdate(SysPush.class)
|
||||||
|
.eq(SysPush::getId, sysPush.getId())
|
||||||
|
.set(SysPush::getStatus,SystemPushStatusEnum.FAIL.getCode()));
|
||||||
|
log.error("未找到执行的人! sysPush={}",JSON.toJSONString(sysPush));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<MinUserDTO> minUserList = new ArrayList<>();
|
||||||
|
switch (groupId) {
|
||||||
|
case ONE_USER:
|
||||||
|
User user = userService.getById(sysPush.getUserId());
|
||||||
|
if(user != null){
|
||||||
|
minUserList.add(new MinUserDTO(user.getId(),user.getUsercode(),user.getNickname()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MEN_USER:
|
||||||
|
List<User> menUserList = userService.list(Wrappers.lambdaQuery(User.class)
|
||||||
|
.select(User::getId, User::getUsercode, User::getNickname)
|
||||||
|
.eq(User::getGender, UserGenderEnum.MAN.getCode())
|
||||||
|
.eq(User::getStatus, 0));
|
||||||
|
minUserList = menUserList.stream().map(i -> new MinUserDTO(i.getId(), i.getUsercode(), i.getNickname())).collect(Collectors.toList());
|
||||||
|
break;
|
||||||
|
case WOMEN_USER:
|
||||||
|
List<User> womenUserList = userService.list(Wrappers.lambdaQuery(User.class)
|
||||||
|
.select(User::getId, User::getUsercode, User::getNickname)
|
||||||
|
.eq(User::getGender, UserGenderEnum.WOMEN.getCode())
|
||||||
|
.eq(User::getStatus, 0));
|
||||||
|
minUserList = womenUserList.stream().map(i -> new MinUserDTO(i.getId(), i.getUsercode(), i.getNickname())).collect(Collectors.toList());
|
||||||
|
break;
|
||||||
|
case ALL_USER:
|
||||||
|
List<User> allUserList = userService.list(Wrappers.lambdaQuery(User.class)
|
||||||
|
.select(User::getId, User::getUsercode, User::getNickname)
|
||||||
|
.eq(User::getStatus, 0));
|
||||||
|
minUserList = allUserList.stream().map(i -> new MinUserDTO(i.getId(), i.getUsercode(), i.getNickname())).collect(Collectors.toList());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(minUserList.isEmpty()){
|
||||||
|
this.update(Wrappers.lambdaUpdate(SysPush.class)
|
||||||
|
.eq(SysPush::getId, sysPush.getId())
|
||||||
|
.set(SysPush::getStatus,SystemPushStatusEnum.FAIL.getCode()));
|
||||||
|
log.error("未找到发送的人! sysPush={}",JSON.toJSONString(sysPush));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<List<MinUserDTO>> partition = Lists.partition(minUserList, 500);
|
||||||
|
for (List<MinUserDTO> minUsers : partition) {
|
||||||
|
SysPushLog sysPushLog = new SysPushLog();
|
||||||
|
sysPushLog.setSysPushId(sysPush.getId());
|
||||||
|
sysPushLog.setUserJson(JSON.toJSONString(minUsers));
|
||||||
|
sysPushLog.setNum(minUsers.size());
|
||||||
|
try {
|
||||||
|
List<Long> userIds = minUsers.stream().map(MinUserDTO::getUserId).collect(Collectors.toList());
|
||||||
|
SendSysPushResp resp = this.sendSysPush(sysPush, userIds);
|
||||||
|
YxDataR<YxCommonR> imResp = resp.getImResp();
|
||||||
|
if(imResp != null && imResp.isSuccess()){
|
||||||
|
sysPushLog.setStatus(SystemPushLogStatusEnum.SEND_SUCCESS.getCode());
|
||||||
|
}else{
|
||||||
|
sysPushLog.setStatus(SystemPushLogStatusEnum.SEND_FAIL.getCode());
|
||||||
|
}
|
||||||
|
sysPushLog.setResult(JSON.toJSONString(imResp));
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("发送失败!",e);
|
||||||
|
sysPushLog.setStatus(SystemPushLogStatusEnum.SEND_FAIL.getCode());
|
||||||
|
sysPushLog.setResult(e.getMessage());
|
||||||
|
}
|
||||||
|
sysPushLogService.save(sysPushLog);
|
||||||
|
}
|
||||||
|
this.update(Wrappers.lambdaUpdate(SysPush.class)
|
||||||
|
.eq(SysPush::getId, sysPush.getId())
|
||||||
|
.set(SysPush::getStatus,SystemPushStatusEnum.COMPLETE.getCode()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SendSysPushResp sendSysPush(SysPush sysPush, List<Long> userIds){
|
||||||
|
Integer type = sysPush.getType();
|
||||||
|
SystemPushTypeEnum systemPushType = SystemPushTypeEnum.getByCode(type);
|
||||||
|
if(systemPushType == null){
|
||||||
|
throw new ServiceException("消息类型有误!");
|
||||||
|
}
|
||||||
|
String content = sysPush.getContent();
|
||||||
|
Object body;
|
||||||
|
YxImTypeEnum yxImTypeEnum;
|
||||||
|
switch (systemPushType){
|
||||||
|
case SIMPLE_TEXT:
|
||||||
|
body = JSON.parseObject(content, NoticeMsgR.class);
|
||||||
|
yxImTypeEnum = YxImTypeEnum.TXT;
|
||||||
|
break;
|
||||||
|
case TEXT:
|
||||||
|
NoticeR<ExtNoticeData> noticeR = JSON.parseObject(content, new TypeReference<NoticeR<ExtNoticeData>>() {});
|
||||||
|
noticeR.getData().setCurrentDate();
|
||||||
|
body = noticeR;
|
||||||
|
yxImTypeEnum = YxImTypeEnum.CUSTOM;
|
||||||
|
break;
|
||||||
|
case SIMPLE_IMAGE_TEXT:
|
||||||
|
NoticeR<SimpleImageTextData> simpleImageTextR = JSON.parseObject(content, new TypeReference<NoticeR<SimpleImageTextData>>() {});
|
||||||
|
yxImTypeEnum = YxImTypeEnum.CUSTOM;
|
||||||
|
SimpleImageTextData data = simpleImageTextR.getData();
|
||||||
|
if(data.getImage() != null){
|
||||||
|
data.setImage(data.getImage());
|
||||||
|
}
|
||||||
|
body = simpleImageTextR;
|
||||||
|
break;
|
||||||
|
case IMAGE_TEXT:
|
||||||
|
NoticeR<MultipleImageTextData> multipleImageTextR = JSON.parseObject(content, new TypeReference<NoticeR<MultipleImageTextData>>() {});
|
||||||
|
MultipleImageTextData multipleImageTextData = multipleImageTextR.getData();
|
||||||
|
List<MultipleImageTextNode> list = multipleImageTextData.getList();
|
||||||
|
for (MultipleImageTextNode node : list) {
|
||||||
|
if(node.getImage() != null){
|
||||||
|
node.setImage(node.getImage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
body = multipleImageTextR;
|
||||||
|
yxImTypeEnum = YxImTypeEnum.CUSTOM;
|
||||||
|
break;
|
||||||
|
case ONLY_IMAGE:
|
||||||
|
NoticeOnlyImageR imageR = JSON.parseObject(content, NoticeOnlyImageR.class);
|
||||||
|
if(imageR.getUrl() != null){
|
||||||
|
imageR.setUrl(imageR.getUrl());
|
||||||
|
}
|
||||||
|
body = imageR;
|
||||||
|
yxImTypeEnum = YxImTypeEnum.IMAGE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new ServiceException("消息类型有误");
|
||||||
|
}
|
||||||
|
YxDataR<YxCommonR> r = yunxin.batchSendToNotice(userIds, body, null, yxImTypeEnum);
|
||||||
|
SendSysPushResp resp = new SendSysPushResp();
|
||||||
|
resp.setImResp(r);
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeSysPush(Long id) {
|
||||||
|
this.update(Wrappers.lambdaUpdate(SysPush.class)
|
||||||
|
.eq(SysPush::getId,id)
|
||||||
|
.eq(SysPush::getStatus,SystemPushStatusEnum.NO_RUN.getCode())
|
||||||
|
.set(SysPush::getStatus,SystemPushStatusEnum.CLOSE.getCode()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveSysPush(SysPushParams params) {
|
||||||
|
SysPushMasterDTO master = params.getMaster();
|
||||||
|
Integer type = master.getType();
|
||||||
|
SystemPushTypeEnum systemPushType = SystemPushTypeEnum.getByCode(type);
|
||||||
|
if(systemPushType == null){
|
||||||
|
throw new ServiceException("消息类型有误!");
|
||||||
|
}
|
||||||
|
SystemPushGroupIdEnum groupIdEnum = SystemPushGroupIdEnum.getByCode(master.getGroupId());
|
||||||
|
if(groupIdEnum == null){
|
||||||
|
throw new ServiceException("发送类型有误!");
|
||||||
|
}
|
||||||
|
SysPush sysPush = new SysPush();
|
||||||
|
if(groupIdEnum == SystemPushGroupIdEnum.ONE_USER){
|
||||||
|
User user = userService.getByUsercode(master.getUsercode());
|
||||||
|
if(user == null){
|
||||||
|
throw new ServiceException("用户编号不存在!");
|
||||||
|
}
|
||||||
|
sysPush.setUserId(user.getId());
|
||||||
|
sysPush.setUsercode(user.getUsercode());
|
||||||
|
}
|
||||||
|
SystemPushSendTimeTypeEnum systemPushSendTime = SystemPushSendTimeTypeEnum.getByCode(master.getSendTimeType());
|
||||||
|
if(systemPushSendTime == null){
|
||||||
|
throw new ServiceException("发送方式有误!");
|
||||||
|
}
|
||||||
|
sysPush.setSendTimeType(systemPushSendTime.getCode());
|
||||||
|
if(systemPushSendTime == SystemPushSendTimeTypeEnum.SCHEDULED_SEND){
|
||||||
|
long between = Date77Util.diff(master.getSendTime(), LocalDateTime.now());
|
||||||
|
if(between < 0){
|
||||||
|
throw new ServiceException("定时发送时间不能少于当前时间");
|
||||||
|
}
|
||||||
|
if(between < 60){
|
||||||
|
throw new ServiceException("定时发送最低限制为1分钟以后");
|
||||||
|
}
|
||||||
|
sysPush.setSendTime(master.getSendTime());
|
||||||
|
}
|
||||||
|
sysPush.setGroupId(master.getGroupId());
|
||||||
|
sysPush.setType(master.getType());
|
||||||
|
sysPush.setTitle(master.getTitle());
|
||||||
|
sysPush.setRemark(master.getRemark());
|
||||||
|
sysPush.setStatus(SystemPushStatusEnum.NO_RUN.getCode());
|
||||||
|
String context = null;
|
||||||
|
switch (systemPushType){
|
||||||
|
case SIMPLE_TEXT:
|
||||||
|
NoticeMsgR ok = NoticeMsgR.ok(master.getOnlyText());
|
||||||
|
context = JSON.toJSONString(ok);
|
||||||
|
break;
|
||||||
|
case TEXT:
|
||||||
|
ExtNoticeData data = new ExtNoticeData();
|
||||||
|
data.setTitle(master.getTitle());
|
||||||
|
data.setTxt1(master.getTextText1());
|
||||||
|
List<ExtNoticeData.MessageExtDataList> fields = BeanConvertUtil.convertListTo(params.getTextContext(), ExtNoticeData.MessageExtDataList::new);
|
||||||
|
data.setFields(fields);
|
||||||
|
data.setTxt2(master.getTextText2());
|
||||||
|
data.setLink_type(master.getTextLinkType());
|
||||||
|
data.setLink_url(master.getTextLinkUrl());
|
||||||
|
NoticeR<ExtNoticeData> noticeR = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
|
context = JSON.toJSONString(noticeR);
|
||||||
|
break;
|
||||||
|
case SIMPLE_IMAGE_TEXT:
|
||||||
|
SimpleImageTextData simpleImageTextData = new SimpleImageTextData();
|
||||||
|
simpleImageTextData.setAct_type(master.getOneImageTitleType());
|
||||||
|
if(simpleImageTextData.getAct_type() == 1){ // 水印标题
|
||||||
|
simpleImageTextData.setAct_string(master.getOneImageText());
|
||||||
|
simpleImageTextData.setTitle(master.getOneImageText());
|
||||||
|
simpleImageTextData.setTxt(master.getOneImageText());
|
||||||
|
}else if(simpleImageTextData.getAct_type() == 2){ // 正常标题
|
||||||
|
simpleImageTextData.setAct_string(master.getOneImageText());
|
||||||
|
simpleImageTextData.setTitle(master.getOneImageText());
|
||||||
|
simpleImageTextData.setTxt(master.getOneImageText());
|
||||||
|
}
|
||||||
|
simpleImageTextData.setImage(master.getOneImageImage());
|
||||||
|
simpleImageTextData.setLink_type(master.getOneImageLinkType());
|
||||||
|
simpleImageTextData.setLink_url(master.getOneImageLinkUrl());
|
||||||
|
NoticeR<SimpleImageTextData> simpleImageTextR = NoticeR.ok(MessageBaseTypeEnum.SIMPLE_IMAGE_TEXT, simpleImageTextData);
|
||||||
|
context = JSON.toJSONString(simpleImageTextR);
|
||||||
|
break;
|
||||||
|
case IMAGE_TEXT:
|
||||||
|
List<SysPushImageContextDTO> imageContext = params.getImageContext();
|
||||||
|
List<MultipleImageTextNode> multipleImageTextNodeList = new ArrayList<>();
|
||||||
|
for (SysPushImageContextDTO dto : imageContext) {
|
||||||
|
MultipleImageTextNode multipleImageTextNode = new MultipleImageTextNode();
|
||||||
|
multipleImageTextNode.setImage(dto.getImage());
|
||||||
|
multipleImageTextNode.setTitle(dto.getTitle());
|
||||||
|
multipleImageTextNode.setLink_type(dto.getLinkType());
|
||||||
|
multipleImageTextNode.setLink_url(dto.getLinkUrl());
|
||||||
|
multipleImageTextNodeList.add(multipleImageTextNode);
|
||||||
|
}
|
||||||
|
MultipleImageTextData multipleImageTextData = new MultipleImageTextData();
|
||||||
|
multipleImageTextData.setList(multipleImageTextNodeList);
|
||||||
|
NoticeR<MultipleImageTextData> multipleImageTextDataNoticeR = NoticeR.ok(MessageBaseTypeEnum.MULTIPLE_IMAGE_TEXT, multipleImageTextData);
|
||||||
|
context = JSON.toJSONString(multipleImageTextDataNoticeR);
|
||||||
|
break;
|
||||||
|
case ONLY_IMAGE:
|
||||||
|
NoticeOnlyImageR noticeOnlyImageR = new NoticeOnlyImageR();
|
||||||
|
noticeOnlyImageR.setUrl(master.getOnlyImage());
|
||||||
|
context = JSON.toJSONString(noticeOnlyImageR);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sysPush.setContent(context);
|
||||||
|
sysPush.setParams(JSON.toJSONString(params));
|
||||||
|
this.save(sysPush);
|
||||||
|
try {
|
||||||
|
// 小于 < 12小时
|
||||||
|
long between = Date77Util.diff(sysPush.getSendTime(), LocalDateTime.now());
|
||||||
|
// SysPushDelayDto dto = new SysPushDelayDto();
|
||||||
|
// dto.setSysPushId(sysPush.getId());
|
||||||
|
// amqpProducer.sendCommonDelayMq(dto,(int)between+2);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("系统推送任务发送失败!",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,28 @@
|
|||||||
package com.ruoyi.xq.service.impl;
|
package com.ruoyi.xq.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.common.helper.LoginHelper;
|
||||||
import com.ruoyi.xq.domain.User;
|
import com.ruoyi.xq.domain.User;
|
||||||
import com.ruoyi.xq.domain.UserExtend;
|
import com.ruoyi.xq.domain.UserExtend;
|
||||||
|
import com.ruoyi.xq.domain.WxTransOrder;
|
||||||
import com.ruoyi.xq.dto.admin.user.UserExtendAdminVo;
|
import com.ruoyi.xq.dto.admin.user.UserExtendAdminVo;
|
||||||
import com.ruoyi.xq.dto.admin.user.req.UpdateIncomeCoinReq;
|
import com.ruoyi.xq.dto.admin.user.req.UpdateIncomeCoinReq;
|
||||||
|
import com.ruoyi.xq.dto.admin.user.req.UpdateWxTransNumReq;
|
||||||
|
import com.ruoyi.xq.enums.common.OrderTypeEnum;
|
||||||
|
import com.ruoyi.xq.enums.common.SystemConfigEnum;
|
||||||
|
import com.ruoyi.xq.enums.pay.PayStatusEnum;
|
||||||
|
import com.ruoyi.xq.enums.pay.PlatformTypeEnum;
|
||||||
|
import com.ruoyi.xq.enums.wxtrans.WxTransSourceEnum;
|
||||||
|
import com.ruoyi.xq.manager.OrderNoUtil;
|
||||||
|
import com.ruoyi.xq.manager.SystemConfigManager;
|
||||||
import com.ruoyi.xq.mapper.UserExtendMapper;
|
import com.ruoyi.xq.mapper.UserExtendMapper;
|
||||||
import com.ruoyi.xq.service.UserExtendService;
|
import com.ruoyi.xq.service.UserExtendService;
|
||||||
import com.ruoyi.xq.service.UserService;
|
import com.ruoyi.xq.service.UserService;
|
||||||
|
import com.ruoyi.xq.service.WxTransOrderService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -29,6 +41,10 @@ import java.math.BigDecimal;
|
|||||||
public class UserExtendServiceImpl extends ServiceImpl<UserExtendMapper,UserExtend> implements UserExtendService {
|
public class UserExtendServiceImpl extends ServiceImpl<UserExtendMapper,UserExtend> implements UserExtendService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
@Autowired
|
||||||
|
private WxTransOrderService wxTransOrderService;
|
||||||
|
@Autowired
|
||||||
|
private SystemConfigManager systemConfigManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean withdraw(Long userId, BigDecimal withdrawPrice){
|
public boolean withdraw(Long userId, BigDecimal withdrawPrice){
|
||||||
@@ -76,4 +92,31 @@ public class UserExtendServiceImpl extends ServiceImpl<UserExtendMapper,UserExte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void updateWxTransNum(UpdateWxTransNumReq bo) {
|
||||||
|
User user = userService.getByUsercode(bo.getUsercode());
|
||||||
|
if(user == null){
|
||||||
|
throw new ServiceException("用户不存在");
|
||||||
|
}
|
||||||
|
boolean wxTransNum = baseMapper.incrWxTransNum(user.getId(), bo.getNumber());
|
||||||
|
if(!wxTransNum){
|
||||||
|
throw new ServiceException("调整失败,请保证调整后交换次数不为负数");
|
||||||
|
}
|
||||||
|
BigDecimal price = systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.WX_TRANS_PRICE);
|
||||||
|
String orderNo = OrderNoUtil.gen(OrderTypeEnum.WX_TRANS);
|
||||||
|
WxTransOrder wxTransOrder = new WxTransOrder();
|
||||||
|
wxTransOrder.setUserId(user.getId());
|
||||||
|
wxTransOrder.setUsercode(user.getUsercode());
|
||||||
|
wxTransOrder.setWxNum(bo.getNumber());
|
||||||
|
wxTransOrder.setWxPrice(NumberUtil.mul(price,bo.getNumber()));
|
||||||
|
wxTransOrder.setOrderName(String.format("管理员新增%s个微信交换",bo.getNumber()));
|
||||||
|
wxTransOrder.setOrderNo(orderNo);
|
||||||
|
wxTransOrder.setPlatformType(PlatformTypeEnum.ADMIN.getCode());
|
||||||
|
wxTransOrder.setPayStatus(PayStatusEnum.NO_PAY.getCode());
|
||||||
|
wxTransOrder.setSource(WxTransSourceEnum.ADMIN.getCode());
|
||||||
|
wxTransOrder.setAdminId(LoginHelper.getUserId());
|
||||||
|
wxTransOrderService.save(wxTransOrder);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.ruoyi.xq.dto.admin.user.UserVipAdminVo;
|
|||||||
import com.ruoyi.xq.dto.admin.user.req.AddVipReq;
|
import com.ruoyi.xq.dto.admin.user.req.AddVipReq;
|
||||||
import com.ruoyi.xq.enums.common.OrderTypeEnum;
|
import com.ruoyi.xq.enums.common.OrderTypeEnum;
|
||||||
import com.ruoyi.xq.enums.pay.PayStatusEnum;
|
import com.ruoyi.xq.enums.pay.PayStatusEnum;
|
||||||
|
import com.ruoyi.xq.enums.pay.PlatformTypeEnum;
|
||||||
import com.ruoyi.xq.enums.vip.VipStatusEnum;
|
import com.ruoyi.xq.enums.vip.VipStatusEnum;
|
||||||
import com.ruoyi.xq.enums.vip.VipTypeEnum;
|
import com.ruoyi.xq.enums.vip.VipTypeEnum;
|
||||||
import com.ruoyi.xq.manager.OrderNoUtil;
|
import com.ruoyi.xq.manager.OrderNoUtil;
|
||||||
@@ -100,6 +101,7 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipMapper,UserVip> imple
|
|||||||
vipOrder.setOrderName(text);
|
vipOrder.setOrderName(text);
|
||||||
vipOrder.setOrderNo(OrderNoUtil.gen(OrderTypeEnum.VIP));
|
vipOrder.setOrderNo(OrderNoUtil.gen(OrderTypeEnum.VIP));
|
||||||
vipOrder.setPayStatus(PayStatusEnum.NO_PAY.getCode());
|
vipOrder.setPayStatus(PayStatusEnum.NO_PAY.getCode());
|
||||||
|
vipOrder.setPlatformType(PlatformTypeEnum.ADMIN.getCode());
|
||||||
vipOrder.setAdmin(true);
|
vipOrder.setAdmin(true);
|
||||||
vipOrder.setAdminId(LoginHelper.getUserId());
|
vipOrder.setAdminId(LoginHelper.getUserId());
|
||||||
vipOrderService.save(vipOrder);
|
vipOrderService.save(vipOrder);
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.ruoyi.xq.service.impl;
|
package com.ruoyi.xq.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.xq.domain.User;
|
import com.ruoyi.xq.domain.User;
|
||||||
import com.ruoyi.xq.domain.WxTransOrder;
|
import com.ruoyi.xq.domain.WxTransOrder;
|
||||||
|
import com.ruoyi.xq.dto.admin.wxtrans.WxTransOrderAdminVo;
|
||||||
import com.ruoyi.xq.enums.common.OrderTypeEnum;
|
import com.ruoyi.xq.enums.common.OrderTypeEnum;
|
||||||
import com.ruoyi.xq.enums.common.SystemConfigEnum;
|
import com.ruoyi.xq.enums.common.SystemConfigEnum;
|
||||||
import com.ruoyi.xq.enums.pay.PayStatusEnum;
|
import com.ruoyi.xq.enums.pay.PayStatusEnum;
|
||||||
@@ -35,13 +38,13 @@ public class WxTransOrderServiceImpl extends ServiceImpl<WxTransOrderMapper,WxTr
|
|||||||
@Override
|
@Override
|
||||||
public WxTransOrder createVipOrder(Long userId, Integer wxTransNum) {
|
public WxTransOrder createVipOrder(Long userId, Integer wxTransNum) {
|
||||||
BigDecimal price = systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.WX_TRANS_PRICE);
|
BigDecimal price = systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.WX_TRANS_PRICE);
|
||||||
String orderNo = OrderNoUtil.gen(OrderTypeEnum.VIP);
|
String orderNo = OrderNoUtil.gen(OrderTypeEnum.WX_TRANS);
|
||||||
User user = userService.getById(userId);
|
User user = userService.getById(userId);
|
||||||
WxTransOrder order = new WxTransOrder();
|
WxTransOrder order = new WxTransOrder();
|
||||||
order.setUserId(user.getId());
|
order.setUserId(user.getId());
|
||||||
order.setUsercode(user.getUsercode());
|
order.setUsercode(user.getUsercode());
|
||||||
order.setWxNum(wxTransNum);
|
order.setWxNum(wxTransNum);
|
||||||
order.setWxPrice(NumberUtil.add(price,wxTransNum));
|
order.setWxPrice(NumberUtil.mul(price,wxTransNum));
|
||||||
order.setOrderName("微信交换订单");
|
order.setOrderName("微信交换订单");
|
||||||
order.setOrderNo(orderNo);
|
order.setOrderNo(orderNo);
|
||||||
order.setPayStatus(PayStatusEnum.READY_PAY.getCode());
|
order.setPayStatus(PayStatusEnum.READY_PAY.getCode());
|
||||||
@@ -49,4 +52,9 @@ public class WxTransOrderServiceImpl extends ServiceImpl<WxTransOrderMapper,WxTr
|
|||||||
this.save(order);
|
this.save(order);
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<WxTransOrderAdminVo> pageAdmin(PageQuery pageQuery, WxTransOrderAdminVo bo) {
|
||||||
|
return baseMapper.pageAdmin(pageQuery.build(), bo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
113
ruoyi-xq/src/main/java/com/ruoyi/xq/util/Date77Util.java
Normal file
113
ruoyi-xq/src/main/java/com/ruoyi/xq/util/Date77Util.java
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
package com.ruoyi.xq.util;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
|
||||||
|
import java.time.*;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.time.temporal.TemporalAdjusters;
|
||||||
|
|
||||||
|
public class Date77Util {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算时间相差秒数
|
||||||
|
* 前者-后者 的差值
|
||||||
|
*/
|
||||||
|
public static long diff(LocalDateTime before, LocalDateTime after){
|
||||||
|
return ChronoUnit.SECONDS.between(after, before);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long diffDays(LocalDateTime before, LocalDateTime after){
|
||||||
|
return ChronoUnit.DAYS.between(after, before);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String betweenShowString(LocalDateTime minTime,LocalDateTime maxTime){
|
||||||
|
Duration duration = Duration.between(minTime, maxTime);
|
||||||
|
long seconds = duration.getSeconds();
|
||||||
|
long absSeconds = Math.abs(seconds);
|
||||||
|
long days = absSeconds / (60 * 60 * 24);
|
||||||
|
long hours = (absSeconds % (60 * 60 * 24)) / (60 * 60);
|
||||||
|
long minutes = (absSeconds % (60 * 60)) / 60;
|
||||||
|
long secs = absSeconds % 60;
|
||||||
|
if(days < 30){
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
if(days != 0){
|
||||||
|
sb.append(days).append("天").append(hours).append("小时").append(minutes).append("分钟");
|
||||||
|
}else if(hours != 0){
|
||||||
|
sb.append(hours).append("小时").append(minutes).append("分钟");
|
||||||
|
}else if(minutes != 0){
|
||||||
|
sb.append(minutes).append("分钟");
|
||||||
|
}else {
|
||||||
|
sb.append(secs).append("秒");
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
Period period = Period.between(minTime.toLocalDate(), maxTime.toLocalDate());
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
if(period.getYears() != 0){
|
||||||
|
sb.append(period.getYears()).append("年");
|
||||||
|
}
|
||||||
|
if(period.getMonths() != 0){
|
||||||
|
sb.append(period.getMonths()).append("月");
|
||||||
|
}
|
||||||
|
if(period.getDays() != 0){
|
||||||
|
sb.append(period.getDays()).append("天");
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// 两个时间点
|
||||||
|
LocalDateTime dateTime1 = LocalDateTime.of(2020, 5, 20, 12, 0, 0);
|
||||||
|
LocalDateTime dateTime2 = LocalDateTime.of(2024, 1, 15, 11, 30, 0);
|
||||||
|
|
||||||
|
// 计算日期间隔
|
||||||
|
Period period = Period.between(dateTime1.toLocalDate(), dateTime2.toLocalDate());
|
||||||
|
|
||||||
|
// 输出年、月、日间隔
|
||||||
|
System.out.println("间隔: " + period.getYears() + " 年 " + period.getMonths() + " 个月 " + period.getDays() + " 天");
|
||||||
|
|
||||||
|
// 计算时间间隔
|
||||||
|
Duration duration = Duration.between(dateTime1, dateTime2);
|
||||||
|
|
||||||
|
// 输出时、分、秒间隔
|
||||||
|
long seconds = duration.getSeconds();
|
||||||
|
long absSeconds = Math.abs(seconds);
|
||||||
|
long days = absSeconds / (60 * 60 * 24);
|
||||||
|
long hours = (absSeconds % (60 * 60 * 24)) / (60 * 60);
|
||||||
|
long minutes = (absSeconds % (60 * 60)) / 60;
|
||||||
|
long secs = absSeconds % 60;
|
||||||
|
|
||||||
|
System.out.println("时间间隔: " + days + " 天 " + hours + " 小时 " + minutes + " 分钟 " + secs + " 秒");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static LocalDate getLastWeekOne(LocalDate date){
|
||||||
|
return date.plusWeeks(-1)
|
||||||
|
.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String localDateTimeToString(LocalDateTime localDateTime){
|
||||||
|
return localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalDateTime toDataSecond(Long date){
|
||||||
|
if(date == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return DateUtil.date(date*1000).toLocalDateTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String getCurrentTimeStr() {
|
||||||
|
return localDateTimeToString(LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String formatDate(LocalDate begin) {
|
||||||
|
return begin.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
set withdraw_total = withdraw_total + #{withdrawMonty}
|
set withdraw_total = withdraw_total + #{withdrawMonty}
|
||||||
where user_id = #{userId}
|
where user_id = #{userId}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="incrWxTransNum">
|
||||||
|
update xq_user_extend
|
||||||
|
set wx_trans_num = wx_trans_num + #{wxTransNum}
|
||||||
|
where user_id = #{userId}
|
||||||
|
</update>
|
||||||
<select id="pageAdmin" resultType="com.ruoyi.xq.dto.admin.user.UserExtendAdminVo">
|
<select id="pageAdmin" resultType="com.ruoyi.xq.dto.admin.user.UserExtendAdminVo">
|
||||||
select t1.*, t2.nickname,t2.mobile,t2.avatar
|
select t1.*, t2.nickname,t2.mobile,t2.avatar
|
||||||
from xq_user_extend t1
|
from xq_user_extend t1
|
||||||
|
|||||||
@@ -4,27 +4,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.xq.mapper.WxTransOrderMapper">
|
<mapper namespace="com.ruoyi.xq.mapper.WxTransOrderMapper">
|
||||||
|
|
||||||
<resultMap type="com.ruoyi.xq.domain.WxTransOrder" id="WxTransOrderResult">
|
<select id="pageAdmin" resultType="com.ruoyi.xq.dto.admin.wxtrans.WxTransOrderAdminVo">
|
||||||
<result property="id" column="id"/>
|
select t1.*, t2.nickname,t2.mobile,t2.avatar
|
||||||
<result property="userId" column="user_id"/>
|
from xq_wx_trans_order t1
|
||||||
<result property="usercode" column="usercode"/>
|
left join xq_user t2 on t1.user_id = t2.id
|
||||||
<result property="traceId" column="trace_id"/>
|
<where>
|
||||||
<result property="wxId" column="wx_id"/>
|
<if test="bo.usercode != null and bo.usercode != ''">
|
||||||
<result property="wxNum" column="wx_num"/>
|
and t1.usercode = #{bo.usercode}
|
||||||
<result property="wxPrice" column="wx_price"/>
|
</if>
|
||||||
<result property="orderName" column="order_name"/>
|
<if test="bo.nickname != null and bo.nickname != ''">
|
||||||
<result property="orderNo" column="order_no"/>
|
and t2.nickname like concat('%',#{bo.nickname},'%')
|
||||||
<result property="platformType" column="platform_type"/>
|
</if>
|
||||||
<result property="payStatus" column="pay_status"/>
|
<if test="bo.mobile != null and bo.mobile != ''">
|
||||||
<result property="payTime" column="pay_time"/>
|
and t2.mobile = #{bo.mobile}
|
||||||
<result property="appid" column="appid"/>
|
</if>
|
||||||
<result property="returnContent" column="return_content"/>
|
</where>
|
||||||
<result property="operateIp" column="operate_ip"/>
|
order by t1.create_time desc
|
||||||
<result property="source" column="source"/>
|
</select>
|
||||||
<result property="adminId" column="admin_id"/>
|
|
||||||
<result property="createTime" column="create_time"/>
|
|
||||||
<result property="updateTime" column="update_time"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user