|
|
@@ -34,16 +34,14 @@ import com.xjrsoft.module.teacher.entity.BaseTeacher;
|
|
|
import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
import com.xjrsoft.module.teacher.service.ITeacherbaseManagerService;
|
|
|
import com.xjrsoft.module.teacher.vo.XjrUserPageVo;
|
|
|
-import com.xjrsoft.module.workflow.constant.WorkflowConstant;
|
|
|
-import com.xjrsoft.module.workflow.entity.WorkflowExtra;
|
|
|
-import com.xjrsoft.module.workflow.entity.WorkflowSchema;
|
|
|
+import com.xjrsoft.module.workflow.entity.WorkflowFormRelation;
|
|
|
import com.xjrsoft.module.workflow.service.IWorkflowExtraService;
|
|
|
+import com.xjrsoft.module.workflow.service.IWorkflowFormRelationService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.camunda.bpm.engine.HistoryService;
|
|
|
import org.camunda.bpm.engine.history.HistoricProcessInstance;
|
|
|
-import org.camunda.bpm.engine.history.HistoricProcessInstanceQuery;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
@@ -53,7 +51,6 @@ import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -77,60 +74,31 @@ public class DataboardController {
|
|
|
private final IBaseStudentService studentService;
|
|
|
private final ITeacherbaseManagerService teacherService;
|
|
|
private final IWorkflowExtraService extraService;
|
|
|
+ private final IWorkflowFormRelationService formRelationService;
|
|
|
|
|
|
@GetMapping(value = "/process-statistics")
|
|
|
@ApiOperation(value="流程统计")
|
|
|
@SaCheckPermission("databoard:detail")
|
|
|
public RT<ProcessStatisticsVo> processStatistics(@Valid StatisticsDto dto){
|
|
|
- HistoricProcessInstanceQuery instanceQuery = historyService.createHistoricProcessInstanceQuery();
|
|
|
- if(dto.getUserId() != null){
|
|
|
- instanceQuery.variableValueEquals(WorkflowConstant.PROCESS_START_USER_ID_KEY, dto.getUserId());
|
|
|
- }
|
|
|
-
|
|
|
- List<WorkflowExtra> workflowExtras = extraService.list(
|
|
|
- new MPJLambdaWrapper<WorkflowExtra>()
|
|
|
- .select(WorkflowExtra.class, x -> VoToColumnUtil.fieldsToColumns(WorkflowExtra.class).contains(x.getProperty()))
|
|
|
- .leftJoin(WorkflowSchema.class, WorkflowSchema::getId, WorkflowExtra::getSchemaId)
|
|
|
- .leftJoin(DictionaryDetail.class, DictionaryDetail::getId, WorkflowSchema::getCategory)
|
|
|
- );
|
|
|
-
|
|
|
-
|
|
|
ProcessStatisticsVo result = new ProcessStatisticsVo();
|
|
|
- List<HistoricProcessInstance> list = instanceQuery.list();
|
|
|
- List<WorkflowExtra> allCountList = new ArrayList<>();
|
|
|
- for (HistoricProcessInstance historicProcessInstance : list) {
|
|
|
- workflowExtras.stream()
|
|
|
- .filter(e -> e.getProcessId().equals(historicProcessInstance.getId()))
|
|
|
- .max(Comparator.comparing(WorkflowExtra::getStartTime))
|
|
|
- .ifPresent(e -> {
|
|
|
- allCountList.add(e);
|
|
|
- });
|
|
|
- }
|
|
|
- result.setAllCount(Long.parseLong(allCountList.size() + ""));
|
|
|
-
|
|
|
- List<HistoricProcessInstance> finished = historyService.createHistoricProcessInstanceQuery().finished().list();
|
|
|
- List<WorkflowExtra> completeCountList = new ArrayList<>();
|
|
|
- for (HistoricProcessInstance historicProcessInstance : finished) {
|
|
|
- workflowExtras.stream()
|
|
|
- .filter(e -> e.getProcessId().equals(historicProcessInstance.getId()))
|
|
|
- .max(Comparator.comparing(WorkflowExtra::getStartTime))
|
|
|
- .ifPresent(e -> {
|
|
|
- completeCountList.add(e);
|
|
|
- });
|
|
|
- }
|
|
|
- result.setCompleteCount(Long.parseLong(completeCountList.size() + ""));
|
|
|
-
|
|
|
- List<HistoricProcessInstance> unfinished = historyService.createHistoricProcessInstanceQuery().unfinished().list();
|
|
|
- List<WorkflowExtra> uncompleteCountList = new ArrayList<>();
|
|
|
- for (HistoricProcessInstance historicProcessInstance : unfinished) {
|
|
|
- workflowExtras.stream()
|
|
|
- .filter(e -> e.getProcessId().equals(historicProcessInstance.getId()))
|
|
|
- .max(Comparator.comparing(WorkflowExtra::getStartTime))
|
|
|
- .ifPresent(e -> {
|
|
|
- uncompleteCountList.add(e);
|
|
|
- });
|
|
|
- }
|
|
|
- result.setUncompleteCount(Long.parseLong(uncompleteCountList.size() + ""));
|
|
|
+
|
|
|
+ List<WorkflowFormRelation> relations = formRelationService.list();
|
|
|
+ result.setAllCount(Long.parseLong(relations.size() + ""));
|
|
|
+ long completeCount = 0L;
|
|
|
+ long uncompleteCount = 0L;
|
|
|
+ for (WorkflowFormRelation relation : relations) {
|
|
|
+ if(HistoricProcessInstance.STATE_COMPLETED.equals(relation.getCurrentState())){
|
|
|
+ completeCount ++;
|
|
|
+ }else if(HistoricProcessInstance.STATE_INTERNALLY_TERMINATED.equals(relation.getCurrentState())){
|
|
|
+ completeCount ++;
|
|
|
+ }else if(HistoricProcessInstance.STATE_EXTERNALLY_TERMINATED.equals(relation.getCurrentState())){
|
|
|
+ completeCount ++;
|
|
|
+ }else{
|
|
|
+ uncompleteCount ++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.setCompleteCount(completeCount);
|
|
|
+ result.setUncompleteCount(uncompleteCount);
|
|
|
|
|
|
return RT.ok(result);
|
|
|
}
|
|
|
@@ -149,12 +117,14 @@ public class DataboardController {
|
|
|
}
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
- String sql = "SELECT id, (SELECT COUNT(*) FROM xjr_user WHERE FIND_IN_SET(id, meeting_apply_participants)) AS person_count FROM wf_meeting_apply where 1 = 1";
|
|
|
+ String sql = "SELECT t1.id, (SELECT COUNT(*) FROM xjr_user WHERE FIND_IN_SET(id, t1.meeting_apply_participants)) AS person_count FROM wf_meeting_apply t1" +
|
|
|
+ " INNER JOIN xjr_workflow_form_relation t2 ON t1.id = t2.form_key_value" +
|
|
|
+ " WHERE t2.current_state = 'COMPLETED'";
|
|
|
if(startTime != null && endTime != null){
|
|
|
- sql += " and meeting_apply_date between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
+ sql += " and t1.meeting_apply_date between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
}
|
|
|
if(dto.getUserId() != null){
|
|
|
- sql += " and FIND_IN_SET(" + dto.getUserId() +", meeting_apply_participants)";
|
|
|
+ sql += " and FIND_IN_SET(" + dto.getUserId() +", t1.meeting_apply_participants)";
|
|
|
}
|
|
|
List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
MeetingStatisticsVo result = new MeetingStatisticsVo();
|
|
|
@@ -171,9 +141,10 @@ public class DataboardController {
|
|
|
@ApiOperation(value="课表统计")
|
|
|
@SaCheckPermission("databoard:detail")
|
|
|
public RT<CourseStatisticsVo> courseStatistics(@Valid StatisticsDetailDto dto){
|
|
|
+
|
|
|
List<CourseTable> list = courseTableService.list(
|
|
|
new QueryWrapper<CourseTable>().lambda()
|
|
|
- .eq((dto.getStartDate() == null && dto.getEndDate() == null), CourseTable::getScheduleDate, new Date())
|
|
|
+ .eq((dto.getStartDate() == null && dto.getEndDate() == null), CourseTable::getScheduleDate, LocalDate.now())
|
|
|
.between((dto.getStartDate() != null && dto.getEndDate() != null), CourseTable::getScheduleDate, dto.getStartDate(), dto.getEndDate())
|
|
|
);
|
|
|
CourseStatisticsVo result = new CourseStatisticsVo();
|
|
|
@@ -189,23 +160,27 @@ public class DataboardController {
|
|
|
result.setTeacherCount(teacherCount);
|
|
|
result.setNoTeacherCount(noTeacherCount);
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
- String sql = "SELECT * FROM wf_course_adjust WHERE STATUS = 1 and adjust_type = 'course_adjust'";
|
|
|
+ String sql = "SELECT t1.* FROM wf_course_adjust t1" +
|
|
|
+ " INNER JOIN xjr_workflow_form_relation t2 ON t2.form_key_value = t1.id" +
|
|
|
+ " WHERE t1.adjust_type = 'course_substitute'" +
|
|
|
+ " AND t2.current_state = 'COMPLETED'";
|
|
|
if(dto.getStartDate() != null && dto.getEndDate() != null){
|
|
|
- sql += " AND exchange_date between '" + dto.getStartDate().format(formatter) + "' and '" + dto.getEndDate().format(formatter) + "'";
|
|
|
+ sql += " AND t1.adjust_date between '" + dto.getStartDate().format(formatter) + "' and '" + dto.getEndDate().format(formatter) + "'";
|
|
|
}else{
|
|
|
- sql += " AND exchange_date = NOW()";
|
|
|
+ sql += " AND t1.adjust_date = DATE_FORMAT(NOW(),'%Y-%m-%d')";
|
|
|
}
|
|
|
- long adjustCount = SqlRunnerAdapter.db().selectCount(sql);
|
|
|
- result.setAdjustCount(Integer.parseInt(adjustCount + ""));
|
|
|
+ result.setAdjustCount(SqlRunnerAdapter.db().selectList(sql).size());
|
|
|
|
|
|
- sql = "SELECT * FROM wf_course_adjust WHERE STATUS = 1 and adjust_type = 'course_exchange'";
|
|
|
+ sql = "SELECT t1.* FROM wf_course_adjust t1" +
|
|
|
+ " INNER JOIN xjr_workflow_form_relation t2 ON t2.form_key_value = t1.id" +
|
|
|
+ " WHERE t1.adjust_type = 'course_exchange'" +
|
|
|
+ " AND t2.current_state = 'COMPLETED'";
|
|
|
if(dto.getStartDate() != null && dto.getEndDate() != null){
|
|
|
- sql += " AND exchange_date between '" + dto.getStartDate().format(formatter) + "' and '" + dto.getEndDate().format(formatter) + "'";
|
|
|
+ sql += " AND t1.adjust_date between '" + dto.getStartDate().format(formatter) + "' and '" + dto.getEndDate().format(formatter) + "'";
|
|
|
}else{
|
|
|
- sql += " AND exchange_date = NOW()";
|
|
|
+ sql += " AND t1.adjust_date = DATE_FORMAT(NOW(),'%Y-%m-%d')";
|
|
|
}
|
|
|
- long exchangeCount = SqlRunnerAdapter.db().selectCount(sql);
|
|
|
- result.setReplaceCount(Integer.parseInt(exchangeCount + ""));
|
|
|
+ result.setReplaceCount(SqlRunnerAdapter.db().selectList(sql).size());
|
|
|
|
|
|
return RT.ok(result);
|
|
|
}
|
|
|
@@ -216,7 +191,7 @@ public class DataboardController {
|
|
|
public RT<VisitorStatisticsVo> visitorStatistics(@Valid StatisticsDto dto){
|
|
|
List<VisitorOutInRecord> list = visitorService.list(
|
|
|
new QueryWrapper<VisitorOutInRecord>().lambda()
|
|
|
- .eq(VisitorOutInRecord::getDeleteMark, DeleteMark.DELETED.getCode())
|
|
|
+ .eq(VisitorOutInRecord::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
);
|
|
|
VisitorStatisticsVo result = new VisitorStatisticsVo();
|
|
|
result.setAllCount(list.size());
|
|
|
@@ -343,7 +318,9 @@ public class DataboardController {
|
|
|
@ApiOperation(value="学生健康统计")
|
|
|
@SaCheckPermission("databoard:detail")
|
|
|
public RT<HealthStatisticsVo> healthStatistics(@Valid StatisticsDto dto){
|
|
|
- String sql = "SELECT gender,COUNT(*) AS a_count FROM student_infection WHERE status = 1 GROUP BY gender";
|
|
|
+ String sql = "SELECT t1.gender,COUNT(t1.*) AS a_count FROM student_infection t1" +
|
|
|
+ " INNER JOIN xjr_workflow_form_relation t2 ON t1.id = t2.form_key_value" +
|
|
|
+ " WHERE t2.current_state = 'COMPLETED' GROUP BY t1.gender";
|
|
|
List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
HealthStatisticsVo result = new HealthStatisticsVo();
|
|
|
for (Map<String, Object> objectMap : list) {
|
|
|
@@ -354,7 +331,9 @@ public class DataboardController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- sql = "SELECT gender,COUNT(*) AS a_count FROM student_psychological WHERE status = 1 GROUP BY gender";
|
|
|
+ sql = "SELECT t1.gender,COUNT(t1.*) AS a_count FROM student_psychological t1" +
|
|
|
+ " INNER JOIN xjr_workflow_form_relation t2 ON t1.id = t2.form_key_value" +
|
|
|
+ " WHERE t2.current_state = 'COMPLETED' GROUP BY t1.gender";
|
|
|
list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
for (Map<String, Object> objectMap : list) {
|
|
|
if(objectMap.get("gender") != null && GenderDictionaryEnum.FEMALE.getCode().equals(objectMap.get("gender").toString())){
|
|
|
@@ -380,12 +359,14 @@ public class DataboardController {
|
|
|
}
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
- String sql = "SELECT * FROM billing_reimbursement where 1 = 1";
|
|
|
+ String sql = "SELECT t2.* FROM billing_reimbursement t1" +
|
|
|
+ " INNER JOIN xjr_workflow_form_relation t2 ON t1.id = t2.form_key_value" +
|
|
|
+ " where 1 = 1";
|
|
|
if(startTime != null && endTime != null){
|
|
|
- sql += " and aply_time between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
+ sql += " and t1.aply_time between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
}
|
|
|
if(dto.getUserId() != null){
|
|
|
- sql += " and applicant_id = " + dto.getUserId();
|
|
|
+ sql += " and t1.applicant_id = " + dto.getUserId();
|
|
|
}
|
|
|
List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
ReimbursementStatisticsVo result = new ReimbursementStatisticsVo();
|
|
|
@@ -394,21 +375,27 @@ public class DataboardController {
|
|
|
int uncompleteCount = 0;
|
|
|
|
|
|
for (Map<String, Object> objectMap : list) {
|
|
|
- Object statusObj = objectMap.get("status");
|
|
|
- if(statusObj == null){
|
|
|
- uncompleteCount ++;
|
|
|
- }else{
|
|
|
+ String statusObj = objectMap.get("current_state").toString();
|
|
|
+ if(HistoricProcessInstance.STATE_COMPLETED.equals(statusObj)){
|
|
|
+ completeCount ++;
|
|
|
+ }else if(HistoricProcessInstance.STATE_INTERNALLY_TERMINATED.equals(statusObj)){
|
|
|
+ completeCount ++;
|
|
|
+ }else if(HistoricProcessInstance.STATE_EXTERNALLY_TERMINATED.equals(statusObj)){
|
|
|
completeCount ++;
|
|
|
+ }else if(HistoricProcessInstance.STATE_ACTIVE.equals(statusObj)){
|
|
|
+ uncompleteCount ++;
|
|
|
}
|
|
|
}
|
|
|
result.setCompleteCount(completeCount);
|
|
|
result.setUncompleteCount(uncompleteCount);
|
|
|
|
|
|
- sql = "select city_in,sum(total_amount) as total_amount from billing_reimbursement where status = 1";
|
|
|
+ sql = "SELECT t1.city_in,SUM(t1.total_amount) AS total_amount FROM billing_reimbursement t1" +
|
|
|
+ " INNER JOIN xjr_workflow_form_relation t2 ON t1.id = t2.form_key_value" +
|
|
|
+ " WHERE t2.current_state = 'COMPLETED'";
|
|
|
if(startTime != null && endTime != null){
|
|
|
- sql += " and aply_time between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
+ sql += " and t1.aply_time between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
}
|
|
|
- sql += " group by city_in ";
|
|
|
+ sql += " group by t1.city_in ";
|
|
|
list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
List<ItemCountAmountVo> amountList = new ArrayList<>();
|
|
|
for (Map<String, Object> objectMap : list) {
|
|
|
@@ -442,9 +429,11 @@ public class DataboardController {
|
|
|
}
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
RepairStatisticsVo result = new RepairStatisticsVo();
|
|
|
- String sql = "SELECT * FROM wf_repair_declaration where 1 = 1";
|
|
|
+ String sql = "SELECT t1.* FROM wf_repair_declaration t1" +
|
|
|
+ " INNER JOIN xjr_workflow_form_relation t2 ON t1.id = t2.form_key_value" +
|
|
|
+ " WHERE t2.current_state = 'COMPLETED'";
|
|
|
if(startTime != null && endTime != null){
|
|
|
- sql += " and application_time between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
+ sql += " and t1.application_time between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
}
|
|
|
List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
result.setAllCount(list.size());
|
|
|
@@ -468,7 +457,9 @@ public class DataboardController {
|
|
|
result.setUncompleteCount(uncompleteCount);
|
|
|
result.setPersonCount(personCount);
|
|
|
|
|
|
- sql = "SELECT ifnull(SUM(indemnity), 0) as indemnity FROM wf_repair_declaration";
|
|
|
+ sql = "SELECT ifnull(SUM(t1.indemnity), 0) as indemnity FROM wf_repair_declaration t1" +
|
|
|
+ " INNER JOIN xjr_workflow_form_relation t2 ON t1.id = t2.form_key_value" +
|
|
|
+ " WHERE t2.current_state = 'COMPLETED'";
|
|
|
list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
result.setTotalAmount(Double.parseDouble(list.get(0).get("indemnity").toString()));
|
|
|
|
|
|
@@ -490,16 +481,18 @@ public class DataboardController {
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
AttendanceStatisticsVo result = new AttendanceStatisticsVo();
|
|
|
|
|
|
- String sql = " SELECT ifnull(sum(leave_days), 0) as leave_days FROM wf_teacherleave WHERE status = 1";
|
|
|
+ String sql = " SELECT ifnull(sum(t1.leave_days), 0) as leave_days FROM wf_teacherleave t1" +
|
|
|
+ " INNER JOIN xjr_workflow_form_relation t2 ON t2.form_key_value = t1.id" +
|
|
|
+ " WHERE t2.current_state = 'COMPLETED'";
|
|
|
|
|
|
if(startTime != null && endTime != null){
|
|
|
String startTimeStr = startTime.format(formatter);
|
|
|
String endTimeStr = endTime.format(formatter);
|
|
|
sql +=" AND (" +
|
|
|
- " (leave_start_time BETWEEN '" + startTimeStr + "' and '" + endTimeStr + "')" +
|
|
|
- " OR (leave_end_time BETWEEN '" + startTimeStr + "' and '" + endTimeStr + "')" +
|
|
|
- " OR (leave_start_time > '" + startTimeStr + "' and '" + endTimeStr + "' > leave_end_time)" +
|
|
|
- " OR ('" + startTimeStr + "' > leave_start_time and leave_end_time > '" + endTimeStr + "')" +
|
|
|
+ " (t1.leave_start_time BETWEEN '" + startTimeStr + "' and '" + endTimeStr + "')" +
|
|
|
+ " OR (t1.leave_end_time BETWEEN '" + startTimeStr + "' and '" + endTimeStr + "')" +
|
|
|
+ " OR (t1.leave_start_time > '" + startTimeStr + "' and '" + endTimeStr + "' > t1.leave_end_time)" +
|
|
|
+ " OR ('" + startTimeStr + "' > t1.leave_start_time and t1.leave_end_time > '" + endTimeStr + "')" +
|
|
|
")";
|
|
|
}
|
|
|
if(dto.getUserId() != null){
|
|
|
@@ -508,9 +501,10 @@ public class DataboardController {
|
|
|
List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
result.setLeaveDays(Double.parseDouble(list.get(0).get("leave_days").toString()));
|
|
|
|
|
|
- sql = "SELECT COUNT(*) AS a_count FROM teacher_out_in_record WHERE delete_mark = 0 and attendance_status = '迟到'";
|
|
|
+ sql = "SELECT * FROM teacher_attendance_record WHERE delete_mark = 0 and attendance_status = '迟到'";
|
|
|
+ formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
if(startTime != null && endTime != null){
|
|
|
- sql +=" AND record_time between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
+ sql +=" AND attendance_date between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
}
|
|
|
if(dto.getUserId() != null){
|
|
|
sql += " and user_id = " + dto.getUserId();
|
|
|
@@ -518,22 +512,28 @@ public class DataboardController {
|
|
|
list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
result.setLateCount(Integer.parseInt(list.get(0).get("a_count").toString()));
|
|
|
|
|
|
- sql = "select COUNT(*) AS a_count from wf_course_adjust where status = 1";
|
|
|
+ sql = "SELECT COUNT(t1.*) AS a_count FROM wf_course_adjust t1" +
|
|
|
+ " INNER JOIN xjr_workflow_form_relation t2 ON t2.form_key_value = t1.id" +
|
|
|
+ " WHERE t1.adjust_type = 'course_exchange'" +
|
|
|
+ " AND t2.current_state = 'COMPLETED'";
|
|
|
if(startTime != null && endTime != null){
|
|
|
- sql +=" AND adjust_date between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
+ sql +=" AND t1.adjust_date between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
}
|
|
|
if(dto.getUserId() != null){
|
|
|
- sql += " and user_id = " + dto.getUserId();
|
|
|
+ sql += " and t1.user_id = " + dto.getUserId();
|
|
|
}
|
|
|
list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
result.setAdjustCount(Integer.parseInt(list.get(0).get("a_count").toString()));
|
|
|
|
|
|
- sql = "select COUNT(*) AS a_count from wf_course_adjust where status = 1";
|
|
|
+ sql = "SELECT COUNT(t1.*) AS a_count FROM wf_course_adjust t1" +
|
|
|
+ " INNER JOIN xjr_workflow_form_relation t2 ON t2.form_key_value = t1.id" +
|
|
|
+ " WHERE t1.adjust_type = 'course_substitute'" +
|
|
|
+ " AND t2.current_state = 'COMPLETED'";
|
|
|
if(startTime != null && endTime != null){
|
|
|
- sql +=" AND exchange_date between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
+ sql +=" AND t1.adjust_date between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
|
|
|
}
|
|
|
if(dto.getUserId() != null){
|
|
|
- sql += " and user_id = " + dto.getUserId();
|
|
|
+ sql += " t1.and user_id = " + dto.getUserId();
|
|
|
}
|
|
|
list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
result.setExchangeCount(Integer.parseInt(list.get(0).get("a_count").toString()));
|