Browse Source

11-11 收款实体类与操作数据库表修改

sunjiabei/feature-20251021102635-银行接口
lijianlin 2 weeks ago
parent
commit
4320c60db2
  1. 4
      src/main/java/com/example/demo/controller/cash/CashCollectionController.java
  2. 2
      src/main/java/com/example/demo/domain/vo/cash/CashCollection.java
  3. 3
      src/main/java/com/example/demo/mapper/cash/CashAuditMapper.java
  4. 4
      src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java
  5. 4
      src/main/java/com/example/demo/service/cash/CashCollectionService.java
  6. 3
      src/main/java/com/example/demo/serviceImpl/cash/CashAuditServiceImpl.java
  7. 4
      src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java
  8. 6
      src/main/java/com/example/demo/serviceImpl/coin/AdminServiceImpl.java
  9. 68
      src/main/resources/cashMapper/CashCollectionMapper.xml

4
src/main/java/com/example/demo/controller/cash/CashCollectionController.java

@ -78,7 +78,7 @@ public class CashCollectionController {
}
//重新提交审核的收款订单
@PostMapping("/reSubmit")
public Result reSubmit(@RequestBody CashRecord cashRecord) {
public Result reSubmit(@RequestBody CashCollection cashRecord) {
try {
return Result.success(cashCollectionService.reSubmit(cashRecord));
}catch (Exception e){
@ -113,7 +113,7 @@ public class CashCollectionController {
}}
//补全手续费等
@PostMapping("/complete")
public Result complete(@RequestBody CashRecord cashRecord) {
public Result complete(@RequestBody CashCollection cashRecord) {
try {
return Result.success(cashCollectionService.complete(cashRecord));
}catch (Exception e){

2
src/main/java/com/example/demo/domain/vo/cash/CashCollection.java

@ -61,7 +61,7 @@ public class CashCollection implements Serializable {
private String remark; // 备注
private String receivedRemark; //到账备注
private String rejectReason; // 驳回理由
private String auditId; //审核人id
private Integer auditId; //审核人id
private String auditName; //审核人id
private Integer cashRoleId; //角色id(0客服1地区财务/负责人2总部)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")

3
src/main/java/com/example/demo/mapper/cash/CashAuditMapper.java

@ -1,6 +1,7 @@
package com.example.demo.mapper.cash;
import com.example.demo.domain.entity.CashRecord;
import com.example.demo.domain.vo.cash.CashCollection;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -15,7 +16,7 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface CashAuditMapper {
//审核收款订单
void updateOrder (CashRecord updateOrder);
void updateOrder (CashCollection updateOrder);
//根据id获取审核人姓名
String getAuditName(Integer auditId);
}

4
src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java

@ -34,7 +34,7 @@ public interface CashCollectionMapper {
@Param("status") Integer status);
//编辑订单
// 编辑订单状态=5后重新提交
int updateByOrderCode(@Param("cashRecord") CashRecord cashRecord);
int updateByOrderCode(@Param("cashRecordCollection") CashCollection cashRecord);
//多条件查询收款订单列表
List<CashCollection> selectCollection1(@Param("pageNum") Integer pageNum,
@Param("pageSize") Integer pageSize,
@ -43,7 +43,7 @@ public interface CashCollectionMapper {
//根据订单号查询待审核的现金收款订单
CashRecord selectAuditByOrderCode(@Param("orderCode") String orderCode);
//补全手续费等信息
int complete(@Param("cashRecord") CashRecord cashRecord);
int complete(@Param("cashRecordCollection") CashCollection cashRecord);
//根据精网号获取姓名
String getNameByJwcode(@Param("jwcode") Integer jwcode);
//根据精网号获取市场名

4
src/main/java/com/example/demo/service/cash/CashCollectionService.java

@ -24,11 +24,11 @@ public interface CashCollectionService {
//撤回未审核的收款订单
String cancel(String orderCode);
//编辑并重新提交收款订单
String reSubmit(CashRecord cashRecord);
String reSubmit(CashCollection cashRecord);
//多条件查询收款订单列表
PageInfo<CashCollection> selectCollection(Integer pageNum, Integer pageSize, CashCollection cashCollection);
//补全手续费等
String complete(CashRecord cashRecord);
String complete(CashCollection cashRecord);
//根据精网号获取姓名和地区
User getNameAndMarket(Integer jwcode);
//获取活动列表

3
src/main/java/com/example/demo/serviceImpl/cash/CashAuditServiceImpl.java

@ -4,6 +4,7 @@ import com.example.demo.Util.GoldTistV2;
import com.example.demo.domain.entity.CashRecord;
import com.example.demo.domain.entity.User;
import com.example.demo.domain.entity.UserGoldRecord;
import com.example.demo.domain.vo.cash.CashCollection;
import com.example.demo.mapper.cash.CashAuditMapper;
import com.example.demo.mapper.cash.CashCollectionMapper;
import com.example.demo.mapper.coin.AuditMapper;
@ -46,7 +47,7 @@ public class CashAuditServiceImpl implements CashAuditService {
){
throw new IllegalArgumentException("订单不存在或已被审核");
}
CashRecord updateOrder = new CashRecord();
CashCollection updateOrder = new CashCollection();
//设置审核人
updateOrder.setAuditId(auditId);
//判断是通过还是驳回更新审核状态

4
src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java

@ -133,7 +133,7 @@ public class CashCollectionServiceImpl implements CashCollectionService {
//编辑并重新提交收款订单
@Override
public String reSubmit(CashRecord cashRecord) {
public String reSubmit(CashCollection cashRecord) {
if (cashRecord.getJwcode()==null){
throw new IllegalArgumentException("精网号不能为空");
}
@ -232,7 +232,7 @@ public class CashCollectionServiceImpl implements CashCollectionService {
}
//补全手续费等内容
@Override
public String complete(CashRecord cashRecord) {
public String complete(CashCollection cashRecord) {
int rows = cashCollectionMapper.complete(cashRecord);

6
src/main/java/com/example/demo/serviceImpl/coin/AdminServiceImpl.java

@ -94,7 +94,6 @@ public class AdminServiceImpl implements AdminService {
//更新密码
@Override
public Result updatePassword(Password password) {
String oldPassword = password.getOldPassword();
String newPassword = password.getNewPassword();
String againPassword = password.getAgainPassword();
@ -129,15 +128,15 @@ public class AdminServiceImpl implements AdminService {
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
// 使用Spring管理的密码编码器不要手动new
String encodedPassword = passwordEncoder.encode(newPassword);
// 更新数据库中的密码
admin.setPassword(encodedPassword);
admin.setUpdateTime(new Date()); // 更新修改时间
adminMapper.updatePassword(admin);
return Result.success("密码修改成功");
} catch (BadCredentialsException e) {
// 旧密码验证失败
return Result.error("原密码错误,请重新输入");
@ -182,6 +181,7 @@ public class AdminServiceImpl implements AdminService {
}
//获取当前登录的管理员账号
public String getCurrentAdminAccount() {
// 1. Security 上下文获取认证信息
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

68
src/main/resources/cashMapper/CashCollectionMapper.xml

@ -6,7 +6,7 @@
<insert id="add" parameterType="com.example.demo.domain.entity.CashRecord"
useGeneratedKeys="true" keyProperty="id">
insert into
cash_record(order_type,jwcode,name,market,activity,
cash_record_collection(order_type,jwcode,name,market,activity,
order_code,goods_name,good_num,num_unit,permanent_gold,free_gold,
payment_currency,payment_amount,received_market,
pay_type,pay_time,status,submitter_id,submitter_market,
@ -29,58 +29,58 @@
<!--更新订单状态-->
<update id="updateStatus">
update cash_record
update cash_record_collection
set status=#{status}
where order_code=#{orderCode}
</update>
<!--更新订单-->
<update id="updateByOrderCode">
UPDATE cash_record
UPDATE cash_record_collection
<set>
jwcode = #{cashRecord.jwcode},
name = #{cashRecord.name},
market = #{cashRecord.market},
activity = #{cashRecord.activity},
goods_name = #{cashRecord.goodsName},
good_num = #{cashRecord.goodNum},
num_unit = #{cashRecord.NumUnit},
permanent_gold = #{cashRecord.permanentGold},
free_gold = #{cashRecord.freeGold},
Num_unit = #{cashRecord.NumUnit},
payment_currency = #{cashRecord.paymentCurrency},
payment_amount = #{cashRecord.paymentAmount},
received_market = #{cashRecord.receivedMarket},
pay_type = #{cashRecord.payType},
pay_time = #{cashRecord.payTime},
voucher = #{cashRecord.voucher},
remark = #{cashRecord.remark},
jwcode = #{cashRecordCollection.jwcode},
name = #{cashRecordCollection.name},
market = #{cashRecordCollection.market},
activity = #{cashRecordCollection.activity},
goods_name = #{cashRecordCollection.goodsName},
good_num = #{cashRecordCollection.goodNum},
num_unit = #{cashRecordCollection.NumUnit},
permanent_gold = #{cashRecordCollection.permanentGold},
free_gold = #{cashRecordCollection.freeGold},
Num_unit = #{cashRecordCollection.NumUnit},
payment_currency = #{cashRecordCollection.paymentCurrency},
payment_amount = #{cashRecordCollection.paymentAmount},
received_market = #{cashRecordCollection.receivedMarket},
pay_type = #{cashRecordCollection.payType},
pay_time = #{cashRecordCollection.payTime},
voucher = #{cashRecordCollection.voucher},
remark = #{cashRecordCollection.remark},
status = 0,
</set>
WHERE order_code = #{cashRecord.orderCode}
WHERE order_code = #{cashRecordCollection.orderCode}
AND status = 5
</update>
<!--补全手续费等字段-->
<update id="complete">
UPDATE cash_record
UPDATE cash_record_collection
<set>
<if test="cashRecord.handlingCharge != null ">
handling_charge = #{cashRecord.handlingCharge},
handling_charge = #{cashRecordCollection.handlingCharge},
</if>
<if test="cashRecord.receivedCurrency != null and cashRecord.receivedCurrency != ''">
received_currency = #{cashRecord.receivedCurrency},
received_currency = #{cashRecordCollection.receivedCurrency},
</if>
<if test="cashRecord.receivedAmount != null and cashRecord.receivedAmount != ''">
received_amount = #{cashRecord.receivedAmount},
received_amount = #{cashRecordCollection.receivedAmount},
</if>
<if test="cashRecord.receivedTime != null">
received_time = #{cashRecord.receivedTime},
received_time = #{cashRecordCollection.receivedTime},
</if>
<if test="cashRecord.paymentCurrency != null and cashRecord.paymentCurrency != ''">
payment_currency = #{cashRecord.paymentCurrency},
payment_currency = #{cashRecordCollection.paymentCurrency},
</if>
<!-- 关键:null 就不拼这一列 -->
<if test="cashRecord.paymentAmount != null">
payment_amount = #{cashRecord.paymentAmount},
payment_amount = #{cashRecordCollection.paymentAmount},
</if>
<!-- 只有 这些字段全部非空才更新状态 -->
status = CASE
@ -95,7 +95,7 @@
ELSE status
END
</set>
WHERE order_code = #{cashRecord.orderCode}
WHERE order_code = #{cashRecordCollection.orderCode}
AND status IN (1, 3)
</update>
<!--设置gOrder订单为已同步-->
@ -131,7 +131,7 @@
cr.audit_id,cr.create_time,cr.update_time,cr.audit_time,
a1.admin_name as submitterName,
a2.admin_name as auditName
from cash_record cr
from cash_record_collection cr
left join admin a1 on cr.submitter_id = a1.id
left join admin a2 on cr.audit_id = a2.id
left join market m1 on m1.id = cr.market
@ -213,11 +213,11 @@
</choose>
</select>
<select id="selectAuditByOrderCode" resultType="com.example.demo.domain.entity.CashRecord">
select cash_record.id,jwcode,name,market,ra.activity_name as activity,
select crc.id,jwcode,name,market,ra.activity_name as activity,
order_code,bank_code,goods_name,good_num,num_unit,permanent_gold,free_gold,
payment_currency,payment_amount,pay_type,pay_time,cash_record.status,submitter_id,
payment_currency,payment_amount,pay_type,pay_time,crc.status,submitter_id,
voucher,remark
from cash_record
from cash_record_collection crc
left join recharge_activity ra on ra.id = cash_record.activity
where order_code=#{orderCode}
</select>
@ -249,7 +249,7 @@
cr.pay_type,cr.received_market,cr.pay_time,cr.received_time,cr.audit_id,cr.status,cr.submitter_id,
cr.submitter_market,cr.voucher,cr.remark,cr.audit_time,a1.admin_name as submitterName,
a2.admin_name as auditName,ra.activity_name as activity
from cash_record cr
from cash_record_collection cr
left join admin a1 on cr.submitter_id = a1.id
left join admin a2 on cr.audit_id = a2.id
left join recharge_activity ra on ra.id = cr.activity

Loading…
Cancel
Save