Merge remote-tracking branch 'origin/branch_syruan' into branch_syruan
This commit is contained in:
commit
c1abbcbba5
|
|
@ -10,6 +10,7 @@ import com.bonus.common.security.annotation.RequiresPermissions;
|
|||
import com.bonus.material.basic.domain.BmAssetAttributes;
|
||||
import com.bonus.material.basic.service.BmAssetAttributesService;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -23,6 +24,7 @@ import java.util.List;
|
|||
* @author makejava
|
||||
* @since 2024-10-15 10:38:58
|
||||
*/
|
||||
@Api(tags = "资产属性管理接口")
|
||||
@RestController
|
||||
@RequestMapping("/bm_asset_attributes")
|
||||
public class BmAssetAttributesController extends BaseController {
|
||||
|
|
@ -38,12 +40,17 @@ public class BmAssetAttributesController extends BaseController {
|
|||
* @param bmAssetAttributes 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@ApiOperation(value = "查询资产属性管理列表")
|
||||
@RequiresPermissions("basic:asset:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo queryByPage(BmAssetAttributes bmAssetAttributes) {
|
||||
public AjaxResult queryByPage(BmAssetAttributes bmAssetAttributes) {
|
||||
//判断是否分页,用于下拉选
|
||||
if (bmAssetAttributes.getIsAll() != null) {
|
||||
return AjaxResult.success(bmAssetAttributesService.queryByPage(bmAssetAttributes));
|
||||
}
|
||||
startPage();
|
||||
List<BmAssetAttributes> list = bmAssetAttributesService.queryByPage(bmAssetAttributes);
|
||||
return getDataTable(list);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -52,6 +59,7 @@ public class BmAssetAttributesController extends BaseController {
|
|||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@ApiOperation(value = "查询资产属性管理详细信息")
|
||||
@RequiresPermissions("basic:asset:query")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult queryById(@PathVariable("id") Long id) {
|
||||
|
|
@ -64,6 +72,7 @@ public class BmAssetAttributesController extends BaseController {
|
|||
* @param bmAssetAttributes 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@ApiOperation(value = "新增资产属性")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:asset:add")
|
||||
@SysLog(title = "资产属性管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增资产属性管理")
|
||||
|
|
@ -78,6 +87,7 @@ public class BmAssetAttributesController extends BaseController {
|
|||
* @param bmAssetAttributes 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@ApiOperation(value = "修改资产属性")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:asset:edit")
|
||||
@SysLog(title = "资产属性管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->修改资产属性管理")
|
||||
|
|
@ -92,6 +102,7 @@ public class BmAssetAttributesController extends BaseController {
|
|||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@ApiOperation(value = "删除资产属性")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:asset:remove")
|
||||
@SysLog(title = "资产属性管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除资产属性管理")
|
||||
|
|
|
|||
|
|
@ -41,9 +41,6 @@ public class BmUnitController extends BaseController
|
|||
@Autowired
|
||||
private IBmUnitService bmUnitService;
|
||||
|
||||
@Resource
|
||||
private RemoteDictDataService remoteDictDataService;
|
||||
|
||||
/**
|
||||
* 查询往来单位管理列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@ package com.bonus.material.basic.domain;
|
|||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
|
|
@ -24,17 +26,28 @@ public class BmAssetAttributes extends BaseEntity implements Serializable {
|
|||
* 资产类型名称
|
||||
*/
|
||||
@Excel(name = "资产类型名称")
|
||||
@ApiModelProperty(value = "资产类型名称")
|
||||
@NotBlank(message = "资产类型名称不能为空")
|
||||
@Size(max=50, message = "资产类型名称长度不能超过50")
|
||||
private String assetName;
|
||||
|
||||
/**
|
||||
* 资产编码
|
||||
*/
|
||||
@Excel(name = "资产编码")
|
||||
@ApiModelProperty(value = "资产编码")
|
||||
@NotBlank(message = "资产编码不能为空")
|
||||
@Size(max=50, message = "资产编码名称长度不能超过50")
|
||||
private String assetCode;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 是否分页
|
||||
*/
|
||||
private Integer isAll;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ import lombok.Data;
|
|||
import lombok.ToString;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 标段工程管理对象 bm_project
|
||||
*
|
||||
|
|
@ -28,6 +31,8 @@ public class BmProject extends BaseEntity
|
|||
/** 工程项目名称 */
|
||||
@Excel(name = "工程项目名称")
|
||||
@ApiModelProperty(value = "工程项目名称")
|
||||
@NotBlank(message = "工程名称不能为空")
|
||||
@Size(max=255, message = "工程名称长度不能超过255")
|
||||
private String proName;
|
||||
|
||||
/** 关联外部(第三方)的工程ID */
|
||||
|
|
@ -44,14 +49,17 @@ public class BmProject extends BaseEntity
|
|||
|
||||
@ApiModelProperty(value = "实施单位")
|
||||
@Excel(name = "实施单位")
|
||||
@NotBlank(message = "实施单位不能为空")
|
||||
private String impUnit;
|
||||
|
||||
@ApiModelProperty(value = "工程类型")
|
||||
@Excel(name = "工程类型")
|
||||
@NotBlank(message = "工程类型不能为空")
|
||||
private String proType;
|
||||
|
||||
@ApiModelProperty(value = "工程编码")
|
||||
@Excel(name = "i8工程编码")
|
||||
@Size(max=60, message = "工程编号长度不能超过60")
|
||||
private String proCode;
|
||||
|
||||
/**
|
||||
|
|
@ -63,6 +71,7 @@ public class BmProject extends BaseEntity
|
|||
|
||||
@ApiModelProperty(value = "合同主体")
|
||||
@Excel(name = "合同主体")
|
||||
@Size(max=60, message = "合同主体长度不能超过60")
|
||||
private String contractPart;
|
||||
|
||||
/** 经度 */
|
||||
|
|
@ -76,15 +85,18 @@ public class BmProject extends BaseEntity
|
|||
/** 项目经理 */
|
||||
@Excel(name = "项目经理")
|
||||
@ApiModelProperty(value = "项目经理")
|
||||
@Size(max=64, message = "项目经理长度不能超过64")
|
||||
private String proManager;
|
||||
|
||||
/** 联系方式 */
|
||||
@Excel(name = "联系方式")
|
||||
@ApiModelProperty(value = "联系方式")
|
||||
/** 联系电话 */
|
||||
@Excel(name = "联系电话")
|
||||
@ApiModelProperty(value = "联系电话")
|
||||
@Size(max=64, message = "联系电话长度不能超过64")
|
||||
private String telphone;
|
||||
|
||||
@ApiModelProperty(value = "工程状态")
|
||||
@Excel(name = "工程状态")
|
||||
@NotBlank(message = "工程状态不能为空")
|
||||
private String proStatus;
|
||||
|
||||
/** 计划开工日期 */
|
||||
|
|
@ -111,8 +123,10 @@ public class BmProject extends BaseEntity
|
|||
private String delFlag;
|
||||
|
||||
@ApiModelProperty(value = "工程性质")
|
||||
@NotBlank(message = "工程性质不能为空")
|
||||
private String proNature;
|
||||
|
||||
@ApiModelProperty(value = "所属项目中心")
|
||||
@Size(max=60, message = "所属项目中心长度不能超过60")
|
||||
private String proCenter;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ import lombok.Data;
|
|||
import lombok.ToString;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 往来单位管理对象 bm_unit
|
||||
*
|
||||
|
|
@ -26,6 +29,8 @@ public class BmUnit extends BaseEntity
|
|||
/** 单位类型名称 */
|
||||
@Excel(name = "单位名称")
|
||||
@ApiModelProperty(value = "单位类型名称")
|
||||
@NotBlank(message = "单位名称不能为空")
|
||||
@Size(max=30, message = "单位名称长度不能超过30")
|
||||
private String unitName;
|
||||
|
||||
/** 帐号状态(0正常 1停用) */
|
||||
|
|
@ -33,6 +38,7 @@ public class BmUnit extends BaseEntity
|
|||
|
||||
/** 单位类型 */
|
||||
@ApiModelProperty(value = "单位类型")
|
||||
@NotBlank(message = "单位类型不能为空")
|
||||
private Long typeId;
|
||||
|
||||
@Excel(name = "单位类型")
|
||||
|
|
@ -42,16 +48,19 @@ public class BmUnit extends BaseEntity
|
|||
/** 所属分公司 */
|
||||
@Excel(name = "所属分公司")
|
||||
@ApiModelProperty(value = "所属分公司")
|
||||
@NotBlank(message = "所属分公司不能为空")
|
||||
private Long deptId;
|
||||
|
||||
/** 联系人 */
|
||||
@Excel(name = "联系人")
|
||||
@ApiModelProperty(value = "联系人")
|
||||
@Size(max=64, message = "联系人长度不能超过64")
|
||||
private String linkMan;
|
||||
|
||||
/** 联系方式 */
|
||||
@Excel(name = "联系方式")
|
||||
@ApiModelProperty(value = "联系方式")
|
||||
@Size(max=64, message = "联系方式长度不能超过64")
|
||||
private String telphone;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.bonus.system.api.RemoteDeptService;
|
|||
import com.bonus.system.api.domain.SysDept;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.basic.mapper.BmProjectMapper;
|
||||
|
|
@ -24,7 +25,6 @@ import com.bonus.material.basic.service.IBmProjectService;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.*;
|
||||
|
||||
/**
|
||||
* 标段工程管理Service业务层处理
|
||||
|
|
@ -33,6 +33,7 @@ import static com.bonus.common.biz.constant.MaterialConstants.*;
|
|||
* @date 2024-09-26
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BmProjectServiceImpl implements IBmProjectService
|
||||
{
|
||||
@Resource
|
||||
|
|
@ -52,12 +53,14 @@ public class BmProjectServiceImpl implements IBmProjectService
|
|||
{
|
||||
BmProject project = bmProjectMapper.selectBmProjectByProId(proId);
|
||||
extractedImpUnit(project);
|
||||
extracted(project);
|
||||
return project;
|
||||
}
|
||||
|
||||
private void extractedImpUnit(BmProject project) {
|
||||
try {
|
||||
AjaxResult ajaxResult = remoteDeptService.getInfo(Long.parseLong(project.getImpUnit()), SecurityConstants.INNER);
|
||||
//健壮性判断
|
||||
if (ajaxResult.isSuccess()) {
|
||||
// ajaxResult.get("data") 返回的是 LinkedHashMap
|
||||
LinkedHashMap rawDataList = (LinkedHashMap) ajaxResult.get("data");
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
|
@ -67,6 +70,10 @@ public class BmProjectServiceImpl implements IBmProjectService
|
|||
project.setImpUnit(sysDept.getDeptName() == null ? "" : sysDept.getDeptName());
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
log.error("远程调用查询失败:", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询标段工程管理列表
|
||||
|
|
@ -81,61 +88,11 @@ public class BmProjectServiceImpl implements IBmProjectService
|
|||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
extractedImpUnit(item);
|
||||
extracted(item);
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法抽取
|
||||
* @param item
|
||||
*/
|
||||
private void extracted(BmProject item) {
|
||||
if (item.getProTypeId() != null) {
|
||||
if (ZERO_CONSTANT.equals(item.getProTypeId())) {
|
||||
item.setProType("线路工程");
|
||||
} else if (ONE_CONSTANT.equals(item.getProTypeId())) {
|
||||
item.setProType("变电工程");
|
||||
} else if (TWO_CONSTANT.equals(item.getProTypeId())) {
|
||||
item.setProType("业务工程");
|
||||
} else if (THREE_CONSTANT.equals(item.getProTypeId())) {
|
||||
item.setProType("其他工程");
|
||||
} else {
|
||||
item.setProType("未知工程类型");
|
||||
}
|
||||
}
|
||||
if (item.getProNature() != null) {
|
||||
if (ZERO_CONSTANT.equals(item.getProNature())) {
|
||||
item.setProNature("基建");
|
||||
} else if (ONE_CONSTANT.equals(item.getProNature())) {
|
||||
item.setProNature("用户工程");
|
||||
} else if (TWO_CONSTANT.equals(item.getProNature())){
|
||||
item.setProNature("技修大改");
|
||||
} else if (THREE_CONSTANT.equals(item.getProNature())) {
|
||||
item.setProNature("其他");
|
||||
} else {
|
||||
item.setProNature("未知工程性质");
|
||||
}
|
||||
}
|
||||
if (item.getProStatus() != null) {
|
||||
if (ZERO_CONSTANT.equals(item.getProStatus())) {
|
||||
item.setProStatus("开工准备");
|
||||
} else if (ONE_CONSTANT.equals(item.getProStatus())) {
|
||||
item.setProStatus("在建");
|
||||
} else if (TWO_CONSTANT.equals(item.getProStatus())){
|
||||
item.setProStatus("停工");
|
||||
} else if (THREE_CONSTANT.equals(item.getProStatus())){
|
||||
item.setProStatus("完工未竣工");
|
||||
} else if (FOUR_CONSTANT.equals(item.getProStatus())) {
|
||||
item.setProStatus("竣工");
|
||||
} else {
|
||||
item.setProStatus("未知工程状态");
|
||||
}
|
||||
}
|
||||
item.setIsMatchI8(StringUtils.isNotEmpty(item.getExternalId()) ? "匹配" : "不匹配");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增标段工程管理
|
||||
*
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import com.bonus.system.api.RemoteDictDataService;
|
|||
import com.bonus.system.api.domain.SysDictData;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.basic.mapper.BmUnitMapper;
|
||||
|
|
@ -33,6 +34,7 @@ import javax.annotation.Resource;
|
|||
* @date 2024-09-26
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BmUnitServiceImpl implements IBmUnitService
|
||||
{
|
||||
@Autowired
|
||||
|
|
@ -68,7 +70,9 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
}
|
||||
|
||||
private void extracted(List<BmUnit> bmUnitList) {
|
||||
try {
|
||||
AjaxResult ajaxResult = remoteDictDataService.dictType("bm_unit_type", SecurityConstants.INNER);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
// 假设 ajaxResult.get("data") 返回的是 List<LinkedHashMap>
|
||||
List<LinkedHashMap> rawData = (List<LinkedHashMap>) ajaxResult.get("data");
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
|
@ -93,6 +97,10 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("远程服务调用查询失败:", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增往来单位管理
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import javax.validation.constraints.NotNull;
|
|||
import com.bonus.common.biz.domain.TreeSelect;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.ma.MaTypeConfigDto;
|
||||
import com.bonus.material.ma.vo.MaTypeListVo;
|
||||
import com.bonus.material.ma.vo.MaTypeSelectVo;
|
||||
import com.bonus.material.warehouse.domain.WhHouseSet;
|
||||
|
|
@ -201,4 +202,15 @@ public class TypeController extends BaseController {
|
|||
public AjaxResult remove(@PathVariable Long[] typeIds) {
|
||||
return toAjax(typeService.deleteTypeByTypeIds(typeIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物资类型配置右侧列表
|
||||
*/
|
||||
@ApiOperation(value = "查询物资类型配置右侧列表")
|
||||
@RequiresPermissions("ma:typeConfig:list")
|
||||
@GetMapping("/getMaTypeConfigList")
|
||||
public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) {
|
||||
// 调用service处理业务逻辑
|
||||
return typeService.getMaTypeConfigList(maTypeConfigDto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ import lombok.Data;
|
|||
import lombok.ToString;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 配件类型管理对象 ma_part_type
|
||||
*
|
||||
|
|
@ -27,6 +30,8 @@ public class PartType extends BaseEntity
|
|||
/** 类型名称 */
|
||||
@Excel(name = "名称")
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
@NotBlank(message = "名称不能为空")
|
||||
@Size(max=30, message = "名称长度不能超过30")
|
||||
private String paName;
|
||||
|
||||
/** 上级ID */
|
||||
|
|
@ -44,11 +49,13 @@ public class PartType extends BaseEntity
|
|||
/** 计量单位名称 */
|
||||
@Excel(name = "计量单位")
|
||||
@ApiModelProperty(value = "计量单位名称")
|
||||
@Size(max=64, message = "计量单位长度不能超过64")
|
||||
private String unitName;
|
||||
|
||||
/** 原值 */
|
||||
@Excel(name = "购置价格(元)")
|
||||
@ApiModelProperty(value = "原值")
|
||||
@Size(max=10, message = "购置价格长度不能超过10")
|
||||
private BigDecimal buyPrice;
|
||||
|
||||
/** 实时库存 */
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.bonus.material.ma.service;
|
|||
import java.util.List;
|
||||
|
||||
import com.bonus.common.biz.domain.TreeSelect;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.ma.MaTypeConfigDto;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.vo.MaTypeConfigVo;
|
||||
import com.bonus.material.ma.vo.MaTypeListVo;
|
||||
|
|
@ -93,4 +95,6 @@ public interface ITypeService {
|
|||
* @return 树结构列表
|
||||
*/
|
||||
List<Type> buildMaTypeTree(List<Type> maTypeList);
|
||||
|
||||
AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.ma.service.impl;
|
|||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
|
|
@ -13,6 +14,7 @@ import com.bonus.system.api.RemoteUserService;
|
|||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.ma.mapper.MachineMapper;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
|
|
@ -27,6 +29,7 @@ import javax.annotation.Resource;
|
|||
* @date 2024-09-27
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MachineServiceImpl implements IMachineService
|
||||
{
|
||||
@Resource
|
||||
|
|
@ -45,24 +48,27 @@ public class MachineServiceImpl implements IMachineService
|
|||
public MachineVo selectMachineByMaId(Long maId)
|
||||
{
|
||||
MachineVo machineVo = machineMapper.selectMachineByMaId(maId);
|
||||
AjaxResult ajaxResult = remoteUserService.getInfo(machineVo.getKeeperId(), SecurityConstants.INNER);
|
||||
setUserName(machineVo.getKeeperId(), machineVo::setKeeperName);
|
||||
setUserName(machineVo.getRepairId(), machineVo::setRepairName);
|
||||
return machineVo;
|
||||
}
|
||||
|
||||
private void setUserName(Long userId, Consumer<String> setNameFunction) {
|
||||
try {
|
||||
AjaxResult ajaxResult = remoteUserService.getInfo(userId, SecurityConstants.INNER);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
// ajaxResult.get("data") 返回的是 LinkedHashMap
|
||||
LinkedHashMap rawDataList = (LinkedHashMap) ajaxResult.get("data");
|
||||
LinkedHashMap<String, Object> rawDataList = (LinkedHashMap<String, Object>) ajaxResult.get("data");
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
if (rawDataList != null) {
|
||||
SysUser sysUser = objectMapper.convertValue(rawDataList, SysUser.class);
|
||||
machineVo.setKeeperName(sysUser.getNickName() == null ? "" : sysUser.getNickName());
|
||||
setNameFunction.accept(sysUser.getNickName() == null ? "" : sysUser.getNickName());
|
||||
}
|
||||
AjaxResult info = remoteUserService.getInfo(machineVo.getRepairId(), SecurityConstants.INNER);
|
||||
// ajaxResult.get("data") 返回的是 LinkedHashMap
|
||||
LinkedHashMap dataList = (LinkedHashMap) info.get("data");
|
||||
if (dataList != null) {
|
||||
SysUser sysUser = objectMapper.convertValue(dataList, SysUser.class);
|
||||
machineVo.setRepairName(sysUser.getNickName() == null ? "" : sysUser.getNickName());
|
||||
}
|
||||
|
||||
return machineVo;
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.error("远程调用查询失败:", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,6 +8,12 @@ import com.bonus.common.biz.domain.TreeSelect;
|
|||
import com.bonus.common.biz.enums.DataCodeEnum;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.ma.MaTypeConfigDto;
|
||||
import com.bonus.material.ma.domain.TypeKeeper;
|
||||
import com.bonus.material.ma.domain.TypeRepair;
|
||||
import com.bonus.material.ma.service.ITypeKeeperService;
|
||||
import com.bonus.material.ma.service.ITypeRepairService;
|
||||
import com.bonus.material.ma.vo.MaTypeConfigVo;
|
||||
import com.bonus.material.ma.vo.MaTypeListVo;
|
||||
import com.bonus.material.ma.vo.MaTypeSelectVo;
|
||||
|
|
@ -33,6 +39,12 @@ public class TypeServiceImpl implements ITypeService {
|
|||
@Resource
|
||||
private TypeMapper typeMapper;
|
||||
|
||||
@Resource
|
||||
private ITypeKeeperService typeKeeperService;
|
||||
|
||||
@Resource
|
||||
private ITypeRepairService typeRepairService;
|
||||
|
||||
/**
|
||||
* 查询物资类型 -- 根据id
|
||||
*
|
||||
|
|
@ -373,4 +385,96 @@ public class TypeServiceImpl implements ITypeService {
|
|||
return !getChildList(list, t).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) {
|
||||
// 1.把所有物资类型查出来
|
||||
List<MaTypeConfigVo> list = selectThreeFourLevelTypeListAndParent(new Type());
|
||||
// 2.把维修配置信息查出来
|
||||
List<TypeRepair> typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair());
|
||||
// 3.把库管配置信息查出来
|
||||
List<TypeKeeper> typeKeeperList = typeKeeperService.selectTypeKeeperListAndUserName(new TypeKeeper());
|
||||
|
||||
// ------------------- 开启数据处理 ---------------------
|
||||
|
||||
// 4.循环所有物资类型,重型数据集合保障只循环一次,减少性能损失
|
||||
for (MaTypeConfigVo typeConfigVo1 : list) {
|
||||
// 1.外层 先对比维修班组
|
||||
for (TypeRepair typeRepair : typeRepairList) {
|
||||
// 2.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id
|
||||
if (typeRepair.getTypeId().equals(typeConfigVo1.getTypeId())) {
|
||||
// 3.如果相等,把维修员信息设置到物资类型配置信息中
|
||||
typeConfigVo1.setRepairUserId(typeRepair.getUserId());
|
||||
typeConfigVo1.setRepairUserName(typeRepair.getUserName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 1.外层 再对比库管班组
|
||||
for (TypeKeeper typeKeeper : typeKeeperList) {
|
||||
// 2.判断当前库管配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id
|
||||
if (typeKeeper.getTypeId().equals(typeConfigVo1.getTypeId())) {
|
||||
// 3.如果相等,把库管员信息设置到物资类型配置信息中
|
||||
typeConfigVo1.setKeeperUserId(typeKeeper.getUserId());
|
||||
typeConfigVo1.setKeeperUserName(typeKeeper.getUserName());
|
||||
}
|
||||
}
|
||||
|
||||
// 5.判断当前物资类型配置信息是否有子节点
|
||||
if (typeConfigVo1.getChildren() != null) {
|
||||
// 6.有子节点,继续循环子节点,判断子节点是否有维修配置信息
|
||||
for (MaTypeConfigVo typeConfigVo2 : typeConfigVo1.getChildren()) {
|
||||
// 7.有维修配置信息,把维修员信息设置到子节点中
|
||||
for (TypeRepair typeRepair : typeRepairList) {
|
||||
if (typeRepair.getTypeId().equals(typeConfigVo2.getTypeId())) {
|
||||
typeConfigVo2.setRepairUserId(typeRepair.getUserId());
|
||||
typeConfigVo2.setRepairUserName(typeRepair.getUserName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 8.有子节点,继续循环子节点,
|
||||
for (MaTypeConfigVo typeConfigVo3 : typeConfigVo1.getChildren()) {
|
||||
// 9.判断子节点是否有库管配置信息
|
||||
for (TypeKeeper typeKeeper : typeKeeperList) {
|
||||
if (typeKeeper.getTypeId().equals(typeConfigVo3.getTypeId())) {
|
||||
typeConfigVo3.setKeeperUserId(typeKeeper.getUserId());
|
||||
typeConfigVo3.setKeeperUserName(typeKeeper.getUserName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -------------------- 数据处理结束 ---------------------
|
||||
|
||||
// TODO: 先暂时取消后续过滤流程
|
||||
if (true) {
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
// ------------------- 数据过滤开始 ---------------------
|
||||
if (maTypeConfigDto == null || maTypeConfigDto.getUserId() == null || maTypeConfigDto.getUserId() == 0L) {
|
||||
// 如果参数无效,则返回原始列表
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
List<MaTypeConfigVo> filteredList = new ArrayList<>();
|
||||
|
||||
for (MaTypeConfigVo maTypeConfigVo : list) {
|
||||
if (
|
||||
maTypeConfigVo.getKeeperUserId().equals(maTypeConfigDto.getUserId()) ||
|
||||
maTypeConfigVo.getRepairUserId().equals(maTypeConfigDto.getUserId())
|
||||
)
|
||||
{
|
||||
filteredList.add(maTypeConfigVo);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------- 数据过滤结束 ---------------------
|
||||
|
||||
|
||||
// 返回前端
|
||||
return AjaxResult.success(filteredList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue