|
|
@ -226,10 +226,24 @@ public class ServiceApplicationsService { |
|
|
* 添加 |
|
|
* 添加 |
|
|
*/ |
|
|
*/ |
|
|
public ResponseDTO<String> add(ServiceApplicationsAddForm addForm) { |
|
|
public ResponseDTO<String> add(ServiceApplicationsAddForm addForm) { |
|
|
|
|
|
|
|
|
ServiceApplicationsEntity serviceApplicationsEntity = SmartBeanUtil.copy(addForm, ServiceApplicationsEntity.class); |
|
|
ServiceApplicationsEntity serviceApplicationsEntity = SmartBeanUtil.copy(addForm, ServiceApplicationsEntity.class); |
|
|
if(addForm.getApplicationId() == null) { |
|
|
if(addForm.getApplicationId() == null) { |
|
|
|
|
|
//新增的时候判断活动类型查询案号有没有存在
|
|
|
|
|
|
if("TIME".equals(addForm.getServiceType())) { |
|
|
|
|
|
List<ServiceApplicationsVO> serviceApplicationsVOS = serviceApplicationsDao.selectByRecordNo(addForm.getRecordNo()); |
|
|
|
|
|
if (!serviceApplicationsVOS.isEmpty()){ |
|
|
|
|
|
throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg()+serviceApplicationsVOS.get(0).getUserName()+UserErrorCode.HAS_EXIST1.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
serviceApplicationsDao.insert(serviceApplicationsEntity); |
|
|
serviceApplicationsDao.insert(serviceApplicationsEntity); |
|
|
}else { |
|
|
}else { |
|
|
|
|
|
//修改的时候判断活动类型查询案号别人有没有创建
|
|
|
|
|
|
if("TIME".equals(addForm.getServiceType())) { |
|
|
|
|
|
//当前登录人的ID
|
|
|
|
|
|
Long userId = AdminRequestUtil.getRequestUser().getEmployeeId(); |
|
|
|
|
|
List<ServiceApplicationsVO> applicationsVOS = serviceApplicationsDao.selectByRecordNoNotMy(userId,addForm.getRecordNo()); |
|
|
|
|
|
} |
|
|
serviceApplicationsDao.updateById(serviceApplicationsEntity); |
|
|
serviceApplicationsDao.updateById(serviceApplicationsEntity); |
|
|
} |
|
|
} |
|
|
return ResponseDTO.ok(); |
|
|
return ResponseDTO.ok(); |
|
|
@ -240,6 +254,16 @@ public class ServiceApplicationsService { |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
public ResponseDTO<String> update(ServiceApplicationsUpdateForm updateForm) { |
|
|
public ResponseDTO<String> update(ServiceApplicationsUpdateForm updateForm) { |
|
|
|
|
|
//判断活动类型查询案号有没有存在
|
|
|
|
|
|
if("TIME".equals(updateForm.getServiceType())) { |
|
|
|
|
|
//当前登录人的ID
|
|
|
|
|
|
Long userId = AdminRequestUtil.getRequestUser().getEmployeeId(); |
|
|
|
|
|
List<ServiceApplicationsVO> serviceApplicationsEntity = serviceApplicationsDao.selectByRecordNoNotMy(userId, updateForm.getRecordNo()); |
|
|
|
|
|
|
|
|
|
|
|
if (!serviceApplicationsEntity.isEmpty()){ |
|
|
|
|
|
throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg()+serviceApplicationsEntity.get(0).getUserName()+UserErrorCode.HAS_EXIST1.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
ServiceApplicationsEntity serviceApplicationsEntity = SmartBeanUtil.copy(updateForm, ServiceApplicationsEntity.class); |
|
|
ServiceApplicationsEntity serviceApplicationsEntity = SmartBeanUtil.copy(updateForm, ServiceApplicationsEntity.class); |
|
|
//serviceApplicationsEntity.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue());
|
|
|
//serviceApplicationsEntity.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue());
|
|
|
serviceApplicationsDao.updateById(serviceApplicationsEntity); |
|
|
serviceApplicationsDao.updateById(serviceApplicationsEntity); |
|
|
@ -250,12 +274,20 @@ public class ServiceApplicationsService { |
|
|
* 提交 |
|
|
* 提交 |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
public ResponseDTO<String> submit(Long applicationId) { |
|
|
public ResponseDTO<String> submit(ServiceApplicationsAddForm addForm) { |
|
|
if (null == applicationId){ |
|
|
if (null == addForm.getApplicationId()){ |
|
|
return ResponseDTO.ok(); |
|
|
return ResponseDTO.ok(); |
|
|
} |
|
|
} |
|
|
|
|
|
if("TIME".equals(addForm.getServiceType())) { |
|
|
|
|
|
//当前登录人的ID
|
|
|
|
|
|
Long userId = AdminRequestUtil.getRequestUser().getEmployeeId(); |
|
|
|
|
|
List<ServiceApplicationsVO> serviceApplicationsEntity = serviceApplicationsDao.selectByRecordNoNotMy(userId, addForm.getRecordNo()); |
|
|
|
|
|
|
|
|
ServiceApplicationsEntity serviceApplicationsEntity = serviceApplicationsDao.selectById(applicationId); |
|
|
if (!serviceApplicationsEntity.isEmpty()){ |
|
|
|
|
|
throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg()+serviceApplicationsEntity.get(0).getUserName()+UserErrorCode.HAS_EXIST1.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
ServiceApplicationsEntity serviceApplications = serviceApplicationsDao.selectById(addForm.getApplicationId()); |
|
|
|
|
|
|
|
|
// 检查当前用户角色是否为CEO
|
|
|
// 检查当前用户角色是否为CEO
|
|
|
/*RequestUser requestUser = AdminRequestUtil.getRequestUser(); |
|
|
/*RequestUser requestUser = AdminRequestUtil.getRequestUser(); |
|
|
@ -272,10 +304,11 @@ public class ServiceApplicationsService { |
|
|
serviceApplicationsEntity.setAssociationAuditTime(LocalDateTime.now()); |
|
|
serviceApplicationsEntity.setAssociationAuditTime(LocalDateTime.now()); |
|
|
} |
|
|
} |
|
|
}else {*/ |
|
|
}else {*/ |
|
|
serviceApplicationsEntity.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue()); |
|
|
SmartBeanUtil.copyProperties(addForm, serviceApplications); |
|
|
serviceApplicationsEntity.setReportTime(LocalDateTime.now()); |
|
|
serviceApplications.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue()); |
|
|
|
|
|
serviceApplications.setReportTime(LocalDateTime.now()); |
|
|
//}
|
|
|
//}
|
|
|
serviceApplicationsDao.updateById(serviceApplicationsEntity); |
|
|
serviceApplicationsDao.updateById(serviceApplications); |
|
|
return ResponseDTO.ok(); |
|
|
return ResponseDTO.ok(); |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
@ -523,6 +556,13 @@ public class ServiceApplicationsService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public ResponseDTO<String> addSubmit(@Valid ServiceApplicationsAddForm addForm) { |
|
|
public ResponseDTO<String> addSubmit(@Valid ServiceApplicationsAddForm addForm) { |
|
|
|
|
|
//判断活动类型查询案号有没有存在
|
|
|
|
|
|
if("TIME".equals(addForm.getServiceType())) { |
|
|
|
|
|
List<ServiceApplicationsVO> serviceApplicationsEntity = serviceApplicationsDao.selectByRecordNo(addForm.getRecordNo()); |
|
|
|
|
|
if (!serviceApplicationsEntity.isEmpty()){ |
|
|
|
|
|
throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg()+serviceApplicationsEntity.get(0).getUserName()+UserErrorCode.HAS_EXIST1.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
ServiceApplicationsEntity serviceApplicationsEntity = SmartBeanUtil.copy(addForm, ServiceApplicationsEntity.class); |
|
|
ServiceApplicationsEntity serviceApplicationsEntity = SmartBeanUtil.copy(addForm, ServiceApplicationsEntity.class); |
|
|
serviceApplicationsEntity.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue()); |
|
|
serviceApplicationsEntity.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue()); |
|
|
//serviceApplicationsEntity.setReportTime(LocalDateTime.now());
|
|
|
//serviceApplicationsEntity.setReportTime(LocalDateTime.now());
|
|
|
@ -614,10 +654,19 @@ public class ServiceApplicationsService { |
|
|
List<ServiceLawyerImportForm> lawyerImportForms = serviceApplicationsDao.getLawyerStatisticsByMonth(serviceLawyerQueryForm); |
|
|
List<ServiceLawyerImportForm> lawyerImportForms = serviceApplicationsDao.getLawyerStatisticsByMonth(serviceLawyerQueryForm); |
|
|
lawyerServiceVO.setQuarterlyServiceCost(BigDecimal.valueOf(Long.valueOf(dictItem.getRemark()) * lawyerImportForms.get(0).getQuarterlyServiceDuration())); |
|
|
lawyerServiceVO.setQuarterlyServiceCost(BigDecimal.valueOf(Long.valueOf(dictItem.getRemark()) * lawyerImportForms.get(0).getQuarterlyServiceDuration())); |
|
|
lawyerServiceVO.setQuarterlyServiceDuration(lawyerImportForms.get(0).getQuarterlyServiceDuration()); |
|
|
lawyerServiceVO.setQuarterlyServiceDuration(lawyerImportForms.get(0).getQuarterlyServiceDuration()); |
|
|
|
|
|
//查询amount类型的金额,然后添加到服务成本中
|
|
|
|
|
|
queryForm.setUserId(lawyerServiceVO.getUserId()); |
|
|
|
|
|
BigDecimal amount = serviceApplicationsDao.getServiceAmount(queryForm); |
|
|
|
|
|
lawyerServiceVO.setQuarterlyServiceCost(lawyerServiceVO.getQuarterlyServiceCost().add(amount)); |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
}else { |
|
|
}else { |
|
|
lawyerServiceVOList.forEach(lawyerServiceVO -> { |
|
|
lawyerServiceVOList.forEach(lawyerServiceVO -> { |
|
|
lawyerServiceVO.setAnnualServiceCost(BigDecimal.valueOf(Long.valueOf(dictItem.getRemark()) * lawyerServiceVO.getAnnualServiceDuration())); |
|
|
lawyerServiceVO.setAnnualServiceCost(BigDecimal.valueOf(Long.valueOf(dictItem.getRemark()) * lawyerServiceVO.getAnnualServiceDuration())); |
|
|
|
|
|
//查询amount类型的金额,然后添加到服务成本中
|
|
|
|
|
|
queryForm.setUserId(lawyerServiceVO.getUserId()); |
|
|
|
|
|
BigDecimal amount = serviceApplicationsDao.getServiceAmount(queryForm); |
|
|
|
|
|
lawyerServiceVO.setAnnualServiceCost(lawyerServiceVO.getAnnualServiceCost().add(amount)); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
lawyerStatisticsVO.setLawyerServiceVOList(lawyerServiceVOList); |
|
|
lawyerStatisticsVO.setLawyerServiceVOList(lawyerServiceVOList); |
|
|
@ -728,14 +777,16 @@ public class ServiceApplicationsService { |
|
|
if (dictItem == null){ |
|
|
if (dictItem == null){ |
|
|
return BigDecimal.valueOf(0L); |
|
|
return BigDecimal.valueOf(0L); |
|
|
} |
|
|
} |
|
|
|
|
|
// 获取是否有amount类型的的案件数据,获取金额
|
|
|
|
|
|
BigDecimal workloadScore = serviceApplicationsDao.getServiceApplicationsAmount(queryForm); |
|
|
//除1w
|
|
|
//除1w
|
|
|
if (time != null && time != 0L) { |
|
|
if (time != null && time != 0L) { |
|
|
Long timeCost = time * Long.valueOf(dictItem.getRemark()); |
|
|
Long timeCost = time * Long.valueOf(dictItem.getRemark()); |
|
|
//取两位小数
|
|
|
|
|
|
|
|
|
|
|
|
// 将long类型转换为BigDecimal
|
|
|
// 将long类型转换为BigDecimal
|
|
|
BigDecimal bigDecimalDividend = BigDecimal.valueOf(timeCost); |
|
|
BigDecimal bigDecimalDividend = BigDecimal.valueOf(timeCost); |
|
|
|
|
|
// 将获取到的金额加到时间金额上
|
|
|
|
|
|
bigDecimalDividend = workloadScore.add(bigDecimalDividend); |
|
|
BigDecimal bigDecimalDivisor = BigDecimal.valueOf(10000); |
|
|
BigDecimal bigDecimalDivisor = BigDecimal.valueOf(10000); |
|
|
|
|
|
|
|
|
// 执行除法运算
|
|
|
// 执行除法运算
|
|
|
@ -1009,6 +1060,10 @@ public class ServiceApplicationsService { |
|
|
if (!lawyerStatisticsVOPageResult.getList().isEmpty()) { |
|
|
if (!lawyerStatisticsVOPageResult.getList().isEmpty()) { |
|
|
for (LawyerStatisticsVO statisticsVO : lawyerStatisticsWithParamYear) { |
|
|
for (LawyerStatisticsVO statisticsVO : lawyerStatisticsWithParamYear) { |
|
|
statisticsVO.setAnnualServiceCost(BigDecimal.valueOf(statisticsVO.getAnnualServiceDuration() * Long.valueOf(one.getRemark()))); |
|
|
statisticsVO.setAnnualServiceCost(BigDecimal.valueOf(statisticsVO.getAnnualServiceDuration() * Long.valueOf(one.getRemark()))); |
|
|
|
|
|
//统计金额
|
|
|
|
|
|
queryForm.setUserId(statisticsVO.getUserId()); |
|
|
|
|
|
BigDecimal amount = serviceApplicationsDao.getServiceAmount(queryForm); |
|
|
|
|
|
statisticsVO.setAnnualServiceCost(statisticsVO.getAnnualServiceCost().add(amount)); |
|
|
} |
|
|
} |
|
|
monthStatistics(queryForm, lawyerStatisticsVOPageResult.getList(),null); |
|
|
monthStatistics(queryForm, lawyerStatisticsVOPageResult.getList(),null); |
|
|
} |
|
|
} |
|
|
@ -1088,6 +1143,9 @@ public class ServiceApplicationsService { |
|
|
if (quarterStatisticsVO != null && quarterStatisticsVO.getQuarterlyServiceDuration() != null) { |
|
|
if (quarterStatisticsVO != null && quarterStatisticsVO.getQuarterlyServiceDuration() != null) { |
|
|
statisticsVO.setQuarterlyServiceDuration(quarterStatisticsVO.getQuarterlyServiceDuration()); |
|
|
statisticsVO.setQuarterlyServiceDuration(quarterStatisticsVO.getQuarterlyServiceDuration()); |
|
|
statisticsVO.setQuarterlyServiceCost(BigDecimal.valueOf(quarterStatisticsVO.getQuarterlyServiceDuration() * Long.valueOf(one.getRemark()))); |
|
|
statisticsVO.setQuarterlyServiceCost(BigDecimal.valueOf(quarterStatisticsVO.getQuarterlyServiceDuration() * Long.valueOf(one.getRemark()))); |
|
|
|
|
|
//统计金额
|
|
|
|
|
|
BigDecimal amount = serviceApplicationsDao.getServiceAmount(queryForm); |
|
|
|
|
|
statisticsVO.setQuarterlyServiceCost(statisticsVO.getQuarterlyServiceCost().add(amount)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}else if (lawyerStatisticsWithParamYear != null) { |
|
|
}else if (lawyerStatisticsWithParamYear != null) { |
|
|
@ -1115,7 +1173,9 @@ public class ServiceApplicationsService { |
|
|
if (quarterStatisticsVO != null && quarterStatisticsVO.getQuarterlyServiceDuration() != null) { |
|
|
if (quarterStatisticsVO != null && quarterStatisticsVO.getQuarterlyServiceDuration() != null) { |
|
|
statisticsVO.setQuarterlyServiceDuration(quarterStatisticsVO.getQuarterlyServiceDuration()); |
|
|
statisticsVO.setQuarterlyServiceDuration(quarterStatisticsVO.getQuarterlyServiceDuration()); |
|
|
statisticsVO.setQuarterlyServiceCost(BigDecimal.valueOf(quarterStatisticsVO.getQuarterlyServiceDuration() * Long.valueOf(one.getRemark()))); |
|
|
statisticsVO.setQuarterlyServiceCost(BigDecimal.valueOf(quarterStatisticsVO.getQuarterlyServiceDuration() * Long.valueOf(one.getRemark()))); |
|
|
|
|
|
//统计金额
|
|
|
|
|
|
BigDecimal amount = serviceApplicationsDao.getServiceAmount(queryForm); |
|
|
|
|
|
statisticsVO.setQuarterlyServiceCost(statisticsVO.getQuarterlyServiceCost().add(amount)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -1145,6 +1205,8 @@ public class ServiceApplicationsService { |
|
|
queryForm.setUserId(statisticsVO.getUserId()); |
|
|
queryForm.setUserId(statisticsVO.getUserId()); |
|
|
//计算年度累计服务成本
|
|
|
//计算年度累计服务成本
|
|
|
statisticsVO.setAnnualServiceCost(BigDecimal.valueOf(statisticsVO.getAnnualServiceDuration() * Long.valueOf(dictItem.getRemark()))); |
|
|
statisticsVO.setAnnualServiceCost(BigDecimal.valueOf(statisticsVO.getAnnualServiceDuration() * Long.valueOf(dictItem.getRemark()))); |
|
|
|
|
|
//查询amount类型的金额,然后添加到服务成本中
|
|
|
|
|
|
BigDecimal amount = serviceApplicationsDao.getServiceAmount(queryForm); |
|
|
//季度服务时间范围
|
|
|
//季度服务时间范围
|
|
|
LawyerStatisticsVO quarterStatisticsVO = serviceApplicationsDao.getdepartmentMothStatistic(queryForm); |
|
|
LawyerStatisticsVO quarterStatisticsVO = serviceApplicationsDao.getdepartmentMothStatistic(queryForm); |
|
|
if (quarterStatisticsVO != null && quarterStatisticsVO.getQuarterlyServiceDuration() != null) { |
|
|
if (quarterStatisticsVO != null && quarterStatisticsVO.getQuarterlyServiceDuration() != null) { |
|
|
@ -1152,6 +1214,11 @@ public class ServiceApplicationsService { |
|
|
//计算季度累计服务成本
|
|
|
//计算季度累计服务成本
|
|
|
statisticsVO.setQuarterlyServiceCost(BigDecimal.valueOf(quarterStatisticsVO.getQuarterlyServiceDuration() * Long.valueOf(dictItem.getRemark()))); |
|
|
statisticsVO.setQuarterlyServiceCost(BigDecimal.valueOf(quarterStatisticsVO.getQuarterlyServiceDuration() * Long.valueOf(dictItem.getRemark()))); |
|
|
} |
|
|
} |
|
|
|
|
|
if (queryForm.getQuarter() == null) { |
|
|
|
|
|
statisticsVO.setAnnualServiceCost(statisticsVO.getAnnualServiceCost().add(amount)); |
|
|
|
|
|
}else { |
|
|
|
|
|
statisticsVO.setQuarterlyServiceCost(statisticsVO.getQuarterlyServiceCost().add(amount)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}else if (lawyerStatisticsWithParamYear != null) { |
|
|
}else if (lawyerStatisticsWithParamYear != null) { |
|
|
for (ServiceDepartmentImportForm statisticsVO : lawyerStatisticsWithParamYear) { |
|
|
for (ServiceDepartmentImportForm statisticsVO : lawyerStatisticsWithParamYear) { |
|
|
@ -1175,6 +1242,7 @@ public class ServiceApplicationsService { |
|
|
queryForm.setFirmId(statisticsVO.getFirmId()); |
|
|
queryForm.setFirmId(statisticsVO.getFirmId()); |
|
|
//计算年度累计服务成本
|
|
|
//计算年度累计服务成本
|
|
|
statisticsVO.setAnnualServiceCost(BigDecimal.valueOf(statisticsVO.getAnnualServiceDuration() * Long.valueOf(dictItem.getRemark()))); |
|
|
statisticsVO.setAnnualServiceCost(BigDecimal.valueOf(statisticsVO.getAnnualServiceDuration() * Long.valueOf(dictItem.getRemark()))); |
|
|
|
|
|
BigDecimal amount = serviceApplicationsDao.getServiceAmount(queryForm); |
|
|
//季度服务时间范围
|
|
|
//季度服务时间范围
|
|
|
LawyerStatisticsVO quarterStatisticsVO = serviceApplicationsDao.getdepartmentMothStatistic(queryForm); |
|
|
LawyerStatisticsVO quarterStatisticsVO = serviceApplicationsDao.getdepartmentMothStatistic(queryForm); |
|
|
if (quarterStatisticsVO != null && quarterStatisticsVO.getQuarterlyServiceDuration() != null) { |
|
|
if (quarterStatisticsVO != null && quarterStatisticsVO.getQuarterlyServiceDuration() != null) { |
|
|
@ -1182,6 +1250,11 @@ public class ServiceApplicationsService { |
|
|
//计算季度累计服务成本
|
|
|
//计算季度累计服务成本
|
|
|
statisticsVO.setQuarterlyServiceCost(BigDecimal.valueOf(quarterStatisticsVO.getQuarterlyServiceDuration() * Long.valueOf(dictItem.getRemark()))); |
|
|
statisticsVO.setQuarterlyServiceCost(BigDecimal.valueOf(quarterStatisticsVO.getQuarterlyServiceDuration() * Long.valueOf(dictItem.getRemark()))); |
|
|
} |
|
|
} |
|
|
|
|
|
if (queryForm.getQuarter() == null) { |
|
|
|
|
|
statisticsVO.setAnnualServiceCost(statisticsVO.getAnnualServiceCost().add(amount)); |
|
|
|
|
|
}else { |
|
|
|
|
|
statisticsVO.setQuarterlyServiceCost(statisticsVO.getQuarterlyServiceCost().add(amount)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|