Commit 091b64cb by 陶光胜

Merge branch 'developer' into 'master'

Developer

See merge request !8
parents 0d8fc5f1 c0318cea
......@@ -8,6 +8,10 @@ package com.gic.finance.constant;
*/
public enum WithdrawalStatusEnum {
/**
* 提审
*/
NEW(0, "提审"),
/**
* 待审核
*/
TO_BE_EXAMINE(1, "待审核"),
......@@ -48,6 +52,18 @@ public enum WithdrawalStatusEnum {
return "未知";
}
public static WithdrawalStatusEnum getEnumByCode(Integer code) {
if (code == null) {
return null;
}
for (WithdrawalStatusEnum typeEnum : values()) {
if (code.intValue() == typeEnum.getCode()) {
return typeEnum;
}
}
return null;
}
public int getCode() {
return code;
}
......
......@@ -30,36 +30,45 @@ public class OperationUserInfoDTO implements Serializable{
return id;
}
public void setId(Integer id) {
public OperationUserInfoDTO setId(Integer id) {
this.id = id;
return this;
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
public OperationUserInfoDTO setLoginName(String loginName) {
this.loginName = loginName;
return this;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
public OperationUserInfoDTO setRealName(String realName) {
this.realName = realName;
return this;
}
public String getUserMobile() {
return userMobile;
}
public void setUserMobile(String userMobile) {
public OperationUserInfoDTO setUserMobile(String userMobile) {
this.userMobile = userMobile;
return this;
}
@Override
public String toString() {
return super.toString();
return "OperationUserInfoDTO{" +
"id=" + id +
", loginName='" + loginName + '\'' +
", realName='" + realName + '\'' +
", userMobile='" + userMobile + '\'' +
'}';
}
}
......@@ -12,13 +12,6 @@ import java.util.List;
* @date 2020/9/11 11:36 AM

*/
public interface TabCashWithdrawalMapper {
/**
* 根据主键删除
*
* @param cashWithdrawalId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer cashWithdrawalId);
/**
* 插入一条记录
......
......@@ -11,13 +11,7 @@ import java.util.List;
* @date 2020/9/11 11:35 AM

*/
public interface TabInvoiceAccountMapper {
/**
* 根据主键删除
*
* @param invoiceAccountId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer invoiceAccountId);
/**
* 插入一条记录
......
......@@ -13,13 +13,7 @@ import java.util.List;
* @date 2020/9/11 11:35 AM

*/
public interface TabInvoiceManageMapper {
/**
* 根据主键删除
*
* @param invoiceManageId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer invoiceManageId);
/**
* 插入一条记录
......
......@@ -12,13 +12,6 @@ import java.util.List;
* @date 2020/9/11 11:36 AM

*/
public interface TabPayAccountMapper {
/**
* 根据主键删除
*
* @param payAccountId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer payAccountId);
/**
* 插入一条记录
......
......@@ -14,13 +14,7 @@ import java.util.List;
* @date 2020/9/11 11:33 AM

*/
public interface TabTransferAccountsApprovalMapper {
/**
* 根据主键删除
*
* @param transferApprovalId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer transferApprovalId);
/**
* 插入一条记录
......
......@@ -60,6 +60,8 @@ public class TabInvoiceAccount {
*/
private Date updateTime;
private Integer deleteFlag;
public Integer getInvoiceAccountId() {
return invoiceAccountId;
}
......@@ -139,4 +141,13 @@ public class TabInvoiceAccount {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public TabInvoiceAccount setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
return this;
}
}
\ No newline at end of file
......@@ -55,6 +55,8 @@ public class TabPayAccount {
*/
private Date updateTime;
private Integer deleteFlag;
public Integer getPayAccountId() {
return payAccountId;
}
......@@ -126,4 +128,13 @@ public class TabPayAccount {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public TabPayAccount setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
return this;
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.gic.finance.dao.mapper.TabInvoiceAccountMapper;
import com.gic.finance.dto.InvoiceAccountDTO;
import com.gic.finance.entity.TabInvoiceAccount;
import com.gic.finance.service.InvoiceAccountService;
import com.gic.finance.util.DeleteFlagConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -23,7 +24,9 @@ public class InvoiceAccountServiceImpl implements InvoiceAccountService{
private TabInvoiceAccountMapper tabInvoiceAccountMapper;
@Override
public void save(InvoiceAccountDTO dto) {
tabInvoiceAccountMapper.insert(EntityUtil.changeEntityNew(TabInvoiceAccount.class, dto));
TabInvoiceAccount record = EntityUtil.changeEntityNew(TabInvoiceAccount.class, dto);
record.setDeleteFlag(DeleteFlagConstants.NORMAL_STATUS);
tabInvoiceAccountMapper.insert(record);
}
@Override
......
......@@ -3,6 +3,7 @@ package com.gic.finance.service.impl;
import java.util.Date;
import java.util.List;
import com.gic.finance.util.DeleteFlagConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -25,7 +26,9 @@ public class PayAccountServiceImpl implements PayAccountService {
@Override
public int save(PayAccountDTO dto) {
return tabPayAccountMapper.insert(EntityUtil.changeEntityNew(TabPayAccount.class, dto));
TabPayAccount record = EntityUtil.changeEntityNew(TabPayAccount.class, dto);
record.setDeleteFlag(DeleteFlagConstants.NORMAL_STATUS);
return tabPayAccountMapper.insert(record);
}
@Override
......
......@@ -2,6 +2,7 @@ package com.gic.finance.service.outer.impl;
import java.util.Date;
import com.gic.finance.util.cashwithdrawal.StateHandler;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -37,38 +38,17 @@ public class CashWithdrawalApiServiceImpl implements CashWithdrawalApiService{
private CashWithdrawalService cashWithdrawalService;
@Autowired
private PayAccountService payAccountService;
/**
* 提现申请
* @Title: cashWithdrawal

* @Description:

 * @author guojuxing
* @param dto

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


 */
private ServiceResponse<String> cashWithdrawal(CashWithdrawalDTO dto) {
ServiceResponse paramValid = ValidParamsUtils.allCheckValidate(dto, CashWithdrawalDTO.CashWithdrawal.class);
if (!paramValid.isSuccess()) {
return paramValid;
}
dto.setCreateTime(new Date());
dto.setUpdateTime(new Date());
dto.setCashWithdrawalStatus(WithdrawalStatusEnum.TO_BE_EXAMINE.getCode());
//流水号
dto.setCashWithdrawalSerialNumber(CreateRandomUtils.createSerialNumber());
cashWithdrawalService.save(dto);
return ServiceResponse.success(dto.getCashWithdrawalSerialNumber());
}
@Override
public ServiceResponse<String> cashWithdrawalOfServiceProvider(CashWithdrawalDTO dto) {
dto.setApplyType(WithdrawalApplyTypeEnum.SERVICE_PROVIDER.getCode());
return cashWithdrawal(dto);
return StateHandler.cashWithdrawal(WithdrawalStatusEnum.NEW, dto);
}
@Override
public ServiceResponse<String> cashWithdrawalOfSupplier(CashWithdrawalDTO dto) {
dto.setApplyType(WithdrawalApplyTypeEnum.SUPPLIER.getCode());
return cashWithdrawal(dto);
return StateHandler.cashWithdrawal(WithdrawalStatusEnum.NEW, dto);
}
@Override
......@@ -95,15 +75,9 @@ public class CashWithdrawalApiServiceImpl implements CashWithdrawalApiService{
if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "参数有误,无此记录");
}
if (record.getCashWithdrawalStatus().intValue() == WithdrawalStatusEnum.CANCEL.getCode()) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已取消");
}
// 操作人相关信息
getOperationUserInfo(record, dto);
record.setCashWithdrawalStatus(WithdrawalStatusEnum.PASS.getCode());
cashWithdrawalService.update(record);
return ServiceResponse.success();
return StateHandler.approval(WithdrawalStatusEnum.getEnumByCode(record.getCashWithdrawalStatus()), record);
}
@Override
......@@ -117,57 +91,25 @@ public class CashWithdrawalApiServiceImpl implements CashWithdrawalApiService{
@Override
public ServiceResponse<Void> reject(Integer id, String rejectReason, OperationUserInfoDTO dto) {
if (StringUtils.isBlank(rejectReason)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "驳回理由不能为空");
}
TabCashWithdrawal record = cashWithdrawalService.getById(id);
if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "参数有误,无此记录");
}
if (record.getCashWithdrawalStatus().intValue() == WithdrawalStatusEnum.CANCEL.getCode()) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已取消");
}
// 操作人相关信息
getOperationUserInfo(record, dto);
record.setCashWithdrawalStatus(WithdrawalStatusEnum.REJECT.getCode());
record.setRejectReason(rejectReason);
cashWithdrawalService.update(record);
//回调
AsyncCallbackUtils.callBack(record, "com.gic.open.api.service.market.PayCallbackApiService", "callbackWithdraw");
return ServiceResponse.success();
return StateHandler.reject(WithdrawalStatusEnum.getEnumByCode(record.getCashWithdrawalStatus()), record);
}
@Override
public ServiceResponse<Void> pay(Integer id, Integer payId, String bankSerialNumber) {
if (StringUtils.isBlank(bankSerialNumber)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "银行流水号不能为空");
}
TabCashWithdrawal record = cashWithdrawalService.getById(id);
if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "参数有误,无此申请单记录");
}
TabPayAccount account = payAccountService.getById(payId);
if (account == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "无此打款户信息记录,请前往添加");
}
//todo 操作人相关信息
record.setOperatorTime(new Date());
record.setPayId(payId);
record.setPayAccount(account.getBankAccount());
record.setPayAccountBank(account.getBank());
record.setPayAccountBranchName(account.getBranchName());
record.setPayAccountName(account.getAccountName());
record.setBankSerialNumber(bankSerialNumber);
record.setCashWithdrawalStatus(WithdrawalStatusEnum.COMPLETE.getCode());
cashWithdrawalService.update(record);
//回调
AsyncCallbackUtils.callBack(record, "com.gic.open.api.service.market.PayCallbackApiService", "callbackWithdraw");
return ServiceResponse.success();
record.setPayId(payId);
return StateHandler.complete(WithdrawalStatusEnum.getEnumByCode(record.getCashWithdrawalStatus()), record);
}
@Override
......@@ -183,12 +125,7 @@ public class CashWithdrawalApiServiceImpl implements CashWithdrawalApiService{
if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "提现流水号错误,查无数据");
}
if (record.getCashWithdrawalStatus().intValue() != WithdrawalStatusEnum.TO_BE_EXAMINE.getCode()) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已审批,不能取消");
}
record.setCashWithdrawalStatus(WithdrawalStatusEnum.CANCEL.getCode());
cashWithdrawalService.update(record);
return ServiceResponse.success();
return StateHandler.cancel(WithdrawalStatusEnum.getEnumByCode(record.getCashWithdrawalStatus()), record);
}
private void getOperationUserInfo(TabCashWithdrawal record, OperationUserInfoDTO userInfo) {
......
package com.gic.finance.util;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* Spring ApplicationContext 工具类
* @ClassName: ApplicationContextUtils

* @Description: 

* @author guojuxing

* @date 2020/11/11 10:22 AM

*/
@Component
public class ApplicationContextUtils implements ApplicationContextAware{
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
ApplicationContextUtils.applicationContext = applicationContext;
}
public static <T> T getBean(String beanName) {
if (applicationContext.containsBean(beanName)) {
return (T) applicationContext.getBean(beanName);
}
return null;
}
public static <T> T getBean(Class<T> clazz) {
return applicationContext.getBean(clazz);
}
}
package com.gic.finance.util;
/**
* 数据删除标志常量
* @ClassName: DeleteFlagConstants

* @Description: 

* @author guojuxing

* @date 2020/10/13 4:12 PM

*/
public class DeleteFlagConstants {
/**
* 数据正常状态
*/
public static final int NORMAL_STATUS = 0;
/**
* 数据删除状态
*/
public static final int DELETE_STATUS = 1;
}
package com.gic.finance.util.cashwithdrawal;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.finance.dto.CashWithdrawalDTO;
import com.gic.finance.entity.TabCashWithdrawal;
import com.gic.finance.service.CashWithdrawalService;
/**
* 体现状态抽象
* @ClassName: AbstractState

* @Description: 

* @author guojuxing

* @date 2020/11/6 10:18 AM

*/
public abstract class AbstractState {
/**
* 提现申请
* @Title: cashWithdrawal

* @Description:

* @author guojuxing
* @param dto

* @return com.gic.api.base.commons.ServiceResponse<java.lang.String>


*/
public abstract ServiceResponse<String> cashWithdrawal(CashWithdrawalDTO dto);
/**
* 审核通过
* @param record
* @return
*/
public abstract ServiceResponse<Void> approval(TabCashWithdrawal record);
/**
* 审核拒绝
* @param record
* @return
*/
public abstract ServiceResponse<Void> reject(TabCashWithdrawal record);
/**
* 审核取消
* @param record
* @return
*/
public abstract ServiceResponse<Void> cancel(TabCashWithdrawal record);
/**
* 完成(打款成功)
* @param record
* @return
*/
public abstract ServiceResponse<Void> complete(TabCashWithdrawal record);
}
package com.gic.finance.util.cashwithdrawal;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.finance.constant.WithdrawalStatusEnum;
import com.gic.finance.dto.CashWithdrawalDTO;
import com.gic.finance.entity.TabCashWithdrawal;
import com.gic.finance.util.ApplicationContextUtils;
import com.gic.finance.util.cashwithdrawal.event.*;
/**
* 提现调用
* @ClassName: StateHandler

* @Description: 

* @author guojuxing

* @date 2020/11/6 1:41 PM

*/
public class StateHandler {
private static Map<WithdrawalStatusEnum, AbstractState> stateMap = new ConcurrentHashMap<>(16);
static {
stateMap.put(WithdrawalStatusEnum.NEW, ApplicationContextUtils.getBean(CashWithdrawalState.class));
stateMap.put(WithdrawalStatusEnum.TO_BE_EXAMINE, ApplicationContextUtils.getBean(CheckAuthState.class));
stateMap.put(WithdrawalStatusEnum.CANCEL, ApplicationContextUtils.getBean(CancelState.class));
stateMap.put(WithdrawalStatusEnum.REJECT, ApplicationContextUtils.getBean(RejectState.class));
stateMap.put(WithdrawalStatusEnum.PASS, ApplicationContextUtils.getBean(ApprovalState.class));
stateMap.put(WithdrawalStatusEnum.COMPLETE, ApplicationContextUtils.getBean(CompleteState.class));
}
public static ServiceResponse<String> cashWithdrawal(WithdrawalStatusEnum state, CashWithdrawalDTO dto) {
return stateMap.get(state).cashWithdrawal(dto);
}
public static ServiceResponse<Void> approval(WithdrawalStatusEnum state, TabCashWithdrawal record) {
return stateMap.get(state).approval(record);
}
public static ServiceResponse<Void> reject(WithdrawalStatusEnum state, TabCashWithdrawal record) {
return stateMap.get(state).reject(record);
}
public static ServiceResponse<Void> cancel(WithdrawalStatusEnum state, TabCashWithdrawal record) {
return stateMap.get(state).cancel(record);
}
public static ServiceResponse<Void> complete(WithdrawalStatusEnum state, TabCashWithdrawal record) {
return stateMap.get(state).complete(record);
}
}
package com.gic.finance.util.cashwithdrawal.event;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.utils.AsyncCallbackUtils;
import com.gic.finance.constant.WithdrawalStatusEnum;
import com.gic.finance.dto.CashWithdrawalDTO;
import com.gic.finance.entity.TabCashWithdrawal;
import com.gic.finance.entity.TabPayAccount;
import com.gic.finance.service.CashWithdrawalService;
import com.gic.finance.service.PayAccountService;
import com.gic.finance.util.cashwithdrawal.AbstractState;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* 审批通过状态
* @ClassName: ApprovalState

