Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 10 months ago
parent
commit
8456ba65d8
  1. 1
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarEntity.java
  2. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DeviceEntity.java
  3. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java
  4. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/DeviceController.java
  5. 32
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java
  6. 53
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/DeviceJob.java
  7. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml
  8. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml
  9. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java
  10. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java
  11. 5
      hzims-service/safeproduct/src/main/resources/db/1.0.2.sql
  12. BIN
      hzims-service/safeproduct/src/main/resources/template/卫生自查表.docx
  13. BIN
      hzims-service/safeproduct/src/main/resources/template/车辆维保记录单.docx

1
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarEntity.java

@ -88,7 +88,6 @@ public class CarEntity extends BaseEntity {
@ApiModelProperty("保养状态") @ApiModelProperty("保养状态")
private String maintenanceStatus; private String maintenanceStatus;
@NotNull
@ApiModelProperty("车辆管理人id") @ApiModelProperty("车辆管理人id")
private Long managerId; private Long managerId;

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DeviceEntity.java

@ -58,6 +58,9 @@ public class DeviceEntity extends BaseEntity {
@ApiModelProperty("上次检验日期") @ApiModelProperty("上次检验日期")
private Date inspectionLastTime; private Date inspectionLastTime;
@ApiModelProperty("设备管理人id")
private Long managerId;
@Size(max = 50, message = "设备管理人长度不能超过50") @Size(max = 50, message = "设备管理人长度不能超过50")
@ApiModelProperty("设备管理人") @ApiModelProperty("设备管理人")
private String manager; private String manager;

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java

@ -24,6 +24,9 @@ public class HygieneRecordDetailVO {
@ApiModelProperty("检查人") @ApiModelProperty("检查人")
private String checkUser; private String checkUser;
@ApiModelProperty("检查时间")
private Date checkTime;
@ApiModelProperty("责任区id") @ApiModelProperty("责任区id")
private String hygieneZoneIds; private String hygieneZoneIds;

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/DeviceController.java

@ -43,7 +43,7 @@ public class DeviceController extends BladeController {
@PostMapping("/update") @PostMapping("/update")
@ApiOperation(value = "修改") @ApiOperation(value = "修改")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
public R update(DeviceEntity deviceEntity) { public R update(@Valid @RequestBody DeviceEntity deviceEntity) {
return R.status(deviceService.updateById(deviceEntity)); return R.status(deviceService.updateById(deviceEntity));
} }
@ -63,8 +63,8 @@ public class DeviceController extends BladeController {
@GetMapping("/page") @GetMapping("/page")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "name", value = "设备名称", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "plateNumber", value = "车牌号", dataType = "query", paramType = "string") @ApiImplicitParam(name = "deviceStatus", value = "设备状态", dataType = "query", paramType = "string")
}) })
@ApiOperation(value = "分页") @ApiOperation(value = "分页")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)

32
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java

@ -12,9 +12,13 @@ import com.hnac.hzims.safeproduct.service.ICarMaintenanceService;
import com.hnac.hzims.safeproduct.service.ICarService; import com.hnac.hzims.safeproduct.service.ICarService;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -29,6 +33,7 @@ import java.util.List;
* @author liwen * @author liwen
* @date 2024-01-11 * @date 2024-01-11
*/ */
@Slf4j
@Component @Component
public class CarJob { public class CarJob {
@ -44,6 +49,9 @@ public class CarJob {
@Autowired @Autowired
ISysClient sysClient; ISysClient sysClient;
@Autowired
IUserClient userClient;
/** /**
* 车辆台账自动变更 * 车辆台账自动变更
*/ */
@ -92,10 +100,16 @@ public class CarJob {
* @param carEntity 车辆实体类 * @param carEntity 车辆实体类
*/ */
private void sendUninsuredMessage(CarEntity carEntity) { private void sendUninsuredMessage(CarEntity carEntity) {
if (carEntity.getManagerId() == null) {
log.error("系统无该用户信息,推送车保过期消息失败");
return;
}
// 查询用户
R<User> userRes = userClient.userInfoById(carEntity.getManagerId());
User user = userRes.getData();
BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO();
String deptId = AuthUtil.getDeptId(); if (StringUtils.isNotEmpty(user.getDeptId())) {
if (StringUtils.isNotEmpty(deptId)) { Long id = Long.valueOf(user.getDeptId());
Long id = Long.valueOf(deptId);
businessMessageDTO.setDeptId(id); businessMessageDTO.setDeptId(id);
businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData()); businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData());
businessMessageDTO.setBusinessKey("车保到期"); businessMessageDTO.setBusinessKey("车保到期");
@ -115,10 +129,16 @@ public class CarJob {
* @param carEntity 车辆实体类 * @param carEntity 车辆实体类
*/ */
private void sendUnMaintainedMessage(CarEntity carEntity) { private void sendUnMaintainedMessage(CarEntity carEntity) {
if (carEntity.getManagerId() == null) {
log.error("系统无该用户信息,推送维保过期消息失败");
return;
}
// 查询用户
R<User> userRes = userClient.userInfoById(carEntity.getManagerId());
User user = userRes.getData();
BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO();
String deptId = AuthUtil.getDeptId(); if (StringUtils.isNotEmpty(user.getDeptId())) {
if (StringUtils.isNotEmpty(deptId)) { Long id = Long.valueOf(user.getDeptId());
Long id = Long.valueOf(deptId);
businessMessageDTO.setDeptId(id); businessMessageDTO.setDeptId(id);
businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData()); businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData());
businessMessageDTO.setBusinessKey("维保到期"); businessMessageDTO.setBusinessKey("维保到期");

53
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/DeviceJob.java

@ -1,11 +1,20 @@
package com.hnac.hzims.safeproduct.jobs; package com.hnac.hzims.safeproduct.jobs;
import com.hnac.hzims.common.constant.CommonConstant;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.safeproduct.entity.DeviceEntity; import com.hnac.hzims.safeproduct.entity.DeviceEntity;
import com.hnac.hzims.safeproduct.enums.DeviceStatusEnum; import com.hnac.hzims.safeproduct.enums.DeviceStatusEnum;
import com.hnac.hzims.safeproduct.service.IDeviceService; import com.hnac.hzims.safeproduct.service.IDeviceService;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -19,12 +28,22 @@ import java.util.List;
* @author liwen * @author liwen
* @date 2024-01-16 * @date 2024-01-16
*/ */
@Slf4j
@Component @Component
public class DeviceJob { public class DeviceJob {
@Autowired @Autowired
IDeviceService deviceService; IDeviceService deviceService;
@Autowired
IUserClient userClient;
@Autowired
ISysClient sysClient;
@Autowired
IMessageClient messageClient;
@XxlJob("autoChangeDeviceStatus") @XxlJob("autoChangeDeviceStatus")
public ReturnT<String> autoChangeDeviceStatus(String param) { public ReturnT<String> autoChangeDeviceStatus(String param) {
// 获取时间范围 // 获取时间范围
@ -37,9 +56,41 @@ public class DeviceJob {
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return ReturnT.SUCCESS; return ReturnT.SUCCESS;
} }
list.forEach(e -> e.setDeviceStatus(DeviceStatusEnum.EXPIRED.getValue())); list.forEach(device -> {
device.setDeviceStatus(DeviceStatusEnum.EXPIRED.getValue());
sendExpiredMessage(device);
});
// 更新状态 // 更新状态
boolean update = deviceService.updateBatchById(list); boolean update = deviceService.updateBatchById(list);
return update ? ReturnT.SUCCESS : ReturnT.FAIL; return update ? ReturnT.SUCCESS : ReturnT.FAIL;
} }
/**
* 推送设备过期消息
* @param deviceEntity 特种设备实体类
*/
private void sendExpiredMessage(DeviceEntity deviceEntity) {
if (deviceEntity.getManagerId() == null) {
log.error("系统无该用户信息,推送设备过期消息失败");
return;
}
// 查询用户
R<User> userRes = userClient.userInfoById(deviceEntity.getManagerId());
User user = userRes.getData();
BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO();
if (StringUtils.isNotEmpty(user.getDeptId())) {
Long id = Long.valueOf(user.getDeptId());
businessMessageDTO.setDeptId(id);
businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData());
businessMessageDTO.setBusinessKey("设备到期");
businessMessageDTO.setBusinessClassify("system");
businessMessageDTO.setTaskId(deviceEntity.getId());
businessMessageDTO.setSubject("设备到期通知");
businessMessageDTO.setContent("您所管理的特种设备" + deviceEntity.getName() + "已到期,请尽快进行检验。");
businessMessageDTO.setUserIds(String.valueOf(deviceEntity.getManagerId()));
businessMessageDTO.setCreateUser(deviceEntity.getCreateUser());
businessMessageDTO.setTenantId(CommonConstant.TENANT_ID);
}
messageClient.sendAppAndWsMsgByUsers(businessMessageDTO);
}
} }

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml

@ -5,7 +5,7 @@
<select id="getCarMaintenance" resultType="com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailVO"> <select id="getCarMaintenance" resultType="com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailVO">
SELECT SELECT
t1.code, t1.start_time, t1.end_time, t1.location, t1.cost, t1.maintainer, t1.content, t1.img_path, t1.file_path, t1.code, t1.start_time, t1.end_time, t1.location, t1.cost, t1.maintainer, t1.content, t1.img_path, t1.file_path,
t1.manager_advice, t1.confirmation_time, t2.plate_number, t2.unit, t2.car_brand, t2.car_type, t1.maintanence_type t1.manager_advice, t1.confirmation_time, t2.plate_number, t2.unit, t2.car_brand, t2.car_type, t1.maintenance_type
FROM FROM
hzims_car_maintenance t1 hzims_car_maintenance t1
LEFT JOIN hzims_car t2 ON t1.car_id = t2.id LEFT JOIN hzims_car t2 ON t1.car_id = t2.id

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml

@ -4,7 +4,7 @@
<select id="getRecordDetail" resultType="com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO"> <select id="getRecordDetail" resultType="com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO">
SELECT SELECT
code, actual_end_time, check_user, hygiene_zone_ids, check_result,comprehensive_score, week_num, code, actual_end_time, check_user, hygiene_zone_ids, check_result,comprehensive_score, week_num,
img_path, hygiene_plan_id img_path, hygiene_plan_id, check_time
FROM FROM
hzims_hygiene_record hzims_hygiene_record
WHERE WHERE

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java

@ -99,7 +99,7 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
// 若确认成功,更新台账相关信息 // 若确认成功,更新台账相关信息
if (update) { if (update) {
CarEntity carEntity = carService.getById(carMaintenanceEntity.getCarId()); CarEntity carEntity = carService.getById(carMaintenanceEntity.getCarId());
carEntity.setMaintenanceLastTime(carMaintenanceEntity.getConfirmationTime()); carEntity.setMaintenanceLastTime(carMaintenanceEntity.getEndTime());
carEntity.setMaintenanceNextTime(confirmationDTO.getMaintenanceNextTime()); carEntity.setMaintenanceNextTime(confirmationDTO.getMaintenanceNextTime());
carEntity.setMaintenanceMileage(confirmationDTO.getMaintenanceMileage()); carEntity.setMaintenanceMileage(confirmationDTO.getMaintenanceMileage());
carEntity.setMaintenanceStatus(CarMaintenanceStatusEnum.MAINTAINED.getValue()); carEntity.setMaintenanceStatus(CarMaintenanceStatusEnum.MAINTAINED.getValue());

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java

@ -10,9 +10,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.dto.CarMilesYearDTO; import com.hnac.hzims.safeproduct.dto.CarMilesYearDTO;
import com.hnac.hzims.safeproduct.dto.RehearsalExportDTO;
import com.hnac.hzims.safeproduct.entity.CarEntity; import com.hnac.hzims.safeproduct.entity.CarEntity;
import com.hnac.hzims.safeproduct.enums.RehearsalStatusEnum; import com.hnac.hzims.safeproduct.enums.CarMaintenanceStatusEnum;
import com.hnac.hzims.safeproduct.mapper.CarMapper; import com.hnac.hzims.safeproduct.mapper.CarMapper;
import com.hnac.hzims.safeproduct.service.ICarCheckRecordService; import com.hnac.hzims.safeproduct.service.ICarCheckRecordService;
import com.hnac.hzims.safeproduct.service.ICarMaintenanceService; import com.hnac.hzims.safeproduct.service.ICarMaintenanceService;
@ -164,6 +163,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, CarEntity> implements
queryWrapper.lambda().eq(CarEntity::getPlateNumber, carEntity.getPlateNumber()); queryWrapper.lambda().eq(CarEntity::getPlateNumber, carEntity.getPlateNumber());
CarEntity car = this.getOne(queryWrapper); CarEntity car = this.getOne(queryWrapper);
if (car == null) { if (car == null) {
carEntity.setMaintenanceStatus(CarMaintenanceStatusEnum.UNMAINTAINED.getValue());
return R.status(this.save(carEntity)); return R.status(this.save(carEntity));
} }
return R.fail("车牌号已存在"); return R.fail("车牌号已存在");

5
hzims-service/safeproduct/src/main/resources/db/1.0.2.sql

@ -240,7 +240,7 @@ CREATE TABLE `hzims_car` (
`maintenance_next_time` date DEFAULT NULL COMMENT '下期保养时间', `maintenance_next_time` date DEFAULT NULL COMMENT '下期保养时间',
`maintenance_mileage` decimal(10, 2) DEFAULT NULL COMMENT '保养里程', `maintenance_mileage` decimal(10, 2) DEFAULT NULL COMMENT '保养里程',
`maintenance_status` varchar(50) DEFAULT NULL COMMENT '保养状态', `maintenance_status` varchar(50) DEFAULT NULL COMMENT '保养状态',
`manager_id` bigint(20) NOT NULL COMMENT '车辆管理人id', `manager_id` bigint(20) DEFAULT NULL COMMENT '车辆管理人id',
`manager` varchar(50) NOT NULL COMMENT '车辆管理人', `manager` varchar(50) NOT NULL COMMENT '车辆管理人',
`img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '车辆图片', `img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '车辆图片',
`file_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '车辆附件', `file_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '车辆附件',
@ -345,7 +345,7 @@ CREATE TABLE `hzims_device` (
`name` varchar(50) NOT NULL COMMENT '设备名称', `name` varchar(50) NOT NULL COMMENT '设备名称',
`type` varchar(50) NOT NULL DEFAULT '' COMMENT '规格型号', `type` varchar(50) NOT NULL DEFAULT '' COMMENT '规格型号',
`code` varchar(50) NOT NULL COMMENT '编码', `code` varchar(50) NOT NULL COMMENT '编码',
`quality_cerfiticate_no` varchar(255) NOT NULL DEFAULT '' COMMENT '产品合格证号', `quality_certificate_no` varchar(255) NOT NULL DEFAULT '' COMMENT '产品合格证号',
`production_time` date DEFAULT NULL COMMENT '生产日期', `production_time` date DEFAULT NULL COMMENT '生产日期',
`used_time` date DEFAULT NULL COMMENT '使用日期', `used_time` date DEFAULT NULL COMMENT '使用日期',
`used_location` varchar(255) NOT NULL DEFAULT '' COMMENT '使用地点', `used_location` varchar(255) NOT NULL DEFAULT '' COMMENT '使用地点',
@ -353,6 +353,7 @@ CREATE TABLE `hzims_device` (
`inspection_current_time` date DEFAULT NULL COMMENT '本次检验日期', `inspection_current_time` date DEFAULT NULL COMMENT '本次检验日期',
`inspection_next_time` date DEFAULT NULL COMMENT '下次检验日期', `inspection_next_time` date DEFAULT NULL COMMENT '下次检验日期',
`inspection_last_time` date DEFAULT NULL COMMENT '上次检验日期', `inspection_last_time` date DEFAULT NULL COMMENT '上次检验日期',
`manager_id` bigint(20) DEFAULT NULL COMMENT '设备管理人id',
`manager` varchar(50) NOT NULL DEFAULT '' COMMENT '设备管理人', `manager` varchar(50) NOT NULL DEFAULT '' COMMENT '设备管理人',
`device_status` varchar(20) NOT NULL DEFAULT 'NORMAL' COMMENT '设备状态', `device_status` varchar(20) NOT NULL DEFAULT 'NORMAL' COMMENT '设备状态',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',

BIN
hzims-service/safeproduct/src/main/resources/template/卫生自查表.docx

Binary file not shown.

BIN
hzims-service/safeproduct/src/main/resources/template/车辆维保记录单.docx

Binary file not shown.
Loading…
Cancel
Save