Browse Source

添加逾期

contract
Yen 2 years ago
parent
commit
220f41af26
  1. 27
      src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java
  2. 31
      src/main/java/com/qs/serve/modules/tbs/entity/TbsCostApply.java
  3. 30
      src/main/java/com/qs/serve/modules/tbs/entity/so/TbsCostApplySo.java
  4. 7
      src/main/java/com/qs/serve/modules/tbs/mapper/TbsCostApplyMapper.java
  5. 4
      src/main/java/com/qs/serve/modules/tbs/service/TbsCostApplyService.java
  6. 29
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java
  7. 54
      src/main/resources/mapper/tbs/TbsCostApplyMapper.xml

27
src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java

@ -2,6 +2,7 @@ package com.qs.serve.modules.tbs.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qs.serve.common.model.annotation.SysLog;
import com.qs.serve.common.model.enums.BudgetLogOptFlag;
import com.qs.serve.common.model.consts.BudgetLogRollbackFlag;
@ -28,7 +29,6 @@ import com.qs.serve.modules.tbs.entity.bo.TbsAffairCommitBo;
import com.qs.serve.modules.tbs.entity.bo.TbsCostApplyActivityBo;
import com.qs.serve.modules.tbs.entity.bo.TbsCostApplyBo;
import com.qs.serve.modules.tbs.entity.dto.TbsBudgetCostResult;
import com.qs.serve.modules.tbs.entity.so.TbsCostApplySo;
import com.qs.serve.modules.tbs.entity.vo.CtpAffairVo;
import com.qs.serve.modules.tbs.entity.vo.TbsBudgetTableVo;
import com.qs.serve.modules.tbs.entity.vo.TbsCostApplyVo;
@ -110,8 +110,6 @@ public class TbsCostApplyController {
TbsCostApply entity = CopierUtil.copy(param,new TbsCostApply());
LambdaQueryWrapper<TbsCostApply> lqw = new LambdaQueryWrapper<>(entity);
lqw.orderByDesc(TbsCostApply::getId);
TbsCostApplySo query = new TbsCostApplySo();
query.setOverdueState(param.getOverdueState());
List<TbsCostApply> list = tbsCostApplyService.list(lqw);
return R.ok(list);
}
@ -134,8 +132,6 @@ public class TbsCostApplyController {
lqw.in(TbsCostApply::getCreateBy,userIds);
lqw.orderByDesc(TbsCostApply::getId);
PageUtil.startPage();
TbsCostApplySo query = new TbsCostApplySo();
query.setOverdueState(param.getOverdueState());
List<TbsCostApply> list = tbsCostApplyService.list(lqw);
return R.ok(list);
}
@ -155,12 +151,9 @@ public class TbsCostApplyController {
}
userIds.add(userId);
TbsCostApply entity = CopierUtil.copy(param,new TbsCostApply());
LambdaQueryWrapper<TbsCostApply> lqw = new LambdaQueryWrapper<>(entity);
lqw.orderByDesc(TbsCostApply::getId);
lqw.in(TbsCostApply::getUserId,userIds);
PageUtil.startPage();
List<TbsCostApply> list = tbsCostApplyService.list(lqw);
return R.byPageHelperList(list);
entity.setSelectUserIds(userIds);
IPage<TbsCostApply> page = tbsCostApplyService.selectPage(entity);
return R.byMbpList(page);
}
/**
@ -169,15 +162,9 @@ public class TbsCostApplyController {
* @return
*/
@GetMapping("/page")
public R<PageVo<TbsCostApply>> getPage(TbsCostApplyVo param){
TbsCostApply entity = CopierUtil.copy(param,new TbsCostApply());
LambdaQueryWrapper<TbsCostApply> lqw = new LambdaQueryWrapper<>(entity);
lqw.orderByDesc(TbsCostApply::getId);
PageUtil.startPage();
TbsCostApplySo query = new TbsCostApplySo();
query.setOverdueState(param.getOverdueState());
List<TbsCostApply> list = tbsCostApplyService.list(lqw);
return R.byPageHelperList(list);
public R<PageVo<TbsCostApply>> getPage(TbsCostApply param){
IPage<TbsCostApply> page = tbsCostApplyService.selectPage(param);
return R.byMbpList(page);
}
/**

31
src/main/java/com/qs/serve/modules/tbs/entity/TbsCostApply.java

@ -15,6 +15,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotBlank;
import java.util.List;
/**
* 费用申请 实体类
@ -145,5 +146,35 @@ public class TbsCostApply implements Serializable {
@TableField(exist = false)
private Object contractInfo;
/**
* 用于逾期判断
*/
@TableField(exist = false)
private LocalDate actEndDate;
/**
* 逾期结果(拼接非持久化)
*/
@TableField(exist = false)
private Integer overdueState;
/**
* 逾期结果(拼接非持久化)
*/
@TableField(exist = false)
LocalDate nowDate;
/**
* 逾期结果(拼接非持久化)
*/
@TableField(exist = false)
LocalDate startNowDate;
/**
* 逾期结果(拼接非持久化)
*/
@TableField(exist = false)
List<String> selectUserIds;
}

