add 官网卡支付/贷款申请

master
PeiYY 4 years ago
parent cf20ef1ff6
commit 7e73daaa00

@ -0,0 +1,44 @@
package au.com.royalpay.payment.manage.loanapplicaiton.domain.descriptor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.sql.Timestamp;
/**
*
*/
@Data
@Accessors(chain = true)
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class LoanApplicationDescriptor {
private String id;
private Timestamp createTime;
private String clientId;
private String name;
private String phone;
private String email;
private String businessName;
private String industry;
/**
*
*/
private String status;
/**
*
*/
private String remark;
}

@ -0,0 +1,76 @@
package au.com.royalpay.payment.manage.loanapplicaiton.domain.entity;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.descriptor.LoanApplicationDescriptor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.sql.Timestamp;
/**
*
*/
@Data
@Accessors(chain = true)
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class LoanApplication {
private String id;
private Timestamp createTime;
private Timestamp modifyTime;
private String creator;
private String modifier;
private String clientId;
/**
*
*/
private String name;
/**
*
*/
private String phone;
/**
*
*/
private String email;
/**
*
*/
private String businessName;
/**
*
*/
private String industry;
/**
*
*/
private LoanApplicationStatus status;
/**
*
*/
private String remark;
public LoanApplicationDescriptor describe() {
return new LoanApplicationDescriptor()
.setId(this.id)
.setClientId(this.clientId)
.setCreateTime(this.createTime)
.setName(this.name)
.setPhone(this.phone)
.setEmail(this.email)
.setBusinessName(this.businessName)
.setIndustry(this.industry)
.setStatus(this.status.description())
.setRemark(this.remark);
}
}

@ -0,0 +1,90 @@
package au.com.royalpay.payment.manage.loanapplicaiton.domain.entity;
/**
* 0:1:2:
*/
public enum LoanApplicationStatus {
/**
*
*/
READY {
@Override
public int code() {
return 0;
}
@Override
public String value() {
return "READY";
}
@Override
public String description() {
return "待处理";
}
},
/**
*
*/
PROCESSING {
@Override
public int code() {
return 1;
}
@Override
public String value() {
return "PROCESSING";
}
@Override
public String description() {
return "处理中";
}
},
/**
*
*/
COMPLETED {
@Override
public int code() {
return 2;
}
@Override
public String value() {
return "COMPLETED";
}
@Override
public String description() {
return "已处理";
}
};
/**
*
*
* @return
*/
public abstract int code();
/**
*
*
* @return
*/
public abstract String value();
public abstract String description();
public static LoanApplicationStatus codeOf(int code) {
for (LoanApplicationStatus status : LoanApplicationStatus.values()) {
if (status.code() == code) {
return status;
}
}
return LoanApplicationStatus.READY;
}
}

@ -0,0 +1,34 @@
package au.com.royalpay.payment.manage.loanapplicaiton.domain.entity.request;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.entity.LoanApplicationStatus;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class ModifyLoanApplicationRequest {
private String id;
/**
*
*/
private Integer status;
/**
*
*/
private String remark;
public ModifyLoanApplicationRequest build(String id, String status, String remark) {
return new ModifyLoanApplicationRequest()
.setId(id)
.setStatus(LoanApplicationStatus.valueOf(status).code())
.setRemark(remark);
}
}

@ -0,0 +1,17 @@
package au.com.royalpay.payment.manage.loanapplicaiton.domain.repository;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.entity.LoanApplication;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.entity.request.ModifyLoanApplicationRequest;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import java.util.Map;
public interface LoanApplicationRepository {
PageList<LoanApplication> listPagedLoanApplication(Map<String, Object> params, PageBounds pageBounds);
LoanApplication getById(String id);
void changeLoanApplication(ModifyLoanApplicationRequest request);
}

@ -0,0 +1,18 @@
package au.com.royalpay.payment.manage.loanapplicaiton.domain.service;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.descriptor.LoanApplicationDescriptor;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.web.command.ModifyLoanApplicationCommand;
import au.com.royalpay.payment.manage.support.representation.PageListRepresentation;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import java.util.Map;
public interface LoanApplicationService {
PageListRepresentation<LoanApplicationDescriptor> listPagedLoanApplication(Map<String, Object> params, PageBounds pageBounds);
LoanApplicationDescriptor getById(String id);
void changeLoanApplication(String id, ModifyLoanApplicationCommand command);
}

