فهرست منبع

联调过错检查

xuxiaodong 2 ماه پیش
والد
کامیت
fef0eda49e

+ 22 - 11
zfjg-api/zfjg-api-manage/src/main/java/com/zfjg/manage/api/dto/other/WReportDto.java

@@ -1,6 +1,7 @@
 package com.zfjg.manage.api.dto.other;
 
-import com.zfjg.manage.api.domain.other.WCheckItem;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -8,27 +9,37 @@ import java.util.List;
 
 @Data
 public class WReportDto {
-    @ApiModelProperty("新增ID不传, 更新必传ID")
+    @ApiModelProperty("新增不传ID, 更新才传ID")
+    @JsonSerialize(using = ToStringSerializer.class)
     private Long id;
 
     @ApiModelProperty("执法机构")
     private String orgId;
 
     @ApiModelProperty("执法机构名称")
-    private String orgName;
+    private List<String> orgName;
 
     @ApiModelProperty("过错责任人")
     private String wUser;
 
-    @ApiModelProperty("过错责任人ID")
-    private String cUser;
+    @ApiModelProperty("不当履行职责执法过错情形")
+    private List<String> wrongCategory;
 
-    @ApiModelProperty("过错项")
-    private List<WCheckItem> cItem;
+    @ApiModelProperty("未履行职责执法过错情形")
+    private List<String> notCategory;
 
-    @ApiModelProperty("处理方式(以逗号分割处理方式)")
-    private String dDo;
+    @ApiModelProperty("违法履行职责执法过错情形")
+    private List<String> breakLawCategory;
 
-    @ApiModelProperty("上传文件(多文件以逗号分割)")
-    private String fDown;
+    @ApiModelProperty("处理方式,多个以逗号分割")
+    private List<String> doHandlerCategory;
+
+    @ApiModelProperty("上传文件多文件逗号分割")
+    private List<String> files;
+
+    @ApiModelProperty("处理方式")
+    private List<String> doHandler;
+
+    @ApiModelProperty("级联数据")
+    private String caseData;
 }

+ 7 - 0
zfjg-api/zfjg-api-manage/src/main/java/com/zfjg/manage/api/vo/other/WReportVo.java

@@ -1,8 +1,11 @@
 package com.zfjg.manage.api.vo.other;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.time.LocalDateTime;
