首页》个人工作台
This commit is contained in:
parent
5853279a53
commit
7253022f9d
|
|
@ -1,5 +1,18 @@
|
|||
package com.nflg.product.material.api.user.material;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.db.Session;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nflg.product.base.core.api.BaseApi;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.material.constant.MaterialProcessStateEnum;
|
||||
import com.nflg.product.material.constant.MaterialUpdateBillStateEnum;
|
||||
import com.nflg.product.material.pojo.entity.*;
|
||||
import com.nflg.product.material.pojo.vo.MaterialHomeMainVO;
|
||||
import com.nflg.product.material.pojo.vo.StandardPartPickRuleHomeVO;
|
||||
import com.nflg.product.material.service.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
|
|
@ -7,6 +20,13 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* packageName com.nflg.product.material.api.user.material
|
||||
*
|
||||
|
|
@ -18,17 +38,107 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@Api(tags = "主数据平台首页")
|
||||
@RestController
|
||||
@RequestMapping("home")
|
||||
public class MaterialHomeApi {
|
||||
public class MaterialHomeApi extends BaseApi {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tet
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("test")
|
||||
@ApiOperation("auto-批量删除")
|
||||
public ResultVO<String> test(String tet){
|
||||
System.out.println("tet1:"+tet);
|
||||
return ResultVO.success("返回才能够");
|
||||
@Resource
|
||||
MaterialMainService materialMainService;
|
||||
|
||||
@Resource
|
||||
private AuthorityDepartmentService authorityDepartmentService;
|
||||
|
||||
@Resource
|
||||
private StandardDeptService standardDeptService;
|
||||
|
||||
@Resource
|
||||
private StandardPartPickRuleService standardPartPickRuleService;
|
||||
|
||||
@Resource
|
||||
private MaterialUpdateBillService materialUpdateBillService;
|
||||
|
||||
@Resource
|
||||
private StandardPartPickRuleArgumentsService standardPartPickRuleArgumentsService;
|
||||
|
||||
@Resource
|
||||
private StandardCategoryService standardCategoryService;
|
||||
|
||||
@GetMapping("materialManagement")
|
||||
@ApiOperation("物料管理")
|
||||
public ResultVO<Map<String,List<MaterialHomeMainVO>>> materialManagement(){
|
||||
Map<String,List<MaterialHomeMainVO>> mp = Maps.newHashMap();
|
||||
List<MaterialHomeMainVO> mainList = materialMainService.listByHome(null,5);
|
||||
List<MaterialHomeMainVO> mainUpdateList = materialUpdateBillService.listByHome(null,5);
|
||||
mp.put("mainList",mainList);
|
||||
mp.put("mainUpdateList",mainUpdateList);
|
||||
return ResultVO.success(mp);
|
||||
}
|
||||
|
||||
@GetMapping("materialMessage")
|
||||
@ApiOperation("消息提醒")
|
||||
public ResultVO<Map<String,List<MaterialHomeMainVO>>> materialMessage(){
|
||||
Map<String,List<MaterialHomeMainVO>> mp = Maps.newHashMap();
|
||||
List<MaterialHomeMainVO> mainList = materialMainService.listByHome(MaterialProcessStateEnum.REJECT.getValue(),5);
|
||||
List<MaterialHomeMainVO> mainUpdateList = materialUpdateBillService.listByHome(MaterialUpdateBillStateEnum.REJECT.getValue(),5);
|
||||
mp.put("mainList",mainList);
|
||||
mp.put("mainUpdateList",mainUpdateList);
|
||||
return ResultVO.success(mp);
|
||||
}
|
||||
|
||||
@GetMapping("materialMessage")
|
||||
@ApiOperation("标准部件")
|
||||
public ResultVO<Map<String, List<StandardPartPickRuleHomeVO>>> standardPartList(){
|
||||
//仅取90天内的数据
|
||||
Date date90 = DateUtil.offsetDay(new Date(),-90);
|
||||
|
||||
Map<String, List<StandardPartPickRuleHomeVO>> mp = Maps.newHashMap();
|
||||
AuthorityDepartmentEntity auDept = authorityDepartmentService.getById(SessionUtil.getPartRowId());
|
||||
//获取当前登录用户的标准件部门id
|
||||
StandardDeptEntity sDept = standardDeptService.getOne(Wrappers.<StandardDeptEntity>lambdaQuery()
|
||||
.eq(StandardDeptEntity::getDeptCode,auDept.getDptCode()),false);
|
||||
if(sDept == null){
|
||||
return ResultVO.success(mp);
|
||||
}
|
||||
//规则集合,含共享部门及创建部门
|
||||
List<StandardPartPickRuleEntity> ruleList = standardPartPickRuleService.list(Wrappers.<StandardPartPickRuleEntity>lambdaQuery()
|
||||
.ge(StandardPartPickRuleEntity::getCreatedTime,date90)
|
||||
.and(wp-> wp.eq(StandardPartPickRuleEntity::getDeptRowId,sDept.getRowId())
|
||||
.or(w -> w.like(StandardPartPickRuleEntity::getShareDeptRowId,sDept.getRowId())))
|
||||
.orderByDesc(StandardPartPickRuleEntity::getCreatedTime)
|
||||
.last(String.format("limit %d",5)));
|
||||
if(ruleList.isEmpty()){
|
||||
return ResultVO.success(mp);
|
||||
}
|
||||
//分类集合
|
||||
List<StandardCategoryEntity> categoryList = standardCategoryService.list(Wrappers.<StandardCategoryEntity>lambdaQuery()
|
||||
.in(StandardCategoryEntity::getRowId,ruleList.stream().map(StandardPartPickRuleEntity::getCategoryRowId).collect(Collectors.toList())));
|
||||
|
||||
//参数集合
|
||||
List<StandardPartPickRuleArgumentsEntity> argList = standardPartPickRuleArgumentsService.list(Wrappers.<StandardPartPickRuleArgumentsEntity>lambdaQuery()
|
||||
.in(StandardPartPickRuleArgumentsEntity::getPickRuleRowId,ruleList.stream().map(StandardPartPickRuleEntity::getRowId).collect(Collectors.toList()))
|
||||
.orderByAsc(StandardPartPickRuleArgumentsEntity::getOrderNum));
|
||||
//本部门设置的选配规则
|
||||
List<StandardPartPickRuleHomeVO> desginList = Lists.newArrayList();
|
||||
//本部门可用的选配规则
|
||||
List<StandardPartPickRuleHomeVO> shareList = Lists.newArrayList();
|
||||
|
||||
ruleList.forEach(rule -> {
|
||||
StandardPartPickRuleHomeVO ruleHomeVO = new StandardPartPickRuleHomeVO();
|
||||
ruleHomeVO.setRowId(rule.getRowId());
|
||||
ruleHomeVO.setCategoryRowId(rule.getCategoryRowId());
|
||||
|
||||
ruleHomeVO.setCategoryName(categoryList.stream().filter(c -> Objects.equals(c.getRowId(),rule.getCategoryRowId()))
|
||||
.map(StandardCategoryEntity::getCategoryName).distinct().collect(Collectors.joining()));
|
||||
|
||||
ruleHomeVO.setArguments(argList.stream().filter(a -> Objects.equals(a.getRowId(),rule.getRowId()))
|
||||
.map(StandardPartPickRuleArgumentsEntity::getName).distinct().collect(Collectors.joining("/")));
|
||||
|
||||
|
||||
});
|
||||
|
||||
//本部门设置的选配规则
|
||||
|
||||
|
||||
return ResultVO.success(null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -17,4 +17,13 @@ public enum MaterialUpdateBillStateEnum {
|
|||
|
||||
private final Integer value;
|
||||
private final String description;
|
||||
|
||||
public static MaterialUpdateBillStateEnum findDescriptionByValue(Integer value) {
|
||||
for (MaterialUpdateBillStateEnum valueEnum : MaterialUpdateBillStateEnum.values()) {
|
||||
if (valueEnum.getValue().equals(value)) {
|
||||
return valueEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,6 +221,8 @@ public class MaterialMainEntity implements Serializable {
|
|||
@ApiModelProperty("驳回原因")
|
||||
private String rejectResion;
|
||||
|
||||
@ApiModelProperty("驳回时间")
|
||||
private Date rejectTime;
|
||||
|
||||
/**
|
||||
* 物料分类编码
|
||||
|
|
|
|||
|
|
@ -177,6 +177,9 @@ public class MaterialUpdateBillEntity implements Serializable {
|
|||
@ApiModelProperty(value = "驳回原因")
|
||||
private String rejectResion;
|
||||
|
||||
@ApiModelProperty("驳回时间")
|
||||
private Date rejectTime;
|
||||
|
||||
/**
|
||||
* 驳回人
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.nflg.product.material.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* packageName com.nflg.product.material.pojo.vo
|
||||
*
|
||||
* @author luohj
|
||||
* @className MaterialHomeMainVO
|
||||
* @date 2024/7/29 0029
|
||||
* @description 首页
|
||||
*/
|
||||
@Data
|
||||
public class MaterialHomeMainVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "表行id")
|
||||
private Long rowId;
|
||||
|
||||
@ApiModelProperty(value = "物料编码")
|
||||
private String materialNo;
|
||||
|
||||
@ApiModelProperty(value = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty(value = "流程状态")
|
||||
private Integer processState;
|
||||
|
||||
@ApiModelProperty(value = "流程状态名称")
|
||||
private String processStateName;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.nflg.product.material.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author 曹鹏飞
|
||||
* @date 2024/5/9 11:31:31
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class StandardPartPickRuleHomeVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 行ID
|
||||
*/
|
||||
@ApiModelProperty(value = "行ID")
|
||||
private Long rowId;
|
||||
|
||||
/**
|
||||
* 部件类型的行ID
|
||||
*/
|
||||
@ApiModelProperty(value = "部件类型的行ID")
|
||||
@NotNull
|
||||
private Long categoryRowId;
|
||||
|
||||
/*
|
||||
* 部件类型的名称
|
||||
*/
|
||||
@ApiModelProperty(value = "部件类型的名称")
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 参数
|
||||
*/
|
||||
@ApiModelProperty(value = "参数")
|
||||
private String arguments;
|
||||
}
|
||||
|
|
@ -3,12 +3,14 @@ package com.nflg.product.material.service;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
|
@ -18,6 +20,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.base.core.vo.PageVO;
|
||||
|
|
@ -2874,4 +2877,36 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
|||
List<MaterialMainEntity> list=lambdaQuery().in(MaterialMainEntity::getMaterialNo, materialNos).list();
|
||||
return Convert.toList(MaterialMainVO.class, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页》物料管理》我的物料申请
|
||||
* @param processState 流程状态
|
||||
* @param limitNums 取数
|
||||
* @return
|
||||
*/
|
||||
public List<MaterialHomeMainVO> listByHome(Integer processState,Integer limitNums){
|
||||
List<MaterialHomeMainVO> rlist = Lists.newArrayList();
|
||||
//仅取90天内的数据
|
||||
Date date90 = DateUtil.offsetDay(new Date(),-90);
|
||||
LambdaQueryWrapper<MaterialMainEntity> lw = Wrappers.<MaterialMainEntity>lambdaQuery()
|
||||
.eq(MaterialMainEntity::getCreatedBy, SessionUtil.getUserCode());
|
||||
//消息提醒,仅获取已驳回的记录
|
||||
if(Objects.equals(processState,MaterialProcessStateEnum.REJECT.getValue())){
|
||||
lw.eq(MaterialMainEntity::getProcessState,processState);
|
||||
lw.ge(MaterialMainEntity::getRejectTime,date90).orderByDesc(MaterialMainEntity::getRejectTime);
|
||||
}else{
|
||||
lw.ge(MaterialMainEntity::getCreatedTime,date90).orderByDesc(MaterialMainEntity::getCreatedTime);
|
||||
}
|
||||
lw.last(String.format("limit %d",limitNums));
|
||||
|
||||
List<MaterialMainEntity> mainList = this.list(lw);
|
||||
|
||||
if(!mainList.isEmpty()){
|
||||
rlist = Convert.toList(MaterialHomeMainVO.class,mainList);
|
||||
rlist.forEach(r -> r.setProcessStateName(Optional.ofNullable(MaterialProcessStateEnum.findDescriptionByValue(r.getProcessState()))
|
||||
.map(MaterialProcessStateEnum::getDescription).orElse("") ));
|
||||
}
|
||||
return rlist;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.nflg.product.base.core.config.SpringContextUtils;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
|
|
@ -36,6 +37,7 @@ import java.math.RoundingMode;
|
|||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -66,6 +68,9 @@ public class MaterialSubmitService {
|
|||
@Value("${oa.timeout}")
|
||||
private int timeout;
|
||||
|
||||
@Value("${spring.profiles.active}")
|
||||
private String profiles;
|
||||
|
||||
public void submitOne(Long rowId) {
|
||||
|
||||
MaterialMainVO materialMainVO = materialMainService.selectByRowId(rowId, MaterialMainTypeEnum.ONE.getCode());
|
||||
|
|
@ -511,6 +516,7 @@ public class MaterialSubmitService {
|
|||
//更新完结流程
|
||||
log.info("物料申请--OA返回结果--通过:" + JSON.toJSONString(oaRowIds));
|
||||
if (oaRowIds.size() > 0) {
|
||||
|
||||
try {
|
||||
// oaId去重
|
||||
List<String> oaRowIdList = oaRowIds.stream().distinct().collect(Collectors.toList());
|
||||
|
|
@ -525,9 +531,23 @@ public class MaterialSubmitService {
|
|||
// oaId去重
|
||||
List<OaRejectDTO> rejects = rejectList.stream().collect(Collectors.collectingAndThen(
|
||||
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(OaRejectDTO::getInstId))), ArrayList::new));
|
||||
List<MaterialMainEntity> mList = materialMainService.list(Wrappers.<MaterialMainEntity>lambdaQuery().in(MaterialMainEntity::getOaRowId,
|
||||
rejects.stream().map(OaRejectDTO::getInstId).distinct().collect(Collectors.toList())));
|
||||
Map<String,String> mainMap = mList.stream().collect(Collectors.toMap(m -> String.valueOf(m.getOaRowId()), MaterialMainEntity::getCreatedBy,(k1, k2)->k1));
|
||||
for (OaRejectDTO r : rejects) {
|
||||
try {
|
||||
materialMainService.getBaseMapper().reject("", r.getReturnMessage(), r.getInstId());
|
||||
//已驳回,发送RTX消息给用户 by luohj 240730
|
||||
String receiver = mainMap.get(r.getInstId());
|
||||
if(StrUtil.isNotBlank(receiver)){
|
||||
String msg = mList.stream().filter(m -> Objects.equals(String.valueOf(m.getOaRowId()),r.getInstId()))
|
||||
.map(m -> String.format("%s %s",m.getMaterialNo(),m.getMaterialName()))
|
||||
.collect(Collectors.joining("\n"));
|
||||
CompletableFuture.runAsync(() -> {
|
||||
httpUtils.rtxMessage(profiles,"物料新增申请【被驳回】",msg,Objects.equals(receiver,"admin")?"10002327":receiver);
|
||||
}).join();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("OAID为:" + r.getInstId() + "修改申请信息异常", e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,19 @@ package com.nflg.product.material.service;
|
|||
|
||||
import cn.hutool.cache.impl.TimedCache;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
|
|
@ -23,6 +28,7 @@ import com.nflg.product.material.pojo.dto.MaterialMainAttrDTO;
|
|||
import com.nflg.product.material.pojo.dto.MaterialUpdateBillDTO;
|
||||
import com.nflg.product.material.pojo.entity.*;
|
||||
import com.nflg.product.material.pojo.query.MaterialUpdateBillQuery;
|
||||
import com.nflg.product.material.pojo.vo.MaterialHomeMainVO;
|
||||
import com.nflg.product.material.pojo.vo.MaterialMainAttrValuesVO;
|
||||
import com.nflg.product.material.pojo.vo.MaterialMainVO;
|
||||
import com.nflg.product.material.pojo.vo.MaterialUpdateBillVO;
|
||||
|
|
@ -961,4 +967,48 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
|
|||
public List<Map<String, Object>> getCurrentUpdateMaterial(List<String> list) {
|
||||
return materialUpdateBillMapper.getCurrentUpdateMaterial(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页》物料管理》我的变更申请
|
||||
* @return
|
||||
*/
|
||||
public List<MaterialHomeMainVO> listByHome(Integer billState,Integer limitNums){
|
||||
List<MaterialHomeMainVO> rlist = Lists.newArrayList();
|
||||
//仅取90天内的数据
|
||||
Date date90 = DateUtil.offsetDay(new Date(),-90);
|
||||
|
||||
LambdaQueryWrapper<MaterialUpdateBillEntity> lw = Wrappers.<MaterialUpdateBillEntity>lambdaQuery()
|
||||
.eq(MaterialUpdateBillEntity::getCreatedBy,SessionUtil.getUserCode());
|
||||
|
||||
//消息提醒,仅取已驳回记录
|
||||
if(Objects.equals(billState,MaterialUpdateBillStateEnum.REJECT.getValue())){
|
||||
lw.eq(MaterialUpdateBillEntity::getBillState,billState)
|
||||
.ge(MaterialUpdateBillEntity::getRejectTime,date90)
|
||||
.orderByDesc(MaterialUpdateBillEntity::getRejectTime);
|
||||
}else{
|
||||
lw.ge(MaterialUpdateBillEntity::getCreatedTime,date90)
|
||||
.orderByDesc(MaterialUpdateBillEntity::getCreatedTime);
|
||||
}
|
||||
lw.last(String.format("limit %d",limitNums));
|
||||
|
||||
List<MaterialUpdateBillEntity> entityList = this.list(Wrappers.<MaterialUpdateBillEntity>lambdaQuery()
|
||||
.eq(MaterialUpdateBillEntity::getCreatedBy,SessionUtil.getUserCode())
|
||||
.eq(null != billState,MaterialUpdateBillEntity::getBillState,billState)
|
||||
.ge(MaterialUpdateBillEntity::getCreatedTime,date90)
|
||||
.orderByDesc(MaterialUpdateBillEntity::getCreatedTime)
|
||||
.last(String.format("limit %d",limitNums)));
|
||||
if(!entityList.isEmpty()){
|
||||
entityList.forEach(e -> {
|
||||
MaterialHomeMainVO r = Convert.convert(MaterialHomeMainVO.class,e);
|
||||
if(StrUtil.isBlank(r.getMaterialName())){
|
||||
r.setMaterialName(Optional.ofNullable(e.getOldMaterialDesc()).orElse(""));
|
||||
}
|
||||
r.setProcessState(e.getBillState());
|
||||
r.setProcessStateName(Optional.ofNullable(MaterialUpdateBillStateEnum.findDescriptionByValue(e.getBillState()))
|
||||
.map(MaterialUpdateBillStateEnum::getDescription).orElse(""));
|
||||
rlist.add(r);
|
||||
});
|
||||
}
|
||||
return rlist;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
|
|
@ -31,6 +32,7 @@ import java.io.IOException;
|
|||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -67,6 +69,9 @@ public class MaterialUpdateToOAService {
|
|||
@Value("${oa.timeout}")
|
||||
private int timeout;
|
||||
|
||||
@Value("${spring.profiles.active}")
|
||||
private String profiles;
|
||||
|
||||
public void submit(List<Long> rowIds) {
|
||||
List<MaterialUpdateBillEntity> entityList = materialUpdateBillService.lambdaQuery().in(MaterialUpdateBillEntity::getRowId, rowIds).list();
|
||||
sysnToOa(entityList);
|
||||
|
|
@ -435,9 +440,24 @@ public class MaterialUpdateToOAService {
|
|||
// oaId去重
|
||||
List<OaRejectDTO> rejects = rejectList.stream().collect(Collectors.collectingAndThen(
|
||||
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(OaRejectDTO::getInstId))), ArrayList::new));
|
||||
|
||||
List<MaterialUpdateBillEntity> mList = materialUpdateBillService.list(Wrappers.<MaterialUpdateBillEntity>lambdaQuery().in(MaterialUpdateBillEntity::getOaRowId,
|
||||
rejects.stream().map(OaRejectDTO::getInstId).distinct().collect(Collectors.toList())));
|
||||
Map<String,String> mainMap = mList.stream().collect(Collectors.toMap(m -> String.valueOf(m.getOaRowId()), MaterialUpdateBillEntity::getCreatedBy,(k1, k2)->k1));
|
||||
|
||||
for (OaRejectDTO r : rejects) {
|
||||
try {
|
||||
materialUpdateBillService.getBaseMapper().rejectBill(r.getReturnMessage(), r.getInstId(), "");
|
||||
//已驳回,发送RTX消息给用户 by luohj 240730
|
||||
String receiver = mainMap.get(r.getInstId());
|
||||
if(StrUtil.isNotBlank(receiver)){
|
||||
String msg = mList.stream().filter(m -> Objects.equals(String.valueOf(m.getOaRowId()),r.getInstId()))
|
||||
.map(m -> String.format("%s %s",m.getMaterialNo(),Optional.ofNullable(m.getMaterialName()).orElse(m.getOldMaterialDesc())))
|
||||
.collect(Collectors.joining("\n"));
|
||||
CompletableFuture.runAsync(() -> {
|
||||
httpUtils.rtxMessage(profiles,"物料变更申请【被驳回】",msg,Objects.equals(receiver,"admin")?"10002327":receiver);
|
||||
}).join();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("OAID为:" + r.getInstId() + "修改变更信息异常", e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
package com.nflg.product.material.util;
|
||||
|
||||
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -11,8 +15,10 @@ import org.springframework.http.HttpStatus;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
|
|
@ -392,5 +398,28 @@ public class HttpUtils {
|
|||
return getOkHttpClient().newCall(request).execute();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param profiles 环境变量
|
||||
* @param title 消息标题
|
||||
* @param msg 消息内容
|
||||
* @param receiver 接收人,工号,多人以,隔开
|
||||
*/
|
||||
public void rtxMessage(String profiles, String title, String msg, String receiver){
|
||||
String url = "http://192.168.0.1:8012/sendnotify.cgi";
|
||||
try{
|
||||
if(!ObjectUtil.equal(profiles.toLowerCase(),"prod")){
|
||||
title += "(测试)";
|
||||
}
|
||||
title = URLEncoder.encode(title, "GBK");
|
||||
msg = URLEncoder.encode(msg, "GBK");
|
||||
receiver = URLEncoder.encode(receiver, "GBK");
|
||||
url += "?title=" + title + "&msg=" + msg + "&delaytime=0&receiver=" + receiver;
|
||||
String re = this.doGet(url);
|
||||
}catch (Exception e){
|
||||
log.error("RTX消息发送异常:{}" ,e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -388,6 +388,7 @@
|
|||
UPDATE t_material_main
|
||||
set reject_user=#{rejectUser},
|
||||
reject_resion=#{rejectResion},
|
||||
reject_time = now(),
|
||||
process_state=2
|
||||
where oa_row_id = #{oaRowId}
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@
|
|||
|
||||
<update id="rejectBill">
|
||||
update t_material_update_bill
|
||||
set bill_state=5, reject_resion=#{rejectResion}, reject_user=#{rejectUser}
|
||||
set bill_state=5, reject_resion=#{rejectResion},reject_time=now(), reject_user=#{rejectUser}
|
||||
where oa_row_id = #{oaRowId}
|
||||
</update>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,17 +2,22 @@ package com.nflg.product.bomnew.api.user;
|
|||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||
import com.nflg.product.base.core.api.BaseApi;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.bomnew.constant.EBomConstant;
|
||||
import com.nflg.product.bomnew.constant.EBomSourceEnum;
|
||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||
import com.nflg.product.bomnew.constant.*;
|
||||
import com.nflg.product.bomnew.pojo.dto.*;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||
|
|
@ -557,4 +562,34 @@ public class EbomApi extends BaseApi {
|
|||
return ResultVO.success(true);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("byHome")
|
||||
public ResultVO<Map<String,List<BomNewHomeBomVO>>> byHome(){
|
||||
Map<String,List<BomNewHomeBomVO>> mp = Maps.newHashMap();
|
||||
//仅取90天内的数据
|
||||
Date date90 = DateUtil.offsetDay(new Date(),-90);
|
||||
int limitNums = 5;
|
||||
List<BomNewEbomParentEntity> eList = bomNewEbomParentService.list(Wrappers.<BomNewEbomParentEntity>lambdaQuery()
|
||||
.eq(BomNewEbomParentEntity::getCreatedBy,SessionUtil.getUserCode())
|
||||
.ge(BomNewEbomParentEntity::getCreatedTime,date90)
|
||||
.orderByDesc(BomNewEbomParentEntity::getCreatedTime)
|
||||
.last(String.format("limit %d",limitNums)));
|
||||
List<BomNewHomeBomVO> ebomList = Convert.toList(BomNewHomeBomVO.class,eList);
|
||||
ebomList.forEach(e->e.setEditStatusName( EbomEditStatusEnum.byValue(e.getEditStatus())));
|
||||
mp.put("ebomList",ebomList);
|
||||
|
||||
List<BomNewPbomParentEntity> pList = bomNewPbomParentService.list(Wrappers.<BomNewPbomParentEntity>lambdaQuery()
|
||||
.eq(BomNewPbomParentEntity::getCreatedBy,SessionUtil.getUserCode())
|
||||
.ge(BomNewPbomParentEntity::getCreatedTime,date90)
|
||||
.orderByDesc(BomNewPbomParentEntity::getCreatedTime)
|
||||
.last(String.format("limit %d",limitNums)));
|
||||
|
||||
List<BomNewHomeBomVO> pbomList = Convert.toList(BomNewHomeBomVO.class,pList);
|
||||
pbomList.forEach(p -> p.setEditStatusName(PBomEditStatusEnum.byValue(p.getEditStatus())));
|
||||
mp.put("pbomList",pbomList);
|
||||
|
||||
return ResultVO.success(mp);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
package com.nflg.product.bomnew.constant;
|
||||
|
||||
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum EbomEditStatusEnum implements ValueEnum<Integer> {
|
||||
|
|
@ -11,7 +15,21 @@ public enum EbomEditStatusEnum implements ValueEnum<Integer> {
|
|||
HANDLER_CREATED(1, "待处理"),//待处理=暂存
|
||||
HANDLER_FINISHED(2, "已处理"); //已处理=提交
|
||||
|
||||
|
||||
private final Integer value;
|
||||
private final String description;
|
||||
|
||||
public static EbomEditStatusEnum findDescriptionByValue(Integer value) {
|
||||
for (EbomEditStatusEnum valueEnum :EbomEditStatusEnum.values()) {
|
||||
if (valueEnum.getValue().equals(value)) {
|
||||
return valueEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String byValue(Integer value){
|
||||
return Optional.ofNullable(findDescriptionByValue(value))
|
||||
.map(EbomEditStatusEnum::getDescription).orElse("");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.nflg.product.bomnew.constant;
|
|||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PBomEditStatusEnum implements ValueEnum<Integer>{
|
||||
|
|
@ -15,4 +17,19 @@ public enum PBomEditStatusEnum implements ValueEnum<Integer>{
|
|||
|
||||
private final Integer value;
|
||||
private final String description;
|
||||
|
||||
|
||||
public static PBomEditStatusEnum findDescriptionByValue(Integer value) {
|
||||
for (PBomEditStatusEnum valueEnum :PBomEditStatusEnum.values()) {
|
||||
if (valueEnum.getValue().equals(value)) {
|
||||
return valueEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String byValue(Integer value){
|
||||
return Optional.ofNullable(findDescriptionByValue(value))
|
||||
.map(PBomEditStatusEnum::getDescription).orElse("");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* packageName com.nflg.product.bomnew.pojo.vo
|
||||
*
|
||||
* @author luohj
|
||||
* @className BomNewHomeBomVO
|
||||
* @date 2024/7/30 0030
|
||||
* @description TODO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BomNewHomeBomVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "主键-行ID")
|
||||
private Long rowId;
|
||||
|
||||
@ApiModelProperty(value = "物料编码")
|
||||
private String materialNo;
|
||||
|
||||
@ApiModelProperty(value = "图号")
|
||||
private String drawingNo;
|
||||
|
||||
@ApiModelProperty(value = "处理状态")
|
||||
private Integer editStatus;
|
||||
|
||||
@ApiModelProperty(value = "处理状态名称")
|
||||
private String editStatusName;
|
||||
}
|
||||
Loading…
Reference in New Issue