Merge remote-tracking branch 'origin/master'

This commit is contained in:
sxu 2024-10-21 10:17:30 +08:00
commit 014996b1fe
9 changed files with 129 additions and 107 deletions

View File

@ -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 = "仓储管理->删除资产属性管理")

View File

@ -41,9 +41,6 @@ public class BmUnitController extends BaseController
@Autowired
private IBmUnitService bmUnitService;
@Resource
private RemoteDictDataService remoteDictDataService;
/**
* 查询往来单位管理列表
*/

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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代表删除 */

View File

@ -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()) ? "匹配" : "不匹配");
}
/**
* 新增标段工程管理
*

View File

@ -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());
}
}
/**
* 新增往来单位管理

View File

@ -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;
/** 实时库存 */

View File

@ -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());
}
}
/**