|
|
|
@ -275,9 +275,7 @@ public class ServiceApplicationsService { |
|
|
|
* |
|
|
|
*/ |
|
|
|
public ResponseDTO<String> submit(ServiceApplicationsAddForm addForm) { |
|
|
|
if (null == addForm.getApplicationId()){ |
|
|
|
return ResponseDTO.ok(); |
|
|
|
} |
|
|
|
|
|
|
|
if("TIME".equals(addForm.getServiceType())) { |
|
|
|
//当前登录人的ID
|
|
|
|
Long userId = AdminRequestUtil.getRequestUser().getEmployeeId(); |
|
|
|
@ -287,7 +285,6 @@ public class ServiceApplicationsService { |
|
|
|
throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg()+serviceApplicationsEntity.get(0).getUserName()+UserErrorCode.HAS_EXIST1.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
ServiceApplicationsEntity serviceApplications = serviceApplicationsDao.selectById(addForm.getApplicationId()); |
|
|
|
|
|
|
|
// 检查当前用户角色是否为CEO
|
|
|
|
/*RequestUser requestUser = AdminRequestUtil.getRequestUser(); |
|
|
|
@ -304,11 +301,22 @@ public class ServiceApplicationsService { |
|
|
|
serviceApplicationsEntity.setAssociationAuditTime(LocalDateTime.now()); |
|
|
|
} |
|
|
|
}else {*/ |
|
|
|
|
|
|
|
//}
|
|
|
|
if (null == addForm.getApplicationId()){ |
|
|
|
ServiceApplicationsEntity serviceApplications = new ServiceApplicationsEntity(); |
|
|
|
SmartBeanUtil.copyProperties(addForm, serviceApplications); |
|
|
|
serviceApplications.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue()); |
|
|
|
serviceApplications.setReportTime(LocalDateTime.now()); |
|
|
|
serviceApplicationsDao.insert(serviceApplications); |
|
|
|
}else { |
|
|
|
ServiceApplicationsEntity serviceApplications = serviceApplicationsDao.selectById(addForm.getApplicationId()); |
|
|
|
SmartBeanUtil.copyProperties(addForm, serviceApplications); |
|
|
|
serviceApplications.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue()); |
|
|
|
serviceApplications.setReportTime(LocalDateTime.now()); |
|
|
|
//}
|
|
|
|
serviceApplicationsDao.updateById(serviceApplications); |
|
|
|
} |
|
|
|
//serviceApplicationsDao.updateById(serviceApplications);
|
|
|
|
return ResponseDTO.ok(); |
|
|
|
} |
|
|
|
/** |
|
|
|
@ -563,8 +571,8 @@ public class ServiceApplicationsService { |
|
|
|
throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg()+serviceApplicationsEntity.get(0).getUserName()+UserErrorCode.HAS_EXIST1.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
ServiceApplicationsEntity serviceApplicationsEntity = SmartBeanUtil.copy(addForm, ServiceApplicationsEntity.class); |
|
|
|
serviceApplicationsEntity.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue()); |
|
|
|
//ServiceApplicationsEntity serviceApplicationsEntity = SmartBeanUtil.copy(addForm, ServiceApplicationsEntity.class);
|
|
|
|
//serviceApplicationsEntity.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue());
|
|
|
|
//serviceApplicationsEntity.setReportTime(LocalDateTime.now());
|
|
|
|
|
|
|
|
// 检查当前用户角色是否为CEO
|
|
|
|
@ -584,9 +592,17 @@ public class ServiceApplicationsService { |
|
|
|
}*/ |
|
|
|
|
|
|
|
if (null == addForm.getApplicationId()){ |
|
|
|
serviceApplicationsDao.insert(serviceApplicationsEntity); |
|
|
|
ServiceApplicationsEntity serviceApplications = new ServiceApplicationsEntity(); |
|
|
|
SmartBeanUtil.copyProperties(addForm, serviceApplications); |
|
|
|
serviceApplications.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue()); |
|
|
|
serviceApplications.setReportTime(LocalDateTime.now()); |
|
|
|
serviceApplicationsDao.insert(serviceApplications); |
|
|
|
}else { |
|
|
|
serviceApplicationsDao.updateById(serviceApplicationsEntity); |
|
|
|
ServiceApplicationsEntity serviceApplications = serviceApplicationsDao.selectById(addForm.getApplicationId()); |
|
|
|
SmartBeanUtil.copyProperties(addForm, serviceApplications); |
|
|
|
serviceApplications.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue()); |
|
|
|
serviceApplications.setReportTime(LocalDateTime.now()); |
|
|
|
serviceApplicationsDao.updateById(serviceApplications); |
|
|
|
} |
|
|
|
|
|
|
|
return ResponseDTO.ok(); |
|
|
|
@ -648,25 +664,49 @@ public class ServiceApplicationsService { |
|
|
|
//每个人的季度
|
|
|
|
if (!lawyerServiceVOList.isEmpty() && queryForm.getQuarter() != null) { |
|
|
|
lawyerServiceVOList.forEach(lawyerServiceVO -> { |
|
|
|
lawyerServiceVO.setAnnualServiceCost(BigDecimal.valueOf(Long.valueOf(dictItem.getRemark()) * lawyerServiceVO.getAnnualServiceDuration())); |
|
|
|
BigDecimal annualDuration = BigDecimal.valueOf(lawyerServiceVO.getAnnualServiceDuration()); |
|
|
|
BigDecimal costRate = BigDecimal.valueOf(Long.valueOf(dictItem.getRemark())); |
|
|
|
lawyerServiceVO.setAnnualServiceCost(annualDuration.multiply(costRate)); |
|
|
|
|
|
|
|
//查詢每個律師季度服務信息
|
|
|
|
serviceLawyerQueryForm.setUserId(lawyerServiceVO.getUserId()); |
|
|
|
List<ServiceLawyerImportForm> lawyerImportForms = serviceApplicationsDao.getLawyerStatisticsByMonth(serviceLawyerQueryForm); |
|
|
|
lawyerServiceVO.setQuarterlyServiceCost(BigDecimal.valueOf(Long.valueOf(dictItem.getRemark()) * lawyerImportForms.get(0).getQuarterlyServiceDuration())); |
|
|
|
|
|
|
|
if (lawyerImportForms != null && !lawyerImportForms.isEmpty() && lawyerImportForms.get(0) != null) { |
|
|
|
BigDecimal quarterlyDuration = BigDecimal.valueOf(lawyerImportForms.get(0).getQuarterlyServiceDuration()); |
|
|
|
lawyerServiceVO.setQuarterlyServiceCost(quarterlyDuration.multiply(costRate)); |
|
|
|
lawyerServiceVO.setQuarterlyServiceDuration(lawyerImportForms.get(0).getQuarterlyServiceDuration()); |
|
|
|
} |
|
|
|
|
|
|
|
//查询amount类型的金额,然后添加到服务成本中
|
|
|
|
queryForm.setUserId(lawyerServiceVO.getUserId()); |
|
|
|
BigDecimal amount = serviceApplicationsDao.getServiceAmount(queryForm); |
|
|
|
lawyerServiceVO.setQuarterlyServiceCost(lawyerServiceVO.getQuarterlyServiceCost().add(amount)); |
|
|
|
|
|
|
|
// 安全地添加季度服务成本
|
|
|
|
BigDecimal currentQuarterlyCost = lawyerServiceVO.getQuarterlyServiceCost(); |
|
|
|
if (currentQuarterlyCost != null) { |
|
|
|
lawyerServiceVO.setQuarterlyServiceCost(currentQuarterlyCost.add(amount)); |
|
|
|
} else { |
|
|
|
lawyerServiceVO.setQuarterlyServiceCost(amount); |
|
|
|
} |
|
|
|
}); |
|
|
|
}else { |
|
|
|
lawyerServiceVOList.forEach(lawyerServiceVO -> { |
|
|
|
lawyerServiceVO.setAnnualServiceCost(BigDecimal.valueOf(Long.valueOf(dictItem.getRemark()) * lawyerServiceVO.getAnnualServiceDuration())); |
|
|
|
BigDecimal annualDuration = BigDecimal.valueOf(lawyerServiceVO.getAnnualServiceDuration()); |
|
|
|
BigDecimal costRate = BigDecimal.valueOf(Long.valueOf(dictItem.getRemark())); |
|
|
|
lawyerServiceVO.setAnnualServiceCost(annualDuration.multiply(costRate)); |
|
|
|
|
|
|
|
//查询amount类型的金额,然后添加到服务成本中
|
|
|
|
queryForm.setUserId(lawyerServiceVO.getUserId()); |
|
|
|
BigDecimal amount = serviceApplicationsDao.getServiceAmount(queryForm); |
|
|
|
lawyerServiceVO.setAnnualServiceCost(lawyerServiceVO.getAnnualServiceCost().add(amount)); |
|
|
|
|
|
|
|
// 安全地添加年度服务成本
|
|
|
|
BigDecimal currentAnnualCost = lawyerServiceVO.getAnnualServiceCost(); |
|
|
|
if (currentAnnualCost != null) { |
|
|
|
lawyerServiceVO.setAnnualServiceCost(currentAnnualCost.add(amount)); |
|
|
|
} else { |
|
|
|
lawyerServiceVO.setAnnualServiceCost(amount); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
lawyerStatisticsVO.setLawyerServiceVOList(lawyerServiceVOList); |
|
|
|
@ -1215,9 +1255,19 @@ public class ServiceApplicationsService { |
|
|
|
statisticsVO.setQuarterlyServiceCost(BigDecimal.valueOf(quarterStatisticsVO.getQuarterlyServiceDuration() * Long.valueOf(dictItem.getRemark()))); |
|
|
|
} |
|
|
|
if (queryForm.getQuarter() == null) { |
|
|
|
statisticsVO.setAnnualServiceCost(statisticsVO.getAnnualServiceCost().add(amount)); |
|
|
|
BigDecimal currentAnnualCost = statisticsVO.getAnnualServiceCost(); |
|
|
|
if (currentAnnualCost != null) { |
|
|
|
statisticsVO.setAnnualServiceCost(currentAnnualCost.add(amount)); |
|
|
|
} else { |
|
|
|
statisticsVO.setAnnualServiceCost(amount); |
|
|
|
} |
|
|
|
}else { |
|
|
|
statisticsVO.setQuarterlyServiceCost(statisticsVO.getQuarterlyServiceCost().add(amount)); |
|
|
|
BigDecimal currentQuarterlyCost = statisticsVO.getQuarterlyServiceCost(); |
|
|
|
if (currentQuarterlyCost != null) { |
|
|
|
statisticsVO.setQuarterlyServiceCost(currentQuarterlyCost.add(amount)); |
|
|
|
} else { |
|
|
|
statisticsVO.setQuarterlyServiceCost(amount); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}else if (lawyerStatisticsWithParamYear != null) { |
|
|
|
@ -1251,9 +1301,19 @@ public class ServiceApplicationsService { |
|
|
|
statisticsVO.setQuarterlyServiceCost(BigDecimal.valueOf(quarterStatisticsVO.getQuarterlyServiceDuration() * Long.valueOf(dictItem.getRemark()))); |
|
|
|
} |
|
|
|
if (queryForm.getQuarter() == null) { |
|
|
|
statisticsVO.setAnnualServiceCost(statisticsVO.getAnnualServiceCost().add(amount)); |
|
|
|
BigDecimal currentAnnualCost = statisticsVO.getAnnualServiceCost(); |
|
|
|
if (currentAnnualCost != null) { |
|
|
|
statisticsVO.setAnnualServiceCost(currentAnnualCost.add(amount)); |
|
|
|
} else { |
|
|
|
statisticsVO.setAnnualServiceCost(amount); |
|
|
|
} |
|
|
|
}else { |
|
|
|
statisticsVO.setQuarterlyServiceCost(statisticsVO.getQuarterlyServiceCost().add(amount)); |
|
|
|
BigDecimal currentQuarterlyCost = statisticsVO.getQuarterlyServiceCost(); |
|
|
|
if (currentQuarterlyCost != null) { |
|
|
|
statisticsVO.setQuarterlyServiceCost(currentQuarterlyCost.add(amount)); |
|
|
|
} else { |
|
|
|
statisticsVO.setQuarterlyServiceCost(amount); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|