From d9f77c5f5d08e558bc8250e491bcaf65c3364a8a Mon Sep 17 00:00:00 2001 From: PigBaoBei <2739175034@qq.com> Date: Thu, 25 Jan 2024 13:56:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E6=A0=B8=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/logpm/supervise/api/ClassifyApi.java | 17 ++++++- .../mapper/IndicatorsAnnexMapper.java | 6 +++ .../mapper/IndicatorsAnnexMapper.xml | 3 ++ .../supervise/mapper/IndicatorsMapper.java | 2 +- .../supervise/mapper/IndicatorsMapper.xml | 14 +++--- .../supervise/service/IClassifyService.java | 7 +++ .../service/impl/ClassifyServiceImpl.java | 49 ++++++++++++++++--- 7 files changed, 80 insertions(+), 18 deletions(-) diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/api/ClassifyApi.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/api/ClassifyApi.java index 923f924f6..ac8765a79 100644 --- a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/api/ClassifyApi.java +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/api/ClassifyApi.java @@ -62,12 +62,25 @@ public class ClassifyApi { @GetMapping("/myApiIndicatorsDetail") @ApiOperationSupport(order = 1) @ApiOperation(value = "我的考核列表") - public R myApiIndicatorsDetail(@RequestParam Long Id) { - R r = classifyService.myApiIndicatorsDetail(Id); + public R myApiIndicatorsDetail(@RequestParam Long id) { + R r = classifyService.myApiIndicatorsDetail(id); return r; } + @PostMapping("/updateApiIndicators") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "小程序保存考核内容", notes = "传入classify") + public R updateApiIndicators(@RequestBody IndicatorsDTO instanceofDTO) { + R r = classifyService.updateApiIndicators(instanceofDTO); + return r; + } + + + + + + diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsAnnexMapper.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsAnnexMapper.java index 91c5096d6..5eea3b1a5 100644 --- a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsAnnexMapper.java +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsAnnexMapper.java @@ -12,4 +12,10 @@ public interface IndicatorsAnnexMapper extends BaseMapper List findListByIndicatorsIdAndType(@Param("id") Long id, @Param("type") int type); + + /** + * \进行考核的资源文件删除 + * @param id + */ + void deleteResourceByInstanceoId(@Param("indicatorsId") Long indicatorsId); } diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsAnnexMapper.xml b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsAnnexMapper.xml index 28c3ee5da..8a2aa471d 100644 --- a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsAnnexMapper.xml +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsAnnexMapper.xml @@ -1,6 +1,9 @@ + + DELETE FROM sup_indicators_annex WHERE indicators_id = #{indicatorsId} + diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/IClassifyService.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/IClassifyService.java index aec0c6dec..558c3d38c 100644 --- a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/IClassifyService.java +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/IClassifyService.java @@ -79,4 +79,11 @@ public interface IClassifyService extends BaseService { * @return */ R myApiIndicatorsDetail(Long id); + + /** + * 修改考核详情 + * @param instanceofDTO + * @return + */ + R updateApiIndicators(IndicatorsDTO instanceofDTO); } diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/impl/ClassifyServiceImpl.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/impl/ClassifyServiceImpl.java index a3da9857c..1df3e59c1 100644 --- a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/impl/ClassifyServiceImpl.java +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/impl/ClassifyServiceImpl.java @@ -27,6 +27,7 @@ import com.logpm.supervise.entity.IndicatorsAnnexEntity; import com.logpm.supervise.entity.IndicatorsEntity; import com.logpm.supervise.entity.PointsEntity; import com.logpm.supervise.mapper.ClassifyMapper; +import com.logpm.supervise.mapper.IndicatorsAnnexMapper; import com.logpm.supervise.mapper.IndicatorsMapper; import com.logpm.supervise.service.IClassifyService; import com.logpm.supervise.service.IIndicatorsAnnexService; @@ -66,6 +67,8 @@ public class ClassifyServiceImpl extends BaseServiceImpl> resourceList = instanceofDTO.getResourceList(); - for (Map map : resourceList) { - IndicatorsAnnexEntity indicatorsAnnexEntity = Func.copy(map, IndicatorsAnnexEntity.class); - indicatorsAnnexService.save(indicatorsAnnexEntity); - } + handleResource(resourceList,indicatorsEntity.getId()); + } + return R.status(true); + } + + @Transactional + private void handleResource(List> resourceList, Long id) { + for (Map map : resourceList) { + IndicatorsAnnexEntity indicatorsAnnexEntity = Func.copy(map, IndicatorsAnnexEntity.class); + indicatorsAnnexEntity.setIndicatorsId(id); + indicatorsAnnexService.save(indicatorsAnnexEntity); } - //保存考核内容 - IndicatorsEntity indicatorsEntity = Func.copy(instanceofDTO, IndicatorsEntity.class); - return R.status(iIndicatorsService.save(indicatorsEntity)); } @Override public R selectMyApiIndicators(Map params, IPage page) { Long userId = AuthUtil.getUserId(); + if (Func.isEmpty(userId)){ + return null; + } + params.put("userId",userId); Page indicatorsVOPage = indicatorsMapper.selectMyApiIndicators(page,params); return R.data(indicatorsVOPage); } @@ -223,12 +240,28 @@ public class ClassifyServiceImpl extends BaseServiceImpl annexEntityList = indicatorsAnnexService.list(Wrappers.query().lambda().eq(IndicatorsAnnexEntity::getIndicatorsId, instanceofDTO.getId())); + if (Func.isNotEmpty(annexEntityList)){ + //进行附件文件信息删除 + indicatorsAnnexMapper.deleteResourceByInstanceoId(instanceofDTO.getId()); + } + if (Func.isNotEmpty(instanceofDTO.getResourceList())){ + handleResource(instanceofDTO.getResourceList(), instanceofDTO.getId()); + } + IndicatorsEntity indicatorsEntity = Func.copy(instanceofDTO, IndicatorsEntity.class); + return R.status(iIndicatorsService.updateById(indicatorsEntity)); + } + private List getClassifyList(Long pid) { return baseMapper.selectAllClassifyList(pid); }