|
@@ -20,6 +20,7 @@ import com.xjrsoft.module.databoard.vo.DurationVo;
|
|
|
import com.xjrsoft.module.databoard.vo.HealthItemCountVo;
|
|
import com.xjrsoft.module.databoard.vo.HealthItemCountVo;
|
|
|
import com.xjrsoft.module.databoard.vo.HealthStatisticsDetailVo;
|
|
import com.xjrsoft.module.databoard.vo.HealthStatisticsDetailVo;
|
|
|
import com.xjrsoft.module.databoard.vo.ItemCountAmountVo;
|
|
import com.xjrsoft.module.databoard.vo.ItemCountAmountVo;
|
|
|
|
|
+import com.xjrsoft.module.databoard.vo.ItemCountRatioVo;
|
|
|
import com.xjrsoft.module.databoard.vo.ItemCountVo;
|
|
import com.xjrsoft.module.databoard.vo.ItemCountVo;
|
|
|
import com.xjrsoft.module.databoard.vo.ItemDoubleVo;
|
|
import com.xjrsoft.module.databoard.vo.ItemDoubleVo;
|
|
|
import com.xjrsoft.module.databoard.vo.ProcessStatisticsDetailVo;
|
|
import com.xjrsoft.module.databoard.vo.ProcessStatisticsDetailVo;
|
|
@@ -52,10 +53,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.Duration;
|
|
import java.time.Duration;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.time.Period;
|
|
import java.time.Period;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -92,6 +96,14 @@ public class DatadetailController {
|
|
|
if(dto.getUserId() != null){
|
|
if(dto.getUserId() != null){
|
|
|
instanceQuery.variableValueEquals(WorkflowConstant.PROCESS_START_USER_ID_KEY, dto.getUserId());
|
|
instanceQuery.variableValueEquals(WorkflowConstant.PROCESS_START_USER_ID_KEY, dto.getUserId());
|
|
|
}
|
|
}
|
|
|
|
|
+ LocalDateTime startTime = null;
|
|
|
|
|
+ LocalDateTime endTime = null;
|
|
|
|
|
+ if(dto.getStartDate() != null){
|
|
|
|
|
+ startTime = dto.getStartDate().atStartOfDay();
|
|
|
|
|
+ }
|
|
|
|
|
+ if(dto.getEndDate() != null){
|
|
|
|
|
+ endTime = dto.getEndDate().atStartOfDay().plusDays(1).plusNanos(-1);
|
|
|
|
|
+ }
|
|
|
if (!ObjectUtil.isNull(dto.getStartDate())) {
|
|
if (!ObjectUtil.isNull(dto.getStartDate())) {
|
|
|
instanceQuery.startedAfter(WorkFlowUtil.getStartOfDay(dto.getStartDate()));
|
|
instanceQuery.startedAfter(WorkFlowUtil.getStartOfDay(dto.getStartDate()));
|
|
|
}
|
|
}
|
|
@@ -101,6 +113,8 @@ public class DatadetailController {
|
|
|
|
|
|
|
|
List<WorkflowExtra> workflowExtras = extraService.list(
|
|
List<WorkflowExtra> workflowExtras = extraService.list(
|
|
|
new MPJLambdaWrapper<WorkflowExtra>()
|
|
new MPJLambdaWrapper<WorkflowExtra>()
|
|
|
|
|
+ .between((startTime != null && endTime != null), WorkflowExtra::getLaunchTime, startTime, endTime)
|
|
|
|
|
+ .select(WorkflowExtra::getId)
|
|
|
.select(WorkflowExtra.class, x -> VoToColumnUtil.fieldsToColumns(WorkflowExtra.class).contains(x.getProperty()))
|
|
.select(WorkflowExtra.class, x -> VoToColumnUtil.fieldsToColumns(WorkflowExtra.class).contains(x.getProperty()))
|
|
|
.leftJoin(WorkflowSchema.class, WorkflowSchema::getId, WorkflowExtra::getSchemaId)
|
|
.leftJoin(WorkflowSchema.class, WorkflowSchema::getId, WorkflowExtra::getSchemaId)
|
|
|
.leftJoin(DictionaryDetail.class, DictionaryDetail::getId, WorkflowSchema::getCategory)
|
|
.leftJoin(DictionaryDetail.class, DictionaryDetail::getId, WorkflowSchema::getCategory)
|
|
@@ -124,7 +138,7 @@ public class DatadetailController {
|
|
|
List<WorkflowExtra> completeCountList = new ArrayList<>();
|
|
List<WorkflowExtra> completeCountList = new ArrayList<>();
|
|
|
for (HistoricProcessInstance historicProcessInstance : finished) {
|
|
for (HistoricProcessInstance historicProcessInstance : finished) {
|
|
|
workflowExtras.stream()
|
|
workflowExtras.stream()
|
|
|
- .filter(e -> e.getProcessId().equals(historicProcessInstance.getId()))
|
|
|
|
|
|
|
+ .filter(e -> e.getProcessId().equals(historicProcessInstance.getId()) && e.getEndTime() != null)
|
|
|
.max(Comparator.comparing(WorkflowExtra::getStartTime))
|
|
.max(Comparator.comparing(WorkflowExtra::getStartTime))
|
|
|
.ifPresent(e -> {
|
|
.ifPresent(e -> {
|
|
|
completeCountList.add(e);
|
|
completeCountList.add(e);
|
|
@@ -167,28 +181,17 @@ public class DatadetailController {
|
|
|
result.setDistributionList(distributionList);
|
|
result.setDistributionList(distributionList);
|
|
|
List<DurationVo> durationList = new ArrayList<>();
|
|
List<DurationVo> durationList = new ArrayList<>();
|
|
|
|
|
|
|
|
- List<Duration> timeDifferences = new ArrayList<>();
|
|
|
|
|
|
|
+ List<Long> secondList = new ArrayList<>();
|
|
|
completeCountList.stream().filter(el -> el.getEndTime() != null && el.getStartTime() != null).forEach(el -> {
|
|
completeCountList.stream().filter(el -> el.getEndTime() != null && el.getStartTime() != null).forEach(el -> {
|
|
|
- Duration diff = Duration.between(el.getEndTime(), el.getStartTime());
|
|
|
|
|
- timeDifferences.add(diff);
|
|
|
|
|
|
|
+ Duration diff = Duration.between(el.getStartTime(), el.getEndTime());
|
|
|
|
|
+ secondList.add(diff.getSeconds());
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- int zeroHour = 0;
|
|
|
|
|
- int oneHour = 0;
|
|
|
|
|
- int fourHour = 0;
|
|
|
|
|
- int eightHour = 0;
|
|
|
|
|
- for (Duration timeDifference : timeDifferences) {
|
|
|
|
|
- long seconds = timeDifference.getSeconds();
|
|
|
|
|
- if(seconds < 3600){
|
|
|
|
|
- zeroHour ++;
|
|
|
|
|
- }else if(seconds < 14400){
|
|
|
|
|
- oneHour ++;
|
|
|
|
|
- }else if(seconds < 28800){
|
|
|
|
|
- fourHour ++;
|
|
|
|
|
- }else{
|
|
|
|
|
- eightHour ++;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ long zeroHour = secondList.stream().filter(x -> x < 3600L).count();
|
|
|
|
|
+ long oneHour = secondList.stream().filter(x -> x < 14400L && x >= 3600L).count();
|
|
|
|
|
+ long fourHour = secondList.stream().filter(x -> x < 28800L && x >= 14400L).count();
|
|
|
|
|
+ long eightHour = secondList.stream().filter(x -> x >= 28800L).count();
|
|
|
|
|
+
|
|
|
DurationVo zeroVo = new DurationVo();
|
|
DurationVo zeroVo = new DurationVo();
|
|
|
zeroVo.setDuration("0-1h");
|
|
zeroVo.setDuration("0-1h");
|
|
|
zeroVo.setCount(zeroHour);
|
|
zeroVo.setCount(zeroHour);
|
|
@@ -556,11 +559,22 @@ public class DatadetailController {
|
|
|
@SaCheckPermission("datadetail:detail")
|
|
@SaCheckPermission("datadetail:detail")
|
|
|
public RT<SubscriptionStatisticsDetailVo> subscriptionStatistics(@Valid StatisticsDetailDto dto) {
|
|
public RT<SubscriptionStatisticsDetailVo> subscriptionStatistics(@Valid StatisticsDetailDto dto) {
|
|
|
SubscriptionStatisticsDetailVo result = new SubscriptionStatisticsDetailVo();
|
|
SubscriptionStatisticsDetailVo result = new SubscriptionStatisticsDetailVo();
|
|
|
|
|
+ LocalDateTime startTime = null;
|
|
|
|
|
+ LocalDateTime endTime = null;
|
|
|
|
|
+ if(dto.getStartDate() != null){
|
|
|
|
|
+ startTime = dto.getStartDate().atStartOfDay();
|
|
|
|
|
+ }
|
|
|
|
|
+ if(dto.getEndDate() != null){
|
|
|
|
|
+ endTime = dto.getEndDate().atStartOfDay().plusDays(1).plusNanos(-1);
|
|
|
|
|
+ }
|
|
|
List<WfSubscription> list = subscriptionService.list(
|
|
List<WfSubscription> list = subscriptionService.list(
|
|
|
new QueryWrapper<WfSubscription>().lambda()
|
|
new QueryWrapper<WfSubscription>().lambda()
|
|
|
- .between((dto.getStartDate() != null && dto.getEndDate() != null), WfSubscription::getShenQingRiQi4752, dto.getStartDate(), dto.getEndDate())
|
|
|
|
|
|
|
+ .between((startTime != null && endTime != null), WfSubscription::getShenQingRiQi4752, startTime, endTime)
|
|
|
);
|
|
);
|
|
|
- double totalAmount = list.stream().filter(x -> x.getTotalAmount() != null).mapToDouble(WfSubscription::getTotalAmount).sum();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ result.setAllCount(list.size());
|
|
|
|
|
+
|
|
|
|
|
+ double totalAmount = list.stream().filter(x -> x.getTotalAmount() != null && x.getStatus() == 1).mapToDouble(WfSubscription::getTotalAmount).sum();
|
|
|
result.setTotalAmount(totalAmount);
|
|
result.setTotalAmount(totalAmount);
|
|
|
|
|
|
|
|
int adoptCount = list.stream().filter(x -> x.getStatus() == 1).collect(Collectors.toList()).size();
|
|
int adoptCount = list.stream().filter(x -> x.getStatus() == 1).collect(Collectors.toList()).size();
|
|
@@ -569,14 +583,14 @@ public class DatadetailController {
|
|
|
int pendingCount = list.stream().filter(x -> x.getStatus() == null || x.getStatus() == 0).collect(Collectors.toList()).size();
|
|
int pendingCount = list.stream().filter(x -> x.getStatus() == null || x.getStatus() == 0).collect(Collectors.toList()).size();
|
|
|
result.setPendingCount(pendingCount);
|
|
result.setPendingCount(pendingCount);
|
|
|
|
|
|
|
|
- String sql = "SELECT IFNULL(t3.name, '未填写') AS item,COUNT(t1.id) AS a_count,SUM(t1.amount) as a_sum FROM wf_subscription_list t1" +
|
|
|
|
|
|
|
+ String sql = "SELECT IFNULL(t3.name, '未填写') AS item,COUNT(t1.id) AS a_count,SUM(t1.estimated_unit_price * t1.amount) as a_sum FROM wf_subscription_list t1" +
|
|
|
" INNER JOIN wf_subscription t2 ON t1.parent_id = t2.id" +
|
|
" INNER JOIN wf_subscription t2 ON t1.parent_id = t2.id" +
|
|
|
" LEFT JOIN xjr_dictionary_detail t3 ON t1.item_type = t3.code" +
|
|
" LEFT JOIN xjr_dictionary_detail t3 ON t1.item_type = t3.code" +
|
|
|
" AND t3.item_id = 1752140413593518081" +
|
|
" AND t3.item_id = 1752140413593518081" +
|
|
|
" WHERE t2.status = 1";
|
|
" WHERE t2.status = 1";
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
|
- if(dto.getStartDate() != null && dto.getEndDate() != null){
|
|
|
|
|
- sql += " and t2.shen_qing_ri_qi4752 between '" + dto.getStartDate().format(formatter) + "' and '" + dto.getEndDate().format(formatter) + "'";
|
|
|
|
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ if(startTime != null && endTime != null){
|
|
|
|
|
+ sql += " and t2.shen_qing_ri_qi4752 between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
}
|
|
}
|
|
|
sql += " GROUP BY t3.name";
|
|
sql += " GROUP BY t3.name";
|
|
|
List<Map<String, Object>> datalist = SqlRunnerAdapter.db().selectList(sql);
|
|
List<Map<String, Object>> datalist = SqlRunnerAdapter.db().selectList(sql);
|
|
@@ -600,12 +614,12 @@ public class DatadetailController {
|
|
|
result.setCategoryCountList(categoryCountList);
|
|
result.setCategoryCountList(categoryCountList);
|
|
|
result.setCategoryAmountList(categoryAmountList);
|
|
result.setCategoryAmountList(categoryAmountList);
|
|
|
|
|
|
|
|
- sql = "SELECT IFNULL(t3.name, '未填写') AS item,COUNT(t1.id) AS a_count,SUM(t1.amount) as a_sum FROM wf_subscription_list t1" +
|
|
|
|
|
|
|
+ sql = "SELECT IFNULL(t3.name, '未填写') AS item,COUNT(t1.id) AS a_count,SUM(t1.estimated_unit_price * t1.amount) as a_sum FROM wf_subscription_list t1" +
|
|
|
" INNER JOIN wf_subscription t2 ON t1.parent_id = t2.id" +
|
|
" INNER JOIN wf_subscription t2 ON t1.parent_id = t2.id" +
|
|
|
" LEFT JOIN xjr_department t3 ON t2.application_department = t3.id" +
|
|
" LEFT JOIN xjr_department t3 ON t2.application_department = t3.id" +
|
|
|
" WHERE t2.status = 1";
|
|
" WHERE t2.status = 1";
|
|
|
- if(dto.getStartDate() != null && dto.getEndDate() != null){
|
|
|
|
|
- sql += " and t2.shen_qing_ri_qi4752 between '" + dto.getStartDate().format(formatter) + "' and '" + dto.getEndDate().format(formatter) + "'";
|
|
|
|
|
|
|
+ if(startTime != null && endTime != null){
|
|
|
|
|
+ sql += " and t2.shen_qing_ri_qi4752 between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
}
|
|
}
|
|
|
sql += " GROUP BY t3.name";
|
|
sql += " GROUP BY t3.name";
|
|
|
datalist = SqlRunnerAdapter.db().selectList(sql);
|
|
datalist = SqlRunnerAdapter.db().selectList(sql);
|
|
@@ -643,6 +657,35 @@ public class DatadetailController {
|
|
|
courseCountList.add(listVo);
|
|
courseCountList.add(listVo);
|
|
|
}
|
|
}
|
|
|
result.setCourseCountList(courseCountList);
|
|
result.setCourseCountList(courseCountList);
|
|
|
|
|
+
|
|
|
|
|
+ sql = "SELECT count(*) FROM course_table t1" +
|
|
|
|
|
+ " INNER JOIN base_teacher t2 ON t1.teacher_id = t2.user_id" +
|
|
|
|
|
+ " INNER JOIN xjr_user_dept_relation t3 ON t2.user_id = t3.user_id" +
|
|
|
|
|
+ " INNER JOIN xjr_department t4 ON t4.id = t3.dept_id" +
|
|
|
|
|
+ " WHERE t4.delete_mark = 0 AND t2.delete_mark = 0" +
|
|
|
|
|
+ " AND t4.is_major = 1";
|
|
|
|
|
+ long allCourseCount = SqlRunnerAdapter.db().selectCount(sql);
|
|
|
|
|
+ sql = "SELECT name,(" +
|
|
|
|
|
+ " SELECT COUNT(*) FROM course_table t1" +
|
|
|
|
|
+ " INNER JOIN base_teacher t2 ON t1.teacher_id = t2.user_id" +
|
|
|
|
|
+ " INNER JOIN xjr_user_dept_relation t3 ON t2.user_id = t3.user_id" +
|
|
|
|
|
+ " WHERE t3.dept_id = xjr_department.id" +
|
|
|
|
|
+ " ) AS course_count FROM xjr_department WHERE is_major = 1";
|
|
|
|
|
+ list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
|
|
+ List<ItemCountRatioVo> deptCourseList = new ArrayList<>();
|
|
|
|
|
+ for (Map<String, Object> objectMap : list) {
|
|
|
|
|
+ int courseCount = Integer.parseInt(objectMap.get("course_count").toString());
|
|
|
|
|
+ //计算出勤率
|
|
|
|
|
+ BigDecimal divide = BigDecimal.valueOf(courseCount).divide(BigDecimal.valueOf(allCourseCount), 4, RoundingMode.HALF_UP);
|
|
|
|
|
+ deptCourseList.add(
|
|
|
|
|
+ new ItemCountRatioVo() {{
|
|
|
|
|
+ setItem(objectMap.get("name").toString());
|
|
|
|
|
+ setCount(courseCount);
|
|
|
|
|
+ setRatio(divide.doubleValue());
|
|
|
|
|
+ }}
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ result.setDeptCourseList(deptCourseList);
|
|
|
return RT.ok(result);
|
|
return RT.ok(result);
|
|
|
}
|
|
}
|
|
|
|
|
|