@ -0,0 +1,43 @@
package au.com.royalpay.payment.manage.loanapplicaiton.domain.web;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.descriptor.LoanApplicationDescriptor;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.service.LoanApplicationService;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.web.command.ModifyLoanApplicationCommand;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
*
*/
@RestController
@RequestMapping(value = "/partners")
public class RestLoanApplicationController {
@Resource
private LoanApplicationService applicationService;
/**
*
*
* @param id
* @return
*/
@RequestMapping(value = "/loanApplications/{id}", method = RequestMethod.GET)
public LoanApplicationDescriptor getLoanApplication(@PathVariable("id") String id) {
return applicationService.getById(id);
}
/**
*
*
* @param id
* @param command
*/
@RequestMapping(value = "/loanApplications/{id}", method = RequestMethod.PUT)
public void changeLoanApplication(@PathVariable("id") String id,
@RequestBody ModifyLoanApplicationCommand command) {
applicationService.changeLoanApplication(id, command);
}
}

@ -0,0 +1,44 @@
package au.com.royalpay.payment.manage.loanapplicaiton.domain.web;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.descriptor.LoanApplicationDescriptor;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.service.LoanApplicationService;
import au.com.royalpay.payment.manage.support.representation.PageListRepresentation;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.constraints.Min;
import java.util.Map;
/**
*
*/
@RestController
@RequestMapping(value = "/partners")
public class RestLoanApplicationsController {
@Resource
private LoanApplicationService applicationService;
/**
*
*
* @param params
* @param page
* @param pageSize
* @return
*/
@RequestMapping(value = "/loanApplications", method = RequestMethod.GET)
public Object listPagedLoanApplication(@RequestParam Map<String, Object> params,
@Min(1) @RequestParam(value = "page", required = false, defaultValue = "1") int page,
@Min(1) @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize) {
PageBounds pageBounds = new PageBounds(page, pageSize, Order.formString("create_time.desc"));
PageListRepresentation<LoanApplicationDescriptor> result = applicationService.listPagedLoanApplication(params, pageBounds);
return result;
}
}

@ -0,0 +1,23 @@
package au.com.royalpay.payment.manage.loanapplicaiton.domain.web.command;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
@Data
@Accessors(chain = true)
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class ModifyLoanApplicationCommand {
@NotBlank(message = "error.payment.valid.param_missing")
private String remark;
@NotBlank(message = "error.payment.valid.param_missing")
private String status;
}

@ -0,0 +1,35 @@
package au.com.royalpay.payment.manage.loanapplicaiton.infrastructure.repository;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.entity.LoanApplication;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.entity.request.ModifyLoanApplicationRequest;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.repository.LoanApplicationRepository;
import au.com.royalpay.payment.manage.mappers.loanapplication.LoanApplicationMapper;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.Map;
@Repository
public class LoanApplicationRepositoryImpl implements LoanApplicationRepository {
@Resource
private LoanApplicationMapper mapper;
@Override
public PageList<LoanApplication> listPagedLoanApplication(Map<String, Object> params, PageBounds pageBounds) {
return mapper.listPagedLoanApplication(params, pageBounds);
}
@Override
public LoanApplication getById(String id) {
return mapper.findById(id);
}
@Override
public void changeLoanApplication(ModifyLoanApplicationRequest request) {
mapper.updateLoanApplication(request);
}
}

@ -0,0 +1,54 @@
package au.com.royalpay.payment.manage.loanapplicaiton.infrastructure.service;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.descriptor.LoanApplicationDescriptor;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.entity.LoanApplication;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.entity.request.ModifyLoanApplicationRequest;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.repository.LoanApplicationRepository;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.service.LoanApplicationService;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.web.command.ModifyLoanApplicationCommand;
import au.com.royalpay.payment.manage.support.representation.PageListRepresentation;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Map;
@Service
public class LoanApplicationServiceImpl implements LoanApplicationService {
@Resource
private LoanApplicationRepository repository;
@Override
public PageListRepresentation<LoanApplicationDescriptor> listPagedLoanApplication(Map<String, Object> params, PageBounds pageBounds) {
PageList<LoanApplication> loanApplications = repository.listPagedLoanApplication(params, pageBounds);
PageList<LoanApplicationDescriptor> loanApplicationDescriptors = new PageList<>(loanApplications.getPaginator());
loanApplications.forEach(item -> {
loanApplicationDescriptors.add(item.describe());
});
return new PageListRepresentation<>(loanApplicationDescriptors);
}
@Override
public LoanApplicationDescriptor getById(String id) {
LoanApplication application = this.getLoanApplication(id);
return application.describe();
}
@Override
public void changeLoanApplication(String id, ModifyLoanApplicationCommand command) {
LoanApplication application = this.getLoanApplication(id);
repository.changeLoanApplication(new ModifyLoanApplicationRequest().build(application.getId(), command.getStatus(), command.getRemark()));
}
private LoanApplication getLoanApplication(String id) {
LoanApplication application = repository.getById(id);
if (application == null) {
throw new BadRequestException("Loan is not exist");
}
return application;
}
}

