工作组统计

This commit is contained in:
zhangqinlin
2021-09-15 09:38:07 +08:00
parent 9c491ced98
commit 9d7e80c668
4 changed files with 153 additions and 90 deletions
@@ -93,29 +93,6 @@ public class PayWorkingGroupController extends JeroController<PayWorkingGroup, I
return Result.OK(pageList);
}
/**
* 分页列表查询
*
* @param payWorkingGroupSearch 工作组项目
* @param pageNo 页数
* @param pageSize 条数
* @return
*/
@ApiOperation(value="工作组项目统计-统计分页列表查询", notes="工作组项目统计-统计分页列表查询")
@GetMapping(value = "/list2")
public Result<?> list2(PayWorkingGroupSearch payWorkingGroupSearch,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
Page<PayWorkingGroupStatistics> page = new Page<>(pageNo, pageSize);
IPage<PayWorkingGroupStatistics> pageList = payWorkingGroupService.queryPageListForStatistics(page, payWorkingGroupSearch);
double sum = pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney()==null ? "0" : t.getAllMoney())).sum();
double sum2 = pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney()==null ? "0" : t.getComeAllMoney())).sum();
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
objectObjectHashMap.put("分页集合",pageList);
objectObjectHashMap.put("总计应收总金额",sum);
objectObjectHashMap.put("总计实收总金额",sum2);
return Result.OK(objectObjectHashMap);
}
/**
* 列表查询
@@ -390,28 +367,6 @@ public class PayWorkingGroupController extends JeroController<PayWorkingGroup, I
return super.exportXls(request, payWorkingGroup, PayWorkingGroup.class, "pay_working_group");
}
/**
* 导出excel
*
*/
@GetMapping(value = "/exportXls2")
@ApiOperation(value="工作组项目统计-统计导出excel", notes="工作组项目统计-统计导出excel")
public ModelAndView exportXls2() {
List<PayWorkingGroupStatistics> pageList = payWorkingGroupService.queryPageListForStatisticsExcel();
return AmountUtil.exportListXls(pageList, PayWorkingGroupStatistics.class,"工作组项目统计");
}
/**
* 获取工作组列表
*
*/
@GetMapping(value = "/getGroupList")
@ApiOperation(value="获取工作组列表下拉框", notes="获取工作组列表下拉框")
public List<String> getGroupList() {
List<String> pageList = payWorkingGroupService.getGroupList();
return pageList;
}
/**
* 通过excel导入数据
@@ -0,0 +1,139 @@
package com.jero.project.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.vo.DictModel;
import com.jero.project.entity.PayWorkGroupSubletStatistics;
import com.jero.project.entity.PayWorkingGroupSearch;
import com.jero.project.entity.PayWorkingGroupStatistics;
import com.jero.project.entity.PayWorkingGroupSubletSearch;
import com.jero.project.service.IPayWorkingGroupService;
import com.jero.project.service.IPayWorkingGroupSubItemService;
import com.jero.util.AmountUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import java.util.HashMap;
import java.util.List;
/**
* @author zql
* @date 2021/9/15 8:54
*/
@Api(tags="工作组统计")
@RestController
@RequestMapping("/project/payWorkingGroupStatistics")
@Slf4j
public class PayWorkingGroupStatisticsController {
@Autowired
private ISysBaseAPI sysBaseAPI;
@Autowired
private IPayWorkingGroupSubItemService payWorkingGroupSubItemService;
@Autowired
private IPayWorkingGroupService payWorkingGroupService;
/**
* 分页列表查询
*
* @param payWorkingGroupSearch 工作组项目
* @param pageNo 页数
* @param pageSize 条数
* @return
*/
@ApiOperation(value="工作组项目统计-统计分页列表查询", notes="工作组项目统计-统计分页列表查询")
@GetMapping(value = "/list")
public Result<?> list(PayWorkingGroupSearch payWorkingGroupSearch,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
Page<PayWorkingGroupStatistics> page = new Page<>(pageNo, pageSize);
IPage<PayWorkingGroupStatistics> pageList = payWorkingGroupService.queryPageListForStatistics(page, payWorkingGroupSearch);
double sum = pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney()==null ? "0" : t.getAllMoney())).sum();
double sum2 = pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney()==null ? "0" : t.getComeAllMoney())).sum();
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
objectObjectHashMap.put("分页集合",pageList);
objectObjectHashMap.put("总计应收总金额",sum);
objectObjectHashMap.put("总计实收总金额",sum2);
return Result.OK(objectObjectHashMap);
}
/**
* 导出excel
*
*/
@GetMapping(value = "/exportXls2")
@ApiOperation(value="工作组项目统计-统计导出excel", notes="工作组项目统计-统计导出excel")
public ModelAndView exportXls2() {
List<PayWorkingGroupStatistics> pageList = payWorkingGroupService.queryPageListForStatisticsExcel();
return AmountUtil.exportListXls(pageList, PayWorkingGroupStatistics.class,"工作组项目统计");
}
/**
* 获取工作组列表
*
*/
@GetMapping(value = "/getGroupList")
@ApiOperation(value="工作组获取工作组列表下拉框", notes="工作组获取工作组列表下拉框")
public List<String> getGroupList() {
List<String> pageList = payWorkingGroupService.getGroupList();
return pageList;
}
/**
* 分页列表查询
*
* @param payWorkingGroupSubletSearch 工作组成员统计搜索
* @param pageNo 页数
* @param pageSize 条数
* @return
*/
@ApiOperation(value = "工作组成员统计-详情分页列表查询(传工作组id)", notes = "工作组成员统计-详情分页列表查询(传工作组id)")
@GetMapping(value = "/listSub")
public Result<?> list2(PayWorkingGroupSubletSearch payWorkingGroupSubletSearch,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Page<PayWorkGroupSubletStatistics> page = new Page<>(pageNo, pageSize);
IPage<PayWorkGroupSubletStatistics> pageList = payWorkingGroupSubItemService.queryPageList2(page, payWorkingGroupSubletSearch);
double sum = pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null ? "0" : t.getAllMoney())).sum();
double sum2 = pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null ? "0" : t.getComeAllMoney())).sum();
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
objectObjectHashMap.put("分页集合", pageList);
objectObjectHashMap.put("总计应收总金额", sum);
objectObjectHashMap.put("总计实收总金额", sum2);
return Result.OK(objectObjectHashMap);
}
/**
*导出
* @param id
* @return
*/
@GetMapping(value = "/excelSub")
@ApiOperation(value = "工作组成员统计-导出统计(传工作组id)", notes = "工作组成员统计-导出统计(传工作组id)")
public ModelAndView excelSub(@RequestParam(name = "id", required = true) String id) {
List<PayWorkGroupSubletStatistics> list = payWorkingGroupSubItemService.importExcelStatistics(id);
return AmountUtil.exportListXls(list, PayWorkGroupSubletStatistics.class, "工作组成员统计");
}
@ApiOperation(value = "工作组成员字典表获取", notes = "工作组成员字典表获取")
@GetMapping(value = "/getChartUseDict")
public HashMap getChartUse() {
List<DictModel> payment_charge_use = sysBaseAPI.queryDictItemsByCode("payment_charge_use");
List<DictModel> account_type = sysBaseAPI.queryDictItemsByCode("account_type");
HashMap<String, List<DictModel>> hashMap = new HashMap<>();
hashMap.put("来款用途", payment_charge_use);
hashMap.put("到账状态", account_type);
return hashMap;
}
}
@@ -84,29 +84,7 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
return Result.OK(pageList);
}
/**
* 分页列表查询
*
* @param payWorkingGroupSubletSearch 工作组成员统计搜索
* @param pageNo 页数
* @param pageSize 条数
* @return
*/
@ApiOperation(value = "工作组成员统计-详情分页列表查询", notes = "工作组成员统计-详情分页列表查询")
@GetMapping(value = "/list2")
public Result<?> list2(PayWorkingGroupSubletSearch payWorkingGroupSubletSearch,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Page<PayWorkGroupSubletStatistics> page = new Page<>(pageNo, pageSize);
IPage<PayWorkGroupSubletStatistics> pageList = payWorkingGroupSubItemService.queryPageList2(page, payWorkingGroupSubletSearch);
double sum = pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null ? "0" : t.getAllMoney())).sum();
double sum2 = pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null ? "0" : t.getComeAllMoney())).sum();
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
objectObjectHashMap.put("分页集合", pageList);
objectObjectHashMap.put("总计应收总金额", sum);
objectObjectHashMap.put("总计实收总金额", sum2);
return Result.OK(objectObjectHashMap);
}
/**
* 添加
@@ -296,16 +274,6 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
}
@ApiOperation(value = "字典表获取", notes = "字典表获取")
@GetMapping(value = "/getChartUseDict")
public HashMap getChartUse() {
List<DictModel> payment_charge_use = sysBaseAPI.queryDictItemsByCode("payment_charge_use");
List<DictModel> account_type = sysBaseAPI.queryDictItemsByCode("account_type");
HashMap<String, List<DictModel>> hashMap = new HashMap<>();
hashMap.put("来款用途", payment_charge_use);
hashMap.put("到账状态", account_type);
return hashMap;
}
/**
* 通过excel导入数据
@@ -320,16 +288,5 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
return Result.OK("文件导入成功!");
}
/**
* 通过excel导入数据
*
* @param id
* @return
*/
@GetMapping(value = "/importExcelStatistics")
@ApiOperation(value = "工作组成员统计-导出统计", notes = "工作组成员统计-导出统计")
public ModelAndView importExcelStatistics(@RequestParam(name = "id", required = true) String id) {
List<PayWorkGroupSubletStatistics> list = payWorkingGroupSubItemService.importExcelStatistics(id);
return AmountUtil.exportListXls(list, PayWorkGroupSubletStatistics.class, "工作组成员统计");
}
}
@@ -111,4 +111,16 @@
</where>
group by pwgs.id
</select>
<select id="importExcelStatistics" resultType="com.jero.project.entity.PayWorkGroupSubletStatistics">
SELECT
pwgs.id,
pwg.principal_name_a as principalName,
pwgs.charge_company_temporary_name AS chargeCompanyTemporaryName,
pwgs.receivable_amount AS allMoney,
pwgs.paid_amount AS comeAllMoney,
pwgs.charge_use as chargeUse
FROM pay_working_group_subitem pwgs left join pay_payment_record ppr on(pwgs.id=ppr.project_id)
left join pay_working_group pwg on(pwgs.working_group_id=pwg.id)
where pwgs.working_group_id = #{id}
</select>
</mapper>