Merge remote-tracking branch 'origin/develop' into develop

master
yixian 4 years ago
commit a450d50615

@ -0,0 +1,22 @@
ALTER TABLE `sys_clients_apply`
ADD COLUMN `type` smallint(1) NULL DEFAULT 0 COMMENT '0:PC 1:PC-卡支付';
CREATE TABLE `sys_clients_loans_apply` (
`id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键id',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
`modifiy_time` timestamp(0) NULL DEFAULT NULL COMMENT '修改时间',
`modifier` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改者',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人姓名',
`phone` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人手机',
`email` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系邮箱',
`business_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商业名称',
`industry` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '行业',
`status` int(1) NULL DEFAULT 0 COMMENT '贷款申请状态 0:待处理、1:处理中、2:已处理',
`source` int(1) NULL DEFAULT 0 COMMENT '申请来源: 0 : PC1公众号菜单2公众号推送3小程序申请4App申请',
`client_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户id',
`client_moniker` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户的parterCode',
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注信息',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '贷款申请表' ROW_FORMAT = Dynamic;

@ -0,0 +1,54 @@
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 statusDescription;
/**
*
*/
private String remark;
/**
*
*/
private Integer source;
}

@ -0,0 +1,83 @@
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;
/**
*
*/
private Integer source;
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.value())
.setStatusDescription(this.status.description())
.setRemark(this.remark)
.setSource(this.source);
}
}

@ -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,81 @@
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());
result.put("source", 0);
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("short_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,41 @@
<?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="source" property="source"/>
<result column="status" property="status" typeHandler="org.apache.ibatis.type.EnumOrdinalTypeHandler"/>
</resultMap>
<select id="listPagedLoanApplication"
resultMap="loanApplicationMap">
SELECT * FROM sys_clients_loans_apply scla
<where>
<if test="businessName!=null">
<bind name="business_name_pattern" value="'%'+businessName+'%'"/>
and scla.business_name like #{business_name_pattern}
</if>
</where>
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>

@ -19,6 +19,19 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
return $http.get('/partners/application/' + $stateParams.client_apply_id); return $http.get('/partners/application/' + $stateParams.client_apply_id);
}] }]
} }
}).state('partner_apply.loans_application', {
url: '/loans/application',
templateUrl: '/static/payment/partner/templates/partner_loans_application.html',
controller: 'partnerLoansApplicationListCtrl'
}).state('partner_apply.loans_application_detail', {
url: '/loans/application/{id}',
templateUrl: '/static/payment/partner/templates/partner_loans_application_detail.html',
controller: 'partnerLoansApplicationDetailCtrl',
resolve: {
partner: ['$http', '$stateParams', function ($http, $stateParams) {
return $http.get('/partners/loanApplications/' + $stateParams.id);
}]
}
}) })
}]); }]);
app.controller('partnerApplyCtrl', ['$rootScope', '$state', function ($rootScope, $state) { app.controller('partnerApplyCtrl', ['$rootScope', '$state', function ($rootScope, $state) {
@ -206,6 +219,67 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
}]); }]);
app.controller('partnerLoansApplicationListCtrl', ['$scope', '$state', '$http', '$uibModal', 'commonDialog', 'industryMap', 'stateMap', 'countryMap',
function ($scope, $state, $http, $uibModal, commonDialog, industryMap, stateMap, countryMap) {
$scope.pagination = {};
$scope.industries = industryMap.configs()
$scope.states = stateMap.configs();
$scope.countries = countryMap.configs();
$scope.params = {};
$scope.loadPartners = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/partners/loanApplications', {params: params}).then(function (resp) {
$scope.partners = resp.data.data;
$scope.pagination = resp.data.pagination;
});
};
$scope.loadPartners(1);
$scope.handleButton = function (obj) {
var partner = angular.copy(obj);
partner.link = true;
$uibModal.open({
templateUrl: '/static/payment/partner/templates/partner_loans_application_edit.html',
controller: 'partnerApplicationEditCtrl',
resolve: {
partner: partner
}
}).result.then(function () {
commonDialog.alert({title: 'Success', content: '修改成功!', type: 'success'});
$state.reload();
// $state.go('partner_application.detail', {client_apply_id: obj.client_apply_id}, {reload: true});
})
};
}]);
app.controller('partnerApplicationEditCtrl', ['$scope', '$http', '$state', 'partner', function ($scope, $http, $state, partner) {
$scope.partner = angular.copy(partner);
$scope.submit = function (form) {
if (form.$invalid) {
angular.forEach(form, function (item, key) {
if (key.indexOf('$') <= 0) {
item.$dirty = true;
}
});
return;
}
$scope.errmsg = null;
$http.put('/partners/loanApplications/' + partner.id, $scope.partner).then(function (resp) {
$scope.$close();
}, function (resp) {
$scope.errmsg = resp.data.message;
});
};
}]);
app.filter('cut', function () { app.filter('cut', function () {
return function (value, wordwise, max, tail) { return function (value, wordwise, max, tail) {
if (!value) return ''; if (!value) return '';

@ -53,7 +53,7 @@
<!--<td ng-bind="partner.industry"></td>--> <!--<td ng-bind="partner.industry"></td>-->
<td ng-bind="partner.suburb"></td> <td ng-bind="partner.suburb"></td>
<td> <td>
<span ng-if="partner.source==0">PC</span> <span ng-if="partner.source==0">PC<span ng-if="partner.type==1">(卡支付)</span></span>
<span ng-if="partner.source==1">公众号菜单</span> <span ng-if="partner.source==1">公众号菜单</span>
<span ng-if="partner.source==2">公众号推送</span> <span ng-if="partner.source==2">公众号推送</span>
<span ng-if="partner.source==3">小程序申请</span> <span ng-if="partner.source==3">小程序申请</span>

@ -320,7 +320,7 @@
<td style="text-align: center"> <td style="text-align: center">
<a role="button" ng-click="editRate(rate)" style="padding-right: 10px;" <a role="button" ng-click="editRate(rate)" style="padding-right: 10px;"
ng-if="'011'|withRole"><i class="fa fa-edit"></i></a> ng-if="'011'|withRole"><i class="fa fa-edit"></i></a>
<span ng-if="rate.active=='1' && (bankCtrl.rate_name=='rpaypmt_card' ||bankCtrl.rate_name=='rpaypmt_dd') <span ng-if="(bankCtrl.rate_name=='rpaypmt_card' ||bankCtrl.rate_name=='rpaypmt_dd')
&& partner.upay_approve_result"> && partner.upay_approve_result">
<span style="color: orange">(Promotional Offer)</span> <span style="color: orange">(Promotional Offer)</span>
<a class="fa fa-cloud-download" target="_blank" <a class="fa fa-cloud-download" target="_blank"

@ -0,0 +1,90 @@
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="box-solid">
<div class="box box-warning">
<div class="box-header">
<div class="form-inline">
<div class="form-group">
<label class="control-label" for="short-name-search">Company Name</label>
<input type="text" class="form-control" id="short-name-search"
ng-model="params.businessName">
</div>
<div class="form-group">
<button class="btn btn-primary" type="button" ng-click="loadPartners(1)"><i
class="fa fa-search"></i></button>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">Application List</h3>
</div>
<div class="box-body no-padding table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Application Time</th>
<th>Company Name</th>
<th>Source</th>
<th>Approve Status</th>
<th>Remark</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="partner in partners">
<td ng-bind="partner.createTime"></td>
<td ng-bind="partner.businessName"></td>
<td>
<span ng-if="partner.source==0">PC</span>
<span ng-if="partner.source==1">公众号菜单</span>
<span ng-if="partner.source==2">公众号推送</span>
<span ng-if="partner.source==3">小程序申请</span>
<span ng-if="partner.source==4">App申请</span>
</td>
<td>
<span>{{partner.statusDescription}}</span>
</td>
<td ng-bind="partner.remark|limitTo:10" title="{{partner.remark}}"></td>
<td>
<a class="text-primary" role="button" ng-click="handleButton(partner)">
<i class="fa fa-cog"></i> handle
</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="partners.length">
<uib-pagination class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="loadPartners()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total
Pages:{{pagination.totalPages}}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,33 @@
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<form name="partnerForm" novalidate>
<div class="form-group" style="display:flex;margin-top: 26px;">
<label class="control-label col-xs-4 col-sm-3">Status</label>
<div class="col-xs-8">
<select class="form-control" ng-model="partner.status">
<option value="READY">READY</option>
<option value="PROCESSING">PROCESSING</option>
<option value="COMPLETED">COMPLETED</option>
</select>
</div>
</div>
<div class="form-group" style="display:flex;">
<label class="control-label col-sm-3" for="short-id-input">Remark</label>
<div class="col-sm-9">
<input class="form-control" ng-model="partner.remark"
type="text"
id="short-id-input">
</div>
</div>
</form>
</div>
<div class="col-sm-12">
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" ng-click="$dismiss()">Cancel</button>
<button type="button" class="btn btn-success" ng-click="submit(partnerForm)">Submit</button>
</div>

@ -19,9 +19,9 @@
<li ui-sref-active="active" ng-if="'simpleApplyApp'|withModule"> <li ui-sref-active="active" ng-if="'simpleApplyApp'|withModule">
<a ui-sref="partner_apply.simple_application"> <span>Application & Open</span></a> <a ui-sref="partner_apply.simple_application"> <span>Application & Open</span></a>
</li> </li>
<!--<li ui-sref-active-eq="active" ng-if="'citypartner'|withModule"> <li ui-sref-active-eq="active" ng-if="'simpleApplyApp'|withModule">
<a ui-sref="partner_apply.citypartner_reg"><i class="fa fa-tv"></i> <span>City Partners</span></a> <a ui-sref="partner_apply.loans_application"><span>Loans Application</span></a>
</li>--> </li>
</ul> </ul>
</div> </div>
</div> </div>

Loading…
Cancel
Save