1修改注销用户接口
This commit is contained in:
parent
9bfb559a80
commit
0b3e5733e7
@ -1,44 +1,55 @@
|
||||
package com.xhpc;
|
||||
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.boot.jackson.JsonComponent;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.TimeZone;
|
||||
|
||||
@JsonComponent
|
||||
public class DateFormatConfig {
|
||||
//
|
||||
// @Value("${spring.jackson.date-format:yyyy-MM-dd HH:mm:ss}")
|
||||
// private String pattern;
|
||||
//
|
||||
// /**
|
||||
// * @author xiaofu
|
||||
// * @description date 类型全局时间格式化
|
||||
// * @date 2020/8/31 18:22
|
||||
// */
|
||||
// @Bean
|
||||
// public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilder() {
|
||||
//
|
||||
// return builder -> {
|
||||
// TimeZone tz = TimeZone.getTimeZone("UTC");
|
||||
// DateFormat df = new SimpleDateFormat(pattern);
|
||||
// df.setTimeZone(tz);
|
||||
// builder.failOnEmptyBeans(false)
|
||||
// .failOnUnknownProperties(false)
|
||||
// .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
||||
// .dateFormat(df);
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @author xiaofu
|
||||
// * @description LocalDate 类型全局时间格式化
|
||||
// * @date 2020/8/31 18:22
|
||||
// */
|
||||
// @Bean
|
||||
// public LocalDateTimeSerializer localDateTimeDeserializer() {
|
||||
// return new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(pattern));
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer(LocalDateTimeSerializer localDateTimeDeserializer) {
|
||||
// return builder -> builder.serializerByType(LocalDateTime.class, localDateTimeDeserializer);
|
||||
// }
|
||||
|
||||
@Value("${spring.jackson.date-format:yyyy-MM-dd HH:mm:ss}")
|
||||
private String pattern;
|
||||
|
||||
/**
|
||||
* @author xiaofu
|
||||
* @description date 类型全局时间格式化
|
||||
* @date 2020/8/31 18:22
|
||||
*/
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilder() {
|
||||
|
||||
return builder -> {
|
||||
TimeZone tz = TimeZone.getTimeZone("UTC");
|
||||
DateFormat df = new SimpleDateFormat(pattern);
|
||||
df.setTimeZone(tz);
|
||||
builder.failOnEmptyBeans(false)
|
||||
.failOnUnknownProperties(false)
|
||||
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
||||
.dateFormat(df);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @author xiaofu
|
||||
* @description LocalDate 类型全局时间格式化
|
||||
* @date 2020/8/31 18:22
|
||||
*/
|
||||
@Bean
|
||||
public LocalDateTimeSerializer localDateTimeDeserializer() {
|
||||
return new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(pattern));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer(LocalDateTimeSerializer localDateTimeDeserializer) {
|
||||
return builder -> builder.serializerByType(LocalDateTime.class, localDateTimeDeserializer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,11 +29,7 @@ public class AlipayPaymentController {
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
/**
|
||||
* 新版本的支付方式
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@GetMapping("/payment")
|
||||
@ApiOperation(value = "微信支付")
|
||||
private String newPay() throws Exception {
|
||||
|
||||
@ -10,6 +10,7 @@ import com.xhpc.payment.domain.XhpcRechargeOrder;
|
||||
import com.xhpc.payment.domain.XhpcUserAccountStatement;
|
||||
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
|
||||
import com.xhpc.payment.service.IXhpcRechargeOrderService;
|
||||
import com.xhpc.payment.service.IXhpcRefundOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -51,6 +52,9 @@ public class WxPaymentController {
|
||||
@Autowired
|
||||
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
|
||||
|
||||
@Autowired
|
||||
private IXhpcRefundOrderService iXhpcRefundOrderService;
|
||||
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
@ -71,6 +75,10 @@ public class WxPaymentController {
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空");
|
||||
}
|
||||
Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(Long.parseLong(userId));
|
||||
if (StringUtils.isNotNull(refundOrder)) {
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "用户存正在退款");
|
||||
}
|
||||
Double amount1 = Double.parseDouble(amount) * 100;
|
||||
String orderNumber = StringUtils.numFormat(Long.parseLong(userId), 1, StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
|
||||
if (0.0 == amount1) {
|
||||
|
||||
@ -34,6 +34,7 @@ import org.apache.http.ssl.SSLContexts;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -74,16 +75,25 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/examine")
|
||||
@ApiOperation(value = "退款审核")
|
||||
@Transactional
|
||||
public AjaxResult info(@RequestBody XhpcRefundAudit xhpcRefundAudit) {
|
||||
Map<String, Object> map = iXhpcRefundOrderService.info(xhpcRefundAudit.getRefundOrderId());
|
||||
if (null == map) {
|
||||
AjaxResult.error(HttpStatus.DATA_ERROR, "退款订单不存在");
|
||||
}
|
||||
String status = StringUtils.valueOf(map.get("status"));
|
||||
if (StatusConstants.REFUND_ORDER_STATUS_WAIT != Integer.parseInt(status)) {
|
||||
AjaxResult.error(HttpStatus.DATA_ERROR, "退款订单状态不能审核");
|
||||
}
|
||||
String examineStatus = StringUtils.valueOf(map.get("examineStatus"));
|
||||
if (StatusConstants.REFUND_ORDER_STATUS_WAIT != Integer.parseInt(examineStatus)) {
|
||||
AjaxResult.error(HttpStatus.DATA_ERROR, "退款订单状态不能审核");
|
||||
}
|
||||
AjaxResult ajaxResult = iXhpcRefundAuditService.insert(xhpcRefundAudit);
|
||||
if (StringUtils.isNotNull(ajaxResult)) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ajaxResult;
|
||||
}
|
||||
Map<String, Object> map = iXhpcRefundOrderService.info(xhpcRefundAudit.getRefundOrderId());
|
||||
if (null == map) {
|
||||
AjaxResult.error(HttpStatus.DATA_ERROR, "退款订单不存在");
|
||||
}
|
||||
String userId = StringUtils.valueOf(map.get("userId"));
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(Long.parseLong(userId));
|
||||
@ -105,19 +115,20 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款审核
|
||||
* 取消申请
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/cancelExamine")
|
||||
@ApiOperation(value = "退款审核")
|
||||
@ApiOperation(value = "取消申请")
|
||||
@Transactional
|
||||
public AjaxResult cancelExamine(@RequestBody Map<String, Object> map) {
|
||||
String userId = StringUtils.valueOf(map);
|
||||
String userId = StringUtils.valueOf(map.get("userId"));
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "用户id不能为空");
|
||||
}
|
||||
Map<String, Object> refundOrder = iXhpcRefundOrderService.addRefundOrder(Long.parseLong(userId));
|
||||
Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(Long.parseLong(userId));
|
||||
if (StringUtils.isNull(refundOrder)) {
|
||||
return AjaxResult.error(HttpStatus.DATA_ERROR, "退款订单不存在");
|
||||
}
|
||||
|
||||
@ -52,13 +52,8 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
}
|
||||
//生成退款订单
|
||||
String orderOutNumber = StringUtils.numFormat(Long.parseLong(userId), Integer.parseInt(type), StatusConstants.FLOWING_WATER_REFUND_TYPE);
|
||||
|
||||
return iXhpcRefundOrderService.addRefundOrder(userId, BigDecimal.valueOf(Double.parseDouble(amount)), type, orderOutNumber, openid);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
System.out.println(StringUtils.numFormat(Long.parseLong("11"), Integer.parseInt("1"), StatusConstants.FLOWING_WATER_REFUND_TYPE));//打印结果"000006"
|
||||
String remark = StringUtils.valueOf(map.get("remark"));
|
||||
return iXhpcRefundOrderService.addRefundOrder(userId, BigDecimal.valueOf(Double.parseDouble(amount)), type, orderOutNumber, openid, remark);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,6 +68,18 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
return AjaxResult.success(iXhpcRefundOrderService.info(refundOrderId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户id查询未完成退款订单
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getNotRefundOrder")
|
||||
@ApiOperation(value = "用户id查询未完成退款订单")
|
||||
public AjaxResult getNotRefundOrder(@RequestParam Long userId) {
|
||||
return AjaxResult.success(iXhpcRefundOrderService.getNotRefundOrder(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款订单页列表
|
||||
*/
|
||||
|
||||
@ -37,6 +37,14 @@ public interface XhpcRefundOrderMapper {
|
||||
*/
|
||||
public int updateStatus(XhpcRefundOrder xhpcRefundOrder);
|
||||
|
||||
/**
|
||||
* 修改退款订单审核状态信息
|
||||
*
|
||||
* @param xhpcRefundOrder 退款订单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateExamineStatus(XhpcRefundOrder xhpcRefundOrder);
|
||||
|
||||
/**
|
||||
* 查询退款订单详情
|
||||
*
|
||||
|
||||
@ -47,9 +47,10 @@ public interface IXhpcRefundOrderService {
|
||||
* @param appUserId C端用户id
|
||||
* @param amount 充值金额
|
||||
* @param type 退款渠道(1微信 2支付宝)
|
||||
* @param remark 备注
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid);
|
||||
public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid, String remark);
|
||||
|
||||
/**
|
||||
* 通过用户id查询未完成退款订单
|
||||
@ -57,7 +58,7 @@ public interface IXhpcRefundOrderService {
|
||||
* @param userId 用户id
|
||||
* @return 结果
|
||||
*/
|
||||
public Map<String, Object> addRefundOrder(Long userId);
|
||||
public Map<String, Object> getNotRefundOrder(Long userId);
|
||||
|
||||
/**
|
||||
* 修改退款订单信息
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xhpc.payment.service.impl;
|
||||
|
||||
import com.xhpc.common.core.constant.StatusConstants;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.payment.domain.XhpcRefundAudit;
|
||||
import com.xhpc.payment.domain.XhpcRefundOrder;
|
||||
@ -41,7 +42,8 @@ public class XhpcRefundAuditServiceImpl implements IXhpcRefundAuditService {
|
||||
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
|
||||
xhpcRefundOrder.setRefundOrderId(xhpcRefundAudit.getRefundOrderId());
|
||||
xhpcRefundOrder.setExamineStatus(xhpcRefundAudit.getStatus());
|
||||
int updateStatus = xhpcRefundOrderMapper.updateStatus(xhpcRefundOrder);
|
||||
xhpcRefundOrder.setStatus(StatusConstants.REFUND_ORDER_STATUS_WAIT);
|
||||
int updateStatus = xhpcRefundOrderMapper.updateExamineStatus(xhpcRefundOrder);
|
||||
if (updateStatus == 0) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid) {
|
||||
public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid, String remark) {
|
||||
|
||||
List<Map<String, Object>> list = xhpcRefundOrderMapper.getNotChargeOrder(Long.parseLong(appUserId));
|
||||
if (null != list && list.size() > 0) {
|
||||
@ -97,6 +97,7 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
xhpcRefundOrder.setAmount(amount);
|
||||
xhpcRefundOrder.setRefundOrderNumber(refundOrderNumber);
|
||||
xhpcRefundOrder.setType(Integer.parseInt(type));
|
||||
xhpcRefundOrder.setRemark(remark);
|
||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
xhpcRefundOrder.setOpenId(openid);
|
||||
} else {
|
||||
@ -117,7 +118,7 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> addRefundOrder(Long userId) {
|
||||
public Map<String, Object> getNotRefundOrder(Long userId) {
|
||||
return xhpcRefundOrderMapper.getNotRefundOrder(userId);
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,8 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
|
||||
if (StringUtils.isNotNull(appUserInfo)) {
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
xhpcUserAccountStatement.setRemainingSum(BigDecimal.valueOf(Double.valueOf(balance)));
|
||||
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(BigDecimal.valueOf(Double.valueOf(balance)));
|
||||
xhpcUserAccountStatement.setRemainingSum(surplus);
|
||||
}
|
||||
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
|
||||
}
|
||||
|
||||
@ -143,6 +143,14 @@
|
||||
<set>
|
||||
<if test="null != status">status = #{status},</if>
|
||||
</set>
|
||||
WHERE refund_order_id = #{refundOrderId} and examine_status = 0
|
||||
</update>
|
||||
|
||||
<update id="updateExamineStatus" parameterType="com.xhpc.payment.domain.XhpcRefundOrder">
|
||||
UPDATE xhpc_refund_order
|
||||
<set>
|
||||
<if test="null != status">examine_status = #{examineStatus},</if>
|
||||
</set>
|
||||
WHERE refund_order_id = #{refundOrderId} and status = #{status}
|
||||
</update>
|
||||
|
||||
@ -197,7 +205,7 @@
|
||||
ORDER BY xco.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getNotRefundOrder" parameterType="java.lang.String" resultType="java.util.Map">
|
||||
<select id="getNotRefundOrder" parameterType="java.lang.Long" resultType="java.util.Map">
|
||||
select xro.refund_order_id refundOrderId ,xro.refund_order_number refundOrderNumber,
|
||||
xro.alipay_id alipayId ,xro.open_id openId,xro.user_id userId,xro.amount,
|
||||
xro.type,xro.examine_status examineStatus,xro.`status`,xro.create_time createTime,
|
||||
@ -207,9 +215,9 @@
|
||||
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'refund_order_status' and sdd.dict_value = xro.`status`
|
||||
LEFT JOIN sys_dict_data sdds on sdds.`dict_type` = 'refund_examine_status' and sdds.dict_value =
|
||||
xro.examine_status
|
||||
where xro.del_flag = 0
|
||||
where xro.del_flag = 0 and xro.examine_status = 0 and xro.status = 0
|
||||
<if test="userId != null and userId != ''">
|
||||
and xau.app_user_id = {userId}
|
||||
and xau.app_user_id = #{userId}
|
||||
</if>
|
||||
ORDER BY xro.create_time DESC LIMIT 1
|
||||
</select>
|
||||
|
||||
@ -25,7 +25,7 @@ import java.util.Date;
|
||||
@Aspect
|
||||
@Component
|
||||
@Configuration
|
||||
public class DaoAspect {
|
||||
public class UserDaoAspect {
|
||||
private static final String CREATE_BY = "createBy";
|
||||
private static final String CREATE_TIME = "createTime";
|
||||
private static final String UPDATE_BY = "updateBy";
|
||||
@ -113,11 +113,8 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
if (StringUtils.isEmpty(code)) {
|
||||
return R.fail(HttpStatus.NOT_NULL, "验证码不能为空");
|
||||
}
|
||||
String captcha = redisService.getCacheObject(phone);
|
||||
redisService.deleteObject(phone);
|
||||
|
||||
if (!code.equalsIgnoreCase(captcha))
|
||||
{
|
||||
String captcha = redisService.getCacheObject("pvToken:" + phone);
|
||||
if (!code.equalsIgnoreCase(captcha)) {
|
||||
R.fail(HttpStatus.ERROR_STATUS, "验证码错误");
|
||||
}
|
||||
XhpcAppUser info = xhpcAppUserMapper.getAppUserByPhone(phone);
|
||||
@ -150,13 +147,10 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
if (StringUtils.isEmpty(openid)) {
|
||||
return R.fail(HttpStatus.NOT_NULL, "openid不能为空");
|
||||
}
|
||||
String captcha = redisService.getCacheObject(phone);
|
||||
redisService.deleteObject(phone);
|
||||
if (!code.equalsIgnoreCase(captcha))
|
||||
{
|
||||
String captcha = redisService.getCacheObject("pvToken:" + phone);
|
||||
if (!code.equalsIgnoreCase(captcha)) {
|
||||
R.fail(HttpStatus.ERROR_STATUS, "验证码错误");
|
||||
}
|
||||
|
||||
return appLogin(phone, type, openid);
|
||||
}
|
||||
|
||||
@ -202,6 +196,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
user.setAlipayLogin(UserConstants.LOGIN);
|
||||
}
|
||||
xhpcAppUserMapper.update(user);
|
||||
redisService.deleteObject("pvToken:" + user.getPhone());
|
||||
// 获取登录token
|
||||
return R.ok(tokenService.createToken(userInfo));
|
||||
}
|
||||
@ -288,8 +283,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
if (StringUtils.isEmpty(phone)) {
|
||||
return R.fail(HttpStatus.NOT_NULL, "手机号不能为空");
|
||||
}
|
||||
redisService.deleteObject(phone);
|
||||
String captcha = redisService.getCacheObject(phone);
|
||||
String captcha = redisService.getCacheObject("pvToken:" + phone);
|
||||
if (!code.equalsIgnoreCase(captcha)) {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "验证码错误");
|
||||
}
|
||||
@ -298,6 +292,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "用户不存在");
|
||||
}
|
||||
xhpcAppUserMapper.deleteById(xhpcAppUser.getAppUserId());
|
||||
return R.fail();
|
||||
redisService.deleteObject("pvToken:" + phone);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user