+
 @Data
 public class WReportVo {
     private Long id;
@@ -30,4 +33,8 @@ public class WReportVo {
 
     @ApiModelProperty("处理次数")
     private Integer aCount;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty("创建时间")
+    private LocalDateTime createTime;
 }

+ 3 - 0
zfjg-api/zfjg-api-system/src/main/java/com/zfjg/system/api/RemoteUserService.java

@@ -69,6 +69,9 @@ public interface RemoteUserService {
     @GetMapping("/user/{userId}")
     AjaxResult getInfo(@PathVariable("userId") String id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 
+    @GetMapping("/user/getByUserId/{userId}")
+    R<SysUser> getInfo2(@PathVariable("userId") String id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
+
     @GetMapping("/user/byUid")
     R<SysUser> findByUid(@RequestParam("uid") String uid, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 

+ 5 - 0
zfjg-api/zfjg-api-system/src/main/java/com/zfjg/system/api/factory/RemoteUserFallbackFactory.java

@@ -82,6 +82,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
             public R<SysDept> getInfoByOrgId(String orgId) {
                 return R.fail("远程调用失败");
             }
+
+            @Override
+            public R<SysUser> getInfo2(String id, String source) {
+                return null;
+            }
         };
     }
 }

+ 51 - 6
zfjg-modules/zfjg-manage/src/main/java/com/zfjg/manage/controller/other/WReportController.java

@@ -1,19 +1,23 @@
 package com.zfjg.manage.controller.other;
 
+import cn.hutool.core.collection.ListUtil;
 import com.zfjg.common.core.domain.R;
 import com.zfjg.common.core.utils.ServletUtils;
+import com.zfjg.common.core.web.controller.BaseController;
+import com.zfjg.common.core.web.page.TableInfo;
+import com.zfjg.manage.api.domain.other.WReport;
 import com.zfjg.manage.api.dto.other.WReportDto;
+import com.zfjg.manage.api.dto.other.WReportQuery;
 import com.zfjg.manage.service.enforce.report.ReportService;
 import com.zfjg.manage.service.other.WReportBizService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -24,9 +28,9 @@ import javax.annotation.Resource;
  * @since 2024-11-20
  */
 @Api(value = "执法过错调查", tags = "执法过错调查")
-@Controller
+@RestController
 @RequestMapping("/wReport")
-public class WReportController {
+public class WReportController extends BaseController {
     @Resource
     private WReportBizService wReportBizService;
 
@@ -37,5 +41,46 @@ public class WReportController {
         return R.ok(apkUrl);
     }
 
+    @ApiOperation(value = "更新")
+    @PostMapping("/update")
+    public R<String> updateReport(@RequestBody WReportDto reportDto) {
+        String apkUrl = wReportBizService.updateReport(reportDto);
+        return R.ok(apkUrl);
+    }
+
+    @ApiOperation(value = "删除")
+    @PostMapping("/{id}/del")
+    public R<String> removeReport(@PathVariable Long id) {
+        String apkUrl = wReportBizService.removeReport(id);
+        return R.ok(apkUrl);
+    }
+
+    @ApiOperation(value = "详情")
+    @GetMapping("/detail")
+    public R<List<WReportDto>> reportDetail(WReportQuery wReportQuery) {
+        List<WReport> wReports = wReportBizService.reportDetail(wReportQuery);
+        List<WReportDto> wReportDtos = wReports.stream().map(it -> {
+            WReportDto wReportDto = new WReportDto();
+            wReportDto.setId(it.getId());
+            wReportDto.setOrgId(it.getOrgId());
+            wReportDto.setWUser(it.getWUser());
+            wReportDto.setOrgName(ListUtil.of(it.getOrgName()));
+            wReportDto.setFiles(Optional.ofNullable(it.getFDown()).map(item -> Arrays.asList(item.split("\\|\\|\\|"))).orElseGet(ArrayList::new));
+            wReportDto.setDoHandler(Optional.ofNullable(it.getDDo()).map(item -> Arrays.asList(item.split("\\|\\|\\|"))).orElseGet(ArrayList::new));
+            wReportDto.setNotCategory(Optional.ofNullable(it.getNType()).map(item -> Arrays.asList(item.split("\\|\\|\\|"))).orElseGet(ArrayList::new));
+            wReportDto.setWrongCategory(Optional.ofNullable(it.getWType()).map(item -> Arrays.asList(item.split("\\|\\|\\|"))).orElseGet(ArrayList::new));
+            wReportDto.setBreakLawCategory(Optional.ofNullable(it.getSType()).map(item -> Arrays.asList(item.split("\\|\\|\\|"))).orElseGet(ArrayList::new));
+            return wReportDto;
+        }).collect(Collectors.toList());
+        return R.ok(wReportDtos);
+    }
+
+    @ApiOperation(value = "列表")
+    @GetMapping("/list")
+    public TableInfo<?> updateReport(WReportQuery wReportQuery) {
+        startPage();
+        return wReportBizService.listReport(wReportQuery);
+    }
+
 
 }

+ 1 - 1
zfjg-modules/zfjg-manage/src/main/java/com/zfjg/manage/mapper/other/WReportMapper.java

@@ -9,7 +9,7 @@ import com.zfjg.manage.api.domain.other.WReport;
  * </p>
  *
  * @author xuxiaodong
- * @since 2024-11-20
+ * @since 2024-11-21
  */
 public interface WReportMapper extends BaseMapper<WReport> {
 

+ 126 - 16
zfjg-modules/zfjg-manage/src/main/java/com/zfjg/manage/service/impl/other/WReportServiceImpl.java

@@ -1,20 +1,39 @@
 package com.zfjg.manage.service.impl.other;
 
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zfjg.common.core.constant.SecurityConstants;
+import com.zfjg.common.core.domain.R;
+import com.zfjg.common.core.exception.ServiceException;
+import com.zfjg.common.core.utils.StringUtils;
 import com.zfjg.common.core.utils.bean.BeanUtils;
+import com.zfjg.common.core.web.domain.AjaxResult;
 import com.zfjg.common.core.web.page.TableInfo;
 import com.zfjg.manage.api.domain.other.WReport;
 import com.zfjg.manage.api.dto.other.WReportDto;
 import com.zfjg.manage.api.dto.other.WReportQuery;
 import com.zfjg.manage.api.vo.other.WReportDetailVO;
+import com.zfjg.manage.api.vo.other.WReportVo;
 import com.zfjg.manage.mapper.other.WReportMapper;
 import com.zfjg.manage.service.other.IWReportService;
 import com.zfjg.manage.service.other.WReportBizService;
-import org.springframework.beans.BeansException;
+import com.zfjg.system.api.RemoteUserService;
+import com.zfjg.system.api.domain.SysDept;
+import com.zfjg.system.api.domain.SysUser;
+import com.zfjg.system.api.model.LoginUser;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.time.LocalDateTime;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -26,34 +45,125 @@ import java.time.LocalDateTime;
  */
 @Service
 public class WReportServiceImpl extends ServiceImpl<WReportMapper, WReport> implements IWReportService, WReportBizService {
+    @Resource
+    private RemoteUserService remoteUserService;
+
     @Override
     public String addReport(WReportDto reportDto) {
-        try {
-            WReport wReport = new WReport();
-            BeanUtils.copyProperties(reportDto, wReport);
-            LocalDateTime currentTime = LocalDateTime.now();
-            wReport.setId(IdUtil.getSnowflake(1, 1).nextId());
-            wReport.setCreateTime(currentTime);
-            wReport.setUpdateTime(currentTime);
-            this.save(wReport);
-            return "ok";
-        } catch (Exception e) {
-            return "error";
+        WReport wReport = new WReport();
+        BeanUtils.copyProperties(reportDto, wReport);
+        LocalDateTime currentTime = LocalDateTime.now();
+
+        String orgId = String.join("", reportDto.getOrgName());
+        R<SysDept> infoByOrgId = remoteUserService.getInfoByOrgId(orgId);
+        SysDept data = infoByOrgId.getData();
+
+        wReport.setOrgId(data.getEnforceOrgId());
+        wReport.setOrgName(data.getDeptShortName());
+        wReport.setId(IdUtil.getSnowflake(1, 1).nextId());
+        if (ObjectUtil.isNotEmpty(reportDto.getWrongCategory())) {
+            wReport.setWType(String.join("|||", reportDto.getWrongCategory()));
+            wReport.setWTypeC(reportDto.getWrongCategory().size());
+        }
+
+        if (ObjectUtil.isNotEmpty(reportDto.getNotCategory())) {
+            wReport.setNType(String.join("|||", reportDto.getNotCategory()));
+            wReport.setNTypeC(reportDto.getNotCategory().size());
+        }
+
+        if (ObjectUtil.isNotEmpty(reportDto.getBreakLawCategory())) {
+            wReport.setSType(String.join("|||", reportDto.getBreakLawCategory()));
+            wReport.setSTypeC(reportDto.getBreakLawCategory().size());
+        }
+
+        if (ObjectUtil.isNotEmpty(reportDto.getFiles())) {
+            wReport.setFDown(String.join("|||", reportDto.getFiles()));
         }
+
+        if (ObjectUtil.isNotEmpty(reportDto.getDoHandler())) {
+            wReport.setDDo(String.join("|||", reportDto.getDoHandler()));
+        }
+        wReport.setCreateTime(currentTime);
+        wReport.setUpdateTime(currentTime);
+        this.save(wReport);
+        return "ok";
     }
 
     @Override
     public String updateReport(WReportDto reportDto) {
-        return "";
+        WReport wReport = this.getById(reportDto.getId());
+        WReport report = Optional.ofNullable(wReport).map(it -> {
+            BeanUtils.copyProperties(reportDto, it);
+            return it;
+        }).orElseThrow(() -> new ServiceException("error"));
+        this.updateById(report);
+        return "ok";
+    }
+
+    @Override
+    public String removeReport(Long id) {
+        this.removeById(id);
+        return "ok";
     }
 
     @Override
-    public WReportDetailVO reportDetail(String orgId) {
-        return null;
+    public List<WReport> reportDetail(WReportQuery wReportQuery) {
+        LambdaQueryWrapper<WReport> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(WReport::getOrgId, wReportQuery.getOrgId());
+        if (StringUtils.isNoneBlank(wReportQuery.getUsername())) {
+            queryWrapper.eq(WReport::getWUser, wReportQuery.getUsername());
+        }
+        if (ObjectUtil.isNotEmpty(wReportQuery.getStartTime())) {
+            queryWrapper.gt(WReport::getCreateTime, wReportQuery.getStartTime());
+        }
+        if (ObjectUtil.isNotEmpty(wReportQuery.getEndTime())) {
+            queryWrapper.lt(WReport::getCreateTime, wReportQuery.getEndTime());
+        }
+        return this.list(queryWrapper);
     }
 
     @Override
     public TableInfo<?> listReport(WReportQuery wReportQuery) {
-        return null;
+        QueryWrapper<WReport> queryWrapper = new QueryWrapper<>();
+        if (StringUtils.isNoneBlank(wReportQuery.getOrgId())) {
+            queryWrapper.eq("org_id", wReportQuery.getOrgId());
+        }
+        if (StringUtils.isNoneBlank(wReportQuery.getUsername())) {
+            R<SysUser> info2 = remoteUserService.getInfo2(wReportQuery.getUsername(), SecurityConstants.INNER);
+            queryWrapper.eq("w_user", info2.getData().getNickName());
+        }
+        if (ObjectUtil.isNotEmpty(wReportQuery.getStartTime())) {
+            queryWrapper.gt("create_time", wReportQuery.getStartTime());
+        }
+        if (ObjectUtil.isNotEmpty(wReportQuery.getEndTime())) {
+            queryWrapper.lt("create_time", wReportQuery.getEndTime());
+        }
+        queryWrapper.groupBy("org_id");
+        queryWrapper.select("id", "org_id", "org_name", "w_user", "create_time", "w_type", "sum(w_type_c) as w_type_c", "n_type", "sum(n_type_c) as n_type_c", "s_type", "sum(s_type_c) as s_type_c");
+        List<WReport> wReports = this.list(queryWrapper);
+
+
+        TableInfo<WReportVo> reportVoPageInfo = new TableInfo<>();
+        BeanUtils.copyProperties(wReports, reportVoPageInfo);
+        List<WReportVo> wReportVos = wReports.stream().map(it -> {
+            WReportVo wReportVo = new WReportVo();
+            wReportVo.setId(it.getId());
+            wReportVo.setOrgId(it.getOrgId());
+            wReportVo.setOrgName(it.getOrgName());
+            wReportVo.setWUser(it.getWUser());
+            Integer i = Optional.ofNullable(it.getWTypeC()).orElse(0);
+            Integer i1 = Optional.ofNullable(it.getNTypeC()).orElse(0);
+            Integer i2 = Optional.ofNullable(it.getSTypeC()).orElse(0);
+            wReportVo.setDCount(it.getWTypeC());
+            wReportVo.setNCount(it.getNTypeC());
+            wReportVo.setWCount(it.getSTypeC());
+            Integer i3 = i + i1 + i2;
+            wReportVo.setACount(i3);
+            wReportVo.setCreateTime(it.getCreateTime());
+            return wReportVo;
+        }).collect(Collectors.toList());
+
+        reportVoPageInfo.setRows(wReportVos);
+        return reportVoPageInfo;
     }
 }

+ 6 - 1
zfjg-modules/zfjg-manage/src/main/java/com/zfjg/manage/service/other/WReportBizService.java

@@ -1,10 +1,13 @@
 package com.zfjg.manage.service.other;
 
 import com.zfjg.common.core.web.page.TableInfo;
+import com.zfjg.manage.api.domain.other.WReport;
 import com.zfjg.manage.api.dto.other.WReportDto;
 import com.zfjg.manage.api.dto.other.WReportQuery;
 import com.zfjg.manage.api.vo.other.WReportDetailVO;
 
+import java.util.List;
+
 public interface WReportBizService {
     /**
      * 新增过错信息
@@ -23,11 +26,13 @@ public interface WReportBizService {
      */
     String updateReport(WReportDto reportDto);
 
+    String removeReport(Long id);
+
 
     /**
      * 查看详情
      */
-    WReportDetailVO reportDetail(String orgId);
+    List<WReport> reportDetail(WReportQuery wReportQuery);
 
     /**
      * 列表

+ 10 - 0
zfjg-modules/zfjg-system/src/main/java/com/zfjg/system/controller/SysUserController.java

@@ -236,6 +236,16 @@ public class SysUserController extends BaseController {
     }
 
 
+    /**
+     * 根据用户编号获取详细信息
+     */
+    @GetMapping(value = {"/getByUserId/{userId}"})
+    public R<SysUser> getInfo2(@PathVariable(value = "userId", required = false) String userId) {
+        AjaxResult ajax = AjaxResult.success();
+        SysUser sysUser = userService.findByUid(userId);
+        return R.ok(sysUser);
+    }
+
     /**
      * 新增用户
      */