|
@@ -38,8 +38,11 @@ import org.assertj.core.util.Lists;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Isolation;
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -76,6 +79,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
@Resource
|
|
|
private HttpServletRequest request;
|
|
|
@Resource
|
|
|
+ ExcelExportService excelExportService;
|
|
|
+ @Resource
|
|
|
private ProjectNotifyUserService projectNotifyUserService;
|
|
|
@Resource
|
|
|
private GroupParticipatorMapper groupParticipatorMapper;
|
|
@@ -185,6 +190,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
TaskGroupService taskGroupService;
|
|
|
@Resource
|
|
|
GroupTemplateMapper GroupTemplateMapper;
|
|
|
+ @Resource
|
|
|
+ WxCorpInfoMapper wxCorpInfoMapper;
|
|
|
|
|
|
@Resource
|
|
|
private HttpServletResponse response;
|
|
@@ -1107,6 +1114,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
try {
|
|
|
User targetUser = userMapper.selectById(request.getHeader("Token"));
|
|
|
Integer companyId =targetUser.getCompanyId();
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
//当前用户管理部门
|
|
|
List<Integer> deptIds=null;
|
|
@@ -1325,13 +1333,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//生成excel文件导出
|
|
|
//String fileName = "项目成本工时统计_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.projectCost")+System.currentTimeMillis();
|
|
|
- String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , allList, path);
|
|
|
- httpRespMsg.data = resp;
|
|
|
+ return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , allList, path);
|
|
|
} catch (NullPointerException e) {
|
|
|
e.printStackTrace();
|
|
|
//httpRespMsg.setError("验证失败");
|
|
|
httpRespMsg.setError(MessageUtils.message("access.verificationError"));
|
|
|
return httpRespMsg;
|
|
|
+ } catch (Exception exception) {
|
|
|
+ exception.printStackTrace();
|
|
|
+ httpRespMsg.setError(exception.getMessage());
|
|
|
}
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -1667,6 +1677,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//通过公司id获取该公司所有的项目列表
|
|
|
User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
Integer companyId = user.getCompanyId();
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
//判断用户的角色,如果是管理员和负责人,查看全部的。如果是普通员工,只能是看到参与的项目
|
|
|
QueryWrapper<Project> queryWrapper = new QueryWrapper<Project>().eq("company_id", companyId);
|
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
@@ -1701,7 +1712,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
//String fileName = "项目报表_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.projectReport")+System.currentTimeMillis();
|
|
|
- ExcelUtil.exportGeneralExcelByTitleAndList(fileName, exportList, path);
|
|
|
+ ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName, exportList, path);
|
|
|
httpRespMsg.data = pathPrefix + fileName+".xls";
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -1744,7 +1755,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
|
|
|
User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
Integer companyId = user.getCompanyId();
|
|
|
-
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
QueryWrapper<Project> queryWrapper = new QueryWrapper<Project>().eq("company_id", companyId);
|
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
List<Project> projectAllList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
|
|
@@ -1789,7 +1800,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
//String fileName = "项目任务报表_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.projectTaskReport")+System.currentTimeMillis();
|
|
|
- ExcelUtil.exportGeneralExcelByTitleAndList(fileName, exportList, path);
|
|
|
+ ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName, exportList, path);
|
|
|
httpRespMsg.data = pathPrefix + fileName+".xls";
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -1839,6 +1850,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//通过公司id获取该公司所有的项目列表
|
|
|
User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
Integer companyId = user.getCompanyId();
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
List<Project> projectAllList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
|
|
|
List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "全部项目任务报表");
|
|
|
List<SysRichFunction> functionInchargeList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "负责项目任务报表");
|
|
@@ -1876,7 +1888,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
//String fileName = "项目成本报表_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.projectCostReport")+System.currentTimeMillis();
|
|
|
- ExcelUtil.exportGeneralExcelByTitleAndList(fileName, exportList, path);
|
|
|
+ ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName, exportList, path);
|
|
|
httpRespMsg.data = pathPrefix + fileName+".xls";
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -1945,6 +1957,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//通过公司id获取该公司所有的项目列表
|
|
|
User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
Integer companyId = user.getCompanyId();
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
List<Project> projectAllList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
|
|
|
List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "全部项目任务报表");
|
|
|
List<SysRichFunction> functionInchargeList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "负责项目任务报表");
|
|
@@ -1992,7 +2005,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
//String fileName = "项目收支平衡报表(利润表)_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.profitSta")+System.currentTimeMillis();
|
|
|
- ExcelUtil.exportGeneralExcelByTitleAndList(fileName, exportList, path);
|
|
|
+ ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName, exportList, path);
|
|
|
httpRespMsg.data = pathPrefix + fileName+".xls";
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -2003,7 +2016,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//通过公司id获取该公司所有的项目列表
|
|
|
User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
Integer companyId = user.getCompanyId();
|
|
|
-
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
List<CustomerProject> projectList = projectMapper.getCustomerProjectInAndOut(companyId, null, null,null,null);
|
|
|
List<List<String>> exportList = new ArrayList<>();
|
|
|
//String[] titles = {"客户名称", "相关项目", "合同金额", "人工成本", "一般费用", "差旅费用","外包费用", "总费用", "利润", "利润率"};
|
|
@@ -2061,7 +2074,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
//String fileName = "客户项目利润报表_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.cusPro")+System.currentTimeMillis();
|
|
|
- ExcelUtil.exportGeneralExcelByTitleAndList(fileName, exportList, path);
|
|
|
+ ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName, exportList, path);
|
|
|
httpRespMsg.data = pathPrefix + fileName+".xls";
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -2521,6 +2534,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
User user = userMapper.selectById(token);
|
|
|
Integer companyId = user.getCompanyId();
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
|
|
|
List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "全部项目任务报表");
|
|
@@ -2587,7 +2601,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
//String fileName = "项目阶段工时报表_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.ProPeriodWork")+System.currentTimeMillis();
|
|
|
- ExcelUtil.exportGeneralExcelByTitleAndList(fileName, dataList, path);
|
|
|
+ ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName, dataList, path);
|
|
|
httpRespMsg.data = pathPrefix + fileName+".xls";
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -3018,6 +3032,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
project.setCreatorId(userId);
|
|
|
project.setCreatorName(user.getName());
|
|
|
project.setProjectName(name);
|
|
|
+ project.setCreateDate(LocalDate.now());
|
|
|
|
|
|
//处理人员
|
|
|
if (inchargerCell != null) {
|
|
@@ -3452,6 +3467,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
project.setCreatorId(userId);
|
|
|
project.setCreatorName(user.getName());
|
|
|
project.setProjectName(name);
|
|
|
+ project.setCreateDate(LocalDate.now());
|
|
|
|
|
|
//处理人员
|
|
|
if (inchargerCell != null) {
|
|
@@ -4142,7 +4158,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg exportData(HttpServletRequest request) {
|
|
|
+ public HttpRespMsg exportData(String keyword,
|
|
|
+ @RequestParam(required = false, defaultValue = "1") Integer searchField,
|
|
|
+ Integer projectId, //可以直接传projectId来进行匹配
|
|
|
+ Integer status, Integer category,Integer projectMainId,Integer deptId,String inchagerId,String participation,HttpServletRequest request) {
|
|
|
String token = request.getHeader("TOKEN");
|
|
|
User user = userMapper.selectById(token);
|
|
|
List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
|
|
@@ -4152,12 +4171,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//无全部项目权限,只能导出自己相关的(创建或参与)
|
|
|
userId = user.getId();
|
|
|
}
|
|
|
- HttpRespMsg projectPage = getProjectPage(null, null, null, null, null, null, null, null,null, null, null,null,null, request);
|
|
|
+ HttpRespMsg projectPage = getProjectPage(null, null, keyword, searchField, status, category, projectId, projectMainId,deptId, null, null,inchagerId,participation, request);
|
|
|
List<ProjectKeyNodesSetting> projectKeyNodesSettingList = projectKeyNodesSettingMapper.selectList(new QueryWrapper<ProjectKeyNodesSetting>().eq("company_id", user.getCompanyId()));
|
|
|
Map<String,Object> resultMap= (Map<String, Object>) projectPage.data;
|
|
|
List<ProjectVO> projectVOList= (List<ProjectVO>) resultMap.get("records");
|
|
|
List<String> nameList= (List<String>) resultMap.get("nameList");
|
|
|
Company company = companyMapper.selectById(user.getCompanyId());
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", company.getId()));
|
|
|
List<String> headList = new ArrayList<String>();
|
|
|
// headList.add("项目编号");
|
|
|
// headList.add("项目分类");
|
|
@@ -4335,8 +4355,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
rowData.add("");
|
|
|
rowData.add("");
|
|
|
}
|
|
|
- Integer status = projectVO.getStatus();
|
|
|
- switch (status){
|
|
|
+ Integer state = projectVO.getStatus();
|
|
|
+ switch (state){
|
|
|
//case 0:rowData.add("全部");
|
|
|
case 0:rowData.add(MessageUtils.message("excel.whole"));
|
|
|
break;
|
|
@@ -4373,7 +4393,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//生成excel文件导出
|
|
|
//String fileName = "项目导出_"+company.getCompanyName()+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.proExport")+company.getCompanyName()+System.currentTimeMillis();
|
|
|
- String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , allList, path);
|
|
|
+ String resp = ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName,allList,path);
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
httpRespMsg.data = resp;
|
|
|
|
|
@@ -4384,6 +4404,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
public HttpRespMsg exportGroupData(HttpServletRequest request) {
|
|
|
String token = request.getHeader("TOKEN");
|
|
|
User user = userMapper.selectById(token);
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
List<HashMap<String, Object>> list = projectMapper.getExportGroupData(user.getCompanyId());
|
|
|
List<List<String>> allList = new ArrayList<>();
|
|
|
List<String> headList = new ArrayList<String>();
|
|
@@ -4409,7 +4430,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
//String fileName = "项目分组_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.proGroup")+System.currentTimeMillis();
|
|
|
- String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , allList, path);
|
|
|
+ String resp = ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , allList, path);
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
httpRespMsg.data = resp;
|
|
|
return httpRespMsg;
|
|
@@ -4452,6 +4473,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
try {
|
|
|
Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
|
List<String> headList = new ArrayList<String>();
|
|
|
// headList.add("序号");
|
|
@@ -4530,7 +4552,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//生成excel文件导出
|
|
|
//String fileName = timeType.getCustomDataName() + "统计_"+System.currentTimeMillis();
|
|
|
String fileName = timeType.getCustomDataName() + MessageUtils.message("Statistics.tj")+"_"+System.currentTimeMillis();
|
|
|
- String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , allList, path);
|
|
|
+ String resp = ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , allList, path);
|
|
|
|
|
|
httpRespMsg.data = resp;
|
|
|
} catch (NullPointerException e) {
|
|
@@ -4822,7 +4844,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//通过公司id获取该公司所有的项目列表
|
|
|
User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
Integer companyId = user.getCompanyId();
|
|
|
-
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
List<HashMap> projectList = projectMapper.getBaseCostAndRealCost(companyId, null, null, null);
|
|
|
List<List<String>> exportList = new ArrayList<>();
|
|
|
//String[] titles = {"项目编号", "项目名称", "当前总预算","当前剩余预算","总剩余预算","已发生总工时成本"};
|
|
@@ -4915,7 +4937,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
//String fileName = "工时成本预警表_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.hourCostAlert")+System.currentTimeMillis();
|
|
|
- ExcelUtil.exportGeneralExcelByTitleAndList(fileName, exportList, path);
|
|
|
+ ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName, exportList, path);
|
|
|
httpRespMsg.data = pathPrefix + fileName+".xls";
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -5183,6 +5205,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//根据系统配置的员工成本计算方式,按固定时薪还是固定月薪,分情况计算。
|
|
|
User targetUser = userMapper.selectById(request.getHeader("Token"));
|
|
|
Integer companyId =targetUser.getCompanyId();
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
//当前用户管理部门
|
|
|
List<Integer> deptIds=null;
|
|
@@ -5328,7 +5351,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//生成excel文件导出
|
|
|
//String fileName = "项目分类工时成本统计_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.proClassLaborCost")+System.currentTimeMillis();
|
|
|
- String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , allList, path);
|
|
|
+ String resp = ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , allList, path);
|
|
|
httpRespMsg.data = resp;
|
|
|
} catch (NullPointerException e) {
|
|
|
e.printStackTrace();
|
|
@@ -5394,6 +5417,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
String token = request.getHeader("TOKEN");
|
|
|
User user = userMapper.selectById(token);
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "全公司工时分配");
|
|
|
List<SysRichFunction> functionDeptList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "负责部门工时分配");
|
|
|
List<Integer> deptIds=null;
|
|
@@ -5437,7 +5461,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//生成excel文件导出
|
|
|
//String fileName = "人员工时分配统计_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.perHoursAllSta")+System.currentTimeMillis();
|
|
|
- String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , dataList, path);
|
|
|
+ String resp = ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , dataList, path);
|
|
|
msg.data = resp;
|
|
|
return msg;
|
|
|
}
|
|
@@ -5604,7 +5628,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
BigDecimal divide;
|
|
|
if(days!=0){
|
|
|
divide = bigDecimal.divide(BigDecimal.valueOf(days), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
- }else if(days==0&&num!=0){
|
|
|
+ }else if(days==0){
|
|
|
divide=new BigDecimal(1);
|
|
|
//查看当天有请假直接算100%
|
|
|
}else if (days==0&&num!=0&&leaveSheetList.size()>0){
|
|
@@ -5624,7 +5648,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
BigDecimal divide;
|
|
|
if(days!=0){
|
|
|
divide = bigDecimal.divide(BigDecimal.valueOf(days), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
- }else if(days==0&&num!=0){
|
|
|
+ }else if(days==0){
|
|
|
divide=new BigDecimal(1);
|
|
|
//查看当天有请假直接算100%
|
|
|
}else if (days==0&&num!=0&&leaveSheetList.size()>0){
|
|
@@ -5654,6 +5678,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
@Override
|
|
|
public HttpRespMsg exportReportTimelinessRate(HttpServletRequest request, String startDate, String endDate) {
|
|
|
HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
HttpRespMsg msg = getUserReportTimelinessRate(request, startDate, endDate, null, null, null, null);
|
|
|
HashMap map= (HashMap) msg.data;
|
|
|
List<TimelinessRateVO> list = (List<TimelinessRateVO>) map.get("list");
|
|
@@ -5673,7 +5699,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//生成excel文件导出
|
|
|
//String fileName = "人员填报及时率统计_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.timePerFill")+System.currentTimeMillis();
|
|
|
- String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , dataList, path);
|
|
|
+ String resp = ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , dataList, path);
|
|
|
httpRespMsg.data = resp;
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -5718,6 +5744,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
@Override
|
|
|
public HttpRespMsg exportWaitingReviewList(HttpServletRequest request, Integer stateKey, String userId,String startDate,String endDate) {
|
|
|
HttpRespMsg msg = getWaitingReviewList(request, stateKey, userId, null, null,startDate,endDate,null);
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
HashMap resultmap= (HashMap) msg.data;
|
|
|
List<Map<String,Object>> list= (List<Map<String, Object>>) resultmap.get("result");
|
|
|
List<List<String>> dataList=new ArrayList<>();
|
|
@@ -5733,7 +5761,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//生成excel文件导出
|
|
|
//String fileName = "人员待审核统计_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.perReviewed")+System.currentTimeMillis();
|
|
|
- String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , dataList, path);
|
|
|
+ String resp = ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , dataList, path);
|
|
|
msg.data = resp;
|
|
|
return msg;
|
|
|
}
|
|
@@ -5849,6 +5877,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
@Override
|
|
|
public HttpRespMsg exportUserWorkingTimeStatic(String startDate, String endDate, HttpServletRequest request, String userId, Integer departmentId) {
|
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
HttpRespMsg httpRespMsg = getUserWorkingTimeStatic(startDate, endDate, null, null, request, userId, departmentId);
|
|
|
Map<String,Object> data = (Map<String, Object>) httpRespMsg.data;
|
|
|
List<Map<String,Object>> resultList= (List<Map<String, Object>>) data.get("result");
|
|
@@ -5880,7 +5910,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//生成excel文件导出
|
|
|
//String fileName = "人员工时统计_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("fileName.perHoursSta")+System.currentTimeMillis();
|
|
|
- String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , dataList, path);
|
|
|
+ String resp = ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , dataList, path);
|
|
|
msg.data = resp;
|
|
|
return msg;
|
|
|
}
|
|
@@ -6293,6 +6323,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
public HttpRespMsg exportProjectBaseCost(HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
HttpRespMsg projectBaseCost = getProjectBaseCost(null, request, null, null);
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
HashMap map= (HashMap) projectBaseCost.data;
|
|
|
List<Project> resultProjectList= (List<Project>) map.get("result");
|
|
|
List<List<String>> dataList=new ArrayList<>();
|
|
@@ -6323,7 +6355,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//生成excel文件导出
|
|
|
//String fileName = "项目成本基线表_"+System.currentTimeMillis();
|
|
|
String fileName = MessageUtils.message("Statistics.ProjectCostBase")+System.currentTimeMillis();
|
|
|
- String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , dataList, path);
|
|
|
+ String resp = ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , dataList, path);
|
|
|
httpRespMsg.data = resp;
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -6392,6 +6424,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
public HttpRespMsg exportTimeCostByUserCustom(String startDate, String endDate, String subCustomName, Integer customId, HttpServletRequest request, String fieldName) {
|
|
|
HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
User targetUser = userMapper.selectById(request.getHeader("token"));
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", targetUser.getCompanyId()));
|
|
|
List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
|
|
|
List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
|
|
|
HttpRespMsg msg = getTimeCostByUserCustom(startDate, endDate, null, customId, request, fieldName);
|
|
@@ -6424,7 +6457,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//生成excel文件导出
|
|
|
//String fileName = userCustom.getName()+"工时成本统计_"+System.currentTimeMillis();
|
|
|
String fileName = userCustom.getName()+MessageUtils.message("fileName.hourCost")+System.currentTimeMillis();
|
|
|
- String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , dataList, path);
|
|
|
+ String resp = ExcelUtil.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , dataList, path);
|
|
|
httpRespMsg.data = resp;
|
|
|
|
|
|
return httpRespMsg;
|
|
@@ -6754,7 +6787,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
msg.setError(MessageUtils.message("other.tokenOverdue"));
|
|
|
return msg;
|
|
|
}
|
|
|
+ TimeType timeType = timeTypeMapper.selectById(thirdPartyInterface.getCompanyId());
|
|
|
List<Project> allProject = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", thirdPartyInterface.getCompanyId()));
|
|
|
+ List<ProjectMain> projectMainList = projectMainMapper.selectList(new QueryWrapper<ProjectMain>().eq("company_id", thirdPartyInterface.getCompanyId()));
|
|
|
+ List<ProjectLevel> projectLevelList = projectLevelMapper.selectList(new QueryWrapper<ProjectLevel>().eq("company_id", thirdPartyInterface.getCompanyId()));
|
|
|
+ List<ProjectStage> projectStageList = projectStageMapper.selectList(new QueryWrapper<ProjectStage>().eq("company_id", thirdPartyInterface.getCompanyId()));
|
|
|
+ List<ProjectCategory> projectCategoryList = projectCategoryMapper.selectList(new QueryWrapper<ProjectCategory>().eq("company_id", thirdPartyInterface.getCompanyId()));
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", thirdPartyInterface.getCompanyId()));
|
|
|
String message="";
|
|
|
List<Project> changeProjectList=new ArrayList<>();
|
|
|
List<Project> inertProjectList=new ArrayList<>();
|
|
@@ -6766,6 +6805,37 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if(first.isPresent()){
|
|
|
continue;
|
|
|
}
|
|
|
+ if(timeType.getMainProjectState()==1){
|
|
|
+ Optional<ProjectMain> mainOptional = projectMainList.stream().filter(pm -> pm.getName().equals(project.getProjectMainName())).findFirst();
|
|
|
+ if(mainOptional.isPresent()){
|
|
|
+ project.setProjectMainId(mainOptional.get().getId());
|
|
|
+ project.setCategoryName(mainOptional.get().getCategoryName());
|
|
|
+ project.setCategory(mainOptional.get().getCategoryId());
|
|
|
+ }else project.setProjectMainName(null);
|
|
|
+ }else {
|
|
|
+ Optional<ProjectCategory> category = projectCategoryList.stream().filter(pc -> pc.getName().equals(project.getCategoryName())).findFirst();
|
|
|
+ if(category.isPresent()){
|
|
|
+ project.setProjectMainId(null);
|
|
|
+ project.setProjectMainName(null);
|
|
|
+ project.setCategoryName(category.get().getName());
|
|
|
+ project.setCategory(category.get().getId());
|
|
|
+ }else project.setCategoryName(null);
|
|
|
+ }
|
|
|
+ if(timeType.getProjectLevelState()==1){
|
|
|
+ Optional<ProjectLevel> level = projectLevelList.stream().filter(pl -> pl.getProjectLevelName().equals(project.getLevelString())).findFirst();
|
|
|
+ if(level.isPresent()){
|
|
|
+ project.setLevel(level.get().getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Optional<User> user = userList.stream().filter(ul -> ul.getJobNumber()!=null&&ul.getJobNumber().equals(project.getInchargerId())).findFirst();
|
|
|
+ if(user.isPresent()){
|
|
|
+ project.setInchargerId(user.get().getId());
|
|
|
+ project.setInchargerName(user.get().getName());
|
|
|
+ }
|
|
|
+ Optional<ProjectStage> stage = projectStageList.stream().filter(ps -> ps.getProjectStageName().equals(project.getCurrentStageName())).findFirst();
|
|
|
+ if(stage.isPresent()){
|
|
|
+ project.setCurrentStageId(stage.get().getId());
|
|
|
+ }else project.setCurrentStageName(null);
|
|
|
project.setCompanyId(thirdPartyInterface.getCompanyId());
|
|
|
inertProjectList.add(project);
|
|
|
}
|
|
@@ -6773,6 +6843,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//message+="成功添加"+inertProjectList.size()+"条项目数据";
|
|
|
message+=MessageUtils.message("project.upDataSuc",inertProjectList.size());
|
|
|
}
|
|
|
+ List<Integer> idList = inertProjectList.stream().map(Project::getId).collect(Collectors.toList());
|
|
|
+ idList.add(-1);
|
|
|
+ List<ProjectSeparate> projectSeparateList = projectSeparateMapper.selectList(new QueryWrapper<ProjectSeparate>().in("id", idList));
|
|
|
for (Project project : inertProjectList) {
|
|
|
List<TaskGroup> taskGroupList = project.getTaskGroupList();
|
|
|
if(taskGroupList!=null){
|
|
@@ -6780,16 +6853,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
taskGroupService.saveBatch(taskGroupList);
|
|
|
}
|
|
|
ProjectSeparate projectSeparate = project.getProjectSeparate();
|
|
|
- if(projectSeparate!=null){
|
|
|
- projectSeparate.setId(project.getId());
|
|
|
- projectSeparateService.save(projectSeparate);
|
|
|
- }
|
|
|
+ projectSeparate.setId(project.getId());
|
|
|
+ projectSeparateService.saveOrUpdate(projectSeparate);
|
|
|
}
|
|
|
}
|
|
|
}else if(changeType.equals("update_project")){
|
|
|
if(projectList!=null &&projectList.size()>0){
|
|
|
for (Project project : projectList) {
|
|
|
Optional<Project> first = allProject.stream().filter(ap ->ap.getProjectCode()!=null&& ap.getProjectCode().equals(project.getProjectCode())).findFirst();
|
|
|
+ Optional<User> user = userList.stream().filter(ul ->ul.getJobNumber()!=null&&ul.getJobNumber().equals(project.getInchargerId())).findFirst();
|
|
|
+ if(user.isPresent()){
|
|
|
+ project.setInchargerId(user.get().getId());
|
|
|
+ project.setInchargerName(user.get().getName());
|
|
|
+ }
|
|
|
if(first.isPresent()){
|
|
|
project.setId(first.get().getId());
|
|
|
project.setCompanyId(thirdPartyInterface.getCompanyId());
|
|
@@ -6803,7 +6879,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<Integer> idList = changeProjectList.stream().map(Project::getId).collect(Collectors.toList());
|
|
|
idList.add(-1);
|
|
|
List<TaskGroup> groupList = taskGroupMapper.selectList(new QueryWrapper<TaskGroup>().in("project_id", idList));
|
|
|
- List<ProjectSeparate> projectSeparateList = projectSeparateMapper.selectList(new QueryWrapper<ProjectSeparate>().in("project_id", idList));
|
|
|
+ List<ProjectSeparate> projectSeparateList = projectSeparateMapper.selectList(new QueryWrapper<ProjectSeparate>().in("id", idList));
|
|
|
for (Project project : changeProjectList) {
|
|
|
List<TaskGroup> taskGroupList = project.getTaskGroupList();
|
|
|
if(taskGroupList!=null){
|
|
@@ -6819,10 +6895,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
taskGroupService.saveOrUpdateBatch(taskGroupList);
|
|
|
}
|
|
|
ProjectSeparate projectSeparate = project.getProjectSeparate();
|
|
|
- Optional<ProjectSeparate> first = projectSeparateList.stream().filter(pl -> pl.getId().equals(project.getId())).findFirst();
|
|
|
- if(first.isPresent()) {
|
|
|
- projectSeparate.setId(first.get().getId());
|
|
|
- }
|
|
|
+ projectSeparate.setId(project.getId());
|
|
|
+ projectSeparateService.saveOrUpdate(projectSeparate);
|
|
|
projectSeparateService.saveOrUpdate(projectSeparate);
|
|
|
}
|
|
|
}
|
|
@@ -6846,6 +6920,18 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg testRead(String jobId) {
|
|
|
+ excelExportService.testRead(jobId);
|
|
|
+ return new HttpRespMsg();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg testAdd(String jobId) {
|
|
|
+ excelExportService.testAdd(jobId);
|
|
|
+ return new HttpRespMsg();
|
|
|
+ }
|
|
|
+
|
|
|
public static void main(String[] args) {
|
|
|
Map params = new HashMap<>();
|
|
|
Map paramDataJson = new HashMap<>();
|