Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom

This commit is contained in:
大米 2024-04-11 17:13:22 +08:00
commit 2d3e271709
25 changed files with 294 additions and 95 deletions

View File

@ -0,0 +1,70 @@
package com.nflg.product.bomnew.api.user;
import cn.hutool.core.util.StrUtil;
import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.bomnew.pojo.dto.CacheDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import nflg.product.common.vo.ResultVO;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.lang.NonNull;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
/**
* @author 曹鹏飞
* @date 2024/4/9 09:22:09
*/
@Api(tags = "缓存接口")
@RestController
@RequestMapping("bom/new/cache")
public class CacheApi extends BaseApi {
private static final String PREFIX = "frontend:";
@Resource
private RedisTemplate<String, String> redisTemplate;
/**
* 设置用户缓存
* @param key 缓存key
* @param content 缓存内容
* @return
*/
@PostMapping("set")
@ApiOperation("设置缓存")
public ResultVO<String> setCache(@Valid @RequestBody CacheDTO data) {
redisTemplate.boundValueOps(buildKey(data.key)).set(data.value);
return ResultVO.success();
}
/**
* 获取用户缓存
* @param key 缓存key
* @return
*/
@GetMapping("get")
@ApiOperation("获取缓存")
public ResultVO<String> getCache(@Valid @RequestParam @NonNull String key) {
return ResultVO.success(redisTemplate.boundValueOps(buildKey(key)).get());
}
/**
* 删除用户缓存
* @param key 缓存key
* @return
*/
@DeleteMapping("del")
@ApiOperation("删除缓存")
public ResultVO<String> delCache(@Valid @RequestBody CacheDTO data) {
redisTemplate.delete(buildKey(data.key));
return ResultVO.success();
}
private String buildKey(String key) {
return StrUtil.format("{}:{}:{}", PREFIX, SessionUtil.getUserCode(), key);
}
}

View File

@ -260,8 +260,7 @@ public class EbomApi extends BaseApi {
dto.setRevertUserName(SessionUtil.getUserName());
dto.setUserCode(SessionUtil.getUserCode());
bomNewEbomParentService.revertDesign(dto);
//更新-待复核根节点
bomNewEbomParentService.getBaseMapper().updateRootForWaitReview();
return ResultVO.success(true);
@ -367,7 +366,7 @@ public class EbomApi extends BaseApi {
checkDeleteRule(dto);
bomNewEbomParentService.deleteBomChild(dto.getDelDatas());
BomNewEbomParentVO temporary = bomNewEbomParentService.temporary(dto);
bomNewEbomParentService.getBaseMapper().updateRootForWaitReview();
return ResultVO.success(temporary);
}
@ -378,7 +377,7 @@ public class EbomApi extends BaseApi {
checkDeleteRule(dto);
bomNewEbomParentService.deleteBomChild(dto.getDelDatas());
BomNewEbomParentVO temporary = bomNewEbomParentService.temporary(dto);
bomNewEbomParentService.getBaseMapper().updateRootForWaitReview();
// bomNewEbomParentService.getBaseMapper().updateRootForWaitReview();
return ResultVO.success(temporary);
}
@ -441,8 +440,8 @@ public class EbomApi extends BaseApi {
dto.setRealName("郑军榕");
dto.setDepartName("信息流程中心/IT支持");
dto.setFullDeptName("信息流程中心/IT支持");
dto.setRowId(1585164668335439881l);
SessionUtil.loginUser.set(dto);
dto.setRowId(1585164668335439881L);
BaseApi.loginUser.set(dto);
return ResultVO.success();
}

View File

@ -155,13 +155,17 @@ public class PBomApi extends BaseApi {
return ResultVO.success(true);
}
/**
* 删除
* @param param 包含删除BOM所需信息的DTO数据传输对象
* @return data字段表示删除的bom中是否包含工艺包包含工艺包时需要刷新列表数据true为包含false为不包含
*/
@PostMapping("editDel")
@ApiOperation("编辑-删除")
@LogRecord(success = "PBom-编辑-删除,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#param.bomRowId}}",type = "PBom-编辑-删除")
public ResultVO<Boolean> editDel(@Valid @RequestBody EditPBomDelDTO param){
VUtils.isTure(CollUtil.isEmpty(param.getRowIdList())).throwMessage("请选择要删除的数据行");
bomNewPbomParentService.editDel(param);
return ResultVO.success(true);
return ResultVO.success(bomNewPbomParentService.editDel(param));
}
@PostMapping("setVirtualPart")

View File

@ -8,4 +8,8 @@ public class MaterialMainConstant {
public static final String MaterialNo_31="31";
/*
* 工艺包类别编号
*/
public static final String CATEGORYCODE_TECHNOLOGYPACKAGE = "201201";
}

View File

@ -23,4 +23,8 @@ public interface BomNewPbomChildMapper extends BaseMapper<BomNewPbomChildEntity>
void delByParentRowId(@Param("parentRowId") Long parentRowId);
void setProductionFactoryCode(@Param("productionFactoryCode")String productionFactoryCode, @Param("rowIds") List<Long> rowIds);
List<BomNewPbomChildEntity> getChildrenByChildRowId(Long rowId);
void setParentRowId(List<Long> rowIds, Long parentRowId);
}

