Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
8f4e2a7bf8
|
|
@ -3,16 +3,17 @@ package com.chushang.loan.controller;
|
|||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.chushang.common.core.web.AjaxResult;
|
||||
import com.chushang.common.log.annotation.SysLog;
|
||||
import com.chushang.common.mybatis.utils.PageResult;
|
||||
import com.chushang.loan.domin.dto.LoanApproval;
|
||||
import com.chushang.loan.domin.entity.LoanEntity;
|
||||
import com.chushang.loan.domin.query.LoanFormQuery;
|
||||
import com.chushang.loan.service.ILoanService;
|
||||
import com.chushang.security.annotation.InnerAuth;
|
||||
import com.chushang.security.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/loan")
|
||||
|
|
@ -26,7 +27,7 @@ public class LoanController {
|
|||
/**
|
||||
* 提交表单数据
|
||||
*/
|
||||
@PostMapping("/qcCode")
|
||||
@PostMapping("/qcode")
|
||||
public AjaxResult submitFormData(@RequestBody @Validated LoanFormQuery formData) throws Exception{
|
||||
return AjaxResult.success(iLoanService.qcCode(formData));
|
||||
}
|
||||
|
|
@ -34,17 +35,19 @@ public class LoanController {
|
|||
/**
|
||||
* 查询表单
|
||||
*/
|
||||
@PostMapping("/find")
|
||||
public IPage<LoanEntity> queryLoan(@RequestBody LoanEntity query) {
|
||||
return iLoanService.queryLoan(query);
|
||||
@GetMapping("/find")
|
||||
@RequiresPermissions("loan:loan:find")
|
||||
public AjaxResult queryLoan(LoanEntity query) {
|
||||
return AjaxResult.success(iLoanService.queryLoan(query));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询表单
|
||||
*/
|
||||
@PostMapping("/data")
|
||||
public AjaxResult data(@RequestBody LoanFormQuery query) {
|
||||
@GetMapping("/data")
|
||||
@RequiresPermissions("loan:loan:data")
|
||||
public AjaxResult data( LoanEntity query) {
|
||||
return AjaxResult.success(iLoanService.queryData(query));
|
||||
}
|
||||
|
||||
|
|
@ -53,6 +56,8 @@ public class LoanController {
|
|||
* 审批
|
||||
*/
|
||||
@PostMapping("/approval")
|
||||
@SysLog(value = "审批贷款")
|
||||
@RequiresPermissions("loan:loan:approval")
|
||||
public AjaxResult approval(@RequestBody @Validated LoanApproval approval) {
|
||||
return AjaxResult.success(iLoanService.approval(approval));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public class LoanEntity extends BaseEntity {
|
|||
* 渠道名
|
||||
*/
|
||||
@TableField(value = "channel_name")
|
||||
@Condition(name = "channel_name", type = Condition.ConditionType.like)
|
||||
private String channelName;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ public class LoanData implements Serializable {
|
|||
*/
|
||||
private String authorName;
|
||||
|
||||
/**
|
||||
* 表单编号
|
||||
*/
|
||||
private String formNumber;
|
||||
|
||||
|
||||
/**
|
||||
* 提交人手机号
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,15 +1,18 @@
|
|||
package com.chushang.loan.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.chushang.loan.domin.entity.LoanEntity;
|
||||
import com.chushang.loan.domin.query.LoanFormQuery;
|
||||
import com.chushang.loan.domin.vo.LoanData;
|
||||
import com.chushang.security.entity.po.SysUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface LoanMapper extends BaseMapper<LoanEntity> {
|
||||
|
||||
|
||||
List<LoanData> queryDataList(LoanFormQuery queryy);
|
||||
List<LoanData> queryDataList(@Param("query") LoanEntity query, Page<LoanEntity> page);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ public interface ILoanService {
|
|||
|
||||
String qcCode(LoanFormQuery formData) throws Exception;
|
||||
|
||||
IPage<LoanEntity> queryLoan(LoanEntity query);
|
||||
PageResult queryLoan(LoanEntity query);
|
||||
|
||||
PageResult queryData(LoanFormQuery query);
|
||||
PageResult queryData(LoanEntity query);
|
||||
|
||||
int approval(LoanApproval approval);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.chushang.common.core.constant.SecurityConstants;
|
||||
import com.chushang.common.core.web.AjaxResult;
|
||||
import com.chushang.common.core.web.Result;
|
||||
import com.chushang.common.mybatis.page.CommonParam;
|
||||
import com.chushang.common.mybatis.utils.PageResult;
|
||||
|
|
@ -80,14 +81,14 @@ public class LoanServiceImpl extends ServiceImpl<LoanMapper, LoanEntity> impleme
|
|||
Result<SysUserQcCode> userInfo = remoteUserQcCodeService.getUserInfo(new UserQcCodeDTO() {{
|
||||
setUserId(SecurityUtils.getUserId());
|
||||
}});
|
||||
if(userInfo.getCode() == 200 && !Objects.isNull(userInfo.getData())){
|
||||
if(userInfo.isSuccess()){
|
||||
codeUrl = userInfo.getData().getLoanCode();
|
||||
}else{
|
||||
|
||||
Result<String> stringResult = remoteOssService.uploadQcCode();
|
||||
if(stringResult.getCode() == 200){
|
||||
if(stringResult.isSuccess()){
|
||||
codeUrl = stringResult.getData();
|
||||
Result<Integer> save = remoteUserQcCodeService.save(new UserQcCodeDTO() {{
|
||||
remoteUserQcCodeService.save(new UserQcCodeDTO() {{
|
||||
setUrl(stringResult.getData());
|
||||
setUserId(SecurityUtils.getUserId());
|
||||
}});
|
||||
|
|
@ -100,20 +101,23 @@ public class LoanServiceImpl extends ServiceImpl<LoanMapper, LoanEntity> impleme
|
|||
|
||||
@Override
|
||||
@DataScope
|
||||
public IPage<LoanEntity> queryLoan(LoanEntity query) {
|
||||
public PageResult queryLoan(LoanEntity query) {
|
||||
CommonParam commonParam = CommonParam.buildPageRequest();
|
||||
LambdaQueryWrapper<LoanEntity> queryWrapper = WrapperUtils.builder(query, query, commonParam);
|
||||
IPage<LoanEntity> page = this.page(
|
||||
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(commonParam.getPage(), commonParam.getLimit()),
|
||||
Page<LoanEntity> page = this.page(
|
||||
new Page<>(commonParam.getPage(), commonParam.getLimit()),
|
||||
queryWrapper
|
||||
);
|
||||
return page;
|
||||
return new PageResult(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult queryData(LoanFormQuery query) {
|
||||
Page<LoanVO> of = query.of();
|
||||
List<LoanData> loanVOSList = baseMapper.queryDataList(query);
|
||||
@DataScope(deptAlias = "u", userAlias = "u")
|
||||
public PageResult queryData(LoanEntity query) {
|
||||
|
||||
CommonParam commonParam = CommonParam.buildPageRequest();
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page<LoanEntity> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(commonParam.getPage(),commonParam.getLimit());
|
||||
List<LoanData> loanVOSList = baseMapper.queryDataList(query,page);
|
||||
List<LoanVO> resultList = new ArrayList<>();
|
||||
for (LoanData loanData:loanVOSList){
|
||||
LoanVO loanVO = new LoanVO();
|
||||
|
|
@ -122,7 +126,11 @@ public class LoanServiceImpl extends ServiceImpl<LoanMapper, LoanEntity> impleme
|
|||
loanVO.setTotalLoanAmount(String.valueOf(loanData.getTotalLoanAmount()));
|
||||
resultList.add(loanVO);
|
||||
}
|
||||
return new PageResult(resultList, of.getTotal(), of.getPages(), of.getCurrent());
|
||||
return new PageResult(
|
||||
resultList,
|
||||
page.getTotal(),
|
||||
page.getPages(),
|
||||
page.getCurrent());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,43 @@
|
|||
<mapper namespace="com.chushang.loan.mapper.LoanMapper">
|
||||
|
||||
|
||||
<select id="queryDataList" resultType="com.chushang.loan.domin.vo.LoanData">
|
||||
<select id="queryDataList" resultType="com.chushang.loan.domin.vo.LoanData"
|
||||
parameterType="com.chushang.loan.domin.vo.LoanData">
|
||||
select channel_name,
|
||||
author_name,
|
||||
author_phone,
|
||||
COUNT(if(status = 2, id, null)) as totalOpenFlux,
|
||||
SUM(if(status = 2, loan_amount, null)) as totalLoanAmount,
|
||||
sum(application_amount) as totalTransactionAmount
|
||||
from loan group by user_id,channel_name,author_name,author_phone
|
||||
from loan
|
||||
where del_state = false
|
||||
<if test="query.channelName != '' and query.channelName != null">
|
||||
AND channel_name like concat('%',#{query.channelName},'%')
|
||||
</if>
|
||||
<if test="query.formNumber != '' and query.formNumber != null ">
|
||||
AND form_number = #{query.formNumber}
|
||||
</if>
|
||||
<if test="query.authorPhone != '' and query.authorPhone != null">
|
||||
AND author_phone = #{query.authorPhone}
|
||||
</if>
|
||||
<if test="query.authorName != '' and query.authorName != null ">
|
||||
AND author_name like concat('%',#{query.authorName},'%')
|
||||
</if>
|
||||
<if test="query.deptId != null">
|
||||
AND dept_id = #{query.deptId}
|
||||
</if>
|
||||
<if test="query.status != null">
|
||||
AND status = #{query.status}
|
||||
</if>
|
||||
|
||||
<if test="query.submissionTimes != null and query.submissionTimes.size() > 1 ">
|
||||
AND submission_time between #{query.submissionTimes[0]} and #{query.submissionTimes[1]}
|
||||
</if>
|
||||
|
||||
group by user_id,channel_name,author_name,author_phone
|
||||
|
||||
|
||||
${query.sqlParam.dataScope}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue