|
@@ -2649,10 +2649,123 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
|
|
|
htinfo.setField3(htnum3);
|
|
|
htinfo.setField4(htnum4);
|
|
|
reportFormList4.add(htinfo);
|
|
|
+
|
|
|
+ //公司级:年部项目报表总览
|
|
|
+ //type:类型(1:项目;2:开票;3:报销;4:合同)
|
|
|
+ statementCompanyComprehensiveInfo.setType("1");
|
|
|
+ statementCompanyComprehensiveInfo.setBigDateType("0");
|
|
|
+ List<StatementCompanyComprehensiveInfo> reportFormList5 = dao.selectAllByOfficeIdByYear(statementCompanyComprehensiveInfo);
|
|
|
+ //项目表 各列合计
|
|
|
+ String xmYearNum1 = "0";
|
|
|
+ String xmYearNum2 = "0";
|
|
|
+ String xmYearNum3 = "0";
|
|
|
+ String xmYearNum4 = "0";
|
|
|
+ String xmYearNum5 = "0";
|
|
|
+ String xmYearNum6 = "0";
|
|
|
+ String xmYearNum7 = "0";
|
|
|
+ String xmYearNum8 = "0";
|
|
|
+ for(StatementCompanyComprehensiveInfo info:reportFormList5){
|
|
|
+ //转BigDecimal 处理 合计
|
|
|
+ xmYearNum1 = new BigDecimal(info.getField1()).add(new BigDecimal(xmYearNum1)).toString();
|
|
|
+ xmYearNum2 = new BigDecimal(info.getField2()).add(new BigDecimal(xmYearNum2)).toString();
|
|
|
+ xmYearNum3 = new BigDecimal(info.getField3()).add(new BigDecimal(xmYearNum3)).toString();
|
|
|
+ xmYearNum4 = new BigDecimal(info.getField4()).add(new BigDecimal(xmYearNum4)).toString();
|
|
|
+ xmYearNum5 = new BigDecimal(info.getField5()).add(new BigDecimal(xmYearNum5)).toString();
|
|
|
+ xmYearNum6 = new BigDecimal(info.getField6()).add(new BigDecimal(xmYearNum6)).toString();
|
|
|
+ xmYearNum7 = new BigDecimal(info.getField7()).add(new BigDecimal(xmYearNum7)).toString();
|
|
|
+ xmYearNum8 = new BigDecimal(info.getField8()).add(new BigDecimal(xmYearNum8)).toString();
|
|
|
+ }
|
|
|
+ //存放到对应报表的list集合,方便页面集合展示
|
|
|
+ StatementCompanyComprehensiveInfo xmInfoYear = new StatementCompanyComprehensiveInfo();
|
|
|
+ xmInfoYear.setOfficeName("本年合计");
|
|
|
+ xmInfoYear.setField1(xmYearNum1);
|
|
|
+ xmInfoYear.setField2(xmYearNum2);
|
|
|
+ xmInfoYear.setField3(xmYearNum3);
|
|
|
+ xmInfoYear.setField4(xmYearNum4);
|
|
|
+ xmInfoYear.setField5(xmYearNum5);
|
|
|
+ xmInfoYear.setField6(xmYearNum6);
|
|
|
+ xmInfoYear.setField7(xmYearNum7);
|
|
|
+ xmInfoYear.setField8(xmYearNum8);
|
|
|
+ reportFormList5.add(xmInfoYear);
|
|
|
+
|
|
|
+ //部门级:开票报表
|
|
|
+ //类型(1:项目;2:开票;3:报销;4:合同)
|
|
|
+ statementCompanyComprehensiveInfo.setType("2");
|
|
|
+ List<StatementCompanyComprehensiveInfo> reportFormList6 = dao.selectAllByOfficeIdByYear(statementCompanyComprehensiveInfo);
|
|
|
+ //各列合计
|
|
|
+ String kpYearNum1 = "0";
|
|
|
+ String kpYearNum2 = "0";
|
|
|
+ String kpYearNum3 = "0";
|
|
|
+ String kpYearNum4 = "0";
|
|
|
+ for(StatementCompanyComprehensiveInfo info:reportFormList6){
|
|
|
+ //转BigDecimal 处理
|
|
|
+ kpYearNum1 = new BigDecimal(info.getField1()).add(new BigDecimal(kpYearNum1)).toString();
|
|
|
+ kpYearNum2 = new BigDecimal(info.getField2()).add(new BigDecimal(kpYearNum2)).toString();
|
|
|
+ kpYearNum3 = new BigDecimal(info.getField3()).add(new BigDecimal(kpYearNum3)).toString();
|
|
|
+ kpYearNum4 = new BigDecimal(info.getField4()).add(new BigDecimal(kpYearNum4)).toString();
|
|
|
+ }
|
|
|
+ //存放到对应报表的list集合,方便页面集合展示
|
|
|
+ StatementCompanyComprehensiveInfo kpInfoYear = new StatementCompanyComprehensiveInfo();
|
|
|
+ kpInfoYear.setOfficeName("本年合计");
|
|
|
+ kpInfoYear.setField1(kpYearNum1);
|
|
|
+ kpInfoYear.setField2(kpYearNum2);
|
|
|
+ kpInfoYear.setField3(kpYearNum3);
|
|
|
+ kpInfoYear.setField4(kpYearNum4);
|
|
|
+ reportFormList6.add(kpInfoYear);
|
|
|
+
|
|
|
+ //公司级:报销报表
|
|
|
+ //类型(1:项目;2:开票;3:报销;4:合同)
|
|
|
+ statementCompanyComprehensiveInfo.setType("3");
|
|
|
+ List<StatementCompanyComprehensiveInfo> reportFormList7 = dao.selectAllByOfficeIdByYear(statementCompanyComprehensiveInfo);
|
|
|
+ //合计
|
|
|
+ String bxYearNum1 = "0";
|
|
|
+ String bxYearNum2 = "0";
|
|
|
+ for(StatementCompanyComprehensiveInfo info:reportFormList7){
|
|
|
+ //转BigDecimal 处理
|
|
|
+ bxYearNum1 = new BigDecimal(info.getField1()).add(new BigDecimal(bxYearNum1)).toString();
|
|
|
+ bxYearNum2 = new BigDecimal(info.getField2()).add(new BigDecimal(bxYearNum2)).toString();
|
|
|
+ }
|
|
|
+ //存放到对应报表的list集合,方便页面集合展示
|
|
|
+ StatementCompanyComprehensiveInfo bxInfoYear = new StatementCompanyComprehensiveInfo();
|
|
|
+ bxInfoYear.setOfficeName("本年合计");
|
|
|
+ bxInfoYear.setField1(bxYearNum1);
|
|
|
+ bxInfoYear.setField2(bxYearNum2);
|
|
|
+ reportFormList7.add(bxInfoYear);
|
|
|
+
|
|
|
+ //公司级:合同报表
|
|
|
+ //类型(1:项目;2:开票;3:报销;4:合同)
|
|
|
+ statementCompanyComprehensiveInfo.setType("4");
|
|
|
+ List<StatementCompanyComprehensiveInfo> reportFormList8= dao.selectAllByOfficeIdByYear(statementCompanyComprehensiveInfo);
|
|
|
+ //合计
|
|
|
+ String htYearNum1 = "0";
|
|
|
+ String htYearNum2 = "0";
|
|
|
+ String htYearNum3 = "0";
|
|
|
+ String htYearNum4 = "0";
|
|
|
+ for(StatementCompanyComprehensiveInfo info:reportFormList8){
|
|
|
+ //转BigDecimal 处理
|
|
|
+ htYearNum1 = new BigDecimal(info.getField1()).add(new BigDecimal(htYearNum1)).toString();
|
|
|
+ htYearNum2 = new BigDecimal(info.getField2()).add(new BigDecimal(htYearNum2)).toString();
|
|
|
+ htYearNum3 = new BigDecimal(info.getField3()).add(new BigDecimal(htYearNum3)).toString();
|
|
|
+ htYearNum4 = new BigDecimal(info.getField4()).add(new BigDecimal(htYearNum4)).toString();
|
|
|
+ }
|
|
|
+ //存放到对应报表的list集合,方便页面集合展示
|
|
|
+ StatementCompanyComprehensiveInfo htInfoYear = new StatementCompanyComprehensiveInfo();
|
|
|
+ htInfoYear.setOfficeName("本年合计");
|
|
|
+ htInfoYear.setField1(htYearNum1);
|
|
|
+ htInfoYear.setField2(htYearNum2);
|
|
|
+ htInfoYear.setField3(htYearNum3);
|
|
|
+ htInfoYear.setField4(htYearNum4);
|
|
|
+ reportFormList8.add(htInfoYear);
|
|
|
+
|
|
|
+
|
|
|
map.put("reportFormList1",reportFormList1);
|
|
|
map.put("reportFormList2",reportFormList2);
|
|
|
map.put("reportFormList3",reportFormList3);
|
|
|
map.put("reportFormList4",reportFormList4);
|
|
|
+ map.put("reportFormList5",reportFormList5);
|
|
|
+ map.put("reportFormList6",reportFormList6);
|
|
|
+ map.put("reportFormList7",reportFormList7);
|
|
|
+ map.put("reportFormList8",reportFormList8);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -2717,4 +2830,559 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 部门级信息处理
|
|
|
+ * @param bigDateType 状态1(0:年;1:季度;2:月份)
|
|
|
+ * @param smallDateType 状态2(针对状态1进行精确所在指定季度或者月份)
|
|
|
+ */
|
|
|
+ public void disposeStatementOfficeByYear(Integer year,Integer bigDateType,Integer smallDateType){
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ //获取当前年份
|
|
|
+ if(null == year){
|
|
|
+ year = cal.get(Calendar.YEAR);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, String> dateMap = getDateNew(bigDateType, smallDateType,year);
|
|
|
+ //开始时间
|
|
|
+ String beginDate = dateMap.get("beginDate");
|
|
|
+ //结束时间
|
|
|
+ String endDate = dateMap.get("endDate");
|
|
|
+ String statementDate = dateMap.get("statementDate");
|
|
|
+ //部门级项目处理
|
|
|
+ disposeStatementOfficeProjectByYear(year,beginDate,endDate,statementDate,bigDateType, smallDateType);
|
|
|
+ //查询部门信息
|
|
|
+ List<Office> officeList = dao.getAllOfficeListInfo();
|
|
|
+ //部门级开票处理
|
|
|
+ disposeStatementOfficeInvoiceByYear(year,beginDate,endDate,statementDate,bigDateType, smallDateType,officeList);
|
|
|
+ //部门级报销处理
|
|
|
+ disposeStatementOfficeReimbursementByYear(year,beginDate,endDate,statementDate,bigDateType, smallDateType,officeList);
|
|
|
+ //部门级合同处理
|
|
|
+ disposeStatementOfficeContractByYear(year,beginDate,endDate,statementDate,bigDateType, smallDateType,officeList);
|
|
|
+
|
|
|
+ //创建utilNotifyId参数
|
|
|
+ //参数是由 year、bigDateType、smallDateType参数设定
|
|
|
+ String utilNotifyId = year + "," + bigDateType + "," + smallDateType;
|
|
|
+ //发送通知
|
|
|
+ switch (bigDateType){
|
|
|
+ //年度汇总
|
|
|
+ case 0:
|
|
|
+ officeNotification(statementDate,"年","164",utilNotifyId);
|
|
|
+ break;
|
|
|
+ //季度汇总
|
|
|
+ case 1:
|
|
|
+ //smallDateType 为季度时候
|
|
|
+ officeNotification(statementDate,"季","165",utilNotifyId);
|
|
|
+ break;
|
|
|
+ //月度汇总
|
|
|
+ case 2:
|
|
|
+ //smallDateType 为月度时候
|
|
|
+ officeNotification(statementDate,"月","166",utilNotifyId);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 部门级项目月报/季报/年报汇总方法 年部
|
|
|
+ * @param beginDate 开始时间
|
|
|
+ * @param endDate 结束时间
|
|
|
+ * @param statementDate 报表时间
|
|
|
+ * @param bigDateType 状态1(0:年;1:季度;2:月份)
|
|
|
+ * @param smallDateType 状态2(针对状态1进行精确所在指定季度或者月份)
|
|
|
+ */
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public void disposeStatementOfficeProjectByYear(Integer year,String beginDate,String endDate,String statementDate,Integer bigDateType,Integer smallDateType){
|
|
|
+
|
|
|
+ //查询新增A类项目数量
|
|
|
+ List<ReportDataEntity> field1All = dao.getOfficeInsertProjectCountByGradeAll("2", beginDate, endDate);
|
|
|
+ List<ReportDataEntity> field2All = dao.getOfficeInsertProjectCountByGradeAll( "1", beginDate, endDate);
|
|
|
+ List<ReportDataEntity> field3All = dao.getOfficeProjectCountByRecordAll(beginDate, endDate);
|
|
|
+ List<ReportDataEntity> field4All = dao.getOfficeProjectCountByReportedAll(beginDate, endDate);
|
|
|
+ //超期未归档
|
|
|
+ List<ReportDataEntity> field5All = dao.getOfficeOverDueNotRecordProjectAll();
|
|
|
+ //超期归档
|
|
|
+ List<ReportDataEntity> field6All = dao.getOfficeOverDueRecordProjectAll(beginDate, endDate);
|
|
|
+ //超期未上报
|
|
|
+ List<ReportDataEntity> field7All = dao.getOfficeOverDueNotReportedProjectAll();
|
|
|
+ //超期上报
|
|
|
+ List<ReportDataEntity> field8All = dao.getOfficeOverDueReportedProjectAll(beginDate, endDate);
|
|
|
+ //查询电子归档超期未归档项目数量(分组)
|
|
|
+ Map<String, List<ReportDataEntity>> field5AllMap = officeDataMessageDispose(field5All);
|
|
|
+ //分组
|
|
|
+ Map<String, List<ReportDataEntity>> field6AllMap = officeDataMessageDispose(field6All);
|
|
|
+ //分组
|
|
|
+ Map<String, List<ReportDataEntity>> field7AllMap = officeDataMessageDispose(field7All);
|
|
|
+ //分组
|
|
|
+ Map<String, List<ReportDataEntity>> field8AllMap = officeDataMessageDispose(field8All);
|
|
|
+
|
|
|
+ //查询部门信息
|
|
|
+ List<Office> officeList = dao.getOfficeListInfo();
|
|
|
+ for (Office officeInfo : officeList) {
|
|
|
+ //查询该部门的所有子部门
|
|
|
+ List<Office> childOfficeList = dao.getChildOfficeList(officeInfo.getId());
|
|
|
+ for (Office office : childOfficeList) {
|
|
|
+ //根据部门信息查询部门下的所有员工信息
|
|
|
+ List<User> officeUserList = dao.getUserByOfficeId(office.getId());
|
|
|
+ //遍历成员信息 并查询每个成员的项目信息
|
|
|
+ for (User user : officeUserList) {
|
|
|
+ StatementCompanyComprehensiveInfo comprehensiveInfo = new StatementCompanyComprehensiveInfo();
|
|
|
+ comprehensiveInfo.setType("1");
|
|
|
+ comprehensiveInfo.setYear(String.valueOf(year));
|
|
|
+ comprehensiveInfo.setBigDateType(bigDateType.toString());
|
|
|
+ comprehensiveInfo.setSmallDateType(smallDateType.toString());
|
|
|
+ comprehensiveInfo.setStatementDate(statementDate);
|
|
|
+ comprehensiveInfo.setOfficeId(user.getOffice().getId());
|
|
|
+ comprehensiveInfo.setOfficeParentIds(office.getParentIds());
|
|
|
+ comprehensiveInfo.setUserId(user.getId());
|
|
|
+ //查询新增A类项目数量
|
|
|
+ /*Integer projectCountByA = dao.getOfficeInsertProjectCountByGrade(user.getId(), "2", beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField1(projectCountByA.toString());*/
|
|
|
+ for (ReportDataEntity reportData: field1All) {
|
|
|
+ if(user.getId().equals(reportData.getUserId())){
|
|
|
+ comprehensiveInfo.setField1(String.valueOf(Integer.parseInt(comprehensiveInfo.getField1()) + reportData.getCount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询新增B类项目数量
|
|
|
+ /*Integer projectCountByB = dao.getOfficeInsertProjectCountByGrade(user.getId(), "1", beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField2(projectCountByB.toString());*/
|
|
|
+ for (ReportDataEntity reportData: field2All) {
|
|
|
+ if(user.getId().equals(reportData.getUserId())){
|
|
|
+ comprehensiveInfo.setField2(String.valueOf(Integer.parseInt(comprehensiveInfo.getField2()) + reportData.getCount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询本月电子归档项目数量
|
|
|
+ /*Integer getProjectCountByRecord = dao.getOfficeProjectCountByRecord(user.getId(), beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField3(getProjectCountByRecord.toString());*/
|
|
|
+ for (ReportDataEntity reportData: field3All) {
|
|
|
+ if(user.getId().equals(reportData.getUserId())){
|
|
|
+ comprehensiveInfo.setField3(String.valueOf(Integer.parseInt(comprehensiveInfo.getField3()) + reportData.getCount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询本月上报项目数量
|
|
|
+ /*Integer getProjectCountByReported = dao.getOfficeProjectCountByReported(user.getId(), beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField4(getProjectCountByReported.toString());*/
|
|
|
+ for (ReportDataEntity reportData: field4All) {
|
|
|
+ if(user.getId().equals(reportData.getUserId())){
|
|
|
+ comprehensiveInfo.setField4(String.valueOf(Integer.parseInt(comprehensiveInfo.getField4()) + reportData.getCount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询电子归档超期未归档项目数量(保存到数据库)
|
|
|
+ /*List<String> overDueNotRecordProjectIdList = dao.getOfficeOverDueNotRecordProject(user.getId());
|
|
|
+ comprehensiveInfo.setField5(String.valueOf(overDueNotRecordProjectIdList.size()));*/
|
|
|
+
|
|
|
+ List<ReportDataEntity> field5ListAll = Lists.newArrayList();
|
|
|
+ for (String key : field5AllMap.keySet()) {
|
|
|
+ if(user.getId().equals(key)){
|
|
|
+ List<ReportDataEntity> reportDataEntities = field5AllMap.get(key);
|
|
|
+ field5ListAll.addAll(reportDataEntities);
|
|
|
+ comprehensiveInfo.setField5(String.valueOf(Integer.parseInt(comprehensiveInfo.getField5()) + reportDataEntities.size()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StatementDataInfo> overDueNotRecordProjectList = Lists.newArrayList();
|
|
|
+ for (ReportDataEntity reportDataEntity : field5ListAll) {
|
|
|
+ StatementDataInfo info = new StatementDataInfo();
|
|
|
+ info.setStatementDate(statementDate);
|
|
|
+ info.setGradeType("1");
|
|
|
+ info.setType("1");
|
|
|
+ info.setYear(String.valueOf(year));
|
|
|
+ info.setBigDateType(bigDateType.toString());
|
|
|
+ info.setSmallDateType(smallDateType.toString());
|
|
|
+ info.setOfficeId(user.getOffice().getId());
|
|
|
+ info.setField1(reportDataEntity.getFieldId());
|
|
|
+ info.setUserId(user.getId());
|
|
|
+ info.setOfficeParentIds(office.getParentIds());
|
|
|
+ overDueNotRecordProjectList.add(info);
|
|
|
+ }
|
|
|
+ if(overDueNotRecordProjectList.size()>0){
|
|
|
+ //每次删除之前的数据
|
|
|
+ for (StatementDataInfo statementDataInfo : overDueNotRecordProjectList) {
|
|
|
+ dao.deleteOfficeStatementDataInfoByYear(statementDataInfo);
|
|
|
+ }
|
|
|
+ dao.insertOfficeStatementDataInfoByYear(overDueNotRecordProjectList);
|
|
|
+ }
|
|
|
+ //查询电子归档超期归档项目数量(保存到数据库)
|
|
|
+ /*List<String> overDueRecordProjectIdList = dao.getOfficeOverDueRecordProject(user.getId(), beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField6(String.valueOf(overDueRecordProjectIdList.size()));*/
|
|
|
+ List<ReportDataEntity> field6ListAll = Lists.newArrayList();
|
|
|
+ for (String key : field6AllMap.keySet()) {
|
|
|
+ if(user.getId().equals(key)){
|
|
|
+ List<ReportDataEntity> reportDataEntities = field6AllMap.get(key);
|
|
|
+ field6ListAll.addAll(reportDataEntities);
|
|
|
+ comprehensiveInfo.setField6(String.valueOf(Integer.parseInt(comprehensiveInfo.getField6()) + reportDataEntities.size()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<StatementDataInfo> overDueRecordProjectList = Lists.newArrayList();
|
|
|
+ for (ReportDataEntity reportDataEntity : field6ListAll) {
|
|
|
+ StatementDataInfo info = new StatementDataInfo();
|
|
|
+ info.setStatementDate(statementDate);
|
|
|
+ info.setGradeType("1");
|
|
|
+ info.setType("1");
|
|
|
+ info.setYear(String.valueOf(year));
|
|
|
+ info.setBigDateType(bigDateType.toString());
|
|
|
+ info.setSmallDateType(smallDateType.toString());
|
|
|
+ info.setOfficeId(user.getOffice().getId());
|
|
|
+ info.setField2(reportDataEntity.getFieldId());
|
|
|
+ info.setUserId(user.getId());
|
|
|
+ info.setOfficeParentIds(office.getParentIds());
|
|
|
+ overDueRecordProjectList.add(info);
|
|
|
+ }
|
|
|
+ if(overDueRecordProjectList.size()>0){
|
|
|
+ //每次删除之前的数据
|
|
|
+ for (StatementDataInfo statementDataInfo : overDueRecordProjectList) {
|
|
|
+ dao.deleteOfficeStatementDataInfoByYear(statementDataInfo);
|
|
|
+ }
|
|
|
+ dao.insertOfficeStatementDataInfoByYear(overDueRecordProjectList);
|
|
|
+ }
|
|
|
+ //查询上报超期未上报项目数量(保存到数据库)
|
|
|
+ /*List<String> overDueNotReportedProjectIdList = dao.getOfficeOverDueNotReportedProject(user.getId());
|
|
|
+ comprehensiveInfo.setField7(String.valueOf(overDueNotReportedProjectIdList.size()));*/
|
|
|
+ List<ReportDataEntity> field7ListAll = Lists.newArrayList();
|
|
|
+ for (String key : field7AllMap.keySet()) {
|
|
|
+ if(user.getId().equals(key)){
|
|
|
+ List<ReportDataEntity> reportDataEntities = field7AllMap.get(key);
|
|
|
+ field7ListAll.addAll(reportDataEntities);
|
|
|
+ comprehensiveInfo.setField7(String.valueOf(Integer.parseInt(comprehensiveInfo.getField7()) + reportDataEntities.size()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<StatementDataInfo> overDueNotReportedProjectList = Lists.newArrayList();
|
|
|
+ for (ReportDataEntity reportDataEntity : field7ListAll) {
|
|
|
+ StatementDataInfo info = new StatementDataInfo();
|
|
|
+ info.setStatementDate(statementDate);
|
|
|
+ info.setGradeType("1");
|
|
|
+ info.setType("1");
|
|
|
+ info.setYear(String.valueOf(year));
|
|
|
+ info.setBigDateType(bigDateType.toString());
|
|
|
+ info.setSmallDateType(smallDateType.toString());
|
|
|
+ info.setOfficeId(user.getOffice().getId());
|
|
|
+ info.setField3(reportDataEntity.getFieldId());
|
|
|
+ info.setUserId(user.getId());
|
|
|
+ info.setOfficeParentIds(office.getParentIds());
|
|
|
+ overDueNotReportedProjectList.add(info);
|
|
|
+ }
|
|
|
+ if(overDueNotReportedProjectList.size()>0){
|
|
|
+ //每次删除之前的数据
|
|
|
+ for (StatementDataInfo statementDataInfo : overDueNotReportedProjectList) {
|
|
|
+ dao.deleteOfficeStatementDataInfoByYear(statementDataInfo);
|
|
|
+ }
|
|
|
+ dao.insertOfficeStatementDataInfoByYear(overDueNotReportedProjectList);
|
|
|
+ }
|
|
|
+ //查询上报超期上报项目数量(保存到数据库)
|
|
|
+ /*List<String> overDueReportedProjectIdList = dao.getOfficeOverDueReportedProject(user.getId(), beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField8(String.valueOf(overDueReportedProjectIdList.size()));*/
|
|
|
+ List<ReportDataEntity> field8ListAll = Lists.newArrayList();
|
|
|
+ for (String key : field8AllMap.keySet()) {
|
|
|
+ if(user.getId().equals(key)){
|
|
|
+ List<ReportDataEntity> reportDataEntities = field8AllMap.get(key);
|
|
|
+ field8ListAll.addAll(reportDataEntities);
|
|
|
+ comprehensiveInfo.setField8(String.valueOf(Integer.parseInt(comprehensiveInfo.getField8()) + reportDataEntities.size()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<StatementDataInfo> overDueReportedProjectList = Lists.newArrayList();
|
|
|
+ for (ReportDataEntity reportDataEntity : field8ListAll) {
|
|
|
+ StatementDataInfo info = new StatementDataInfo();
|
|
|
+ info.setStatementDate(statementDate);
|
|
|
+ info.setGradeType("1");
|
|
|
+ info.setType("1");
|
|
|
+ info.setYear(String.valueOf(year));
|
|
|
+ info.setBigDateType(bigDateType.toString());
|
|
|
+ info.setSmallDateType(smallDateType.toString());
|
|
|
+ info.setOfficeId(user.getOffice().getId());
|
|
|
+ info.setField4(reportDataEntity.getFieldId());
|
|
|
+ info.setUserId(user.getId());
|
|
|
+ info.setOfficeParentIds(office.getParentIds());
|
|
|
+ overDueReportedProjectList.add(info);
|
|
|
+ }
|
|
|
+ if(overDueReportedProjectList.size()>0){
|
|
|
+ //每次删除之前的数据
|
|
|
+ for (StatementDataInfo statementDataInfo : overDueReportedProjectList) {
|
|
|
+ dao.deleteOfficeStatementDataInfoByYear(statementDataInfo);
|
|
|
+ }
|
|
|
+ dao.insertOfficeStatementDataInfoByYear(overDueReportedProjectList);
|
|
|
+ }
|
|
|
+ //数据处理并保存到数据库中
|
|
|
+ comprehensiveInfo.preInsert();
|
|
|
+ //每次删除对应条件的数据 比部门多了userId
|
|
|
+ dao.deleteOfficeComprehensiveByYear(comprehensiveInfo);
|
|
|
+ dao.insertOfficeComprehensiveByYear(comprehensiveInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 部门级开票记录月报/季报/年报汇总方法
|
|
|
+ * @param beginDate 开始时间
|
|
|
+ * @param endDate 结束时间
|
|
|
+ * @param statementDate 报表时间
|
|
|
+ * @param bigDateType 状态1(0:年;1:季度;2:月份)
|
|
|
+ * @param smallDateType 状态2(针对状态1进行精确所在指定季度或者月份)
|
|
|
+ * @param officeList 部门信息
|
|
|
+ */
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public void disposeStatementOfficeInvoiceByYear(Integer year,String beginDate,String endDate,String statementDate,Integer bigDateType,Integer smallDateType,List<Office> officeList){
|
|
|
+
|
|
|
+ List<ReportDataEntity> field1All = dao.getInsertOfficeInvoiceCountByOfficeAll(beginDate, endDate);
|
|
|
+ List<ReportDataEntity> field2All = dao.getInsertOfficeInvoiceSumMoneyByOfficeAll(beginDate, endDate);
|
|
|
+ List<ReportDataEntity> field3All = dao.getInsertOfficeInvoiceDetailsCountByOfficeAll(beginDate, endDate);
|
|
|
+ List<ReportDataEntity> field4All = dao.getInsertOfficeInvoiceDetailsSumMoneyByOfficeAll(beginDate, endDate);
|
|
|
+
|
|
|
+ for (Office officeInfo : officeList) {
|
|
|
+ //查询该部门的所有子部门
|
|
|
+ List<Office> childOfficeList = dao.getChildOfficeList(officeInfo.getId());
|
|
|
+ for (Office office : childOfficeList) {
|
|
|
+ //根据部门信息查询部门下的所有员工信息
|
|
|
+ List<User> officeUserList = dao.getUserByOfficeId(office.getId());
|
|
|
+ //遍历成员信息 并查询每个成员的项目信息
|
|
|
+ for (User user : officeUserList) {
|
|
|
+ StatementCompanyComprehensiveInfo comprehensiveInfo = new StatementCompanyComprehensiveInfo();
|
|
|
+ comprehensiveInfo.setType("2");
|
|
|
+ comprehensiveInfo.setYear(String.valueOf(year));
|
|
|
+ comprehensiveInfo.setBigDateType(bigDateType.toString());
|
|
|
+ comprehensiveInfo.setSmallDateType(smallDateType.toString());
|
|
|
+ comprehensiveInfo.setStatementDate(statementDate);
|
|
|
+ comprehensiveInfo.setOfficeId(user.getOffice().getId());
|
|
|
+ comprehensiveInfo.setOfficeParentIds(office.getParentIds());
|
|
|
+ comprehensiveInfo.setUserId(user.getId());
|
|
|
+ //查询新增发票信息
|
|
|
+ /*Integer field1 = dao.getInsertOfficeInvoiceCountByOffice(user.getId(), beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField1(field1.toString());*/
|
|
|
+ for (ReportDataEntity reportData: field1All) {
|
|
|
+ if(user.getId().equals(reportData.getUserId())){
|
|
|
+ comprehensiveInfo.setField1(String.valueOf(Integer.parseInt(comprehensiveInfo.getField1()) + reportData.getCount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询开票金额总额
|
|
|
+ /*String field2 = dao.getInsertOfficeInvoiceSumMoneyByOffice(user.getId(), beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField2(field2);*/
|
|
|
+ for (ReportDataEntity reportData: field2All) {
|
|
|
+ if(user.getId().equals(reportData.getUserId())){
|
|
|
+ comprehensiveInfo.setField2(String.valueOf(new BigDecimal(comprehensiveInfo.getField2()).add(new BigDecimal(reportData.getVariableElement()))));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询本月收款发票
|
|
|
+ /*Integer field3 = dao.getInsertOfficeInvoiceDetailsCountByOffice(user.getId(), beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField3(field3.toString());*/
|
|
|
+ for (ReportDataEntity reportData: field3All) {
|
|
|
+ if(user.getId().equals(reportData.getUserId())){
|
|
|
+ comprehensiveInfo.setField3(String.valueOf(Integer.parseInt(comprehensiveInfo.getField3()) + reportData.getCount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询本月收款
|
|
|
+ /*String field4 = dao.getInsertOfficeInvoiceDetailsSumMoneyByOffice(user.getId(), beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField4(field4);*/
|
|
|
+ for (ReportDataEntity reportData: field4All) {
|
|
|
+ if(user.getId().equals(reportData.getUserId())){
|
|
|
+ comprehensiveInfo.setField4(String.valueOf(new BigDecimal(comprehensiveInfo.getField4()).add(new BigDecimal(reportData.getVariableElement()))));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //对金额数据进行处理和四舍五入
|
|
|
+ if(StringUtils.isNotBlank(comprehensiveInfo.getField2())){
|
|
|
+ BigDecimal b = new BigDecimal(comprehensiveInfo.getField2());
|
|
|
+ comprehensiveInfo.setField2(String.valueOf(b.setScale(2, BigDecimal.ROUND_HALF_UP)));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(comprehensiveInfo.getField4())){
|
|
|
+ BigDecimal b = new BigDecimal(comprehensiveInfo.getField4());
|
|
|
+ comprehensiveInfo.setField4(String.valueOf(b.setScale(2, BigDecimal.ROUND_HALF_UP)));
|
|
|
+ }
|
|
|
+
|
|
|
+ //数据处理并保存到数据库中
|
|
|
+ comprehensiveInfo.preInsert();
|
|
|
+ //每次删除对应条件的数据 比部门多了userId
|
|
|
+ dao.deleteOfficeComprehensiveByYear(comprehensiveInfo);
|
|
|
+ dao.insertOfficeComprehensiveByYear(comprehensiveInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 部门级报销记录月报/季报/年报汇总方法
|
|
|
+ * @param beginDate 开始时间
|
|
|
+ * @param endDate 结束时间
|
|
|
+ */
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public void disposeStatementOfficeReimbursementByYear(Integer year,String beginDate,String endDate,String statementDate,Integer bigDateType,Integer smallDateType,List<Office> officeList){
|
|
|
+
|
|
|
+ List<ReportDataEntity> field1All = dao.getInsertOfficeReimbursementCountByOfficeAll(beginDate, endDate);
|
|
|
+ List<ReportDataEntity> field2All = dao.getInsertOfficeReimbursementSumMoneyByOfficeAll(beginDate, endDate);
|
|
|
+
|
|
|
+ for (Office officeInfo : officeList) {
|
|
|
+ //查询该部门的所有子部门
|
|
|
+ List<Office> childOfficeList = dao.getChildOfficeList(officeInfo.getId());
|
|
|
+ for (Office office : childOfficeList) {
|
|
|
+ //根据部门信息查询部门下的所有员工信息
|
|
|
+ List<User> officeUserList = dao.getUserByOfficeId(office.getId());
|
|
|
+ //遍历成员信息 并查询每个成员的项目信息
|
|
|
+ for (User user : officeUserList) {
|
|
|
+ StatementCompanyComprehensiveInfo comprehensiveInfo = new StatementCompanyComprehensiveInfo();
|
|
|
+ comprehensiveInfo.setType("3");
|
|
|
+ comprehensiveInfo.setYear(String.valueOf(year));
|
|
|
+ comprehensiveInfo.setBigDateType(bigDateType.toString());
|
|
|
+ comprehensiveInfo.setSmallDateType(smallDateType.toString());
|
|
|
+ comprehensiveInfo.setStatementDate(statementDate);
|
|
|
+ comprehensiveInfo.setOfficeId(officeInfo.getId());
|
|
|
+ comprehensiveInfo.setOfficeParentIds(office.getParentIds());
|
|
|
+ comprehensiveInfo.setUserId(user.getId());
|
|
|
+ //查询新增报销信息
|
|
|
+ /*Integer field1 = dao.getInsertOfficeReimbursementCountByOffice(user.getId(), beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField1(field1.toString());*/
|
|
|
+ for (ReportDataEntity reportData: field1All) {
|
|
|
+ if(user.getId().equals(reportData.getUserId())){
|
|
|
+ comprehensiveInfo.setField1(String.valueOf(Integer.parseInt(comprehensiveInfo.getField1()) + reportData.getCount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询报销金额总额
|
|
|
+ /*String field2 = dao.getInsertOfficeReimbursementSumMoneyByOffice(user.getId(), beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField2(field2);*/
|
|
|
+ for (ReportDataEntity reportData: field2All) {
|
|
|
+ if(user.getId().equals(reportData.getUserId())){
|
|
|
+ comprehensiveInfo.setField2(String.valueOf(new BigDecimal(comprehensiveInfo.getField2()).add(new BigDecimal(reportData.getVariableElement()))));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //对金额数据进行处理和四舍五入
|
|
|
+ if(StringUtils.isNotBlank(comprehensiveInfo.getField2())){
|
|
|
+ BigDecimal b = new BigDecimal(comprehensiveInfo.getField2());
|
|
|
+ comprehensiveInfo.setField2(String.valueOf(b.setScale(2, BigDecimal.ROUND_HALF_UP)));
|
|
|
+ }
|
|
|
+ //数据处理并保存到数据库中
|
|
|
+ comprehensiveInfo.preInsert();
|
|
|
+ //每次删除对应条件的数据 比部门多了userId
|
|
|
+ dao.deleteOfficeComprehensiveByYear(comprehensiveInfo);
|
|
|
+ dao.insertOfficeComprehensiveByYear(comprehensiveInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 部门级合同记录月报/季报/年报汇总方法
|
|
|
+ * @param beginDate 开始时间
|
|
|
+ * @param endDate 结束时间
|
|
|
+ */
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public void disposeStatementOfficeContractByYear(Integer year,String beginDate,String endDate,String statementDate,Integer bigDateType,Integer smallDateType,List<Office> officeList){
|
|
|
+
|
|
|
+ List<ReportDataEntity> field1All = dao.getInsertOfficeContractCountByOfficeAll(beginDate, endDate);
|
|
|
+ List<ReportDataEntity> field2All = dao.getInsertOfficeContractRecordCountByOfficeAll(beginDate, endDate);
|
|
|
+ List<ReportDataEntity> field3All = dao.getOfficeOverDueNotContractRecordCountByOfficeAll();
|
|
|
+ List<ReportDataEntity> field4All = dao.getOfficeOverDueContractRecordCountByOfficeAll(beginDate, endDate);
|
|
|
+
|
|
|
+ //查询电子归档超期未归档项目数量(分组)
|
|
|
+ Map<String, List<ReportDataEntity>> field3AllMap = officeDataMessageDispose(field3All);
|
|
|
+ //分组
|
|
|
+ Map<String, List<ReportDataEntity>> field4AllMap = officeDataMessageDispose(field4All);
|
|
|
+
|
|
|
+ for (Office officeInfo : officeList) {//查询该部门的所有子部门
|
|
|
+ List<Office> childOfficeList = dao.getChildOfficeList(officeInfo.getId());
|
|
|
+ for (Office office : childOfficeList) {
|
|
|
+ //根据部门信息查询部门下的所有员工信息
|
|
|
+ List<User> officeUserList = dao.getUserByOfficeId(office.getId());
|
|
|
+ //遍历成员信息 并查询每个成员的项目信息
|
|
|
+ for (User user : officeUserList) {
|
|
|
+ StatementCompanyComprehensiveInfo comprehensiveInfo = new StatementCompanyComprehensiveInfo();
|
|
|
+ comprehensiveInfo.setType("4");
|
|
|
+ comprehensiveInfo.setYear(String.valueOf(year));
|
|
|
+ comprehensiveInfo.setBigDateType(bigDateType.toString());
|
|
|
+ comprehensiveInfo.setSmallDateType(smallDateType.toString());
|
|
|
+ comprehensiveInfo.setStatementDate(statementDate);
|
|
|
+ comprehensiveInfo.setOfficeId(officeInfo.getId());
|
|
|
+ comprehensiveInfo.setOfficeParentIds(office.getParentIds());
|
|
|
+ comprehensiveInfo.setUserId(user.getId());
|
|
|
+ //查询新增合同信息
|
|
|
+ /*Integer field1 = dao.getInsertOfficeContractCountByOffice(user.getId(), beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField1(field1.toString());*/
|
|
|
+ for (ReportDataEntity reportData: field1All) {
|
|
|
+ if(user.getId().equals(reportData.getUserId())){
|
|
|
+ comprehensiveInfo.setField1(String.valueOf(Integer.parseInt(comprehensiveInfo.getField1()) + reportData.getCount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询本月纸质归档合同信息
|
|
|
+ /*Integer field2 = dao.getInsertOfficeContractRecordCountByOffice(user.getId(), beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField2(field2.toString());*/
|
|
|
+ for (ReportDataEntity reportData: field2All) {
|
|
|
+ if(user.getId().equals(reportData.getUserId())){
|
|
|
+ comprehensiveInfo.setField2(String.valueOf(Integer.parseInt(comprehensiveInfo.getField2()) + reportData.getCount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询超期未归档合同信息
|
|
|
+ /*List<String> overDueNotContractIdList = dao.getOfficeOverDueNotContractRecordCountByOffice(user.getId());
|
|
|
+ comprehensiveInfo.setField3(String.valueOf(overDueNotContractIdList.size()));*/
|
|
|
+ List<ReportDataEntity> field3ListAll = Lists.newArrayList();
|
|
|
+ for (String key : field3AllMap.keySet()) {
|
|
|
+ if(user.getId().equals(key)){
|
|
|
+ List<ReportDataEntity> reportDataEntities = field3AllMap.get(key);
|
|
|
+ field3ListAll.addAll(reportDataEntities);
|
|
|
+ comprehensiveInfo.setField3(String.valueOf(Integer.parseInt(comprehensiveInfo.getField3()) + reportDataEntities.size()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<StatementDataInfo> overDueNotContractList = Lists.newArrayList();
|
|
|
+ for (ReportDataEntity reportDataEntity : field3ListAll) {
|
|
|
+ StatementDataInfo info = new StatementDataInfo();
|
|
|
+ info.setStatementDate(statementDate);
|
|
|
+ info.setGradeType("1");
|
|
|
+ info.setType("4");
|
|
|
+ info.setYear(String.valueOf(year));
|
|
|
+ info.setBigDateType(bigDateType.toString());
|
|
|
+ info.setSmallDateType(smallDateType.toString());
|
|
|
+ info.setOfficeId(officeInfo.getId());
|
|
|
+ info.setUserId(user.getId());
|
|
|
+ info.setOfficeParentIds(office.getParentIds());
|
|
|
+ info.setField1(reportDataEntity.getFieldId());
|
|
|
+ overDueNotContractList.add(info);
|
|
|
+ }
|
|
|
+ if(overDueNotContractList.size()>0){
|
|
|
+ //每次删除之前的数据
|
|
|
+ for (StatementDataInfo statementDataInfo : overDueNotContractList) {
|
|
|
+ dao.deleteOfficeStatementDataInfoByYear(statementDataInfo);
|
|
|
+ }
|
|
|
+ dao.insertOfficeStatementDataInfoByYear(overDueNotContractList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询超期归档合同信息
|
|
|
+ /*List<String> overDueContractIdList = dao.getOfficeOverDueContractRecordCountByOffice(user.getId(), beginDate, endDate);
|
|
|
+ comprehensiveInfo.setField4(String.valueOf(overDueContractIdList.size()));*/
|
|
|
+ List<ReportDataEntity> field4ListAll = Lists.newArrayList();
|
|
|
+ for (String key : field4AllMap.keySet()) {
|
|
|
+ if(user.getId().equals(key)){
|
|
|
+ List<ReportDataEntity> reportDataEntities = field4AllMap.get(key);
|
|
|
+ field4ListAll.addAll(reportDataEntities);
|
|
|
+ comprehensiveInfo.setField4(String.valueOf(Integer.parseInt(comprehensiveInfo.getField4()) + reportDataEntities.size()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<StatementDataInfo> overDueContractList = Lists.newArrayList();
|
|
|
+ for (ReportDataEntity reportDataEntity : field4ListAll) {
|
|
|
+ StatementDataInfo info = new StatementDataInfo();
|
|
|
+ info.setStatementDate(statementDate);
|
|
|
+ info.setGradeType("1");
|
|
|
+ info.setType("4");
|
|
|
+ info.setYear(String.valueOf(year));
|
|
|
+ info.setBigDateType(bigDateType.toString());
|
|
|
+ info.setSmallDateType(smallDateType.toString());
|
|
|
+ info.setOfficeId(officeInfo.getId());
|
|
|
+ info.setUserId(user.getId());
|
|
|
+ info.setOfficeParentIds(office.getParentIds());
|
|
|
+ info.setField2(reportDataEntity.getFieldId());
|
|
|
+ overDueContractList.add(info);
|
|
|
+ }
|
|
|
+ if(overDueContractList.size()>0){
|
|
|
+ //每次删除之前的数据
|
|
|
+ for (StatementDataInfo statementDataInfo : overDueContractList) {
|
|
|
+ dao.deleteOfficeStatementDataInfoByYear(statementDataInfo);
|
|
|
+ }
|
|
|
+ dao.insertOfficeStatementDataInfoByYear(overDueContractList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //数据处理并保存到数据库中
|
|
|
+ comprehensiveInfo.preInsert();
|
|
|
+ //每次删除对应条件的数据 比部门多了userId
|
|
|
+ dao.deleteOfficeComprehensiveByYear(comprehensiveInfo);
|
|
|
+ dao.insertOfficeComprehensiveByYear(comprehensiveInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|