feat(settlement): 新增已结算和未结算报表查询功能
- 在 SltAgreementInfoService接口中添加了 getSltReportedList 和 getSltReportList 方法 - 在 SltAgreementInfoServiceImpl 类中实现了这两个方法 - 在 SltAgreementInfoMapper 接口中添加了对应的 SQL 查询方法 - 在 XML 文件中编写了具体的 SQL 查询语句 - 优化了单位列表查询,增加了过滤班组的功能
This commit is contained in:
parent
06fb0a60d1
commit
7ad03dbdd0
|
|
@ -105,4 +105,9 @@ public class BmUnit extends BaseEntity
|
||||||
/** 班组ID */
|
/** 班组ID */
|
||||||
private Long teamId;
|
private Long teamId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否过滤班组(true 过滤,默认不过滤)
|
||||||
|
*/
|
||||||
|
private boolean enableFilterTeam;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,13 @@ public class SelectController {
|
||||||
return service.getUnitList(bmUnit);
|
return service.getUnitList(bmUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "往来单位下拉选,过滤掉班组类型")
|
||||||
|
@PostMapping("getUnitListFilterTeam")
|
||||||
|
public AjaxResult getUnitListFilterTeam(@RequestBody BmUnit bmUnit) {
|
||||||
|
bmUnit.setEnableFilterTeam(true);
|
||||||
|
return service.getUnitList(bmUnit);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* todo 领用申请往来单位下拉选专用
|
* todo 领用申请往来单位下拉选专用
|
||||||
* @param bmUnit
|
* @param bmUnit
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,10 @@ public class SelectServiceImpl implements SelectService {
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.filter(unit -> unit.getId() != null && unit.getParentId() != null)
|
.filter(unit -> unit.getId() != null && unit.getParentId() != null)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (bmUnit.isEnableFilterTeam()) {
|
||||||
|
list.removeIf(item -> Objects.equals("0101", item.getTypeKey()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
stepTimes.put("数据过滤", System.currentTimeMillis() - filterStart);
|
stepTimes.put("数据过滤", System.currentTimeMillis() - filterStart);
|
||||||
|
|
||||||
|
|
@ -111,7 +115,7 @@ public class SelectServiceImpl implements SelectService {
|
||||||
List<ProjectTreeNode> newList = mapper.getTeam();
|
List<ProjectTreeNode> newList = mapper.getTeam();
|
||||||
stepTimes.put("获取班组数据", System.currentTimeMillis() - teamStart);
|
stepTimes.put("获取班组数据", System.currentTimeMillis() - teamStart);
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(newList)) {
|
if (CollectionUtils.isNotEmpty(newList) && !bmUnit.isEnableFilterTeam()) {
|
||||||
groupList.addAll(newList);
|
groupList.addAll(newList);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import com.bonus.material.task.mapper.TmTaskMapper;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.poi.hssf.usermodel.*;
|
import org.apache.poi.hssf.usermodel.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -1410,6 +1411,54 @@ public class SltAgreementInfoController extends BaseController {
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已结算报表--列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "已结算报表list查询")
|
||||||
|
@GetMapping("/getSltReportedList")
|
||||||
|
public TableDataInfo getSltReportedList(SltAgreementInfo bean) {
|
||||||
|
startPage();
|
||||||
|
List<SltAgreementInfo> list = sltAgreementInfoService.getSltReportedList(bean);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未结算报表--列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "未结算报表list查询")
|
||||||
|
@GetMapping("/getSltReportList")
|
||||||
|
public TableDataInfo getSltReportList(SltAgreementInfo query) {
|
||||||
|
// ----------- 定义返回集合 ------------
|
||||||
|
List<SltInfoVo> resultList = new ArrayList<>();
|
||||||
|
|
||||||
|
// ----------- 查询列表 ---------------
|
||||||
|
List<SltAgreementInfo> list = sltAgreementInfoService.getSltReportList(query);
|
||||||
|
|
||||||
|
// ----------- 遍历列表,设置默认值 ---------------
|
||||||
|
Byte settlementType = sltAgreementInfoService.checkLoginUserHasSettlementPermission();
|
||||||
|
// 设置结算权限,控制展示
|
||||||
|
list.forEach(info -> info.setSettlementType(settlementType));
|
||||||
|
|
||||||
|
List<SltInfoVo> dataList = new ArrayList<>();
|
||||||
|
SltInfoVo bean = new SltInfoVo();
|
||||||
|
for (SltAgreementInfo info : list) {
|
||||||
|
SltInfoVo vo = sltAgreementInfoService.getSltInfo(info);
|
||||||
|
if (vo == null) { continue; }
|
||||||
|
vo.setAgreementId(info.getAgreementId());
|
||||||
|
vo.setAgreementCode(info.getAgreementCode());
|
||||||
|
dataList.add(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 移除领、修、丢、废4项都没有明细的结算信息
|
||||||
|
dataList.removeIf(vo -> CollectionUtils.isEmpty(vo.getLeaseList())
|
||||||
|
&& CollectionUtils.isEmpty(vo.getRepairList())
|
||||||
|
&& CollectionUtils.isEmpty(vo.getScrapList())
|
||||||
|
&& CollectionUtils.isEmpty(vo.getLoseList())
|
||||||
|
);
|
||||||
|
|
||||||
|
return getDataTable(dataList);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 进行结算审批
|
* 进行结算审批
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,18 @@ public interface SltAgreementInfoMapper {
|
||||||
*/
|
*/
|
||||||
List<SltAgreementInfo> getSltList(SltAgreementInfo bean);
|
List<SltAgreementInfo> getSltList(SltAgreementInfo bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已结算报表list查询
|
||||||
|
*/
|
||||||
|
List<SltAgreementInfo> getSltReportedList(SltAgreementInfo bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未结算报表查询
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SltAgreementInfo> getSltReportList(SltAgreementInfo bean);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对驳回的结算信息进行重新设置为未结算
|
* 对驳回的结算信息进行重新设置为未结算
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,21 @@ public interface ISltAgreementInfoService {
|
||||||
*/
|
*/
|
||||||
List<SltAgreementInfo> getSltList(SltAgreementInfo bean);
|
List<SltAgreementInfo> getSltList(SltAgreementInfo bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已结算报表list
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SltAgreementInfo> getSltReportedList(SltAgreementInfo bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询未结算报表list
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SltAgreementInfo> getSltReportList(SltAgreementInfo bean);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 进行结算审批
|
* 进行结算审批
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,13 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
||||||
//丢失费用列表
|
//丢失费用列表
|
||||||
List<SltAgreementInfo> loseList = getLoseList(info);
|
List<SltAgreementInfo> loseList = getLoseList(info);
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(leaseList) && CollectionUtils.isEmpty(repairList)
|
||||||
|
&& CollectionUtils.isEmpty(scrapList) && CollectionUtils.isEmpty(loseList))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//费用减免列表
|
||||||
List<SltAgreementReduce> reductionList = getReductionList(info);
|
List<SltAgreementReduce> reductionList = getReductionList(info);
|
||||||
sltInfoVo.setLeaseList(leaseList);
|
sltInfoVo.setLeaseList(leaseList);
|
||||||
sltInfoVo.setRepairList(repairList);
|
sltInfoVo.setRepairList(repairList);
|
||||||
|
|
@ -536,6 +543,34 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
||||||
return sltAgreementInfoMapper.getSltList(bean);
|
return sltAgreementInfoMapper.getSltList(bean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已结算报表list
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SltAgreementInfo> getSltReportedList(SltAgreementInfo bean) {
|
||||||
|
return sltAgreementInfoMapper.getSltReportedList(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询未结算报表list
|
||||||
|
*
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SltAgreementInfo> getSltReportList(SltAgreementInfo bean) {
|
||||||
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
|
List<SltAgreementInfo> list = sltAgreementInfoMapper.getSltReportList(bean);
|
||||||
|
// 删除 null 对象
|
||||||
|
list.removeIf(Objects::isNull);
|
||||||
|
// 遍历列表,设置默认值
|
||||||
|
list.forEach(obj -> {
|
||||||
|
if (obj.getIsSlt() == null) { obj.setIsSlt("0");}
|
||||||
|
});
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断以逗号分隔的字符串是否包含指定的值(严格判断)
|
* 判断以逗号分隔的字符串是否包含指定的值(严格判断)
|
||||||
* @param strings 以逗号分隔的字符串
|
* @param strings 以逗号分隔的字符串
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
||||||
LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id
|
LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id
|
||||||
where bai.status = '1'
|
where bai.status = '1' AND bui.type_id != '1731'
|
||||||
<if test="unitIds != null">
|
<if test="unitIds != null">
|
||||||
and bui.unit_id in
|
and bui.unit_id in
|
||||||
<foreach item="item" index="index" collection="unitIds" open="(" separator="," close=")">
|
<foreach item="item" index="index" collection="unitIds" open="(" separator="," close=")">
|
||||||
|
|
@ -784,4 +784,71 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
and saa.settlement_type = #{sltType}
|
and saa.settlement_type = #{sltType}
|
||||||
and (saa.status = '1' or saa.status = '2')
|
and (saa.status = '1' or saa.status = '2')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getSltReportedList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||||
|
SELECT
|
||||||
|
saa.id as id, bai.agreement_id as agreementId, bai.agreement_code as agreementCode, saa.settlement_type as settlementType,
|
||||||
|
bui.unit_id as unitId,bui.unit_name as unitName, bp.pro_id as projectId , bp.pro_name as projectName,
|
||||||
|
saa.remark,saa.cost as costs,su.nick_name as auditor,saa.audit_time as auditTime,
|
||||||
|
saa.create_time as createTime,
|
||||||
|
SUM(IF(sad.slt_type = '1',sad.money,0)) AS leaseCost,
|
||||||
|
SUM(IF(sad.slt_type = '2',sad.money,0)) AS loseCost,
|
||||||
|
SUM(IF(sad.slt_type = '3',sad.money,0)) AS repairCost,
|
||||||
|
SUM(IF(sad.slt_type = '4',sad.money,0)) AS scrapCost,
|
||||||
|
case when saa.status = '1' then '1' when saa.status = '2' then '2' when saa.status = '3' then '3' end as sltStatus
|
||||||
|
FROM
|
||||||
|
bm_agreement_info bai
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
||||||
|
LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id
|
||||||
|
LEFT JOIN sys_user su ON saa.auditor = su.user_id and su.del_flag = 0
|
||||||
|
where
|
||||||
|
bai.status = '1' and saa.status in ('1','2','3')
|
||||||
|
<if test="unitId != null and unitId != ''">
|
||||||
|
and bui.unit_id = #{unitId}
|
||||||
|
</if>
|
||||||
|
<if test="projectId != null and projectId != ''">
|
||||||
|
and bp.pro_id = #{projectId}
|
||||||
|
</if>
|
||||||
|
<choose>
|
||||||
|
<when test="sltStatus == '1'.toString()">
|
||||||
|
and saa.status = '1'
|
||||||
|
</when>
|
||||||
|
<when test="sltStatus == '2'.toString()">
|
||||||
|
and saa.status = '2'
|
||||||
|
</when>
|
||||||
|
<when test="sltStatus == '3'.toString()">
|
||||||
|
and saa.status = '3'
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
GROUP BY bai.agreement_id
|
||||||
|
ORDER BY bai.create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getSltReportList" resultMap="SltAgreementInfoResult">
|
||||||
|
SELECT bai.agreement_id, bai.agreement_code as agreementCode, bai.is_slt as isSlt,
|
||||||
|
bui.unit_id as unitId,bui.unit_name as unitName, bp.pro_id as projectId , bp.pro_name as projectName,
|
||||||
|
saa.remark,bai.protocol,saa.cost as costs,
|
||||||
|
case when (saa.id is null or saa.status = '0') then '0' when saa.status = '1' then '1' when saa.status = '2' then '2' when saa.status = '3' then '3' end as sltStatus
|
||||||
|
FROM bm_agreement_info bai
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
||||||
|
LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id
|
||||||
|
where bai.status = '1' AND bui.type_id != '1731' AND bai.is_slt = '0'
|
||||||
|
<if test="unitIds != null">
|
||||||
|
and bui.unit_id in
|
||||||
|
<foreach item="item" index="index" collection="unitIds" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="projectId != null and projectId != ''">
|
||||||
|
and bp.pro_id = #{projectId}
|
||||||
|
</if>
|
||||||
|
<if test="sltStatus != null">
|
||||||
|
and bai.is_slt = #{sltStatus}
|
||||||
|
</if>
|
||||||
|
GROUP BY bai.agreement_id
|
||||||
|
ORDER BY bai.create_time desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue