工程管理
This commit is contained in:
parent
ab7aef3c84
commit
413ba05302
|
|
@ -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 = "仓储管理->删除资产属性管理")
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class BmProjectController extends BaseController
|
|||
* 查询标段工程管理列表
|
||||
*/
|
||||
@ApiOperation(value = "查询标段工程管理列表")
|
||||
@RequiresPermissions("basic:project:list")
|
||||
//@RequiresPermissions("basic:project:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BmProject bmProject)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,9 +41,6 @@ public class BmUnitController extends BaseController
|
|||
@Autowired
|
||||
private IBmUnitService bmUnitService;
|
||||
|
||||
@Resource
|
||||
private RemoteDictDataService remoteDictDataService;
|
||||
|
||||
/**
|
||||
* 查询往来单位管理列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -36,5 +36,10 @@ public class BmAssetAttributes extends BaseEntity implements Serializable {
|
|||
*/
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 是否分页
|
||||
*/
|
||||
private Integer isAll;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,19 +52,21 @@ public class BmProjectServiceImpl implements IBmProjectService
|
|||
{
|
||||
BmProject project = bmProjectMapper.selectBmProjectByProId(proId);
|
||||
extractedImpUnit(project);
|
||||
extracted(project);
|
||||
return project;
|
||||
}
|
||||
|
||||
private void extractedImpUnit(BmProject project) {
|
||||
AjaxResult ajaxResult = remoteDeptService.getInfo(Long.parseLong(project.getImpUnit()), SecurityConstants.INNER);
|
||||
// ajaxResult.get("data") 返回的是 LinkedHashMap
|
||||
LinkedHashMap rawDataList = (LinkedHashMap) ajaxResult.get("data");
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
if (rawDataList != null) {
|
||||
SysDept sysDept = objectMapper.convertValue(rawDataList, SysDept.class);
|
||||
project.setImpUnit(sysDept.getDeptName() == null ? "" : sysDept.getDeptName());
|
||||
//健壮性判断
|
||||
if (ajaxResult.isSuccess()) {
|
||||
// ajaxResult.get("data") 返回的是 LinkedHashMap
|
||||
LinkedHashMap rawDataList = (LinkedHashMap) ajaxResult.get("data");
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
if (rawDataList != null) {
|
||||
SysDept sysDept = objectMapper.convertValue(rawDataList, SysDept.class);
|
||||
project.setImpUnit(sysDept.getDeptName() == null ? "" : sysDept.getDeptName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -81,61 +83,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()) ? "匹配" : "不匹配");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增标段工程管理
|
||||
*
|
||||
|
|
|
|||
|
|
@ -69,26 +69,28 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
|
||||
private void extracted(List<BmUnit> bmUnitList) {
|
||||
AjaxResult ajaxResult = remoteDictDataService.dictType("bm_unit_type", SecurityConstants.INNER);
|
||||
// 假设 ajaxResult.get("data") 返回的是 List<LinkedHashMap>
|
||||
List<LinkedHashMap> rawData = (List<LinkedHashMap>) ajaxResult.get("data");
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
// 将 rawData 转换为 SysDictData 列表
|
||||
List<SysDictData> dataList = rawData.stream()
|
||||
.map(rawDatum -> objectMapper.convertValue(rawDatum, SysDictData.class))
|
||||
.collect(Collectors.toList());
|
||||
// 使用 Map 存储字典数据以提高查找速度
|
||||
Map<String, String> dictMap = dataList.stream()
|
||||
.collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
||||
if (CollectionUtils.isNotEmpty(bmUnitList)) {
|
||||
for (BmUnit unit : bmUnitList) {
|
||||
if (unit.getUnitId() != null) {
|
||||
//根据单位id去人员绑定中查询是否绑定,赋值绑定状态
|
||||
unit.setIsBind(bmUnitMapper.selectBmUnitPersonByUnitId(unit.getUnitId()) > 0 ? 1 : 0);
|
||||
}
|
||||
String typeName = dictMap.get(unit.getTypeId().toString());
|
||||
if (typeName != null) {
|
||||
unit.setTypeName(typeName);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
// 假设 ajaxResult.get("data") 返回的是 List<LinkedHashMap>
|
||||
List<LinkedHashMap> rawData = (List<LinkedHashMap>) ajaxResult.get("data");
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
// 将 rawData 转换为 SysDictData 列表
|
||||
List<SysDictData> dataList = rawData.stream()
|
||||
.map(rawDatum -> objectMapper.convertValue(rawDatum, SysDictData.class))
|
||||
.collect(Collectors.toList());
|
||||
// 使用 Map 存储字典数据以提高查找速度
|
||||
Map<String, String> dictMap = dataList.stream()
|
||||
.collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
||||
if (CollectionUtils.isNotEmpty(bmUnitList)) {
|
||||
for (BmUnit unit : bmUnitList) {
|
||||
if (unit.getUnitId() != null) {
|
||||
//根据单位id去人员绑定中查询是否绑定,赋值绑定状态
|
||||
unit.setIsBind(bmUnitMapper.selectBmUnitPersonByUnitId(unit.getUnitId()) > 0 ? 1 : 0);
|
||||
}
|
||||
String typeName = dictMap.get(unit.getTypeId().toString());
|
||||
if (typeName != null) {
|
||||
unit.setTypeName(typeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class MachineController extends BaseController {
|
|||
* 获取机具设备管理详细信息
|
||||
*/
|
||||
@ApiOperation(value = "获取机具设备管理详细信息")
|
||||
@RequiresPermissions("ma:machine:query")
|
||||
//@RequiresPermissions("ma:machine:query")
|
||||
@GetMapping(value = "/{maId}")
|
||||
public AjaxResult getInfo(@PathVariable("maId") Long maId)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -45,26 +46,25 @@ public class MachineServiceImpl implements IMachineService
|
|||
public MachineVo selectMachineByMaId(Long maId)
|
||||
{
|
||||
MachineVo machineVo = machineMapper.selectMachineByMaId(maId);
|
||||
AjaxResult ajaxResult = remoteUserService.getInfo(machineVo.getKeeperId(), SecurityConstants.INNER);
|
||||
// ajaxResult.get("data") 返回的是 LinkedHashMap
|
||||
LinkedHashMap rawDataList = (LinkedHashMap) 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());
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
setUserName(machineVo.getKeeperId(), machineVo::setKeeperName);
|
||||
setUserName(machineVo.getRepairId(), machineVo::setRepairName);
|
||||
return machineVo;
|
||||
}
|
||||
|
||||
private void setUserName(Long userId, Consumer<String> setNameFunction) {
|
||||
AjaxResult ajaxResult = remoteUserService.getInfo(userId, SecurityConstants.INNER);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
// ajaxResult.get("data") 返回的是 LinkedHashMap
|
||||
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);
|
||||
setNameFunction.accept(sysUser.getNickName() == null ? "" : sysUser.getNickName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询机具设备管理列表
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue