Browse Source

8-21 充值审核通过后首充日期判断

lijianlin/feature-20250728171217-三期金豆消费相关
lijianlin 1 day ago
parent
commit
2070c7657a
  1. 2
      src/main/java/com/example/demo/domain/entity/User.java
  2. 2
      src/main/java/com/example/demo/domain/vo/coin/GoldUser.java
  3. 3
      src/main/java/com/example/demo/mapper/coin/AuditMapper.java
  4. 8
      src/main/java/com/example/demo/serviceImpl/coin/AuditServiceImpl.java
  5. 6
      src/main/resources/mapper/AuditMapper.xml

2
src/main/java/com/example/demo/domain/entity/User.java

@ -57,7 +57,7 @@ public class User implements Serializable {
@ExcelIgnore @ExcelIgnore
private List<String> markets; private List<String> markets;
@ExcelProperty("首充日期") @ExcelProperty("首充日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private Date firstRecharge; // 首充日期 private Date firstRecharge; // 首充日期
@ExcelProperty("创建时间") @ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")

2
src/main/java/com/example/demo/domain/vo/coin/GoldUser.java

@ -54,7 +54,7 @@ public class GoldUser {
@ExcelProperty("消费次数") @ExcelProperty("消费次数")
private Integer consumeNum; // 消费次数 private Integer consumeNum; // 消费次数
@ExcelProperty("首充日期") @ExcelProperty("首充日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private Date firstRecharge; // 首充日期 private Date firstRecharge; // 首充日期
private List<String> markets; // 地区列表 private List<String> markets; // 地区列表
} }

3
src/main/java/com/example/demo/mapper/coin/AuditMapper.java

@ -7,6 +7,7 @@ import com.example.demo.domain.vo.coin.RefundAudit;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -43,4 +44,6 @@ public interface AuditMapper {
//获取审核人id对应的人名 //获取审核人id对应的人名
String getName(Integer auditId); String getName(Integer auditId);
//更新首充日期
void updateFirstRecharge(Integer jwcode);
} }

8
src/main/java/com/example/demo/serviceImpl/coin/AuditServiceImpl.java

@ -20,7 +20,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List; import java.util.List;
/** /**
@ -103,8 +105,10 @@ public class AuditServiceImpl implements AuditService {
2.用户当前首充时间小于当前时间 2.用户当前首充时间小于当前时间
3.用户当前首充时间等于2020-01-01 00:00:00 3.用户当前首充时间等于2020-01-01 00:00:00
*/ */
if(oldFirstRecharge== null || oldFirstRecharge.after(date) || "2020-01-01 00:00:00".equals(oldFirstRecharge.toString())){
update.setFirstRecharge(date);//设置首充时间为当前时间
// 构造 2020-01-01 00:00:00
Date placeholder = new GregorianCalendar(2020, Calendar.JANUARY, 1, 0, 0).getTime();
if(oldFirstRecharge== null||oldFirstRecharge.after(date)||placeholder.equals(oldFirstRecharge)){
auditMapper.updateFirstRecharge(order.getJwcode());//设置首充时间为当前时间
} }
auditMapper.updateUserGold(update); auditMapper.updateUserGold(update);
//erp增加充值数据 //erp增加充值数据

6
src/main/resources/mapper/AuditMapper.xml

@ -25,6 +25,7 @@
current_task_gold = current_task_gold + COALESCE(#{currentTaskGold},0), current_task_gold = current_task_gold + COALESCE(#{currentTaskGold},0),
recharge_num = recharge_num+COALESCE(#{rechargeNum},0) recharge_num = recharge_num+COALESCE(#{rechargeNum},0)
where jwcode = #{jwcode} where jwcode = #{jwcode}
</update> </update>
<!--修改消费订单为已退款--> <!--修改消费订单为已退款-->
@ -33,6 +34,11 @@
set is_refund = #{isRefund} set is_refund = #{isRefund}
where order_code = #{orderCode} where order_code = #{orderCode}
</update> </update>
<update id="updateFirstRecharge">
update user
set first_recharge = NOW()
where jwcode = #{jwcode}
</update>
<!--根据订单号查未审核订单--> <!--根据订单号查未审核订单-->
<select id="selectOrderByOrderCode" resultType="com.example.demo.domain.entity.UserGoldRecord"> <select id="selectOrderByOrderCode" resultType="com.example.demo.domain.entity.UserGoldRecord">

Loading…
Cancel
Save