Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -76,6 +76,11 @@ public class AutoCreateLubricate {
|
||||
if (num <= 3) {
|
||||
this.createMain(param);
|
||||
}
|
||||
// 周期为周 :当前日期-保养计划日期 <= 1 天时,新增保养单
|
||||
} else if (StrUtil.equals(maintenancecycle,"04")) {
|
||||
if (num <= 1) {
|
||||
this.createMain(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -114,6 +119,11 @@ public class AutoCreateLubricate {
|
||||
if (num >= 3) {
|
||||
this.createMain(param);
|
||||
}
|
||||
// 周期为日 :当前日期-保养实际结束 <= 1 天时,新增保养单
|
||||
} else if (StrUtil.equals(maintenancecycle,"04")) {
|
||||
if (num >= 1) {
|
||||
this.createMain(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,11 @@ public class AutoCreateRepair {
|
||||
if (num <= 3) {
|
||||
this.createRepair(param);
|
||||
}
|
||||
// 周期为日 : 维修计划日期 - 当前日期 <= 1 天时,新增维修单
|
||||
} else if (StrUtil.equals(maintenancecycle,"05")) {
|
||||
if (num <= 1) {
|
||||
this.createRepair(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -122,6 +127,11 @@ public class AutoCreateRepair {
|
||||
if (num >= 3) {
|
||||
this.createRepair(param);
|
||||
}
|
||||
// 周期为日 :当前日期-维修实际结束 <= 1 天时,新增维修单
|
||||
} else if (StrUtil.equals(maintenancecycle,"05")) {
|
||||
if (num >= 1) {
|
||||
this.createRepair(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,10 @@ public class AutoCreateSportCheck {
|
||||
if (num <= 3) {
|
||||
this.createMain(param);
|
||||
}
|
||||
} else if (StrUtil.equals(maintenancecycle,"04")) {
|
||||
if (num <= 1) {
|
||||
this.createMain(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -114,6 +118,10 @@ public class AutoCreateSportCheck {
|
||||
if (num >= 3) {
|
||||
this.createMain(param);
|
||||
}
|
||||
} else if (StrUtil.equals(maintenancecycle,"04")) {
|
||||
if (num >= 1) {
|
||||
this.createMain(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,10 @@ public class AutoCreateUpkeep {
|
||||
if (num <= 3) {
|
||||
this.createMain(param);
|
||||
}
|
||||
} else if (StrUtil.equals(maintenancecycle,"04")) {
|
||||
if (num <= 1) {
|
||||
this.createMain(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -114,6 +118,10 @@ public class AutoCreateUpkeep {
|
||||
if (num >= 3) {
|
||||
this.createMain(param);
|
||||
}
|
||||
} else if (StrUtil.equals(maintenancecycle,"04")) {
|
||||
if (num >= 1) {
|
||||
this.createMain(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,11 @@ public class DevicelubricateplanmstServiceImpl implements Devicelubricateplanmst
|
||||
Date next_end_date = DateUtil.offsetWeek(real_end_date2,1);
|
||||
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
|
||||
ja2.add(jo);
|
||||
}else{
|
||||
}else if (maintenancecycle2.equals("04")) { // 日
|
||||
Date next_end_date = DateUtil.offsetDay(real_end_date2,1);
|
||||
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
|
||||
ja2.add(jo);
|
||||
} else{
|
||||
jo.put("next_end_date","");
|
||||
ja2.add(jo);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,11 @@ public class DevicerepairplanmstServiceImpl implements DevicerepairplanmstServic
|
||||
Date next_end_date = DateUtil.offsetWeek(real_end_date2,1);
|
||||
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
|
||||
ja2.add(jo);
|
||||
}else{
|
||||
}else if (maintenancecycle2.equals("05")) { // 日
|
||||
Date next_end_date = DateUtil.offsetDay(real_end_date2,1);
|
||||
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
|
||||
ja2.add(jo);
|
||||
} else{
|
||||
jo.put("next_end_date","");
|
||||
ja2.add(jo);
|
||||
}
|
||||
|
||||
@@ -100,6 +100,10 @@ public class DevicesportcheckplanmstServiceImpl implements Devicesportcheckplanm
|
||||
Date next_end_date = DateUtil.offsetWeek(real_end_date2,1);
|
||||
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
|
||||
ja2.add(jo);
|
||||
}else if (maintenancecycle2.equals("04")) { // 日
|
||||
Date next_end_date = DateUtil.offsetDay(real_end_date2,1);
|
||||
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
|
||||
ja2.add(jo);
|
||||
}else{
|
||||
jo.put("next_end_date","");
|
||||
ja2.add(jo);
|
||||
|
||||
@@ -100,7 +100,11 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla
|
||||
Date next_end_date = DateUtil.offsetWeek(real_end_date2,1);
|
||||
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
|
||||
ja2.add(jo);
|
||||
}else{
|
||||
} else if (maintenancecycle2.equals("04")) { // 日
|
||||
Date next_end_date = DateUtil.offsetDay(real_end_date2,1);
|
||||
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
|
||||
ja2.add(jo);
|
||||
} else{
|
||||
jo.put("next_end_date","");
|
||||
ja2.add(jo);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
|
||||
package org.nl.wms.masterdata_manage.controller.em;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.jsonwebtoken.lang.Assert;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.device_manage.service.userdevice.dto.DeviceUserQuery;
|
||||
import org.nl.wms.masterdata_manage.service.em.EmBiRepairDeviceService;
|
||||
import org.nl.wms.masterdata_manage.service.em.dao.EmBiRepairDevice;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liu xy
|
||||
* @date 2022-05-26
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "维修人与设备档案维护")
|
||||
@RequestMapping("/api/embirepairdevice")
|
||||
@Slf4j
|
||||
public class EmBiRepairDeviceController {
|
||||
|
||||
@Autowired
|
||||
private EmBiRepairDeviceService emBiRepairDeviceService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询人员设备维护")
|
||||
public ResponseEntity<Object> query(DeviceUserQuery query, PageQuery page){
|
||||
Page<Object> result = PageHelper.startPage(page.getPage() + 1, page.getSize());
|
||||
List<Map> list = emBiRepairDeviceService.queryAll(query);
|
||||
TableDataInfo build = TableDataInfo.build(list);
|
||||
build.setTotalElements(result.getTotal());
|
||||
return new ResponseEntity<>(build,HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/device")
|
||||
@Log("查询设备")
|
||||
//("查询设备")
|
||||
public ResponseEntity<Object> device(DeviceUserQuery query, PageQuery page){
|
||||
Page<Object> result = PageHelper.startPage(page.getPage() + 1, page.getSize());
|
||||
List<Map> list = emBiRepairDeviceService.queryAllDevice(query);
|
||||
TableDataInfo build = TableDataInfo.build(list);
|
||||
build.setTotalElements(result.getTotal());
|
||||
return new ResponseEntity<>(build,HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增人员设备维护")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject entity){
|
||||
Assert.notNull(entity,"请求参数不能为空");
|
||||
|
||||
EmBiRepairDevice one = emBiRepairDeviceService.getOne(
|
||||
new QueryWrapper<EmBiRepairDevice>().lambda()
|
||||
.eq(EmBiRepairDevice::getUser_id, entity.getString("user_id"))
|
||||
.eq(EmBiRepairDevice::getDevice_code, entity.getString("device_code"))
|
||||
);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("设备重复");
|
||||
|
||||
EmBiRepairDevice emBiRepairDevice = entity.toJavaObject(EmBiRepairDevice.class);
|
||||
emBiRepairDevice.setPerson_id(IdUtil.getStringId());
|
||||
emBiRepairDeviceService.save(emBiRepairDevice);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改人员设备维护")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject entity){
|
||||
|
||||
EmBiRepairDevice one = emBiRepairDeviceService.getOne(
|
||||
new QueryWrapper<EmBiRepairDevice>().lambda()
|
||||
.eq(EmBiRepairDevice::getUser_id, entity.getString("user_id"))
|
||||
.eq(EmBiRepairDevice::getDevice_code, entity.getString("device_code"))
|
||||
);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("设备重复");
|
||||
|
||||
EmBiRepairDevice emBiRepairDevice = emBiRepairDeviceService.getById(entity.getString("person_id"));
|
||||
emBiRepairDevice.setDevice_code(entity.getString("device_code"));
|
||||
emBiRepairDeviceService.updateById(emBiRepairDevice);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
|
||||
@Log("删除人员设备维护")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
if (ids != null && ids.length>0){
|
||||
emBiRepairDeviceService.removeByIds(Arrays.asList(ids));
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.nl.wms.masterdata_manage.service.em;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.device_manage.service.userdevice.dto.DeviceUserQuery;
|
||||
import org.nl.wms.masterdata_manage.service.em.dao.EmBiRepairDevice;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 人员设备关系表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
public interface EmBiRepairDeviceService extends IService<EmBiRepairDevice> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
List<Map> queryAll(DeviceUserQuery whereJson);
|
||||
|
||||
List<Map> queryAllDevice(DeviceUserQuery whereJson);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.nl.wms.masterdata_manage.service.em.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 人员设备关系表
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("em_bi_repairpersondevice")
|
||||
public class EmBiRepairDevice implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private String person_id;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String user_id;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.nl.wms.masterdata_manage.service.em.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.device_manage.service.userdevice.dto.DeviceUserQuery;
|
||||
import org.nl.wms.masterdata_manage.service.em.dao.EmBiRepairDevice;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 人员设备关系表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
public interface EmBiRepairDeviceMapper extends BaseMapper<EmBiRepairDevice> {
|
||||
|
||||
List<Map> queryAll(@Param("query") DeviceUserQuery query);
|
||||
|
||||
List<Map> queryAllDevice(@Param("query") DeviceUserQuery query);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.masterdata_manage.service.em.dao.mapper.EmBiRepairDeviceMapper">
|
||||
|
||||
<select id="queryAll" resultType="java.util.Map">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sys_user
|
||||
<where>
|
||||
is_used = '1'
|
||||
<if test="query.username != null and query.username != ''">
|
||||
and username = #{query.username}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryAllDevice" resultType="java.util.Map">
|
||||
SELECT
|
||||
device.device_code,
|
||||
device.device_name,
|
||||
use1.person_name,
|
||||
mps.person_id
|
||||
FROM
|
||||
em_bi_repairpersondevice mps
|
||||
LEFT JOIN em_bi_equipmentfile device ON device.device_code = mps.device_code
|
||||
LEFT JOIN sys_user use1 ON use1.user_id = mps.user_id
|
||||
<where>
|
||||
mps.user_id = #{query.user_id}
|
||||
</where>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.nl.wms.masterdata_manage.service.em.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.wms.device_manage.service.userdevice.dto.DeviceUserQuery;
|
||||
import org.nl.wms.masterdata_manage.service.em.EmBiRepairDeviceService;
|
||||
import org.nl.wms.masterdata_manage.service.em.dao.EmBiRepairDevice;
|
||||
import org.nl.wms.masterdata_manage.service.em.dao.mapper.EmBiRepairDeviceMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 人员设备关系表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
@Service
|
||||
public class EmBiRepairDeviceServiceImpl extends ServiceImpl<EmBiRepairDeviceMapper, EmBiRepairDevice> implements EmBiRepairDeviceService {
|
||||
|
||||
@Override
|
||||
public List<Map> queryAll(DeviceUserQuery query) {
|
||||
return this.baseMapper.queryAll(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> queryAllDevice(DeviceUserQuery query) {
|
||||
return this.baseMapper.queryAllDevice(query);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user