View File

@ -0,0 +1,18 @@
package com.nflg.product.bomnew.pojo.dto;
/**
* @author 曹鹏飞
* @date 2024/4/10 17:31:57
*/
public class CacheDTO {
/*
* 缓存key
*/
public String key;
/*
* 缓存value
*/
public String value;
}

View File

@ -1,19 +1,18 @@
package com.nflg.product.bomnew.pojo.entity;
import java.math.BigDecimal;
import cn.hutool.core.util.NumberUtil;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDate;
/**
* t_bom_new_original_child
@ -136,7 +135,7 @@ public class BomNewOriginalChildEntity implements Serializable {
private Long bomVersionRowId;
public BigDecimal getTotalWeight() {
return NumberUtil.mul(this.getUnitWeight(), this.num);
return NumberUtil.mul(this.unitWeight, this.num);
}
private static final long serialVersionUID = -61829104329368344L;

View File

@ -1,19 +1,17 @@
package com.nflg.product.bomnew.pojo.entity;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDate;
/**
* t_bom_new_pbom_child
@ -148,6 +146,7 @@ public class BomNewPbomChildEntity implements Serializable {
/**
* 生产工厂设置方式 0-默认 1-规则匹配 2-手工
* @see com.nflg.product.bomnew.constant.ProductionFactoryCodeInputTypeEnum
*/
@TableField(value = "production_factory_code_input_type")
@ApiModelProperty("生产工厂设置方式 0-默认 1-规则匹配 2-手工")
@ -218,6 +217,7 @@ public class BomNewPbomChildEntity implements Serializable {
/**
* 0-非虚拟包 1-发货包 2-制作包 4-直发包 8-发货前装配包
* @see com.nflg.product.bomnew.constant.VirtualPackageTypeEnum
*/
@TableField(value = "virtual_part_type")
@ApiModelProperty(value = "0-非虚拟包 1-发货包 2-制作包 4-直发包 8-发货前装配包")

View File

@ -1,19 +1,17 @@
package com.nflg.product.bomnew.pojo.entity;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDate;
/**
* t_bom_new_pbom_parent
@ -169,6 +167,7 @@ public class BomNewPbomParentEntity implements Serializable {
/**
* 1=待处理2=暂存 3=已处理
* @see com.nflg.product.bomnew.constant.PBomEditStatusEnum
*/
@TableField(value = "edit_status")
@ApiModelProperty(value = "1=待处理、2=暂存 3=已处理")
@ -176,6 +175,7 @@ public class BomNewPbomParentEntity implements Serializable {
/**
* BOM状态1=待发布 2=待分配工厂 3=已分配工厂 4=已发布
* @see com.nflg.product.bomnew.constant.PBomStatusEnum
*/
@TableField(value = "status")
@ApiModelProperty(value = "BOM状态1=待发布 4=已发布 8=待分配工厂 16=已分配工厂")
@ -247,6 +247,7 @@ public class BomNewPbomParentEntity implements Serializable {
/**
* 创建人员所属岗位 0-设计人员 1-工艺人员 2-其他
* @see com.nflg.product.bomnew.constant.UserJobEnum
*/
@TableField(value = "created_job")
@ApiModelProperty(value = "创建人员所属岗位 0-设计人员 1-工艺人员 2-其他")

View File

@ -1111,7 +1111,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if(CollUtil.isEmpty(sameList)){
return ResultVO.success();
}else{
return ResultVO.error(StrUtil.format("包含相同物料 {}",StrUtil.join(",",sameList)));
return ResultVO.error(StrUtil.format("导入数据存在重复物料 {}",StrUtil.join(",",sameList)));
}
}
@ -1256,7 +1256,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
//更新-待复核根节点
// getBaseMapper().updateRootForWaitReview();
}
@ -1342,7 +1343,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
.set(BomNewEbomParentEntity::getAuditUserName, SessionUtil.getUserName())
.set(BomNewEbomParentEntity::getStatus, EBomStatusEnum.CHECKED.getValue())
.set(BomNewEbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_FINISHED.getValue())
.set(BomNewEbomParentEntity::getRootIsForWaitReview,0)
.set(BomNewEbomParentEntity::getRevertDesc,"")
.in(BomNewEbomParentEntity::getRowId, updateReviewIdList);
//child表状态变更
@ -1733,6 +1736,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
ebomChildService.getBaseMapper().updateEBomMaterialUse();
// ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
if (eBomEdit.isRootForWaitReview()) {
this.getBaseMapper().updateRootForWaitReview();
}
BomNewEbomParentVO retParentVO = Convert.convert(BomNewEbomParentVO.class, eBomEdit.getParentEntity());
retParentVO.setBomRowId(retParentVO.getRowId());
@ -1795,7 +1805,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
superMaterialStatus(dto.getDatas());
// checkAndSaveEBomException(dto.getParent().getBomRowId());
if (eBomEdit.isRootForWaitReview()) {
this.getBaseMapper().updateRootForWaitReview();
}
return true;

View File

@ -573,6 +573,8 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
BomNewOriginalChildEntity entChild = new BomNewOriginalChildEntity();
entChild.setRowId(k.getRowId());
entChild.setBomVersionRowId(k.getBomRowId());
entChild.setNum(k.getNum());
entChild.setUnitWeight(k.getUnitWeight());
originalChildEntities.add(entChild);
});
if (CollUtil.isNotEmpty(originalChildEntities)) {

View File

@ -6,6 +6,8 @@ import com.nflg.product.bomnew.mapper.master.BomNewPbomChildMapper;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* t_bom_new_pbom_child 表服务实现类
@ -17,4 +19,11 @@ import org.springframework.stereotype.Service;
@Service
public class BomNewPbomChildService extends ServiceImpl<BomNewPbomChildMapper, BomNewPbomChildEntity> {
public List<BomNewPbomChildEntity> getChildrenByChildRowId(Long rowId) {
return this.getBaseMapper().getChildrenByChildRowId(rowId);
}
public void setParentRowId(List<Long> rowIds, Long parentRowId) {
this.getBaseMapper().setParentRowId(rowIds, parentRowId);
}
}

View File

@ -366,28 +366,51 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
* @param paramDTO
*/
@Transactional(rollbackFor = Exception.class)
public void editDel(EditPBomDelDTO paramDTO) {
public boolean editDel(EditPBomDelDTO paramDTO) {
boolean hasTechnologypackage = false;
BomNewPbomParentEntity parent = this.getById(paramDTO.getBomRowId());
VUtils.isTure(Objects.isNull(parent)).throwMessage("参数bomRowId错误该BOM不存在");
BomNewPbomParentVO parentVO = Convert.convert(BomNewPbomParentVO.class, parent);
LogRecordContext.putVariable("bom",parent);
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO));
List<BomNewPbomChildEntity> childList = pbomChildService.getBaseMapper().selectBatchIds(paramDTO.getRowIdList());
List<BomNewPbomParentVO> childListVO = Convert.toList(BomNewPbomParentVO.class, childList);
materialMainService.intiMaterialInfo(childListVO);
// 判断是否是工艺包
List<BomNewPbomParentVO> technologypackages = childListVO.stream()
.filter(c -> MaterialMainConstant.CATEGORYCODE_TECHNOLOGYPACKAGE.equals(c.getMaterialCategoryCode()))
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(technologypackages)) {
//将工艺包子级提层
for (BomNewPbomParentVO t : technologypackages) {
//找出所有子级
List<BomNewPbomChildEntity> cc = pbomChildService.getChildrenByChildRowId(t.getRowId());
if (!cc.isEmpty()) {
hasTechnologypackage = true;
//将子级的父级id设置为工艺包的父级id
pbomChildService.setParentRowId(cc.stream().map(BomNewPbomChildEntity::getRowId).collect(Collectors.toList()),
t.getParentRowId());
}
}
}
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO));
// 机加工件 的子级可直接删除
if (parentVO.getMaterialCategoryCode().startsWith("200301")) {
pbomChildService.getBaseMapper().delByRowId(paramDTO.getRowIdList());
return;
return hasTechnologypackage;
}
//删除辅助物料
List<BomNewPbomParentVO> noDelList = childListVO.stream().filter(u -> !u.getMaterialCategoryCode().startsWith("1003") && !u.getMaterialCategoryCode().startsWith("1020") && !u.getMaterialCategoryCode().startsWith("1021")).collect(Collectors.toList());
List<BomNewPbomParentVO> noDelList = childListVO.stream()
.filter(u -> !u.getMaterialCategoryCode().startsWith("1003") && !u.getMaterialCategoryCode().startsWith("1020") && !u.getMaterialCategoryCode().startsWith("1021"))
.collect(Collectors.toList());
noDelList.removeAll(technologypackages);
VUtils.isTure(CollUtil.isNotEmpty(noDelList)).throwMessage("非机加工件的子级只能删除辅助物料");
pbomChildService.getBaseMapper().delByRowId(paramDTO.getRowIdList());
return hasTechnologypackage;
}
/**

View File

@ -40,6 +40,8 @@ public class EBomEdit {
public List<BomNewEbomParentEntity> parentEntities;
@Getter
private BomNewEbomParentEntity parentEntity;
@Getter
private boolean isRootForWaitReview=false;
public List<BomNewEbomChildEntity> childEntities;
@ -78,9 +80,16 @@ public class EBomEdit {
parent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
boolean isTechnician= SpringUtil.getBean(UserRoleService.class).technician();
parent.setStatus(isTechnician? EBomStatusEnum.CHECKED.getValue() : EBomStatusEnum.WAIT_CHECK.getValue());
parent.setCreatedJob(isTechnician? UserJobEnum.ENGINEER.getValue() : UserJobEnum.DESIGNER.getValue());
parent.setStatus(SpringUtil.getBean(UserRoleService.class).technician() ? EBomStatusEnum.CHECKED.getValue() : EBomStatusEnum.WAIT_CHECK.getValue());
parent.setCreatedJob(SpringUtil.getBean(UserRoleService.class).technician() ? UserJobEnum.ENGINEER.getValue() : UserJobEnum.DESIGNER.getValue());
//工艺人不用更新
if(isTechnician){
isRootForWaitReview=false;
}else{
isRootForWaitReview=true;
}
parent.setCreatedTime(LocalDateTime.now());
parent.setModifyTime(LocalDateTime.now());
@ -125,12 +134,12 @@ public class EBomEdit {
});
if (Objects.equals(createDTO.getOpType(), EbomEditStatusEnum.HANDLER_FINISHED.getValue())) {
//工艺人员
if (roleList.contains(EBomConstant.TECHNICIAN)) {
parentEntity.setStatus(EBomStatusEnum.CHECKED.getValue());
}
}
// if (Objects.equals(createDTO.getOpType(), EbomEditStatusEnum.HANDLER_FINISHED.getValue())) {
// //工艺人员
// if (roleList.contains(EBomConstant.TECHNICIAN)) {
// parentEntity.setStatus(EBomStatusEnum.CHECKED.getValue());
// }
// }
childEntities.addAll(updateOrCreateChild(createDTO));
@ -293,6 +302,7 @@ public class EBomEdit {
//rowId is null 必定是未入库作为根
if (dto.getParent().getRowId() == null || dto.getParent().getRowId().longValue() == 0) {
createRootBom(dto);
return;
}

View File

@ -9,10 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.bomnew.constant.EBomExceptionStatusEnum;
import com.nflg.product.bomnew.constant.EBomStatusEnum;
import com.nflg.product.bomnew.constant.PBomStatusEnum;
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
import com.nflg.product.bomnew.constant.*;
import com.nflg.product.bomnew.pojo.entity.*;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
import com.nflg.product.bomnew.service.BomNewEbomVirtualPackageCompositionService;
@ -24,7 +21,6 @@ import com.nflg.product.bomnew.util.VUtils;
import com.nflg.product.bomnew.util.VersionUtil;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.bouncycastle.crypto.engines.EthereumIESEngine;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@ -175,6 +171,7 @@ public class EBomToPBom {
pBomParent.setTechnologyUserCode(SessionUtil.getUserCode());
pBomParent.setTechnologyUserName(SessionUtil.getRealName());
pBomParent.setCurrentVersion(VersionUtil.getNextVersion(""));
pBomParent.setEditStatus(PBomEditStatusEnum.HANDLER_CREATED.getValue());
if(Objects.nonNull(oldParent)){
pBomParent.setCurrentVersion(VersionUtil.getNextVersion(oldParent.getCurrentVersion()));
oldParent.setExpireEndTime(LocalDateTime.now());

View File

@ -152,6 +152,8 @@ public class PlmBomToOriginalConvert extends BaseConvert {
originalBom.setLastVersionIs(0);
this.resultParent.add(originalBom);
handlerChild(parentEntity,originalSourceEnum);
} else {
importErrorResult.add(new ImportOriginalBomVO(parent.getChartNo(), "已忽略ebom正式表中有相同的数据"));
}
}
}

View File

@ -1,4 +1,14 @@
#nacos.server-addr=114.132.64.230:8123
nacos.server-addr=192.168.0.194:8848
spring.cache.type=redis
spring.redis.database=1
spring.redis.host=192.168.0.194
spring.redis.password=
spring.redis.port=6379
spring.redis.timeout=0
spring.redis.ssl=false
spring.redis.lettuce.pool.max-wait=-1ms
spring.redis.lettuce.pool.max-active=8
spring.redis.lettuce.pool.max-idle=8
spring.redis.lettuce.pool.min-idle=0
logging.config=classpath:logback-sit.xml

View File

@ -1,12 +1,12 @@
nacos.server-addr=192.168.0.191:8848
spring.cache.type=redis
spring.redis.database=0
spring.redis.host=192.168.0.191
spring.redis.password=
spring.redis.port=6379
spring.redis.timeout=0
spring.redis.ssl=false
spring.redis.lettuce.pool.max-wait=1ms
spring.redis.lettuce.pool.max-wait=-1ms
spring.redis.lettuce.pool.max-active=8
spring.redis.lettuce.pool.max-idle=8
spring.redis.lettuce.pool.min-idle=0

View File

@ -1,14 +1,13 @@
#nacos.server-addr=114.132.64.230:8123
nacos.server-addr=192.168.0.194:8848
spring.cache.type=redis
spring.redis.database=0
spring.redis.host=192.168.0.194
spring.redis.password=
spring.redis.port=6379
spring.redis.timeout=0
spring.redis.ssl=false
spring.redis.lettuce.pool.max-wait=1ms
spring.redis.lettuce.pool.max-wait=-1ms
spring.redis.lettuce.pool.max-active=8
spring.redis.lettuce.pool.max-idle=8
spring.redis.lettuce.pool.min-idle=0

View File

@ -1,5 +1,5 @@
spring.application.name=bom-new
spring.profiles.active=sit
spring.profiles.active=dev
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss

View File

@ -39,7 +39,7 @@
<logger name="com.alibaba.nacos" level="WARN" />
<!-- 日志输出级别 -->
<root level="TRACE">
<root level="DEBUG">
<appender-ref ref="Console" />
<appender-ref ref="RollingFileAll" />
</root>

View File

@ -68,4 +68,22 @@
#{item}
</foreach>
</update>
<select id="getChildrenByChildRowId" resultMap="BaseResultMap">
SELECT c.*
FROM t_bom_new_pbom_child c
JOIN t_bom_new_pbom_parent p ON p.row_id = c.parent_row_id
JOIN t_bom_new_pbom_child c1 ON p.material_no = c1.material_no AND p.last_version_is = 1
WHERE c1.row_id = #{rowId}
ORDER BY c.row_id
</select>
<select id="setParentRowId">
UPDATE t_bom_new_pbom_child
SET parent_row_id=#{parentRowId},modify_time=now()
WHERE row_id IN
<foreach collection="rowIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

View File

@ -142,7 +142,8 @@
</select>
<!--bom发布-->
<update id="bomRelease">
update t_bom_new_pbom_parent set status=#{status} , release_user_name=#{releaseUserName} , release_time=now()
update t_bom_new_pbom_parent set status=#{status} ,edit_status=3, release_user_name=#{releaseUserName} ,
release_time=now()
where row_id in
<foreach collection="rowIds" item="rowId" open="(" close=")" separator=",">
#{rowId}

View File

@ -1,10 +1,12 @@
package com.nflg.product.base.core.conmon.util;
import cn.hutool.core.util.StrUtil;
import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.base.core.exception.NflgBusinessException;
import nflg.product.common.constant.STATE;
import nflg.product.common.dto.LoginUserInfoDTO;
import java.util.*;
import java.util.List;
import java.util.Optional;
/**
* @decription
@ -12,7 +14,7 @@ import java.util.*;
* @Date 2022/7/15 9:04
**/
public class SessionUtil {
public static ThreadLocal<LoginUserInfoDTO> loginUser= BaseApi.loginUser;
//public static ThreadLocal<LoginUserInfoDTO> loginUser= BaseApi.loginUser;
/**
* 获取登入用户编号
@ -20,7 +22,8 @@ public class SessionUtil {
* @return
*/
public static Long getRowId() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getRowId).orElse(1585164668335439881L);
//return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getRowId).orElse(1585164668335439881L);
return getUser().getRowId();
}
/**
@ -29,7 +32,9 @@ public class SessionUtil {
* @return
*/
public static String getUserCode() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getUserCode).orElse("QHI17062100");
//return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getUserCode).orElse("QHI17062100");
return getUser().getUserCode();
}
/**
@ -38,7 +43,8 @@ public class SessionUtil {
* @return
*/
public static String getUserName() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getUserName).orElse("郑军榕");
//return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getUserName).orElse("郑军榕");
return getUser().getUserName();
}
/**
@ -47,48 +53,61 @@ public class SessionUtil {
* @return
*/
public static Long getPartRowId() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getDepartRowId).orElse(null);
//return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getDepartRowId).orElse(null);
return getUser().getDepartRowId();
}
public static String getRealName() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getRealName).orElse("郑军榕");
//return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getRealName).orElse("郑军榕");
return getUser().getRealName();
}
public static String getDepartName() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getDepartName).orElse(null);
//return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getDepartName).orElse(null);
return getUser().getDepartName();
}
public static List<Long> getAruList() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getAruList).orElse(null);
//return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getAruList).orElse(null);
return getUser().getAruList();
}
// 获取岗位代码
public static Integer getQueryData() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getQueryData).orElse(null);
//return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getQueryData).orElse(null);
return getUser().getQueryData();
}
public static String getFullDeptName() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getFullDeptName).orElse(null);
//return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getFullDeptName).orElse(null);
return getUser().getFullDeptName();
}
//获取2级部门以下
public static String getSecondFullDeptName() {
String depName = Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getFullDeptName).orElse("");
depName= StrUtil.replace(depName,"OU=","").replace("福建南方路面机械有限公司,DC=nflg","");
List<String> depts = new ArrayList<>(Arrays.asList(StrUtil.split(depName, ",")));
depts.remove("");
Collections.reverse(depts );
return StrUtil.join("/",depts);
}
// //获取2级部门以下
// public static String getSecondFullDeptName() {
// String depName = Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getFullDeptName).orElse("");
//
// depName= StrUtil.replace(depName,"OU=","").replace("福建南方路面机械有限公司,DC=nflg","");
// List<String> depts = new ArrayList<>(Arrays.asList(StrUtil.split(depName, ",")));
// depts.remove("");
// Collections.reverse(depts );
// return StrUtil.join("/",depts);
//
//
// }
public static String getLanguage() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getLanguage).orElse("");
//return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getLanguage).orElse("");
return getUser().getLanguage();
}
public static String getSessionKey() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getSessionKey).orElse(null);
//return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getSessionKey).orElse(null);
return getUser().getSessionKey();
}
private static LoginUserInfoDTO getUser() {
return Optional.ofNullable(BaseApi.loginUser.get())
.orElseThrow(() -> new NflgBusinessException(STATE.LoginError, "请登录"));
}
}

View File

@ -3,12 +3,10 @@ spring.application.name=gateway
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8
server.port=89
spring.cloud.nacos.config.namespace=nflg_dev
spring.cloud.nacos.discovery.namespace=nflg_dev
spring.cloud.nacos.config.namespace=nflg
spring.cloud.nacos.discovery.namespace=nflg
spring.cloud.nacos.config.file-extension=properties
nacos.plugin.namespace=nflg_dev
nacos.plugin.namespace=nflg
#configuration