30
src/main/java/com/qs/serve/modules/tbs/entity/so/TbsCostApplySo.java

@ -1,30 +0,0 @@
package com.qs.serve.modules.tbs.entity.so;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 费用申请 VO
* @author YenHex
* @since 2022-11-09
*/
@Data
public class TbsCostApplySo implements Serializable {
/**
* 0=>未逾期1=>已逾期2=>即将逾期
*/
Integer overdueState;
LocalDate nowDate;
LocalDate startNowDate;
}

7
src/main/java/com/qs/serve/modules/tbs/mapper/TbsCostApplyMapper.java

@ -2,9 +2,9 @@ package com.qs.serve.modules.tbs.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.qs.serve.modules.tbs.entity.TbsCostApply;
import com.qs.serve.modules.tbs.entity.so.TbsCostApplySo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -20,12 +20,11 @@ public interface TbsCostApplyMapper extends BaseMapper<TbsCostApply> {
/**
* 查询列表
* @param lqw
* @param page
* @param param
* @return
*/
List<TbsCostApply> selectCostApplyList(@Param(Constants.WRAPPER)Wrapper<TbsCostApply> lqw,
@Param("query")TbsCostApplySo param);
IPage<TbsCostApply> selectCostApplyList(IPage<TbsCostApply> page,@Param("query")TbsCostApply param);
}

4
src/main/java/com/qs/serve/modules/tbs/service/TbsCostApplyService.java

