From ce21ccdd0f706dec89682f268694ab6d948962c4 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Sun, 10 May 2020 23:13:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=88=91=E7=9A=84=E6=9C=AA?= =?UTF-8?q?=E8=AE=A4=E9=A2=86=E4=BC=81=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...EnterpriseOfGridOperatorAppController.java | 30 ++++- .../IEnterpriseOfGridOperatorDao.java | 18 +++ .../IEnterpriseOfGridOperatorService.java | 18 +++ .../EnterpriseOfGridOperatorServiceImpl.java | 33 +++++ .../gridpersonnel/IGridPersonnelService.java | 8 ++ .../impl/GridPersonnelServiceImpl.java | 7 ++ .../enterpriseofgridoperator-mapper.xml | 115 ++++++++++++++++++ .../gridpersonnel/gridpersonnel-mapper.xml | 4 + 8 files changed, 232 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cm/inspection/controller/app/apis/enterpriseofgridoperator/EnterpriseOfGridOperatorAppController.java b/src/main/java/com/cm/inspection/controller/app/apis/enterpriseofgridoperator/EnterpriseOfGridOperatorAppController.java index 045a325..9264219 100644 --- a/src/main/java/com/cm/inspection/controller/app/apis/enterpriseofgridoperator/EnterpriseOfGridOperatorAppController.java +++ b/src/main/java/com/cm/inspection/controller/app/apis/enterpriseofgridoperator/EnterpriseOfGridOperatorAppController.java @@ -139,7 +139,7 @@ public class EnterpriseOfGridOperatorAppController extends AbstractController { return enterpriseOfGridOperatorService.listPageEnterpriseOfGridOperatorOfMine(token, page); } - @ApiOperation(value = "统计我的企业", notes = "统计我的企业解耦") + @ApiOperation(value = "统计我的企业", notes = "统计我的企业接口") @ApiImplicitParams({ @ApiImplicitParam(name = "token", value = "token", paramType = "header"), }) @@ -167,4 +167,32 @@ public class EnterpriseOfGridOperatorAppController extends AbstractController { return enterpriseOfGridOperatorService.listPageEnterpriseOfGridOperatorByUserId(userId, page); } + // Unclaimed + @ApiOperation(value = "我的未认领企业分页列表", notes = "我的未认领企业分页列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "token", value = "token", paramType = "header"), + @ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"), + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"), + @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"), + @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"), + @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listpageunclaimedenterpriseofmine") + public SuccessResultList> listPageUnclaimedEnterpriseOfMine(@RequestHeader("token") String token, ListPage page) throws SearchException { + Map params = requestParams(); + page.setParams(params); + return enterpriseOfGridOperatorService.listPageUnclaimedEnterpriseOfMine(token, page); + } + + @ApiOperation(value = "统计我的未认领企业", notes = "统计我的未认领企业接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "token", value = "token", paramType = "header"), + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("countunclaimedenterpriseofmine") + public SuccessResultData countUnclaimedEnterpriseOfMine(@RequestHeader("token") String token) { + return enterpriseOfGridOperatorService.countUnclaimedEnterpriseOfMine(token); + } + } \ No newline at end of file diff --git a/src/main/java/com/cm/inspection/dao/enterpriseofgridoperator/IEnterpriseOfGridOperatorDao.java b/src/main/java/com/cm/inspection/dao/enterpriseofgridoperator/IEnterpriseOfGridOperatorDao.java index e06e297..32b85c9 100644 --- a/src/main/java/com/cm/inspection/dao/enterpriseofgridoperator/IEnterpriseOfGridOperatorDao.java +++ b/src/main/java/com/cm/inspection/dao/enterpriseofgridoperator/IEnterpriseOfGridOperatorDao.java @@ -107,4 +107,22 @@ public interface IEnterpriseOfGridOperatorDao { * @throws SearchException */ List listGridPersonnel(Map params) throws SearchException; + + /** + * 未认领企业列表 + * + * @param params + * @return + * @throws SearchException + */ + List listUnclaimedEnterprise(Map params) throws SearchException; + + /** + * 统计未认领企业 + * + * @param params + * @return + * @throws SearchException + */ + Integer countUnclaimedEnterprise(Map params) throws SearchException; } diff --git a/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/IEnterpriseOfGridOperatorService.java b/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/IEnterpriseOfGridOperatorService.java index 5a2ffcb..c98e87e 100644 --- a/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/IEnterpriseOfGridOperatorService.java +++ b/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/IEnterpriseOfGridOperatorService.java @@ -190,4 +190,22 @@ public interface IEnterpriseOfGridOperatorService { */ List listGridPersonnel(Map params) throws SearchException; + /** + * 我的未认领企业分页列表 + * + * @param token + * @param page + * @return + * @throws SearchException + */ + SuccessResultList> listPageUnclaimedEnterpriseOfMine(String token, ListPage page) throws SearchException; + + /** + * 统计我的未认领企业 + * + * @param token + * @return + * @throws SearchException + */ + SuccessResultData countUnclaimedEnterpriseOfMine(String token) throws SearchException; } diff --git a/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/impl/EnterpriseOfGridOperatorServiceImpl.java b/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/impl/EnterpriseOfGridOperatorServiceImpl.java index 88322a2..9697797 100644 --- a/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/impl/EnterpriseOfGridOperatorServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/impl/EnterpriseOfGridOperatorServiceImpl.java @@ -11,6 +11,7 @@ import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; import com.cm.common.token.app.AppTokenManager; import com.cm.common.token.app.entity.AppToken; +import com.cm.common.token.app.entity.AppTokenUser; import com.cm.common.utils.HashMapUtil; import com.cm.common.utils.UUIDUtil; import com.cm.inspection.dao.enterpriseofgridoperator.IEnterpriseOfGridOperatorDao; @@ -19,6 +20,7 @@ import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO; import com.cm.inspection.pojo.vos.enterpriseofgridoperator.EnterpriseOfGridOperatorVO; import com.cm.inspection.service.BaseService; import com.cm.inspection.service.enterpriseofgridoperator.IEnterpriseOfGridOperatorService; +import com.cm.inspection.service.gridpersonnel.IGridPersonnelService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; @@ -41,6 +43,8 @@ public class EnterpriseOfGridOperatorServiceImpl extends BaseService implements private IEnterpriseOfGridOperatorDao enterpriseOfGridOperatorDao; @Autowired private SecurityComponent securityComponent; + @Autowired + private IGridPersonnelService gridPersonnelService; @Override public SuccessResult saveEnterpriseOfGridOperator(EnterpriseOfGridOperatorVO enterpriseOfGridOperatorVO) throws Exception { @@ -219,6 +223,35 @@ public class EnterpriseOfGridOperatorServiceImpl extends BaseService implements return enterpriseOfGridOperatorDao.listGridPersonnel(params); } + @Override + public SuccessResultList> listPageUnclaimedEnterpriseOfMine(String token, ListPage page) throws SearchException { + String userId = AppTokenManager.getInstance().getToken(token).getAppTokenUser().getId(); + GridPersonnelDTO gridPersonnelDTO = gridPersonnelService.getGridPersonnelByUserId(userId); + page.getParams().put("area1", gridPersonnelDTO.getArea1()); + page.getParams().put("area2", gridPersonnelDTO.getArea2()); + page.getParams().put("area3", gridPersonnelDTO.getArea3()); + page.getParams().put("area4", gridPersonnelDTO.getArea4()); + page.getParams().put("area5", gridPersonnelDTO.getArea5()); + PageHelper.startPage(page.getPage(), page.getRows()); + List enterpriseOfGridOperatorDTOs = enterpriseOfGridOperatorDao.listUnclaimedEnterprise(page.getParams()); + PageInfo pageInfo = new PageInfo<>(enterpriseOfGridOperatorDTOs); + return new SuccessResultList<>(enterpriseOfGridOperatorDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); + } + + @Override + public SuccessResultData countUnclaimedEnterpriseOfMine(String token) throws SearchException { + String userId = AppTokenManager.getInstance().getToken(token).getAppTokenUser().getId(); + GridPersonnelDTO gridPersonnelDTO = gridPersonnelService.getGridPersonnelByUserId(userId); + Map params = getHashMap(5); + params.put("area1", gridPersonnelDTO.getArea1()); + params.put("area2", gridPersonnelDTO.getArea2()); + params.put("area3", gridPersonnelDTO.getArea3()); + params.put("area4", gridPersonnelDTO.getArea4()); + params.put("area5", gridPersonnelDTO.getArea5()); + Integer countResult = enterpriseOfGridOperatorDao.countUnclaimedEnterprise(params); + return new SuccessResultData<>(countResult == null ? 0 : countResult); + } + /** * 网格员的企业分页列表(通过用户) * diff --git a/src/main/java/com/cm/inspection/service/gridpersonnel/IGridPersonnelService.java b/src/main/java/com/cm/inspection/service/gridpersonnel/IGridPersonnelService.java index 0601fda..7fe8a30 100644 --- a/src/main/java/com/cm/inspection/service/gridpersonnel/IGridPersonnelService.java +++ b/src/main/java/com/cm/inspection/service/gridpersonnel/IGridPersonnelService.java @@ -147,4 +147,12 @@ public interface IGridPersonnelService { */ SuccessResultData countGridPersonnel(Map params) throws SearchException; + /** + * 网格员详情(通过用户ID) + * + * @param userId + * @return + * @throws SearchException + */ + GridPersonnelDTO getGridPersonnelByUserId(String userId) throws SearchException; } diff --git a/src/main/java/com/cm/inspection/service/gridpersonnel/impl/GridPersonnelServiceImpl.java b/src/main/java/com/cm/inspection/service/gridpersonnel/impl/GridPersonnelServiceImpl.java index 33af446..4edbfda 100644 --- a/src/main/java/com/cm/inspection/service/gridpersonnel/impl/GridPersonnelServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/gridpersonnel/impl/GridPersonnelServiceImpl.java @@ -178,4 +178,11 @@ public class GridPersonnelServiceImpl extends BaseService implements IGridPerson return new SuccessResultData<>(countResult == null ? 0 : countResult); } + @Override + public GridPersonnelDTO getGridPersonnelByUserId(String userId) throws SearchException { + Map params = getHashMap(1); + params.put("userId", userId); + return gridPersonnelDao.getGridPersonnel(params); + } + } diff --git a/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml b/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml index c94c43f..918d236 100644 --- a/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml +++ b/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml @@ -477,4 +477,119 @@ + + + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml b/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml index 978203c..bf3cb1f 100644 --- a/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml +++ b/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml @@ -141,6 +141,10 @@ AND t1.grid_personnel_id = #{gridPersonnelId} + + AND + t1.user_id LIKE CONCAT(#{userId}, '%') +