fix:检查统计接口修改提交

pg_adapter
wangxy 8 months ago
parent be5f47e305
commit 1a6efcb1ce

@ -12,6 +12,7 @@ import com.ruoyi.system.domain.count.PropertyDesCountDTO;
import com.ruoyi.system.domain.count.PropertyStateCountDTO; import com.ruoyi.system.domain.count.PropertyStateCountDTO;
import com.ruoyi.system.service.ITdCheckService; import com.ruoyi.system.service.ITdCheckService;
import com.ruoyi.system.service.ITdNotifyService; import com.ruoyi.system.service.ITdNotifyService;
import com.ruoyi.system.service.check.TdCheckReportService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -35,8 +37,8 @@ import java.util.stream.Collectors;
public class TdChecknumController extends BaseController{ public class TdChecknumController extends BaseController{
private String prefix = "system/check/checknum"; private String prefix = "system/check/checknum";
@Autowired @Resource
private ITdCheckService tdCheckService; private TdCheckReportService checkReportService;
@Autowired @Autowired
private ITdNotifyService tdNotifyService; private ITdNotifyService tdNotifyService;
@ -66,7 +68,7 @@ public class TdChecknumController extends BaseController{
@PostMapping("/countResult") @PostMapping("/countResult")
@ResponseBody @ResponseBody
public AjaxResult countbf() { public AjaxResult countbf() {
CheckResultCountDTO checkResultCountDTO = tdCheckService.selectResultCount(); CheckResultCountDTO checkResultCountDTO = checkReportService.selectResultCount();
List<JSONObject> datas = checkResult.stream() List<JSONObject> datas = checkResult.stream()
.map(name -> { .map(name -> {
AtomicReference<Object> value = new AtomicReference<>(0L); AtomicReference<Object> value = new AtomicReference<>(0L);
@ -93,7 +95,7 @@ public class TdChecknumController extends BaseController{
@PostMapping("/countType") @PostMapping("/countType")
@ResponseBody @ResponseBody
public AjaxResult countXH() { public AjaxResult countXH() {
CheckTypeCountDTO checkTypeCountDTO = tdCheckService.selectTypeCount(); CheckTypeCountDTO checkTypeCountDTO = checkReportService.selectTypeCount();
List<JSONObject> datas = checkType.stream() List<JSONObject> datas = checkType.stream()
.map(name -> { .map(name -> {
AtomicReference<Object> value = new AtomicReference<>(0L); AtomicReference<Object> value = new AtomicReference<>(0L);

@ -2,6 +2,8 @@ package com.ruoyi.system.mapper.check;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.check.TdCheckReport; import com.ruoyi.system.domain.check.TdCheckReport;
import com.ruoyi.system.domain.count.CheckResultCountDTO;
import com.ruoyi.system.domain.count.CheckTypeCountDTO;
import java.util.List; import java.util.List;
@ -16,6 +18,10 @@ public interface TdCheckReportMapper extends BaseMapper<TdCheckReport> {
public List<TdCheckReport> selectTdCheckReportList(TdCheckReport tdCheckReport); public List<TdCheckReport> selectTdCheckReportList(TdCheckReport tdCheckReport);
public CheckResultCountDTO selectResultCount();
public CheckTypeCountDTO selectTypeCount();
} }

@ -2,6 +2,8 @@ package com.ruoyi.system.service.check;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.system.domain.check.TdCheckReport; import com.ruoyi.system.domain.check.TdCheckReport;
import com.ruoyi.system.domain.count.CheckResultCountDTO;
import com.ruoyi.system.domain.count.CheckTypeCountDTO;
import com.ruoyi.system.domain.place.TdPlace; import com.ruoyi.system.domain.place.TdPlace;
import java.util.List; import java.util.List;
@ -16,4 +18,9 @@ public interface TdCheckReportService extends IService<TdCheckReport> {
public List<TdCheckReport> selectTdCheckReportList(TdCheckReport tdCheckReport); public List<TdCheckReport> selectTdCheckReportList(TdCheckReport tdCheckReport);
public CheckResultCountDTO selectResultCount();
public CheckTypeCountDTO selectTypeCount();
} }

@ -2,6 +2,8 @@ package com.ruoyi.system.service.check.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.domain.check.TdCheckReport; import com.ruoyi.system.domain.check.TdCheckReport;
import com.ruoyi.system.domain.count.CheckResultCountDTO;
import com.ruoyi.system.domain.count.CheckTypeCountDTO;
import com.ruoyi.system.mapper.check.TdCheckReportMapper; import com.ruoyi.system.mapper.check.TdCheckReportMapper;
import com.ruoyi.system.mapper.place.TdPlaceMapper; import com.ruoyi.system.mapper.place.TdPlaceMapper;
import com.ruoyi.system.service.check.TdCheckReportService; import com.ruoyi.system.service.check.TdCheckReportService;
@ -26,6 +28,16 @@ public class TdCheckReportServiceImpl extends ServiceImpl<TdCheckReportMapper, T
public List<TdCheckReport> selectTdCheckReportList(TdCheckReport tdCheckReport) { public List<TdCheckReport> selectTdCheckReportList(TdCheckReport tdCheckReport) {
return checkReportMapper.selectTdCheckReportList(tdCheckReport); return checkReportMapper.selectTdCheckReportList(tdCheckReport);
} }
@Override
public CheckResultCountDTO selectResultCount() {
return checkReportMapper.selectResultCount();
}
@Override
public CheckTypeCountDTO selectTypeCount() {
return checkReportMapper.selectTypeCount();
}
} }

@ -42,4 +42,21 @@
</trim> </trim>
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
<select id="selectTypeCount" resultType="com.ruoyi.system.domain.count.CheckTypeCountDTO">
SELECT
SUM (CASE WHEN check_type = 0 THEN 1 ELSE 0 END) AS zxjc,
SUM (CASE WHEN check_type = 1 THEN 1 ELSE 0 END) AS bmjjc
from td_check_report
</select>
<select id="selectResultCount" resultType="com.ruoyi.system.domain.count.CheckResultCountDTO">
SELECT
SUM (CASE WHEN check_state = 0 THEN 1 ELSE 0 END) AS tg,
SUM (CASE WHEN check_state = 1 THEN 1 ELSE 0 END) AS wtg,
SUM (CASE WHEN check_state = 2 THEN 1 ELSE 0 END) AS djc
from td_check_report
</select>
</mapper> </mapper>

Loading…
Cancel
Save