Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c0b425737f
|
|
@ -4,10 +4,12 @@ import com.bonus.sgzb.common.core.web.controller.BaseController;
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
||||||
import com.bonus.sgzb.material.config.PageResultVo;
|
import com.bonus.sgzb.material.config.PageResultVo;
|
||||||
|
import com.bonus.sgzb.material.domain.LeaseApplyDetails;
|
||||||
import com.bonus.sgzb.material.domain.MaWholeSetDto;
|
import com.bonus.sgzb.material.domain.MaWholeSetDto;
|
||||||
import com.bonus.sgzb.material.domain.MaWholeTreeVo;
|
import com.bonus.sgzb.material.domain.MaWholeTreeVo;
|
||||||
import com.bonus.sgzb.material.domain.MaWholeVo;
|
import com.bonus.sgzb.material.domain.MaWholeVo;
|
||||||
import com.bonus.sgzb.material.service.MaWholeSetService;
|
import com.bonus.sgzb.material.service.MaWholeSetService;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.annotations.ApiParam;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -51,11 +53,11 @@ public class MaWholeSetController extends BaseController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation("查询整套抱杆管理")
|
@ApiOperation("查询整套抱杆管理")
|
||||||
@PostMapping("/selectList")
|
@GetMapping("/selectList")
|
||||||
public AjaxResult selectList(@ApiParam(value = "查询信息") @RequestBody MaWholeSetDto dto) {
|
public TableDataInfo selectList(MaWholeSetDto dto) {
|
||||||
log.info("查询整套抱杆管理:{}", dto);
|
PageHelper.startPage(dto.getPageNum() == 0 ? 1 : dto.getPageNum(), dto.getPageSize());
|
||||||
PageResultVo<MaWholeVo> result = maWholeSetService.selectList(dto);
|
List<MaWholeVo> maWholeVos = maWholeSetService.selectList(dto);
|
||||||
return AjaxResult.success(result);
|
return getDataTable(maWholeVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -96,4 +98,16 @@ public class MaWholeSetController extends BaseController {
|
||||||
log.info("根据id删除整套抱杆:{}", dto);
|
log.info("根据id删除整套抱杆:{}", dto);
|
||||||
return maWholeSetService.deleteById(dto);
|
return maWholeSetService.deleteById(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询整套抱杆明细
|
||||||
|
* @param wholeTypeName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("领料申请查询成套抱杆设备")
|
||||||
|
@GetMapping("/selectListByWholeTypeName")
|
||||||
|
public AjaxResult selectListByWholeTypeName(MaWholeSetDto wholeTypeName) {
|
||||||
|
List<LeaseApplyDetails> list = maWholeSetService.selectListByWholeTypeName(wholeTypeName);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
package com.bonus.sgzb.material.domain;
|
package com.bonus.sgzb.material.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 整套抱杆表单集合实体类
|
* 整套抱杆表单集合实体类
|
||||||
|
|
@ -20,10 +24,38 @@ public class MaWhole {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
/** 父级ID */
|
/** 父级ID */
|
||||||
@ApiModelProperty(value = "父级ID")
|
@ApiModelProperty(value = "父级类型ID")
|
||||||
private Integer parentId;
|
private Integer parentId;
|
||||||
|
/** 父级ID */
|
||||||
|
@ApiModelProperty(value = "类型ID")
|
||||||
|
private Integer typeId;
|
||||||
|
@ApiModelProperty(value = "数量")
|
||||||
|
private Integer deviceNum;
|
||||||
|
|
||||||
/** 配套数量 */
|
/** 配套数量 */
|
||||||
@ApiModelProperty(value = "配套数量")
|
@ApiModelProperty(value = "配套数量")
|
||||||
private Integer totalNum;
|
private Integer totalNum;
|
||||||
|
/** 设备id */
|
||||||
|
@ApiModelProperty(value = "设备id")
|
||||||
|
private Integer deviceTypeId;
|
||||||
|
/** 设备类型 */
|
||||||
|
@ApiModelProperty(value = "设备类型(1主体设备 2配套设备)")
|
||||||
|
private Integer ascriptionType;
|
||||||
|
|
||||||
|
/** 配套名称 */
|
||||||
|
@ApiModelProperty(value = "配套名称")
|
||||||
|
private String wholeTypeName;
|
||||||
|
/** 配套名称 */
|
||||||
|
@ApiModelProperty(value = "所属公司")
|
||||||
|
private String companyId;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
/** 创建人 */
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private Integer createBy;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,22 @@ public class MaWholeSetDto {
|
||||||
/** 关键字 */
|
/** 关键字 */
|
||||||
@ApiModelProperty(value = "关键字")
|
@ApiModelProperty(value = "关键字")
|
||||||
private String keyWord;
|
private String keyWord;
|
||||||
|
/** 配套名称 */
|
||||||
|
@ApiModelProperty(value = "配套名称")
|
||||||
|
private String wholeTypeName;
|
||||||
|
/** 关键字 */
|
||||||
|
@ApiModelProperty(value = "所属公司")
|
||||||
|
private String companyId;
|
||||||
|
/** 关键字 */
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private Integer createBy;
|
||||||
|
@ApiModelProperty(value = "开始时间")
|
||||||
|
private String startTime;
|
||||||
|
@ApiModelProperty(value = "结束时间")
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
/** 表单对象集合 */
|
/** 表单对象集合 */
|
||||||
@ApiModelProperty(value = "表单对象集合")
|
@ApiModelProperty(value = "表单对象集合")
|
||||||
private List<MaWhole> wholeList;
|
private List<MaWhole> deviceInfo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,12 @@ public interface BackApplyMapper {
|
||||||
*/
|
*/
|
||||||
List<TypeTreeNode> getUseTypeTree(BackApplyInfo bean);
|
List<TypeTreeNode> getUseTypeTree(BackApplyInfo bean);
|
||||||
|
|
||||||
|
List<TypeTreeNode> getUseTypeTreeL4(BackApplyInfo bean);
|
||||||
|
|
||||||
|
List<TypeTreeNode> getUseTypeTreeL3(List<Long> list);
|
||||||
|
|
||||||
|
List<TypeTreeNode> getUseTypeTreeL21(List<Long> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退料申请导出
|
* 退料申请导出
|
||||||
* @param bean
|
* @param bean
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
package com.bonus.sgzb.material.mapper;
|
package com.bonus.sgzb.material.mapper;
|
||||||
|
|
||||||
import com.bonus.sgzb.base.api.domain.MaType;
|
import com.bonus.sgzb.base.api.domain.MaType;
|
||||||
import com.bonus.sgzb.material.domain.MaWhole;
|
import com.bonus.sgzb.material.domain.*;
|
||||||
import com.bonus.sgzb.material.domain.MaWholeSetDto;
|
|
||||||
import com.bonus.sgzb.material.domain.MaWholeVo;
|
|
||||||
import com.bonus.sgzb.material.domain.TreeSelectId;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -46,10 +43,10 @@ public interface MaWholeSetMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id删除
|
* 根据id删除
|
||||||
* @param id
|
* @param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int deleteById(@Param("id") Integer id);
|
int deleteById(MaWholeSetDto dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id去ma_whole_set表中查询typeid
|
* 根据id去ma_whole_set表中查询typeid
|
||||||
|
|
@ -78,4 +75,8 @@ public interface MaWholeSetMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<TreeSelectId> selectId(@Param("typeId") List<Integer> typeId);
|
List<TreeSelectId> selectId(@Param("typeId") List<Integer> typeId);
|
||||||
|
|
||||||
|
int selectByWholeTypeName(MaWholeSetDto wholeTypeName);
|
||||||
|
|
||||||
|
List<LeaseApplyDetails> selectListByWholeTypeName(MaWholeSetDto wholeTypeName);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public interface WorkSiteDirectManageMapper {
|
||||||
|
|
||||||
int batchDel(@Param("ids") ArrayList<Integer> ids);
|
int batchDel(@Param("ids") ArrayList<Integer> ids);
|
||||||
|
|
||||||
String getMachineStatus(LeaseOutDetails leaseOutDetails);
|
DirectApplyInfo getMachineStatus(LeaseOutDetails leaseOutDetails);
|
||||||
|
|
||||||
int updateLeaseApplyDetailsOutNum(@Param("record")LeaseOutDetails leaseOutDetails);
|
int updateLeaseApplyDetailsOutNum(@Param("record")LeaseOutDetails leaseOutDetails);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.sgzb.material.service;
|
||||||
|
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.material.config.PageResultVo;
|
import com.bonus.sgzb.material.config.PageResultVo;
|
||||||
|
import com.bonus.sgzb.material.domain.LeaseApplyDetails;
|
||||||
import com.bonus.sgzb.material.domain.MaWholeSetDto;
|
import com.bonus.sgzb.material.domain.MaWholeSetDto;
|
||||||
import com.bonus.sgzb.material.domain.MaWholeTreeVo;
|
import com.bonus.sgzb.material.domain.MaWholeTreeVo;
|
||||||
import com.bonus.sgzb.material.domain.MaWholeVo;
|
import com.bonus.sgzb.material.domain.MaWholeVo;
|
||||||
|
|
@ -27,7 +28,7 @@ public interface MaWholeSetService {
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
PageResultVo<MaWholeVo> selectList(MaWholeSetDto dto);
|
List<MaWholeVo> selectList(MaWholeSetDto dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询整套抱杆明细
|
* 查询整套抱杆明细
|
||||||
|
|
@ -56,4 +57,6 @@ public interface MaWholeSetService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
MaWholeTreeVo selectListTree(Integer id);
|
MaWholeTreeVo selectListTree(Integer id);
|
||||||
|
|
||||||
|
List<LeaseApplyDetails> selectListByWholeTypeName(MaWholeSetDto wholeTypeName);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hay
|
* @author hay
|
||||||
|
|
@ -364,8 +365,19 @@ public class BackApplyServiceImpl implements BackApplyService {
|
||||||
public AjaxResult getUseTypeTree(BackApplyInfo bean) {
|
public AjaxResult getUseTypeTree(BackApplyInfo bean) {
|
||||||
List<TypeTreeNode> groupList = new ArrayList<>();
|
List<TypeTreeNode> groupList = new ArrayList<>();
|
||||||
List<TypeTreeNode> list = new ArrayList<>();
|
List<TypeTreeNode> list = new ArrayList<>();
|
||||||
|
List<TypeTreeNode> listL4 = new ArrayList<>();
|
||||||
|
List<TypeTreeNode> listL3 = new ArrayList<>();
|
||||||
|
List<TypeTreeNode> listL21 = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
list = backApplyMapper.getUseTypeTree(bean);
|
//list = backApplyMapper.getUseTypeTree(bean);
|
||||||
|
listL4 = backApplyMapper.getUseTypeTreeL4(bean);
|
||||||
|
List<Long> list4ParentIds = listL4.stream().map(o -> o.getParentId()).collect(Collectors.toList());
|
||||||
|
listL3 = backApplyMapper.getUseTypeTreeL3(list4ParentIds);
|
||||||
|
List<Long> list3ParentIds = listL3.stream().map(o -> o.getParentId()).collect(Collectors.toList());
|
||||||
|
listL21 = backApplyMapper.getUseTypeTreeL21(list3ParentIds);
|
||||||
|
list.addAll(listL4);
|
||||||
|
list.addAll(listL3);
|
||||||
|
list.addAll(listL21);
|
||||||
if (CollectionUtils.isNotEmpty(list)) {
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
// 创建树形结构(数据集合作为参数)
|
// 创建树形结构(数据集合作为参数)
|
||||||
TypeTreeBuild treeBuild = new TypeTreeBuild(list);
|
TypeTreeBuild treeBuild = new TypeTreeBuild(list);
|
||||||
|
|
|
||||||
|
|
@ -39,21 +39,24 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
|
||||||
if (dto == null) {
|
if (dto == null) {
|
||||||
return AjaxResult.error("参数不能为空!!!");
|
return AjaxResult.error("参数不能为空!!!");
|
||||||
}
|
}
|
||||||
if (dto.getParentId() == null) {
|
|
||||||
return AjaxResult.error("父级id不能为空");
|
//先查询是否有重复的配套名称
|
||||||
|
if (selectByWholeTypeName(dto) > 0) {
|
||||||
|
return AjaxResult.error("成套名称已存在");
|
||||||
}
|
}
|
||||||
int count = selectByParentId(dto.getParentId());
|
|
||||||
if (count != 0) {
|
if (CollectionUtils.isNotEmpty(dto.getDeviceInfo())) {
|
||||||
return AjaxResult.error("该物品类型已经绑定相关配件,无法再次绑定,请重新选择!!!");
|
for (MaWhole maWhole : dto.getDeviceInfo()) {
|
||||||
}
|
maWhole.setCreateBy(dto.getCreateBy());
|
||||||
if (CollectionUtils.isNotEmpty(dto.getWholeList())) {
|
maWhole.setCompanyId(dto.getCompanyId());
|
||||||
for (MaWhole maWhole : dto.getWholeList()) {
|
maWhole.setTypeId(maWhole.getDeviceTypeId());
|
||||||
|
maWhole.setTotalNum(maWhole.getDeviceNum());
|
||||||
|
maWhole.setWholeTypeName(dto.getWholeTypeName());
|
||||||
maWhole.setParentId(dto.getParentId());
|
maWhole.setParentId(dto.getParentId());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
try {
|
try {
|
||||||
res = insertMaWholeSet(dto.getWholeList());
|
res = insertMaWholeSet(dto.getDeviceInfo());
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
log.error("insertMaWholeSet方法插入异常");
|
log.error("insertMaWholeSet方法插入异常");
|
||||||
throw new RuntimeException("insertMaWholeSet方法插入异常");
|
throw new RuntimeException("insertMaWholeSet方法插入异常");
|
||||||
|
|
@ -63,26 +66,24 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
|
||||||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||||
}
|
}
|
||||||
return AjaxResult.success("新增成功", res);
|
return AjaxResult.success("新增成功", res);
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("请选择主/配套设备");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int selectByWholeTypeName(MaWholeSetDto wholeTypeName) {
|
||||||
|
return mapper.selectByWholeTypeName(wholeTypeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询整套抱杆管理
|
* 查询整套抱杆管理
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageResultVo<MaWholeVo> selectList(MaWholeSetDto dto) {
|
public List<MaWholeVo> selectList(MaWholeSetDto dto) {
|
||||||
List<MaWholeVo> list = mapper.selectList(dto);
|
return mapper.selectList(dto);
|
||||||
PageHelper.startPage(dto.getPageNum() == 0 ? 1 : dto.getPageNum(), dto.getPageSize());
|
|
||||||
PageResultVo pageResult = new PageResultVo();
|
|
||||||
// 分页信息
|
|
||||||
PageInfo<MaWholeVo> pageInfo = new PageInfo<>(list);
|
|
||||||
pageResult.setTotalCount(pageInfo.getTotal());
|
|
||||||
pageResult.setTotalPageCount(pageInfo.getPages());
|
|
||||||
pageResult.setResult(list);
|
|
||||||
pageResult.setPageNum(dto.getPageNum());
|
|
||||||
pageResult.setPageSize(dto.getPageSize());
|
|
||||||
return pageResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -103,12 +104,12 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult deleteById(MaWholeSetDto dto) {
|
public AjaxResult deleteById(MaWholeSetDto dto) {
|
||||||
if (dto.getId() == null) {
|
if (dto == null) {
|
||||||
return AjaxResult.error("删除标识id为空,无法进行删除");
|
return AjaxResult.error("删除标识id为空,无法进行删除");
|
||||||
}
|
}
|
||||||
int res = 0;
|
int res = 0;
|
||||||
try {
|
try {
|
||||||
res = deleteMaWhole(dto.getId());
|
res = deleteMaWhole(dto);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException("删除失败");
|
throw new RuntimeException("删除失败");
|
||||||
}
|
}
|
||||||
|
|
@ -121,11 +122,11 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id删除整套配件信息
|
* 根据id删除整套配件信息
|
||||||
* @param id
|
* @param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private int deleteMaWhole(Integer id) {
|
private int deleteMaWhole(MaWholeSetDto dto) {
|
||||||
return mapper.deleteById(id);
|
return mapper.deleteById(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -137,32 +138,34 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult update(MaWholeSetDto dto) {
|
public AjaxResult update(MaWholeSetDto dto) {
|
||||||
log.info("修改整套抱杆管理传参:{}", dto);
|
log.info("修改整套抱杆管理传参:{}", dto);
|
||||||
int count = selectByParentId(dto.getParentId());
|
if (CollectionUtils.isNotEmpty(dto.getDeviceInfo())) {
|
||||||
if (!dto.getId().equals(dto.getParentId()) && count != 0) {
|
for (MaWhole maWhole : dto.getDeviceInfo()) {
|
||||||
return AjaxResult.error("该物品类型已经配套相关配件,无法再次绑定,请重新提交修改!!!");
|
maWhole.setCreateBy(dto.getCreateBy());
|
||||||
}
|
maWhole.setTypeId(maWhole.getDeviceTypeId());
|
||||||
if (CollectionUtils.isNotEmpty(dto.getWholeList())) {
|
maWhole.setTotalNum(maWhole.getDeviceNum());
|
||||||
for (MaWhole maWhole : dto.getWholeList()) {
|
maWhole.setWholeTypeName(dto.getWholeTypeName());
|
||||||
maWhole.setParentId(dto.getParentId());
|
maWhole.setParentId(dto.getParentId());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
try {
|
try {
|
||||||
res = deleteMaWhole(dto.getId());
|
deleteMaWhole(dto);
|
||||||
if (res == 0) {
|
res = insertMaWholeSet(dto.getDeviceInfo());
|
||||||
log.error("deleteById方法删除异常");
|
|
||||||
throw new RuntimeException("deleteById方法删除异常");
|
|
||||||
}
|
|
||||||
res = insertMaWholeSet(dto.getWholeList());
|
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
log.error("insertMaWholeSet方法插入异常");
|
log.error("insertMaWholeSet方法插入异常");
|
||||||
throw new RuntimeException("insertMaWholeSet方法插入异常");
|
throw new RuntimeException("insertMaWholeSet方法插入异常");
|
||||||
}
|
}
|
||||||
|
/* int count = selectByWholeTypeName(dto);
|
||||||
|
if (count > 1) {
|
||||||
|
throw new RuntimeException("配套名称已重复,请重新输入");
|
||||||
|
}*/
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return AjaxResult.error(ExceptionEnum.UPDATE_TO_DATABASE.getCode(), ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
|
return AjaxResult.error(ExceptionEnum.UPDATE_TO_DATABASE.getCode(), ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
|
||||||
}
|
}
|
||||||
return AjaxResult.success("修改成功", res);
|
return AjaxResult.success("修改成功", res);
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("请选择主/配套设备");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -186,12 +189,20 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
|
||||||
return treeVo;
|
return treeVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LeaseApplyDetails> selectListByWholeTypeName(MaWholeSetDto wholeTypeName) {
|
||||||
|
return mapper.selectListByWholeTypeName(wholeTypeName);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 方法提取,新增ma_whole_set表
|
* 方法提取,新增ma_whole_set表
|
||||||
|
*
|
||||||
* @param wholeList
|
* @param wholeList
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private int insertMaWholeSet(List<MaWhole> wholeList) { return mapper.insert(wholeList); }
|
private int insertMaWholeSet(List<MaWhole> wholeList) {
|
||||||
|
return mapper.insert(wholeList);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据parentId查询,去重
|
* 根据parentId查询,去重
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import com.bonus.sgzb.material.service.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -179,7 +178,7 @@ public class WorkSiteDirectManageImpl implements WorkSiteDirectManageService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int insertLeaseOutDetail(List<LeaseOutDetails> leaseOutDetails, TmTask lTask) {
|
public int insertLeaseOutDetail(List<LeaseOutDetails> leaseOutDetails, TmTask lTask) {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
String maStatus = "15";
|
String maStatus = "16";
|
||||||
double outNum = 0.1;
|
double outNum = 0.1;
|
||||||
if (StringUtils.isNull(leaseOutDetails)) {
|
if (StringUtils.isNull(leaseOutDetails)) {
|
||||||
log.info("领料出库失败,请检查参数是否填写完整!");
|
log.info("领料出库失败,请检查参数是否填写完整!");
|
||||||
|
|
@ -187,9 +186,9 @@ public class WorkSiteDirectManageImpl implements WorkSiteDirectManageService {
|
||||||
}
|
}
|
||||||
for (LeaseOutDetails leaseOutDetail : leaseOutDetails) {
|
for (LeaseOutDetails leaseOutDetail : leaseOutDetails) {
|
||||||
if (!(Objects.equals(Integer.valueOf(0), leaseOutDetail.getMaId()) || leaseOutDetail.getMaId() == null)) {
|
if (!(Objects.equals(Integer.valueOf(0), leaseOutDetail.getMaId()) || leaseOutDetail.getMaId() == null)) {
|
||||||
String status = workSiteDirectManageMapper.getMachineStatus(leaseOutDetail);
|
DirectApplyInfo directApplyInfo = workSiteDirectManageMapper.getMachineStatus(leaseOutDetail);
|
||||||
if (!maStatus.equals(status)) {
|
if (!maStatus.equals(directApplyInfo.getStatus())) {
|
||||||
log.info("领料出库失败,该设备不是在库状态!");
|
log.info("领料出库失败,该设备不是再用状态!");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -690,6 +690,82 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEVEL ASC, type_id;
|
LEVEL ASC, type_id;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getUseTypeTreeL4" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
|
||||||
|
SELECT
|
||||||
|
mt.type_id,
|
||||||
|
mt.type_name,
|
||||||
|
mt.parent_id,
|
||||||
|
mt.unit_name as unitNames,
|
||||||
|
mt.company_id,
|
||||||
|
SUM( CASE WHEN sai.agreement_id = #{agreementId} AND sai.STATUS = '0' THEN sai.num ELSE 0 END ) AS num,
|
||||||
|
mt.LEVEL
|
||||||
|
FROM
|
||||||
|
ma_type mt
|
||||||
|
LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id
|
||||||
|
WHERE
|
||||||
|
EXISTS ( SELECT 1 FROM slt_agreement_info sai2 WHERE sai2.type_id = mt.type_id AND sai2.agreement_id = #{agreementId} AND sai2.STATUS = '0' and sai.lease_type = 0)
|
||||||
|
GROUP BY
|
||||||
|
mt.type_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getUseTypeTreeL3" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
|
||||||
|
SELECT
|
||||||
|
mt3.type_id,
|
||||||
|
mt3.type_name,
|
||||||
|
mt3.parent_id,
|
||||||
|
mt3.unit_name,
|
||||||
|
mt3.company_id,
|
||||||
|
0 AS num,
|
||||||
|
mt3.LEVEL
|
||||||
|
FROM
|
||||||
|
ma_type mt3 where type_id in
|
||||||
|
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getUseTypeTreeL21" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
|
||||||
|
SELECT
|
||||||
|
mt2.type_id,
|
||||||
|
mt2.type_name,
|
||||||
|
mt2.parent_id,
|
||||||
|
mt2.unit_name,
|
||||||
|
mt2.company_id,
|
||||||
|
0 AS num,
|
||||||
|
mt2.LEVEL
|
||||||
|
FROM
|
||||||
|
ma_type mt2 where type_id in
|
||||||
|
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
union
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
mt1.type_id,
|
||||||
|
mt1.type_name,
|
||||||
|
mt1.parent_id,
|
||||||
|
mt1.unit_name,
|
||||||
|
mt1.company_id,
|
||||||
|
0 AS num,
|
||||||
|
mt1.LEVEL
|
||||||
|
FROM
|
||||||
|
ma_type mt1 left join (
|
||||||
|
SELECT
|
||||||
|
mt2.type_id,
|
||||||
|
mt2.type_name,
|
||||||
|
mt2.parent_id,
|
||||||
|
mt2.unit_name,
|
||||||
|
mt2.company_id,
|
||||||
|
0 AS num,
|
||||||
|
mt2.LEVEL
|
||||||
|
FROM
|
||||||
|
ma_type mt2) mt2 on mt2.parent_id=mt1.type_id where mt2.type_id in
|
||||||
|
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="exportList" resultType="com.bonus.sgzb.base.api.domain.BackApplyInfo">
|
<select id="exportList" resultType="com.bonus.sgzb.base.api.domain.BackApplyInfo">
|
||||||
SELECT
|
SELECT
|
||||||
bai.`code`,
|
bai.`code`,
|
||||||
|
|
|
||||||
|
|
@ -41,24 +41,13 @@
|
||||||
|
|
||||||
<insert id="insert">
|
<insert id="insert">
|
||||||
<foreach item="item" index="index" collection="wholeList" separator=";">
|
<foreach item="item" index="index" collection="wholeList" separator=";">
|
||||||
insert into ma_whole_set
|
insert into ma_whole_set (type_id,parent_id,part_num,whole_type_name,create_by,ascription_type,create_time,status,company_id)
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
values(#{item.typeId},#{item.parentId},#{item.totalNum},#{item.wholeTypeName},#{item.createBy},#{item.ascriptionType}, now(),1,#{item.companyId})
|
||||||
<if test="item.id != null">type_id,</if>
|
|
||||||
<if test="item.parentId != null">parent_id,</if>
|
|
||||||
<if test="item.totalNum != null">part_num,</if>
|
|
||||||
status
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="item.id != null">#{item.id},</if>
|
|
||||||
<if test="item.parentId != null">#{item.parentId},</if>
|
|
||||||
<if test="item.totalNum != null">#{item.totalNum},</if>
|
|
||||||
1
|
|
||||||
</trim>
|
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
<delete id="deleteById" parameterType="java.lang.Integer">
|
<delete id="deleteById" parameterType="java.lang.Integer">
|
||||||
delete from ma_whole_set
|
delete from ma_whole_set
|
||||||
where parent_id = #{id}
|
where parent_id = #{id} and whole_type_name = #{wholeTypeName}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="selectByParentId" resultType="java.lang.Integer">
|
<select id="selectByParentId" resultType="java.lang.Integer">
|
||||||
|
|
@ -68,10 +57,14 @@
|
||||||
<select id="selectList" resultType="com.bonus.sgzb.material.domain.MaWholeVo">
|
<select id="selectList" resultType="com.bonus.sgzb.material.domain.MaWholeVo">
|
||||||
SELECT
|
SELECT
|
||||||
mws.parent_id AS id,
|
mws.parent_id AS id,
|
||||||
|
mws.whole_type_name AS wholeTypeName,
|
||||||
|
mws.create_time AS createTime,
|
||||||
|
SUM(CASE WHEN mws.ascription_type = 2 THEN 1 ELSE 0 END) AS totalNum,
|
||||||
mt2.type_name AS typeName,
|
mt2.type_name AS typeName,
|
||||||
mt.type_name AS typeModelName,
|
mt.type_name AS typeModelName,
|
||||||
SUM(mws.part_num) AS totalNum
|
su.nick_name AS nickName
|
||||||
FROM ma_whole_set mws
|
FROM ma_whole_set mws
|
||||||
|
JOIN sys_user su ON su.user_id = mws.create_by
|
||||||
JOIN ma_type mt ON mws.parent_id = mt.type_id
|
JOIN ma_type mt ON mws.parent_id = mt.type_id
|
||||||
JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||||
|
|
@ -79,20 +72,28 @@
|
||||||
WHERE
|
WHERE
|
||||||
mt.`status` = '0'
|
mt.`status` = '0'
|
||||||
AND mt.del_flag = '0'
|
AND mt.del_flag = '0'
|
||||||
<if test="keyWord != null and keyWord != ''">
|
<if test="wholeTypeName != null and wholeTypeName != ''">
|
||||||
and (
|
and mws.whole_type_name like concat('%', #{wholeTypeName}, '%')
|
||||||
mt2.type_name like concat('%', #{keyWord}, '%') or
|
|
||||||
mt.type_name like concat('%', #{keyWord}, '%')
|
|
||||||
)
|
|
||||||
</if>
|
</if>
|
||||||
GROUP BY mws.parent_id
|
<if test="parentId != null and parentId != ''">
|
||||||
|
and mws.parent_id = #{parentId}
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
|
||||||
|
and mws.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||||
|
</if>
|
||||||
|
GROUP BY mws.parent_id,mws.whole_type_name
|
||||||
|
order by mws.create_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="selectListById" resultType="com.bonus.sgzb.material.domain.MaWholeVo">
|
<select id="selectListById" resultType="com.bonus.sgzb.material.domain.MaWholeVo">
|
||||||
SELECT
|
SELECT
|
||||||
mws.parent_id AS id,
|
mws.parent_id AS id,
|
||||||
|
mt.type_id as deviceTypeId,
|
||||||
mt2.type_name AS typeName,
|
mt2.type_name AS typeName,
|
||||||
mt.type_name AS typeModelName,
|
mt.type_name AS deviceType,
|
||||||
mws.part_num AS totalNum
|
mws.whole_type_name as wholeTypeName,
|
||||||
|
case when mws.ascription_type = 1 then '主体设备' else '配套设备' end as deviceAscription,
|
||||||
|
mws.ascription_type as ascriptionType,
|
||||||
|
mws.part_num AS deviceNum
|
||||||
FROM
|
FROM
|
||||||
ma_whole_set mws
|
ma_whole_set mws
|
||||||
JOIN ma_type mt ON mws.type_id = mt.type_id
|
JOIN ma_type mt ON mws.type_id = mt.type_id
|
||||||
|
|
@ -100,17 +101,8 @@
|
||||||
JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||||
JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||||
WHERE
|
WHERE
|
||||||
mt.`status` = '0'
|
mws.parent_id = #{id} AND
|
||||||
AND mt.del_flag = '0'
|
mws.whole_type_name = #{wholeTypeName}
|
||||||
<if test="id != null and id != ''">
|
|
||||||
and mws.parent_id = #{id}
|
|
||||||
</if>
|
|
||||||
<if test="keyWord != null and keyWord != ''">
|
|
||||||
and (
|
|
||||||
mt2.type_name like concat('%', #{keyWord}, '%') or
|
|
||||||
mt.type_name like concat('%', #{keyWord}, '%')
|
|
||||||
)
|
|
||||||
</if>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectTypeTree" resultType="com.bonus.sgzb.material.domain.TreeSelectId">
|
<select id="selectTypeTree" resultType="com.bonus.sgzb.material.domain.TreeSelectId">
|
||||||
|
|
@ -148,10 +140,8 @@
|
||||||
JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||||
JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||||
WHERE
|
WHERE
|
||||||
mt.`status` = '0'
|
|
||||||
AND mt.del_flag = '0'
|
|
||||||
<if test="id != null and id != ''">
|
<if test="id != null and id != ''">
|
||||||
and mws.parent_id = #{id}
|
mws.parent_id = #{id}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectId" resultType="com.bonus.sgzb.material.domain.TreeSelectId">
|
<select id="selectId" resultType="com.bonus.sgzb.material.domain.TreeSelectId">
|
||||||
|
|
@ -173,5 +163,28 @@
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectByWholeTypeName" resultType="java.lang.Integer">
|
||||||
|
select COUNT(*) from ma_whole_set
|
||||||
|
where whole_type_name = #{wholeTypeName}
|
||||||
|
</select>
|
||||||
|
<select id="selectListByWholeTypeName" resultType="com.bonus.sgzb.material.domain.LeaseApplyDetails">
|
||||||
|
SELECT
|
||||||
|
mt.unit_name unitName,
|
||||||
|
mt.type_id typeId,
|
||||||
|
mt.num,
|
||||||
|
mt.type_name typeModelName,
|
||||||
|
mt2.type_name typeName,
|
||||||
|
mws2.part_num partNum
|
||||||
|
FROM
|
||||||
|
ma_type mt
|
||||||
|
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||||
|
LEFT JOIN ma_whole_set mws2 ON mws2.type_id = mt.type_id
|
||||||
|
AND mws2.whole_type_name = #{wholeTypeName}
|
||||||
|
AND mws2.company_id = #{companyId}
|
||||||
|
WHERE
|
||||||
|
mt.type_id IN ( SELECT mws.type_id FROM ma_whole_set mws WHERE mws.whole_type_name = #{wholeTypeName})
|
||||||
|
AND mt.`status` = '0'
|
||||||
|
AND mt.del_flag = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -431,8 +431,8 @@
|
||||||
<select id="getDirectApplyInfoById" resultType="com.bonus.sgzb.base.api.domain.DirectApplyInfo">
|
<select id="getDirectApplyInfoById" resultType="com.bonus.sgzb.base.api.domain.DirectApplyInfo">
|
||||||
select * from direct_apply_info where id = #{id}
|
select * from direct_apply_info where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
<select id="getMachineStatus" resultType="java.lang.String">
|
<select id="getMachineStatus" resultType="com.bonus.sgzb.base.api.domain.DirectApplyInfo">
|
||||||
select ma_status
|
select ma_status as status
|
||||||
from ma_machine
|
from ma_machine
|
||||||
where ma_id = #{maId}
|
where ma_id = #{maId}
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue