增加已结算过滤功能,优化项目查询逻辑
This commit is contained in:
parent
b7179fae41
commit
f2408b6f6e
|
|
@ -159,6 +159,11 @@ public class BmProject extends BaseEntity
|
|||
*/
|
||||
private Boolean enableFilter;
|
||||
|
||||
/**
|
||||
* 是否开启已结算过滤
|
||||
*/
|
||||
private Boolean enableFilterSlt;
|
||||
|
||||
@ApiModelProperty(value = "班组id")
|
||||
private Long teamId;
|
||||
|
||||
|
|
|
|||
|
|
@ -1689,14 +1689,14 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
|
||||
List<LeaseApplyInfo> userList = leaseApplyInfoMapper.getUserList(leaseApplyInfo);
|
||||
// 省公司短信发送
|
||||
List<String> mobileList = new ArrayList();
|
||||
if(userList !=null && userList.size()>0){
|
||||
List<String> mobileList = new ArrayList<>();
|
||||
if(userList !=null && !userList.isEmpty()) {
|
||||
for (LeaseApplyInfo item : userList){
|
||||
LeaseApplyInfo item1 = leaseApplyInfoMapper.getUserPhoneById(item);
|
||||
mobileList.add(item1.getPhone());
|
||||
}
|
||||
}
|
||||
if (mobileList != null && mobileList.size() > 0){
|
||||
if (!mobileList.isEmpty()){
|
||||
JSONObject sendResult = SmsTool.sendSms(new BatchSmsByContentParam(mobileList, "您有一条待确认的领料信息,请尽快登录机具系统进行确认!"), BmConfigItems.ANHUI_COMPANY_SMS_KEY);
|
||||
if (sendResult != null) {
|
||||
// 短信发送成功
|
||||
|
|
|
|||
|
|
@ -812,7 +812,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
// 计算报废金额
|
||||
BigDecimal scrapCosts = Optional.ofNullable(details.getBuyPrice()).orElse(BigDecimal.ZERO).multiply(scrapNum);
|
||||
|
||||
|
||||
// 附件📎
|
||||
if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList().get(0).getFileList())) {
|
||||
for (BmFileInfo fileInfo : bean.getNumberScrapRepairPartList().get(0).getFileList()) {
|
||||
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
|
||||
|
|
@ -866,9 +866,8 @@ public class RepairServiceImpl implements RepairService {
|
|||
/**
|
||||
* 拆分维修单,生成任务协议表
|
||||
*
|
||||
* @param newTaskId
|
||||
* @param agreementId
|
||||
* @return
|
||||
* @param newTaskId 新任务ID
|
||||
* @param agreementId 协议ID
|
||||
*/
|
||||
private int insertTta(Long newTaskId, Long agreementId) {
|
||||
int res;
|
||||
|
|
@ -881,9 +880,6 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 生成任务表
|
||||
*
|
||||
* @param createBy
|
||||
* @return
|
||||
*/
|
||||
private Long insertTt(String createBy) {
|
||||
Long newTask = null;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,6 @@ public class SltAgreementInfoController extends BaseController {
|
|||
for (Object row : paginated.getRows()) {
|
||||
if (row instanceof SltAgreementInfo) {
|
||||
((SltAgreementInfo) row).setSettlementType(loginUserHasSettlementPermission);
|
||||
|
||||
}
|
||||
SltInfoVo sltInfoVo = null;
|
||||
if (row instanceof SltAgreementInfo) {
|
||||
|
|
@ -116,10 +115,8 @@ public class SltAgreementInfoController extends BaseController {
|
|||
}
|
||||
if (sltInfoVo != null) {
|
||||
list.get(list.indexOf(row)).setCosts(sltAgreementInfoService.sum(sltInfoVo.getLeaseCost(), sltInfoVo.getRepairCost(), sltInfoVo.getScrapCost(), sltInfoVo.getLoseCost()));
|
||||
//((SltAgreementInfo) row).setCosts(sltAgreementInfoService.sum(sltInfoVo.getLeaseCost(), sltInfoVo.getRepairCost(), sltInfoVo.getScrapCost(), sltInfoVo.getLoseCost()));
|
||||
}
|
||||
}
|
||||
//ListPagingUtil resultPaging = ListPagingUtil.paging(pageIndex, pageSize, paginated.getRows());
|
||||
ListPagingUtil resultPaging = ListPagingUtil.paging(pageIndex, pageSize, list);
|
||||
resultPaging.setTotal(list.size());
|
||||
return AjaxResult.success(resultPaging);
|
||||
|
|
|
|||
|
|
@ -260,8 +260,18 @@ public interface SltAgreementInfoMapper {
|
|||
*/
|
||||
int updateBmAgreementReject(SltAgreementApply sltAgreementApply);
|
||||
|
||||
/**
|
||||
* 根据单位id查询工程集合
|
||||
* @param unitId 单位ID
|
||||
*/
|
||||
int[] getProjectListByUnitIds(int unitId);
|
||||
|
||||
/**
|
||||
* 根据单位id查询工程集合(未结算的工程)
|
||||
* @param unitId 单位ID
|
||||
*/
|
||||
int[] getProjectListAndSltByUnitIds(@Param("unitId") int unitId, @Param("sltType") int sltType);
|
||||
|
||||
List<ProjectTreeNode> getProjectList(int projectId);
|
||||
|
||||
List<AgreementVo> getAgreementInfoById(@Param("unitIds") List<Integer> unitIds, @Param("projectId") int projectId);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import com.bonus.material.settlement.domain.vo.PeriodCostSummaryVo;
|
|||
* 结算信息Service接口
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-10-16
|
||||
*/
|
||||
public interface ISltAgreementInfoService {
|
||||
/**
|
||||
|
|
@ -26,7 +25,7 @@ public interface ISltAgreementInfoService {
|
|||
* @param id 结算信息主键
|
||||
* @return 结算信息
|
||||
*/
|
||||
public SltAgreementInfo selectSltAgreementInfoById(Long id);
|
||||
SltAgreementInfo selectSltAgreementInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询结算信息列表
|
||||
|
|
@ -34,13 +33,13 @@ public interface ISltAgreementInfoService {
|
|||
* @param sltAgreementInfo 结算信息
|
||||
* @return 结算信息集合
|
||||
*/
|
||||
public List<SltAgreementInfo> selectSltAgreementInfoList(SltAgreementInfo sltAgreementInfo);
|
||||
List<SltAgreementInfo> selectSltAgreementInfoList(SltAgreementInfo sltAgreementInfo);
|
||||
|
||||
public List<SltAgreementInfo> getSltAgreementInfo4Project(SltAgreementInfo bean);
|
||||
List<SltAgreementInfo> getSltAgreementInfo4Project(SltAgreementInfo bean);
|
||||
|
||||
public BigDecimal sum(BigDecimal... values);
|
||||
BigDecimal sum(BigDecimal... values);
|
||||
|
||||
public SltInfoVo getSltInfo(SltAgreementInfo info);
|
||||
SltInfoVo getSltInfo(SltAgreementInfo info);
|
||||
|
||||
/**
|
||||
* 批量查询结算信息列表 -- 未结算报表专用
|
||||
|
|
@ -63,7 +62,7 @@ public interface ISltAgreementInfoService {
|
|||
* @param sltAgreementInfo 结算信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSltAgreementInfo(SltAgreementInfo sltAgreementInfo);
|
||||
int insertSltAgreementInfo(SltAgreementInfo sltAgreementInfo);
|
||||
|
||||
/**
|
||||
* 修改结算信息
|
||||
|
|
@ -71,7 +70,7 @@ public interface ISltAgreementInfoService {
|
|||
* @param sltAgreementInfo 结算信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSltAgreementInfo(SltAgreementInfo sltAgreementInfo);
|
||||
int updateSltAgreementInfo(SltAgreementInfo sltAgreementInfo);
|
||||
|
||||
/**
|
||||
* 批量删除结算信息
|
||||
|
|
@ -79,7 +78,7 @@ public interface ISltAgreementInfoService {
|
|||
* @param ids 需要删除的结算信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSltAgreementInfoByIds(Long[] ids);
|
||||
int deleteSltAgreementInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除结算信息信息
|
||||
|
|
@ -87,15 +86,15 @@ public interface ISltAgreementInfoService {
|
|||
* @param id 结算信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSltAgreementInfoById(Long id);
|
||||
int deleteSltAgreementInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 提交结算信息
|
||||
* 提交结算
|
||||
*
|
||||
* @param sltInfoVo 结算信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int submitCosts(SltInfoVo sltInfoVo);
|
||||
int submitCosts(SltInfoVo sltInfoVo);
|
||||
|
||||
/**
|
||||
* 结算审批列表
|
||||
|
|
@ -107,15 +106,11 @@ public interface ISltAgreementInfoService {
|
|||
|
||||
/**
|
||||
* 查询已结算报表list
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<SltAgreementInfo> getSltReportedList(SltAgreementInfo bean);
|
||||
|
||||
/**
|
||||
* 查询未结算报表list
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<SltAgreementInfo> getSltReportList(SltAgreementInfo bean);
|
||||
|
||||
|
|
@ -134,12 +129,8 @@ public interface ISltAgreementInfoService {
|
|||
*/
|
||||
List<SltAgreementInfo> getScrapReportList(SltAgreementInfo bean);
|
||||
|
||||
|
||||
/**
|
||||
* 进行结算审批
|
||||
*
|
||||
* @param sltAgreementApply 进行结算审批
|
||||
* @return 结果
|
||||
*/
|
||||
AjaxResult costExamine(SltAgreementApply sltAgreementApply);
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
|
||||
@Override
|
||||
public List<SltAgreementInfo> getSltAgreementInfo4Project(SltAgreementInfo bean) {
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
List<SltAgreementInfo> list = sltAgreementInfoMapper.getSltAgreementInfo4Project(bean);
|
||||
|
||||
// 删除 null 对象
|
||||
|
|
@ -322,34 +321,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
return sltAgreementInfoMapper.getSltExam(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量分批查询工具
|
||||
*
|
||||
* @param ids 待查询的id集合
|
||||
* @param batchSize 每次查询的最大数量
|
||||
* @param queryFunc 查询函数,比如 service::queryByIds
|
||||
* @return 合并后的结果集合
|
||||
* @param <T> id类型
|
||||
* @param <R> 返回结果类型
|
||||
*/
|
||||
public static <T, R> List<R> batchQuery(List<T> ids, int batchSize, Function<List<T>, List<R>> queryFunc) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<R> result = new ArrayList<>();
|
||||
int total = ids.size();
|
||||
for (int i = 0; i < total; i += batchSize) {
|
||||
int end = Math.min(i + batchSize, total);
|
||||
List<T> subList = ids.subList(i, end);
|
||||
List<R> batchResult = queryFunc.apply(subList);
|
||||
if (batchResult != null && !batchResult.isEmpty()) {
|
||||
result.addAll(batchResult);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增结算信息
|
||||
*
|
||||
|
|
@ -362,6 +333,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
try {
|
||||
return sltAgreementInfoMapper.insertSltAgreementInfo(sltAgreementInfo);
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
throw new ServiceException("错误信息描述");
|
||||
}
|
||||
}
|
||||
|
|
@ -378,6 +350,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
try {
|
||||
return sltAgreementInfoMapper.updateSltAgreementInfo(sltAgreementInfo);
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
throw new ServiceException("错误信息描述");
|
||||
}
|
||||
}
|
||||
|
|
@ -638,8 +611,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
throw new ServiceException("协议id错误");
|
||||
}
|
||||
|
||||
|
||||
|
||||
int theSettledCount = sltAgreementInfoMapper.selectTheSettledCountByAgreementIdType(sltInfoVo.getSettlementType(), agreementId);
|
||||
if (sltInfoVo.getAgreementIds().length <= 1) {
|
||||
// 如果不是批量提交,已结算的费用类型就直接提示已结算
|
||||
|
|
@ -662,7 +633,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
|
||||
//获取该协议下的所有维修任务
|
||||
List<TmTask> repairList = taskMapper.getTaskIdByAgreementId(info);
|
||||
if(repairList != null && !repairList.isEmpty()){
|
||||
if(CollectionUtils.isNotEmpty(repairList)){
|
||||
throw new ServiceException("结算中存在维修和报废未完成的任务,无法结算!");
|
||||
}
|
||||
|
||||
|
|
@ -803,7 +774,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
List<SltAgreementInfo> list = sltAgreementInfoMapper.getSltList(bean);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (SltAgreementInfo row : list){
|
||||
SltInfoVo sltInfoVo = null;
|
||||
SltInfoVo sltInfoVo;
|
||||
sltInfoVo = getSltInfo(row);
|
||||
if (sltInfoVo != null) {
|
||||
row.setCosts(sum(sltInfoVo.getLeaseCost(), sltInfoVo.getRepairCost(), sltInfoVo.getScrapCost(), sltInfoVo.getLoseCost()));
|
||||
|
|
@ -824,25 +795,18 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
sltReportedList.removeIf(Objects::isNull);
|
||||
// 去掉没有审核的or审核不通过的
|
||||
sltReportedList.removeIf(obj -> Objects.isNull(obj.getSltStatus()) || !Objects.equals("2", obj.getSltStatus()));
|
||||
sltReportedList.forEach(sltAgreementInfo -> {
|
||||
if (sltAgreementInfo.getCosts() == null || sltAgreementInfo.getCosts().equals(BigDecimal.ZERO)) {
|
||||
sltAgreementInfo.setCosts(
|
||||
sltReportedList.forEach(sltAgreementInfo -> sltAgreementInfo.setCosts(
|
||||
sltAgreementInfo.getLeaseCost()
|
||||
.add(sltAgreementInfo.getRepairCost())
|
||||
.add(sltAgreementInfo.getScrapCost())
|
||||
.add(sltAgreementInfo.getLoseCost())
|
||||
);
|
||||
}
|
||||
});
|
||||
));
|
||||
}
|
||||
return sltReportedList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未结算报表list
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SltAgreementInfo> getSltReportList(SltAgreementInfo bean) {
|
||||
|
|
@ -889,8 +853,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
}
|
||||
}
|
||||
|
||||
return list != null ? list : new ArrayList<>();
|
||||
|
||||
return list != null ? list : Collections.emptyList();
|
||||
} catch (Exception e) {
|
||||
System.err.println("查询未结算报表失败:" + e.getMessage());
|
||||
throw new ServiceException("查询未结算报表失败:" + e.getMessage());
|
||||
|
|
@ -919,8 +882,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
|
||||
/**
|
||||
* 维修报表list
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
@Override
|
||||
public List<SltAgreementInfo> getRepairReportList(SltAgreementInfo bean) {
|
||||
|
|
@ -929,13 +890,10 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
|
||||
/**
|
||||
* 报废报表list
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
@Override
|
||||
public List<SltAgreementInfo> getScrapReportList(SltAgreementInfo bean) {
|
||||
List<SltAgreementInfo> scrapList = sltAgreementInfoMapper.getScrapDetailsListBatch(bean);
|
||||
return scrapList;
|
||||
return sltAgreementInfoMapper.getScrapDetailsListBatch(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1008,6 +966,10 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询结算记录明细
|
||||
* @param info 结算信息
|
||||
*/
|
||||
@Override
|
||||
public SltInfoVo getSltRecordDetailsList(SltAgreementInfo info) {
|
||||
SltInfoVo sltInfoVo = new SltInfoVo();
|
||||
|
|
@ -1076,18 +1038,30 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
|
||||
/**
|
||||
* 工程类型树
|
||||
* @param bmProject
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getProjectListByUnitIds(BmProject bmProject) {
|
||||
List<ProjectTreeNode> groupList = new ArrayList<>();
|
||||
List<ProjectTreeNode> list = new ArrayList<>();
|
||||
|
||||
// 检查登录用户是否有结算权限
|
||||
int loginUserSettlementTypePermission = 0;
|
||||
try {
|
||||
loginUserSettlementTypePermission = this.checkLoginUserHasSettlementPermission();
|
||||
} catch (Exception e) {
|
||||
System.err.println("虽然当前登陆用户无结算权限,但是允许下拉框查看");
|
||||
}
|
||||
|
||||
try {
|
||||
if (bmProject.getUnitIds() != null) {
|
||||
Map<Integer,Integer> map = new HashMap<>();
|
||||
for (int i = 0; i < bmProject.getUnitIds().length; i++) {
|
||||
int[] projectIds= sltAgreementInfoMapper.getProjectListByUnitIds(bmProject.getUnitIds()[i]);
|
||||
int[] projectIds;
|
||||
if (bmProject.getEnableFilterSlt() != null && bmProject.getEnableFilterSlt()) {
|
||||
projectIds = sltAgreementInfoMapper.getProjectListAndSltByUnitIds(bmProject.getUnitIds()[i], loginUserSettlementTypePermission);
|
||||
} else {
|
||||
projectIds = sltAgreementInfoMapper.getProjectListByUnitIds(bmProject.getUnitIds()[i]);
|
||||
}
|
||||
Map<Integer,Integer> mapTemp = new HashMap<>();
|
||||
for (int projectId : projectIds) {
|
||||
mapTemp.put(projectId, 1);
|
||||
|
|
@ -1130,6 +1104,9 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID查询协议信息
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getAgreementInfoById(SelectDto dto) {
|
||||
List<AgreementVo> vo;
|
||||
|
|
@ -1539,8 +1516,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
return sltAgreementInfoMapper.getRepairCodeList(bean);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 按协议汇总费用数据
|
||||
*
|
||||
|
|
|
|||
|
|
@ -696,17 +696,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</update>
|
||||
|
||||
<select id="getProjectListByUnitIds" resultType="int">
|
||||
<select id="getProjectListByUnitIds">
|
||||
/*根据往来单位id关联协议查询工程*/
|
||||
SELECT
|
||||
bmp.pro_id AS id
|
||||
FROM
|
||||
bm_project bmp
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bmp.imp_unit
|
||||
LEFT JOIN bm_agreement_info bai ON bai.project_id = bmp.pro_id
|
||||
AND bai.`status` = '1'
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
|
||||
AND bu.del_flag = '0'
|
||||
LEFT JOIN bm_agreement_info bai ON bai.project_id = bmp.pro_id AND bai.`status` = '1'
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id AND bu.del_flag = '0'
|
||||
WHERE
|
||||
sd.del_flag = '0'
|
||||
AND sd.`status` = '0'
|
||||
|
|
@ -717,6 +715,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
|
||||
<select id="getProjectListAndSltByUnitIds">
|
||||
SELECT
|
||||
bmp.pro_id AS id
|
||||
FROM
|
||||
bm_project bmp
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bmp.imp_unit
|
||||
LEFT JOIN bm_agreement_info bai ON bai.project_id = bmp.pro_id AND bai.`status` = '1'
|
||||
LEFT JOIN slt_agreement_apply saa ON bai.agreement_id = saa.agreement_id AND saa.settlement_type = #{sltType} AND saa.`status` = '2'
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id AND bu.del_flag = '0'
|
||||
WHERE
|
||||
sd.del_flag = '0'
|
||||
AND sd.`status` = '0'
|
||||
AND bmp.del_flag = '0'
|
||||
AND saa.`status` IS NULL
|
||||
<if test="unitId != null">
|
||||
AND bu.unit_id = #{unitId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getProjectList" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
|
||||
/*根据往来单位id关联协议查询工程*/
|
||||
SELECT
|
||||
|
|
@ -1362,4 +1380,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and tt.code like concat('%', #{repairCode}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue