Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
9e51679064
|
|
@ -45,7 +45,7 @@ public class BmUnitController extends BaseController
|
|||
* 查询往来单位管理列表
|
||||
*/
|
||||
@ApiOperation(value = "查询往来单位管理列表")
|
||||
//@RequiresPermissions("basic:unit:list")
|
||||
@RequiresPermissions("basic:unit:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BmUnit bmUnit)
|
||||
{
|
||||
|
|
@ -113,8 +113,8 @@ public class BmUnitController extends BaseController
|
|||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:unit:remove")
|
||||
@SysLog(title = "往来单位管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除往来单位管理")
|
||||
@DeleteMapping("/{unitIds}")
|
||||
public AjaxResult remove(@PathVariable Long unitId)
|
||||
@DeleteMapping("/{unitId}")
|
||||
public AjaxResult remove(@PathVariable("unitId") Long unitId)
|
||||
{
|
||||
return bmUnitService.deleteBmUnitByUnitId(unitId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
package com.bonus.material.basic.controller;
|
||||
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.basic.domain.BmUnit;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.material.basic.domain.BmUnitPerson;
|
||||
|
|
@ -18,6 +15,8 @@ import com.bonus.material.basic.service.IBmUnitPersonService;
|
|||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 往来单位管理Controller
|
||||
*
|
||||
|
|
@ -32,6 +31,19 @@ public class BmUnitPersonController extends BaseController
|
|||
@Autowired
|
||||
private IBmUnitPersonService bmUnitPersonService;
|
||||
|
||||
/**
|
||||
* 查询往来单位绑定管理列表
|
||||
*/
|
||||
@ApiOperation(value = "查询往来单位绑定管理列表")
|
||||
@RequiresPermissions("basic:person:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BmUnitPerson bmUnitPerson)
|
||||
{
|
||||
startPage();
|
||||
List<BmUnit> list = bmUnitPersonService.selectBmUnitList(bmUnitPerson);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定往来单位人员列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -48,17 +48,20 @@ public class BmProject extends BaseEntity
|
|||
private String proTypeId;
|
||||
|
||||
@ApiModelProperty(value = "实施单位")
|
||||
@Excel(name = "实施单位")
|
||||
@NotBlank(message = "实施单位不能为空")
|
||||
private String impUnit;
|
||||
|
||||
@ApiModelProperty(value = "实施单位")
|
||||
@Excel(name = "实施单位")
|
||||
private String impUnitName;
|
||||
|
||||
@ApiModelProperty(value = "工程类型")
|
||||
@Excel(name = "工程类型")
|
||||
@NotBlank(message = "工程类型不能为空")
|
||||
private String proType;
|
||||
|
||||
@ApiModelProperty(value = "工程编码")
|
||||
@Excel(name = "i8工程编码")
|
||||
@ApiModelProperty(value = "工程编号")
|
||||
@Excel(name = "工程编号")
|
||||
@Size(max=60, message = "工程编号长度不能超过60")
|
||||
private String proCode;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,11 +46,14 @@ public class BmUnit extends BaseEntity
|
|||
private String typeName;
|
||||
|
||||
/** 所属分公司 */
|
||||
@Excel(name = "所属分公司")
|
||||
@ApiModelProperty(value = "所属分公司")
|
||||
@NotBlank(message = "所属分公司不能为空")
|
||||
private Long deptId;
|
||||
|
||||
@Excel(name = "所属分公司")
|
||||
@ApiModelProperty(value = "所属分公司名称")
|
||||
private String deptName;
|
||||
|
||||
/** 联系人 */
|
||||
@Excel(name = "联系人")
|
||||
@ApiModelProperty(value = "联系人")
|
||||
|
|
@ -71,5 +74,11 @@ public class BmUnit extends BaseEntity
|
|||
*/
|
||||
private Integer isBind;
|
||||
|
||||
@ApiModelProperty(value = "绑定人员id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "绑定人员名称")
|
||||
private String userName;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.bonus.material.basic.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
|
@ -32,17 +31,14 @@ public class BmUnitPerson extends BaseEntity
|
|||
private Long unitId;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 数据所属组织 */
|
||||
@Excel(name = "数据所属组织")
|
||||
@ApiModelProperty(value = "数据所属组织")
|
||||
private String companyId;
|
||||
|
||||
/**
|
||||
* 二级树标识 1代表查询二级树
|
||||
*/
|
||||
private Integer isTree;
|
||||
/** 单位类型名称 */
|
||||
@ApiModelProperty(value = "单位类型名称")
|
||||
private String unitName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.bonus.material.basic.mapper;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.biz.domain.TreeNode;
|
||||
import com.bonus.material.basic.domain.BmUnit;
|
||||
import com.bonus.material.basic.domain.BmUnitPerson;
|
||||
|
||||
/**
|
||||
|
|
@ -29,4 +29,11 @@ public interface BmUnitPersonMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteBmUnitPersonByID(Long unitId);
|
||||
|
||||
/**
|
||||
* 查询往来单位管理列表
|
||||
* @param bmUnitPerson
|
||||
* @return
|
||||
*/
|
||||
List<BmUnit> selectBmUnitList(BmUnitPerson bmUnitPerson);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
package com.bonus.material.basic.service;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.BmUnit;
|
||||
import com.bonus.material.basic.domain.BmUnitPerson;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 往来单位管理Service接口
|
||||
*
|
||||
|
|
@ -28,4 +31,10 @@ public interface IBmUnitPersonService
|
|||
*/
|
||||
public AjaxResult deleteBmUnitPersonByID(Long unitId);
|
||||
|
||||
/**
|
||||
* 查询绑定的往来单位列表
|
||||
* @param bmUnitPerson
|
||||
* @return
|
||||
*/
|
||||
List<BmUnit> selectBmUnitList(BmUnitPerson bmUnitPerson);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ import com.bonus.material.basic.service.IBmProjectService;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.*;
|
||||
|
||||
|
||||
/**
|
||||
* 标段工程管理Service业务层处理
|
||||
|
|
@ -56,6 +58,10 @@ public class BmProjectServiceImpl implements IBmProjectService
|
|||
return project;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实施单位方法抽取
|
||||
* @param project
|
||||
*/
|
||||
private void extractedImpUnit(BmProject project) {
|
||||
try {
|
||||
AjaxResult ajaxResult = remoteDeptService.getInfo(Long.parseLong(project.getImpUnit()), SecurityConstants.INNER);
|
||||
|
|
@ -67,7 +73,7 @@ public class BmProjectServiceImpl implements IBmProjectService
|
|||
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());
|
||||
project.setImpUnitName(sysDept.getDeptName() == null ? "" : sysDept.getDeptName());
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
|
|
@ -88,11 +94,61 @@ 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(Integer.valueOf(item.getProTypeId()))) {
|
||||
item.setProType("线路工程");
|
||||
} else if (ONE_CONSTANT.equals(Integer.valueOf(item.getProTypeId()))) {
|
||||
item.setProType("变电工程");
|
||||
} else if (TWO_CONSTANT.equals(Integer.valueOf(item.getProTypeId()))) {
|
||||
item.setProType("业务工程");
|
||||
} else if (THREE_CONSTANT.equals(Integer.valueOf(item.getProTypeId()))) {
|
||||
item.setProType("其他工程");
|
||||
} else {
|
||||
item.setProType("未知工程类型");
|
||||
}
|
||||
}
|
||||
if (item.getProNature() != null) {
|
||||
if (ZERO_CONSTANT.equals(Integer.valueOf(item.getProNature()))) {
|
||||
item.setProNature("基建");
|
||||
} else if (ONE_CONSTANT.equals(Integer.valueOf(item.getProNature()))) {
|
||||
item.setProNature("用户工程");
|
||||
} else if (TWO_CONSTANT.equals(Integer.valueOf(item.getProNature()))){
|
||||
item.setProNature("技修大改");
|
||||
} else if (THREE_CONSTANT.equals(Integer.valueOf(item.getProNature()))) {
|
||||
item.setProNature("其他");
|
||||
} else {
|
||||
item.setProNature("未知工程性质");
|
||||
}
|
||||
}
|
||||
if (item.getProStatus() != null) {
|
||||
if (ZERO_CONSTANT.equals(Integer.valueOf(item.getProStatus()))) {
|
||||
item.setProStatus("开工准备");
|
||||
} else if (ONE_CONSTANT.equals(Integer.valueOf(item.getProStatus()))) {
|
||||
item.setProStatus("在建");
|
||||
} else if (TWO_CONSTANT.equals(Integer.valueOf(item.getProStatus()))){
|
||||
item.setProStatus("停工");
|
||||
} else if (THREE_CONSTANT.equals(Integer.valueOf(item.getProStatus()))){
|
||||
item.setProStatus("完工未竣工");
|
||||
} else if (FOUR_CONSTANT.equals(Integer.valueOf(item.getProStatus()))) {
|
||||
item.setProStatus("竣工");
|
||||
} else {
|
||||
item.setProStatus("未知工程状态");
|
||||
}
|
||||
}
|
||||
item.setIsMatchI8(StringUtils.isNotEmpty(item.getExternalId()) ? "匹配" : "不匹配");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增标段工程管理
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,19 +1,27 @@
|
|||
package com.bonus.material.basic.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.domain.TreeBuild;
|
||||
import com.bonus.common.biz.domain.TreeNode;
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.bonus.material.basic.domain.BmUnit;
|
||||
import com.bonus.material.basic.mapper.BmUnitMapper;
|
||||
import com.bonus.material.purchase.config.RemoteConfig;
|
||||
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 org.springframework.stereotype.Service;
|
||||
import com.bonus.material.basic.mapper.BmUnitPersonMapper;
|
||||
import com.bonus.material.basic.domain.BmUnitPerson;
|
||||
import com.bonus.material.basic.service.IBmUnitPersonService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 往来单位管理Service业务层处理
|
||||
*
|
||||
|
|
@ -23,9 +31,18 @@ import com.bonus.material.basic.service.IBmUnitPersonService;
|
|||
@Service
|
||||
public class BmUnitPersonServiceImpl implements IBmUnitPersonService
|
||||
{
|
||||
@Autowired
|
||||
@Resource
|
||||
private BmUnitPersonMapper bmUnitPersonMapper;
|
||||
|
||||
@Resource
|
||||
private RemoteConfig remoteConfig;
|
||||
|
||||
@Resource
|
||||
private BmUnitMapper bmUnitMapper;
|
||||
|
||||
@Resource
|
||||
private RemoteDeptService remoteDeptService;
|
||||
|
||||
/**
|
||||
* 新增往来单位管理
|
||||
*
|
||||
|
|
@ -65,4 +82,72 @@ public class BmUnitPersonServiceImpl implements IBmUnitPersonService
|
|||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询关联单位列表
|
||||
* @param bmUnitPerson
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BmUnit> selectBmUnitList(BmUnitPerson bmUnitPerson) {
|
||||
List<BmUnit> bmUnitList = bmUnitPersonMapper.selectBmUnitList(bmUnitPerson);
|
||||
Long[] array = bmUnitList.stream()
|
||||
// 提取 createBy 字段
|
||||
.map(BmUnit::getUserId)
|
||||
.map(createBy -> {
|
||||
try {
|
||||
// 转换为 Long
|
||||
return createBy;
|
||||
} catch (NumberFormatException e) {
|
||||
// 处理转换失败的情况,可以返回 null
|
||||
return null;
|
||||
}
|
||||
})
|
||||
// 过滤掉 null 值
|
||||
.filter(value -> value != null)
|
||||
// 转换为 Long[] 数组
|
||||
.toArray(Long[]::new);
|
||||
Map<Long, String> nickNameMap = remoteConfig.getUserName(array);
|
||||
if (CollectionUtils.isNotEmpty(bmUnitList)) {
|
||||
bmUnitList.forEach(item -> {
|
||||
Long userId = item.getUserId();
|
||||
if (userId != null) {
|
||||
String nickName = nickNameMap.get(userId);
|
||||
item.setUserName(nickName != null ? nickName : " ");
|
||||
}
|
||||
if (item.getUnitId() != null) {
|
||||
//根据单位id去人员绑定中查询是否绑定,赋值绑定状态
|
||||
item.setIsBind(bmUnitMapper.selectBmUnitPersonByUnitId(item.getUnitId()) > 0 ? 1 : 0);
|
||||
}
|
||||
extracted(item);
|
||||
});
|
||||
}
|
||||
return bmUnitList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法抽取
|
||||
* @param unit
|
||||
*/
|
||||
private void extracted(BmUnit unit) {
|
||||
Map<String, String> labelMap = remoteConfig.getDictValue("bm_unit_type");
|
||||
if (unit.getUnitId() != null) {
|
||||
//根据单位id去人员绑定中查询是否绑定,赋值绑定状态
|
||||
unit.setIsBind(bmUnitMapper.selectBmUnitPersonByUnitId(unit.getUnitId()) > 0 ? 1 : 0);
|
||||
}
|
||||
if (unit.getTypeId() != null) {
|
||||
unit.setTypeName(labelMap.get(unit.getTypeId().toString()) == null ? "" : labelMap.get(unit.getTypeId().toString()));
|
||||
}
|
||||
AjaxResult ajaxResult = remoteDeptService.getInfo(unit.getDeptId(), SecurityConstants.INNER);
|
||||
//健壮性判断
|
||||
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);
|
||||
unit.setDeptName(sysDept.getDeptName() == null ? "" : sysDept.getDeptName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.util.PhoneUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
|
|
@ -14,8 +13,9 @@ 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.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.RemoteDictDataService;
|
||||
import com.bonus.system.api.domain.SysDictData;
|
||||
import com.bonus.material.purchase.config.RemoteConfig;
|
||||
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;
|
||||
|
|
@ -41,7 +41,11 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
private BmUnitMapper bmUnitMapper;
|
||||
|
||||
@Resource
|
||||
private RemoteDictDataService remoteDictDataService;
|
||||
private RemoteConfig remoteConfig;
|
||||
|
||||
@Resource
|
||||
private RemoteDeptService remoteDeptService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询往来单位管理
|
||||
|
|
@ -52,7 +56,9 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
@Override
|
||||
public BmUnit selectBmUnitByUnitId(Long unitId)
|
||||
{
|
||||
return bmUnitMapper.selectBmUnitByUnitId(unitId);
|
||||
BmUnit unit = bmUnitMapper.selectBmUnitByUnitId(unitId);
|
||||
extracted(unit);
|
||||
return unit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -65,43 +71,42 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
public List<BmUnit> selectBmUnitList(BmUnit bmUnit)
|
||||
{
|
||||
List<BmUnit> bmUnitList = bmUnitMapper.selectBmUnitList(bmUnit);
|
||||
extracted(bmUnitList);
|
||||
if (CollectionUtils.isNotEmpty(bmUnitList)) {
|
||||
bmUnitList.forEach(item -> {
|
||||
extracted(item);
|
||||
});
|
||||
}
|
||||
return bmUnitList;
|
||||
}
|
||||
|
||||
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();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 方法抽取
|
||||
* @param unit
|
||||
*/
|
||||
private void extracted(BmUnit unit) {
|
||||
Map<String, String> labelMap = remoteConfig.getDictValue("bm_unit_type");
|
||||
if (unit.getUnitId() != null) {
|
||||
//根据单位id去人员绑定中查询是否绑定,赋值绑定状态
|
||||
unit.setIsBind(bmUnitMapper.selectBmUnitPersonByUnitId(unit.getUnitId()) > 0 ? 1 : 0);
|
||||
}
|
||||
if (unit.getTypeId() != null) {
|
||||
unit.setTypeName(labelMap.get(unit.getTypeId().toString()) == null ? "" : labelMap.get(unit.getTypeId().toString()));
|
||||
}
|
||||
AjaxResult ajaxResult = remoteDeptService.getInfo(unit.getDeptId(), SecurityConstants.INNER);
|
||||
//健壮性判断
|
||||
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);
|
||||
unit.setDeptName(sysDept.getDeptName() == null ? "" : sysDept.getDeptName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("远程服务调用查询失败:", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增往来单位管理
|
||||
*
|
||||
|
|
|
|||
|
|
@ -98,7 +98,8 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
})
|
||||
// 过滤掉 null 值
|
||||
.filter(value -> value != null)
|
||||
.toArray(Long[]::new);// 转换为 Long[] 数组
|
||||
// 转换为 Long[] 数组
|
||||
.toArray(Long[]::new);
|
||||
Map<Long, String> nickNameMap = remoteConfig.getUserName(array);
|
||||
Map<String, String> labelMap = remoteConfig.getDictValue("purchase_task_status");
|
||||
// 更新 list 中每个 PurchaseVo 对象的 name 字段
|
||||
|
|
@ -108,6 +109,7 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
if (StringUtils.isNotBlank(createBy)) {
|
||||
Long createById = Long.parseLong(createBy);
|
||||
String nickName = nickNameMap.get(createById);
|
||||
purchaseVo.setCreateBy(nickName != null ? nickName : createBy);
|
||||
purchaseVo.setCreateBy(nickName != null ? nickName : createBy); // 设置为 nickName 或原值
|
||||
}
|
||||
// 更新状态名称
|
||||
|
|
|
|||
|
|
@ -253,9 +253,9 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
*/
|
||||
private int updatePurchaseInfoAndDetails(PurchaseVo detail, int purchaseId) {
|
||||
int result = purchaseStorageMapper.updateStatusById(MaterialConstants.FIVE_CONSTANT, purchaseId);
|
||||
if (ZERO_CONSTANT.equals(detail.getManageType())) {
|
||||
if (ZERO_CONSTANT.equals(Integer.valueOf(detail.getManageType()))) {
|
||||
result += purchaseStorageMapper.insertMachine(detail);
|
||||
} else if (ONE_CONSTANT.equals(detail.getManageType())) {
|
||||
} else if (ONE_CONSTANT.equals(Integer.valueOf(detail.getManageType()))) {
|
||||
result += purchaseStorageMapper.updateStorageNum(detail.getBindNum(), detail.getTypeId());
|
||||
}
|
||||
return result + purchaseStorageMapper.updateNum(detail.getPurchaseId(), detail.getBindNum());
|
||||
|
|
@ -297,9 +297,9 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
.mapToInt(detail -> {
|
||||
int result = purchaseStorageMapper.updateNum(detail.getPurchaseId(), detail.getBindNum());
|
||||
result += purchaseStorageMapper.updateStatusById(MaterialConstants.FIVE_CONSTANT, Integer.parseInt(detail.getPurchaseId()));
|
||||
if (ZERO_CONSTANT.equals(detail.getManageType())) {
|
||||
if (ZERO_CONSTANT.equals(Integer.valueOf(detail.getManageType()))) {
|
||||
result += purchaseStorageMapper.insertMachine(detail);
|
||||
} else if (ONE_CONSTANT.equals(detail.getManageType())) {
|
||||
} else if (ONE_CONSTANT.equals(Integer.valueOf(detail.getManageType()))) {
|
||||
result += purchaseStorageMapper.updateStorageNum(detail.getBindNum(), detail.getTypeId());
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -24,4 +24,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
delete from bm_unit_person where unit_id = #{unitId}
|
||||
</delete>
|
||||
|
||||
<select id="selectBmUnitList" resultType="com.bonus.material.basic.domain.BmUnit">
|
||||
SELECT
|
||||
bu.unit_id AS unitId,
|
||||
bu.unit_name AS unitName,
|
||||
bu.STATUS AS STATUS,
|
||||
bu.type_id AS typeId,
|
||||
bu.link_man AS linkMan,
|
||||
bu.telphone AS telphone,
|
||||
bu.dept_id AS deptId,
|
||||
bu.del_flag AS delFlag,
|
||||
bu.create_by AS createBy,
|
||||
bu.create_time AS createTime,
|
||||
bu.update_by AS updateBy,
|
||||
bu.update_time AS updateTime,
|
||||
bu.remark AS remark,
|
||||
bup.user_id as userId
|
||||
FROM
|
||||
bm_unit bu
|
||||
left join bm_unit_person bup ON bu.unit_id = bup.unit_id
|
||||
WHERE
|
||||
bu.del_flag = 0
|
||||
<if test="unitName != null and unitName != ''">and bu.unit_name like concat('%', #{unitName}, '%')</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue