feat(communityCenter): 发布标签
parent
43a6bc98b8
commit
6395fc7260
|
@ -0,0 +1,58 @@
|
||||||
|
package com.mcwl.web.controller.communityCenter;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.mcwl.common.constant.HttpStatus;
|
||||||
|
import com.mcwl.common.core.domain.R;
|
||||||
|
import com.mcwl.common.core.page.TableDataInfo;
|
||||||
|
import com.mcwl.communityCenter.domain.PublishLabel;
|
||||||
|
import com.mcwl.communityCenter.domain.dto.*;
|
||||||
|
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||||
|
import com.mcwl.communityCenter.service.CommunityUserService;
|
||||||
|
import com.mcwl.communityCenter.service.PublishLabelService;
|
||||||
|
import com.mcwl.communityCenter.service.PublishService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布标签
|
||||||
|
*/
|
||||||
|
@Api(tags = "发布标签")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("publishLabel")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PublishLabelController {
|
||||||
|
|
||||||
|
private final PublishLabelService publishLabelService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取发布标签列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取发布标签列表")
|
||||||
|
@PostMapping("list")
|
||||||
|
public R<List<String>> listPublishLabel(@RequestBody @Valid PublishLabelListRes publishLabelListRes) {
|
||||||
|
|
||||||
|
return R.ok(publishLabelService.listPublishLabel(publishLabelListRes));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增发布标签
|
||||||
|
*/
|
||||||
|
@ApiOperation("新增发布标签")
|
||||||
|
@PostMapping("add")
|
||||||
|
public R<String> addPublishLabel(@RequestBody @Valid PublishLabelAddRes publishLabelAddRes) {
|
||||||
|
|
||||||
|
publishLabelService.addPublishLabel(publishLabelAddRes);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -60,6 +60,11 @@ public class Publish extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签名
|
||||||
|
*/
|
||||||
|
private String labelName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布时间 - 定时发布
|
* 发布时间 - 定时发布
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.mcwl.communityCenter.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.mcwl.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("cc_publish_label")
|
||||||
|
public class PublishLabel extends BaseEntity {
|
||||||
|
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id - 租户id
|
||||||
|
*/
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社区id
|
||||||
|
*/
|
||||||
|
private Long communityId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签名
|
||||||
|
*/
|
||||||
|
private String labelName;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.mcwl.communityCenter.domain.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增发布标签请求参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "新增发布标签请求参数")
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PublishLabelAddRes {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "租户id不能为空")
|
||||||
|
@ApiModelProperty(value = "租户id", required = true)
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社区id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "社区id不能为空")
|
||||||
|
@ApiModelProperty(value = "社区id", required = true)
|
||||||
|
private Long communityId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "标签名称不能为空")
|
||||||
|
@ApiModelProperty(value = "标签名称", required = true)
|
||||||
|
private String labelName;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.mcwl.communityCenter.domain.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布标签列表请求参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "发布标签列表请求参数")
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PublishLabelListRes {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "租户id不能为空")
|
||||||
|
@ApiModelProperty(value = "租户id", required = true)
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社区id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "社区id不能为空")
|
||||||
|
@ApiModelProperty(value = "社区id", required = true)
|
||||||
|
private Long communityId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -25,4 +25,7 @@ public class PublishPageRes extends PageDomain {
|
||||||
@ApiModelProperty(value = "类型 0只看星主 1精选", required = true)
|
@ApiModelProperty(value = "类型 0只看星主 1精选", required = true)
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标签名")
|
||||||
|
private String labelName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,11 @@ public class PublishRes {
|
||||||
@ApiModelProperty(value = "社区id", required = true)
|
@ApiModelProperty(value = "社区id", required = true)
|
||||||
@NotNull(message = "社区id不能为空")
|
@NotNull(message = "社区id不能为空")
|
||||||
private Long communityId;
|
private Long communityId;
|
||||||
|
/**
|
||||||
|
* 标签名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "标签名")
|
||||||
|
private String labelName;
|
||||||
/**
|
/**
|
||||||
* 内容
|
* 内容
|
||||||
*/
|
*/
|
||||||
|
@ -51,9 +56,10 @@ public class PublishRes {
|
||||||
private String fileName;
|
private String fileName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布时间 - 定时发布
|
* 是否精选
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "发布时间 - 定时发布")
|
@ApiModelProperty(value = "是否精选")
|
||||||
private Date publishTime;
|
private Integer isElite = 0;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,12 @@ public class PersonHomeVo {
|
||||||
@ApiModelProperty(value = "图片url")
|
@ApiModelProperty(value = "图片url")
|
||||||
private String imageUrl;
|
private String imageUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "标签名")
|
||||||
|
private String labelName;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点赞数
|
* 点赞数
|
||||||
|
|
|
@ -40,6 +40,12 @@ public class PublishVo {
|
||||||
@ApiModelProperty(value = "用户id")
|
@ApiModelProperty(value = "用户id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "标签名")
|
||||||
|
private String labelName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户名
|
* 用户名
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.mcwl.communityCenter.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.mcwl.communityCenter.domain.Publish;
|
||||||
|
import com.mcwl.communityCenter.domain.PublishLabel;
|
||||||
|
import com.mcwl.communityCenter.domain.dto.MyPublishPageRes;
|
||||||
|
import com.mcwl.communityCenter.domain.dto.PublishLabelListRes;
|
||||||
|
import com.mcwl.communityCenter.domain.dto.PublishPageRes;
|
||||||
|
import com.mcwl.communityCenter.domain.dto.PublishRemoveRes;
|
||||||
|
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface PublishLabelMapper extends BaseMapper<PublishLabel> {
|
||||||
|
|
||||||
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
|
List<String> listPublishLabel(PublishLabelListRes publishLabelListRes);
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.mcwl.communityCenter.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.mcwl.common.core.domain.R;
|
||||||
|
import com.mcwl.common.core.page.TableDataInfo;
|
||||||
|
import com.mcwl.communityCenter.domain.Publish;
|
||||||
|
import com.mcwl.communityCenter.domain.PublishLabel;
|
||||||
|
import com.mcwl.communityCenter.domain.dto.*;
|
||||||
|
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface PublishLabelService extends IService<PublishLabel> {
|
||||||
|
|
||||||
|
|
||||||
|
List<String> listPublishLabel(PublishLabelListRes publishLabelListRes);
|
||||||
|
|
||||||
|
void addPublishLabel(PublishLabelAddRes publishLabelAddRes);
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.mcwl.communityCenter.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.mcwl.common.constant.HttpStatus;
|
||||||
|
import com.mcwl.common.core.domain.R;
|
||||||
|
import com.mcwl.common.core.domain.entity.SysUser;
|
||||||
|
import com.mcwl.common.core.page.PageDomain;
|
||||||
|
import com.mcwl.common.core.page.TableDataInfo;
|
||||||
|
import com.mcwl.common.core.redis.RedisCache;
|
||||||
|
import com.mcwl.common.exception.ServiceException;
|
||||||
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
|
import com.mcwl.common.utils.StringUtils;
|
||||||
|
import com.mcwl.communityCenter.constant.AdviceConstant;
|
||||||
|
import com.mcwl.communityCenter.domain.*;
|
||||||
|
import com.mcwl.communityCenter.domain.dto.*;
|
||||||
|
import com.mcwl.communityCenter.domain.vo.CommentVo;
|
||||||
|
import com.mcwl.communityCenter.domain.vo.PersonHomeVo;
|
||||||
|
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||||
|
import com.mcwl.communityCenter.mapper.*;
|
||||||
|
import com.mcwl.communityCenter.service.*;
|
||||||
|
import com.mcwl.system.service.ISysUserService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PublishLabelServiceImpl extends ServiceImpl<PublishLabelMapper, PublishLabel> implements PublishLabelService {
|
||||||
|
|
||||||
|
private final CommunityUserMapper communityUserMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listPublishLabel(PublishLabelListRes publishLabelListRes) {
|
||||||
|
|
||||||
|
|
||||||
|
return baseMapper.listPublishLabel(publishLabelListRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addPublishLabel(PublishLabelAddRes publishLabelAddRes) {
|
||||||
|
|
||||||
|
CommunityUser communityUser = communityUserMapper.selectCommunityUser(publishLabelAddRes.getTenantId(),
|
||||||
|
publishLabelAddRes.getCommunityId(), SecurityUtils.getUserId());
|
||||||
|
|
||||||
|
if (communityUser == null) {
|
||||||
|
throw new ServiceException("您不是该社区的成员,无法添加标签", HttpStatus.SHOW_ERROR_MSG);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (communityUser.getUserType() != 2) {
|
||||||
|
throw new ServiceException("您不是星主,无法添加标签", HttpStatus.SHOW_ERROR_MSG);
|
||||||
|
}
|
||||||
|
|
||||||
|
PublishLabelListRes publishLabelListRes = BeanUtil.copyProperties(publishLabelAddRes, PublishLabelListRes.class);
|
||||||
|
List<String> publishLabelList = this.listPublishLabel(publishLabelListRes);
|
||||||
|
if (publishLabelList.size() >= 3) {
|
||||||
|
throw new ServiceException("最多只能添加三个标签", HttpStatus.SHOW_ERROR_MSG);
|
||||||
|
}
|
||||||
|
|
||||||
|
PublishLabel publishLabel = BeanUtil.copyProperties(publishLabelAddRes, PublishLabel.class);
|
||||||
|
baseMapper.insert(publishLabel);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -103,6 +103,10 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
|
||||||
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员");
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (publishRes.getIsElite() != null && communityUser.getUserType() != 2) {
|
||||||
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是星主,无法设置精选");
|
||||||
|
}
|
||||||
|
|
||||||
if ("1".equals(communityUser.getIsBlack())) {
|
if ("1".equals(communityUser.getIsBlack())) {
|
||||||
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您已被拉黑");
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您已被拉黑");
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?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="com.mcwl.communityCenter.mapper.PublishLabelMapper">
|
||||||
|
|
||||||
|
<select id="listPublishLabel" resultType="java.lang.String">
|
||||||
|
select label_name
|
||||||
|
from cc_publish_label
|
||||||
|
where tenant_id = #{tenantId}
|
||||||
|
and community_id = #{communityId}
|
||||||
|
and del_flag = '0'
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -5,9 +5,12 @@
|
||||||
<mapper namespace="com.mcwl.communityCenter.mapper.PublishMapper">
|
<mapper namespace="com.mcwl.communityCenter.mapper.PublishMapper">
|
||||||
<insert id="insertPublish">
|
<insert id="insertPublish">
|
||||||
insert into cc_publish
|
insert into cc_publish
|
||||||
(tenant_id, community_id, user_id, content, image_url, file_url, file_name, publish_time, create_time)
|
(tenant_id, community_id, user_id, content, image_url, label_name, file_url, file_name, publish_time,
|
||||||
|
is_elite,
|
||||||
|
create_time)
|
||||||
values (#{publish.tenantId}, #{publish.communityId}, #{publish.userId}, #{publish.content}, #{publish.imageUrl},
|
values (#{publish.tenantId}, #{publish.communityId}, #{publish.userId}, #{publish.content}, #{publish.imageUrl},
|
||||||
#{publish.fileUrl}, #{publish.fileName}, #{publish.publishTime}, now())
|
#{publish.labelName}, #{publish.fileUrl}, #{publish.fileName}, #{publish.publishTime},
|
||||||
|
#{publish.isElite}, now())
|
||||||
</insert>
|
</insert>
|
||||||
<update id="elitePublish">
|
<update id="elitePublish">
|
||||||
update cc_publish
|
update cc_publish
|
||||||
|
@ -130,6 +133,9 @@
|
||||||
and p.is_elite = 1
|
and p.is_elite = 1
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="publishPageRes.labelName != null and publishPageRes.labelName != ''">
|
||||||
|
and p.label_name = #{publishPageRes.labelName}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by p.create_time desc
|
order by p.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -54,6 +54,7 @@ import com.mcwl.system.service.ISysUserPayAccountService;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -308,7 +309,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
return R.fail(HttpStatus.SHOW_ERROR_MSG, "请勿频繁点击");
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "请勿频繁点击");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
redisCache.setCacheObject("alipay:fetch:user:" + SecurityUtils.getUserId(), "1");
|
redisCache.setCacheObject("alipay:fetch:user:" + SecurityUtils.getUserId(), "1", 3, TimeUnit.MINUTES);
|
||||||
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
|
||||||
|
@ -347,7 +348,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
|
|
||||||
// 证书用:certificateExecute(request),密钥用:execute(request)
|
// 证书用:certificateExecute(request),密钥用:execute(request)
|
||||||
AlipayFundTransUniTransferResponse response = getAlipayFundTransUniTransferResponse(amount, sysUserPayAccount.getOpenId());
|
AlipayFundTransUniTransferResponse response = getAlipayFundTransUniTransferResponse(amount, sysUserPayAccount.getOpenId());
|
||||||
System.out.println(response.getBody());
|
log.info(response.getBody());
|
||||||
|
|
||||||
if (response.isSuccess()) {
|
if (response.isSuccess()) {
|
||||||
|
|
||||||
|
@ -363,12 +364,10 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
|
|
||||||
// 账户余额不足,发送邮件通知
|
// 账户余额不足,发送邮件通知
|
||||||
// ArrayList<String> tos = CollUtil.newArrayList("2119157836@qq.com");
|
// ArrayList<String> tos = CollUtil.newArrayList("2119157836@qq.com");
|
||||||
|
this.sendAlertEmail(tos, String.format("账户余额不足:用户%s提现:%s", sysUser.getNickName(), amount));
|
||||||
String content = String.format("账户余额不足:用户%s提现:%s", sysUser.getNickName(), amount);
|
|
||||||
MailUtil.send(tos, "魔创未来", content, false);
|
|
||||||
throw new ServiceException("网络异常,请稍后再试", HttpStatus.SHOW_ERROR_MSG);
|
throw new ServiceException("网络异常,请稍后再试", HttpStatus.SHOW_ERROR_MSG);
|
||||||
}
|
}
|
||||||
System.out.println("用户" + SecurityUtils.getLoginUser().getUser().getNickName() + "提现失败:" + response.getSubMsg());
|
log.error("用户{}提现失败:{}", SecurityUtils.getLoginUser().getUser().getNickName(), response.getSubMsg());
|
||||||
throw new ServiceException("提现失败", HttpStatus.SHOW_ERROR_MSG);
|
throw new ServiceException("提现失败", HttpStatus.SHOW_ERROR_MSG);
|
||||||
} finally {
|
} finally {
|
||||||
redisCache.deleteObject("alipay:fetch:user:" + SecurityUtils.getUserId());
|
redisCache.deleteObject("alipay:fetch:user:" + SecurityUtils.getUserId());
|
||||||
|
@ -473,7 +472,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
// 已经绑定过,直接返回
|
// 已经绑定过,直接返回
|
||||||
return "success";
|
return "success";
|
||||||
}
|
}
|
||||||
System.out.println("绑定成功!openId/uid:" + (StrUtil.isEmpty(openId) ? uid : openId));
|
log.info("绑定成功!openId/uid:{}", StrUtil.isEmpty(openId) ? uid : openId);
|
||||||
// 将openId与当前商城用户绑定(保存到数据库)
|
// 将openId与当前商城用户绑定(保存到数据库)
|
||||||
SysUserPayAccount userPayAccount = new SysUserPayAccount();
|
SysUserPayAccount userPayAccount = new SysUserPayAccount();
|
||||||
userPayAccount.setUserId(userId);
|
userPayAccount.setUserId(userId);
|
||||||
|
@ -484,7 +483,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
redisCache.setCacheObject("alipay:bind:user:status:" + userId, "1", 4, TimeUnit.SECONDS);
|
redisCache.setCacheObject("alipay:bind:user:status:" + userId, "1", 4, TimeUnit.SECONDS);
|
||||||
return "success";
|
return "success";
|
||||||
} else {
|
} else {
|
||||||
System.out.println("绑定失败:" + response.getSubMsg());
|
log.error("绑定失败:{}", response.getSubMsg());
|
||||||
redisCache.setCacheObject("alipay:bind:user:status:" + userId, "0", 4, TimeUnit.SECONDS);
|
redisCache.setCacheObject("alipay:bind:user:status:" + userId, "0", 4, TimeUnit.SECONDS);
|
||||||
return "fail";
|
return "fail";
|
||||||
}
|
}
|
||||||
|
@ -623,6 +622,11 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
return alipayClient.certificateExecute(request);
|
return alipayClient.certificateExecute(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public void sendAlertEmail(List<String> emails, String content) {
|
||||||
|
MailUtil.send(emails, "魔创未来", content, false);
|
||||||
|
}
|
||||||
|
|
||||||
public AlipayConfig getAlipayConfig() throws FileNotFoundException {
|
public AlipayConfig getAlipayConfig() throws FileNotFoundException {
|
||||||
|
|
||||||
AlipayConfig config = new AlipayConfig();
|
AlipayConfig config = new AlipayConfig();
|
||||||
|
|
Loading…
Reference in New Issue