Commit 1a228d87 authored by EDY's avatar EDY

优化

parent c41ff68c
......@@ -101,7 +101,7 @@ public class BaseContractInfoController extends BaseController {
@Log(title = "合同信息" , businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseContractInfo baseContractInfo) {
baseContractInfo.setCreateBy(getUsername());
baseContractInfo.setCreateBy(getLoginUser().getUser().getNickName());
return toAjax(baseContractInfoService.insertBaseContractInfo(baseContractInfo));
}
......@@ -112,7 +112,7 @@ public class BaseContractInfoController extends BaseController {
@Log(title = "合同信息" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseContractInfo baseContractInfo) {
return toAjax(baseContractInfoService.updateBaseContractInfo(baseContractInfo));
return toAjax(baseContractInfoService.updateBaseContractInfo(baseContractInfo,getLoginUser().getUser()));
}
/**
......@@ -134,8 +134,8 @@ public class BaseContractInfoController extends BaseController {
@GetMapping(value = "/collect")
public AjaxResult collect() {
ContractCollectVo contractCollectVo = baseContractInfoService.getCollect();
public AjaxResult collect(Long contractId) {
ContractCollectVo contractCollectVo = baseContractInfoService.getCollect(contractId);
return success(contractCollectVo);
}
......
......@@ -24,11 +24,11 @@ public class BaseContractAuditRecord extends BaseEntity
/** 节点 */
@Excel(name = "节点")
private Long jd;
private Integer jd;
/** 操作 */
@Excel(name = "操作")
private Long cz;
private Integer cz;
/** 处理意见 */
@Excel(name = "处理意见")
......@@ -43,21 +43,21 @@ public class BaseContractAuditRecord extends BaseEntity
{
return id;
}
public void setJd(Long jd)
public void setJd(Integer jd)
{
this.jd = jd;
}
public Long getJd()
public Integer getJd()
{
return jd;
}
public void setCz(Long cz)
public void setCz(Integer cz)
{
this.cz = cz;
}
public Long getCz()
public Integer getCz()
{
return cz;
}
......
......@@ -155,7 +155,11 @@ public class BaseContractInfo extends BaseEntity
/** 合同当前节点 */
@Excel(name = "合同当前节点")
private Long dqjd;
private Integer dqjd;
/** 审核状态 */
@Excel(name = "审核状态")
private Integer shzt;
/** 主体地位 */
@Excel(name = "主体地位")
......@@ -181,12 +185,24 @@ public class BaseContractInfo extends BaseEntity
@Excel(name = "是否删除 1 是 0 正常")
private Long deleteFlag;
/** 最小金额 */
private BigDecimal htMinAmount;
/** 最大金额 */
private BigDecimal htMaxAmount;
/** 期数集合 */
private List<BaseContractPeriodsInfo> baseContractPeriodsInfos;
/** 审批记录 */
private List<BaseContractAuditRecord> baseContractAuditRecords;
// 生效时间查询类型
private Integer htsxsjType;
// 终止时间查询类型
private Integer htzzsjType;
public BaseContractInfo() {
}
......@@ -469,12 +485,12 @@ public class BaseContractInfo extends BaseEntity
{
return fdje;
}
public void setDqjd(Long dqjd)
public void setDqjd(Integer dqjd)
{
this.dqjd = dqjd;
}
public Long getDqjd()
public Integer getDqjd()
{
return dqjd;
}
......@@ -609,4 +625,44 @@ public class BaseContractInfo extends BaseEntity
public void setShrName(String shrName) {
this.shrName = shrName;
}
public Integer getShzt() {
return shzt;
}
public void setShzt(Integer shzt) {
this.shzt = shzt;
}
public BigDecimal getHtMinAmount() {
return htMinAmount;
}
public void setHtMinAmount(BigDecimal htMinAmount) {
this.htMinAmount = htMinAmount;
}
public BigDecimal getHtMaxAmount() {
return htMaxAmount;
}
public void setHtMaxAmount(BigDecimal htMaxAmount) {
this.htMaxAmount = htMaxAmount;
}
public Integer getHtsxsjType() {
return htsxsjType;
}
public void setHtsxsjType(Integer htsxsjType) {
this.htsxsjType = htsxsjType;
}
public Integer getHtzzsjType() {
return htzzsjType;
}
public void setHtzzsjType(Integer htzzsjType) {
this.htzzsjType = htzzsjType;
}
}
......@@ -3,7 +3,6 @@ package com.ruoyi.system.mapper.business;
import com.ruoyi.system.domain.business.BaseContractInfo;
import com.ruoyi.system.domain.business.vo.ContractCollectVo;
import java.math.BigDecimal;
import java.util.List;
/**
......@@ -64,5 +63,5 @@ public interface BaseContractInfoMapper
String selectMaxContractNo(String orderNoPrefix);
ContractCollectVo queryContractAmount();
ContractCollectVo queryContractAmount(Long contractId);
}
......@@ -61,6 +61,6 @@ public interface BaseInvoiceInfoMapper
*/
public int deleteBaseInvoiceInfoByIds(Long[] ids);
BigDecimal queryInvoiceAmount();
BigDecimal queryInvoiceAmount(Long contractId);
}
package com.ruoyi.system.service.business;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.system.domain.business.BaseContractInfo;
import com.ruoyi.system.domain.business.BaseContractPeriodsInfo;
......@@ -43,9 +44,10 @@ public interface IBaseContractInfoService
* 修改合同信息
*
* @param baseContractInfo 合同信息
* @param user
* @return 结果
*/
public int updateBaseContractInfo(BaseContractInfo baseContractInfo);
public int updateBaseContractInfo(BaseContractInfo baseContractInfo, SysUser user);
/**
* 批量删除合同信息
......@@ -65,7 +67,7 @@ public interface IBaseContractInfoService
List<BaseContractInfo> selectBaseContractAuditList(BaseContractInfo baseContractInfo, LoginUser loginUser);
ContractCollectVo getCollect();
ContractCollectVo getCollect(Long contractId);
List<BaseContractPeriodsInfo> getPeriodInfo(BaseContractInfo baseContractInfo);
......
......@@ -3,10 +3,12 @@ package com.ruoyi.system.service.business.impl;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.MoneyConverter;
......@@ -95,6 +97,14 @@ public class BaseContractInfoServiceImpl implements IBaseContractInfoService {
baseContractPeriodsInfoMapper.insertBaseContractPeriodsInfo(baseContractPeriodsInfo);
}
}
BaseContractAuditRecord baseContractAuditRecord = new BaseContractAuditRecord();
baseContractAuditRecord.setContractId(baseContractInfo.getId());
baseContractAuditRecord.setJd(1);
baseContractAuditRecord.setCz(1);
baseContractAuditRecord.setClyj("/");
baseContractAuditRecord.setCreateTime(new Date());
baseContractAuditRecord.setCreateBy(baseContractInfo.getCreateBy());
baseContractAuditRecordMapper.insertBaseContractAuditRecord(baseContractAuditRecord);
return result;
}
......@@ -102,11 +112,22 @@ public class BaseContractInfoServiceImpl implements IBaseContractInfoService {
* 修改合同信息
*
* @param baseContractInfo 合同信息
* @param user
* @return 结果
*/
@Override
public int updateBaseContractInfo(BaseContractInfo baseContractInfo) {
public int updateBaseContractInfo(BaseContractInfo baseContractInfo, SysUser user) {
baseContractInfo.setUpdateTime(DateUtils.getNowDate());
if (baseContractInfo.getShzt() != null) {
baseContractInfo.setShrId(user.getUserId());
baseContractInfo.setShrName(user.getNickName());
BaseContractAuditRecord baseContractAuditRecord = new BaseContractAuditRecord();
baseContractAuditRecord.setContractId(baseContractInfo.getId());
baseContractAuditRecord.setJd(2);
baseContractAuditRecord.setCz(1);
baseContractAuditRecord.setClyj(baseContractInfo.getBz());
baseContractAuditRecordMapper.insertBaseContractAuditRecord(baseContractAuditRecord);
}
return baseContractInfoMapper.updateBaseContractInfo(baseContractInfo);
}
......@@ -150,11 +171,11 @@ public class BaseContractInfoServiceImpl implements IBaseContractInfoService {
}
@Override
public ContractCollectVo getCollect() {
ContractCollectVo contractCollectVo = baseContractInfoMapper.queryContractAmount();
public ContractCollectVo getCollect(Long contractId) {
ContractCollectVo contractCollectVo = baseContractInfoMapper.queryContractAmount(contractId);
if (contractCollectVo != null && contractCollectVo.getContractAmount() != null && contractCollectVo.getToTheAmount() != null) {
contractCollectVo.setPayeeAmount(contractCollectVo.getContractAmount().subtract(contractCollectVo.getToTheAmount()));
BigDecimal invoiceAmount = baseInvoiceInfoMapper.queryInvoiceAmount();
BigDecimal invoiceAmount = baseInvoiceInfoMapper.queryInvoiceAmount(contractId);
contractCollectVo.setMakeInvoiceAmount(invoiceAmount);
} else {
contractCollectVo = new ContractCollectVo();
......
......@@ -43,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="htfj" column="htfj" />
<result property="shrId" column="shr_id" />
<result property="shrName" column="shr" />
<result property="shzt" column="shzt" />
<result property="bz" column="bz" />
<result property="deleteFlag" column="delete_flag" />
<result property="createTime" column="create_time" />
......@@ -52,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBaseContractInfoVo">
select id,subject_id,htbh, bm_id, ssbm, ywy_id, ywy, kh_id, khmc, htmc, cplb, j_gsmc, j_txdz, j_yb, j_dzyj, j_hkr, j_khyh, j_yhzh, j_swdjh, j_lxr, j_lxdh, htnr, qysj, htzt, fkfs, htsxsj, htzzsj, qs, htze,hkje, fkbl, fd_flag, fdje, dqjd, ztdw, htfj,shr_id,shr, bz, delete_flag, create_time, create_by, update_time, update_by from base_contract_info
select id,subject_id,htbh, bm_id, ssbm, ywy_id, ywy, kh_id, khmc, htmc, cplb, j_gsmc, j_txdz, j_yb, j_dzyj, j_hkr, j_khyh, j_yhzh, j_swdjh, j_lxr, j_lxdh, htnr, qysj, htzt, fkfs, htsxsj, htzzsj, qs, htze,hkje, fkbl, fd_flag, fdje, dqjd, ztdw, htfj,shr_id,shr,shzt, bz, delete_flag, create_time, create_by, update_time, update_by from base_contract_info
</sql>
<select id="selectBaseContractInfoList" parameterType="BaseContractInfo" resultMap="BaseContractInfoResult">
......@@ -65,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ywyId != null "> and ywy_id = #{ywyId}</if>
<if test="ywy != null and ywy != ''"> and ywy = #{ywy}</if>
<if test="khId != null "> and kh_id = #{khId}</if>
<if test="khmc != null and khmc != ''"> and khmc = #{khmc}</if>
<if test="khmc != null and khmc != ''"> and khmc like concat('%', #{khmc}, '%')</if>
<if test="htmc != null and htmc != ''"> and htmc = #{htmc}</if>
<if test="cplb != null "> and cplb = #{cplb}</if>
<if test="jGsmc != null and jGsmc != ''"> and j_gsmc = #{jGsmc}</if>
......@@ -82,8 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qysj != null "> and qysj = #{qysj}</if>
<if test="htzt != null "> and htzt = #{htzt}</if>
<if test="fkfs != null "> and fkfs = #{fkfs}</if>
<if test="htsxsj != null "> and htsxsj = #{htsxsj}</if>
<if test="htzzsj != null "> and htzzsj = #{htzzsj}</if>
<if test="htsxsj != null "> and htsxsj = #{fkfs}</if>
<if test="qs != null "> and qs = #{qs}</if>
<if test="htze != null "> and htze = #{htze}</if>
<if test="fkbl != null and fkbl != ''"> and fkbl = #{fkbl}</if>
......@@ -94,9 +94,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="htfj != null and htfj != ''"> and htfj = #{htfj}</if>
<if test="shrId != null and shrId != ''"> and shr_id = #{shrId}</if>
<if test="shrName != null and shrName != ''"> and shr = #{shrName}</if>
<if test="shzt != null "> and shzt = #{shzt}</if>
<if test="bz != null and bz != ''"> and bz = #{bz}</if>
<if test="deleteFlag != null "> and delete_flag = #{deleteFlag}</if>
<if test="htMinAmount != null and htMaxAmount != null "> and htze between #{htMinAmount} and #{htMaxAmount}</if>
<if test="htsxsjType != null and htsxsjType == 1 "> and htsxsj >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) </if>
<if test="htsxsjType != null and htsxsjType == 2 "> and htsxsj >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) </if>
<if test="htsxsjType != null and htsxsjType == 3 "> and htsxsj >= DATE_SUB(CURDATE(), INTERVAL 90 DAY) </if>
<if test="htsxsjType != null and htsxsjType == 4 "> and htsxsj >= DATE_SUB(CURDATE(), INTERVAL 180 DAY) </if>
<if test="htzzsjType != null and htzzsjType == 1 "> and htzzsj >= DATE_SUB(CURDATE(), INTERVAL -7 DAY) </if>
<if test="htzzsjType != null and htzzsjType == 2 "> and htzzsj >= DATE_SUB(CURDATE(), INTERVAL -30 DAY) </if>
<if test="htzzsjType != null and htzzsjType == 3 "> and htzzsj >= DATE_SUB(CURDATE(), INTERVAL -90 DAY) </if>
<if test="htzzsjType != null and htzzsjType == 4 "> and htzzsj >= DATE_SUB(CURDATE(), INTERVAL -180 DAY) </if>
</where>
order by id desc
</select>
<select id="selectBaseContractInfoById" parameterType="Long" resultMap="BaseContractInfoResult">
......@@ -111,9 +122,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sum(htze) contractAmount,
sum(hkje) toTheAmount
from base_contract_info where htzt != 5
<if test="contractId != null">
and contract_id = #{contractId}
</if>
</select>
<insert id="insertBaseContractInfo" parameterType="BaseContractInfo" useGeneratedKeys="true" keyProperty="id">
insert into base_contract_info
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -153,6 +166,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="htfj != null">htfj,</if>
<if test="shrId != null">shr_id,</if>
<if test="shrName != null">shr,</if>
<if test="shzt != null">shzt,</if>
<if test="bz != null">bz,</if>
<if test="deleteFlag != null">delete_flag,</if>
<if test="createTime != null">create_time,</if>
......@@ -197,6 +211,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="htfj != null">#{htfj},</if>
<if test="shrId != null">#{shrId},</if>
<if test="shrName != null">#{shr},</if>
<if test="shzt != null">#{shzt},</if>
<if test="bz != null">#{bz},</if>
<if test="deleteFlag != null">#{deleteFlag},</if>
<if test="createTime != null">#{createTime},</if>
......@@ -246,6 +261,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="htfj != null">htfj = #{htfj},</if>
<if test="shrId != null">shr_id = #{shrId},</if>
<if test="shrName != null and shrName != ''">shr = #{shrName},</if>
<if test="shzt != null ">shzt = #{shzt},</if>
<if test="bz != null">bz = #{bz},</if>
<if test="deleteFlag != null">delete_flag = #{deleteFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
......
......@@ -85,7 +85,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<select id="queryInvoiceAmount" resultType="java.math.BigDecimal">
select sum(kpje) invoiceAmount from base_invoice_info where fpzt = 3
select
sum(kpje) invoiceAmount
from
base_invoice_info
where
fpzt = 3
<if test="contractId != null">
and contract_id = #{contractId}
</if>
</select>
<insert id="insertBaseInvoiceInfo" parameterType="BaseInvoiceInfo">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment