| @@ -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); | |||
| } | |||
| } | |||
| @@ -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") | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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; | |||
| // } | |||
| // } | |||
| } | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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) { | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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<WxProfitSharingReceiverApply> listAsPage(WxProfitSharingReceiverApply record, Integer pageIndex, Integer pageSize); | |||
| WxProfitSharingReceiverApply selectById(Long id); | |||
| WxProfitSharingReceiverApply selectByPlat(TenantEntity tenantEntity, Long merid, EnumAppPlat wx); | |||
| } | |||
| @@ -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)); | |||
| } | |||
| } | |||
| @@ -44,6 +44,8 @@ | |||
| <result column="verify_result" jdbcType="INTEGER" property="verifyResult" /> | |||
| <result column="verify_fail_reason" jdbcType="VARCHAR" property="verifyFailReason" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||
| </resultMap> | |||
| @@ -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` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -105,6 +107,10 @@ | |||
| and `verify_result` = #{verifyResult} | |||
| </if> | |||
| <if test=" null != status "> | |||
| and `status` = #{status} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||