* @Description: 

* @author guojuxing

* @date 2020/11/6 11:19 AM

*/
@Component
public class ApprovalState extends AbstractState {
@Autowired
private CashWithdrawalService cashWithdrawalService;
@Autowired
private PayAccountService payAccountService;
@Override
public ServiceResponse<String> cashWithdrawal(CashWithdrawalDTO dto) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已通过审批");
}
@Override
public ServiceResponse<Void> approval(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已通过审批");
}
@Override
public ServiceResponse<Void> reject(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已通过审批");
}
@Override
public ServiceResponse<Void> cancel(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已通过审批");
}
@Override
public ServiceResponse<Void> complete(TabCashWithdrawal record) {
if (StringUtils.isBlank(record.getBankSerialNumber())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "银行流水号不能为空");
}
TabPayAccount account = payAccountService.getById(record.getPayId());
if (account == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "无此打款户信息记录,请前往添加");
}
//todo 操作人相关信息
record.setOperatorTime(new Date());
record.setPayId(record.getPayId());
record.setPayAccount(account.getBankAccount());
record.setPayAccountBank(account.getBank());
record.setPayAccountBranchName(account.getBranchName());
record.setPayAccountName(account.getAccountName());
record.setCashWithdrawalStatus(WithdrawalStatusEnum.COMPLETE.getCode());
cashWithdrawalService.update(record);
//回调
AsyncCallbackUtils.callBack(record, "com.gic.open.api.service.market.PayCallbackApiService", "callbackWithdraw");
return ServiceResponse.success();
}
}
package com.gic.finance.util.cashwithdrawal.event;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.error.ErrorCode;
import com.gic.finance.dto.CashWithdrawalDTO;
import com.gic.finance.entity.TabCashWithdrawal;
import com.gic.finance.util.cashwithdrawal.AbstractState;
import org.springframework.stereotype.Component;
/**
* 取消审核状态
* @ClassName: CancelState

* @Description: 

* @author guojuxing

* @date 2020/11/6 1:38 PM

*/
@Component
public class CancelState extends AbstractState {
@Override
public ServiceResponse<String> cashWithdrawal(CashWithdrawalDTO dto) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已取消");
}
@Override
public ServiceResponse<Void> approval(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已取消");
}
@Override
public ServiceResponse<Void> reject(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已取消");
}
@Override
public ServiceResponse<Void> cancel(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已取消");
}
@Override
public ServiceResponse<Void> complete(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已取消");
}
}
package com.gic.finance.util.cashwithdrawal.event;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.utils.CreateRandomUtils;
import com.gic.enterprise.utils.valid.ValidParamsUtils;
import com.gic.finance.constant.WithdrawalStatusEnum;
import com.gic.finance.dto.CashWithdrawalDTO;
import com.gic.finance.entity.TabCashWithdrawal;
import com.gic.finance.service.CashWithdrawalService;
import com.gic.finance.util.cashwithdrawal.AbstractState;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* 新增提审
* @ClassName: CashWithdrawalState

* @Description: 

* @author guojuxing

* @date 2020/11/6 4:51 PM

*/
@Component
public class CashWithdrawalState extends AbstractState {
@Autowired
private CashWithdrawalService cashWithdrawalService;
@Override
public ServiceResponse<String> cashWithdrawal(CashWithdrawalDTO dto) {
ServiceResponse paramValid = ValidParamsUtils.allCheckValidate(dto, CashWithdrawalDTO.CashWithdrawal.class);
if (!paramValid.isSuccess()) {
return paramValid;
}
dto.setCreateTime(new Date());
dto.setUpdateTime(new Date());
dto.setCashWithdrawalStatus(WithdrawalStatusEnum.TO_BE_EXAMINE.getCode());
//流水号
dto.setCashWithdrawalSerialNumber(CreateRandomUtils.createSerialNumber());
cashWithdrawalService.save(dto);
return ServiceResponse.success(dto.getCashWithdrawalSerialNumber());
}
@Override
public ServiceResponse<Void> approval(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "提审中,不能通过审批");
}
@Override
public ServiceResponse<Void> reject(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "提审中,不能拒绝审批");
}
@Override
public ServiceResponse<Void> cancel(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "提审中,不能取消审批");
}
@Override
public ServiceResponse<Void> complete(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "提审中,不能打款");
}
}
package com.gic.finance.util.cashwithdrawal.event;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.utils.AsyncCallbackUtils;
import com.gic.finance.constant.WithdrawalStatusEnum;
import com.gic.finance.dto.CashWithdrawalDTO;
import com.gic.finance.entity.TabCashWithdrawal;
import com.gic.finance.service.CashWithdrawalService;
import com.gic.finance.util.cashwithdrawal.AbstractState;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 审核
* @ClassName: CheckAuthState

