|
@@ -13984,6 +13984,78 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg getTimeCostByWorkNum(String startDate, String endDate, HttpServletRequest request) {
|
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
|
+ try {
|
|
|
|
+ User targetUser = userMapper.selectById(request.getHeader("Token"));
|
|
|
|
+ Integer companyId =targetUser.getCompanyId();
|
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
+ List<Map<String, Object>> list = projectMapper.getTimeCostByWorkNum(companyId, startDate, endDate);
|
|
|
|
+ BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
|
+ if (!map.containsKey("cost")) {
|
|
|
|
+ map.put("cost", 0);
|
|
|
|
+ }
|
|
|
|
+ if (!map.containsKey("costMoney")) {
|
|
|
|
+ map.put("costMoney", 0);
|
|
|
|
+ } else {
|
|
|
|
+ totalMoneyCost = totalMoneyCost.add((BigDecimal)map.get("costMoney"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ resultMap.put("costList", list);
|
|
|
|
+ resultMap.put("totalMoneyCost", totalMoneyCost);
|
|
|
|
+
|
|
|
|
+ httpRespMsg.data = resultMap;
|
|
|
|
+ } catch (NullPointerException e) {
|
|
|
|
+ //httpRespMsg.setError("验证失败");
|
|
|
|
+ httpRespMsg.setError(MessageUtils.message("access.verificationError"));
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg exportTimeCostByWorkNum(String startDate, String endDate, HttpServletRequest request) {
|
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
|
+ User user = userMapper.selectById(request.getHeader("token"));
|
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
|
+ CompanyDingding dingding = companyDingdingMapper.selectOne(new QueryWrapper<CompanyDingding>().eq("company_id", user.getCompanyId()));
|
|
|
|
+ HttpRespMsg msg = getTimeCostByWorkNum(startDate, endDate, request);
|
|
|
|
+ Map<String, Object> data = (Map<String, Object>) (Map<String, Object>) msg.data;
|
|
|
|
+ List<Map<String, Object>> resultList = (List<Map<String, Object>>) data.get("costList");
|
|
|
|
+
|
|
|
|
+ List<List<String>> dataList=new ArrayList<>();
|
|
|
|
+ List<String> titleList=new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ titleList.add("序号");
|
|
|
|
+ titleList.add("工单号");
|
|
|
|
+ titleList.add("工时");
|
|
|
|
+ titleList.add("工时成本");
|
|
|
|
+ dataList.add(titleList);
|
|
|
|
+ for (int i = 0; i < resultList.size(); i++) {
|
|
|
|
+ List<String> strList=new ArrayList<>();
|
|
|
|
+ strList.add(String.valueOf(i+1));
|
|
|
|
+ Map<String, Object> stringObjectMap = resultList.get(i);
|
|
|
|
+ strList.add((String) stringObjectMap.get("workNum"));
|
|
|
|
+ String costStr = String.format("%.2f", (Double)stringObjectMap.get("cost"));
|
|
|
|
+ BigDecimal costMoney = (BigDecimal) stringObjectMap.get("costMoney");
|
|
|
|
+ String costMoneyStr = costMoney.setScale(2, RoundingMode.HALF_UP).toString();
|
|
|
|
+
|
|
|
|
+ strList.add(costStr);
|
|
|
|
+ strList.add(costMoneyStr);
|
|
|
|
+ dataList.add(strList);
|
|
|
|
+ }
|
|
|
|
+ String fileName = "工单工时成本统计表"+System.currentTimeMillis();
|
|
|
|
+ try {
|
|
|
|
+ return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,dingding,fileName, dataList, path);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ httpRespMsg.data = pathPrefix + fileName+".xlsx";
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
//导出FTE报表数据
|
|
//导出FTE报表数据
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg exportFTEData(String monthStart,String monthEnd, String area,Integer departmentId,HttpServletRequest request) {
|
|
public HttpRespMsg exportFTEData(String monthStart,String monthEnd, String area,Integer departmentId,HttpServletRequest request) {
|