收入合同-工作组列表查询

This commit is contained in:
梁琦涛
2021-09-06 18:05:57 +08:00
parent f6a63d4009
commit 92f04a3a69
6 changed files with 78 additions and 58 deletions
@@ -73,37 +73,7 @@ public class PayWorkingGroupController extends JeroController<PayWorkingGroup, I
if(!Objects.isNull(pageList)){
List<PayWorkingGroupVO> listPayWorkingGroupVO = pageList.getRecords();
if(!CollectionUtils.isEmpty(listPayWorkingGroupVO)){
listPayWorkingGroupVO.forEach(p->{
LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>();
query.eq(PayWorkingGroupSubItem::getWorkingGroupId,p.getId());
List<PayWorkingGroupSubItem> listPayWorkingGroupSubItem = payWorkingGroupSubItemService.list(query);
if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItem)){
PayWorkingGroupPayment payWorkingGroupPayment = new PayWorkingGroupPayment();
// 已付全款
List<PayWorkingGroupSubItem> listAllPayment = listPayWorkingGroupSubItem.stream()
.filter(p1->(Objects.isNull(p1.getPaidAmount()) ? 0 : p1.getPaidAmount())
== (Objects.isNull(p1.getReceivableAmount()) ? 0 : p1.getReceivableAmount())).collect(Collectors.toList());
payWorkingGroupPayment.setAllPayment(listAllPayment.size());
// 部分付款
List<PayWorkingGroupSubItem> listPartPayment = listPayWorkingGroupSubItem.stream()
.filter(p1->(Objects.isNull(p1.getPaidAmount()) ? 0 : p1.getPaidAmount())
< (Objects.isNull(p1.getReceivableAmount()) ? 0 : p1.getReceivableAmount())).collect(Collectors.toList());
payWorkingGroupPayment.setPartPayment(listPartPayment.size());
// 未付款
List<PayWorkingGroupSubItem> listNotPayment = listPayWorkingGroupSubItem.stream()
.filter(p1->(Objects.isNull(p1.getPaidAmount()) ? 0 : p1.getPaidAmount()) == 0
&& (Objects.isNull(p1.getReceivableAmount()) ? 0 : p1.getReceivableAmount()) != 0 )
.collect(Collectors.toList());
payWorkingGroupPayment.setNotPayment(listNotPayment.size());
p.setObj(payWorkingGroupPayment);
}else{
PayWorkingGroupPayment payWorkingGroupPayment = new PayWorkingGroupPayment();
payWorkingGroupPayment.setAllPayment(0);
payWorkingGroupPayment.setPartPayment(0);
payWorkingGroupPayment.setNotPayment(0);
p.setObj(payWorkingGroupPayment);
}
});
setPayWorkingGroupSubItem(listPayWorkingGroupVO);
pageList.setRecords(listPayWorkingGroupVO);
}
}
@@ -126,23 +96,70 @@ public class PayWorkingGroupController extends JeroController<PayWorkingGroup, I
return Result.OK(list);
}
/**
* 根据成员单位列表查询
*
* @param companyId 成员id
* @return
*/
@AutoLog(value = "工作组项目-根据成员单位列表查询")
@ApiOperation(value="工作组项目-根据成员单位列表查询", notes="工作组项目-根据单位列表查询")
@GetMapping(value = "/queryListByCompany")
public Result<?> queryListByCompany(@RequestParam(name = "companyId") String companyId,
@RequestParam(name = "year",required = false) String year) {
if(StringUtils.isBlank(companyId)){
/**
* 根据成员单位列表查询
*
* @param companyId 企业id
* @param workingGroupProject 工作组项目
* @param year 运行年份
* @return
*/
@AutoLog(value = "工作组项目-根据成员单位列表查询")
@ApiOperation(value="工作组项目-根据成员单位列表查询", notes="工作组项目-根据单位列表查询")
@GetMapping(value = "/queryListByCompany")
public Result<?> queryListByCompany(@RequestParam(name = "companyId") String companyId,
@RequestParam(name = "workingGroupProject") String workingGroupProject,
@RequestParam(name = "year",required = false) String year) {
if(StringUtils.isBlank(companyId)){
return Result.error("企业id不能为空!");
}
List<PayWorkingGroup> list = payWorkingGroupService.queryListByCompany(companyId,year);
List<PayWorkingGroupVO> list = payWorkingGroupService.queryListByCompany(companyId,workingGroupProject,year);
if(CollectionUtils.isEmpty(list)){
setPayWorkingGroupSubItem(list);
}
return Result.OK(list);
}
}
/**
* @Description 获取进度
* @Author lqt
* @Date 2021/9/6
* @Param list 集合
* @Return
* @Exception
*/
private void setPayWorkingGroupSubItem(List<PayWorkingGroupVO> list){
list.forEach(p->{
LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>();
query.eq(PayWorkingGroupSubItem::getWorkingGroupId,p.getId());
List<PayWorkingGroupSubItem> listPayWorkingGroupSubItem = payWorkingGroupSubItemService.list(query);
if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItem)){
PayWorkingGroupPayment payWorkingGroupPayment = new PayWorkingGroupPayment();
// 已付全款
List<PayWorkingGroupSubItem> listAllPayment = listPayWorkingGroupSubItem.stream()
.filter(p1->(Objects.isNull(p1.getPaidAmount()) ? 0 : p1.getPaidAmount())
== (Objects.isNull(p1.getReceivableAmount()) ? 0 : p1.getReceivableAmount())).collect(Collectors.toList());
payWorkingGroupPayment.setAllPayment(listAllPayment.size());
// 部分付款
List<PayWorkingGroupSubItem> listPartPayment = listPayWorkingGroupSubItem.stream()
.filter(p1->(Objects.isNull(p1.getPaidAmount()) ? 0 : p1.getPaidAmount())
< (Objects.isNull(p1.getReceivableAmount()) ? 0 : p1.getReceivableAmount())).collect(Collectors.toList());
payWorkingGroupPayment.setPartPayment(listPartPayment.size());
// 未付款
List<PayWorkingGroupSubItem> listNotPayment = listPayWorkingGroupSubItem.stream()
.filter(p1->(Objects.isNull(p1.getPaidAmount()) ? 0 : p1.getPaidAmount()) == 0
&& (Objects.isNull(p1.getReceivableAmount()) ? 0 : p1.getReceivableAmount()) != 0 )
.collect(Collectors.toList());
payWorkingGroupPayment.setNotPayment(listNotPayment.size());
p.setObj(payWorkingGroupPayment);
}else{
PayWorkingGroupPayment payWorkingGroupPayment = new PayWorkingGroupPayment();
payWorkingGroupPayment.setAllPayment(0);
payWorkingGroupPayment.setPartPayment(0);
payWorkingGroupPayment.setNotPayment(0);
p.setObj(payWorkingGroupPayment);
}
});
}
/**
* 添加
@@ -34,6 +34,6 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
* @Return
* @Exception
*/
List<PayWorkingGroup> queryListByCompany(@Param("companyId") String companyId,@Param("year") String year);
List<PayWorkingGroupVO> queryListByCompany(@Param("companyId") String companyId,@Param("workingGroupProject") String workingGroupProject, @Param("year") String year);
}
@@ -38,7 +38,7 @@
</where>
ORDER BY create_time DESC
</select>
<select id="queryListByCompany" resultType="com.jero.project.entity.PayWorkingGroup">
<select id="queryListByCompany" resultType="com.jero.project.vo.PayWorkingGroupVO">
SELECT
pwg.id,
pwg.working_group_project AS workingGroupProject,
@@ -64,6 +64,9 @@
FROM pay_working_group pwg
LEFT JOIN pay_working_group_subitem pwgs ON pwg.id = pwgs.working_group_id
<where>
<if test="workingGroupProject != null and workingGroupProject != ''">
AND pwg.working_group_project = #{workingGroupProject}
</if>
<if test="companyId != null and companyId != ''">
AND pwgs.charge_company_id = #{companyId}
</if>
@@ -32,5 +32,5 @@ public interface IPayWorkingGroupService extends IService<PayWorkingGroup> {
* @Return
* @Exception
*/
List<PayWorkingGroup> queryListByCompany(String companyId,String year);
List<PayWorkingGroupVO> queryListByCompany(String companyId,String workingGroupProject,String year);
}
@@ -31,7 +31,7 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl<PayWorkingGroupMappe
}
@Override
public List<PayWorkingGroup> queryListByCompany(String companyId, String year) {
return payWorkingGroupMapper.queryListByCompany(companyId,year);
public List<PayWorkingGroupVO> queryListByCompany(String companyId,String workingGroupProject, String year) {
return payWorkingGroupMapper.queryListByCompany(companyId,workingGroupProject,year);
}
}