From 3f0e049e33e948c6b4cf7b040e6ad24a09b95372 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 27 May 2024 09:23:50 +0800 Subject: [PATCH 1/7] =?UTF-8?q?#=E5=A4=A7=E6=A8=A1=E5=9E=8B=E5=8F=91?= =?UTF-8?q?=E7=94=B5=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java index 88fc4f4..9cf07ec 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java @@ -258,7 +258,7 @@ public class GenerateServiceImpl extends BaseServiceImpl 0){ entity.setId(null); entity.setFillDate(DateUtil.format(start,DateUtil.PATTERN_DATE)); - entity.setGenerate((random.nextDouble() * 10000) + 50000); + entity.setGenerate((random.nextDouble() * 2800) + 12000); this.save(entity); calendar.add(Calendar.DAY_OF_MONTH,1); start = calendar.getTime(); From afbab4cc47234542f80f6a0e24717f946e377a20 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 27 May 2024 14:45:51 +0800 Subject: [PATCH 2/7] =?UTF-8?q?#=E5=A1=AB=E6=8A=A5=E5=8F=91=E7=94=B5?= =?UTF-8?q?=E9=87=8F=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/operational/fill/feign/GenerateClient.java | 5 ++++- .../hzims/operational/fill/service/impl/GenerateServiceImpl.java | 2 +- .../hzims/operational/main/service/impl/HydropowerServiceImpl.java | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/feign/GenerateClient.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/feign/GenerateClient.java index a017445..22030a1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/feign/GenerateClient.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/feign/GenerateClient.java @@ -6,10 +6,12 @@ import com.hnac.hzims.operational.fill.service.GenerateService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.util.Date; import java.util.List; @@ -28,9 +30,10 @@ public class GenerateClient implements IGenerateClient { public Double stationGenerateByTime(@RequestParam("stationId") String stationId, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) { + Date start = DateUtil.parse(startTime,DateUtil.PATTERN_DATETIME); List generates = generateService.list(Wrappers.lambdaQuery() .eq(GenerateEntity::getStationCode,stationId) - .ge(GenerateEntity::getFillDate,startTime) + .ge(GenerateEntity::getFillDate,DateUtil.format(start,DateUtil.PATTERN_DATE)) .le(GenerateEntity::getFillDate,endTime) ); if(CollectionUtil.isEmpty(generates)){ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java index 9cf07ec..b3141e0 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java @@ -258,7 +258,7 @@ public class GenerateServiceImpl extends BaseServiceImpl 0){ entity.setId(null); entity.setFillDate(DateUtil.format(start,DateUtil.PATTERN_DATE)); - entity.setGenerate((random.nextDouble() * 2800) + 12000); + entity.setGenerate((random.nextDouble() * 1360) + 19000); this.save(entity); calendar.add(Calendar.DAY_OF_MONTH,1); start = calendar.getTime(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index cba31a3..98d399a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java @@ -631,6 +631,8 @@ public class HydropowerServiceImpl implements HydropowerService { // 年发电量 kpi.setGenerateYear(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum()); // 月发电量 + + kpi.setGenerateMon(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum()); // 日发电量 kpi.setGenerateDay(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerDay).sum()); From c8dcd995023c2c8448a92835e098faec36f66f8c Mon Sep 17 00:00:00 2001 From: liwen Date: Mon, 27 May 2024 16:36:34 +0800 Subject: [PATCH 3/7] =?UTF-8?q?update:=20=E5=8D=AB=E7=94=9F=E8=87=AA?= =?UTF-8?q?=E6=9F=A5=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/HygieneTemplateDetailEntity.java | 8 ++++ .../safeproduct/controller/HygieneController.java | 4 +- .../service/IHygieneTemplateDetailService.java | 7 ++++ .../service/IHygieneTemplateService.java | 7 ++++ .../service/impl/HygienePlanServiceImpl.java | 43 +++++++++------------- .../impl/HygieneTemplateDetailServiceImpl.java | 13 +++++++ .../service/impl/HygieneTemplateServiceImpl.java | 33 ++++++++++++++++- .../com/hnac/hzims/safeproduct/utils/BaseUtil.java | 18 +++++++++ .../safeproduct/src/main/resources/db/2.0.1.sql | 4 +- 9 files changed, 107 insertions(+), 30 deletions(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateDetailEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateDetailEntity.java index 9fe501f..3f3ff43 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateDetailEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateDetailEntity.java @@ -25,6 +25,14 @@ public class HygieneTemplateDetailEntity extends BaseEntity { @ApiModelProperty("责任区") private String zone; + @Size(max = 20, message = "责任人字段长度不能超过20") + @ApiModelProperty("责任人") + private String principal; + @ApiModelProperty("检查项") private String checkItem; + + @Size(max = 255, message = "检查项分值字段长度不能超过255") + @ApiModelProperty("检查项分值") + private String checkItemScore; } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java index e6c0c3e..fe2739c 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java @@ -218,7 +218,7 @@ public class HygieneController extends BladeController { @ApiOperation(value = "卫生自查模板详情") @ApiOperationSupport(order = 18) @Operate(label = "卫生自查模板详情", type = BusinessType.QUERY, ignore = false) - public R hygieneTemplateDetail(@RequestParam Long id) { + public R hygieneTemplateDetail(@RequestParam Long id) { HygieneTemplateDetailVO detail = hygieneTemplateService.getHygieneTemplateDetail(id); return R.data(detail); } @@ -227,7 +227,7 @@ public class HygieneController extends BladeController { @ApiOperation(value = "卫生自查模板分页") @ApiOperationSupport(order = 19) @Operate(label = "卫生自查模板分页", type = BusinessType.QUERY, ignore = false) - public R hygieneTemplatePage(@ApiIgnore @RequestParam Map param, Query query) { + public R> hygieneTemplatePage(@ApiIgnore @RequestParam Map param, Query query) { IPage page = hygieneTemplateService.page(Condition.getPage(query), Condition.getQueryWrapper( param, HygieneTemplateEntity.class)); return R.data(page); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateDetailService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateDetailService.java index de71dad..463b0b5 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateDetailService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateDetailService.java @@ -18,4 +18,11 @@ public interface IHygieneTemplateDetailService extends IService getListByTemplateId(Long templateId); + + /** + * 删除关联模板详情数据 + * @param templateId 模板id + * @return true-成功,false-失败 + */ + boolean removeReferenceDetail(Long templateId); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java index 71493f9..5f45e16 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java @@ -39,4 +39,11 @@ public interface IHygieneTemplateService extends IService * @return 详情 */ HygieneTemplateDetailVO getHygieneTemplateDetail(Long id); + + /** + * 根据模板名获取模板 + * @param name 模板名 + * @return 模板实体类 + */ + HygieneTemplateEntity getHygieneTemplateByName(String name); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java index 2c3b176..fb4a3d3 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java @@ -18,6 +18,7 @@ import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper; import com.hnac.hzims.safeproduct.service.IHygienePlanService; import com.hnac.hzims.safeproduct.service.IHygieneRecordService; import com.hnac.hzims.safeproduct.service.IHygieneZoneService; +import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.HygienePlanDetailVO; import com.hnac.hzims.safeproduct.vo.HygieneMonthVO; import org.springblade.core.log.exception.ServiceException; @@ -126,7 +127,7 @@ public class HygienePlanServiceImpl extends ServiceImpl zoneList = hygienePlanDTO.getZoneList(); // 若计划修改成功,修改关联责任区数据 if (updatePlan) { - for (HygieneZoneEntity zone : zoneList) { - String[] scores = zone.getCheckItemScore().split(",|,"); - // 校验检查项总成绩是否为标准总成绩 - getSumScore(scores, hygienePlanDTO.getStandardScore()); + // 删除旧数据 + boolean removeZone = hygieneZoneService.removeReferenceZone(hygienePlanDTO.getId()); + if (removeZone) { + hygienePlan = getPlanByName(hygienePlanDTO.getName()); + // 增加新数据 + for (HygieneZoneEntity zone : zoneList) { + // 传计划id + if (hygienePlan != null) { + zone.setHygienePlanId(hygienePlan.getId()); + } + String[] scores = zone.getCheckItemScore().split(",|,"); + // 校验检查项总成绩是否为标准总成绩 + BaseUtil.getSumScore(scores, hygienePlanDTO.getStandardScore()); + } + // 校验通过则批量修改责任区数据 + return R.status(hygieneZoneService.saveBatch(zoneList)); } - // 校验通过则批量修改责任区数据 - return R.status(hygieneZoneService.updateBatchById(zoneList)); } return R.status(Boolean.FALSE); } @@ -210,24 +221,6 @@ public class HygienePlanServiceImpl extends ServiceImpl standardScore) { - throw new ServiceException("累计分值超过标准总分值"); - } - } - if (sum < standardScore) { - throw new ServiceException("标准总分值未全部分配"); - } - } - - /** * 根据编码查询卫生自查计划 */ @Override diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateDetailServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateDetailServiceImpl.java index 3ea4851..8df4088 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateDetailServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateDetailServiceImpl.java @@ -8,6 +8,7 @@ import com.hnac.hzims.safeproduct.service.IHygieneTemplateDetailService; import org.springframework.stereotype.Service; import java.util.List; +import java.util.stream.Collectors; /** * 卫生自查模板详情服务实现类 @@ -27,4 +28,16 @@ public class HygieneTemplateDetailServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(HygieneTemplateDetailEntity::getTemplateId, templateId); + List list = this.list(queryWrapper); + List ids = list.stream().map(HygieneTemplateDetailEntity::getId).collect(Collectors.toList()); + return this.removeByIds(ids); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java index efceb94..55f66bb 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java @@ -8,6 +8,7 @@ import com.hnac.hzims.safeproduct.entity.HygieneTemplateEntity; import com.hnac.hzims.safeproduct.mapper.HygieneTemplateMapper; import com.hnac.hzims.safeproduct.service.IHygieneTemplateDetailService; import com.hnac.hzims.safeproduct.service.IHygieneTemplateService; +import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.HygieneTemplateDetailVO; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.utils.CollectionUtil; @@ -49,6 +50,15 @@ public class HygieneTemplateServiceImpl extends ServiceImpl detailList = hygieneTemplateDTO.getTemplateDetailList(); + detailList.forEach(detail -> { + detail.setTemplateId(hygieneTemplateEntity.getId()); + String[] scores = detail.getCheckItemScore().split(",|,"); + // 校验检查项总成绩是否为标准总成绩 + BaseUtil.getSumScore(scores, 100); + }); return hygieneTemplateDetailService.saveBatch(hygieneTemplateDTO.getTemplateDetailList()); } @@ -72,9 +82,18 @@ public class HygieneTemplateServiceImpl extends ServiceImpl detailList = hygieneTemplateDTO.getTemplateDetailList(); + for (HygieneTemplateDetailEntity detail : detailList) { + String[] scores = detail.getCheckItemScore().split(",|,"); + BaseUtil.getSumScore(scores, 100); + } + return hygieneTemplateDetailService.saveBatch(detailList); } /** @@ -104,4 +123,14 @@ public class HygieneTemplateServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(HygieneTemplateEntity::getTemplateName, name); + return this.getOne(queryWrapper); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java index da74c7f..76aada7 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java @@ -395,4 +395,22 @@ public class BaseUtil { } return fileName; } + + /** + * 计算累计分值 + * @param scores 各项分值 + * @param standardScore 标准总分值 + */ + public static void getSumScore(String[] scores, Integer standardScore) { + int sum = 0; + for (String score : scores) { + sum += Integer.parseInt(score); + if (sum > standardScore) { + throw new ServiceException("累计分值超过标准总分值"); + } + } + if (sum < standardScore) { + throw new ServiceException("标准总分值未全部分配"); + } + } } diff --git a/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql b/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql index 3730612..9434144 100644 --- a/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql +++ b/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql @@ -31,7 +31,9 @@ CREATE TABLE IF NOT EXISTS `hzims_hygiene_template_detail` ( `id` bigint(20) NOT NULL COMMENT '主键ID', `template_id` bigint(20) NOT NULL COMMENT '模板id', `zone` varchar(50) NOT NULL COMMENT '责任区', - `check_item` mediumtext NOT NULL COMMENT '检查项', + `PRINCIPAL` VARCHAR(20) NOT NULL COMMENT '责任人', + `CHECK_ITEM` MEDIUMTEXT NOT NULL COMMENT '检查项', + `CHECK_ITEM_SCORE` VARCHAR(255) NOT NULL COMMENT '检查项分值', `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', `create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', From 2718da82c99eaf93a605895629bd4aeb82a9ad75 Mon Sep 17 00:00:00 2001 From: liwen Date: Mon, 27 May 2024 16:37:00 +0800 Subject: [PATCH 4/7] =?UTF-8?q?update:=20message=E6=9C=8D=E5=8A=A1pom?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hzims-service/message/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/hzims-service/message/pom.xml b/hzims-service/message/pom.xml index 2dcf390..7f5519f 100644 --- a/hzims-service/message/pom.xml +++ b/hzims-service/message/pom.xml @@ -88,7 +88,6 @@ org.springblade blade-system-api - 5.0.2-SNAPSHOT From bcc6592d3505b1f03d5911b63b48fb4b75007016 Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 28 May 2024 11:24:00 +0800 Subject: [PATCH 5/7] =?UTF-8?q?update:=20=E5=8D=AB=E7=94=9F=E8=87=AA?= =?UTF-8?q?=E6=9F=A5=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safeproduct/mapper/HygienePlanMapper.java | 1 - .../service/impl/HygienePlanServiceImpl.java | 82 ++++++++++------------ .../service/impl/HygieneRecordServiceImpl.java | 14 ++-- .../service/impl/HygieneTemplateServiceImpl.java | 46 ++++++------ .../safeproduct/src/main/resources/db/2.0.1.sql | 6 +- 5 files changed, 75 insertions(+), 74 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java index 946d92b..8170e95 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java @@ -7,7 +7,6 @@ import org.apache.ibatis.annotations.Mapper; import org.springblade.core.datascope.annotation.UserDataAuth; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - /** * 卫生自查计划Mapper类 * diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java index fb4a3d3..4ad0ca5 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java @@ -63,15 +63,16 @@ public class HygienePlanServiceImpl extends ServiceImpl zoneList = hygienePlanDTO.getZoneList(); - // 若计划新增成功,新增关联责任区数据 - if (savePlan) { - hygienePlan = getPlanByName(hygienePlanDTO.getName()); - for (HygieneZoneEntity zone : zoneList) { - // 传计划id - if (hygienePlan != null) { - zone.setHygienePlanId(hygienePlan.getId()); - } - String[] scores = zone.getCheckItemScore().split(",|,"); - // 校验检查项总成绩是否为标准总成绩 - BaseUtil.getSumScore(scores, hygienePlanDTO.getStandardScore()); - } - // 校验通过则批量新增责任区数据 - return R.status(hygieneZoneService.saveBatch(zoneList)); + hygienePlan = getPlanByName(hygienePlanDTO.getName()); + for (HygieneZoneEntity zone : zoneList) { + zone.setHygienePlanId(hygienePlan.getId()); + String[] scores = zone.getCheckItemScore().split(",|,"); + // 校验检查项总成绩是否为标准总成绩 + BaseUtil.getSumScore(scores, hygienePlanDTO.getStandardScore()); } - return R.status(Boolean.FALSE); + // 校验通过则批量新增责任区数据 + return R.status(hygieneZoneService.saveBatch(zoneList)); } /** @@ -153,28 +151,26 @@ public class HygienePlanServiceImpl extends ServiceImpl zoneList = hygienePlanDTO.getZoneList(); - // 若计划修改成功,修改关联责任区数据 - if (updatePlan) { - // 删除旧数据 - boolean removeZone = hygieneZoneService.removeReferenceZone(hygienePlanDTO.getId()); - if (removeZone) { - hygienePlan = getPlanByName(hygienePlanDTO.getName()); - // 增加新数据 - for (HygieneZoneEntity zone : zoneList) { - // 传计划id - if (hygienePlan != null) { - zone.setHygienePlanId(hygienePlan.getId()); - } - String[] scores = zone.getCheckItemScore().split(",|,"); - // 校验检查项总成绩是否为标准总成绩 - BaseUtil.getSumScore(scores, hygienePlanDTO.getStandardScore()); - } - // 校验通过则批量修改责任区数据 - return R.status(hygieneZoneService.saveBatch(zoneList)); - } + // 删除旧的责任区数据 + boolean removeZone = hygieneZoneService.removeReferenceZone(hygienePlanDTO.getId()); + if (!removeZone) { + throw new ServiceException("删除旧的责任区数据失败"); + } + // 新增新的责任区数据 + hygienePlan = getPlanByName(hygienePlanDTO.getName()); + for (HygieneZoneEntity zone : zoneList) { + zone.setHygienePlanId(hygienePlan.getId()); + String[] scores = zone.getCheckItemScore().split(",|,"); + // 校验检查项总成绩是否为标准总成绩 + BaseUtil.getSumScore(scores, hygienePlanDTO.getStandardScore()); } - return R.status(Boolean.FALSE); + // 校验通过则批量修改责任区数据 + return R.status(hygieneZoneService.saveBatch(zoneList)); } /** diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java index 24d3a9f..b38db24 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java @@ -84,9 +84,9 @@ public class HygieneRecordServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().eq(HygieneTemplateEntity::getTemplateName, templateName); - List list = this.list(queryWrapper); - if (CollectionUtil.isNotEmpty(list)) { + // 重名校验 + HygieneTemplateEntity hygieneTemplate = getHygieneTemplateByName(templateName); + if (hygieneTemplate != null) { throw new ServiceException("模板名不可重复"); } - HygieneTemplateEntity hygieneTemplate = new HygieneTemplateEntity(); - hygieneTemplate.setTemplateName(templateName); - boolean saveTemplate = this.save(hygieneTemplate); + // 新增模板 + HygieneTemplateEntity hygieneTemplateEntity = new HygieneTemplateEntity(); + hygieneTemplateEntity.setTemplateName(templateName); + boolean saveTemplate = this.save(hygieneTemplateEntity); if (!saveTemplate) { throw new ServiceException("卫生自查模板新增失败"); } - // 传模板id - HygieneTemplateEntity hygieneTemplateEntity = getHygieneTemplateByName(templateName); + // 新增模板详情 + hygieneTemplate = getHygieneTemplateByName(templateName); List detailList = hygieneTemplateDTO.getTemplateDetailList(); - detailList.forEach(detail -> { - detail.setTemplateId(hygieneTemplateEntity.getId()); + for (HygieneTemplateDetailEntity detail : detailList) { + detail.setTemplateId(hygieneTemplate.getId()); String[] scores = detail.getCheckItemScore().split(",|,"); // 校验检查项总成绩是否为标准总成绩 BaseUtil.getSumScore(scores, 100); - }); - return hygieneTemplateDetailService.saveBatch(hygieneTemplateDTO.getTemplateDetailList()); + } + return hygieneTemplateDetailService.saveBatch(detailList); } /** @@ -70,26 +69,33 @@ public class HygieneTemplateServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(HygieneTemplateEntity::getTemplateName, templateName); queryWrapper.lambda().ne(HygieneTemplateEntity::getId, templateId); - List list = this.list(queryWrapper); - if (CollectionUtil.isNotEmpty(list)) { + HygieneTemplateEntity hygieneTemplate = this.getOne(queryWrapper); + if (hygieneTemplate != null) { throw new ServiceException("模板名不可重复"); } - HygieneTemplateEntity hygieneTemplate = new HygieneTemplateEntity(); - hygieneTemplate.setId(templateId); - hygieneTemplate.setTemplateName(templateName); - boolean updateTemplate = this.updateById(hygieneTemplate); + // 更新模板 + HygieneTemplateEntity hygieneTemplateEntity = new HygieneTemplateEntity(); + hygieneTemplateEntity.setId(templateId); + hygieneTemplateEntity.setTemplateName(templateName); + boolean updateTemplate = this.updateById(hygieneTemplateEntity); if (!updateTemplate) { throw new ServiceException("卫生自查模板更新失败"); } + // 更新模板详情 + // 删除旧的模板详情数据 boolean removeDetail = hygieneTemplateDetailService.removeReferenceDetail(templateId); if (!removeDetail) { throw new ServiceException("卫生自查模板详情数据删除失败"); } + // 新增新的模板详情数据 + hygieneTemplate = getHygieneTemplateByName(templateName); List detailList = hygieneTemplateDTO.getTemplateDetailList(); for (HygieneTemplateDetailEntity detail : detailList) { + detail.setTemplateId(hygieneTemplate.getId()); String[] scores = detail.getCheckItemScore().split(",|,"); BaseUtil.getSumScore(scores, 100); } diff --git a/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql b/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql index 9434144..26bf967 100644 --- a/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql +++ b/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql @@ -31,9 +31,9 @@ CREATE TABLE IF NOT EXISTS `hzims_hygiene_template_detail` ( `id` bigint(20) NOT NULL COMMENT '主键ID', `template_id` bigint(20) NOT NULL COMMENT '模板id', `zone` varchar(50) NOT NULL COMMENT '责任区', - `PRINCIPAL` VARCHAR(20) NOT NULL COMMENT '责任人', - `CHECK_ITEM` MEDIUMTEXT NOT NULL COMMENT '检查项', - `CHECK_ITEM_SCORE` VARCHAR(255) NOT NULL COMMENT '检查项分值', + `prinicipal` varchar(20) NOT NULL COMMENT '责任人', + `check_item` mediumtext NOT NULL COMMENT '检查项', + `check_item_score` varchar(255) NOT NULL COMMENT '检查项分值', `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', `create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', From ced0ef786787bbcaa52ff6efc03e644ae9ccdff4 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Tue, 28 May 2024 15:07:29 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E7=BA=BF?= =?UTF-8?q?=E4=B8=8B=E6=93=8D=E4=BD=9C=E7=A5=A8=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../process/constant/TicketProcessConstant.java | 4 ++ .../entity/StandardTicketInfoEntity.java | 10 +++ .../OfflineOperationTicketProcessServiceImpl.java | 72 ++++++++++++++++++++++ .../hzims-middle/src/main/resources/db/3.0.0.sql | 1 + .../controller/OperationTicketController.java | 17 ++++- .../service/OperationTicketService.java | 3 +- .../service/impl/OperationTicketServiceImpl.java | 11 +++- .../vo/operation/StandardTicketInfoVo.java | 12 ++++ .../ticket/src/main/resources/db/2.0.3.sql | 6 ++ 9 files changed, 130 insertions(+), 6 deletions(-) create mode 100644 hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OfflineOperationTicketProcessServiceImpl.java create mode 100644 hzims-service/hzims-middle/src/main/resources/db/3.0.0.sql create mode 100644 hzims-service/ticket/src/main/resources/db/2.0.3.sql diff --git a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java index d0b79d3..b7ce6c8 100644 --- a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java +++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java @@ -74,4 +74,8 @@ public class TicketProcessConstant { * 风险排查标识 */ public static final String HAZARD_RISK = "hazard_risk"; + /** + * 线下操作票标识 + */ + public static final String OFFLINE_OPERATION_TICKET = "OperationTicketOffline"; } diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/entity/StandardTicketInfoEntity.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/entity/StandardTicketInfoEntity.java index ade487d..3e49fef 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/entity/StandardTicketInfoEntity.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/entity/StandardTicketInfoEntity.java @@ -162,4 +162,14 @@ public class StandardTicketInfoEntity extends TenantEntity implements Serializab @TableField(exist = false) @ApiModelProperty("监护人确认结果:approved-确认,rejected-作废") private String verifyResult; + + @ApiModelProperty("是否线下 : 1-线下,0-线上") + @QueryField(condition = SqlCondition.EQUAL) + private Boolean isOffline; + + @ApiModelProperty("是否审核通过,0为通过,1为未通过") + private Boolean isApproved; + + @ApiModelProperty("图片附件") + private String picture; } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OfflineOperationTicketProcessServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OfflineOperationTicketProcessServiceImpl.java new file mode 100644 index 0000000..f0a346e --- /dev/null +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OfflineOperationTicketProcessServiceImpl.java @@ -0,0 +1,72 @@ +package com.hnac.hzims.middle.processflow.strategy.serviceimpl; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.processflow.service.ProcessDictService; +import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService; +import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue; +import com.hnac.hzims.ticket.ticketprocess.feign.OperationTicketFeignClient; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springframework.stereotype.Service; + +import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.OFFLINE_OPERATION_TICKET; + + +/** + * 操作票流程实现类 + * + * @Author dfy + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/3/28 8:47 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class OfflineOperationTicketProcessServiceImpl extends ProcessAbstractService { + + + + private final OperationTicketFeignClient operationTicketFeignClient; + + + + private final ProcessDictService processDictService; + + + + /** + * 设置执行那种实现类 + * + * @param flowQueue + * @return + */ + @Override + public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { + log.info("是否执行操作票流程环节操作~~~~,流程flowQueue: {}", flowQueue); + String dictValue = processDictService.selectDictValueByKey(OFFLINE_OPERATION_TICKET); + if (dictValue.equals(flowQueue.getProcessDefinitionKey())) { + log.info("已执行操作票流程环节操作~~~~"); + return true; + } + log.error("未执行操作票流程环节操作,请联系管理员~~~~"); + return false; + } + + /** + * 两票管理业务方法 + * + * @param response + */ + @Override + public void calculate(ProcessWorkFlowResponse response) { + log.info("操作票流程消费调用fein接口开始---param",response); + Boolean pending = operationTicketFeignClient.findPending(response); + if (!pending) { + log.info("操作票流程调用fein接口异常---param",response); + throw new ServiceException("操作票流程出现异常呢"); + } + log.info("操作票流程消费调用fein接口结束---param",response); + } +} diff --git a/hzims-service/hzims-middle/src/main/resources/db/3.0.0.sql b/hzims-service/hzims-middle/src/main/resources/db/3.0.0.sql new file mode 100644 index 0000000..c1ebcf4 --- /dev/null +++ b/hzims-service/hzims-middle/src/main/resources/db/3.0.0.sql @@ -0,0 +1 @@ +INSERT INTO `process_dict`(`dict_code`, `dict_sort`, `dict_key`, `dict_value`, `dict_label`, `dict_type`, `is_default`, `status`, `create_dept`, `create_time`, `update_time`, `remark`) VALUES (15, 15, 'OperationTicketOffline', 'OperationTicketOffline', '线下操作票', '线下操作票', 'Y', 0, NULL, '2023-07-25 18:35:01', '2024-05-24 11:22:14', '线下操作票流程'); diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java index 56cc07f..3c79c22 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java @@ -17,6 +17,9 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.OFFLINE_OPERATION_TICKET; +import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.OPERATION_TICKET_KEY; + /** * 操作票 * @Author WL @@ -45,7 +48,19 @@ public class OperationTicketController { @ApiOperation("启动流程") @PostMapping("/startUp") public R start(@RequestBody StandardTicketInfoVo StandardTicketInfoVo) { - operationTicketService.startUp(StandardTicketInfoVo); + operationTicketService.startUp(StandardTicketInfoVo,OPERATION_TICKET_KEY); + return R.success("申请开票成功"); + } + + /** + * 启动流程 + * + * @return + */ + @ApiOperation("启动线下流程") + @PostMapping("/startOffineOperation") + public R startOffineOperation(@RequestBody StandardTicketInfoVo StandardTicketInfoVo) { + operationTicketService.startUp(StandardTicketInfoVo,OFFLINE_OPERATION_TICKET); return R.success("申请开票成功"); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/OperationTicketService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/OperationTicketService.java index 925f8c5..b45f40f 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/OperationTicketService.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/OperationTicketService.java @@ -19,7 +19,7 @@ public interface OperationTicketService { * 启动流程 * @param standardTicketInfoVo */ - void startUp(StandardTicketInfoVo standardTicketInfoVo); + void startUp(StandardTicketInfoVo standardTicketInfoVo,String dictValueKey); /** @@ -39,5 +39,4 @@ public interface OperationTicketService { - } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java index d0fbf33..5ca66c0 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java @@ -100,7 +100,7 @@ public class OperationTicketServiceImpl implements OperationTicketService { * @param standardTicketInfoVo */ @Override - public void startUp(StandardTicketInfoVo standardTicketInfoVo) { + public void startUp(StandardTicketInfoVo standardTicketInfoVo,String dictValueKey) { log.info("执行 com.hnac.hzims.ticket.standardTicket.service.impl【startUp】 。。。方法"); if (standardTicketInfoVo.getSignage() == null) { throw new ServiceException("票据抬头未配置,请您到站点管理配置"); @@ -134,6 +134,7 @@ public class OperationTicketServiceImpl implements OperationTicketService { String code = processDictFeignService.getTicketByCode(standardTicketInfoVo.getSignage(), this.getTicketWichCode(standardTicketInfoVo.getTicketType())); log.info("获取编码: {}", code); if (StringUtils.isBlank(code)) { + log.error("获取操作票编码异常:"+code); throw new ServiceException("服务器异常,请联系管理员"); } standardTicketInfoVo.setCode(code); @@ -143,9 +144,10 @@ public class OperationTicketServiceImpl implements OperationTicketService { List standardTicketInfoVos = this.saveStandardTicketMeasure(this.saveStandardTicketMeasureWichTicket(standardTicketInfoVo)); standardTicketInfoVo.setStandardTicketMeasureVos(standardTicketInfoVos); //6. 查询第操作票值 - String dictValue = processDictFeignService.selectDictValueByKey(OPERATION_TICKET_KEY); + String dictValue = processDictFeignService.selectDictValueByKey(dictValueKey); log.info("查询第操作票值: {}", dictValue); if (StringUtils.isBlank(dictValue)) { + log.error("查询不到操作票值"); throw new ServiceException("服务器异常,请联系管理员"); } // 7.启动流程 @@ -337,7 +339,9 @@ public class OperationTicketServiceImpl implements OperationTicketService { Map params = new HashMap<>(4); params.put("standardTicketInfoVo", standardTicketInfoVo); params.put("taskId", standardTicketInfoVo.getId()); - params.put("guardianUserIds", "taskUser_".concat(standardTicketInfoVo.getGuardian().toString())); + if(ObjectUtil.isNotEmpty(standardTicketInfoVo.getGuardian())){ + params.put("guardianUserIds", "taskUser_".concat(standardTicketInfoVo.getGuardian().toString())); + } //已开启流程 R processInstanceContainNameByKey = flowClient.startProcessInstanceContainNameByKey(dictValue, String.valueOf(standardTicketInfoVo.getId()), standardTicketInfoVo.getTitle(), params); if (!processInstanceContainNameByKey.isSuccess()) { @@ -434,6 +438,7 @@ public class OperationTicketServiceImpl implements OperationTicketService { boolean save = standardTicketInfoService.save(standardTicketInfo); if (!save) { + log.error("saveStandardTicketInfo failed"); throw new ServiceException("Save failed"); } BeanUtils.copyProperties(standardTicketInfo, standardTicketInfoVo); diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/operation/StandardTicketInfoVo.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/operation/StandardTicketInfoVo.java index e777e6e..cf8e741 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/operation/StandardTicketInfoVo.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/operation/StandardTicketInfoVo.java @@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.mp.support.SqlCondition; import org.springblade.core.tenant.mp.TenantEntity; import org.springframework.format.annotation.DateTimeFormat; @@ -152,4 +154,14 @@ public class StandardTicketInfoVo extends TenantEntity { @ApiModelProperty("安全措施") private List standardTicketMeasureVos; + + @ApiModelProperty("是否线下 : 1-线下,0-线上") + @QueryField(condition = SqlCondition.EQUAL) + private Boolean isOffline; + + @ApiModelProperty("是否审核通过 : 1-通过,0-未通过") + private Boolean isApproved; + + @ApiModelProperty("图片附件") + private String picture; } diff --git a/hzims-service/ticket/src/main/resources/db/2.0.3.sql b/hzims-service/ticket/src/main/resources/db/2.0.3.sql new file mode 100644 index 0000000..755f8ce --- /dev/null +++ b/hzims-service/ticket/src/main/resources/db/2.0.3.sql @@ -0,0 +1,6 @@ +alter table `hzims_standard_ticket_info` add column `is_offline` tinyint(2) default 0 comment '是否线下 : 1-线下,0-线上'; +alter table `hzims_standard_ticket_info` add column `is_approved` tinyint(2) default NULL comment '是否审核通过 : 1-通过,0-未通过'; +alter table `hzims_standard_ticket_info` ADD COLUMN `picture` varchar(600) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片附件' ; +ALTER TABLE `hzims_standard_ticket_info` + MODIFY COLUMN `issue_order_person` bigint(20) NULL COMMENT '发令人' AFTER `code`, + MODIFY COLUMN `access_order_person` bigint(20) NULL COMMENT '受令人' AFTER `issue_order_person`; \ No newline at end of file From b3cbe8b30a68c6b06551a29fa750e70c1a1a157a Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 28 May 2024 16:07:29 +0800 Subject: [PATCH 7/7] =?UTF-8?q?update:=20=E5=8D=AB=E7=94=9F=E8=87=AA?= =?UTF-8?q?=E6=9F=A5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safeproduct/entity/HygieneTemplateEntity.java | 4 +++ .../safeproduct/controller/HygieneController.java | 4 +-- .../safeproduct/mapper/HygieneTemplateMapper.java | 10 +++++++ .../safeproduct/mapper/HygieneTemplateMapper.xml | 13 +++++++++ .../safeproduct/service/IHygieneRecordService.java | 8 ++++++ .../service/IHygieneTemplateService.java | 12 +++++++++ .../service/impl/HygienePlanServiceImpl.java | 29 +++++++++++++++++--- .../service/impl/HygieneRecordServiceImpl.java | 10 +++++++ .../service/impl/HygieneTemplateServiceImpl.java | 31 ++++++++++++++++++++++ 9 files changed, 115 insertions(+), 6 deletions(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateEntity.java index 9a82c8f..9875675 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateEntity.java @@ -1,5 +1,6 @@ package com.hnac.hzims.safeproduct.entity; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -18,4 +19,7 @@ public class HygieneTemplateEntity extends BaseEntity { @ApiModelProperty("模板名称") private String templateName; + + @TableField(exist = false) + private String createDeptName; } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java index fe2739c..8290da9 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java @@ -2,7 +2,6 @@ package com.hnac.hzims.safeproduct.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.safeproduct.Constants; import com.hnac.hzims.safeproduct.dto.HygienePlanDTO; import com.hnac.hzims.safeproduct.dto.HygieneRecordDTO; @@ -228,8 +227,7 @@ public class HygieneController extends BladeController { @ApiOperationSupport(order = 19) @Operate(label = "卫生自查模板分页", type = BusinessType.QUERY, ignore = false) public R> hygieneTemplatePage(@ApiIgnore @RequestParam Map param, Query query) { - IPage page = hygieneTemplateService.page(Condition.getPage(query), Condition.getQueryWrapper( - param, HygieneTemplateEntity.class)); + IPage page = hygieneTemplateService.getHygieneTemplatePage(param, query); return R.data(page); } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.java index 1a76e7c..d5bcf94 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.java @@ -1,9 +1,12 @@ package com.hnac.hzims.safeproduct.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.safeproduct.entity.HygieneTemplateEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.Map; + /** * 卫生自查模板Mapper类 * @@ -12,4 +15,11 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface HygieneTemplateMapper extends BaseMapper { + /** + * 卫生自查页面 + * @param param 参数 + * @param page 分页类 + * @return 页面 + */ + IPage getHygieneTemplatePage(IPage page, Map param); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.xml index 28b08b9..cdb1378 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.xml @@ -1,4 +1,17 @@ + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java index 86d8637..7d050d0 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java @@ -10,6 +10,7 @@ import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import javax.servlet.http.HttpServletResponse; +import java.util.List; import java.util.Map; /** @@ -62,4 +63,11 @@ public interface IHygieneRecordService extends IService { * @param response 响应类 */ void exportHygieneRecordData(Long id, HttpServletResponse response); + + /** + * 查询关联卫生自查记录 + * @param planId 计划id + * @return 记录列表 + */ + List getReferenceRecord(Long planId); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java index 5f45e16..bd908d6 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java @@ -1,9 +1,13 @@ package com.hnac.hzims.safeproduct.service; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.dto.HygieneTemplateDTO; import com.hnac.hzims.safeproduct.entity.HygieneTemplateEntity; import com.hnac.hzims.safeproduct.vo.HygieneTemplateDetailVO; +import org.springblade.core.mp.support.Query; + +import java.util.Map; /** * 卫生自查模板服务类 @@ -46,4 +50,12 @@ public interface IHygieneTemplateService extends IService * @return 模板实体类 */ HygieneTemplateEntity getHygieneTemplateByName(String name); + + /** + * 卫生自查页面 + * @param param 参数 + * @param query 分页类 + * @return 页面 + */ + IPage getHygieneTemplatePage(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java index 4ad0ca5..d0d3b88 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java @@ -7,11 +7,13 @@ import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.safeproduct.dto.HygienePlanDTO; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; +import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity; import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity; import com.hnac.hzims.safeproduct.enums.HygieneStatusEnum; import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper; @@ -39,6 +41,7 @@ import java.net.URLEncoder; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.stream.Collectors; /** * 卫生自查计划服务实现类 @@ -139,9 +142,10 @@ public class HygienePlanServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().ne(HygienePlanEntity::getId, hygienePlanDTO.getId()); + queryWrapper.lambda().ne(HygienePlanEntity::getId, planId); queryWrapper.lambda().eq(HygienePlanEntity::getName, hygienePlanDTO.getName()); HygienePlanEntity hygienePlan = this.getOne(queryWrapper); if (hygienePlan != null) { @@ -157,7 +161,7 @@ public class HygienePlanServiceImpl extends ServiceImpl zoneList = hygienePlanDTO.getZoneList(); // 删除旧的责任区数据 - boolean removeZone = hygieneZoneService.removeReferenceZone(hygienePlanDTO.getId()); + boolean removeZone = hygieneZoneService.removeReferenceZone(planId); if (!removeZone) { throw new ServiceException("删除旧的责任区数据失败"); } @@ -170,7 +174,26 @@ public class HygienePlanServiceImpl extends ServiceImpl recordList = hygieneRecordService.getReferenceRecord(planId); + if (CollectionUtils.isNotEmpty(recordList)) { + List zones = hygieneZoneService.getReferenceZone(planId); + List ids = zones.stream().map(HygieneZoneEntity::getId).collect(Collectors.toList()); + StringBuilder zoneIds = new StringBuilder(); + for (int i = 0; i < ids.size(); i++) { + zoneIds.append(ids.get(i)); + if (i != ids.size() - 1) { + zoneIds.append(","); + } + } + recordList.forEach(record -> record.setHygieneZoneIds(zoneIds.toString())); + return R.status(hygieneRecordService.updateBatchById(recordList)); + } + return R.status(Boolean.TRUE); } /** diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java index b38db24..5392c0a 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java @@ -200,6 +200,16 @@ public class HygieneRecordServiceImpl extends ServiceImpl getReferenceRecord(Long planId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(HygieneRecordEntity::getHygienePlanId, planId); + return this.list(queryWrapper); + } + + /** * 查询是否存在同月编号 * @param currentMonth 当月 * @return 存在则返回上一编号,否则返回null diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java index af8ff3a..f2f99b5 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java @@ -1,6 +1,8 @@ package com.hnac.hzims.safeproduct.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.safeproduct.dto.HygieneTemplateDTO; import com.hnac.hzims.safeproduct.entity.HygieneTemplateDetailEntity; @@ -11,12 +13,17 @@ import com.hnac.hzims.safeproduct.service.IHygieneTemplateService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.HygieneTemplateDetailVO; import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.system.feign.ISysClient; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -30,6 +37,12 @@ public class HygieneTemplateServiceImpl extends ServiceImpl getHygieneTemplatePage(Map param, Query query) { + IPage page = new Page<>(query.getCurrent(), query.getSize()); + IPage templatePage = hygieneTemplateMapper.getHygieneTemplatePage(page, param); + List templateList = templatePage.getRecords(); + templateList.forEach(template -> { + R deptName = sysClient.getDeptName(template.getCreateDept()); + if (deptName.isSuccess()) { + template.setCreateDeptName(deptName.getData()); + } + }); + templatePage.setRecords(templateList); + return templatePage; + } }