提交 2356676f authored 作者: liruixin's avatar liruixin

Merge remote-tracking branch 'origin/v5.5_settlement_20231011' into v5.5_settlement_20231011

package com.clx.performance.param.open;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@ApiModel(description = "货主绑卡")
@Getter
@Setter
@ToString
@NoArgsConstructor
public class OpenOwnerBindCardParam {
@ApiModelProperty(value = "货主编号")
private Long userNo;
@ApiModelProperty(value = "货主姓名")
private String name;
@ApiModelProperty(value = "所属银行")
private String ownerAccountBank;
@ApiModelProperty(value = "开户行")
private String ownerOpenBank;
@ApiModelProperty(value = "户名")
private String ownerAccountName;
@ApiModelProperty(value = "银行账户")
private String ownerBankAccount;
}
package com.clx.performance.param.open;
import com.msl.common.convertor.type.MoneyInConvert;
import com.msl.common.convertor.type.MoneyOutConvert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.math.BigDecimal;
@ApiModel(description = "货主提现")
@Getter
@Setter
@ToString
@NoArgsConstructor
public class OpenOwnerCaseOutParam {
@ApiModelProperty(value = "货主用户编号", example = "123")
private Long ownerUserNo;
@ApiModelProperty(value = "提现金额(元)", example = "1.23")
@MoneyInConvert
private BigDecimal caseOutBalance;
@ApiModelProperty(value = "账户类型: 1:保证金 2:预付运费", example = "1")
private Integer accountType;
@ApiModelProperty(value = "提现银行", example = "浙江银行")
private String caseOutBank;
@ApiModelProperty(value = "提现银行卡号", example = "62213545878787")
private String caseOutBankNumber;
}
\ No newline at end of file
package com.clx.performance.param.open;
import com.msl.common.convertor.type.MoneyInConvert;
import com.msl.common.convertor.type.MoneyOutConvert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.math.BigDecimal;
@ApiModel(description = "货主充值")
@Getter
@Setter
@ToString
@NoArgsConstructor
public class OpenOwnerTopUpParam {
@ApiModelProperty(value = "货主用户编号", example = "123")
private Long ownerUserNo;
@ApiModelProperty(value = "充值金额(元)", example = "1.23")
@MoneyInConvert
private BigDecimal topUpBalance;
@ApiModelProperty(value = "账户类型: 1:保证金 2:预付运费", example = "1")
private Integer accountType;
@ApiModelProperty(value = "打款银行", example = "浙江银行")
private String drawingBank;
@ApiModelProperty(value = "打款银行卡号", example = "62213545878787")
private String drawingBankNumber;
@ApiModelProperty(value = "打款凭证", example = "/a.png")
private String drawingProof;
}
\ No newline at end of file
package com.clx.performance.param.pc; package com.clx.performance.param.pc;
import com.msl.common.convertor.type.MoneyInConvert;
import com.msl.common.convertor.type.MoneyOutConvert; import com.msl.common.convertor.type.MoneyOutConvert;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -22,7 +23,7 @@ public class OwnerCaseOutParam { ...@@ -22,7 +23,7 @@ public class OwnerCaseOutParam {
private Long ownerUserNo; private Long ownerUserNo;
@ApiModelProperty(value = "提现金额(元)", example = "1.23") @ApiModelProperty(value = "提现金额(元)", example = "1.23")
@MoneyOutConvert @MoneyInConvert
private BigDecimal caseOutBalance; private BigDecimal caseOutBalance;
@ApiModelProperty(value = "账户类型: 1:保证金 2:预付运费", example = "1") @ApiModelProperty(value = "账户类型: 1:保证金 2:预付运费", example = "1")
......
package com.clx.performance.param.pc; package com.clx.performance.param.pc;
import com.msl.common.convertor.type.MoneyInConvert;
import com.msl.common.convertor.type.MoneyOutConvert; import com.msl.common.convertor.type.MoneyOutConvert;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -22,7 +23,7 @@ public class OwnerTopUpParam { ...@@ -22,7 +23,7 @@ public class OwnerTopUpParam {
private Long ownerUserNo; private Long ownerUserNo;
@ApiModelProperty(value = "充值金额(元)", example = "1.23") @ApiModelProperty(value = "充值金额(元)", example = "1.23")
@MoneyOutConvert @MoneyInConvert
private BigDecimal topUpBalance; private BigDecimal topUpBalance;
@ApiModelProperty(value = "账户类型: 1:保证金 2:预付运费", example = "1") @ApiModelProperty(value = "账户类型: 1:保证金 2:预付运费", example = "1")
......
package com.clx.performance.param.pc.owner;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@NoArgsConstructor
@ToString
public class CreteAccountParam {
private Long userNo;
private String name;
private String mobile;
}
package com.clx.performance.param.pc.owner;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.math.BigDecimal;
@Getter
@Setter
@NoArgsConstructor
@ToString
public class FrozenAccountParam {
private Long userNo;
private String mobile;
private String ownerName;
private BigDecimal frozenBalance;
private BigDecimal ensureBalance;
private Integer orderId;
private String orderNo;
}
...@@ -68,6 +68,6 @@ public class OwnerAccountVO { ...@@ -68,6 +68,6 @@ public class OwnerAccountVO {
private LocalDateTime createTime; private LocalDateTime createTime;
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private LocalDateTime modifyTime; private LocalDateTime modifiedTime;
} }
\ No newline at end of file
...@@ -101,6 +101,6 @@ public class OwnerCaseOutVO { ...@@ -101,6 +101,6 @@ public class OwnerCaseOutVO {
* 修改时间 * 修改时间
*/ */
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private LocalDateTime modifyTime; private LocalDateTime modifiedTime;
} }
\ No newline at end of file
package com.clx.performance.controller.open;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.model.OwnerTransferInfo;
import com.clx.performance.param.open.OpenOwnerBindCardParam;
import com.clx.performance.param.open.OpenOwnerCaseOutParam;
import com.clx.performance.param.open.OpenOwnerTopUpParam;
import com.clx.performance.param.pc.*;
import com.clx.performance.param.pc.owner.CreteAccountParam;
import com.clx.performance.param.pc.owner.FrozenAccountParam;
import com.clx.performance.service.*;
import com.clx.performance.vo.pc.*;
import com.clx.user.vo.pc.owner.OwnerBindCardVO;
import com.msl.common.base.PageData;
import com.msl.common.convertor.aspect.UnitCovert;
import com.msl.common.result.Result;
import com.msl.user.data.UserSessionData;
import com.msl.user.utils.TokenUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/open/owner")
@Validated
@AllArgsConstructor
@Api(tags = "PC-货主资金管理")
public class OpenOwnerAccountController {
private final OwnerAccountService ownerAccountService;
@ApiOperation(value = "账户充值", notes = "<br>By:胡宇帆")
@PostMapping("/accountTopUp")
@UnitCovert(param = false)
public Result<Long> openAccountTopUp(@RequestBody OpenOwnerTopUpParam param) {
Long id = ownerAccountService.openAccountTopUp(param);
return Result.ok(id);
}
@ApiOperation(value = "账户提现", notes = "<br>By:胡宇帆")
@PostMapping("/accountCaseOut")
@UnitCovert(param = false)
public Result<Long> accountCaseOut(@RequestBody OpenOwnerCaseOutParam param) {
Long id = ownerAccountService.openAccountCaseOut(param);
return Result.ok(id);
}
@ApiOperation(value = "获取货主信息绑卡信息", notes = "<br>By:胡宇帆")
@GetMapping("/getOwnerBindCard")
public Result<OwnerBindCardVO> getOwnerBindCard(@RequestParam Long userNo) {
return Result.ok(ownerAccountService.getOwnerBindCard(userNo));
}
@ApiOperation(value = "绑定货主银行卡")
@PostMapping({"/bindOwnerBindCard"})
Result<Object> openBindOwnerBindCard(@RequestBody OpenOwnerBindCardParam param) {
ownerAccountService.openBindOwnerBindCard(param);
return Result.ok();
}
@ApiOperation(value = "解绑货主银行卡")
@PostMapping({"/unBindOwnerBindCard"})
Result<Object> unBindOwnerBindCard(@RequestBody OpenOwnerBindCardParam param) {
ownerAccountService.openUnBindOwnerBindCard(param);
return Result.ok();
}
}
package com.clx.performance.controller.pc.owner; package com.clx.performance.controller.pc.owner;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.enums.OwnerAccountEnum;
import com.clx.performance.model.OwnerTransferInfo; import com.clx.performance.model.OwnerTransferInfo;
import com.clx.performance.param.pc.*; import com.clx.performance.param.pc.*;
import com.clx.performance.param.pc.owner.CreteAccountParam;
import com.clx.performance.param.pc.owner.FrozenAccountParam;
import com.clx.performance.service.*; import com.clx.performance.service.*;
import com.clx.performance.vo.pc.*; import com.clx.performance.vo.pc.*;
import com.clx.user.feign.OwnerInfoFeign; import com.clx.user.feign.OwnerInfoFeign;
...@@ -26,7 +29,10 @@ import org.springframework.web.bind.annotation.*; ...@@ -26,7 +29,10 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@RestController @RestController
...@@ -50,10 +56,10 @@ public class OwnerAccountController { ...@@ -50,10 +56,10 @@ public class OwnerAccountController {
@ApiOperation(value = "账户信息", notes = "<br>By:胡宇帆") @ApiOperation(value = "账户信息", notes = "<br>By:胡宇帆")
@GetMapping("/accountInfo") @GetMapping("/accountInfo")
@UnitCovert(param = false) @UnitCovert(param = false)
public Result<List<OwnerAccountVO>> accountInfo() { public Result<Map> accountInfo() {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo(); UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
List<OwnerAccountVO> accountVOList = ownerAccountService.accountInfo(loginUserInfo.getUserNo()); Map<String,OwnerAccountVO> result = ownerAccountService.accountInfo(loginUserInfo.getUserNo());
return Result.ok(accountVOList); return Result.ok(result);
} }
@ApiOperation(value = "货主充值记录列表", notes = "<br>By:胡宇帆") @ApiOperation(value = "货主充值记录列表", notes = "<br>By:胡宇帆")
...@@ -161,11 +167,16 @@ public class OwnerAccountController { ...@@ -161,11 +167,16 @@ public class OwnerAccountController {
} }
@ApiOperation(value = "冻结保证金", notes = "<br>By:胡宇帆") @ApiOperation(value = "冻结保证金", notes = "<br>By:胡宇帆")
@PostMapping("/ownerBindCardPageList11") @PostMapping("/ownerAccountFrozen")
public Result<Object> ownerAccountFrozen(Long ownerUserNo) { public Result<Object> ownerAccountFrozen(FrozenAccountParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo(); ownerAccountService.ownerAccountFrozen(param);
ownerAccountService.ownerAccountFrozen(ownerUserNo); return Result.ok();
}
@ApiOperation(value = "创建账户", notes = "<br>By:胡宇帆")
@PostMapping("/createAccount")
public Result<Object> createAccount(CreteAccountParam param) {
ownerAccountService.createAccount(param);
return Result.ok(); return Result.ok();
} }
} }
...@@ -17,5 +17,8 @@ public interface OwnerAccountDao extends BaseDao<OwnerAccountMapper, OwnerAccoun ...@@ -17,5 +17,8 @@ public interface OwnerAccountDao extends BaseDao<OwnerAccountMapper, OwnerAccoun
OwnerAccount getAccountByOwnerUserNoAndAccountType(Long ownerUserNo, Integer accountType); OwnerAccount getAccountByOwnerUserNoAndAccountType(Long ownerUserNo, Integer accountType);
int updateAccount(OwnerAccount account, LocalDateTime now); int updateOwnerAccountForConfirm(OwnerAccount account);
int updateAccountCAS(OwnerAccount account, LocalDateTime now, boolean flag);
} }
...@@ -37,14 +37,19 @@ public class OwnerAccountDaoImpl extends BaseDaoImpl<OwnerAccountMapper, OwnerAc ...@@ -37,14 +37,19 @@ public class OwnerAccountDaoImpl extends BaseDaoImpl<OwnerAccountMapper, OwnerAc
return baseMapper.selectOne(lQrWrapper().eq(OwnerAccount::getAccountType, accountType).eq(OwnerAccount::getOwnerUserNo, ownerUserNo)); return baseMapper.selectOne(lQrWrapper().eq(OwnerAccount::getAccountType, accountType).eq(OwnerAccount::getOwnerUserNo, ownerUserNo));
} }
@Override
public int updateOwnerAccountForConfirm(OwnerAccount account) {
return baseMapper.updateOwnerAccountForConfirm(account);
}
@Override @Override
public int updateAccount(OwnerAccount account, LocalDateTime now) { public int updateAccountCAS(OwnerAccount account, LocalDateTime now, boolean flag) {
return baseMapper.updateAccount(account, now); if (flag) {
// if (flag) { return baseMapper.addAccount(account, now);
// baseMapper.addAccount(account, now); } else {
// } else { return baseMapper.subAccount(account, now);
// baseMapper.subAccount(account, now); }
// }
} }
......
...@@ -22,9 +22,12 @@ public interface OwnerAccountMapper extends BaseMapper<OwnerAccount> { ...@@ -22,9 +22,12 @@ public interface OwnerAccountMapper extends BaseMapper<OwnerAccount> {
@SelectProvider(type = OwnerAccountSqlProvider.class, method = "pageList") @SelectProvider(type = OwnerAccountSqlProvider.class, method = "pageList")
IPage<OwnerAccountVO> pageList(Page<OwnerAccountVO> page, PageOwnerAccountListParam param); IPage<OwnerAccountVO> pageList(Page<OwnerAccountVO> page, PageOwnerAccountListParam param);
@SelectProvider(type = OwnerAccountSqlProvider.class, method = "updateAccount") @SelectProvider(type = OwnerAccountSqlProvider.class, method = "addAccount")
int updateAccount(OwnerAccount account, LocalDateTime now); int addAccount(OwnerAccount account, LocalDateTime now);
// @SelectProvider(type = OwnerAccountSqlProvider.class, method = "subAccount") @SelectProvider(type = OwnerAccountSqlProvider.class, method = "subAccount")
// int subAccount(OwnerAccount account, LocalDateTime now); int subAccount(OwnerAccount account, LocalDateTime now);
@SelectProvider(type = OwnerAccountSqlProvider.class, method = "updateOwnerAccountForConfirm")
int updateOwnerAccountForConfirm(OwnerAccount account);
} }
\ No newline at end of file
...@@ -17,5 +17,5 @@ import org.apache.ibatis.annotations.SelectProvider; ...@@ -17,5 +17,5 @@ import org.apache.ibatis.annotations.SelectProvider;
public interface OwnerBindCardRecordMapper extends BaseMapper<OwnerBindCardRecord> { public interface OwnerBindCardRecordMapper extends BaseMapper<OwnerBindCardRecord> {
@SelectProvider(type = OwnerBindCardRecordSqlProvider.class, method = "ownerBindCardPageList") @SelectProvider(type = OwnerBindCardRecordSqlProvider.class, method = "ownerBindCardPageList")
IPage<OwnerBindCardRecordVO> ownerBindCardPageList(PageOwnerBindCardRecordListParam param); IPage<OwnerBindCardRecordVO> ownerBindCardPageList(Page<OwnerBindCardRecordVO> page,PageOwnerBindCardRecordListParam param);
} }
\ No newline at end of file
...@@ -43,7 +43,7 @@ public class OwnerAccount implements HasKey<Integer> { ...@@ -43,7 +43,7 @@ public class OwnerAccount implements HasKey<Integer> {
* 联系电话 * 联系电话
*/ */
@TableField("mobile") @TableField("mobile")
private Integer mobile; private String mobile;
/** /**
* 账户类型;1:保证金 2:预付运费 * 账户类型;1:保证金 2:预付运费
*/ */
...@@ -75,8 +75,8 @@ public class OwnerAccount implements HasKey<Integer> { ...@@ -75,8 +75,8 @@ public class OwnerAccount implements HasKey<Integer> {
@TableField("create_time") @TableField("create_time")
private LocalDateTime createTime; private LocalDateTime createTime;
@TableField("modify_time") @TableField("modified_time")
private LocalDateTime modifyTime; private LocalDateTime modifiedTime;
@KeyColumn("id") @KeyColumn("id")
@Override @Override
......
...@@ -110,8 +110,8 @@ public class OwnerCaseOut implements HasKey<Integer> { ...@@ -110,8 +110,8 @@ public class OwnerCaseOut implements HasKey<Integer> {
/** /**
* 修改时间 * 修改时间
*/ */
@TableField("modify_time") @TableField("modified_time")
private LocalDateTime modifyTime; private LocalDateTime modifiedTime;
@Override @Override
@KeyColumn("id") @KeyColumn("id")
......
...@@ -32,7 +32,7 @@ public class OwnerTopUp implements HasKey<Integer> { ...@@ -32,7 +32,7 @@ public class OwnerTopUp implements HasKey<Integer> {
/** /**
* 充值编号 * 充值编号
*/ */
@TableField("owner_no") @TableField("top_up_no")
private Long topUpNo; private Long topUpNo;
/** /**
* 货主编码 * 货主编码
......
...@@ -2,7 +2,12 @@ package com.clx.performance.service; ...@@ -2,7 +2,12 @@ package com.clx.performance.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.model.OwnerTransferInfo; import com.clx.performance.model.OwnerTransferInfo;
import com.clx.performance.param.open.OpenOwnerBindCardParam;
import com.clx.performance.param.open.OpenOwnerCaseOutParam;
import com.clx.performance.param.open.OpenOwnerTopUpParam;
import com.clx.performance.param.pc.*; import com.clx.performance.param.pc.*;
import com.clx.performance.param.pc.owner.CreteAccountParam;
import com.clx.performance.param.pc.owner.FrozenAccountParam;
import com.clx.performance.vo.pc.OwnerAccountRunningWaterRecordVO; import com.clx.performance.vo.pc.OwnerAccountRunningWaterRecordVO;
import com.clx.performance.vo.pc.OwnerAccountVO; import com.clx.performance.vo.pc.OwnerAccountVO;
import com.clx.user.param.pc.owner.UpdateOwnerBindCardFeignParam; import com.clx.user.param.pc.owner.UpdateOwnerBindCardFeignParam;
...@@ -10,6 +15,7 @@ import com.clx.user.vo.pc.owner.OwnerBindCardVO; ...@@ -10,6 +15,7 @@ import com.clx.user.vo.pc.owner.OwnerBindCardVO;
import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import java.util.List; import java.util.List;
import java.util.Map;
public interface OwnerAccountService { public interface OwnerAccountService {
IPage<OwnerAccountVO> pageList(PageOwnerAccountListParam param); IPage<OwnerAccountVO> pageList(PageOwnerAccountListParam param);
...@@ -18,12 +24,16 @@ public interface OwnerAccountService { ...@@ -18,12 +24,16 @@ public interface OwnerAccountService {
IPage<OwnerAccountRunningWaterRecordVO> prepaidFreightAccountPageList(PagePlatformPrepaidFreightAccountParam param); IPage<OwnerAccountRunningWaterRecordVO> prepaidFreightAccountPageList(PagePlatformPrepaidFreightAccountParam param);
List<OwnerAccountVO> accountInfo(Long ownerUserNo); Map<String,OwnerAccountVO> accountInfo(Long ownerUserNo);
Long accountTopUp(OwnerTopUpParam param); Long accountTopUp(OwnerTopUpParam param);
Long openAccountTopUp(OpenOwnerTopUpParam param);
Long accountCaseOut(OwnerCaseOutParam param); Long accountCaseOut(OwnerCaseOutParam param);
Long openAccountCaseOut(OpenOwnerCaseOutParam param);
/** /**
* 充值审批 * 充值审批
*/ */
...@@ -61,7 +71,15 @@ public interface OwnerAccountService { ...@@ -61,7 +71,15 @@ public interface OwnerAccountService {
void bindOwnerBindCard(OwnerBindCardParam param); void bindOwnerBindCard(OwnerBindCardParam param);
void openBindOwnerBindCard(OpenOwnerBindCardParam param);
void unBindOwnerBindCard(OwnerBindCardParam param); void unBindOwnerBindCard(OwnerBindCardParam param);
void ownerAccountFrozen(Long ownerUserNo); void openUnBindOwnerBindCard(OpenOwnerBindCardParam param);
void ownerAccountFrozen(FrozenAccountParam param);
void createAccount(CreteAccountParam param);
} }
package com.clx.performance.service.impl; package com.clx.performance.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.component.IdGenerateSnowFlake; import com.clx.performance.component.IdGenerateSnowFlake;
import com.clx.performance.dao.*; import com.clx.performance.dao.*;
...@@ -7,7 +9,12 @@ import com.clx.performance.enums.IdTypeEnum; ...@@ -7,7 +9,12 @@ import com.clx.performance.enums.IdTypeEnum;
import com.clx.performance.enums.OwnerAccountEnum; import com.clx.performance.enums.OwnerAccountEnum;
import com.clx.performance.enums.PerformanceResultEnum; import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.model.*; import com.clx.performance.model.*;
import com.clx.performance.param.open.OpenOwnerBindCardParam;
import com.clx.performance.param.open.OpenOwnerCaseOutParam;
import com.clx.performance.param.open.OpenOwnerTopUpParam;
import com.clx.performance.param.pc.*; import com.clx.performance.param.pc.*;
import com.clx.performance.param.pc.owner.CreteAccountParam;
import com.clx.performance.param.pc.owner.FrozenAccountParam;
import com.clx.performance.service.OwnerAccountService; import com.clx.performance.service.OwnerAccountService;
import com.clx.performance.struct.OwnerAccountStruct; import com.clx.performance.struct.OwnerAccountStruct;
import com.clx.performance.utils.excel.ExcelData; import com.clx.performance.utils.excel.ExcelData;
...@@ -35,9 +42,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -35,9 +42,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.LinkedList;
import java.util.List;
@Slf4j @Slf4j
@Service @Service
...@@ -78,8 +83,17 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -78,8 +83,17 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
} }
@Override @Override
public List<OwnerAccountVO> accountInfo(Long ownerUserNo) { public Map<String,OwnerAccountVO> accountInfo(Long ownerUserNo) {
return ownerAccountStruct.convertList(ownerAccountDao.accountInfo(ownerUserNo)); Map<String,OwnerAccountVO> result = new HashMap<>(2);
List<OwnerAccountVO> list = ownerAccountStruct.convertList(ownerAccountDao.accountInfo(ownerUserNo));
for (OwnerAccountVO ownerAccountVO : list) {
if (OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode().equals(ownerAccountVO.getAccountType())) {
result.put("marginAccount", ownerAccountVO);
} else {
result.put("prepaidFreightAccount", ownerAccountVO);
}
}
return result;
} }
@Override @Override
...@@ -99,11 +113,78 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -99,11 +113,78 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
return entity.getTopUpNo(); return entity.getTopUpNo();
} }
public Long openAccountTopUp(OpenOwnerTopUpParam param) {
OwnerTopUp entity = new OwnerTopUp();
entity.setAccountType(param.getAccountType());
entity.setOwnerUserNo(param.getOwnerUserNo());
entity.setTopUpBalance(param.getTopUpBalance());
entity.setStatus(OwnerAccountEnum.TopUpStatus.PENDING.getCode());
entity.setDrawingBank(param.getDrawingBank());
entity.setDrawingBankNumber(param.getDrawingBankNumber());
entity.setDrawingProof(param.getDrawingProof());
//充值编号
entity.setTopUpNo(idGenerateSnowFlake.nextId(IdTypeEnum.Type.TOP_UP.getCode()));
ownerTopUpDao.saveEntity(entity);
return entity.getTopUpNo();
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long accountCaseOut(OwnerCaseOutParam param) { public Long accountCaseOut(OwnerCaseOutParam param) {
BigDecimal caseOutBalance = param.getCaseOutBalance(); BigDecimal caseOutBalance = param.getCaseOutBalance();
LocalDateTime now = LocalDateTime.now();
while (true) {
//冻结账户可用金额
OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(param.getOwnerUserNo(), param.getAccountType());
if (account.getUsableBalance().compareTo(caseOutBalance) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前用户可用余额不足,无法提现");
}
OwnerAccount update = new OwnerAccount();
update.setUsableBalance(caseOutBalance);
update.setFrozenBalance(caseOutBalance);
update.setAccountBalance(caseOutBalance);
update.setModifiedTime(account.getModifiedTime());
update.setId(account.getId());
int flag = ownerAccountDao.updateAccountCAS(update, now, false);
if (flag > 0) {
break;
}
}
//提现记录
OwnerCaseOut entity = new OwnerCaseOut();
entity.setAccountType(param.getAccountType());
entity.setCaseOutNo(idGenerateSnowFlake.nextId(IdTypeEnum.Type.CASE_OUT.getCode()));
entity.setOwnerUserNo(param.getOwnerUserNo());
entity.setStatus(OwnerAccountEnum.CaseOutStatus.PENDING_PAYMENT.getCode());
entity.setCaseOutBank(param.getCaseOutBank());
entity.setCaseOutBankNumber(param.getCaseOutBankNumber());
ownerCaseOutDao.saveEntity(entity);
//插入冻结流水
OwnerRunningWaterRecord runningWaterRecord = new OwnerRunningWaterRecord();
runningWaterRecord.setOwnerName("测试");
runningWaterRecord.setMobile("11111111111");
runningWaterRecord.setCreateBy("操作人测试");
runningWaterRecord.setRelationId(entity.getCaseOutNo());
runningWaterRecord.setAccountBalance(caseOutBalance);
runningWaterRecord.setOwnerUserNo(param.getOwnerUserNo());
runningWaterRecord.setAccountType(param.getAccountType());
runningWaterRecord.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode());
runningWaterRecord.setRunningWaterNo(idGenerateSnowFlake.nextId(IdTypeEnum.Type.CASE_OUT_FROZEN.getCode()));
ownerRunningWaterRecordDao.saveEntity(runningWaterRecord);
return entity.getCaseOutNo();
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long openAccountCaseOut(OpenOwnerCaseOutParam param) {
BigDecimal caseOutBalance = param.getCaseOutBalance();
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
while (true) { while (true) {
//冻结账户可用金额 //冻结账户可用金额
...@@ -111,9 +192,9 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -111,9 +192,9 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
OwnerAccount update = new OwnerAccount(); OwnerAccount update = new OwnerAccount();
update.setUsableBalance(caseOutBalance.negate()); update.setUsableBalance(caseOutBalance.negate());
update.setFrozenBalance(caseOutBalance); update.setFrozenBalance(caseOutBalance);
update.setModifyTime(account.getModifyTime()); update.setModifiedTime(account.getModifiedTime());
update.setId(account.getId()); update.setId(account.getId());
int flag = ownerAccountDao.updateAccount(update, now); int flag = ownerAccountDao.updateAccountCAS(update, now, false);
if (flag > 0) { if (flag > 0) {
break; break;
} }
...@@ -172,8 +253,8 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -172,8 +253,8 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
update.setAccountBalance(topUpBalance); update.setAccountBalance(topUpBalance);
update.setUsableBalance(topUpBalance); update.setUsableBalance(topUpBalance);
update.setId(account.getId()); update.setId(account.getId());
update.setModifyTime(account.getModifyTime()); update.setModifiedTime(account.getModifiedTime());
int flag = ownerAccountDao.updateAccount(update, now); int flag = ownerAccountDao.updateAccountCAS(update, now, true);
if (flag > 0) { if (flag > 0) {
break; break;
} }
...@@ -219,6 +300,8 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -219,6 +300,8 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
@Override @Override
public void accountBalanceConfirm(Integer id) { public void accountBalanceConfirm(Integer id) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
Optional<OwnerCaseOut> optional = ownerCaseOutDao.getEntityByKey(id); Optional<OwnerCaseOut> optional = ownerCaseOutDao.getEntityByKey(id);
if (!optional.isPresent()) { if (!optional.isPresent()) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前ID未查询到有效记录"); throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前ID未查询到有效记录");
...@@ -231,19 +314,24 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -231,19 +314,24 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
} }
//给对应账户减少金额 //给对应账户减少金额
OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(ownerCaseOut.getOwnerUserNo(), ownerCaseOut.getAccountType()); while (true) {
OwnerAccount update = new OwnerAccount(); OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(ownerCaseOut.getOwnerUserNo(), ownerCaseOut.getAccountType());
update.setAccountBalance(account.getAccountBalance().subtract(caseOutBalance)); OwnerAccount update = new OwnerAccount();
update.setUsableBalance(account.getUsableBalance().subtract(caseOutBalance)); update.setFrozenBalance(caseOutBalance);
update.setFrozenBalance(account.getFrozenBalance().subtract(caseOutBalance)); update.setId(account.getId());
update.setId(account.getId()); update.setModifiedTime(account.getModifiedTime());
ownerAccountDao.updateEntityByKey(update); int flag = ownerAccountDao.updateOwnerAccountForConfirm(update);
if (flag > 0) {
break;
}
}
//插入提现成功流水 //插入提现成功流水
OwnerRunningWaterRecord runningWaterRecord = new OwnerRunningWaterRecord(); OwnerRunningWaterRecord runningWaterRecord = new OwnerRunningWaterRecord();
runningWaterRecord.setOwnerName("测试"); runningWaterRecord.setOwnerName(loginUserInfo.getUserName());
runningWaterRecord.setMobile("11111111111"); runningWaterRecord.setMobile(loginUserInfo.getUserMobile());
runningWaterRecord.setCreateBy("操作人"); runningWaterRecord.setCreateBy(loginUserInfo.getUserName());
runningWaterRecord.setRelationId(ownerCaseOut.getCaseOutNo()); runningWaterRecord.setRelationId(ownerCaseOut.getCaseOutNo());
runningWaterRecord.setAccountBalance(caseOutBalance); runningWaterRecord.setAccountBalance(caseOutBalance);
...@@ -392,7 +480,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -392,7 +480,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
if (!result.succeed()) { if (!result.succeed()) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前参数未查询到有效数据"); throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前参数未查询到有效数据");
} }
if (result.succeed() && StringUtils.isNotBlank(result.getData().getOwnerAccountBank())) { if (result.succeed() && ObjectUtil.isNotNull(result.getData()) && StringUtils.isNotBlank(result.getData().getOwnerAccountBank())) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主存在绑定银行卡,请先解绑银行卡后再进行绑定操作"); throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主存在绑定银行卡,请先解绑银行卡后再进行绑定操作");
} }
...@@ -416,6 +504,37 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -416,6 +504,37 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
ownerBindCardRecordDao.saveEntity(record); ownerBindCardRecordDao.saveEntity(record);
} }
@Override
public void openBindOwnerBindCard(OpenOwnerBindCardParam param) {
Result<OwnerBindCardVO> result = ownerInfoFeign.getOwnerInfoVO(param.getUserNo());
if (!result.succeed()) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前参数未查询到有效数据");
}
if (result.succeed() && ObjectUtil.isNotNull(result.getData()) && StringUtils.isNotBlank(result.getData().getOwnerAccountBank())) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主存在绑定银行卡,请先解绑银行卡后再进行绑定操作");
}
UpdateOwnerBindCardFeignParam feignParam = new UpdateOwnerBindCardFeignParam();
feignParam.setUserNo(param.getUserNo());
feignParam.setOwnerAccountBank(param.getOwnerAccountBank());
feignParam.setOwnerAccountName(param.getOwnerAccountName());
feignParam.setOwnerBankAccount(param.getOwnerBankAccount());
feignParam.setOwnerOpenBank(param.getOwnerOpenBank());
ownerInfoFeign.bindOwnerBindCard(feignParam);
OwnerBindCardRecord record = new OwnerBindCardRecord();
record.setOwnerUserNo(param.getUserNo());
record.setOwnerUserName(param.getName());
record.setCreateItem("绑定银行卡");
record.setOwnerBank(param.getOwnerAccountBank());
record.setOpenAccountBank(param.getOwnerAccountBank());
record.setAccountBankName(param.getOwnerAccountName());
record.setBankCardNumber(param.getOwnerBankAccount());
record.setCreateBy("曹做人");
ownerBindCardRecordDao.saveEntity(record);
}
@Override @Override
public void unBindOwnerBindCard(OwnerBindCardParam param) { public void unBindOwnerBindCard(OwnerBindCardParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo(); UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
...@@ -442,48 +561,72 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -442,48 +561,72 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
ownerInfoFeign.unBindOwnerBindCard(feignParam); ownerInfoFeign.unBindOwnerBindCard(feignParam);
} }
@Override
public void openUnBindOwnerBindCard(OpenOwnerBindCardParam param) {
Result<OwnerBindCardVO> result = ownerInfoFeign.getOwnerInfoVO(param.getUserNo());
if (!result.succeed()) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前参数未查询到有效数据");
}
OwnerBindCardRecord record = new OwnerBindCardRecord();
//record.setOwnerType(param.getOwnerType());
record.setOwnerUserNo(param.getUserNo());
record.setCreateItem("解绑银行卡");
record.setOwnerBank(param.getOwnerAccountBank());
record.setOpenAccountBank(param.getOwnerAccountBank());
record.setAccountBankName(param.getOwnerAccountName());
record.setCreateBy(param.getName());
ownerBindCardRecordDao.saveEntity(record);
UpdateOwnerBindCardFeignParam feignParam = new UpdateOwnerBindCardFeignParam();
feignParam.setUserNo(param.getUserNo());
// feignParam.setOwnerAccountBank(param.getOwnerAccountBank());
// feignParam.setOwnerAccountName(param.getOwnerAccountName());
// feignParam.setOwnerBankAccount(param.getOwnerBankAccount());
// feignParam.setOwnerOpenBank(param.getOwnerOpenBank());
ownerInfoFeign.unBindOwnerBindCard(feignParam);
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void ownerAccountFrozen(Long ownerUserNo) { public void ownerAccountFrozen(FrozenAccountParam param) {
String mobile = ""; String mobile = param.getMobile();
String ownerName = ""; Long userNo = param.getUserNo();
BigDecimal frozenBalance = new BigDecimal(12); String ownerName = param.getOwnerName();
BigDecimal ensureBalance = new BigDecimal(14); BigDecimal frozenBalance = param.getFrozenBalance();
Integer orderId = 9; BigDecimal ensureBalance = param.getEnsureBalance();
String orderNo = "123"; Integer orderId = param.getOrderId();
String orderNo = param.getOrderNo();
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
//List<OwnerAccount> updateList = new LinkedList<>();
while (true) { while (true) {
int flag = 0; int flag = 0;
//updateList.clear(); List<OwnerAccount> accountList = ownerAccountDao.accountInfo(userNo);
List<OwnerAccount> accountList = ownerAccountDao.accountInfo(ownerUserNo);
for (OwnerAccount ownerAccount : accountList) { for (OwnerAccount ownerAccount : accountList) {
OwnerAccount entity = new OwnerAccount(); OwnerAccount entity = new OwnerAccount();
entity.setAccountType(ownerAccount.getAccountType()); entity.setAccountType(ownerAccount.getAccountType());
entity.setId(ownerAccount.getId()); entity.setId(ownerAccount.getId());
entity.setModifyTime(ownerAccount.getModifyTime()); entity.setModifiedTime(ownerAccount.getModifiedTime());
if (ownerAccount.getAccountType().equals(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode())) { if (ownerAccount.getAccountType().equals(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode())) {
if (ownerAccount.getUsableBalance().compareTo(frozenBalance) < 0) { if (ownerAccount.getUsableBalance().compareTo(frozenBalance) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主保证金账户可用余额不够冻结"); throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主保证金账户可用余额不够冻结");
} }
//冻结金额 //冻结金额
entity.setFrozenBalance(ownerAccount.getFrozenBalance().subtract(frozenBalance)); entity.setFrozenBalance(frozenBalance);
//可用余额 //可用余额
entity.setUsableBalance(ownerAccount.getUsableBalance().subtract(frozenBalance)); entity.setUsableBalance(frozenBalance);
//updateList.add(entity); //updateList.add(entity);
flag += ownerAccountDao.updateAccount(entity, now); flag += ownerAccountDao.updateAccountCAS(entity, now, false);
} else { } else {
if (ownerAccount.getUsableBalance().compareTo(ensureBalance) < 0) { if (ownerAccount.getUsableBalance().compareTo(ensureBalance) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主预付运费账户可用余额不够冻结"); throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主预付运费账户可用余额不够冻结");
} }
//冻结金额 //冻结金额
entity.setFrozenBalance(ownerAccount.getFrozenBalance().subtract(ensureBalance)); entity.setFrozenBalance(ensureBalance);
//可用余额 //可用余额
entity.setUsableBalance(ownerAccount.getUsableBalance().subtract(ensureBalance)); entity.setUsableBalance(ensureBalance);
//updateList.add(entity); //updateList.add(entity);
flag += ownerAccountDao.updateAccount(entity, now); flag += ownerAccountDao.updateAccountCAS(entity, now, false);
} }
} }
if (flag == 2) { if (flag == 2) {
...@@ -501,7 +644,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -501,7 +644,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
marginAccount.setRelationId(null); marginAccount.setRelationId(null);
marginAccount.setAccountBalance(ensureBalance); marginAccount.setAccountBalance(ensureBalance);
marginAccount.setOwnerUserNo(ownerUserNo); marginAccount.setOwnerUserNo(userNo);
marginAccount.setAccountType(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode()); marginAccount.setAccountType(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode());
marginAccount.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode()); marginAccount.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode());
...@@ -518,7 +661,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -518,7 +661,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
prepaidFreight.setRelationId(null); prepaidFreight.setRelationId(null);
prepaidFreight.setAccountBalance(frozenBalance); prepaidFreight.setAccountBalance(frozenBalance);
prepaidFreight.setOwnerUserNo(ownerUserNo); prepaidFreight.setOwnerUserNo(userNo);
prepaidFreight.setAccountType(OwnerAccountEnum.AccountTypeStatus.PREPAID_FREIGHT_ACCOUNT.getCode()); prepaidFreight.setAccountType(OwnerAccountEnum.AccountTypeStatus.PREPAID_FREIGHT_ACCOUNT.getCode());
prepaidFreight.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode()); prepaidFreight.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode());
...@@ -527,4 +670,21 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -527,4 +670,21 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void createAccount(CreteAccountParam param) {
List<OwnerAccount> accountList = ownerAccountDao.accountInfo(param.getUserNo());
if (CollectionUtil.isNotEmpty(accountList)) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主已创建账户");
}
OwnerAccount ownerAccount = new OwnerAccount();
ownerAccount.setAccountType(OwnerAccountEnum.AccountTypeStatus.PREPAID_FREIGHT_ACCOUNT.getCode());
ownerAccount.setOwnerUserName(param.getName());
ownerAccount.setOwnerUserNo(param.getUserNo());
ownerAccount.setMobile(param.getMobile());
ownerAccountDao.saveEntity(ownerAccount);
ownerAccount.setAccountType(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode());
ownerAccountDao.saveEntity(ownerAccount);
}
} }
...@@ -5,6 +5,7 @@ import com.clx.order.enums.OrderEnum; ...@@ -5,6 +5,7 @@ import com.clx.order.enums.OrderEnum;
import com.clx.performance.model.OrderGoods; import com.clx.performance.model.OrderGoods;
import com.clx.performance.model.OwnerAccount; import com.clx.performance.model.OwnerAccount;
import com.clx.performance.param.pc.PageOwnerAccountListParam; import com.clx.performance.param.pc.PageOwnerAccountListParam;
import com.msl.common.utils.DateUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL; import org.apache.ibatis.jdbc.SQL;
...@@ -37,29 +38,39 @@ public class OwnerAccountSqlProvider { ...@@ -37,29 +38,39 @@ public class OwnerAccountSqlProvider {
return sql; return sql;
} }
public String updateAccount(OwnerAccount account, LocalDateTime now) { public String addAccount(OwnerAccount account, LocalDateTime now) {
StringBuffer sqlList = new StringBuffer(); StringBuffer sqlList = new StringBuffer();
sqlList.append("update owner_account set usable_balance = usable_balance +" + sqlList.append("update owner_account set usable_balance = usable_balance +" +
account.getUsableBalance() + ",frozen_balance = frozen_balance +" account.getUsableBalance() + ",account_balance = account_balance +"
+ account.getUsableBalance() + ",account_balance = account_balance +"
+ account.getAccountBalance()+ + account.getAccountBalance()+
",modify_time=" + now ",modified_time='" + DateUtils.formatDateTime(now, "yyyy-MM-dd HH:mm:ss") +"'"
+ "where id = " + account.getId() + "and modify_time = " + account.getModifyTime() + " where id = " + account.getId() + " and modified_time = '" + DateUtils.formatDateTime(account.getModifiedTime(), "yyyy-MM-dd HH:mm:ss").get()+"'"
);
return sqlList.toString();
}
public String subAccount(OwnerAccount account, LocalDateTime now) {
StringBuffer sqlList = new StringBuffer();
sqlList.append("update owner_account set usable_balance = usable_balance -" +
account.getUsableBalance() + ",frozen_balance = frozen_balance +"
+ account.getFrozenBalance() +",account_balance = account_balance -" + account.getFrozenBalance()
+ ",modified_time='" + DateUtils.formatDateTime(now, "yyyy-MM-dd HH:mm:ss").get()+"'"
+ " where id = " + account.getId() + " and modified_time = '" + DateUtils.formatDateTime(account.getModifiedTime(), "yyyy-MM-dd HH:mm:ss").get()+"'"
);
return sqlList.toString();
}
public String updateOwnerAccountForConfirm(OwnerAccount account) {
StringBuffer sqlList = new StringBuffer();
sqlList.append("update owner_account set frozen_balance = frozen_balance -" +
account.getFrozenBalance()
+ "where id = " + account.getId() + "and modified_time = '" + DateUtils.formatDateTime(account.getModifiedTime(), "yyyy-MM-dd HH:mm:ss").get()+"'"
); );
return sqlList.toString(); return sqlList.toString();
} }
//
// public String subAccount(OwnerAccount account, LocalDateTime now) {
// StringBuffer sqlList = new StringBuffer();
//
// sqlList.append("update owner_account set usable_balance = usable_balance -" +
// account.getUsableBalance() + ",frozen_balance = frozen_balance -"
// + account.getUsableBalance() + ",modify_time=" + now
// + "where id = " + account.getId() + "and modify_time = " + account.getModifyTime()
// );
//
// return sqlList.toString();
// }
} }
package com.clx.performance.sqlProvider; package com.clx.performance.sqlProvider;
import com.clx.performance.param.pc.PageOwnerAccountListParam; import com.clx.performance.param.pc.PageOwnerBindCardRecordListParam;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL; import org.apache.ibatis.jdbc.SQL;
public class OwnerBindCardRecordSqlProvider { public class OwnerBindCardRecordSqlProvider {
public String ownerBindCardPageList(@Param("param") PageOwnerAccountListParam param) { public String ownerBindCardPageList(@Param("param") PageOwnerBindCardRecordListParam param) {
String sql = new SQL() {{ String sql = new SQL() {{
SELECT("a.id, a.owner_user_no," + SELECT("a.id, a.owner_user_no," +
" a.owner_user_name, a.owner_type, a.owner_bank, " + " a.owner_user_name, a.owner_type, a.owner_bank, " +
......
...@@ -13,7 +13,7 @@ public class OwnerCaseOutProvider { ...@@ -13,7 +13,7 @@ public class OwnerCaseOutProvider {
String sql = new SQL() {{ String sql = new SQL() {{
SELECT("a.id, a.owner_user_no," + SELECT("a.id, a.owner_user_no," +
" a.case_out_no, a.case_out_balance, a.account_type, " + " a.case_out_no, a.case_out_balance, a.account_type, " +
" a.status,a.case_out_bank,a.case_out_bank_number,a.payment_time,a.create_by,a.platform_payment_bank_number,a.platform_payment_bank,a.payment_by,a.payment_proof,a.create_time,a.modify_time"); " a.status,a.case_out_bank,a.case_out_bank_number,a.payment_time,a.create_by,a.platform_payment_bank_number,a.platform_payment_bank,a.payment_by,a.payment_proof,a.create_time,a.modified_time");
FROM("owner_case_out a"); FROM("owner_case_out a");
if (StringUtils.isNotBlank(param.getBeginTime()) && StringUtils.isNotBlank(param.getEndTime())) { if (StringUtils.isNotBlank(param.getBeginTime()) && StringUtils.isNotBlank(param.getEndTime())) {
WHERE("a.create_time >= #{param.beginTime} and a.create_time <= #{param.endTime}"); WHERE("a.create_time >= #{param.beginTime} and a.create_time <= #{param.endTime}");
......
...@@ -13,7 +13,7 @@ public class OwnerTopUpProvider { ...@@ -13,7 +13,7 @@ public class OwnerTopUpProvider {
String sql = new SQL() {{ String sql = new SQL() {{
SELECT("a.id, a.owner_user_no," + SELECT("a.id, a.owner_user_no," +
" a.top_up_no, a.top_up_balance, a.account_type, " + " a.top_up_no, a.top_up_balance, a.account_type, " +
" a.status,a.drawing_bank, a.drawing_bank_number,a.drawing_proof,a.approval_time,a.approval_by,a.approval_turn_down,a.create_by,a.create_time,a.modify_time"); " a.status,a.drawing_bank, a.drawing_bank_number,a.drawing_proof,a.approval_time,a.approval_by,a.approval_turn_down,a.create_by,a.create_time,a.modified_time");
FROM("owner_top_up a"); FROM("owner_top_up a");
if (StringUtils.isNotBlank(param.getBeginTime()) && StringUtils.isNotBlank(param.getEndTime())) { if (StringUtils.isNotBlank(param.getBeginTime()) && StringUtils.isNotBlank(param.getEndTime())) {
WHERE("a.create_time >= #{param.beginTime} and a.create_time <= #{param.endTime}"); WHERE("a.create_time >= #{param.beginTime} and a.create_time <= #{param.endTime}");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论