From 9079d6ff1de150ee90f00cd45f735f2a887d826e Mon Sep 17 00:00:00 2001 From: WenG <450292408@qq.com> Date: Thu, 8 Jul 2021 19:46:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A1=97=E9=81=93=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E6=A1=88=E4=BB=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apis/check/Check2Controller.java | 14 +++++++ .../service/check/ICheck2Service.java | 8 ++++ .../service/check/impl/Check2ServiceImpl.java | 41 +++++++++++++++++++ src/main/resources/application-test.yml | 26 ++++++------ 4 files changed, 76 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/cm/inspection/controller/apis/check/Check2Controller.java b/src/main/java/com/cm/inspection/controller/apis/check/Check2Controller.java index 7b17d73..4520e52 100644 --- a/src/main/java/com/cm/inspection/controller/apis/check/Check2Controller.java +++ b/src/main/java/com/cm/inspection/controller/apis/check/Check2Controller.java @@ -132,4 +132,18 @@ public class Check2Controller extends AbstractController { return check2Service.listCheckItem(checkId); } + @ApiOperation(value = "我的街道案件列表", notes = "我的街道案件列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "Integer", defaultValue = "1"), + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "Integer", defaultValue = "20"), + @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listpage-street-of-mine") + public SuccessResultList> listPageStreetOfMine(ListPage page) { + Map params = requestParams(); + page.setParams(params); + return check2Service.listPageStreetOfMine(page); + } + } \ No newline at end of file diff --git a/src/main/java/com/cm/inspection/service/check/ICheck2Service.java b/src/main/java/com/cm/inspection/service/check/ICheck2Service.java index e2ce8a3..42ca40c 100644 --- a/src/main/java/com/cm/inspection/service/check/ICheck2Service.java +++ b/src/main/java/com/cm/inspection/service/check/ICheck2Service.java @@ -112,4 +112,12 @@ public interface ICheck2Service { * @return */ List listCheckItem(String checkId); + + /** + * 我的街道案件列表 + * + * @param page + * @return + */ + SuccessResultList> listPageStreetOfMine(ListPage page); } diff --git a/src/main/java/com/cm/inspection/service/check/impl/Check2ServiceImpl.java b/src/main/java/com/cm/inspection/service/check/impl/Check2ServiceImpl.java index 92a385b..7825a6e 100644 --- a/src/main/java/com/cm/inspection/service/check/impl/Check2ServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/check/impl/Check2ServiceImpl.java @@ -154,6 +154,18 @@ public class Check2ServiceImpl extends BaseService implements ICheck2Service { return null; } + @Override + public SuccessResultList> listPageStreetOfMine(ListPage page) { + String userId = securityComponent.getCurrentUser().getUserId(); + List tasks = processService.listTaskByAssigneeAndVariableKey(GridPersonnelTypeEnum.STREET.getValue(), userId); + List checkIds = listLastCheckId(tasks); + if (checkIds.isEmpty()) { + return new SuccessResultList<>(new ArrayList<>(), 1, 0L); + } + page.getParams().put("checkIds", checkIds); + return listPage(page); + } + /** * 开启检查流程 * @@ -308,4 +320,33 @@ public class Check2ServiceImpl extends BaseService implements ICheck2Service { return true; } + /** + * 最新的检查ID列表 + * + * @param tasks + * @return + */ + private List listLastCheckId(List tasks) { + if (tasks == null || tasks.isEmpty()) { + return new ArrayList<>(); + } + List lastCheckIds = new ArrayList<>(); + for (Task task : tasks) { + Map taskVariableMap = task.getTaskLocalVariables(); + if (taskVariableMap == null) { + continue; + } + Object lastCheckIdObj = taskVariableMap.get(CheckProcessParamsEnum.LAST_CHECK_ID.getValue()); + if (lastCheckIdObj == null) { + continue; + } + String lastCheckId = lastCheckIdObj.toString(); + if (StringUtils.isBlank(lastCheckId)) { + continue; + } + lastCheckIds.add(lastCheckId); + } + return lastCheckIds; + } + } diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index fbc856a..8aeaf43 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -1,6 +1,6 @@ server: port: 7006 - url: http://192.168.0.103:7006/inspection + url: http://192.168.0.101:7006/inspection title: 隐患上报系统 servlet: context-path: /inspection @@ -20,14 +20,14 @@ spring: max-request-size: 1GB datasource: druid: - url: jdbc:mysql://49.233.36.36:6688/db_cloud_inspection?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false -# url: jdbc:mysql://127.0.0.1:3306/db_cloud_inspection?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false +# url: jdbc:mysql://49.233.36.36:6688/db_cloud_inspection?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false + url: jdbc:mysql://127.0.0.1:3306/db_cloud_inspection?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false db-type: mysql driver-class-name: com.mysql.jdbc.Driver - username: wanggeng -# username: root - password: WenG>2132997 -# password: root +# username: wanggeng + username: root +# password: WenG>2132997 + password: root initial-size: 2 min-idle: 2 max-active: 5 @@ -71,7 +71,7 @@ swagger: # 文件 file: - uploadPath: /Users/wanggeng/Desktop/UploadFiles/ + uploadPath: C:\Users\wenc0\Desktop\UploadFiles\ imageTypes: png,jpg,jpeg,gif,blob videoTypes: mp4,rmvb audioTypes: mp3,wmv @@ -81,13 +81,13 @@ file: # 安全 security: oauth2: - oauth-server: http://192.168.0.103:7001/usercenter + oauth-server: http://192.168.0.101:7001/usercenter oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url} client: - client-id: 44a8dc867f7f4465b7ba6065d87e30d7 -# client-id: 32ec344a5fd04fd9911586df5d1dc36b - client-secret: bTRCTEw1TEZkL284bVhLOXJ2NDYrSUlGdU1DSlNGaGdLTWhEb1l1VHZHMG1ac2wwZTJHWk5NbXh3L3h3U2c4Rg== -# client-secret: a2NORTAyZmthdTNtVHNwLytGVVo0ckFhNktHQU9JWVFmUks0TGw5L2hQRW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg== +# client-id: 44a8dc867f7f4465b7ba6065d87e30d7 + client-id: 32ec344a5fd04fd9911586df5d1dc36b +# client-secret: bTRCTEw1TEZkL284bVhLOXJ2NDYrSUlGdU1DSlNGaGdLTWhEb1l1VHZHMG1ac2wwZTJHWk5NbXh3L3h3U2c4Rg== + client-secret: a2NORTAyZmthdTNtVHNwLytGVVo0ckFhNktHQU9JWVFmUks0TGw5L2hQRW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg== user-authorization-uri: ${security.oauth2.oauth-server}/oauth_client/authorize access-token-uri: ${security.oauth2.oauth-server}/oauth_client/token grant-type: authorization_code