@ -0,0 +1,31 @@
package au.com.royalpay.payment.manage.mappers.loanapplication;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.entity.LoanApplication;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.entity.request.ModifyLoanApplicationRequest;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper;
import com.yixsoft.support.mybatis.autosql.annotations.AutoSql;
import com.yixsoft.support.mybatis.autosql.annotations.SqlType;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
@AutoMapper(tablename = "sys_clients_loans_apply", pkName = "id")
public interface LoanApplicationMapper {
PageList<LoanApplication> listPagedLoanApplication(Map<String, Object> params, PageBounds pageBounds);
@AutoSql(SqlType.INSERT)
void save(JSONObject request);
LoanApplication findById(@Param("id") String id);
@AutoSql(SqlType.UPDATE)
void updateLoanApplication(ModifyLoanApplicationRequest request);
@AutoSql(SqlType.DELETE)
void deleteLoanApplication(@Param("id") String id);
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.merchants.events.listeners;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.merchants.events.ClientApplyEvent; import au.com.royalpay.payment.manage.merchants.events.ClientApplyEvent;
import au.com.royalpay.payment.manage.officialwebsit.domain.entity.PartnerApplyType;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage; import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage;
@ -9,7 +10,6 @@ import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -45,7 +45,17 @@ public class SendingApplyToWechatMessageListener implements ApplicationListener<
private TemplateMessage initTemplate(ClientApplyEvent event, String loginUrl, String wxOpenid, String templateId) { private TemplateMessage initTemplate(ClientApplyEvent event, String loginUrl, String wxOpenid, String templateId) {
TemplateMessage msg = new TemplateMessage(wxOpenid, templateId, loginUrl); TemplateMessage msg = new TemplateMessage(wxOpenid, templateId, loginUrl);
if (event.getApplyInfo().containsKey("type")) {
String type = event.getApplyInfo().getString("type");
if (PartnerApplyType.typeOf(type).isCard()) {
msg.put("first", "有新商户提交了卡支付开通申请,请审核", "#ff0000");
}
if (PartnerApplyType.typeOf(type).isLoans()) {
msg.put("first", "有新商户提交了贷款开通申请,请审核", "#ff0000");
}
} else {
msg.put("first", "有新商户提交了开通申请,请审核", "#ff0000"); msg.put("first", "有新商户提交了开通申请,请审核", "#ff0000");
}
msg.put("keyword1", "商户开通申请", "#0000ff"); msg.put("keyword1", "商户开通申请", "#0000ff");
msg.put("keyword2", event.getApplyInfo().getString("company_name"), "#000000"); msg.put("keyword2", event.getApplyInfo().getString("company_name"), "#000000");
msg.put("keyword3", DateFormatUtils.format(event.getTimestamp(), "yyyy-MM-dd HH:mm:ss,z"), "#000000"); msg.put("keyword3", DateFormatUtils.format(event.getTimestamp(), "yyyy-MM-dd HH:mm:ss,z"), "#000000");

@ -0,0 +1,104 @@
package au.com.royalpay.payment.manage.officialwebsit.domain.entity;
/**
* 0,CARD 1,LOANS
*/
public enum PartnerApplyType {
/**
*
*/
CARD {
@Override
public int code() {
return 0;
}
@Override
public String value() {
return "CARD";
}
@Override
public String description() {
return "卡支付";
}
@Override
public boolean isCard() {
return true;
}
@Override
public boolean isLoans() {
return false;
}
},
/**
*
*/
LOANS {
@Override
public int code() {
return 1;
}
@Override
public String value() {
return "LOANS";
}
@Override
public String description() {
return "贷款申请";
}
@Override
public boolean isCard() {
return false;
}
@Override
public boolean isLoans() {
return true;
}
};
/**
*
*
* @return
*/
public abstract int code();
/**
*
*
* @return
*/
public abstract String value();
public abstract String description();
public static PartnerApplyType codeOf(int code) {
for (PartnerApplyType status : PartnerApplyType.values()) {
if (status.code() == code) {
return status;
}
}
return PartnerApplyType.CARD;
}
public static PartnerApplyType typeOf(String type) {
for (PartnerApplyType status : PartnerApplyType.values()) {
if (status.value().equalsIgnoreCase(type)) {
return status;
}
}
return PartnerApplyType.CARD;
}
public abstract boolean isCard();
public abstract boolean isLoans();
}

@ -0,0 +1,7 @@
package au.com.royalpay.payment.manage.officialwebsit.domain.repository;
import com.alibaba.fastjson.JSONObject;
public interface PartnerApplyRepository {
void save(JSONObject applyInfo);
}

@ -0,0 +1,7 @@
package au.com.royalpay.payment.manage.officialwebsit.domain.service;
import au.com.royalpay.payment.manage.officialwebsit.domain.web.command.PartnerApplyInfo;
public interface PartnerApplyService {
void applyPartner(PartnerApplyInfo apply);
}

@ -0,0 +1,46 @@
package au.com.royalpay.payment.manage.officialwebsit.domain.web;
import au.com.royalpay.payment.manage.officialwebsit.domain.service.PartnerApplyService;
import au.com.royalpay.payment.manage.officialwebsit.domain.web.command.PartnerApplyInfo;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.http.HttpUtils;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
/**
* /
*/
@RestController
@RequestMapping("/partners")
public class RestPartnerApplyController {
@Resource
private PartnerApplyService applyService;
/**
* /
*
* @param apply
* @param errors
* @param response
* @throws Exception
*/
@RequestMapping(value = "/website/application", method = RequestMethod.POST)
public void applyPartner(@RequestBody @Valid PartnerApplyInfo apply,
Errors errors, HttpServletResponse response) throws Exception {
if (!PlatformEnvironment.getEnv().enablePartnerApply()) {
throw new BadRequestException("商户自主申请暂时关闭. Merchant Apply disabled at the moment.");
}
HttpUtils.handleValidErrors(errors);
applyService.applyPartner(apply);
}
}

@ -0,0 +1,104 @@
package au.com.royalpay.payment.manage.officialwebsit.domain.web.command;
/**
* /
*/
public class PartnerApplyInfo {
/**
* name
*/
private String firstName;
/**
* name
*/
private String surname;
/**
*
*/
private String phoneNumber;
/**
* email
*/
private String emailAddress;
/**
*
*/
private String businessName;
/**
*
*/
private String industry;
/**
* 0,CARD 1,LOANS
*/
private String type;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getIndustry() {
return industry;
}
public void setIndustry(String industry) {
this.industry = industry;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
return "PartnerApplyInfo{" +
"firstName='" + firstName + '\'' +
", Surname='" + surname + '\'' +
", phoneNumber='" + phoneNumber + '\'' +
", emailAddress='" + emailAddress + '\'' +
", businessName='" + businessName + '\'' +
", industry='" + industry + '\'' +
", type='" + type + '\'' +
'}';
}
}

@ -0,0 +1,20 @@
package au.com.royalpay.payment.manage.officialwebsit.infrastructure.repository;
import au.com.royalpay.payment.manage.mappers.loanapplication.LoanApplicationMapper;
import au.com.royalpay.payment.manage.officialwebsit.domain.repository.PartnerApplyRepository;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
@Repository
public class PartnerApplyRepositoryImpl implements PartnerApplyRepository {
@Resource
private LoanApplicationMapper mapper;
@Override
public void save(JSONObject applyInfo) {
mapper.save(applyInfo);
}
}

@ -0,0 +1,79 @@
package au.com.royalpay.payment.manage.officialwebsit.infrastructure.service;
import au.com.royalpay.payment.manage.loanapplicaiton.domain.entity.LoanApplicationStatus;
import au.com.royalpay.payment.manage.mappers.system.ClientApplyMapper;
import au.com.royalpay.payment.manage.merchants.events.ClientApplyEvent;
import au.com.royalpay.payment.manage.officialwebsit.domain.entity.PartnerApplyType;
import au.com.royalpay.payment.manage.officialwebsit.domain.repository.PartnerApplyRepository;
import au.com.royalpay.payment.manage.officialwebsit.domain.service.PartnerApplyService;
import au.com.royalpay.payment.manage.officialwebsit.domain.web.command.PartnerApplyInfo;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.UUID;
@Slf4j
@Service
public class PartnerApplyServiceImpl implements PartnerApplyService, ApplicationEventPublisherAware {
@Resource
private ClientApplyMapper clientApplyMapper;
@Resource
private PartnerApplyRepository applyRepository;
@Resource
private ApplicationEventPublisher publisher;
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.publisher = applicationEventPublisher;
}
@Override
public void applyPartner(PartnerApplyInfo apply) {
PartnerApplyType applyType = PartnerApplyType.typeOf(apply.getType());
if (applyType.isCard()) {
JSONObject applyInfo = this.buildCardPaymentApplyInfo(apply);
clientApplyMapper.save(applyInfo);
publisher.publishEvent(new ClientApplyEvent(this, applyInfo));
}
if (applyType.isLoans()) {
JSONObject applyInfo = this.buildLoansApplyInfo(apply);
applyRepository.save(applyInfo);
publisher.publishEvent(new ClientApplyEvent(this, applyInfo));
}
}
private JSONObject buildLoansApplyInfo(PartnerApplyInfo apply) {
JSONObject result = new JSONObject();
String name = apply.getFirstName() + " " + apply.getSurname();
result.put("id", UUID.randomUUID().toString());
result.put("name", name);
result.put("phone", apply.getPhoneNumber());
result.put("email", apply.getEmailAddress());
result.put("industry", apply.getIndustry());
result.put("business_name", apply.getBusinessName());
result.put("status", LoanApplicationStatus.READY.code());
return result;
}
private JSONObject buildCardPaymentApplyInfo(PartnerApplyInfo apply) {
JSONObject result = new JSONObject();
String name = apply.getFirstName() + " " + apply.getSurname();
result.put("client_apply_id", UUID.randomUUID().toString());
result.put("contact_person", name);
result.put("contact_phone", apply.getPhoneNumber());
result.put("contact_email", apply.getEmailAddress());
result.put("company_name", apply.getBusinessName());
result.put("industry", apply.getIndustry());
result.put("type", 1);
return result;
}
}

@ -0,0 +1,33 @@
package au.com.royalpay.payment.manage.support.representation;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.github.miemiedev.mybatis.paginator.domain.Paginator;
public class PageListRepresentation<T> {
private PageList data;
private Paginator pagination;
public PageListRepresentation(PageList pageList) {
this.data = pageList;
this.pagination = pageList.getPaginator();
}
public PageList getData() {
return data;
}
public void setData(PageList data) {
this.data = data;
}
public Paginator getPagination() {
return pagination;
}
public void setPagination(Paginator pagination) {
this.pagination = pagination;
}
}

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.loanapplication.LoanApplicationMapper">
<resultMap id="loanApplicationMap"
type="au.com.royalpay.payment.manage.loanapplicaiton.domain.entity.LoanApplication">
<id column="id" property="id"/>
<result column="create_time" property="createTime"/>
<result column="modify_time" property="modifyTime"/>
<result column="creator" property="creator"/>
<result column="modifier" property="modifier"/>
<result column="client_id" property="clientId"/>
<result column="name" property="name"/>
<result column="phone" property="phone"/>
<result column="email" property="email"/>
<result column="business_name" property="businessName"/>
<result column="industry" property="industry"/>
<result column="remark" property="remark"/>
<result column="status" property="status" typeHandler="org.apache.ibatis.type.EnumOrdinalTypeHandler"/>
</resultMap>
<select id="listPagedLoanApplication"
resultMap="loanApplicationMap">
SELECT * FROM sys_clients_loans_apply scla
ORDER BY scla.create_time DESC
</select>
<select id="findById"
resultMap="loanApplicationMap">
SELECT * FROM sys_clients_loans_apply scla
WHERE scla.id=#{id}
</select>
</mapper>
Loading…
Cancel
Save