Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -27,6 +27,7 @@ public enum TagNameEnum {
|
||||
ERROR_GX_IN_OUT("管芯满入空出异常处理"),
|
||||
AUTO_CALL_EMPTY_BY_CZZC("自动称重暂存位叫空"),
|
||||
AUTO_IN_HOT("自动创建入烘箱"),
|
||||
AUTO_IN_OUT("自动创建出烘箱"),
|
||||
ACS_FEEDBACK_TUBE_COMPLETE("ACS反馈管芯入库完成"),
|
||||
/**
|
||||
* 标记符号
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
) t3
|
||||
where childId != '0'
|
||||
</select>
|
||||
<select id="queryPdaAuthority" resultType="com.alibaba.fastjson.JSONArray">
|
||||
<select id="queryPdaAuthority" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
max( sys_user.user_id ) AS accountId,
|
||||
max( sys_user.username ) AS username,
|
||||
|
||||
@@ -14,19 +14,19 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.constant.DictConstantPool;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.domain.vo.MenuMetaVo;
|
||||
import org.nl.common.domain.vo.MenuVo;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CopyUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.IdUtil;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.dict.dao.mapper.SysDictMapper;
|
||||
import org.nl.system.service.menu.dto.MenuDto;
|
||||
import org.nl.system.service.menu.ISysMenuService;
|
||||
import org.nl.system.service.menu.dao.SysMenu;
|
||||
import org.nl.system.service.menu.dao.mapper.SysMenuMapper;
|
||||
import org.nl.system.service.menu.dto.MenuDto;
|
||||
import org.nl.system.service.menu.dto.MenuQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
@@ -66,7 +66,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
@Override
|
||||
public List query(MenuQuery query, PageQuery page) {
|
||||
page.setSort("menu_sort DESC");
|
||||
if (StringUtils.isNotEmpty(query.getBlurry())){
|
||||
if (StringUtils.isNotEmpty(query.getBlurry())) {
|
||||
query.setPid(null);
|
||||
}
|
||||
Page<SysMenu> menuPage = this.page(page.build(), query.build());
|
||||
@@ -138,7 +138,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
|
||||
private void addSystemTypeDict(SysMenu resources) {
|
||||
Dict dict = sysDictMapper.selectOne(new QueryWrapper<Dict>().eq("code", DictConstantPool.DICT_SYS_CODE).orderByDesc("value").last("limit 1"));
|
||||
Integer currentType = dict!=null?Integer.valueOf(dict.getValue())+1:1;
|
||||
Integer currentType = dict != null ? Integer.valueOf(dict.getValue()) + 1 : 1;
|
||||
Dict currentSysType = new Dict();
|
||||
currentSysType.setDict_id(IdUtil.getStringId());
|
||||
currentSysType.setCode(DictConstantPool.DICT_SYS_CODE);
|
||||
@@ -149,15 +149,17 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
sysDictMapper.insert(currentSysType);
|
||||
resources.setSystem_type(String.valueOf(currentType));
|
||||
}
|
||||
|
||||
private void updateRootSystemType(SysMenu sysMenu) {
|
||||
String rootMenuId = this.findRootMenuId(sysMenu.getMenu_id());
|
||||
if (sysMenu.getMenu_id().equals(rootMenuId)){
|
||||
if (sysMenu.getMenu_id().equals(rootMenuId)) {
|
||||
return;
|
||||
}
|
||||
SysMenu rootMenu = this.findById(rootMenuId);
|
||||
sysMenu.setSystem_type(rootMenu.getSystem_type());
|
||||
this.updateById(sysMenu);
|
||||
}
|
||||
|
||||
private String findRootMenuId(String menuId) {
|
||||
SysMenu sysMenu = this.findById(menuId);
|
||||
if (StrUtil.isEmpty(sysMenu.getPid())) {
|
||||
@@ -176,12 +178,12 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
baseMapper.untiedMenu(menu.getMenu_id());
|
||||
baseMapper.deleteById(menu.getMenu_id());
|
||||
String pid = menu.getPid();
|
||||
if (StringUtils.isEmpty(pid)){
|
||||
if (StringUtils.isEmpty(pid)) {
|
||||
pids.add(pid);
|
||||
}
|
||||
updateSubCnt(pid);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(pids)){
|
||||
if (!CollectionUtils.isEmpty(pids)) {
|
||||
sysDictMapper.delete(new QueryWrapper<Dict>().in("para1", pids).eq("code", DictConstantPool.DICT_SYS_CODE));
|
||||
}
|
||||
}
|
||||
@@ -193,8 +195,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
SysMenu menu = baseMapper.selectById(menuId);
|
||||
// 获取当前菜单的所有子菜单
|
||||
String allChild = baseMapper.findAllChild(menuId);
|
||||
List<String> allChildIds = ObjectUtil.isNotEmpty(allChild)?Arrays.asList(allChild.split(",")):null;
|
||||
if (ObjectUtil.isNotEmpty(allChildIds) && allChildIds.contains(resources.getPid())){
|
||||
List<String> allChildIds = ObjectUtil.isNotEmpty(allChild) ? Arrays.asList(allChild.split(",")) : null;
|
||||
if (ObjectUtil.isNotEmpty(allChildIds) && allChildIds.contains(resources.getPid())) {
|
||||
throw new BadRequestException(LangProcess.msg("login_childError"));
|
||||
}
|
||||
if (resources.getIframe()) {
|
||||
@@ -206,17 +208,17 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
|
||||
if (resources.getPid().equals("0")) {
|
||||
resources.setPid(null);
|
||||
if (StringUtils.isNotEmpty(menu.getPid())){
|
||||
if (StringUtils.isNotEmpty(menu.getPid())) {
|
||||
addSystemTypeDict(resources);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
resources.setSystem_type(this.findById(resources.getPid()).getSystem_type());
|
||||
}
|
||||
String oldPid = menu.getPid();
|
||||
String newPid = resources.getPid();
|
||||
// 记录的父节点ID
|
||||
if (oldPid == null && newPid != null){
|
||||
sysDictMapper.delete(new QueryWrapper<Dict>().eq("para1",menu.getMenu_id()));
|
||||
if (oldPid == null && newPid != null) {
|
||||
sysDictMapper.delete(new QueryWrapper<Dict>().eq("para1", menu.getMenu_id()));
|
||||
}
|
||||
menu.setTitle(resources.getTitle());
|
||||
menu.setComponent(resources.getComponent());
|
||||
@@ -238,8 +240,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
updateSubCnt(oldPid);
|
||||
updateSubCnt(newPid);
|
||||
//更新SystemType
|
||||
if (!resources.getSystem_type().equals(menu.getSystem_type())){
|
||||
this.update(new UpdateWrapper<SysMenu>().set(DictConstantPool.DICT_SYS_CODE,resources.getSystem_type()).in("menu_id",allChildIds));
|
||||
if (!resources.getSystem_type().equals(menu.getSystem_type())) {
|
||||
this.update(new UpdateWrapper<SysMenu>().set(DictConstantPool.DICT_SYS_CODE, resources.getSystem_type()).in("menu_id", allChildIds));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -357,7 +359,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
public MenuDto doToDto(SysMenu entity) {
|
||||
|
||||
MenuDto menuDto = new MenuDto();
|
||||
if (ObjectUtil.isEmpty(entity)){
|
||||
if (ObjectUtil.isEmpty(entity)) {
|
||||
return menuDto;
|
||||
}
|
||||
menuDto.setEn_title(entity.getEn_title());
|
||||
@@ -395,15 +397,15 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
@Override
|
||||
public List<MenuVo> buildMenus(String systemType) {
|
||||
Dict dict = sysDictMapper.selectOne(new QueryWrapper<Dict>().eq("code", DictConstantPool.DICT_SYS_CODE).eq("value", systemType));
|
||||
if (dict == null || StringUtils.isEmpty(dict.getPara1())){
|
||||
throw new BadRequestException(LangProcess.msg("error_isNull",DictConstantPool.DICT_SYS_CODE));
|
||||
if (dict == null || StringUtils.isEmpty(dict.getPara1())) {
|
||||
throw new BadRequestException(LangProcess.msg("error_isNull", DictConstantPool.DICT_SYS_CODE));
|
||||
}
|
||||
String pid = dict.getPara1();
|
||||
List<SysMenu> menuDtoList = baseMapper.findSystemMenu(SecurityUtils.getCurrentUserId(),systemType);
|
||||
List<SysMenu> menuDtoList = baseMapper.findSystemMenu(SecurityUtils.getCurrentUserId(), systemType);
|
||||
//移除系统级菜单
|
||||
menuDtoList.removeIf(a->a.getMenu_id().equals(pid));
|
||||
menuDtoList.removeIf(a -> a.getMenu_id().equals(pid));
|
||||
List<MenuDto> menuDtos = this.buildTree(CopyUtil.copyList(menuDtoList, MenuDto.class));
|
||||
return this.buildMenus(menuDtos,pid);
|
||||
return this.buildMenus(menuDtos, pid);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -417,7 +419,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
MenuVo menuVo = new MenuVo();
|
||||
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getLocalTitle(lang));
|
||||
// 一级目录需要加斜杠,不然会报警告
|
||||
menuVo.setPath(pid.equals(menuDTO.getPid())? "/" + menuDTO.getPath() : menuDTO.getPath());
|
||||
menuVo.setPath(pid.equals(menuDTO.getPid()) ? "/" + menuDTO.getPath() : menuDTO.getPath());
|
||||
menuVo.setHidden(menuDTO.getHidden());
|
||||
// 如果不是外链
|
||||
if (!menuDTO.getIframe()) {
|
||||
@@ -434,7 +436,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
if (menuDtoList != null && menuDtoList.size() != 0) {
|
||||
menuVo.setAlwaysShow(true);
|
||||
menuVo.setRedirect("noredirect");
|
||||
menuVo.setChildren(buildMenus(menuDtoList,pid));
|
||||
menuVo.setChildren(buildMenus(menuDtoList, pid));
|
||||
// 处理是一级菜单并且没有子菜单的情况
|
||||
} else if (StrUtil.isEmpty(menuDTO.getPid())) {
|
||||
MenuVo menuVo1 = new MenuVo();
|
||||
@@ -463,7 +465,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
|
||||
@Override
|
||||
public List<Map> getMenusByRole(String roleId, String systemType, String category) {
|
||||
baseMapper.getMenusByRole(systemType,category);
|
||||
baseMapper.getMenusByRole(systemType, category);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -478,7 +480,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
}
|
||||
//查询一级
|
||||
JSONArray pa = baseMapper.queryPdaAuthority(accountId, "0", null);
|
||||
if(ObjectUtil.isEmpty(pa)){
|
||||
if (ObjectUtil.isEmpty(pa)) {
|
||||
throw new BadRequestException("当前用户无菜单权限!");
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
@@ -496,7 +498,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
roleTree.add(row);
|
||||
}
|
||||
res.put("sonTree", roleTree);
|
||||
result.put("rf_menu" + ("188".equals(res.getString("menu_id"))?1:0), res);
|
||||
result.put("rf_menu" + ("188".equals(res.getString("menu_id")) ? 1 : 0), res);
|
||||
}
|
||||
|
||||
returnjo.put("code", "1");
|
||||
|
||||
@@ -6,6 +6,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.common.logging.domain.InterfaceLogType;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
import org.nl.wms.ext.record.core.Record;
|
||||
import org.nl.wms.ext.record.core.RecordDefinition;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -42,7 +44,8 @@ public class AcsToWmsController {
|
||||
}
|
||||
|
||||
@PostMapping("/outHotTaskApply")
|
||||
@Log(value = "申请出烘箱任务", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@Record(interactName = "申请出烘箱任务", direction = RecordDefinition.ACS_LMS)
|
||||
// @Log(value = "申请出烘箱任务", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> outHotTaskApply(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(acsToWmsService.outHotTaskApply(whereJson), HttpStatus.OK);
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.sch.task_manage.AcsTaskDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.wms.ext.record.core;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 对接记录注解
|
||||
* @Author: lyd
|
||||
* @Date: 2024/9/23
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Record {
|
||||
/** 对接名称 */
|
||||
String interactName() default "";
|
||||
/**
|
||||
* 方向
|
||||
* @see RecordDefinition
|
||||
* */
|
||||
String direction() default "";
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package org.nl.wms.ext.record.core;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.AfterThrowing;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.nl.common.utils.RequestHolder;
|
||||
import org.nl.common.utils.StringUtils;
|
||||
import org.nl.common.utils.ThrowableUtil;
|
||||
import org.nl.system.service.logging.dao.SysLog;
|
||||
import org.nl.wms.ext.record.service.ISysInteractRecordService;
|
||||
import org.nl.wms.ext.record.service.dao.SysInteractRecord;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Parameter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Date: 2024/9/23
|
||||
*/
|
||||
@Component
|
||||
@Aspect
|
||||
@Slf4j
|
||||
public class RecordAspect {
|
||||
|
||||
@Autowired
|
||||
private ISysInteractRecordService sysInteractRecordService;
|
||||
|
||||
@Pointcut("@annotation(org.nl.wms.ext.record.core.Record)")
|
||||
public void logPointcut() {
|
||||
// 该方法无方法体,主要为了让同类中其他方法使用此切入点
|
||||
}
|
||||
|
||||
@Around("logPointcut()")
|
||||
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
// 获取 API URL
|
||||
String apiUrl = request.getRequestURL().toString();
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
Record annotation = method.getAnnotation(Record.class);
|
||||
// 方法路径
|
||||
String params = getParameter(method, joinPoint.getArgs());
|
||||
Object result = joinPoint.proceed();
|
||||
sysInteractRecordService.saveRecord(apiUrl, joinPoint, params, result, annotation.direction(), annotation.interactName());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据方法和传入的参数获取请求参数
|
||||
*/
|
||||
|
||||
private String getParameter(Method method, Object[] args) {
|
||||
List<Object> argList = new ArrayList<>();
|
||||
Parameter[] parameters = method.getParameters();
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
//将RequestBody注解修饰的参数作为请求参数
|
||||
RequestBody requestBody = parameters[i].getAnnotation(RequestBody.class);
|
||||
if (requestBody != null) {
|
||||
argList.add(args[i]);
|
||||
}
|
||||
//将RequestParam注解修饰的参数作为请求参数
|
||||
RequestParam requestParam = parameters[i].getAnnotation(RequestParam.class);
|
||||
if (requestParam != null) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String key = parameters[i].getName();
|
||||
if (!StrUtil.isEmpty(requestParam.value())) {
|
||||
key = requestParam.value();
|
||||
}
|
||||
map.put(key, args[i]);
|
||||
argList.add(map);
|
||||
}
|
||||
}
|
||||
if (argList.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
return argList.size() == 1 ? JSONUtil.toJsonStr(argList.get(0)) : JSONUtil.toJsonStr(argList);
|
||||
}
|
||||
|
||||
@AfterThrowing(pointcut = "logPointcut()", throwing = "e")
|
||||
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
// 获取 API URL
|
||||
String apiUrl = request.getRequestURL().toString();
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
Record annotation = method.getAnnotation(Record.class);
|
||||
// 方法路径
|
||||
String params = getParameter(method, joinPoint.getArgs());
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", 400);
|
||||
result.put("message", e.getMessage());
|
||||
sysInteractRecordService.saveRecord(apiUrl, (ProceedingJoinPoint)joinPoint, params, result, annotation.direction(), annotation.interactName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.wms.ext.record.core;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Date: 2024/9/23
|
||||
*/
|
||||
public interface RecordDefinition {
|
||||
// 请求方向
|
||||
/**ACS->LMS**/
|
||||
public static final String ACS_LMS = "1";
|
||||
/**LMS->ACS**/
|
||||
public static final String LMS_ACS = "2";
|
||||
/**MES->LMS**/
|
||||
public static final String MES_LMS = "3";
|
||||
/**LMS->MES**/
|
||||
public static final String LMS_MES = "4";
|
||||
}
|
||||
@@ -2,10 +2,12 @@ package org.nl.wms.ext.record.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.ext.record.service.dao.SysInteractRecord;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -51,6 +53,18 @@ public interface ISysInteractRecordService extends IService<SysInteractRecord> {
|
||||
*/
|
||||
void saveRecord(Object request, BaseResponse response, String direction);
|
||||
|
||||
/**
|
||||
* 创建记录
|
||||
* @param apiUrl
|
||||
* @param joinPoint \
|
||||
* @param request 、
|
||||
* @param response 、
|
||||
* @param direction 、
|
||||
* @param interactName \
|
||||
*/
|
||||
@Async
|
||||
void saveRecord(String apiUrl, ProceedingJoinPoint joinPoint, String request, Object response, String direction, String interactName);
|
||||
|
||||
/**
|
||||
* 保存记录
|
||||
* @param name 、
|
||||
|
||||
@@ -22,31 +22,34 @@ public class SysInteractRecord implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "interact_id", type = IdType.NONE)
|
||||
|
||||
|
||||
private String interact_id;
|
||||
|
||||
|
||||
|
||||
private String interact_name;
|
||||
|
||||
|
||||
|
||||
private int code;
|
||||
|
||||
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
|
||||
private String request_param;
|
||||
|
||||
|
||||
|
||||
private String response_param;
|
||||
|
||||
|
||||
|
||||
private String record_time;
|
||||
|
||||
|
||||
|
||||
private String direction;
|
||||
|
||||
|
||||
|
||||
private Boolean is_success;
|
||||
|
||||
private String api_url;
|
||||
private String target_class;
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ 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.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.language.LangProcess;
|
||||
@@ -24,6 +26,7 @@ import org.nl.wms.ext.record.service.dao.mapper.SysInteractRecordMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -94,6 +97,31 @@ public class SysInteractRecordServiceImpl extends ServiceImpl<SysInteractRecordM
|
||||
sysInteractRecordMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveRecord(String apiUrl, ProceedingJoinPoint joinPoint, String request, Object response, String direction, String interactName) {
|
||||
String responseJsonString = JSONObject.toJSONString(response);
|
||||
JSONObject responseOb = JSONObject.parseObject(responseJsonString);
|
||||
JSONObject responseJson = responseOb.getJSONObject("body");
|
||||
if (ObjectUtil.isEmpty(responseJson)) {
|
||||
responseJson = responseOb;
|
||||
}
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
|
||||
SysInteractRecord entity = new SysInteractRecord();
|
||||
entity.setInteract_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setInteract_name(interactName);
|
||||
entity.setCode(responseJson.getInteger("status"));
|
||||
entity.setMessage(responseJson.getString("message"));
|
||||
entity.setRecord_time(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS"));
|
||||
entity.setDirection(direction);
|
||||
entity.setRequest_param(request);
|
||||
entity.setTarget_class(methodName);
|
||||
entity.setApi_url(apiUrl);
|
||||
entity.setResponse_param(JSONObject.toJSONString(response));
|
||||
entity.setIs_success(responseJson.getInteger("status") == HttpStatus.HTTP_OK);
|
||||
sysInteractRecordMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> void saveRecord(String name, K request, V response, String direction) {
|
||||
SysInteractRecord entity = new SysInteractRecord();
|
||||
|
||||
@@ -182,7 +182,7 @@ public class RawFoilPdaServiceImpl implements RawFoilPdaService {
|
||||
if (ObjectUtil.isEmpty(sbPoint)) {
|
||||
throw new BadRequestException("生箔位:" + pointCode + " 不存在,请检查是否被锁住!");
|
||||
}
|
||||
// 创建工单
|
||||
// todo: 暂时写死,创建工单
|
||||
PdmBiRawfoilworkorder rawOrder = new PdmBiRawfoilworkorder();
|
||||
rawOrder.setWorkorder_id(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
rawOrder.setContainer_name(orderCode);
|
||||
|
||||
@@ -28,10 +28,7 @@ import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.tasks.nbj.SendShaftAGVTask;
|
||||
import org.nl.wms.sch.task_manage.tasks.slitter.SlitterDownAGVTask;
|
||||
import org.nl.wms.sch.task_manage.tasks.slitter.SlitterInHotAGVTask;
|
||||
import org.nl.wms.sch.task_manage.tasks.slitter.SlitterSendRollAGVTask;
|
||||
import org.nl.wms.sch.task_manage.tasks.slitter.SlitterUpTrussTask;
|
||||
import org.nl.wms.sch.task_manage.tasks.slitter.*;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -77,6 +74,8 @@ public class SlitterPdaServiceImpl implements SlitterPdaService {
|
||||
private SlitterDownAGVTask slitterDownAGVTask;
|
||||
@Autowired
|
||||
private SlitterInHotAGVTask slitterInHotAGVTask;
|
||||
@Autowired
|
||||
private SlitterRebakeAGVTask slitterRebakeAGVTask;
|
||||
@Override
|
||||
public JSONObject queryOrderInfo(JSONObject param) {
|
||||
JSONObject result = new JSONObject();
|
||||
@@ -239,10 +238,10 @@ public class SlitterPdaServiceImpl implements SlitterPdaService {
|
||||
// 组织请求任务参数
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("device_code", pointCode);
|
||||
taskParam.put("config_code", "SlitterInHotAGVTask");
|
||||
taskParam.put("config_code", "SlitterRebakeAGVTask");
|
||||
taskParam.put("order_code", rawOrder.getContainer_name());
|
||||
taskParam.put("create_mode", GeneralDefinition.PDA_CREATION);
|
||||
slitterInHotAGVTask.apply(taskParam);
|
||||
slitterRebakeAGVTask.apply(taskParam);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("message", "母卷回库任务创建成功!");
|
||||
return result;
|
||||
|
||||
@@ -4,6 +4,8 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.ext.record.core.Record;
|
||||
import org.nl.wms.ext.record.core.RecordDefinition;
|
||||
import org.nl.wms.pda.st.service.GxPdaService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -31,7 +33,8 @@ public class GxPdaController {
|
||||
return new ResponseEntity<>(gxPdaService.getGxSpecification(), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/confirmedInStorage")
|
||||
@Log("管芯确认入库")
|
||||
// @Log("管芯确认入库")
|
||||
@Record(interactName = "管芯确认入库", direction = RecordDefinition.LMS_ACS)
|
||||
public ResponseEntity<Object> confirmedInStorage(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(gxPdaService.confirmedInStorageV2(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@ package org.nl.wms.quartz;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.lucene.TagNameEnum;
|
||||
import org.nl.wms.pdm.ivt.hot.service.IstIvtHotpointivtService;
|
||||
import org.nl.wms.pdm.ivt.hot.service.dao.StIvtHotpointivt;
|
||||
import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.tasks.hot.OutHotTrussTask;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -29,6 +31,7 @@ public class AutoCreateOutHotTask {
|
||||
private OutHotTrussTask outHotTrussTask;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void run() {
|
||||
MDC.put(GeneralDefinition.MDC_KEY, TagNameEnum.AUTO_IN_OUT.getTag());
|
||||
log.info("自动创建出烘箱任务开始执行...");
|
||||
// 获取烘箱内部状态:烘烤完毕暂存中(04)、03但不需要烘烤的点位
|
||||
List<StIvtHotpointivt> hotPoints = hotpointivtService.getUnionBakedFinishPoint();
|
||||
|
||||
@@ -75,7 +75,7 @@ public class AcsUtil {
|
||||
String msg = e.getMessage();
|
||||
//ConnectException: Connection refused: connect
|
||||
//网络不通
|
||||
result.put("status", HttpStatus.BAD_REQUEST);
|
||||
result.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
result.put("message", "网络不通,操作失败!");
|
||||
result.put("data", new JSONObject());
|
||||
log.error("ACS出现异常: {}", e);
|
||||
@@ -236,8 +236,8 @@ public class AcsUtil {
|
||||
String msg = e.getMessage();
|
||||
//ConnectException: Connection refused: connect
|
||||
//网络不通
|
||||
result.put("status", HttpStatus.BAD_REQUEST);
|
||||
result.put("message", "网络不通,操作失败!");
|
||||
result.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
result.put("message", msg);
|
||||
result.put("data", new JSONObject());
|
||||
}
|
||||
//acs抛异常这里
|
||||
|
||||
@@ -8,6 +8,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.pdm.bi.dao.PdmBiRawfoilworkorder;
|
||||
import org.nl.wms.pdm.bi.service.IpdmBiRawfoilworkorderService;
|
||||
import org.nl.wms.pdm.ivt.hot.service.IstIvtHotpointivtService;
|
||||
import org.nl.wms.pdm.ivt.hot.service.dao.StIvtHotpointivt;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.TaskStatus;
|
||||
@@ -44,6 +46,8 @@ public class BakingOperationServiceImpl implements BakingOperationService {
|
||||
private InHotTrussTask inHotTrussTask;
|
||||
@Autowired
|
||||
private InHotDockingTrussTask inHotDockingTrussTask;
|
||||
@Autowired
|
||||
private IstIvtHotpointivtService hotpointivtService;
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject acsRequestOutHotTask(JSONObject param) {
|
||||
@@ -55,6 +59,10 @@ public class BakingOperationServiceImpl implements BakingOperationService {
|
||||
if (schBaseTasks.size() > 0) {
|
||||
throw new BadRequestException("点位[" + deviceCode + "]已经存在任务!");
|
||||
}
|
||||
StIvtHotpointivt hotPoint = hotpointivtService.getPointByCode(deviceCode, false);
|
||||
if ("01".equals(hotPoint.getPoint_status())) {
|
||||
throw new BadRequestException("烘箱「" + deviceCode + "」系统库存为空!");
|
||||
}
|
||||
param.put("config_code", "OutHotToDockingTrussTask");
|
||||
outHotToDockingTrussTask.apply(param);
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
@@ -26,11 +26,10 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.wms.util.PointUtils.*;
|
||||
import static org.nl.wms.util.TaskUtils.checkTaskOptionStatus;
|
||||
import static org.nl.wms.util.TaskUtils.setUpdateByPC;
|
||||
import static org.nl.wms.util.TaskUtils.setUpdateByType;
|
||||
import static org.nl.wms.sch.task_manage.core.constant.RegionConstant.REGION_A1_HXZC;
|
||||
import static org.nl.wms.util.PointUtils.hotClearPoint;
|
||||
import static org.nl.wms.util.PointUtils.setHxUpdateByType;
|
||||
import static org.nl.wms.util.TaskUtils.*;
|
||||
|
||||
/**
|
||||
* 创建出烘箱任务
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package org.nl.wms.sch.task_manage.tasks.slitter;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.TaskStatus;
|
||||
import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.core.constant.RegionConstant;
|
||||
import org.nl.wms.sch.task_manage.core.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.wms.util.TaskUtils.checkTaskOptionStatus;
|
||||
import static org.nl.wms.util.TaskUtils.setUpdateByPC;
|
||||
|
||||
/**
|
||||
* 分切复烤AGV任务
|
||||
* @Author: lyd
|
||||
* @Date: 2024/9/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("SlitterRebakeAGVTask")
|
||||
public class SlitterRebakeAGVTask extends AbstractTask {
|
||||
private final String THIS_CLASS = SlitterRebakeAGVTask.class.getName();
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Override
|
||||
public void create() throws BadRequestException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createCompletion(SchBaseTask task) {
|
||||
TaskUtils.taskLock(RegionConstant.REGION_A1_HXZC + "5", () -> {
|
||||
// 找个对接位(状态是空的,没有任务的)
|
||||
List<SchBasePoint> endPoints = pointService.getHotNotTaskPoint("A1", RegionConstant.REGION_A1_HXZC,
|
||||
"5", "1");
|
||||
if (endPoints.size() == 0) {
|
||||
throw new BadRequestException("没有可用的烘箱对接位!");
|
||||
}
|
||||
SchBasePoint endPoint = endPoints.get(0);
|
||||
task.setPoint_code2(endPoint.getPoint_code());
|
||||
// 保存任务参数
|
||||
task.setHandle_class(THIS_CLASS);
|
||||
task.setTask_status(TaskStatus.START_AND_POINT.getCode());
|
||||
setUpdateByPC(task);
|
||||
taskService.save(task);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
checkTaskOptionStatus(taskObj);
|
||||
JSONObject requestObj = JSONObject.parseObject(taskObj.getRequest_param());
|
||||
String orderCode = requestObj.getString("order_code");
|
||||
// 点位赋值。
|
||||
String endPointCode = taskObj.getPoint_code2();
|
||||
SchBasePoint endPoint = pointService.getById(endPointCode);
|
||||
endPoint.setPoint_status("5");
|
||||
endPoint.setMaterial_code(orderCode);
|
||||
PointUtils.setUpdateByType(endPoint, taskFinishedType);
|
||||
pointService.updateById(endPoint);
|
||||
// 完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
checkTaskOptionStatus(taskObj);
|
||||
// 取消
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
@@ -121,18 +121,18 @@
|
||||
/>
|
||||
<el-table-column prop="code" :label="$t('Record.table.code')" :min-width="flexWidth('code',crud.data,$t('Record.table.code'))" />
|
||||
<el-table-column prop="message" :label="$t('Record.table.message')" :min-width="flexWidth('message',crud.data,$t('Record.table.message'))" />
|
||||
<!-- <el-table-column-->
|
||||
<!-- prop="request_param"-->
|
||||
<!-- :label="$t('Record.table.request_param')"-->
|
||||
<!-- show-overflow-tooltip-->
|
||||
<!-- :min-width="200"-->
|
||||
<!-- />-->
|
||||
<!-- <el-table-column-->
|
||||
<!-- prop="response_param"-->
|
||||
<!-- :label="$t('Record.table.response_param')"-->
|
||||
<!-- show-overflow-tooltip-->
|
||||
<!-- :min-width="200"-->
|
||||
<!-- />-->
|
||||
<el-table-column
|
||||
prop="api_url"
|
||||
label="URL"
|
||||
show-overflow-tooltip
|
||||
:min-width="200"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="target_class"
|
||||
label="Class"
|
||||
show-overflow-tooltip
|
||||
:min-width="200"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="record_time"
|
||||
:label="$t('Record.table.record_time')"
|
||||
@@ -145,7 +145,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_success" :label="$t('Record.table.is_success')" :min-width="flexWidth('is_success',crud.data,$t('Record.table.is_success'))">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_success ? $t('common.Success') : $t('common.Fail') }}
|
||||
<el-tag v-if="scope.row.is_success" type="success">{{ $t('common.Success') }}</el-tag>
|
||||
<el-tag v-else type="danger">{{ $t('common.Fail') }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column v-permission="[]" :label="$t('common.Operate')" width="120px" align="center" fixed="right">-->
|
||||
|
||||
Reference in New Issue
Block a user