@ -1,10 +1,10 @@
package com.qs.serve.modules.tbs.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qs.serve.common.model.dto.R;
import com.qs.serve.modules.tbs.entity.TbsCostApply;
import com.qs.serve.modules.tbs.entity.so.TbsCostApplySo;
import java.util.List;
@ -15,7 +15,7 @@ import java.util.List;
*/
public interface TbsCostApplyService extends IService<TbsCostApply> {
List<TbsCostApply> selectList(LambdaQueryWrapper<TbsCostApply> lqw, TbsCostApplySo costApplySo,boolean isPage);
IPage<TbsCostApply> selectPage(TbsCostApply costApply) ;
/**
* 提交申请

29
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java

@ -1,6 +1,7 @@
package com.qs.serve.modules.tbs.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qs.serve.common.config.properties.ProjectProperties;
import com.qs.serve.common.model.enums.BudgetLogOptFlag;
@ -28,7 +29,6 @@ import com.qs.serve.modules.tbs.common.util.TbsBudgetLogBuildUtil;
import com.qs.serve.modules.tbs.entity.*;
import com.qs.serve.modules.tbs.entity.dto.TbsBudgetCostResult;
import com.qs.serve.modules.tbs.entity.dto.TbsCostSubItem;
import com.qs.serve.modules.tbs.entity.so.TbsCostApplySo;
import com.qs.serve.modules.tbs.mapper.TbsActivityMapper;
import com.qs.serve.modules.tbs.mapper.TbsActivityPayConditionMapper;
import com.qs.serve.modules.tbs.service.*;
@ -73,12 +73,7 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
private ProjectProperties projectProperties;
@Override
public List<TbsCostApply> selectList(LambdaQueryWrapper<TbsCostApply> lqw, TbsCostApplySo costApplySo,boolean isPage) {
if(costApplySo!=null){
LocalDate now = LocalDate.now();
if(costApplySo.getOverdueState()!=null){
costApplySo.setNowDate(now);
}
public IPage<TbsCostApply> selectPage(TbsCostApply costApply) {
int sysConfOfWarningDays = 0;
try {
SysConfigService configService = SpringUtils.getBean(SysConfigService.class);
@ -88,13 +83,25 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
} catch (BeansException | NumberFormatException e) {
e.printStackTrace();
}
LocalDate now = LocalDate.now();
LocalDate startNow = now.plusDays( - sysConfOfWarningDays );
costApplySo.setStartNowDate(startNow);
costApply.setNowDate(now);
costApply.setStartNowDate(startNow);
IPage<TbsCostApply> iPage = PageUtil.getMbpPage();
IPage<TbsCostApply> result = baseMapper.selectCostApplyList(iPage,costApply);
for (TbsCostApply record : result.getRecords()) {
if (record.getActEndDate()==null){
continue;
}
if(record.getActEndDate().isAfter(now)){
record.setOverdueState(1);
}else if(record.getActEndDate().isAfter(startNow)){
record.setOverdueState(2);
}else {
record.setOverdueState(0);
}
if(isPage){
PageUtil.startPage();
}
return baseMapper.selectCostApplyList(lqw,costApplySo);
return result;
}
@Override

54
src/main/resources/mapper/tbs/TbsCostApplyMapper.xml

@ -29,6 +29,7 @@
<result property="updateBy" column="update_by"/>
<result property="delFlag" column="del_flag"/>
<result property="templateId" column="template_id"/>
<result property="actEndDate" column="act_end_date"/>
</resultMap>
<sql id="tbsCostApplySql">
@ -62,35 +63,76 @@
<select id="selectCostApplyList" parameterType="com.qs.serve.modules.tbs.entity.TbsCostApply" resultMap="tbsCostApplyMap">
SELECT ${ew.sqlSelect}
SELECT
<if test="query!=null">
<if test="query.overdueState!=null">
`tbs_activity`.act_end_date,
</if>
</if>
<include refid="tbsCostApplySql"/>
FROM `tbs_cost_apply` `tbs_cost_apply`
<if test="query!=null">
<if test="query.overdueState!=null">
left JOIN `tbs_activity` on `tbs_cost_apply`.id = `tbs_activity`.cost_apply_id
</if>
</if>
WHERE `tbs_cost_apply`.`del_flag` = 0
and `tbs_activity`.`del_flag` = 0
<if test="query!=null">
<if test="query.overdueState!=null and query.overdueState==0">
and `tbs_activity`.`del_flag` = 0
and `tbs_activity`.`activity_state` = 0
and `tbs_cost_apply`.`charge_state` = 1
and `tbs_activity`.act_end_date &gt; #{query.nowDate}
</if>
<if test="query.overdueState!=null and query.overdueState==1">
and `tbs_activity`.`del_flag` = 0
and `tbs_activity`.`activity_state` = 0
and `tbs_cost_apply`.`charge_state` = 1
and `tbs_activity`.act_end_date &lt;= #{query.nowDate}
</if>
<if test="query.overdueState!=null and query.overdueState==2">
and `tbs_activity`.`del_flag` = 0
and `tbs_activity`.`activity_state` = 0
and `tbs_cost_apply`.`charge_state` = 1
and `tbs_activity`.act_end_date &gt;= #{query.startNowDate}
and `tbs_activity`.act_end_date &lt; #{query.nowDate}
</if>
<include refid="baseWhere4CostApply"/>
</if>
<if test="ew != null">
<if test="ew.nonEmptyOfWhere">
AND ${ew.sqlSegment}
</if>
<if test="query.selectUserIds!=null and query.selectUserIds.size > 0">
and `tbs_cost_apply`.`user_id` in
<foreach collection="query.selectUserIds" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
</select>
<sql id="baseWhere4CostApply">
<if test="query.id != null"> and `tbs_cost_apply`.`id` = #{query.id}</if>
<if test="query.code != null and query.code != ''"> and `tbs_cost_apply`.`code` like concat('%', #{query.code},'%')</if>
<if test="query.chargeTheme != null and query.chargeTheme != ''"> and `tbs_cost_apply`.`charge_theme` like concat('%', #{query.chargeTheme},'%')</if>
<if test="query.supplierId != null"> and `tbs_cost_apply`.`supplier_id` = #{query.supplierId}</if>
<if test="query.supplierCode != null and query.supplierCode != ''"> and `tbs_cost_apply`.`supplier_code` like concat('%', #{query.supplierCode},'%') </if>
<if test="query.supplierName != null and query.supplierName != ''"> and `tbs_cost_apply`.`supplier_name` like concat('%', #{query.supplierName},'%') </if>
<if test="query.chargeState != null"> and `tbs_cost_apply`.`charge_state` = #{query.chargeState}</if>
<if test="query.submitTime != null"> and `tbs_cost_apply`.`submit_time` = #{query.submitTime}</if>
<if test="query.passTime != null"> and `tbs_cost_apply`.`pass_time` = #{query.passTime}</if>
<if test="query.userId != null and query.userId != ''"> and `tbs_cost_apply`.`user_id` = #{query.userId}</if>
<if test="query.userCode != null and query.userCode != ''"> and `tbs_cost_apply`.`user_code` = #{query.userCode}</if>
<if test="query.userName != null and query.userName != ''"> and `tbs_cost_apply`.`user_name` like concat('%', #{query.userName},'%')</if>
<if test="query.syFormId != null and query.syFormId != ''"> and `tbs_cost_apply`.`sy_form_id` = #{query.syFormId}</if>
<if test="query.syFlowId != null and query.syFlowId != ''"> and `tbs_cost_apply`.`sy_flow_id` = #{query.syFlowId}</if>
<if test="query.totalActivity != null"> and `tbs_cost_apply`.`total_activity` = #{query.totalActivity}</if>
<if test="query.totalActivityAmount != null"> and `tbs_cost_apply`.`total_activity_amount` = #{query.totalActivityAmount}</if>
<if test="query.totalActivityUsedAmount != null"> and `tbs_cost_apply`.`total_activity_used_amount` = #{query.totalActivityUsedAmount}</if>
<if test="query.contractFlag != null"> and `tbs_cost_apply`.`contract_flag` = #{query.contractFlag}</if>
<if test="query.createTime != null"> and `tbs_cost_apply`.`create_time` = #{query.createTime}</if>
<if test="query.updateTime != null"> and `tbs_cost_apply`.`update_time` = #{query.updateTime}</if>
<if test="query.tenantId != null and query.tenantId != ''"> and `tbs_cost_apply`.`tenant_id` = #{query.tenantId}</if>
<if test="query.createBy != null and query.createBy != ''"> and `tbs_cost_apply`.`create_by` = #{query.createBy}</if>
<if test="query.updateBy != null and query.updateBy != ''"> and `tbs_cost_apply`.`update_by` = #{query.updateBy}</if>
<if test="query.delFlag != null and query.delFlag != ''"> and `tbs_cost_apply`.`del_flag` = #{query.delFlag}</if>
</sql>
</mapper>

Loading…
Cancel
Save