From 53b642e60ce97fd6a03dcdd4521baae797c8ae25 Mon Sep 17 00:00:00 2001 From: xhxu Date: Mon, 15 Aug 2022 10:32:04 +0800 Subject: [PATCH] // enum --- ...xProfitSharingReceiverApplyController.java | 68 +++++++++++++++++++ .../po/WxProfitSharingReceiverApply.java | 11 +-- .../java/com/iformall/enums/EnumAppPlat.java | 2 +- .../com/iformall/enums/EnumCardSpendFrom.java | 2 +- .../com/iformall/enums/EnumComposeOrder.java | 13 +--- .../java/com/iformall/enums/EnumPayWay.java | 2 +- .../com/iformall/enums/EnumProjectPlat.java | 2 +- .../enums/EnumSharingReceiverAccountType.java | 4 +- .../enums/EnumSharingReceiverApplyStatus.java | 36 ++++++++++ .../EnumSharingReceiverVerifyResult.java | 55 +++++++++++++++ .../WxProfitSharingReceiverApplyService.java | 6 ++ ...ProfitSharingReceiverApplyServiceImpl.java | 19 ++++++ .../WxProfitSharingReceiverApplyMapper.xml | 8 ++- 13 files changed, 206 insertions(+), 22 deletions(-) create mode 100644 mallinkBApi/src/main/java/com/iformall/controller/WxProfitSharingReceiverApplyController.java create mode 100644 mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverApplyStatus.java create mode 100644 mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverVerifyResult.java diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxProfitSharingReceiverApplyController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxProfitSharingReceiverApplyController.java new file mode 100644 index 000000000..6d87620c3 --- /dev/null +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxProfitSharingReceiverApplyController.java @@ -0,0 +1,68 @@ +package com.iformall.controller; + +import com.iformall.common.ErrorCode; +import com.iformall.common.ResultData; +import com.iformall.domain.po.WxMerchant; +import com.iformall.domain.po.WxProfitSharingReceiver; +import com.iformall.domain.po.WxProfitSharingReceiverApply; +import com.iformall.douyin.pay.enums.MerchantImportStatus; +import com.iformall.enums.EnumAppPlat; +import com.iformall.enums.EnumMerchantStatus; +import com.iformall.enums.EnumProfitSharingType; +import com.iformall.enums.EnumSharingReceiverApplymentState; +import com.iformall.service.WxMerchantService; +import com.iformall.service.WxProfitSharingReceiverApplyService; +import com.iformall.service.WxProfitSharingReceiverService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/api/sharingReceiverApply") +@Api(description = "进件相关接口") +@Slf4j +public class WxProfitSharingReceiverApplyController extends BaseController { + + @Autowired + private WxProfitSharingReceiverApplyService wxProfitSharingReceiverApplyService; + + @Autowired + private WxProfitSharingReceiverService wxProfitSharingReceiverService; + + @Autowired + private WxMerchantService wxMerchantService; + + @ApiOperation("申请") + @PostMapping("/receiverAdd") + public ResultData receiverApply(@RequestBody WxProfitSharingReceiverApply receiverAdd) { + log.debug("[" + getIpAddr() + "] merchantProfitSharingReceiver::receiverAdd"); + if(receiverAdd.getMerchantId() == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); + } + WxMerchant merchant = wxMerchantService.selectById(receiverAdd.getMerchantId()); + if(merchant == null || EnumMerchantStatus.NOT_VALID.getCode().equals(merchant.getStatus())){ + return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID.getCode(),"商户不存在或已停用"); + } + WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(merchant, merchant.getId(), EnumAppPlat.WX, EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2); + if(receiver != null && MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "该商户已进件成功"); + } + + if(receiverAdd.getId() != null){ + WxProfitSharingReceiverApply receiverApply = wxProfitSharingReceiverApplyService.selectById(receiverAdd.getId()); + if(receiverApply == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "该商户进件数据异常,请联系管理员"); + } + if(receiverApply.getApplymentState().intValue() > 0){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "该商户进件流程中,无法修改"); + } + }else{ + WxProfitSharingReceiverApply receiverApply = wxProfitSharingReceiverApplyService.selectByPlat(merchant,merchant.getId(),EnumAppPlat.WX); + } + + return new ResultData(receiverAdd); + } + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxProfitSharingReceiverApply.java b/mallinkService/src/main/java/com/iformall/domain/po/WxProfitSharingReceiverApply.java index a9665b31e..6196927fa 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxProfitSharingReceiverApply.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxProfitSharingReceiverApply.java @@ -64,11 +64,11 @@ public class WxProfitSharingReceiverApply extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="微信支付申请单号",name="applymentId") private Integer applymentId; - @io.swagger.annotations.ApiModelProperty(value="申请状态",name="applymentState") + @io.swagger.annotations.ApiModelProperty(value="EnumSharingReceiverApplymentState 申请状态",name="applymentState") private Integer applymentState; @io.swagger.annotations.ApiModelProperty(value="申请状态描述",name="applymentStateDesc") private String applymentStateDesc; - @io.swagger.annotations.ApiModelProperty(value="签约状态",name="signState") + @io.swagger.annotations.ApiModelProperty(value="EnumSharingReceiverSignState 签约状态",name="signState") private Integer signState; @io.swagger.annotations.ApiModelProperty(value="签约链接",name="signUrl") private String signUrl; @@ -83,11 +83,14 @@ public class WxProfitSharingReceiverApply extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="法人验证链接二维码",name="legalValidationQrcode") private String legalValidationQrcode; - @io.swagger.annotations.ApiModelProperty(value="申请状态",name="verifyResult") + @io.swagger.annotations.ApiModelProperty(value="修改收款帐号 申请状态",name="verifyResult") private Integer verifyResult; - @io.swagger.annotations.ApiModelProperty(value="申请状态描述",name="verifyFailReason") + @io.swagger.annotations.ApiModelProperty(value="修改收款帐号 申请状态描述",name="verifyFailReason") private String verifyFailReason; + @io.swagger.annotations.ApiModelProperty(value="修改收款帐号 申请状态描述",name="status") + private Integer status; + @io.swagger.annotations.ApiModelProperty(value="",name="createTime") private Date createTime; @io.swagger.annotations.ApiModelProperty(value="",name="updateTime") diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumAppPlat.java b/mallinkService/src/main/java/com/iformall/enums/EnumAppPlat.java index f31f6b0fb..f6e11e6e2 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumAppPlat.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumAppPlat.java @@ -29,7 +29,7 @@ public enum EnumAppPlat { public static EnumAppPlat getByCode(Integer code) { for (EnumAppPlat e : EnumAppPlat.values()) { - if (e.getCode().intValue() == code.intValue()) { + if (e.getCode().equals(code)) { return e; } } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumCardSpendFrom.java b/mallinkService/src/main/java/com/iformall/enums/EnumCardSpendFrom.java index fb41cac42..d17824580 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumCardSpendFrom.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumCardSpendFrom.java @@ -22,7 +22,7 @@ public enum EnumCardSpendFrom { public static EnumPayWay getPayWay(Integer code) { for (EnumPayWay payWay:EnumPayWay.values()) { - if (null != payWay.getCardSpendFrom() && payWay.getCardSpendFrom().getCode().intValue() == code.intValue() ) { + if (null != payWay.getCardSpendFrom() && payWay.getCardSpendFrom().getCode().equals(code) ) { return payWay; } } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumComposeOrder.java b/mallinkService/src/main/java/com/iformall/enums/EnumComposeOrder.java index ce37651d5..70078062d 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumComposeOrder.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumComposeOrder.java @@ -40,20 +40,11 @@ public enum EnumComposeOrder { //是单个支付还是组合支付,是否需要多分账 public static boolean isSingle(Integer type) { - if (type.intValue() == SINGLE.getCode().intValue()) { + if (SINGLE.getCode().equals(type)) { return true; }else { return false; } } - - //子订单是单个还是一起,购物车的子订单是单个,可以单个支付,券包的子订单不能单个支付 -// public static boolean childOrderIsSingle(Integer type) { -// if (type.intValue() == SINGLE.getCode().intValue() || type.intValue() == ONE_NUMBER_ORDER_BATCH.getCode().intValue() -// || type.intValue() == MULITY_NUMBER_ORDER_BATCH.getCode().intValue()) { -// return true; -// }else { -// return false; -// } -// } + } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumPayWay.java b/mallinkService/src/main/java/com/iformall/enums/EnumPayWay.java index c685e1e26..396b5dff8 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumPayWay.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumPayWay.java @@ -30,7 +30,7 @@ public enum EnumPayWay { public static EnumPayWay getEnum(Integer code) { for (EnumPayWay value : values()) { - if (value.getCode().intValue()==code.intValue()) { + if (value.getCode().equals(code)) { return value; } } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumProjectPlat.java b/mallinkService/src/main/java/com/iformall/enums/EnumProjectPlat.java index 41432a2ec..a6ad54c31 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumProjectPlat.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumProjectPlat.java @@ -29,7 +29,7 @@ public enum EnumProjectPlat { public static EnumProjectPlat getByCode(Integer code) { for (EnumProjectPlat e : EnumProjectPlat.values()) { - if (e.getCode().intValue() == code.intValue()) { + if (e.getCode().equals(code)) { return e; } } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverAccountType.java b/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverAccountType.java index 67c69e361..53c52d49d 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverAccountType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverAccountType.java @@ -6,8 +6,8 @@ package com.iformall.enums; */ public enum EnumSharingReceiverAccountType { - ACCOUNT_TYPE_74(74, "74", "对公账户"), - ACCOUNT_TYPE_75(75, "75", "对私账户"), + ACCOUNT_TYPE_BUSINESS(74, "ACCOUNT_TYPE_BUSINESS", "对公账户"), + ACCOUNT_TYPE_PRIVATE(75, "ACCOUNT_TYPE_PRIVATE", "对私账户"), ; public static EnumSharingReceiverAccountType getEnum(Integer code) { diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverApplyStatus.java b/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverApplyStatus.java new file mode 100644 index 000000000..b735e8f85 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverApplyStatus.java @@ -0,0 +1,36 @@ +package com.iformall.enums; + +/** + * Created by Stormeye on 2018/08/09. + */ +public enum EnumSharingReceiverApplyStatus { + PROFIT_RECEIVER_APPLY_STATUS_VALID(0, "正常"), + PROFIT_RECEIVER_APPLY_STATUS_INVALID(1, "作废"), + + ; + + public static EnumSharingReceiverApplyStatus getEnum(Integer code) { + for (EnumSharingReceiverApplyStatus value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumSharingReceiverApplyStatus(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverVerifyResult.java b/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverVerifyResult.java new file mode 100644 index 000000000..520ec4982 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverVerifyResult.java @@ -0,0 +1,55 @@ +package com.iformall.enums; + +/** + * 签约状态 + * VERIFYING:系统汇款验证中,商户可发起提现尝试。 + * VERIFY_SUCCESS:系统成功汇款,该账户可正常发起提现。 + * VERIFY_FAIL:系统汇款失败,该账户无法发起提现,请检查修改。 + */ +public enum EnumSharingReceiverVerifyResult { + + VERIFYING(1, "VERIFYING", "系统汇款验证中,商户可发起提现尝试。"), + VERIFY_SUCCESS(2, "VERIFY_SUCCESS", "系统成功汇款,该账户可正常发起提现。"), + VERIFY_FAIL(3, "VERIFY_FAIL", "系统汇款失败,该账户无法发起提现,请检查修改。"), + ; + + public static EnumSharingReceiverVerifyResult getEnum(Integer code) { + for (EnumSharingReceiverVerifyResult value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + public static EnumSharingReceiverVerifyResult getEnum(String codeStr) { + for (EnumSharingReceiverVerifyResult value : values()) { + if (value.getCodeStr().equals(codeStr)) { + return value; + } + } + return null; + } + + private Integer code; + private String codeStr; + private String message; + + EnumSharingReceiverVerifyResult(Integer code, String codeStr, String message) { + this.code = code; + this.codeStr = codeStr; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getCodeStr() { + return codeStr; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverApplyService.java b/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverApplyService.java index fda20d3a2..00a186337 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverApplyService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverApplyService.java @@ -1,7 +1,10 @@ package com.iformall.service; import com.github.pagehelper.PageInfo; +import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxProfitSharingReceiverApply; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.enums.EnumAppPlat; public interface WxProfitSharingReceiverApplyService { @@ -14,4 +17,7 @@ public interface WxProfitSharingReceiverApplyService { PageInfo listAsPage(WxProfitSharingReceiverApply record, Integer pageIndex, Integer pageSize); + WxProfitSharingReceiverApply selectById(Long id); + + WxProfitSharingReceiverApply selectByPlat(TenantEntity tenantEntity, Long merid, EnumAppPlat wx); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverApplyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverApplyServiceImpl.java index 65a3f21b9..c6d4240f6 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverApplyServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverApplyServiceImpl.java @@ -1,8 +1,12 @@ package com.iformall.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.domain.po.*; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.enums.EnumAppPlat; +import com.iformall.enums.EnumSharingReceiverApplyStatus; import com.iformall.mapper.WxProfitSharingReceiverApplyMapper; import com.iformall.service.WxProfitSharingReceiverApplyService; import org.slf4j.Logger; @@ -24,5 +28,20 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitSharingReceiverApplyMapper.findList(record)); } + @Override + public WxProfitSharingReceiverApply selectById(Long id) { + return wxProfitSharingReceiverApplyMapper.selectById(id); + } + + @Override + public WxProfitSharingReceiverApply selectByPlat(TenantEntity tenantEntity, Long merchantId, EnumAppPlat wx) { + WxProfitSharingReceiverApply receiverApply = new WxProfitSharingReceiverApply(); + receiverApply.updateTenantInfo(tenantEntity); + receiverApply.setMerchantId(merchantId); + receiverApply.setPlat(wx.getCode()); + receiverApply.setStatus(EnumSharingReceiverApplyStatus.PROFIT_RECEIVER_APPLY_STATUS_VALID.getCode()); + return wxProfitSharingReceiverApplyMapper.selectOne(new QueryWrapper<>(receiverApply)); + } + } diff --git a/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverApplyMapper.xml b/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverApplyMapper.xml index 6fa9e5644..10662e152 100644 --- a/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverApplyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverApplyMapper.xml @@ -44,6 +44,8 @@ + + @@ -56,7 +58,7 @@ `merchant_shortname`,`qualifications`,`business_addition_pics`,`business_addition_desc`, `applyment_id`,`applyment_state`,`applyment_state_desc`,`sign_state`,`sign_url`, `sub_mchid`,`account_validation`,`audit_detail`,`legal_validation_url`,`legal_validation_qrcode`, - `verify_result`,`verify_fail_reason`,`create_time`,`update_time` + `verify_result`,`verify_fail_reason`,`status`,`create_time`,`update_time` @@ -105,6 +107,10 @@ and `verify_result` = #{verifyResult} + + and `status` = #{status} + + and id in