字段非空判断
This commit is contained in:
parent
413ba05302
commit
79f6a099a6
|
|
@ -46,7 +46,7 @@ public class BmProjectController extends BaseController
|
||||||
* 查询标段工程管理列表
|
* 查询标段工程管理列表
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "查询标段工程管理列表")
|
@ApiOperation(value = "查询标段工程管理列表")
|
||||||
//@RequiresPermissions("basic:project:list")
|
@RequiresPermissions("basic:project:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(BmProject bmProject)
|
public TableDataInfo list(BmProject bmProject)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class BmUnitController extends BaseController
|
||||||
* 查询往来单位管理列表
|
* 查询往来单位管理列表
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "查询往来单位管理列表")
|
@ApiOperation(value = "查询往来单位管理列表")
|
||||||
//@RequiresPermissions("basic:unit:list")
|
@RequiresPermissions("basic:unit:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(BmUnit bmUnit)
|
public TableDataInfo list(BmUnit bmUnit)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,10 @@ package com.bonus.material.basic.domain;
|
||||||
|
|
||||||
import com.bonus.common.core.annotation.Excel;
|
import com.bonus.common.core.annotation.Excel;
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -24,12 +25,16 @@ public class BmAssetAttributes extends BaseEntity implements Serializable {
|
||||||
* 资产类型名称
|
* 资产类型名称
|
||||||
*/
|
*/
|
||||||
@Excel(name = "资产类型名称")
|
@Excel(name = "资产类型名称")
|
||||||
|
@ApiModelProperty(value = "资产类型名称")
|
||||||
|
@NotBlank(message = "资产类型名称不能为空")
|
||||||
private String assetName;
|
private String assetName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产编码
|
* 资产编码
|
||||||
*/
|
*/
|
||||||
@Excel(name = "资产编码")
|
@Excel(name = "资产编码")
|
||||||
|
@ApiModelProperty(value = "资产编码")
|
||||||
|
@NotBlank(message = "资产编码不能为空")
|
||||||
private String assetCode;
|
private String assetCode;
|
||||||
/**
|
/**
|
||||||
* 删除标志(0代表存在 2代表删除)
|
* 删除标志(0代表存在 2代表删除)
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标段工程管理对象 bm_project
|
* 标段工程管理对象 bm_project
|
||||||
*
|
*
|
||||||
|
|
@ -28,6 +30,7 @@ public class BmProject extends BaseEntity
|
||||||
/** 工程项目名称 */
|
/** 工程项目名称 */
|
||||||
@Excel(name = "工程项目名称")
|
@Excel(name = "工程项目名称")
|
||||||
@ApiModelProperty(value = "工程项目名称")
|
@ApiModelProperty(value = "工程项目名称")
|
||||||
|
@NotBlank(message = "工程名称不能为空")
|
||||||
private String proName;
|
private String proName;
|
||||||
|
|
||||||
/** 关联外部(第三方)的工程ID */
|
/** 关联外部(第三方)的工程ID */
|
||||||
|
|
@ -44,10 +47,12 @@ public class BmProject extends BaseEntity
|
||||||
|
|
||||||
@ApiModelProperty(value = "实施单位")
|
@ApiModelProperty(value = "实施单位")
|
||||||
@Excel(name = "实施单位")
|
@Excel(name = "实施单位")
|
||||||
|
@NotBlank(message = "实施单位不能为空")
|
||||||
private String impUnit;
|
private String impUnit;
|
||||||
|
|
||||||
@ApiModelProperty(value = "工程类型")
|
@ApiModelProperty(value = "工程类型")
|
||||||
@Excel(name = "工程类型")
|
@Excel(name = "工程类型")
|
||||||
|
@NotBlank(message = "工程类型不能为空")
|
||||||
private String proType;
|
private String proType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "工程编码")
|
@ApiModelProperty(value = "工程编码")
|
||||||
|
|
@ -85,6 +90,7 @@ public class BmProject extends BaseEntity
|
||||||
|
|
||||||
@ApiModelProperty(value = "工程状态")
|
@ApiModelProperty(value = "工程状态")
|
||||||
@Excel(name = "工程状态")
|
@Excel(name = "工程状态")
|
||||||
|
@NotBlank(message = "工程状态不能为空")
|
||||||
private String proStatus;
|
private String proStatus;
|
||||||
|
|
||||||
/** 计划开工日期 */
|
/** 计划开工日期 */
|
||||||
|
|
@ -111,6 +117,7 @@ public class BmProject extends BaseEntity
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
@ApiModelProperty(value = "工程性质")
|
@ApiModelProperty(value = "工程性质")
|
||||||
|
@NotBlank(message = "工程性质不能为空")
|
||||||
private String proNature;
|
private String proNature;
|
||||||
|
|
||||||
@ApiModelProperty(value = "所属项目中心")
|
@ApiModelProperty(value = "所属项目中心")
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 往来单位管理对象 bm_unit
|
* 往来单位管理对象 bm_unit
|
||||||
*
|
*
|
||||||
|
|
@ -26,6 +28,7 @@ public class BmUnit extends BaseEntity
|
||||||
/** 单位类型名称 */
|
/** 单位类型名称 */
|
||||||
@Excel(name = "单位名称")
|
@Excel(name = "单位名称")
|
||||||
@ApiModelProperty(value = "单位类型名称")
|
@ApiModelProperty(value = "单位类型名称")
|
||||||
|
@NotBlank(message = "单位名称不能为空")
|
||||||
private String unitName;
|
private String unitName;
|
||||||
|
|
||||||
/** 帐号状态(0正常 1停用) */
|
/** 帐号状态(0正常 1停用) */
|
||||||
|
|
@ -33,6 +36,7 @@ public class BmUnit extends BaseEntity
|
||||||
|
|
||||||
/** 单位类型 */
|
/** 单位类型 */
|
||||||
@ApiModelProperty(value = "单位类型")
|
@ApiModelProperty(value = "单位类型")
|
||||||
|
@NotBlank(message = "单位类型不能为空")
|
||||||
private Long typeId;
|
private Long typeId;
|
||||||
|
|
||||||
@Excel(name = "单位类型")
|
@Excel(name = "单位类型")
|
||||||
|
|
@ -42,6 +46,7 @@ public class BmUnit extends BaseEntity
|
||||||
/** 所属分公司 */
|
/** 所属分公司 */
|
||||||
@Excel(name = "所属分公司")
|
@Excel(name = "所属分公司")
|
||||||
@ApiModelProperty(value = "所属分公司")
|
@ApiModelProperty(value = "所属分公司")
|
||||||
|
@NotBlank(message = "所属分公司不能为空")
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/** 联系人 */
|
/** 联系人 */
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import com.bonus.system.api.RemoteDeptService;
|
||||||
import com.bonus.system.api.domain.SysDept;
|
import com.bonus.system.api.domain.SysDept;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.material.basic.mapper.BmProjectMapper;
|
import com.bonus.material.basic.mapper.BmProjectMapper;
|
||||||
|
|
@ -24,7 +25,6 @@ import com.bonus.material.basic.service.IBmProjectService;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import static com.bonus.common.biz.constant.MaterialConstants.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标段工程管理Service业务层处理
|
* 标段工程管理Service业务层处理
|
||||||
|
|
@ -33,6 +33,7 @@ import static com.bonus.common.biz.constant.MaterialConstants.*;
|
||||||
* @date 2024-09-26
|
* @date 2024-09-26
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class BmProjectServiceImpl implements IBmProjectService
|
public class BmProjectServiceImpl implements IBmProjectService
|
||||||
{
|
{
|
||||||
@Resource
|
@Resource
|
||||||
|
|
@ -56,17 +57,21 @@ public class BmProjectServiceImpl implements IBmProjectService
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extractedImpUnit(BmProject project) {
|
private void extractedImpUnit(BmProject project) {
|
||||||
AjaxResult ajaxResult = remoteDeptService.getInfo(Long.parseLong(project.getImpUnit()), SecurityConstants.INNER);
|
try {
|
||||||
//健壮性判断
|
AjaxResult ajaxResult = remoteDeptService.getInfo(Long.parseLong(project.getImpUnit()), SecurityConstants.INNER);
|
||||||
if (ajaxResult.isSuccess()) {
|
//健壮性判断
|
||||||
// ajaxResult.get("data") 返回的是 LinkedHashMap
|
if (ajaxResult.isSuccess()) {
|
||||||
LinkedHashMap rawDataList = (LinkedHashMap) ajaxResult.get("data");
|
// ajaxResult.get("data") 返回的是 LinkedHashMap
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
LinkedHashMap rawDataList = (LinkedHashMap) ajaxResult.get("data");
|
||||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
if (rawDataList != null) {
|
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
SysDept sysDept = objectMapper.convertValue(rawDataList, SysDept.class);
|
if (rawDataList != null) {
|
||||||
project.setImpUnit(sysDept.getDeptName() == null ? "" : sysDept.getDeptName());
|
SysDept sysDept = objectMapper.convertValue(rawDataList, SysDept.class);
|
||||||
|
project.setImpUnit(sysDept.getDeptName() == null ? "" : sysDept.getDeptName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
log.error("远程调用查询失败:", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import com.bonus.system.api.RemoteDictDataService;
|
||||||
import com.bonus.system.api.domain.SysDictData;
|
import com.bonus.system.api.domain.SysDictData;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.material.basic.mapper.BmUnitMapper;
|
import com.bonus.material.basic.mapper.BmUnitMapper;
|
||||||
|
|
@ -33,6 +34,7 @@ import javax.annotation.Resource;
|
||||||
* @date 2024-09-26
|
* @date 2024-09-26
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class BmUnitServiceImpl implements IBmUnitService
|
public class BmUnitServiceImpl implements IBmUnitService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -68,31 +70,35 @@ public class BmUnitServiceImpl implements IBmUnitService
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extracted(List<BmUnit> bmUnitList) {
|
private void extracted(List<BmUnit> bmUnitList) {
|
||||||
AjaxResult ajaxResult = remoteDictDataService.dictType("bm_unit_type", SecurityConstants.INNER);
|
try {
|
||||||
if (ajaxResult.isSuccess()) {
|
AjaxResult ajaxResult = remoteDictDataService.dictType("bm_unit_type", SecurityConstants.INNER);
|
||||||
// 假设 ajaxResult.get("data") 返回的是 List<LinkedHashMap>
|
if (ajaxResult.isSuccess()) {
|
||||||
List<LinkedHashMap> rawData = (List<LinkedHashMap>) ajaxResult.get("data");
|
// 假设 ajaxResult.get("data") 返回的是 List<LinkedHashMap>
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
List<LinkedHashMap> rawData = (List<LinkedHashMap>) ajaxResult.get("data");
|
||||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
// 将 rawData 转换为 SysDictData 列表
|
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
List<SysDictData> dataList = rawData.stream()
|
// 将 rawData 转换为 SysDictData 列表
|
||||||
.map(rawDatum -> objectMapper.convertValue(rawDatum, SysDictData.class))
|
List<SysDictData> dataList = rawData.stream()
|
||||||
.collect(Collectors.toList());
|
.map(rawDatum -> objectMapper.convertValue(rawDatum, SysDictData.class))
|
||||||
// 使用 Map 存储字典数据以提高查找速度
|
.collect(Collectors.toList());
|
||||||
Map<String, String> dictMap = dataList.stream()
|
// 使用 Map 存储字典数据以提高查找速度
|
||||||
.collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
Map<String, String> dictMap = dataList.stream()
|
||||||
if (CollectionUtils.isNotEmpty(bmUnitList)) {
|
.collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
||||||
for (BmUnit unit : bmUnitList) {
|
if (CollectionUtils.isNotEmpty(bmUnitList)) {
|
||||||
if (unit.getUnitId() != null) {
|
for (BmUnit unit : bmUnitList) {
|
||||||
//根据单位id去人员绑定中查询是否绑定,赋值绑定状态
|
if (unit.getUnitId() != null) {
|
||||||
unit.setIsBind(bmUnitMapper.selectBmUnitPersonByUnitId(unit.getUnitId()) > 0 ? 1 : 0);
|
//根据单位id去人员绑定中查询是否绑定,赋值绑定状态
|
||||||
}
|
unit.setIsBind(bmUnitMapper.selectBmUnitPersonByUnitId(unit.getUnitId()) > 0 ? 1 : 0);
|
||||||
String typeName = dictMap.get(unit.getTypeId().toString());
|
}
|
||||||
if (typeName != null) {
|
String typeName = dictMap.get(unit.getTypeId().toString());
|
||||||
unit.setTypeName(typeName);
|
if (typeName != null) {
|
||||||
|
unit.setTypeName(typeName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("远程调用查询失败:", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ public class MachineController extends BaseController {
|
||||||
* 获取机具设备管理详细信息
|
* 获取机具设备管理详细信息
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取机具设备管理详细信息")
|
@ApiOperation(value = "获取机具设备管理详细信息")
|
||||||
//@RequiresPermissions("ma:machine:query")
|
@RequiresPermissions("ma:machine:query")
|
||||||
@GetMapping(value = "/{maId}")
|
@GetMapping(value = "/{maId}")
|
||||||
public AjaxResult getInfo(@PathVariable("maId") Long maId)
|
public AjaxResult getInfo(@PathVariable("maId") Long maId)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配件类型管理对象 ma_part_type
|
* 配件类型管理对象 ma_part_type
|
||||||
*
|
*
|
||||||
|
|
@ -27,6 +29,7 @@ public class PartType extends BaseEntity
|
||||||
/** 类型名称 */
|
/** 类型名称 */
|
||||||
@Excel(name = "名称")
|
@Excel(name = "名称")
|
||||||
@ApiModelProperty(value = "类型名称")
|
@ApiModelProperty(value = "类型名称")
|
||||||
|
@NotBlank(message = "名称不能为空")
|
||||||
private String paName;
|
private String paName;
|
||||||
|
|
||||||
/** 上级ID */
|
/** 上级ID */
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import com.bonus.system.api.RemoteUserService;
|
||||||
import com.bonus.system.api.domain.SysUser;
|
import com.bonus.system.api.domain.SysUser;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.material.ma.mapper.MachineMapper;
|
import com.bonus.material.ma.mapper.MachineMapper;
|
||||||
import com.bonus.material.ma.domain.Machine;
|
import com.bonus.material.ma.domain.Machine;
|
||||||
|
|
@ -28,6 +29,7 @@ import javax.annotation.Resource;
|
||||||
* @date 2024-09-27
|
* @date 2024-09-27
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class MachineServiceImpl implements IMachineService
|
public class MachineServiceImpl implements IMachineService
|
||||||
{
|
{
|
||||||
@Resource
|
@Resource
|
||||||
|
|
@ -52,16 +54,20 @@ public class MachineServiceImpl implements IMachineService
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUserName(Long userId, Consumer<String> setNameFunction) {
|
private void setUserName(Long userId, Consumer<String> setNameFunction) {
|
||||||
AjaxResult ajaxResult = remoteUserService.getInfo(userId, SecurityConstants.INNER);
|
try {
|
||||||
if (ajaxResult.isSuccess()) {
|
AjaxResult ajaxResult = remoteUserService.getInfo(userId, SecurityConstants.INNER);
|
||||||
// ajaxResult.get("data") 返回的是 LinkedHashMap
|
if (ajaxResult.isSuccess()) {
|
||||||
LinkedHashMap<String, Object> rawDataList = (LinkedHashMap<String, Object>) ajaxResult.get("data");
|
// ajaxResult.get("data") 返回的是 LinkedHashMap
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
LinkedHashMap<String, Object> rawDataList = (LinkedHashMap<String, Object>) ajaxResult.get("data");
|
||||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
if (rawDataList != null) {
|
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
SysUser sysUser = objectMapper.convertValue(rawDataList, SysUser.class);
|
if (rawDataList != null) {
|
||||||
setNameFunction.accept(sysUser.getNickName() == null ? "" : sysUser.getNickName());
|
SysUser sysUser = objectMapper.convertValue(rawDataList, SysUser.class);
|
||||||
|
setNameFunction.accept(sysUser.getNickName() == null ? "" : sysUser.getNickName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
log.error("远程调用查询失败:", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue