
66 changed files with 1908 additions and 167 deletions
@ -0,0 +1,30 @@ |
|||
package com.yxt.anrui.portal.api.sysnotice; |
|||
|
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/30 |
|||
**/ |
|||
@Data |
|||
public class SysNotice extends BaseEntity { |
|||
|
|||
private static final long serialVersionUID = 8324297245354558865L; |
|||
@ApiModelProperty("标题") |
|||
private String title; |
|||
@ApiModelProperty("有效期至") |
|||
private String validityDate; |
|||
@ApiModelProperty("类别") |
|||
private String type; |
|||
@ApiModelProperty("类别key") |
|||
private String typeKey; |
|||
@ApiModelProperty("是否置顶") |
|||
private String topping; |
|||
@ApiModelProperty("内容") |
|||
private String content; |
|||
@ApiModelProperty("附件") |
|||
private String files; |
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.yxt.anrui.portal.api.sysnotice; |
|||
|
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/31 |
|||
**/ |
|||
@Data |
|||
public class SysNoticeDetailsVo { |
|||
|
|||
private String sid; |
|||
|
|||
@ApiModelProperty("标题") |
|||
private String title; |
|||
@ApiModelProperty("有效期至") |
|||
private String validityDate; |
|||
@ApiModelProperty("类别") |
|||
private String type; |
|||
@ApiModelProperty("类别key") |
|||
private String typeKey; |
|||
@ApiModelProperty("是否置顶") |
|||
private String topping; |
|||
@ApiModelProperty("内容") |
|||
private String content; |
|||
@ApiModelProperty("附件") |
|||
private List<UrlQuery> filesList = new ArrayList<>(); |
|||
|
|||
private String createTime; |
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.yxt.anrui.portal.api.sysnotice; |
|||
|
|||
import com.yxt.common.core.dto.Dto; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/31 |
|||
**/ |
|||
@Data |
|||
public class SysNoticeDto implements Dto { |
|||
private static final long serialVersionUID = 8074080443156103663L; |
|||
|
|||
private String sid; |
|||
|
|||
@ApiModelProperty("标题") |
|||
private String title; |
|||
@ApiModelProperty("有效期至") |
|||
private String validityDate; |
|||
@ApiModelProperty("类别") |
|||
private String type; |
|||
@ApiModelProperty("类别key") |
|||
private String typeKey; |
|||
@ApiModelProperty("是否置顶") |
|||
private String topping; |
|||
@ApiModelProperty("内容") |
|||
private String content; |
|||
@ApiModelProperty("附件") |
|||
private List<UrlQuery> filesList = new ArrayList<>(); |
|||
|
|||
private String createTime; |
|||
|
|||
} |
@ -0,0 +1,53 @@ |
|||
package com.yxt.anrui.portal.api.sysnotice; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/30 |
|||
**/ |
|||
@Api(tags = "通知公告") |
|||
@FeignClient( |
|||
contextId = "anrui-portal-SysNotice", |
|||
name = "anrui-portal", |
|||
path = "v1/SysNotice", |
|||
fallback = SysNoticeFeignFallback.class) |
|||
public interface SysNoticeFeign { |
|||
|
|||
@ApiOperation("分页列表") |
|||
@PostMapping("/listPage") |
|||
ResultBean<PagerVo<SysNoticeVo>> listPage(@RequestBody PagerQuery<SysNoticeQuery> pagerQuery); |
|||
|
|||
@ApiOperation("新增修改保存") |
|||
@PostMapping("/saveOrUpdate") |
|||
ResultBean saveOrUpdate(@RequestBody SysNoticeDto dto); |
|||
|
|||
@ApiOperation("初始化") |
|||
@GetMapping("/getDetails") |
|||
ResultBean<SysNoticeDetailsVo> getDetails(@RequestParam("sid") String sid); |
|||
|
|||
@ApiOperation("开启关闭:1是开启,2是关闭") |
|||
@PostMapping("/setState") |
|||
ResultBean setState(@RequestBody SysNoticesQuery query); |
|||
|
|||
@ApiOperation("置顶是,取消置顶否") |
|||
@PostMapping("/setTopping") |
|||
ResultBean setTopping(@RequestBody SysNoticessQuery query); |
|||
|
|||
@ApiOperation("首页通知公告") |
|||
@GetMapping("/getLists") |
|||
ResultBean<List<SysNoticeListVo>> getLists(); |
|||
|
|||
@ApiOperation("删除/批量删除") |
|||
@DeleteMapping("/delBySids") |
|||
ResultBean delBySids(@RequestBody String[] sids); |
|||
} |
@ -0,0 +1,12 @@ |
|||
package com.yxt.anrui.portal.api.sysnotice; |
|||
|
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/30 |
|||
**/ |
|||
@Component |
|||
public class SysNoticeFeignFallback { |
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.yxt.anrui.portal.api.sysnotice; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/31 |
|||
**/ |
|||
@Data |
|||
public class SysNoticeListVo { |
|||
|
|||
private String sid; |
|||
private String title; |
|||
private String createTime; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.yxt.anrui.portal.api.sysnotice; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/30 |
|||
**/ |
|||
@Data |
|||
public class SysNoticeQuery implements Query { |
|||
private static final long serialVersionUID = -2087301472856056824L; |
|||
@ApiModelProperty("标题") |
|||
private String title; |
|||
@ApiModelProperty("发布时间开始") |
|||
private String createDateStart; |
|||
@ApiModelProperty("发布时间结束") |
|||
private String createDateEnd; |
|||
@ApiModelProperty("是否置顶") |
|||
private String topping; |
|||
@ApiModelProperty("开启1,关闭2") |
|||
private String state; |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.yxt.anrui.portal.api.sysnotice; |
|||
|
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/30 |
|||
**/ |
|||
@Data |
|||
public class SysNoticeVo { |
|||
private String sid; |
|||
@ApiModelProperty("标题") |
|||
private String title; |
|||
@ApiModelProperty("发布时间") |
|||
private String createDate; |
|||
@ApiModelProperty("有效期至") |
|||
private String validityDate; |
|||
@ApiModelProperty("状态") |
|||
private String stateValue; |
|||
@ApiModelProperty("是否置顶") |
|||
private String topping; |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.yxt.anrui.portal.api.sysnotice; |
|||
|
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/31 |
|||
**/ |
|||
@Data |
|||
public class SysNoticesQuery { |
|||
|
|||
@ApiModelProperty("sids") |
|||
private List<String> sidsList = new ArrayList<>(); |
|||
@ApiModelProperty("1开启、2关闭") |
|||
private String state; |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.yxt.anrui.portal.api.sysnotice; |
|||
|
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/31 |
|||
**/ |
|||
@Data |
|||
public class SysNoticessQuery { |
|||
|
|||
@ApiModelProperty("sids") |
|||
private List<String> sidsList = new ArrayList<>(); |
|||
@ApiModelProperty("置顶是、取消置顶否") |
|||
private String topping; |
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.yxt.anrui.portal.api.sysnotice; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/31 |
|||
**/ |
|||
@Data |
|||
public class UrlQuery { |
|||
|
|||
private String url; |
|||
|
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.yxt.anrui.portal.biz.sysnotice; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import com.yxt.anrui.portal.api.sysnotice.SysNotice; |
|||
import com.yxt.anrui.portal.api.sysnotice.SysNoticeListVo; |
|||
import com.yxt.anrui.portal.api.sysnotice.SysNoticeVo; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/30 |
|||
**/ |
|||
@Mapper |
|||
public interface SysNoticeMapper extends BaseMapper<SysNotice> { |
|||
IPage<SysNoticeVo> selectPageVo(IPage<SysNotice> page, @Param(Constants.WRAPPER) QueryWrapper<SysNotice> qw); |
|||
|
|||
List<SysNoticeListVo> getLists(); |
|||
} |
@ -0,0 +1,26 @@ |
|||
<?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="com.yxt.anrui.portal.biz.sysnotice.SysNoticeMapper"> |
|||
<select id="selectPageVo" resultType="com.yxt.anrui.portal.api.sysnotice.SysNoticeVo"> |
|||
select sn.sid,sn.title, |
|||
DATE_FORMAT(sn.createTime, '%Y-%m-%d') as createDate, |
|||
sn.validityDate, |
|||
case state |
|||
when 1 |
|||
then '开启' |
|||
when 2 then '关闭' end as stateValue, |
|||
sn.topping |
|||
from sys_notice sn |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="getLists" resultType="com.yxt.anrui.portal.api.sysnotice.SysNoticeListVo"> |
|||
select sid, title, DATE_FORMAT(createTime, '%Y-%m-%d') as createTime |
|||
from sys_notice |
|||
where state = 1 and (validityDate is null or validityDate = '' or validityDate>NOW()) |
|||
order by topping desc, createTime desc |
|||
limit 4 |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,63 @@ |
|||
package com.yxt.anrui.portal.biz.sysnotice; |
|||
|
|||
import com.yxt.anrui.portal.api.sysnotice.*; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import io.swagger.annotations.Api; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/30 |
|||
**/ |
|||
@Api(tags = "通知公告") |
|||
@RestController |
|||
@RequestMapping("v1/SysNotice") |
|||
public class SysNoticeRest implements SysNoticeFeign { |
|||
|
|||
@Autowired |
|||
private SysNoticeService sysNoticeService; |
|||
|
|||
@Override |
|||
public ResultBean<PagerVo<SysNoticeVo>> listPage(PagerQuery<SysNoticeQuery> pagerQuery) { |
|||
ResultBean<PagerVo<SysNoticeVo>> rb = ResultBean.fireFail(); |
|||
PagerVo<SysNoticeVo> pv = sysNoticeService.listPageVo(pagerQuery); |
|||
return rb.success().setData(pv); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean saveOrUpdate(SysNoticeDto dto) { |
|||
return sysNoticeService.saveOrUpdateNotice(dto); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean<SysNoticeDetailsVo> getDetails(String sid) { |
|||
return sysNoticeService.getDetails(sid); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean setState(SysNoticesQuery query) { |
|||
return sysNoticeService.setState(query); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean setTopping(SysNoticessQuery query) { |
|||
return sysNoticeService.setTopping(query); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean<List<SysNoticeListVo>> getLists() { |
|||
return sysNoticeService.getLists(); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean delBySids(String[] sids) { |
|||
return sysNoticeService.delAllBySids(sids); |
|||
} |
|||
} |
@ -0,0 +1,174 @@ |
|||
package com.yxt.anrui.portal.biz.sysnotice; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.date.DateUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.anrui.portal.api.sysnotice.*; |
|||
import com.yxt.common.base.config.component.FileUploadComponent; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.PagerUtil; |
|||
import com.yxt.common.base.utils.StringUtils; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.Collections; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/1/30 |
|||
**/ |
|||
@Service |
|||
public class SysNoticeService extends MybatisBaseService<SysNoticeMapper, SysNotice> { |
|||
|
|||
@Autowired |
|||
private FileUploadComponent fileUploadComponent; |
|||
|
|||
public PagerVo<SysNoticeVo> listPageVo(PagerQuery<SysNoticeQuery> pagerQuery) { |
|||
SysNoticeQuery query = pagerQuery.getParams(); |
|||
QueryWrapper<SysNotice> qw = new QueryWrapper<>(); |
|||
if (query != null) { |
|||
qw.eq("1", 1); |
|||
//标题
|
|||
if (StringUtils.isNotBlank(query.getTitle())) { |
|||
qw.like("sn.title", query.getTitle()); |
|||
} |
|||
qw.apply(StringUtils.isNotBlank(query.getCreateDateStart()), "date_format (sn.createTime,'%Y-%m-%d') >= date_format('" + query.getCreateDateStart() + "','%Y-%m-%d')"). |
|||
apply(StringUtils.isNotBlank(query.getCreateDateEnd()), "date_format (sn.createTime,'%Y-%m-%d') <= date_format('" + query.getCreateDateEnd() + "','%Y-%m-%d')" |
|||
); |
|||
if (StringUtils.isNotBlank(query.getTopping())) { |
|||
qw.like("sn.topping", query.getTopping()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getState())) { |
|||
qw.eq("sn.state", query.getState()); |
|||
} |
|||
qw.orderByDesc("sn.createTime"); |
|||
} |
|||
IPage<SysNotice> page = PagerUtil.queryToPage(pagerQuery); |
|||
IPage<SysNoticeVo> pagging = baseMapper.selectPageVo(page, qw); |
|||
PagerVo<SysNoticeVo> p = PagerUtil.pageToVo(pagging, null); |
|||
return p; |
|||
} |
|||
|
|||
public ResultBean saveOrUpdateNotice(SysNoticeDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
String sid = dto.getSid(); |
|||
if (StringUtils.isBlank(sid)) { |
|||
SysNotice sysNotice = new SysNotice(); |
|||
BeanUtil.copyProperties(dto, sysNotice, "sid"); |
|||
List<UrlQuery> filss = dto.getFilesList(); |
|||
filss.removeAll(Collections.singleton(null)); |
|||
if (!filss.isEmpty()) { |
|||
List<String> filesList = filss.stream().map(v -> v.getUrl()).collect(Collectors.toList()); |
|||
filesList.removeAll(Collections.singleton(null)); |
|||
if (!filesList.isEmpty()) { |
|||
String files = String.join(",", filesList).replaceAll(fileUploadComponent.getUrlPrefix(), ""); |
|||
sysNotice.setFiles(files); |
|||
} |
|||
} |
|||
baseMapper.insert(sysNotice); |
|||
} else { |
|||
SysNotice sysNotice = fetchBySid(sid); |
|||
if (sysNotice == null) { |
|||
return rb.setMsg("该通知公告不存在"); |
|||
} |
|||
BeanUtil.copyProperties(dto, sysNotice, "sid"); |
|||
List<UrlQuery> filss = dto.getFilesList(); |
|||
filss.removeAll(Collections.singleton(null)); |
|||
if (!filss.isEmpty()) { |
|||
List<String> filesList = filss.stream().map(v -> v.getUrl()).collect(Collectors.toList()); |
|||
filesList.removeAll(Collections.singleton(null)); |
|||
if (!filesList.isEmpty()) { |
|||
String files = String.join(",", filesList).replaceAll(fileUploadComponent.getUrlPrefix(), ""); |
|||
sysNotice.setFiles(files); |
|||
} |
|||
} else { |
|||
sysNotice.setFiles(""); |
|||
} |
|||
baseMapper.updateById(sysNotice); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
|
|||
public ResultBean<SysNoticeDetailsVo> getDetails(String sid) { |
|||
ResultBean<SysNoticeDetailsVo> rb = ResultBean.fireFail(); |
|||
SysNoticeDetailsVo sysNoticeDetailsVo = new SysNoticeDetailsVo(); |
|||
SysNotice sysNotice = fetchBySid(sid); |
|||
if (sysNotice == null) { |
|||
return rb.setMsg("该通知公告不存在"); |
|||
} |
|||
BeanUtil.copyProperties(sysNotice, sysNoticeDetailsVo); |
|||
sysNoticeDetailsVo.setCreateTime(DateUtil.format(sysNotice.getCreateTime(), "yyyy-MM-dd")); |
|||
String filesss = sysNotice.getFiles(); |
|||
List<UrlQuery> lists = new ArrayList<>(); |
|||
if (StringUtils.isNotBlank(filesss)) { |
|||
List<String> fileList = Arrays.asList(filesss.split(",")).stream().map(c -> fileUploadComponent.getUrlPrefix() + c).collect(Collectors.toList()); |
|||
for (int i = 0; i < fileList.size(); i++) { |
|||
UrlQuery urlQuery = new UrlQuery(); |
|||
urlQuery.setUrl(fileList.get(i)); |
|||
lists.add(urlQuery); |
|||
} |
|||
sysNoticeDetailsVo.setFilesList(lists); |
|||
} |
|||
return rb.success().setData(sysNoticeDetailsVo); |
|||
} |
|||
|
|||
public ResultBean setState(SysNoticesQuery query) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<String> sidsList = query.getSidsList(); |
|||
sidsList.removeAll(Collections.singleton(null)); |
|||
if (sidsList.isEmpty()) { |
|||
return rb.setMsg("请选择数据"); |
|||
} |
|||
String state = query.getState(); |
|||
for (String sid : sidsList) { |
|||
SysNotice sysNotice = fetchBySid(sid); |
|||
if (sysNotice == null) { |
|||
return rb.setMsg("操作的数据中包含不存在的数据,请刷新后操作"); |
|||
} |
|||
sysNotice.setState(Integer.valueOf(state).intValue()); |
|||
baseMapper.updateById(sysNotice); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
|
|||
public ResultBean<List<SysNoticeListVo>> getLists() { |
|||
ResultBean<List<SysNoticeListVo>> rb = ResultBean.fireFail(); |
|||
List<SysNoticeListVo> list = baseMapper.getLists(); |
|||
list.removeAll(Collections.singleton(null)); |
|||
return rb.success().setData(list); |
|||
} |
|||
|
|||
public ResultBean delAllBySids(String[] sids) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
delBySids(sids); |
|||
return rb.success().setMsg("删除成功"); |
|||
} |
|||
|
|||
public ResultBean setTopping(SysNoticessQuery query) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<String> sidsList = query.getSidsList(); |
|||
sidsList.removeAll(Collections.singleton(null)); |
|||
if (sidsList.isEmpty()) { |
|||
return rb.setMsg("请选择数据"); |
|||
} |
|||
String topping = query.getTopping(); |
|||
for (String sid : sidsList) { |
|||
SysNotice sysNotice = fetchBySid(sid); |
|||
if (sysNotice == null) { |
|||
return rb.setMsg("操作的数据中包含不存在的数据,请刷新后操作"); |
|||
} |
|||
sysNotice.setTopping(topping); |
|||
baseMapper.updateById(sysNotice); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
} |
@ -0,0 +1,351 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div v-show="viewState == 1"> |
|||
<div class="tab-header webtop"> |
|||
<div>{{ viewTitle }}</div> |
|||
<div> |
|||
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate()">保存</el-button> |
|||
<el-button type="primary" size="small" :disabled="submitdisabled" @click="submit()">生成</el-button> |
|||
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
|||
</div> |
|||
</div> |
|||
<div class="listconadd"> |
|||
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02"> |
|||
<el-row style="border-top: 1px solid #e0e3eb"> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">销售部门</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.createDept }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">销售日期</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.saleDate }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">销售价格</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.salePrice }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<div class="title titleOne"> |
|||
<div>客户信息<span style="color: red;margin-left: 10px">注:若客户信息不存在请先点击新增客户按钮完善客户信息</span></div> |
|||
<el-button type="primary" size="mini" @click="addCustomer">新增客户</el-button> |
|||
</div> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">新车主名称</div> |
|||
<el-form-item> |
|||
<el-select v-model="formobj.customerName" class="addinputInfo" filterable clearable placeholder="" @change="changeCustomer"> |
|||
<el-option v-for="item in customer_list" :key="item.newCustomerSid" :label="item.vinOwner" :value="item.vinOwner"/> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">客户类型</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.customerType }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">联系电话</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.mobile }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">证件类型</div> |
|||
<el-form-item> |
|||
<el-select class="addinputInfo" v-model="formobj.certificateTypeKey" filterable clearable placeholder="" @change="certificateTypeChange"> |
|||
<el-option v-for="item in certificateType_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">证件号码</div> |
|||
<el-form-item><el-input class="addinputInfo" style="width: 40%;" v-model="formobj.IDNumber" clearable placeholder=""/></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">证件有效期</div> |
|||
<el-form-item><el-date-picker class="addinputInfo" v-model="formobj.endDate" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择日期" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="span-sty">证件地址</div> |
|||
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.certificateAddress" clearable placeholder=""/></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<div class="title">二次销售车辆列表</div> |
|||
<el-table :key="tableKey" :data="formobj.loanSecondarySalesVehVoList" :index="index" border style="width: 100%"> |
|||
<el-table-column fixed width="80" label="序号" type="index" :index="index + 1" align="center"/> |
|||
<el-table-column prop="vinNo" label="车架号" align="center" min-width="100" /> |
|||
<el-table-column prop="vehMark" label="车牌号" align="center" min-width="100"/> |
|||
<el-table-column prop="vehType" label="车辆类型" align="center" min-width="120"/> |
|||
<el-table-column prop="modelName" label="车型" align="center" min-width="130"/> |
|||
</el-table> |
|||
</el-form> |
|||
</div> |
|||
</div> |
|||
<el-dialog :visible.sync="dialogVisible" width="70%"> |
|||
<el-form :model="formobj" class="formadd"> |
|||
<el-row style="border-top: 1px solid #E0E3EB"> |
|||
<el-col :span="4" class="tleftb"> |
|||
<span>客户名称</span> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item><el-input class="addinputw" v-model="formobj.customerName" clearable placeholder=""/></el-form-item> |
|||
</el-col> |
|||
<el-col :span="4" class="tleftb"> |
|||
<span>客户类型</span> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item> |
|||
<el-select v-model="formobj.customerTypeKey" filterable clearable placeholder="" @change="customerTypeChange"> |
|||
<el-option v-for="item in customerType_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="4" class="tleftb"> |
|||
<span>联系电话</span> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item><el-input class="addinputw" v-model="formobj.mobile" clearable placeholder=""/></el-form-item> |
|||
</el-col> |
|||
<el-col :span="4" class="tleftb"> |
|||
<span>证件类型</span> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item> |
|||
<el-select v-model="formobj.certificateTypeKey" filterable clearable placeholder="" @change="certificateTypeChange"> |
|||
<el-option v-for="item in certificateType_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="4" class="tleftb"> |
|||
<span>证件号码</span> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item><el-input class="addinputw" v-model="formobj.IDNumber" clearable placeholder=""/></el-form-item> |
|||
</el-col> |
|||
<el-col :span="4" class="tleftb"> |
|||
<span>证件有效期</span> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item><el-date-picker class="addinputw" v-model="formobj.endDate" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择日期" /></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="4" class="tleftb"> |
|||
<span>证件地址</span> |
|||
</el-col> |
|||
<el-col :span="20"> |
|||
<el-form-item><el-input class="addinputw" v-model="formobj.certificateAddress" clearable placeholder=""/></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<div style="text-align:center;margin-top: 20px;"> |
|||
<el-button type="primary" size="mini" @click="reject">确 定</el-button> |
|||
<el-button type="info " size="mini" @click="dialogVisible = false">取 消</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import req from '@/api/secondarysales/secondarysales' |
|||
import { pickCustomer, typeValues } from '@/api/Common/dictcommons' |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
viewTitle: '', |
|||
viewState: 1, |
|||
submitdisabled: false, |
|||
dialogVisible: false, |
|||
tableKey: 0, |
|||
index: 0, |
|||
customer_list: [], |
|||
customerType_list: [], |
|||
certificateType_list: [], |
|||
formobj: { |
|||
mainSid: '', |
|||
createDept: '', |
|||
saleDate: '', |
|||
salePrice: '', |
|||
customerSid: '', |
|||
customerName: '', |
|||
customerType: '', |
|||
customerTypeKey: '', |
|||
mobile: '', |
|||
certificateTypeKey: '', |
|||
certificateType: '', |
|||
IDNumber: '', |
|||
endDate: '', |
|||
certificateAddress: '', |
|||
loanSecondarySalesVehVoList: [], |
|||
}, |
|||
rules: {} |
|||
} |
|||
}, |
|||
methods: { |
|||
init() { |
|||
typeValues({ type: 'certificateType' }).then((resp) => { |
|||
if (resp.success) { |
|||
this.certificateType_list = resp.data |
|||
} |
|||
}) |
|||
typeValues({ type: 'customerType' }).then((resp) => { |
|||
if (resp.success) { |
|||
this.customerType_list = resp.data |
|||
} |
|||
}) |
|||
pickCustomer({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => { |
|||
if (res.success) { |
|||
this.customer_list = res.data |
|||
} |
|||
}) |
|||
}, |
|||
showEdit(sid) { |
|||
this.viewTitle = '交回车辆二次销售合同信息补充' |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
this.init() |
|||
req.getDetails({ sid: sid }).then((res) => { |
|||
if (res.success) { |
|||
this.formobj = res.data |
|||
} |
|||
}) |
|||
}, |
|||
addCustomer() { |
|||
this.dialogVisible = true |
|||
this.formobj.customerName = '' |
|||
this.formobj.customerSid = '' |
|||
this.formobj.customerType = '' |
|||
this.formobj.customerTypeKey = '' |
|||
this.formobj.mobile = '' |
|||
this.formobj.endDate = '' |
|||
this.formobj.IDNumber = '' |
|||
this.formobj.certificateType = '' |
|||
this.formobj.certificateTypeKey = '' |
|||
this.formobj.certificateAddress = '' |
|||
}, |
|||
reject() { |
|||
this.dialogVisible = false |
|||
}, |
|||
changeCustomer(value) { |
|||
const choosetItem = this.customer_list.filter((item) => item.vinOwner === value) |
|||
if (choosetItem.length > 0 && choosetItem !== null) { |
|||
this.formobj.customerSid = choosetItem[0].newCustomerSid |
|||
this.formobj.customerType = choosetItem[0].customerType |
|||
this.formobj.customerTypeKey = choosetItem[0].customerTypeKey |
|||
this.formobj.mobile = choosetItem[0].phoneNum |
|||
this.formobj.endDate = choosetItem[0].endDate |
|||
this.formobj.IDNumber = choosetItem[0].idNumber |
|||
this.formobj.certificateType = choosetItem[0].certificateType |
|||
this.formobj.certificateTypeKey = choosetItem[0].certificateTypeKey |
|||
this.formobj.certificateAddress = '' |
|||
} else { |
|||
this.formobj.customerSid = '' |
|||
this.formobj.customerType = '' |
|||
this.formobj.customerTypeKey = '' |
|||
this.formobj.mobile = '' |
|||
this.formobj.endDate = '' |
|||
this.formobj.IDNumber = '' |
|||
this.formobj.certificateType = '' |
|||
this.formobj.certificateTypeKey = '' |
|||
this.formobj.certificateAddress = '' |
|||
} |
|||
}, |
|||
customerTypeChange(value) { |
|||
const choose = this.customerType_list.filter((item) => item.dictKey === value) |
|||
if (choose.length > 0 && choose !== null) { |
|||
this.formobj.customerType = choose[0].dictValue |
|||
} else { |
|||
this.formobj.customerType = '' |
|||
} |
|||
}, |
|||
certificateTypeChange(value) { |
|||
const choose = this.certificateType_list.filter((item) => item.dictKey === value) |
|||
if (choose.length > 0 && choose !== null) { |
|||
this.formobj.certificateType = choose[0].dictValue |
|||
} else { |
|||
this.formobj.certificateType = '' |
|||
} |
|||
}, |
|||
saveOrUpdate() { |
|||
this.$refs['form_obj'].validate((valid) => { |
|||
if (valid) { |
|||
this.submitdisabled = true |
|||
req.save(this.formobj).then((res) => { |
|||
if (res.success) { |
|||
this.$message({ showClose: true, type: 'success', message: '保存成功' }) |
|||
this.handleReturn('true') |
|||
} else { |
|||
this.submitdisabled = false |
|||
} |
|||
}).catch(() => { |
|||
this.submitdisabled = false |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
submit() { |
|||
// this.$refs['form_obj'].validate((valid) => { |
|||
// if (valid) { |
|||
// this.submitdisabled = true |
|||
// req.saveOrUpdate(this.formobj).then((res) => { |
|||
// if (res.success) { |
|||
// this.$message({ showClose: true, type: 'success', message: '保存成功' }) |
|||
// this.handleReturn('true') |
|||
// } else { |
|||
// this.submitdisabled = false |
|||
// } |
|||
// }).catch(() => { |
|||
// this.submitdisabled = false |
|||
// }) |
|||
// } |
|||
// }) |
|||
}, |
|||
handleReturn(isreload) { |
|||
if (isreload === 'true') this.$emit('reloadlist') |
|||
this.formobj = { |
|||
mainSid: '', |
|||
createDept: '', |
|||
saleDate: '', |
|||
salePrice: '', |
|||
customerSid: '', |
|||
customerName: '', |
|||
customerType: '', |
|||
customerTypeKey: '', |
|||
mobile: '', |
|||
certificateTypeKey: '', |
|||
certificateType: '', |
|||
IDNumber: '', |
|||
endDate: '', |
|||
certificateAddress: '', |
|||
loanSecondarySalesVehVoList: [], |
|||
} |
|||
this.submitdisabled = false |
|||
this.$emit('doback') |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.span-sty { |
|||
width: 100px !important; |
|||
} |
|||
.addinputInfo { |
|||
margin-left: 90px !important; |
|||
} |
|||
.titleOne { |
|||
padding: 7px; |
|||
display: flex; |
|||
flex-direction: row; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
} |
|||
</style> |
@ -0,0 +1,29 @@ |
|||
package com.yxt.anrui.riskcenter.api.loanpushfundhistory; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @author liupopo |
|||
* @version 1.0 |
|||
* @since 1.0 |
|||
*/ |
|||
@ApiModel(value = "推送资金占用费记录表", description = "推送资金占用费记录表") |
|||
@TableName("loan_push_fund_history") |
|||
@Data |
|||
public class LoanPushFundHistory extends BaseEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
@ApiModelProperty("资金占用费") |
|||
private BigDecimal fund; |
|||
@ApiModelProperty("使用组织sid") |
|||
private String useOrgSid; |
|||
@ApiModelProperty("使用组织名称") |
|||
private String useOrgName; |
|||
@ApiModelProperty("销售订单车辆sid") |
|||
private String busVinSid; |
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.yxt.anrui.riskcenter.api.loanpushfundhistory; |
|||
|
|||
import io.swagger.annotations.Api; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
|
|||
|
|||
/** |
|||
* @author liupopo |
|||
* @version 1.0 |
|||
* @since 1.0 |
|||
*/ |
|||
@Api(tags = "推送资金占用费记录表") |
|||
@FeignClient( |
|||
contextId = "anrui-riskcenter-LoanPushFundHistory", |
|||
name = "anrui-riskcenter", |
|||
path = "v1/loanpushfundhistory", |
|||
fallback = LoanPushFundHistoryFeignFallback.class) |
|||
public interface LoanPushFundHistoryFeign { |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,11 @@ |
|||
package com.yxt.anrui.riskcenter.api.loanpushfundhistory; |
|||
|
|||
|
|||
import org.springframework.stereotype.Component; |
|||
|
|||
|
|||
@Component |
|||
public class LoanPushFundHistoryFeignFallback implements LoanPushFundHistoryFeign { |
|||
|
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.yxt.anrui.riskcenter.api.loanrepaymentplandetails; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2024/1/5 15:59 |
|||
*/ |
|||
@Data |
|||
public class LoanPlanDetailsVoForFundVoucher { |
|||
private String busVinSid; |
|||
private String useOrgName; |
|||
private BigDecimal duePushMoney; |
|||
private String useOrgSid; |
|||
private BigDecimal fund; |
|||
private BigDecimal reveivableMoney; |
|||
} |
@ -1,13 +1,22 @@ |
|||
<?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="com.yxt.anrui.riskcenter.biz.loanbepadsincereveh.LoanBePadsincereVehMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
<select id="selectPageVo" resultType="com.yxt.anrui.riskcenter.api.loanbepadsincereveh.LoanBePadsincereVehVo"> |
|||
SELECT * FROM loan_be_padsincere_veh <where> ${ew.sqlSegment} </where> |
|||
</select> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
<select id="selectPageVo" resultType="com.yxt.anrui.riskcenter.api.loanbepadsincereveh.LoanBePadsincereVehVo"> |
|||
SELECT * FROM loan_be_padsincere_veh |
|||
<where>${ew.sqlSegment}</where> |
|||
</select> |
|||
|
|||
<select id="selectListAllVo" resultType="com.yxt.anrui.riskcenter.api.loanbepadsincereveh.LoanBePadsincereVehVo"> |
|||
SELECT * FROM loan_be_padsincere_veh <where> ${ew.sqlSegment} </where> |
|||
</select> |
|||
<select id="selectListAllVo" resultType="com.yxt.anrui.riskcenter.api.loanbepadsincereveh.LoanBePadsincereVehVo"> |
|||
SELECT * FROM loan_be_padsincere_veh |
|||
<where>${ew.sqlSegment}</where> |
|||
</select> |
|||
<select id="selByMainSidAndPaySid" |
|||
resultType="com.yxt.anrui.riskcenter.api.loanbepadsincereveh.LoanBePadsincereVeh"> |
|||
SELECT * |
|||
FROM loan_be_padsincere_veh |
|||
where mainSid = #{sid} |
|||
and paySid = #{paySid} |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,18 @@ |
|||
package com.yxt.anrui.riskcenter.biz.loanpushfundhistory; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.yxt.anrui.riskcenter.api.loanpushfundhistory.LoanPushFundHistory; |
|||
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanPlanDetailsVoForFundVoucher; |
|||
import com.yxt.anrui.riskcenter.api.loantransferpaymentrecord.LoanTransferPaymentRecord; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
@Mapper |
|||
public interface LoanPushFundHistoryMapper extends BaseMapper<LoanPushFundHistory> { |
|||
|
|||
|
|||
int saveLists(@Param("list") List<LoanPushFundHistory> list); |
|||
} |
@ -0,0 +1,13 @@ |
|||
<?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="com.yxt.anrui.riskcenter.biz.loanpushfundhistory.LoanPushFundHistoryMapper"> |
|||
|
|||
|
|||
<insert id="saveLists" parameterType="java.util.List"> |
|||
insert into loan_push_fund_history(sid,busVinSid,useOrgSid,useOrgName,fund) |
|||
values |
|||
<foreach collection="list" item="item" index="index" separator=","> |
|||
(#{item.sid},#{item.busVinSid},#{item.useOrgSid},#{item.useOrgName},#{item.fund}) |
|||
</foreach> |
|||
</insert> |
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package com.yxt.anrui.riskcenter.biz.loanpushfundhistory; |
|||
|
|||
import com.yxt.anrui.riskcenter.api.loanpushfundhistory.LoanPushFundHistoryFeign; |
|||
import com.yxt.anrui.riskcenter.api.loantransferpaymentrecord.LoanTransferPaymentRecordFeign; |
|||
import io.swagger.annotations.Api; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
|
|||
@Api(tags = "推送资金占用费记录表") |
|||
@RestController |
|||
@RequestMapping("v1/loanpushfundhistory") |
|||
public class LoanPushFundHistoryRest implements LoanPushFundHistoryFeign { |
|||
|
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.yxt.anrui.riskcenter.biz.loanpushfundhistory; |
|||
|
|||
|
|||
import com.yxt.anrui.riskcenter.api.loanpushfundhistory.LoanPushFundHistory; |
|||
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanPlanDetailsVoForFundVoucher; |
|||
import com.yxt.anrui.riskcenter.api.loantransferpaymentrecord.LoanTransferPaymentRecord; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: fzz |
|||
* @date: 2023/7/6 |
|||
**/ |
|||
@Service |
|||
public class LoanPushFundHistoryService extends MybatisBaseService<LoanPushFundHistoryMapper, LoanPushFundHistory> { |
|||
|
|||
public int saveLists(List<LoanPushFundHistory> list) { |
|||
return baseMapper.saveLists(list); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,270 @@ |
|||
package com.yxt.anrui.riskcenter.biz.loanrepaymentplandetails; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.date.DateTime; |
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.math.Money; |
|||
import com.yxt.anrui.base.api.basepurchasesystem.BasePurchaseSystemDetailsVo; |
|||
import com.yxt.anrui.base.api.basepurchasesystem.BasePurchaseSystemFeign; |
|||
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrder; |
|||
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderFeign; |
|||
import com.yxt.anrui.buscenter.api.bussalesorderborrower.BusSalesOrderBorrowerDetailsVo; |
|||
import com.yxt.anrui.buscenter.api.bussalesorderborrower.BusSalesOrderBorrowerFeign; |
|||
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle; |
|||
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicleFeign; |
|||
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailedjr.FinUncollectedReceivablesDetailedJRFeign; |
|||
import com.yxt.anrui.fin.api.kingdee.FinKingDeeFeign; |
|||
import com.yxt.anrui.fin.api.kingdee.bdcustomer.BdCustomer; |
|||
import com.yxt.anrui.fin.api.kingdee.voucher.GeneralVoucher; |
|||
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign; |
|||
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationVo; |
|||
import com.yxt.anrui.riskcenter.api.loanfundday.LoanFundDay; |
|||
import com.yxt.anrui.riskcenter.api.loanmonthlyaccrualrecord.LoanMonthlyAccrualRecord; |
|||
import com.yxt.anrui.riskcenter.api.loanpushfundhistory.LoanPushFundHistory; |
|||
import com.yxt.anrui.riskcenter.api.loanrepaymenthistory.utils.CollectorsUtil; |
|||
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanPlanDetailsVoForFundVoucher; |
|||
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanPlanDetailsVoForLateVoucher; |
|||
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetails; |
|||
import com.yxt.anrui.riskcenter.biz.loanfundday.LoanFundDayService; |
|||
import com.yxt.anrui.riskcenter.biz.loanpushfundhistory.LoanPushFundHistoryService; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.scheduling.annotation.Scheduled; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.ArrayList; |
|||
import java.util.Collections; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: fzz |
|||
* @date: 2024/1/30 |
|||
**/ |
|||
@Component |
|||
public class ScheduledRepaymentPlanDetailsService { |
|||
|
|||
@Autowired |
|||
private LoanRepaymentPlanDetailsService loanRepaymentPlanDetailsService; |
|||
@Autowired |
|||
private BusSalesOrderFeign busSalesOrderFeign; |
|||
@Autowired |
|||
private BusSalesOrderBorrowerFeign busSalesOrderBorrowerFeign; |
|||
@Autowired |
|||
private FinKingDeeFeign finKingDeeFeign; |
|||
@Autowired |
|||
private SysOrganizationFeign sysOrganizationFeign; |
|||
@Autowired |
|||
private BusSalesOrderVehicleFeign busSalesOrderVehicleFeign; |
|||
@Autowired |
|||
private BasePurchaseSystemFeign basePurchaseSystemFeign; |
|||
@Autowired |
|||
private LoanPushFundHistoryService loanPushFundHistoryService; |
|||
|
|||
|
|||
/** |
|||
* 次月1日23点推送上月尚未转累欠的记录 |
|||
*/ |
|||
@Scheduled(cron = "0 0 23 1 * ?") |
|||
public void pushLateVoucher() { |
|||
List<String> useOrgSidList = loanRepaymentPlanDetailsService.selUseOrgSidListForLateVoucher(); |
|||
useOrgSidList.removeAll(Collections.singleton(null)); |
|||
if (!useOrgSidList.isEmpty()) { |
|||
for (String u : useOrgSidList) { |
|||
List<LoanPlanDetailsVoForLateVoucher> records = loanRepaymentPlanDetailsService.selListForLateVoucher(u); |
|||
List<String> planSids = new ArrayList<>(); |
|||
if (!records.isEmpty()) { |
|||
GeneralVoucher generalVoucher = new GeneralVoucher(); |
|||
List<GeneralVoucher.GeneralVoucherDetail> voucherDetails = new ArrayList<>(); |
|||
for (LoanPlanDetailsVoForLateVoucher planDetails : records) { |
|||
if (null != planDetails) { |
|||
planSids.add(planDetails.getPlanSid()); |
|||
GeneralVoucher.GeneralVoucherDetail voucherDetail = new GeneralVoucher.GeneralVoucherDetail(); |
|||
if (StringUtils.isNotBlank(planDetails.getUseOrgSid())) { |
|||
String useOrgSid = planDetails.getUseOrgSid(); |
|||
SysOrganizationVo organizationVo = sysOrganizationFeign.fetchBySid(useOrgSid).getData(); |
|||
if (null != organizationVo) { |
|||
generalVoucher.setUseOrgCode(organizationVo.getOrgCode()); |
|||
} |
|||
} |
|||
if (StringUtils.isNotBlank(planDetails.getDeptSid())) { |
|||
String deptSid = planDetails.getDeptSid(); |
|||
SysOrganizationVo organizationDeptVo = sysOrganizationFeign.fetchBySid(deptSid).getData(); |
|||
if (null != organizationDeptVo) { |
|||
voucherDetail.setDeptCode(organizationDeptVo.getOrgCode()); |
|||
} |
|||
} |
|||
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(planDetails.getBusVinSid()).getData(); |
|||
BusSalesOrder salesOrder = busSalesOrderFeign.fetchBySid(planDetails.getSalesOrderSid()).getData(); |
|||
if (null != salesOrder) { |
|||
if (null != busSalesOrderVehicle) { |
|||
String customerNumber = ""; |
|||
//判断财务系统是否有客户
|
|||
Boolean aBoolean = finKingDeeFeign.customerExistState(busSalesOrderVehicle.getTemporaryNo()).getData(); |
|||
String linkNo = ""; |
|||
BusSalesOrderBorrowerDetailsVo borrowerDetailsVo = busSalesOrderBorrowerFeign.fetchDetailsBySid(busSalesOrderVehicle.getBorrowerSid()).getData(); |
|||
if (!aBoolean) { |
|||
// List<BdCustomer> bdCustomers = new ArrayList<>();
|
|||
BdCustomer bdCustomer = new BdCustomer(); |
|||
bdCustomer.setFNumber(busSalesOrderVehicle.getTemporaryNo()); |
|||
bdCustomer.setFShortName(salesOrder.getContractNo()); |
|||
BasePurchaseSystemDetailsVo data = basePurchaseSystemFeign.fetchDetailsByDeptSid(salesOrder.getPurchaseSystemSid()).getData(); |
|||
bdCustomer.setTOrgIds(data.getOrgCode()); |
|||
if (org.apache.commons.lang3.StringUtils.isNotBlank(busSalesOrderVehicle.getLinkNo())) { |
|||
String vinNo = busSalesOrderVehicle.getLinkNo(); |
|||
if (vinNo.length() > 8) { |
|||
linkNo = vinNo.substring(vinNo.length() - 8); |
|||
} else { |
|||
linkNo = busSalesOrderVehicle.getLinkNo(); |
|||
} |
|||
if (null != borrowerDetailsVo) { |
|||
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + linkNo); |
|||
} |
|||
} else { |
|||
if (null != borrowerDetailsVo) { |
|||
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo()); |
|||
} |
|||
} |
|||
// bdCustomers.add(bdCustomer);
|
|||
ResultBean<String> resultBean = finKingDeeFeign.draftBdCustomer(bdCustomer); |
|||
if (resultBean.getSuccess()) { |
|||
customerNumber = bdCustomer.getFNumber(); |
|||
} |
|||
} else { |
|||
customerNumber = busSalesOrderVehicle.getTemporaryNo(); |
|||
} |
|||
voucherDetail.setCustomerCode(customerNumber); |
|||
} |
|||
} |
|||
if (StringUtils.isNotBlank(planDetails.getOutstandingMoney())) { |
|||
voucherDetail.setAmount(new BigDecimal(planDetails.getOutstandingMoney())); |
|||
} |
|||
voucherDetails.add(voucherDetail); |
|||
} |
|||
} |
|||
generalVoucher.setVoucherDetails(voucherDetails); |
|||
finKingDeeFeign.saveLateVoucher(generalVoucher); |
|||
} |
|||
if (!planSids.isEmpty()) { |
|||
int i = loanRepaymentPlanDetailsService.updateOweState(planSids); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 月初1号计提上个月资金占用费 |
|||
* 1号1点 |
|||
*/ |
|||
@Scheduled(cron = "0 0 1 1 * ?") |
|||
public void pushFundVoucher() { |
|||
List<String> useOrgSidList = loanRepaymentPlanDetailsService.selUseOrgSidListForFundVoucher(); |
|||
useOrgSidList.removeAll(Collections.singleton(null)); |
|||
if (!useOrgSidList.isEmpty()) { |
|||
for (String u : useOrgSidList) { |
|||
List<LoanPlanDetailsVoForFundVoucher> fundVouchers = loanRepaymentPlanDetailsService.getFundForVoucher(u); |
|||
List<LoanPushFundHistory> fundHistoryList = new ArrayList<>(); |
|||
if (!fundVouchers.isEmpty()) { |
|||
BigDecimal result = fundVouchers.stream() |
|||
// 将LoanPlanDetailsVoForFundVoucher对象的duePushMoney取出来map为Bigdecimal
|
|||
.map(LoanPlanDetailsVoForFundVoucher::getDuePushMoney) |
|||
// 使用reduce()聚合函数,实现累加器
|
|||
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|||
GeneralVoucher generalVoucher = new GeneralVoucher(); |
|||
List<GeneralVoucher.GeneralVoucherDetail> voucherDetails = new ArrayList<>(); |
|||
SysOrganizationVo organizationVo = sysOrganizationFeign.fetchBySid(u).getData(); |
|||
if (null != organizationVo) { |
|||
generalVoucher.setUseOrgCode(organizationVo.getOrgCode()); |
|||
} |
|||
GeneralVoucher.GeneralVoucherDetail voucherDetail1 = new GeneralVoucher.GeneralVoucherDetail(); |
|||
voucherDetail1.setSceneCode("贷方"); |
|||
voucherDetail1.setDataTime(new DateTime()); |
|||
voucherDetail1.setAmount(result); |
|||
List<SysOrganizationVo> deptVo = sysOrganizationFeign.selectChildrenListBySid(u).getData(); |
|||
if (!deptVo.isEmpty()) { |
|||
deptVo.stream().forEach(d -> { |
|||
if (d.getName().equals("金融服务部")) { |
|||
voucherDetail1.setDeptCode(d.getOrgCode()); |
|||
} |
|||
}); |
|||
} |
|||
voucherDetails.add(voucherDetail1); |
|||
for (LoanPlanDetailsVoForFundVoucher v : fundVouchers) { |
|||
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(v.getBusVinSid()).getData(); |
|||
if (null != busSalesOrderVehicle) { |
|||
BusSalesOrder salesOrder = busSalesOrderFeign.fetchBySid(busSalesOrderVehicle.getSalesOrderSid()).getData(); |
|||
String deptSid = salesOrder.getOrgSid(); |
|||
GeneralVoucher.GeneralVoucherDetail voucherDetail = new GeneralVoucher.GeneralVoucherDetail(); |
|||
voucherDetail.setSceneCode("借方"); |
|||
voucherDetail.setDataTime(new DateTime()); |
|||
SysOrganizationVo organizationDeptVo = sysOrganizationFeign.fetchBySid(deptSid).getData(); |
|||
if (null != organizationDeptVo) { |
|||
voucherDetail.setDeptCode(organizationDeptVo.getOrgCode()); |
|||
} |
|||
if (null != salesOrder) { |
|||
if (null != busSalesOrderVehicle) { |
|||
String customerNumber = ""; |
|||
//判断财务系统是否有客户
|
|||
Boolean aBoolean = finKingDeeFeign.customerExistState(busSalesOrderVehicle.getTemporaryNo()).getData(); |
|||
String linkNo = ""; |
|||
BusSalesOrderBorrowerDetailsVo borrowerDetailsVo = busSalesOrderBorrowerFeign.fetchDetailsBySid(busSalesOrderVehicle.getBorrowerSid()).getData(); |
|||
if (!aBoolean) { |
|||
// List<BdCustomer> bdCustomers = new ArrayList<>();
|
|||
BdCustomer bdCustomer = new BdCustomer(); |
|||
bdCustomer.setFNumber(busSalesOrderVehicle.getTemporaryNo()); |
|||
bdCustomer.setFShortName(salesOrder.getContractNo()); |
|||
BasePurchaseSystemDetailsVo data = basePurchaseSystemFeign.fetchDetailsByDeptSid(salesOrder.getPurchaseSystemSid()).getData(); |
|||
bdCustomer.setTOrgIds(data.getOrgCode()); |
|||
if (org.apache.commons.lang3.StringUtils.isNotBlank(busSalesOrderVehicle.getLinkNo())) { |
|||
String vinNo = busSalesOrderVehicle.getLinkNo(); |
|||
if (vinNo.length() > 8) { |
|||
linkNo = vinNo.substring(vinNo.length() - 8); |
|||
} else { |
|||
linkNo = busSalesOrderVehicle.getLinkNo(); |
|||
} |
|||
if (null != borrowerDetailsVo) { |
|||
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + linkNo); |
|||
} |
|||
} else { |
|||
if (null != borrowerDetailsVo) { |
|||
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo()); |
|||
} |
|||
} |
|||
// bdCustomers.add(bdCustomer);
|
|||
ResultBean<String> resultBean = finKingDeeFeign.draftBdCustomer(bdCustomer); |
|||
if (resultBean.getSuccess()) { |
|||
customerNumber = bdCustomer.getFNumber(); |
|||
} |
|||
} else { |
|||
customerNumber = busSalesOrderVehicle.getTemporaryNo(); |
|||
} |
|||
voucherDetail.setCustomerCode(customerNumber); |
|||
} |
|||
} |
|||
voucherDetail.setAmount(v.getDuePushMoney()); |
|||
voucherDetails.add(voucherDetail); |
|||
} |
|||
LoanPushFundHistory loanPushFundHistory = new LoanPushFundHistory(); |
|||
BeanUtil.copyProperties(v, loanPushFundHistory, "id", "sid", "fund"); |
|||
if (null != v.getDuePushMoney()) { |
|||
loanPushFundHistory.setFund(v.getDuePushMoney()); |
|||
} |
|||
fundHistoryList.add(loanPushFundHistory); |
|||
} |
|||
generalVoucher.setVoucherDetails(voucherDetails); |
|||
finKingDeeFeign.saveFundVoucher(generalVoucher); |
|||
// 生成推送资金占用费历史记录
|
|||
if (!fundHistoryList.isEmpty()) { |
|||
loanPushFundHistoryService.saveLists(fundHistoryList); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
Loading…
Reference in new issue