Merge branch 'master' of http://121.40.234.130:8899/zhangdongsheng/yinnihailiang_one
This commit is contained in:
@@ -26,7 +26,7 @@ import org.nl.b_lms.sch.region.service.IschBaseRegionService;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/schBaseRegion")
|
||||
@RequestMapping("/api/region")
|
||||
@Slf4j
|
||||
public class SchBaseRegionController {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SchBaseRegionController {
|
||||
*/
|
||||
@PostMapping
|
||||
@Log("新增区域基础表")
|
||||
public ResponseEntity<Object> create(SchBaseRegion entity) {
|
||||
public ResponseEntity<Object> create(@RequestBody SchBaseRegion entity) {
|
||||
schBaseRegionService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class SchBaseRegionController {
|
||||
@PutMapping
|
||||
@Log("修改区域基础表")
|
||||
//@SaCheckPermission("@el.check(SchBaseRegion:edit')")
|
||||
public ResponseEntity<Object> update(SchBaseRegion entity) {
|
||||
public ResponseEntity<Object> update(@RequestBody SchBaseRegion entity) {
|
||||
schBaseRegionService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.nl.b_lms.sch.region.dao;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -16,10 +14,6 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sch_base_region")
|
||||
public class SchBaseRegion extends Model<SchBaseRegion> {
|
||||
@@ -73,7 +67,7 @@ public class SchBaseRegion extends Model<SchBaseRegion> {
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long create_id;
|
||||
private String create_id;
|
||||
|
||||
|
||||
/**
|
||||
@@ -92,13 +86,13 @@ public class SchBaseRegion extends Model<SchBaseRegion> {
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long update_optid;
|
||||
private String update_id;
|
||||
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optname;
|
||||
private String update_name;
|
||||
|
||||
|
||||
/**
|
||||
@@ -108,16 +102,6 @@ public class SchBaseRegion extends Model<SchBaseRegion> {
|
||||
private String update_time;
|
||||
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.region_id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package org.nl.b_lms.sch.region.service.impl;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.nl.b_lms.sch.region.dao.SchBaseRegion;
|
||||
import org.nl.b_lms.sch.region.dao.mapper.SchBaseRegionMapper;
|
||||
@@ -8,6 +12,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -40,16 +45,14 @@ public class SchBaseRegionServiceImpl extends ServiceImpl<SchBaseRegionMapper, S
|
||||
*/
|
||||
@Override
|
||||
public IPage<SchBaseRegion> queryAll(Map whereJson, PageQuery page) {
|
||||
return schBaseRegionMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()), new QueryWrapper<SchBaseRegion>()
|
||||
.lambda()
|
||||
// .like(StringUtils.isNotBlank(form.name()), User::getName, form.name())
|
||||
// .between(form.beginTime != null && form.endTime != null, User::getCreateTime, beginTime, endTime)
|
||||
// .in(form.Status != null, User::getStatus
|
||||
// , UserStatusEnum.NOT_SUBMITTED
|
||||
// , UserStatusEnum.TO_REVIEWED)
|
||||
// .orderByDesc(User::getId)
|
||||
//.eq(SchBaseRegion::getIs_delete, 0)
|
||||
);
|
||||
String blurry = MapUtil.getStr(whereJson, "region_code");
|
||||
LambdaQueryWrapper<SchBaseRegion> lam = new LambdaQueryWrapper<>();
|
||||
lam.like(ObjectUtil.isNotEmpty(blurry), SchBaseRegion::getRegion_code, blurry)
|
||||
.or(ObjectUtil.isNotEmpty(blurry), la -> la.like(SchBaseRegion::getRegion_name, blurry))
|
||||
.orderByAsc(SchBaseRegion::getRegion_code);
|
||||
IPage<SchBaseRegion> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
schBaseRegionMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,9 +63,19 @@ public class SchBaseRegionServiceImpl extends ServiceImpl<SchBaseRegionMapper, S
|
||||
*/
|
||||
@Override
|
||||
public void create(SchBaseRegion entity) {
|
||||
SchBaseRegion region = getByCode(entity.getRegion_code());
|
||||
if (ObjectUtil.isNotEmpty(region)) {
|
||||
throw new BadRequestException("区域[" + entity.getRegion_code() + "]已存在!");
|
||||
}
|
||||
schBaseRegionMapper.insert(getBasicInfo(entity, true));
|
||||
}
|
||||
|
||||
private SchBaseRegion getByCode(String regionCode) {
|
||||
LambdaQueryWrapper<SchBaseRegion> lam = new LambdaQueryWrapper<>();
|
||||
lam.eq(SchBaseRegion::getRegion_code, regionCode);
|
||||
return this.getOne(lam);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
@@ -71,10 +84,13 @@ public class SchBaseRegionServiceImpl extends ServiceImpl<SchBaseRegionMapper, S
|
||||
*/
|
||||
@Override
|
||||
public void update(SchBaseRegion entity) {
|
||||
// SchBaseRegion dto = schBaseRegionMapper.selectById(entity.getId);
|
||||
// if (dto == null) {
|
||||
// throw new BadRequestException("不存在该数据!");
|
||||
// }
|
||||
SchBaseRegion region = getById(entity.getRegion_id());
|
||||
if (ObjectUtil.isEmpty(region)) {
|
||||
throw new BadRequestException("区域[" + entity.getRegion_code() + "]不存在!");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(region) && !entity.getRegion_id().equals(region.getRegion_id())) {
|
||||
throw new BadRequestException("区域[" + entity.getRegion_code() + "]已存在!");
|
||||
}
|
||||
schBaseRegionMapper.updateById(getBasicInfo(entity, false));
|
||||
}
|
||||
|
||||
@@ -98,14 +114,15 @@ public class SchBaseRegionServiceImpl extends ServiceImpl<SchBaseRegionMapper, S
|
||||
* @param isCreate 是否创建
|
||||
*/
|
||||
private SchBaseRegion getBasicInfo(SchBaseRegion entity, boolean isCreate) {
|
||||
// if (isCreate) {
|
||||
// entity.setCreate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
|
||||
// entity.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
// entity.setCreate_time(DateUtil.now());
|
||||
// }
|
||||
// entity.setUpdate_optid(Long.valueOf(SecurityUtils.getCurrentUserId()));
|
||||
// entity.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
// entity.setUpdate_time(DateUtil.now());
|
||||
if (isCreate) {
|
||||
entity.setRegion_id(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
entity.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
entity.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setCreate_time(DateUtil.now());
|
||||
}
|
||||
entity.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setUpdate_time(DateUtil.now());
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,15 @@ package org.nl.b_lms.sch.task.controller;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.dto.SchBaseTaskQuery;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.wms.sch.manage.FinishTypeEnum;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -26,7 +32,7 @@ import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/schBaseTask")
|
||||
@RequestMapping("/api/task")
|
||||
@Slf4j
|
||||
public class SchBaseTaskController {
|
||||
|
||||
@@ -43,10 +49,51 @@ public class SchBaseTaskController {
|
||||
*/
|
||||
@GetMapping
|
||||
@Log("查询任务表")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
public ResponseEntity<Object> query(SchBaseTaskQuery whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(schBaseTaskService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/taskStatus")
|
||||
@Log("获取任务状态列表")
|
||||
public ResponseEntity<Object> getTaskStatus() {
|
||||
TaskStatusEnum[] values = TaskStatusEnum.values();
|
||||
JSONArray arr = new JSONArray();
|
||||
for (TaskStatusEnum value : values) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", value.getCode());
|
||||
json.put("name", value.getName());
|
||||
arr.add(json);
|
||||
}
|
||||
//增加未完成状态
|
||||
JSONObject unFinish = new JSONObject();
|
||||
unFinish.put("code", "-1");
|
||||
unFinish.put("name", "未完成");
|
||||
arr.add(unFinish);
|
||||
return new ResponseEntity<>(arr, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/finishType")
|
||||
@Log("获取任务类型列表")
|
||||
public ResponseEntity<Object> getFinishType() {
|
||||
FinishTypeEnum[] values = FinishTypeEnum.values();
|
||||
JSONArray arr = new JSONArray();
|
||||
for (FinishTypeEnum value : values) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", value.getCode());
|
||||
json.put("name", value.getName());
|
||||
arr.add(json);
|
||||
}
|
||||
return new ResponseEntity<>(arr, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/operation")
|
||||
@Log("任务操作")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> update(@RequestBody Map<String, Object> map) {
|
||||
schBaseTaskService.operation(map);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.nl.b_lms.sch.task.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
@@ -244,13 +243,13 @@ public class SchBaseTask extends Model<SchBaseTask> {
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
private String update_id;
|
||||
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optname;
|
||||
private String update_name;
|
||||
|
||||
|
||||
/**
|
||||
@@ -275,18 +274,14 @@ public class SchBaseTask extends Model<SchBaseTask> {
|
||||
* 是否立即下发
|
||||
*/
|
||||
private String is_send;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.task_id;
|
||||
}
|
||||
@TableField(exist = false)
|
||||
private String task_type_name;
|
||||
@TableField(exist = false)
|
||||
private String create_name1;
|
||||
@TableField(exist = false)
|
||||
private String task_status_name;
|
||||
@TableField(exist = false)
|
||||
private String final_product_area;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package org.nl.b_lms.sch.task.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.b_lms.sch.task.dto.SchBaseTaskQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -27,4 +29,6 @@ public interface SchBaseTaskMapper extends BaseMapper<SchBaseTask> {
|
||||
* @return /
|
||||
*/
|
||||
List<SchBaseTask> getTaskByPlanQzzNoAndDevice(String resourceName);
|
||||
|
||||
IPage<SchBaseTask> selectPageLeftJoin(IPage<SchBaseTask> pages, SchBaseTaskQuery whereJson, List<String> collect);
|
||||
}
|
||||
|
||||
@@ -20,4 +20,62 @@
|
||||
AND p.resource_name = #{resourceName}
|
||||
AND IFNULL(p.qzzno, '') <![CDATA[ <> ]]> ''
|
||||
</select>
|
||||
<select id="selectPageLeftJoin" resultType="org.nl.b_lms.sch.task.dao.SchBaseTask">
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
task.*,
|
||||
md.class_name task_type_name,
|
||||
user.person_name AS create_name1,
|
||||
dict.label task_status_name,
|
||||
case when task.task_type like '0105%' then 'LK' when task.task_type like '0107%' then 'LK' ELSE task.product_area end AS final_product_area
|
||||
FROM
|
||||
sch_base_task task
|
||||
LEFT JOIN md_pb_classstandard md ON task.task_type = md.class_code
|
||||
LEFT JOIN sys_user user ON user.username = task.create_name
|
||||
LEFT JOIN sys_dict dict ON dict.`value` = task.task_status AND dict.`code` = 'task_status'
|
||||
<where>
|
||||
<if test="whereJson.is_delete != null">
|
||||
AND task.is_delete = #{whereJson.is_delete}
|
||||
</if>
|
||||
<if test="whereJson.task_types != null and whereJson.task_types != ''">
|
||||
AND task.task_type IN
|
||||
<foreach collection="whereJson.task_types" item="code" separator="," open="(" close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="whereJson.end_time != null">
|
||||
AND task.create_time <![CDATA[<=]]> #{whereJson.end_time}
|
||||
</if>
|
||||
<if test="whereJson.begin_time != null">
|
||||
AND task.create_time <![CDATA[>=]]> #{whereJson.begin_time}
|
||||
</if>
|
||||
<if test="whereJson.unFinished != null">
|
||||
AND task.task_status <![CDATA[<=]]> #{whereJson.unFinished}
|
||||
</if>
|
||||
<if test="whereJson.vehicle_code != null">
|
||||
AND task.vehicle_code = #{whereJson.vehicle_code}
|
||||
</if>
|
||||
<if test="whereJson.task_code != null">
|
||||
AND task.task_code = LIKE '%${whereJson.task_code}%'
|
||||
</if>
|
||||
<if test="whereJson.point_code1 != null">
|
||||
AND (task.point_code1 LIKE '%${whereJson.point_code1}%'
|
||||
OR task.point_code2 LIKE '%${whereJson.point_code1}%')
|
||||
</if>
|
||||
<if test="collect != null and collect != ''">
|
||||
AND task.task_status IN
|
||||
<foreach collection="collect" item="code" separator="," open="(" close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
) a
|
||||
WHERE 1=1
|
||||
<if test="whereJson.in_area_id != null and whereJson.in_area_id != ''">
|
||||
AND a.final_product_area IN
|
||||
<foreach collection="whereJson.in_area_id" item="code" separator="," open="(" close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.nl.b_lms.sch.task.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Date: 2024/10/30
|
||||
*/
|
||||
@Data
|
||||
public class SchBaseTaskQuery implements Serializable {
|
||||
private String task_code;
|
||||
private String vehicle_code;
|
||||
private String point_code1;
|
||||
private String task_status;
|
||||
private String is_delete;
|
||||
private String task_type;
|
||||
private List<String> task_types;
|
||||
private String begin_time;
|
||||
private String end_time;
|
||||
private String more_task_status;
|
||||
private String unFinished;
|
||||
private List<String> in_area_id;
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.dto.SchBaseTaskQuery;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
|
||||
import java.util.List;
|
||||
@@ -27,7 +28,7 @@ public interface IschBaseTaskService extends IService<SchBaseTask> {
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<SchBaseTask>
|
||||
*/
|
||||
IPage<SchBaseTask> queryAll(Map whereJson, PageQuery pageable);
|
||||
IPage<SchBaseTask> queryAll(SchBaseTaskQuery whereJson, PageQuery pageable);
|
||||
|
||||
|
||||
/**
|
||||
@@ -87,6 +88,8 @@ public interface IschBaseTaskService extends IService<SchBaseTask> {
|
||||
* @return /
|
||||
*/
|
||||
Boolean checkHaveTaskByZcPoint(BstIvtCutpointivt point);
|
||||
|
||||
void operation(Map<String, Object> map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,26 +1,43 @@
|
||||
package org.nl.b_lms.sch.task.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.dao.mapper.SchBaseTaskMapper;
|
||||
import org.nl.b_lms.sch.task.dto.SchBaseTaskQuery;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.basedata.master.classstandard.service.IClassStandardService;
|
||||
import org.nl.wms.basedata.master.classstandard.service.dao.ClassStandard;
|
||||
import org.nl.wms.basedata.st.areapermissions.service.IUserAreaPermissionService;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -35,6 +52,13 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
|
||||
@Autowired
|
||||
private SchBaseTaskMapper schBaseTaskMapper;
|
||||
@Autowired
|
||||
private IUserAreaPermissionService userAreaPermissionService;
|
||||
@Autowired
|
||||
private IClassStandardService classStandardService;
|
||||
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
|
||||
/**
|
||||
@@ -44,17 +68,32 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
* @param page 分页参数
|
||||
*/
|
||||
@Override
|
||||
public IPage<SchBaseTask> queryAll(Map whereJson, PageQuery page) {
|
||||
return schBaseTaskMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()), new QueryWrapper<SchBaseTask>()
|
||||
.lambda()
|
||||
// .like(StringUtils.isNotBlank(form.name()), User::getName, form.name())
|
||||
// .between(form.beginTime != null && form.endTime != null, User::getCreateTime, beginTime, endTime)
|
||||
// .in(form.Status != null, User::getStatus
|
||||
// , UserStatusEnum.NOT_SUBMITTED
|
||||
// , UserStatusEnum.TO_REVIEWED)
|
||||
// .orderByDesc(User::getId)
|
||||
.eq(SchBaseTask::getIs_delete, 0)
|
||||
);
|
||||
public IPage<SchBaseTask> queryAll(SchBaseTaskQuery whereJson, PageQuery page) {
|
||||
List<String> collect = ObjectUtil.isNotEmpty(whereJson.getMore_task_status())
|
||||
? Arrays.stream(whereJson.getMore_task_status().split(",")).collect(Collectors.toList()) : null;
|
||||
if (collect != null) {
|
||||
if (collect.contains("-1")) {
|
||||
collect = null;
|
||||
whereJson.setUnFinished("07");
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(whereJson.getTask_type())) {
|
||||
// 获取任务类型
|
||||
ClassStandard dto = classStandardService.getById(whereJson.getTask_type());
|
||||
ArrayList<String> allChildrenIds = classStandardService.getAllChildrenIds(dto.getClass_id());
|
||||
if (CollectionUtil.isEmpty(allChildrenIds)) {
|
||||
allChildrenIds.add(dto.getClass_code());
|
||||
}
|
||||
whereJson.setTask_types(allChildrenIds);
|
||||
}
|
||||
|
||||
List<String> in_area_id = userAreaPermissionService.getCurrentUserAreas(SecurityUtils.getCurrentUserId());
|
||||
if (CollectionUtil.isNotEmpty(in_area_id)) {
|
||||
whereJson.setIn_area_id(in_area_id);
|
||||
}
|
||||
IPage<SchBaseTask> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
pages = schBaseTaskMapper.selectPageLeftJoin(pages, whereJson, collect);
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,8 +167,8 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
entity.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setCreate_time(DateUtil.now());
|
||||
}
|
||||
entity.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
entity.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
entity.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setUpdate_time(DateUtil.now());
|
||||
return entity;
|
||||
}
|
||||
@@ -160,6 +199,81 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
return list(lam).size() > 0;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void operation(Map<String, Object> map) {
|
||||
String task_id = MapUtil.getStr(map, "task_id");
|
||||
RLock lock = redissonClient.getLock(task_id);
|
||||
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
String method_name = MapUtil.getStr(map, "method_name");
|
||||
SchBaseTask taskObj = this.getById(task_id);
|
||||
if ("finish".equals(method_name)) {
|
||||
//强制执行,只把任务变更成完成状态
|
||||
// 更改任务状态为完成
|
||||
taskObj.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
taskObj.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
taskObj.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
taskObj.setUpdate_time(DateUtil.now());
|
||||
taskObj.setRemark("任务被用户:" + SecurityUtils.getCurrentNickName() + "在:" + DateUtil.now() + "强制完成。");
|
||||
this.updateById(taskObj);
|
||||
} else {
|
||||
// 任务处理类
|
||||
String processing_class = taskObj.getHandle_class();
|
||||
String message = "";
|
||||
|
||||
try {
|
||||
Object obj = new Object();
|
||||
try {
|
||||
obj = SpringContextHolder.getBean(Class.forName(processing_class));
|
||||
} catch (Exception e) {
|
||||
Class<?> clz = Class.forName(processing_class);
|
||||
obj = clz.newInstance();
|
||||
}
|
||||
// 调用每个任务类的method_name()强制结束方法
|
||||
Method m = obj.getClass().getMethod(method_name, String.class);
|
||||
JSONObject result = (JSONObject) m.invoke(obj, task_id);
|
||||
if (ObjectUtil.isEmpty(result)) {
|
||||
return;
|
||||
}
|
||||
JSONArray arr = result.getJSONArray("errArr");
|
||||
LambdaUpdateWrapper<SchBaseTask> lam = new LambdaUpdateWrapper<>();
|
||||
if (ObjectUtil.isNotEmpty(arr)) {
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
lam.set(SchBaseTask::getRemark, json.getString("message"))
|
||||
.eq(SchBaseTask::getTask_id, json.getString("task_id"));
|
||||
this.update(lam);
|
||||
}
|
||||
throw new BadRequestException("任务操作失败!");
|
||||
} else {
|
||||
lam.set(SchBaseTask::getRemark, "操作成功")
|
||||
.eq(SchBaseTask::getTask_id, task_id);
|
||||
this.update(lam);
|
||||
}
|
||||
} catch (InvocationTargetException e) {
|
||||
if (ObjectUtil.isNull(e.getTargetException().getMessage())) {
|
||||
message = e.getTargetException().toString();
|
||||
} else {
|
||||
message = e.getTargetException().getMessage();
|
||||
}
|
||||
throw new BadRequestException(message);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new BadRequestException("任务标识为:" + task_id + "的任务正在操作中!");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -92,8 +92,8 @@ public class DjqTask extends AbstractAcsTask {
|
||||
if (TaskUtil.checkParams(schBaseTask, THIS_CLASS, TaskStatusEnum.FINISHED.getCode())) return;
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getString("task_id"))
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
@@ -263,13 +263,13 @@ public class DjqTask extends AbstractAcsTask {
|
||||
}
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId)
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
//任务被标记为取消
|
||||
updateWrapper.set(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("是"));
|
||||
updateWrapper.set(SchBaseTask::getTask_status, TaskStatusEnum.CANCEL.getCode());
|
||||
updateWrapper.set(SchBaseTask::getRemark,"任务被用户:" + schBaseTask.getUpdate_optname() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
updateWrapper.set(SchBaseTask::getRemark,"任务被用户:" + schBaseTask.getUpdate_name() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
taskService.update(null,updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ public class DjqToKzjhcwTask extends AbstractAcsTask {
|
||||
if (TaskUtil.checkParams(schBaseTask, THIS_CLASS, TaskStatusEnum.FINISHED.getCode())) return;
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getString("task_id"))
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
@@ -205,13 +205,13 @@ public class DjqToKzjhcwTask extends AbstractAcsTask {
|
||||
}
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId)
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
//任务被标记为取消
|
||||
updateWrapper.set(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("是"));
|
||||
updateWrapper.set(SchBaseTask::getTask_status, TaskStatusEnum.CANCEL.getCode());
|
||||
updateWrapper.set(SchBaseTask::getRemark,"任务被用户:" + schBaseTask.getUpdate_optname() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
updateWrapper.set(SchBaseTask::getRemark,"任务被用户:" + schBaseTask.getUpdate_name() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
taskService.update(null,updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.TaskUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
@@ -86,8 +85,8 @@ public class GzqTask extends AbstractAcsTask {
|
||||
if (TaskUtil.checkParams(schBaseTask, THIS_CLASS,TaskStatusEnum.FINISHED.getCode())) return;
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getString("task_id"))
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
@@ -96,7 +95,7 @@ public class GzqTask extends AbstractAcsTask {
|
||||
}
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
log.info("任务编号为:"+schBaseTask.getTask_code()+"的任务完成接口在"+schBaseTask.getUpdate_time()+"被调用---------------------------------------------");
|
||||
|
||||
|
||||
//1.改变起点点位状态
|
||||
packageinfoivtService.update(null,new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
|
||||
//2.更新库存记录
|
||||
@@ -205,13 +204,13 @@ public class GzqTask extends AbstractAcsTask {
|
||||
}
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId)
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
//任务被标记为取消
|
||||
updateWrapper.set(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("是"));
|
||||
updateWrapper.set(SchBaseTask::getTask_status, TaskStatusEnum.CANCEL.getCode());
|
||||
updateWrapper.set(SchBaseTask::getRemark,"任务被用户:" + schBaseTask.getUpdate_optname() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
updateWrapper.set(SchBaseTask::getRemark,"任务被用户:" + schBaseTask.getUpdate_name() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
taskService.update(null,updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,8 +89,8 @@ public class GzqToKzjhcwTask extends AbstractAcsTask {
|
||||
if (TaskUtil.checkParams(schBaseTask, THIS_CLASS, TaskStatusEnum.FINISHED.getCode())) return;
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getString("task_id"))
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
@@ -207,13 +207,13 @@ public class GzqToKzjhcwTask extends AbstractAcsTask {
|
||||
}
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId)
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
//任务被标记为取消
|
||||
updateWrapper.set(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("是"));
|
||||
updateWrapper.set(SchBaseTask::getTask_status, TaskStatusEnum.CANCEL.getCode());
|
||||
updateWrapper.set(SchBaseTask::getRemark,"任务被用户:" + schBaseTask.getUpdate_optname() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
updateWrapper.set(SchBaseTask::getRemark,"任务被用户:" + schBaseTask.getUpdate_name() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
taskService.update(null,updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,8 +113,8 @@ public class MzhcwTask extends AbstractAcsTask {
|
||||
if (TaskUtil.checkParams(schBaseTask, THIS_CLASS, TaskStatusEnum.FINISHED.getCode())) return;
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getString("task_id"))
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
// 执行中
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
@@ -388,13 +388,13 @@ public class MzhcwTask extends AbstractAcsTask {
|
||||
}
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId)
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
//任务被标记为取消
|
||||
updateWrapper.set(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("是"));
|
||||
updateWrapper.set(SchBaseTask::getTask_status, TaskStatusEnum.CANCEL.getCode());
|
||||
updateWrapper.set(SchBaseTask::getRemark,"任务被用户:" + schBaseTask.getUpdate_optname() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
updateWrapper.set(SchBaseTask::getRemark,"任务被用户:" + schBaseTask.getUpdate_name() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
taskService.update(null,updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,8 @@ public class SendDjqKzjTask extends AbstractAcsTask {
|
||||
if (TaskUtil.checkParams(schBaseTask, THIS_CLASS, TaskStatusEnum.FINISHED.getCode())) return;
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getString("task_id"))
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
@@ -185,13 +185,13 @@ public class SendDjqKzjTask extends AbstractAcsTask {
|
||||
}
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId)
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
//任务被标记为取消
|
||||
updateWrapper.set(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("是"));
|
||||
updateWrapper.set(SchBaseTask::getTask_status, TaskStatusEnum.CANCEL.getCode());
|
||||
updateWrapper.set(SchBaseTask::getRemark, "任务被用户:" + schBaseTask.getUpdate_optname() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
updateWrapper.set(SchBaseTask::getRemark, "任务被用户:" + schBaseTask.getUpdate_name() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
taskService.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,8 @@ public class SendGzqKzjTask extends AbstractAcsTask {
|
||||
if (TaskUtil.checkParams(schBaseTask, THIS_CLASS, TaskStatusEnum.FINISHED.getCode())) return;
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getString("task_id"))
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
@@ -184,13 +184,13 @@ public class SendGzqKzjTask extends AbstractAcsTask {
|
||||
}
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId)
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
//任务被标记为取消
|
||||
updateWrapper.set(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("是"));
|
||||
updateWrapper.set(SchBaseTask::getTask_status, TaskStatusEnum.CANCEL.getCode());
|
||||
updateWrapper.set(SchBaseTask::getRemark, "任务被用户:" + schBaseTask.getUpdate_optname() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
updateWrapper.set(SchBaseTask::getRemark, "任务被用户:" + schBaseTask.getUpdate_name() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
taskService.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -86,8 +86,8 @@ public class SsxDjwTask extends AbstractAcsTask {
|
||||
if (TaskUtil.checkParams(schBaseTask, THIS_CLASS, TaskStatusEnum.FINISHED.getCode())) return;
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getString("task_id"))
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
@@ -211,13 +211,13 @@ public class SsxDjwTask extends AbstractAcsTask {
|
||||
}
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId)
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
//任务被标记为取消
|
||||
updateWrapper.set(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("是"));
|
||||
updateWrapper.set(SchBaseTask::getTask_status, TaskStatusEnum.CANCEL.getCode());
|
||||
updateWrapper.set(SchBaseTask::getRemark,"任务被用户:" + schBaseTask.getUpdate_optname() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
updateWrapper.set(SchBaseTask::getRemark,"任务被用户:" + schBaseTask.getUpdate_name() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
taskService.update(null,updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -115,8 +115,8 @@ public class ZxDjwTask extends AbstractAcsTask {
|
||||
if (TaskUtil.checkParams(schBaseTask, THIS_CLASS, TaskStatusEnum.FINISHED.getCode())) return;
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getString("task_id"))
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
@@ -267,13 +267,13 @@ public class ZxDjwTask extends AbstractAcsTask {
|
||||
}
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId)
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
//任务被标记为取消
|
||||
updateWrapper.set(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("是"));
|
||||
updateWrapper.set(SchBaseTask::getTask_status, TaskStatusEnum.CANCEL.getCode());
|
||||
updateWrapper.set(SchBaseTask::getRemark, "任务被用户:" + schBaseTask.getUpdate_optname() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
updateWrapper.set(SchBaseTask::getRemark, "任务被用户:" + schBaseTask.getUpdate_name() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
taskService.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -112,8 +112,8 @@ public class ZxqTask extends AbstractAcsTask {
|
||||
if (TaskUtil.checkParams(schBaseTask, THIS_CLASS, TaskStatusEnum.FINISHED.getCode())) return;
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getString("task_id"))
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
@@ -358,13 +358,13 @@ public class ZxqTask extends AbstractAcsTask {
|
||||
}
|
||||
LambdaUpdateWrapper<SchBaseTask> updateWrapper = new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_id, taskId)
|
||||
.set(SchBaseTask::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_optname, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentUsername())
|
||||
.set(SchBaseTask::getUpdate_time, DateUtil.now());
|
||||
//任务被标记为取消
|
||||
updateWrapper.set(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("是"));
|
||||
updateWrapper.set(SchBaseTask::getTask_status, TaskStatusEnum.CANCEL.getCode());
|
||||
updateWrapper.set(SchBaseTask::getRemark, "任务被用户:" + schBaseTask.getUpdate_optname() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
updateWrapper.set(SchBaseTask::getRemark, "任务被用户:" + schBaseTask.getUpdate_name() + "在:" + schBaseTask.getUpdate_time() + "强制取消。");
|
||||
taskService.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.nl.common.utils;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.bst.ivt.shafttubeivt.service.dao.BstIvtShafttubeivt;
|
||||
@@ -99,8 +98,8 @@ public class TaskUtils {
|
||||
* @param task 任务
|
||||
*/
|
||||
public static void updateOptMessageByTask(SchBaseTask task) {
|
||||
task.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
task.setUpdate_optname(SecurityUtils.getCurrentUsername());
|
||||
task.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
task.setUpdate_name(SecurityUtils.getCurrentUsername());
|
||||
task.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
|
||||
<select id="getAllChildrenIds" resultType="java.lang.String">
|
||||
SELECT DISTINCT
|
||||
class_id
|
||||
class_code
|
||||
FROM (
|
||||
SELECT
|
||||
t1.class_id,
|
||||
t1.class_code,
|
||||
IF(find_in_set(parent_class_id, @pids) > 0, @pids := concat(@pids, ',', class_id), 0) AS ischild
|
||||
FROM (
|
||||
SELECT class_id, parent_class_id FROM md_pb_classstandard t WHERE t.is_delete = '0' ORDER BY class_code
|
||||
SELECT class_code, class_id, parent_class_id FROM md_pb_classstandard t WHERE t.is_delete = '0' ORDER BY class_code
|
||||
) t1,
|
||||
(SELECT @pids := #{classId}) t2
|
||||
) t3
|
||||
|
||||
@@ -44,4 +44,9 @@ public interface IUserAreaPermissionService extends IService<UserAreaPermission>
|
||||
|
||||
String getInArea();
|
||||
|
||||
/**
|
||||
* 获取当前用户对应的区域数组
|
||||
* @return
|
||||
*/
|
||||
List<String> getCurrentUserAreas(String currentUserId);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
@@ -104,4 +105,15 @@ public class UserAreaPermissionServiceImpl extends ServiceImpl<UserAreaPermissio
|
||||
}
|
||||
return in_stor_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCurrentUserAreas(String currentUserId) {
|
||||
if (ObjectUtil.isEmpty(currentUserId)) {
|
||||
return null;
|
||||
}
|
||||
LambdaQueryWrapper<UserAreaPermission> lam = new LambdaQueryWrapper<>();
|
||||
lam.eq(UserAreaPermission::getUser_id, currentUserId);
|
||||
List<UserAreaPermission> list = userAreaPermissionMapper.selectList(lam);
|
||||
return list.stream().map(UserAreaPermission::getProduct_area).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Map;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@RequestMapping("/api/region")
|
||||
@RequestMapping("/api/region2")
|
||||
@Slf4j
|
||||
public class RegionController {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Map;
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/task")
|
||||
@RequestMapping("/api/task2")
|
||||
@Slf4j
|
||||
public class TaskController {
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
v-model="query.is_delete"
|
||||
class="filter-item"
|
||||
clearable
|
||||
@change="handTaskStatus"
|
||||
@change="hand"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deleteList"
|
||||
@@ -229,7 +229,15 @@ export default {
|
||||
sort: 'create_time,desc',
|
||||
crudMethod: { ...crudTask },
|
||||
query: {
|
||||
task_code: '', is_delete: '0', vehicle_code: '', start_point_code: '', next_point_code: '', task_type: '', finished_type: '', task_status: ['-1']
|
||||
task_code: '',
|
||||
is_delete: '0',
|
||||
vehicle_code: '',
|
||||
start_point_code: '',
|
||||
next_point_code: '',
|
||||
task_type: '',
|
||||
finished_type: '',
|
||||
more_task_status: '-1',
|
||||
task_status: ['-1']
|
||||
},
|
||||
optShow: {
|
||||
add: false,
|
||||
@@ -279,7 +287,7 @@ export default {
|
||||
parent_class_code: 'task_type'
|
||||
}
|
||||
crudClassstandard.getClassType(param).then(res => {
|
||||
const data = res.content
|
||||
const data = res
|
||||
this.buildTree(data)
|
||||
this.classes1 = data
|
||||
})
|
||||
@@ -297,9 +305,8 @@ export default {
|
||||
// 获取子节点数据
|
||||
loadChildNodes({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
debugger
|
||||
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
parentNode.children = res.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
@@ -312,13 +319,12 @@ export default {
|
||||
}
|
||||
},
|
||||
hand(value) {
|
||||
debugger
|
||||
this.crud.toQuery()
|
||||
},
|
||||
handTaskStatus(value) {
|
||||
debugger
|
||||
if (value) {
|
||||
this.query.task_status = this.task_status.toString()
|
||||
console.log(value)
|
||||
this.crud.query.more_task_status = value.toString()
|
||||
}
|
||||
this.crud.toQuery()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user