commit
d9e8409ddd
@ -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);
|
||||||
|
|
||||||
|
}
|
@ -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,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>
|
@ -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="‹"
|
||||||
|
next-text="›"
|
||||||
|
first-text="«"
|
||||||
|
last-text="»"></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>
|
Loading…
Reference in new issue