| @@ -4,6 +4,7 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.enums.EnumCouponSourceType; | import com.iformall.enums.EnumCouponSourceType; | ||||
| import com.iformall.enums.EnumSharingReceiverAccountType; | |||||
| import com.iformall.enums.EnumSharingReceiverQualificationGth; | import com.iformall.enums.EnumSharingReceiverQualificationGth; | ||||
| import com.iformall.enums.EnumSharingReceiverQualificationQy; | import com.iformall.enums.EnumSharingReceiverQualificationQy; | ||||
| import com.iformall.service.bank.WxBankUtilService; | import com.iformall.service.bank.WxBankUtilService; | ||||
| @@ -50,6 +51,38 @@ public class BankController extends BaseController{ | |||||
| } | } | ||||
| } | } | ||||
| @ApiOperation("查询银行列表") | |||||
| @GetMapping("banking") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData banking(Integer bankAccountType,Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] BankController::banking"); | |||||
| if(bankAccountType == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| EnumSharingReceiverAccountType enumAccountType = EnumSharingReceiverAccountType.getEnum(bankAccountType); | |||||
| if(enumAccountType == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"参数不符合规范"); | |||||
| } | |||||
| if(pageNum == null){ | |||||
| pageNum = 1; | |||||
| } | |||||
| if(pageSize == null){ | |||||
| pageSize = 200; | |||||
| } | |||||
| int offset = (pageNum-1)*pageSize; | |||||
| int limit = pageSize; | |||||
| if(EnumSharingReceiverAccountType.BANK_ACCOUNT_TYPE_CORPORATE.equals(enumAccountType)){ | |||||
| return wxBankUtilService.corporateBanking(getTenantInfo(),offset, limit); | |||||
| }else{ | |||||
| return wxBankUtilService.personalBanking(getTenantInfo(),offset, limit); | |||||
| } | |||||
| } | |||||
| @ApiOperation("查询支持个人业务的银行列表") | @ApiOperation("查询支持个人业务的银行列表") | ||||
| @GetMapping("personalBanking") | @GetMapping("personalBanking") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -0,0 +1,97 @@ | |||||
| package com.iformall.controller; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.file.aliyun.AliyunOSS; | |||||
| import com.iformall.utils.ImgUtil; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RequestParam; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import org.springframework.web.multipart.MultipartFile; | |||||
| import javax.imageio.ImageIO; | |||||
| import java.awt.image.BufferedImage; | |||||
| import java.util.ArrayList; | |||||
| import java.util.HashMap; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| @RestController | |||||
| @RequestMapping(value = "/api/mediaUpload") | |||||
| @Api(description = "文件上传接口") | |||||
| public class WxMerchantMediaUploadController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private AliyunOSS aliyunOSS; | |||||
| /** | |||||
| * 图片上传 | |||||
| * | |||||
| * @param multiReq | |||||
| * @return | |||||
| * @throws Exception | |||||
| */ | |||||
| @PostMapping(value = "/merchantUpload", consumes = "multipart/*", headers = "content-type=multipart/form-data") | |||||
| @ApiOperation("上传图片") | |||||
| public ResultData awsImgUpload(@RequestParam("file") MultipartFile multiReq, @RequestParam Map<String, String> param) { | |||||
| logger.info("[" + getIpAddr() + "] WxMerchantMediaUploadController::merchantUpload"); | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| long size = multiReq.getSize(); | |||||
| final long length = 2097152; | |||||
| if (size > length) { | |||||
| return new ResultData(ErrorCode.PICTURE_SIZE_EXCEED); | |||||
| } | |||||
| String fileFormat = ""; | |||||
| try { | |||||
| int dot = multiReq.getOriginalFilename().lastIndexOf('.'); | |||||
| if (dot >= 0) { | |||||
| fileFormat = multiReq.getOriginalFilename().substring(dot, multiReq.getOriginalFilename().length()); | |||||
| } | |||||
| String imgFormat = ImgUtil.getImgFormat(fileFormat); | |||||
| if(StringUtils.isNotBlank(imgFormat)) { | |||||
| long maxSize = 0l; | |||||
| try { | |||||
| maxSize = Long.parseLong(param.get("size")); | |||||
| } catch (NumberFormatException e) {} | |||||
| if(maxSize > 0l && size > maxSize*1024){ | |||||
| return new ResultData(ErrorCode.PICTURE_SIZE_CUSTOMIZE); | |||||
| } | |||||
| BufferedImage bufferedImage = ImageIO.read(multiReq.getInputStream()); | |||||
| if(bufferedImage != null){ | |||||
| int width = 0;int hight = 0; | |||||
| try { | |||||
| width = Integer.parseInt(param.get("width")); | |||||
| hight = Integer.parseInt(param.get("hight")); | |||||
| } catch (NumberFormatException e) {} | |||||
| Integer relWidth = bufferedImage.getWidth(); | |||||
| Integer relHeight = bufferedImage.getHeight(); | |||||
| if((width > 0 && width != relWidth.intValue()) | |||||
| || (hight > 0 && hight != relHeight.intValue())){ | |||||
| return new ResultData(ErrorCode.PICTURE_W_H_CUSTOMIZE); | |||||
| } | |||||
| } | |||||
| } | |||||
| ResultData data = aliyunOSS.uploadFile(tenantEntity.getTenantId(), fileFormat, multiReq.getInputStream()); | |||||
| return data; | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(ErrorCode.PICTURE_ANALYZING_ERROR); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -79,10 +79,6 @@ public class WxProfitSharingReceiverApplyController extends BaseController { | |||||
| if(merchant == null || EnumMerchantStatus.NOT_VALID.getCode().equals(merchant.getStatus())){ | if(merchant == null || EnumMerchantStatus.NOT_VALID.getCode().equals(merchant.getStatus())){ | ||||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID.getCode(),"商户不存在或已停用"); | 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(), "该商户已进件成功"); | |||||
| } | |||||
| WxProfitSharingReceiverApply receiverApply = wxProfitSharingReceiverApplyService.detailByPlat(merchant,merchant.getId(),EnumAppPlat.WX); | WxProfitSharingReceiverApply receiverApply = wxProfitSharingReceiverApplyService.detailByPlat(merchant,merchant.getId(),EnumAppPlat.WX); | ||||
| @@ -105,7 +101,7 @@ public class WxProfitSharingReceiverApplyController extends BaseController { | |||||
| }else if(EnumSharingReceiverOrganizationType.QIYE.equals(enumOrganizationType)){ | }else if(EnumSharingReceiverOrganizationType.QIYE.equals(enumOrganizationType)){ | ||||
| return new ResultData(EnumSharingReceiverQualificationQy.getList()); | return new ResultData(EnumSharingReceiverQualificationQy.getList()); | ||||
| }else{ | }else{ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "主体类型暂不支持"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "主体类型不符合规范"); | |||||
| } | } | ||||
| } | } | ||||
| @@ -6,7 +6,8 @@ package com.iformall.utils; | |||||
| public class UrlCheck { | public class UrlCheck { | ||||
| public static boolean checkUrl(String url) { | public static boolean checkUrl(String url) { | ||||
| return url.contains("awsFileUpload") | |||||
| return url.contains("merchantUpload") | |||||
| || url.contains("awsFileUpload") | |||||
| || url.contains("awsImgUpload") | || url.contains("awsImgUpload") | ||||
| || url.contains("awsFilesUpload"); | || url.contains("awsFilesUpload"); | ||||
| } | } | ||||
| @@ -2,12 +2,15 @@ package com.iformall.enums; | |||||
| /** | /** | ||||
| * 结算账户信息 | * 结算账户信息 | ||||
| * 账户类型 | |||||
| * 1、若主体为企业/政府机关/事业单位/社会组织,可填写:对公银行账户。 | |||||
| * 2、若主体为个体户,可选择填写:对公银行账户或经营者个人银行卡。 | |||||
| * BANK_ACCOUNT_TYPE_CORPORATE:对公银行账户 | |||||
| * BANK_ACCOUNT_TYPE_PERSONAL:经营者个人银行卡 | |||||
| */ | */ | ||||
| public enum EnumSharingReceiverAccountType { | public enum EnumSharingReceiverAccountType { | ||||
| ACCOUNT_TYPE_BUSINESS(74, "ACCOUNT_TYPE_BUSINESS", "对公账户"), | |||||
| ACCOUNT_TYPE_PRIVATE(75, "ACCOUNT_TYPE_PRIVATE", "对私账户"), | |||||
| BANK_ACCOUNT_TYPE_CORPORATE(74, "BANK_ACCOUNT_TYPE_CORPORATE", "对公账户"), | |||||
| BANK_ACCOUNT_TYPE_PERSONAL(75, "BANK_ACCOUNT_TYPE_PERSONAL", "对私账户"), | |||||
| ; | ; | ||||
| public static EnumSharingReceiverAccountType getEnum(Integer code) { | public static EnumSharingReceiverAccountType getEnum(Integer code) { | ||||