* @Description: 

* @author guojuxing

* @date 2020/11/6 3:28 PM

*/
@Component
public class CheckAuthState extends AbstractState {
@Autowired
private CashWithdrawalService cashWithdrawalService;
@Override
public ServiceResponse<String> cashWithdrawal(CashWithdrawalDTO dto) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "不能重复提审");
}
@Override
public ServiceResponse<Void> approval(TabCashWithdrawal record) {
record.setCashWithdrawalStatus(WithdrawalStatusEnum.PASS.getCode());
cashWithdrawalService.update(record);
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> reject(TabCashWithdrawal record) {
if (StringUtils.isBlank(record.getRejectReason())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "驳回理由不能为空");
}
record.setCashWithdrawalStatus(WithdrawalStatusEnum.REJECT.getCode());
cashWithdrawalService.update(record);
//回调
AsyncCallbackUtils.callBack(record, "com.gic.open.api.service.market.PayCallbackApiService", "callbackWithdraw");
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> cancel(TabCashWithdrawal record) {
record.setCashWithdrawalStatus(WithdrawalStatusEnum.CANCEL.getCode());
cashWithdrawalService.update(record);
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> complete(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "审核中不能打款");
}
}
package com.gic.finance.util.cashwithdrawal.event;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.error.ErrorCode;
import com.gic.finance.dto.CashWithdrawalDTO;
import com.gic.finance.entity.TabCashWithdrawal;
import com.gic.finance.util.cashwithdrawal.AbstractState;
import org.springframework.stereotype.Component;
/**
* 完成状态
* @ClassName: CompleteState

* @Description: 

* @author guojuxing

* @date 2020/11/6 3:48 PM

*/
@Component
public class CompleteState extends AbstractState {
@Override
public ServiceResponse<String> cashWithdrawal(CashWithdrawalDTO dto) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已完成");
}
@Override
public ServiceResponse<Void> approval(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已完成");
}
@Override
public ServiceResponse<Void> reject(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已完成");
}
@Override
public ServiceResponse<Void> cancel(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已完成");
}
@Override
public ServiceResponse<Void> complete(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "已完成");
}
}
package com.gic.finance.util.cashwithdrawal.event;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.error.ErrorCode;
import com.gic.finance.constant.WithdrawalStatusEnum;
import com.gic.finance.dto.CashWithdrawalDTO;
import com.gic.finance.entity.TabCashWithdrawal;
import com.gic.finance.util.cashwithdrawal.AbstractState;
import org.springframework.stereotype.Component;
/**
* 拒绝审批状态
* @ClassName: RejectState

* @Description: 

* @author guojuxing

* @date 2020/11/6 11:23 AM

*/
@Component
public class RejectState extends AbstractState {
@Override
public ServiceResponse<String> cashWithdrawal(CashWithdrawalDTO dto) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), WithdrawalStatusEnum.REJECT.getMessage());
}
@Override
public ServiceResponse<Void> approval(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), WithdrawalStatusEnum.REJECT.getMessage());
}
@Override
public ServiceResponse<Void> reject(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), WithdrawalStatusEnum.REJECT.getMessage());
}
@Override
public ServiceResponse<Void> cancel(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), WithdrawalStatusEnum.REJECT.getMessage());
}
@Override
public ServiceResponse<Void> complete(TabCashWithdrawal record) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), WithdrawalStatusEnum.REJECT.getMessage());
}
}
......@@ -44,10 +44,7 @@
from tab_cash_withdrawal
where cash_withdrawal_id = #{cashWithdrawalId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_cash_withdrawal
where cash_withdrawal_id = #{cashWithdrawalId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.finance.entity.TabCashWithdrawal">
insert into tab_cash_withdrawal (cash_withdrawal_id, cash_withdrawal_serial_number,
apply_type, cash_withdrawal_amount, cash_withdrawal_status,
......
......@@ -12,10 +12,11 @@
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="delete_flag" jdbcType="INTEGER" property="deleteFlag" />
</resultMap>
<sql id="Base_Column_List">
invoice_account_id, account_name, tax_number, address, bank, account_phone, bank_account,
status, create_time, update_time
status, create_time, update_time, delete_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -23,19 +24,16 @@
from tab_invoice_account
where invoice_account_id = #{invoiceAccountId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_invoice_account
where invoice_account_id = #{invoiceAccountId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.finance.entity.TabInvoiceAccount">
insert into tab_invoice_account (invoice_account_id, account_name, tax_number,
address, bank, account_phone,
bank_account, status, create_time,
update_time)
update_time, delete_flag)
values (#{invoiceAccountId,jdbcType=INTEGER}, #{accountName,jdbcType=VARCHAR}, #{taxNumber,jdbcType=VARCHAR},
#{address,jdbcType=VARCHAR}, #{bank,jdbcType=VARCHAR}, #{accountPhone,jdbcType=VARCHAR},
#{bankAccount,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
#{updateTime,jdbcType=TIMESTAMP}, #{deleteFlag,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.finance.entity.TabInvoiceAccount">
insert into tab_invoice_account
......@@ -70,6 +68,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="deleteFlag != null">
delete_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="invoiceAccountId != null">
......@@ -102,6 +103,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.finance.entity.TabInvoiceAccount">
......@@ -134,6 +138,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
</set>
where invoice_account_id = #{invoiceAccountId,jdbcType=INTEGER}
</update>
......@@ -147,7 +154,8 @@
bank_account = #{bankAccount,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP},
delete_flag = #{deleteFlag,jdbcType=INTEGER}
where invoice_account_id = #{invoiceAccountId,jdbcType=INTEGER}
</update>
......@@ -156,6 +164,7 @@
<include refid="Base_Column_List" />
from tab_invoice_account
where status = 1
and delete_flag = 0
</select>
<update id="closeStatus">
......@@ -169,6 +178,8 @@
from tab_invoice_account
where status != 0
and delete_flag = 0
order by status
</select>
</mapper>
\ No newline at end of file
......@@ -51,10 +51,7 @@
from tab_invoice_manage
where invoice_manage_id = #{invoiceManageId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_invoice_manage
where invoice_manage_id = #{invoiceManageId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.finance.entity.TabInvoiceManage">
insert into tab_invoice_manage (invoice_manage_id, invoice_apply_serial,
platform_type, invoice_type, billing_amount,
......
......@@ -11,10 +11,11 @@
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="delete_flag" jdbcType="INTEGER" property="deleteFlag" />
</resultMap>
<sql id="Base_Column_List">
pay_account_id, account_name, bank, branch_name, bank_account, status, sort, create_time,
update_time
update_time, delete_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -22,18 +23,15 @@
from tab_pay_account
where pay_account_id = #{payAccountId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_pay_account
where pay_account_id = #{payAccountId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.finance.entity.TabPayAccount">
insert into tab_pay_account (pay_account_id, account_name, bank,
branch_name, bank_account, status,
sort, create_time, update_time
sort, create_time, update_time, delete_flag
)
values (#{payAccountId,jdbcType=INTEGER}, #{accountName,jdbcType=VARCHAR}, #{bank,jdbcType=VARCHAR},
#{branchName,jdbcType=VARCHAR}, #{bankAccount,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{sort,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
#{sort,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{deleteFlag,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.finance.entity.TabPayAccount">
......@@ -66,6 +64,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="deleteFlag != null">
delete_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="payAccountId != null">
......@@ -95,6 +96,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.finance.entity.TabPayAccount">
......@@ -124,6 +128,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
</set>
where pay_account_id = #{payAccountId,jdbcType=INTEGER}
</update>
......@@ -136,7 +143,8 @@
status = #{status,jdbcType=INTEGER},
sort = #{sort,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP},
delete_flag = #{deleteFlag,jdbcType=INTEGER}
where pay_account_id = #{payAccountId,jdbcType=INTEGER}
</update>
......@@ -145,6 +153,7 @@
<include refid="Base_Column_List" />
from tab_pay_account
where status != 0
and delete_flag = 0
order by sort
</select>
......@@ -153,6 +162,7 @@
ifnull(max(sort), 0)
from tab_pay_account
where status != 0
and delete_flag = 0
</select>
<select id="getMinSort" resultType="int">
......@@ -160,6 +170,7 @@
ifnull(min(sort),0)
from tab_pay_account
where status != 0
and delete_flag = 0
</select>
......@@ -168,6 +179,7 @@
<include refid="Base_Column_List" />
from tab_pay_account
where status != 0
and delete_flag = 0
and sort &lt; #{sort}
</select>
......@@ -176,6 +188,7 @@
<include refid="Base_Column_List" />
from tab_pay_account
where status != 0
and delete_flag = 0
and sort > #{sort}
</select>
</mapper>
\ No newline at end of file
......@@ -38,10 +38,7 @@
from tab_transfer_accounts_approval
where transfer_approval_id = #{transferApprovalId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_transfer_accounts_approval
where transfer_approval_id = #{transferApprovalId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.finance.entity.TabTransferAccountsApproval">
insert into tab_transfer_accounts_approval (transfer_approval_id, order_number,
platform_type, initiator_type, initiator_name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment