|
|
|
@@ -5,23 +5,36 @@ 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.domain.po.base.TenantEntity; |
|
|
|
import com.iformall.douyin.pay.enums.MerchantImportStatus; |
|
|
|
import com.iformall.enums.*; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.file.aliyun.AliyunOSS; |
|
|
|
import com.iformall.service.WxMerchantService; |
|
|
|
import com.iformall.service.WxProfitSharingReceiverApplyService; |
|
|
|
import com.iformall.service.WxProfitSharingReceiverService; |
|
|
|
import com.iformall.utils.ImgYwsqhUtil; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
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.*; |
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@RestController |
|
|
|
@RequestMapping("/api/sharingReceiverApply") |
|
|
|
@Api(description = "进件相关接口") |
|
|
|
@Slf4j |
|
|
|
public class WxProfitSharingReceiverApplyController extends BaseController { |
|
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxProfitSharingReceiverApplyService wxProfitSharingReceiverApplyService; |
|
|
|
|
|
|
|
@@ -31,6 +44,9 @@ public class WxProfitSharingReceiverApplyController extends BaseController { |
|
|
|
@Autowired |
|
|
|
private WxMerchantService wxMerchantService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private AliyunOSS aliyunOSS; |
|
|
|
|
|
|
|
@ApiOperation("申请") |
|
|
|
@PostMapping("/receiverAdd") |
|
|
|
public ResultData receiverApply(@RequestBody WxProfitSharingReceiverApply receiverAdd) { |
|
|
|
@@ -151,4 +167,64 @@ public class WxProfitSharingReceiverApplyController extends BaseController { |
|
|
|
return wxProfitSharingReceiverApplyService.applyment(receiverAdd); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取授权函 |
|
|
|
* { |
|
|
|
* "contact_name":"",//经办人姓名 |
|
|
|
* "contact_id_number":"",//经办人身份证 |
|
|
|
* "contact_department":"",//部门 |
|
|
|
* "contact_job":"",//职位 |
|
|
|
* "legal_person":"",//法人姓名 |
|
|
|
* "id_card_number":"",//法人身份证 |
|
|
|
* "card_period_begin":"",//法人身份证有效期开始 |
|
|
|
* "card_period_end":"",//法人身份证有效期结束 |
|
|
|
* "isSeal":"",//是否有公章(字符串"true","false") |
|
|
|
* "merchant_name":""//商户或企业名称 |
|
|
|
* } |
|
|
|
* |
|
|
|
* @param |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping(value = "/getYwsqh") |
|
|
|
@ApiOperation("获取图片") |
|
|
|
public ResultData getYwsqh(@RequestParam Map<String, String> param) { |
|
|
|
logger.info("[" + getIpAddr() + "] WxMerchantMediaUploadController::getYwsqh"); |
|
|
|
TenantEntity tenantEntity = getTenantInfo(); |
|
|
|
|
|
|
|
String contact_name = param.get("contact_name"); |
|
|
|
String contact_id_number = param.get("contact_id_number"); |
|
|
|
String contact_department = param.get("contact_department"); |
|
|
|
String contact_job = param.get("contact_job"); |
|
|
|
String legal_person = param.get("legal_person"); |
|
|
|
String id_card_number = param.get("id_card_number"); |
|
|
|
String card_period_begin = param.get("card_period_begin"); |
|
|
|
String card_period_end = param.get("card_period_end"); |
|
|
|
Boolean isSeal = "true".equals(param.get("isSeal"))?true:false; |
|
|
|
String merchant_name = param.get("merchant_name"); |
|
|
|
|
|
|
|
byte[] bytes = ImgYwsqhUtil.imgCeate(contact_name, contact_id_number, contact_department, contact_job, |
|
|
|
legal_person, id_card_number, card_period_begin, card_period_end, isSeal, merchant_name); |
|
|
|
if(bytes == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"生成图片异常"); |
|
|
|
} |
|
|
|
try { |
|
|
|
|
|
|
|
String url = aliyunOSS.upload(tenantEntity.getTenantId(), ".png", new ByteArrayInputStream(bytes)); |
|
|
|
if(StringUtils.isBlank(url)){ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"获取图片异常"); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String,String> map = new HashMap<>(); |
|
|
|
map.put("url",url); |
|
|
|
return new ResultData(map); |
|
|
|
|
|
|
|
} catch(MallinkException e){ |
|
|
|
logger.error(e.getMessage()); |
|
|
|
return new ResultData(e.getErrorCode(),e.getMessage()); |
|
|
|
}catch (Exception e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
return new ResultData(ErrorCode.PICTURE_ANALYZING_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |