mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
机台授权接口-新需求更改
This commit is contained in:
-5
@@ -610,11 +610,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
// todo 修改排单数据筛选,目前只解决了非混单的情况,混单情况待解决
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectListByGoodsId(pageReqVO.getGoodsId(), getUserOrganId());
|
||||
|
||||
// List<Long> orderIds = new ArrayList<>();
|
||||
// if(pageReqVO.getGoodsId() != null) {
|
||||
// List<GoodsDO> goodsDOS = goodsMapper.selectListByGoodsId(pageReqVO.getGoodsId(), getUserOrganId());
|
||||
// orderIds = goodsDOS.stream().map(GoodsDO::getOrderId).toList();
|
||||
// }
|
||||
|
||||
QueryWrapperX<OrderDO> queryWrapperX = new QueryWrapperX<>();
|
||||
queryWrapperX
|
||||
|
||||
+19
-18
@@ -3,7 +3,6 @@ package com.cf.imes.module.system.controller.admin.machine;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.machine.MachineDO;
|
||||
import com.cf.imes.module.system.service.machine.MachineService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -13,7 +12,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@@ -28,8 +27,8 @@ public class MachineAuthController {
|
||||
@Resource
|
||||
private MachineService machineService;
|
||||
|
||||
@PutMapping("insert-organ-auth")
|
||||
@Operation(summary = "组织机台授权新增")
|
||||
@PostMapping("insert-organ-auth")
|
||||
@Operation(summary = "组织机台授权信息更新")
|
||||
@PreAuthorize("@ss.hasPermission('machine-auth::update')")
|
||||
public CommonResult<Boolean> auth(@RequestBody MachineOrgAuthReq vo) {
|
||||
return success(machineService.auth(vo));
|
||||
@@ -43,27 +42,29 @@ public class MachineAuthController {
|
||||
}
|
||||
|
||||
@GetMapping("organ-by-organId")
|
||||
@Operation(summary = "根据组织id查询组织机台授权")
|
||||
@Operation(summary = "根据组织ID查询已经授权的机台ID")
|
||||
@PreAuthorize("@ss.hasPermission('machine-auth::query')")
|
||||
@Parameter(name = "organId", description = "组织id", required = true, example = "1")
|
||||
public CommonResult<OrganMachineResp> organTemplateByOrganId(@RequestParam Long organId ) {
|
||||
public CommonResult<List<Integer>> organTemplateByOrganId(@RequestParam Long organId ) {
|
||||
return success(machineService.organMachineByOrganId(organId));
|
||||
}
|
||||
|
||||
@GetMapping("page-machine-auth")
|
||||
@Operation(summary = "授权机台分页")
|
||||
@GetMapping("select-machine-auth")
|
||||
@Operation(summary = "查询机台授权列表")
|
||||
@PreAuthorize("@ss.hasPermission('machine-auth::query')")
|
||||
public CommonResult<PageResult<MachineAuthResp>> pageTemplateAuth(MachinePageReqVO pageParam) {
|
||||
PageResult<MachineDO> page = machineService.page(pageParam);
|
||||
List<MachineAuthResp> list = page.getList().stream().map(e->MachineAuthResp.builder()
|
||||
.id(e.getId())
|
||||
.machineType(e.getMachineType())
|
||||
.machineName(e.getName())
|
||||
.organId(e.getOrganId())
|
||||
.build()
|
||||
).collect(Collectors.toList());
|
||||
public CommonResult<Map<Integer, List<MachineBrandModelRespVO>>> getTemplateAuth(MachinePageReqVO pageParam) {
|
||||
|
||||
return success(new PageResult<MachineAuthResp>(list, page.getTotal()));
|
||||
return success(machineService.getTemplateAuth(pageParam));
|
||||
|
||||
// List<MachineAuthResp> list = page.getList().stream().map(e->MachineAuthResp.builder()
|
||||
// .id(e.getId())
|
||||
// .machineType(e.getMachineType())
|
||||
// .machineName(e.getName())
|
||||
// .organId(e.getOrganId())
|
||||
// .build()
|
||||
// ).collect(Collectors.toList());
|
||||
//
|
||||
// return success(new PageResult<MachineAuthResp>(list, page.getTotal()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-1
@@ -31,7 +31,6 @@ public class CuttingTemplateSaveReqVO {
|
||||
|
||||
|
||||
@Schema(description = "引用的品牌ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
// @NotNull(message = "品牌ID")
|
||||
private Long brandId;
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -19,8 +19,8 @@ public class MachineBrandModelRespVO {
|
||||
private String brand;
|
||||
|
||||
|
||||
// @Schema(description = "机台的型号-即机台的名称")
|
||||
// private List<String> name;
|
||||
@Schema(description = "机台类别")
|
||||
private Integer machineType;
|
||||
|
||||
@Schema(description = "机台的型号-即机台的名称")
|
||||
private List<MachineSimpleRespVO> machineSimpleRespVOS;
|
||||
|
||||
+25
-3
@@ -12,10 +12,32 @@ import java.util.List;
|
||||
@Data
|
||||
public class MachineOrgAuthReq {
|
||||
|
||||
@Schema(description = "组织id")
|
||||
@Schema(description = "组织id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long organId;
|
||||
@Schema(description = "权限列表")
|
||||
private List<MachineAuth> machineAuthList;
|
||||
|
||||
|
||||
@Schema(description = "开料机授权数量")
|
||||
private Integer cutLimit;
|
||||
|
||||
|
||||
@Schema(description = "钻孔机授权数量")
|
||||
private Integer drillLimit;
|
||||
|
||||
|
||||
@Schema(description = "贴标机授权数量")
|
||||
private Integer labelLimit;
|
||||
|
||||
|
||||
@Schema(description = "裁板锯授权数量")
|
||||
private Integer sawLimit;
|
||||
|
||||
|
||||
@Schema(description = "封边机授权数量")
|
||||
private Integer sealedgeLimit;
|
||||
|
||||
|
||||
@Schema(description = "授权的机台ID")
|
||||
private List<Integer> machineAuthIds;
|
||||
|
||||
|
||||
}
|
||||
|
||||
+4
-2
@@ -9,8 +9,10 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class OrganMachinePage extends PageParam {
|
||||
@Schema(description = "组织id")
|
||||
private Long organId;
|
||||
|
||||
@Schema(description = "组织名称")
|
||||
private String organName;
|
||||
|
||||
@Schema(description = "机台名称")
|
||||
private String machineName;
|
||||
}
|
||||
|
||||
+23
-12
@@ -1,18 +1,11 @@
|
||||
package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
*/
|
||||
@@ -21,13 +14,31 @@ import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrganMachineResp {
|
||||
|
||||
@Schema(description = "组织id")
|
||||
private Long organId;
|
||||
|
||||
@Schema(description = "组织名称")
|
||||
private String organName;
|
||||
@Schema(description = "更新时间")
|
||||
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
||||
private Date updateTime;
|
||||
@Schema(description = "机台模板列表")
|
||||
private List<OrganMachineVO> authMachineList;
|
||||
|
||||
|
||||
@Schema(description = "开料机授权数量")
|
||||
private Integer cutLimit;
|
||||
|
||||
|
||||
@Schema(description = "钻孔机授权数量")
|
||||
private Integer drillLimit;
|
||||
|
||||
|
||||
@Schema(description = "贴标机授权数量")
|
||||
private Integer labelLimit;
|
||||
|
||||
|
||||
@Schema(description = "裁板锯授权数量")
|
||||
private Integer sawLimit;
|
||||
|
||||
|
||||
@Schema(description = "封边机授权数量")
|
||||
private Integer sealedgeLimit;
|
||||
|
||||
}
|
||||
|
||||
+4
-14
@@ -1,6 +1,5 @@
|
||||
package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -9,19 +8,10 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class OrganMachineVO {
|
||||
@Schema(description = "机台id")
|
||||
private Long machineId;
|
||||
@Schema(description = "机台名称")
|
||||
private String machineName;
|
||||
@Schema(description = "机台类型")
|
||||
private Integer machineType;
|
||||
@Schema(description ="加工模式 开料机加工模式 默认true,显示开料机工作模式(是否排钻/造型,sc)配置")
|
||||
private Boolean showPriorFacing;
|
||||
@Schema(description = "双工位")
|
||||
private Boolean showDualWorkstation;
|
||||
@Schema(description = "自动贴标")
|
||||
private Boolean showAutoNotePrinter;
|
||||
|
||||
@JsonIgnore
|
||||
|
||||
@Schema(description = "组织ID")
|
||||
private Long organId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
+32
-12
@@ -2,13 +2,12 @@ package com.cf.imes.module.system.dal.dataobject.machine;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
*/
|
||||
@@ -17,22 +16,43 @@ import java.time.LocalDateTime;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class MachineLimitDO {
|
||||
public class MachineLimitDO extends BaseDO {
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
private Long organId;
|
||||
private Long machineId;
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
/**
|
||||
* 加工模式 开料机加工模式 默认true,显示开料机工作模式(是否排钻/造型,sc)配置
|
||||
* 开料机授权数量
|
||||
*/
|
||||
private Boolean showPriorFacing;
|
||||
private Integer cutLimit;
|
||||
|
||||
|
||||
/**
|
||||
* 双工位
|
||||
* 钻孔机授权数量
|
||||
*/
|
||||
private Boolean showDualWorkstation;
|
||||
private Integer drillLimit;
|
||||
|
||||
/**
|
||||
* 自动贴标
|
||||
* 贴标机授权数量
|
||||
*/
|
||||
private Boolean showAutoNotePrinter;
|
||||
private Integer labelLimit;
|
||||
|
||||
/**
|
||||
* 裁板锯授权数量
|
||||
*/
|
||||
private Integer sawLimit;
|
||||
|
||||
|
||||
/**
|
||||
* 封边机授权数量
|
||||
*/
|
||||
private Integer sealedgeLimit;
|
||||
|
||||
|
||||
/**
|
||||
* 机台授权列表
|
||||
*/
|
||||
private String setting;
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -32,4 +32,6 @@ public interface MachineBrandMapper extends BaseMapperX<MachineBrandDO> {
|
||||
|
||||
List<MachineBrandModelRespVO> selectMachineList(@Param("type") Integer type);
|
||||
|
||||
List<MachineBrandModelRespVO> selectMachineNoDefault();
|
||||
|
||||
}
|
||||
|
||||
+8
@@ -1,12 +1,20 @@
|
||||
package com.cf.imes.module.system.dal.mysql.machine;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.OrganMachinePage;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.OrganMachineResp;
|
||||
import com.cf.imes.module.system.dal.dataobject.machine.MachineLimitDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
*/
|
||||
@Mapper
|
||||
public interface MachineLimitMapper extends BaseMapperX<MachineLimitDO> {
|
||||
|
||||
|
||||
IPage<OrganMachineResp> selectOrganMachinePage(@Param("page") IPage page,@Param("machinePage") OrganMachinePage machinePage);
|
||||
|
||||
}
|
||||
|
||||
+1
@@ -70,4 +70,5 @@ public interface MachineTemplateMapper extends BaseMapperX<MachineTemplateDO> {
|
||||
.eq(MachineTemplateDO::getMachineType,machineType)
|
||||
.eq(MachineTemplateDO::getName,name));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+7
@@ -114,4 +114,11 @@ public interface OrganMapper extends BaseMapperX<OrganizationDO> {
|
||||
.eq(OrganizationDO::getDeleted,false)
|
||||
.lt(OrganizationDO::getExpireTime,alertDay));
|
||||
}
|
||||
default List<OrganizationDO> selectOrganListByName(String organName) {
|
||||
return selectList(new LambdaQueryWrapperX<OrganizationDO>()
|
||||
.eqIfPresent(OrganizationDO::getDeleted,false)
|
||||
.likeIfPresent(OrganizationDO::getName,organName)
|
||||
.select(OrganizationDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
-4
@@ -1,12 +1,13 @@
|
||||
package com.cf.imes.module.system.service.machine;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.*;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.machine.MachineDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 机台 Service 接口
|
||||
@@ -72,11 +73,15 @@ public interface MachineService {
|
||||
|
||||
PageResult<OrganMachineResp> organMachinePage(OrganMachinePage page);
|
||||
|
||||
OrganMachineResp organMachineByOrganId(Long organId);
|
||||
List<Integer> organMachineByOrganId(Long organId);
|
||||
|
||||
PageResult<MachineDO> page(MachinePageReqVO pageParam);
|
||||
|
||||
List<MachineSimpleRespVO> simpleList(Long organId,Long type);
|
||||
|
||||
List<MachineBrandModelRespVO> getBrandAndModel(Integer type);
|
||||
|
||||
Map<Integer, List<MachineBrandModelRespVO>> getTemplateAuth(MachinePageReqVO pageParam);
|
||||
|
||||
|
||||
}
|
||||
+100
-45
@@ -7,7 +7,9 @@ import co.elastic.clients.elasticsearch._types.query_dsl.TermQuery;
|
||||
import co.elastic.clients.elasticsearch.core.SearchRequest;
|
||||
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.enums.MachineTypeEnum;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
@@ -316,42 +318,73 @@ public class MachineServiceImpl implements MachineService {
|
||||
|
||||
@Override
|
||||
public Boolean auth(MachineOrgAuthReq vo) {
|
||||
machineLimitMapper.delete(new LambdaQueryWrapperX<MachineLimitDO>().eq(MachineLimitDO::getOrganId, vo.getOrganId()));
|
||||
|
||||
List<MachineAuth> machineAuthList = vo.getMachineAuthList();
|
||||
|
||||
if(CollectionUtil.isNotEmpty(machineAuthList)) {
|
||||
List<MachineLimitDO> organMachineDOS = new ArrayList<>();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
for (MachineAuth machineAuth : machineAuthList) {
|
||||
organMachineDOS.add(
|
||||
MachineLimitDO.builder()
|
||||
.createTime(now)
|
||||
.organId(vo.getOrganId())
|
||||
.machineId(machineAuth.getMachineId())
|
||||
.showDualWorkstation(machineAuth.getShowDualWorkstation())
|
||||
.showAutoNotePrinter(machineAuth.getShowAutoNotePrinter())
|
||||
.showPriorFacing(machineAuth.getShowPriorFacing())
|
||||
.build()
|
||||
);
|
||||
|
||||
}
|
||||
machineLimitMapper.insertBatch(organMachineDOS);
|
||||
OrganizationDO tenant = organMapper.selectById(vo.getOrganId());
|
||||
if (tenant == null) {
|
||||
throw exception(ORGAN_NOT_EXISTS);
|
||||
}
|
||||
// machineLimitMapper.delete(new LambdaQueryWrapperX<MachineLimitDO>().eq(MachineLimitDO::getOrganId, vo.getOrganId()));
|
||||
|
||||
// List<MachineAuth> machineAuthList = vo.getMachineAuthList();
|
||||
|
||||
// if(CollectionUtil.isNotEmpty(machineAuthList)) {
|
||||
// List<MachineLimitDO> organMachineDOS = new ArrayList<>();
|
||||
// LocalDateTime now = LocalDateTime.now();
|
||||
// for (MachineAuth machineAuth : machineAuthList) {
|
||||
// organMachineDOS.add(
|
||||
// MachineLimitDO.builder()
|
||||
// .createTime(now)
|
||||
// .organId(vo.getOrganId())
|
||||
//// .machineId(machineAuth.getMachineId())
|
||||
//// .showDualWorkstation(machineAuth.getShowDualWorkstation())
|
||||
//// .showAutoNotePrinter(machineAuth.getShowAutoNotePrinter())
|
||||
//// .showPriorFacing(machineAuth.getShowPriorFacing())
|
||||
// .build()
|
||||
// );
|
||||
//
|
||||
// }
|
||||
// machineLimitMapper.insertBatch(organMachineDOS);
|
||||
// }
|
||||
|
||||
MachineLimitDO machineLimitDO = MachineLimitDO.builder()
|
||||
.organId(vo.getOrganId())
|
||||
.cutLimit(vo.getCutLimit())
|
||||
.drillLimit(vo.getDrillLimit())
|
||||
.labelLimit(vo.getLabelLimit())
|
||||
.sawLimit(vo.getSawLimit())
|
||||
.sealedgeLimit(vo.getSealedgeLimit())
|
||||
.setting(vo.getMachineAuthIds().toString())
|
||||
.build();
|
||||
|
||||
|
||||
|
||||
machineLimitMapper.updateById(machineLimitDO);
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OrganMachineResp> organMachinePage(OrganMachinePage page) {
|
||||
Page<OrganMachineResp> respPage = new Page<>(page.getPageNo(), page.getPageSize());
|
||||
Page<OrganMachineResp> pageRes = machineMapper.selectOrganMachinePage(respPage, page);
|
||||
return new PageResult<>(pageRes.getRecords(), pageRes.getTotal());
|
||||
public PageResult<OrganMachineResp> organMachinePage(OrganMachinePage machinePage) {
|
||||
|
||||
PageDTO<OrganMachineResp> page = new PageDTO<>(machinePage.getPageNo(), machinePage.getPageSize());
|
||||
|
||||
|
||||
IPage<OrganMachineResp> packRespVOS = machineLimitMapper.selectOrganMachinePage(page, machinePage);
|
||||
|
||||
|
||||
return new PageResult<>(packRespVOS.getRecords(), packRespVOS.getTotal());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrganMachineResp organMachineByOrganId(Long organId) {
|
||||
return machineMapper.selectOrganMachine(organId);
|
||||
public List<Integer> organMachineByOrganId(Long organId) {
|
||||
|
||||
String setting = machineLimitMapper.selectById(organId).getSetting();
|
||||
|
||||
return JSON.parseArray(setting).toJavaList(Integer.class);
|
||||
|
||||
// return machineMapper.selectOrganMachine(organId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -385,29 +418,24 @@ public class MachineServiceImpl implements MachineService {
|
||||
@Override
|
||||
public List<MachineBrandModelRespVO> getBrandAndModel(Integer type) {
|
||||
|
||||
// List<MachineBrandDO> machineBrandDOS = machineBrandMapper.selectListByType(type);
|
||||
|
||||
return machineBrandMapper.selectMachineList(type);
|
||||
|
||||
// List<MachineBrandModelRespVO> machineBrandModelRespVOS = BeanUtils.toBean(machineBrandDOS, MachineBrandModelRespVO.class);
|
||||
//
|
||||
//
|
||||
// List<MachineTemplateDO> machineDOS = machineTemplateMapper.selectList(new LambdaQueryWrapperX<MachineTemplateDO>()
|
||||
// .eq(MachineTemplateDO::getDeleted,false)
|
||||
// .eqIfPresent(MachineTemplateDO::getMachineType, type));
|
||||
//
|
||||
// machineBrandModelRespVOS.forEach(v->
|
||||
// v.setName(machineDOS.stream().filter(f->f.getBrandId().equals(v.getId())).map(MachineTemplateDO::getName).toList())
|
||||
// );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// List<MachineBrandModelRespVO> machineVOS = BeanUtils.toBean(machineDOS, MachineBrandModelRespVO.class);
|
||||
//
|
||||
//
|
||||
// Map<String, List<MachineBrandModelRespVO>> map = machineVOS.stream().collect(Collectors.groupingBy(MachineBrandModelRespVO::getBrand));
|
||||
|
||||
@Override
|
||||
public Map<Integer, List<MachineBrandModelRespVO>> getTemplateAuth(MachinePageReqVO pageParam) {
|
||||
|
||||
|
||||
List<MachineBrandModelRespVO> machineBrandModelRespVOS = machineBrandMapper.selectMachineNoDefault();
|
||||
|
||||
return machineBrandModelRespVOS.stream().collect(Collectors.groupingBy(MachineBrandModelRespVO::getMachineType));
|
||||
|
||||
|
||||
|
||||
// return machineBrandModelRespVOS;
|
||||
}
|
||||
|
||||
|
||||
@@ -425,11 +453,38 @@ public class MachineServiceImpl implements MachineService {
|
||||
}
|
||||
}
|
||||
|
||||
private Boolean validateBrandAndModel(String brand, String model){
|
||||
// 校验当前组织当前类型的机台是否达到最大创建数量
|
||||
private void validateMachineNum(Integer machineType, Long organId){
|
||||
|
||||
Integer machineNum = machineMapper.selectByOrganId(machineType,organId).size()+1;
|
||||
|
||||
MachineLimitDO machineLimitDO = machineLimitMapper.selectById(organId);
|
||||
|
||||
Integer authMachineNum = 0;
|
||||
switch (machineType){
|
||||
|
||||
case 1 :
|
||||
authMachineNum = machineLimitDO.getCutLimit();
|
||||
break;
|
||||
case 2 :
|
||||
authMachineNum = machineLimitDO.getDrillLimit();
|
||||
break;
|
||||
case 3 :
|
||||
authMachineNum = machineLimitDO.getSawLimit();
|
||||
break;
|
||||
case 4 :
|
||||
authMachineNum = machineLimitDO.getLabelLimit();
|
||||
break;
|
||||
case 5 :
|
||||
authMachineNum = machineLimitDO.getSealedgeLimit();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(machineNum >= authMachineNum){
|
||||
throw exception(MACHINE_NUM_ERROR);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+37
-37
@@ -384,23 +384,23 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
@Override
|
||||
public Boolean updateTemplateAuth(MachineOrgAuthReq vo) {
|
||||
|
||||
List<MachineAuth> machineAuthList = vo.getMachineAuthList();
|
||||
|
||||
if(!machineAuthList.isEmpty()) {
|
||||
List<MachineTemplateLimitDO> machineTemplateLimitDOS = new ArrayList<>();
|
||||
|
||||
for (MachineAuth machineAuth : machineAuthList) {
|
||||
|
||||
machineTemplateLimitDOS.add(MachineTemplateLimitDO.builder()
|
||||
.id(machineAuth.getMachineId())
|
||||
.showAutoNotePrinter(machineAuth.getShowAutoNotePrinter())
|
||||
.showDualWorkstation(machineAuth.getShowDualWorkstation())
|
||||
.showPriorFacing(machineAuth.getShowPriorFacing())
|
||||
.build());
|
||||
}
|
||||
|
||||
machineTemplateLimitMapper.updateBatch(machineTemplateLimitDOS);
|
||||
}
|
||||
// List<MachineAuth> machineAuthList = vo.getMachineAuthList();
|
||||
//
|
||||
// if(!machineAuthList.isEmpty()) {
|
||||
// List<MachineTemplateLimitDO> machineTemplateLimitDOS = new ArrayList<>();
|
||||
//
|
||||
// for (MachineAuth machineAuth : machineAuthList) {
|
||||
//
|
||||
// machineTemplateLimitDOS.add(MachineTemplateLimitDO.builder()
|
||||
// .id(machineAuth.getMachineId())
|
||||
// .showAutoNotePrinter(machineAuth.getShowAutoNotePrinter())
|
||||
// .showDualWorkstation(machineAuth.getShowDualWorkstation())
|
||||
// .showPriorFacing(machineAuth.getShowPriorFacing())
|
||||
// .build());
|
||||
// }
|
||||
//
|
||||
// machineTemplateLimitMapper.updateBatch(machineTemplateLimitDOS);
|
||||
// }
|
||||
|
||||
return true;
|
||||
|
||||
@@ -443,26 +443,26 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
// 去掉授权删除
|
||||
// machineTemplateLimitMapper.delete(new LambdaQueryWrapperX<MachineTemplateLimitDO>().eq(MachineTemplateLimitDO::getOrganId, vo.getOrganId()));
|
||||
|
||||
List<MachineAuth> machineAuthList = vo.getMachineAuthList();
|
||||
|
||||
if(CollectionUtil.isNotEmpty(machineAuthList)) {
|
||||
List<MachineTemplateLimitDO> organMachineDOS = new ArrayList<>();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
for (MachineAuth machineAuth : machineAuthList) {
|
||||
organMachineDOS.add(
|
||||
MachineTemplateLimitDO.builder()
|
||||
.createTime(now)
|
||||
.organId(vo.getOrganId())
|
||||
.machineId(machineAuth.getMachineId())
|
||||
.showDualWorkstation(machineAuth.getShowDualWorkstation())
|
||||
.showAutoNotePrinter(machineAuth.getShowAutoNotePrinter())
|
||||
.showPriorFacing(machineAuth.getShowPriorFacing())
|
||||
.build()
|
||||
);
|
||||
|
||||
}
|
||||
machineTemplateLimitMapper.insertBatch(organMachineDOS);
|
||||
}
|
||||
// List<MachineAuth> machineAuthList = vo.getMachineAuthList();
|
||||
//
|
||||
// if(CollectionUtil.isNotEmpty(machineAuthList)) {
|
||||
// List<MachineTemplateLimitDO> organMachineDOS = new ArrayList<>();
|
||||
// LocalDateTime now = LocalDateTime.now();
|
||||
// for (MachineAuth machineAuth : machineAuthList) {
|
||||
// organMachineDOS.add(
|
||||
// MachineTemplateLimitDO.builder()
|
||||
// .createTime(now)
|
||||
// .organId(vo.getOrganId())
|
||||
// .machineId(machineAuth.getMachineId())
|
||||
// .showDualWorkstation(machineAuth.getShowDualWorkstation())
|
||||
// .showAutoNotePrinter(machineAuth.getShowAutoNotePrinter())
|
||||
// .showPriorFacing(machineAuth.getShowPriorFacing())
|
||||
// .build()
|
||||
// );
|
||||
//
|
||||
// }
|
||||
// machineTemplateLimitMapper.insertBatch(organMachineDOS);
|
||||
// }
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
+14
@@ -25,10 +25,12 @@ import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
||||
import com.cf.imes.module.system.convert.organ.OrganConvert;
|
||||
import com.cf.imes.module.system.dal.dataobject.machine.MachineLimitDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.permission.MenuDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.permission.RoleDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.organ.OrganizationDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.organ.TenantPackageDO;
|
||||
import com.cf.imes.module.system.dal.mysql.machine.MachineLimitMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.organ.OrganMapper;
|
||||
import com.cf.imes.module.system.enums.permission.RoleCodeEnum;
|
||||
import com.cf.imes.module.system.enums.permission.RoleTypeEnum;
|
||||
@@ -86,6 +88,10 @@ public class OrganServiceImpl implements OrganService {
|
||||
@Value("${chenfeng.organ.use-data-code:imes_prod}")
|
||||
private String useDataCode;
|
||||
|
||||
@Resource
|
||||
private MachineLimitMapper machineLimitMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<Long> getOrganIdList() {
|
||||
List<OrganizationDO> organizationDOS = organMapper.selectList();
|
||||
@@ -152,6 +158,14 @@ public class OrganServiceImpl implements OrganService {
|
||||
// 修改组织的管理员
|
||||
organMapper.updateById(new OrganizationDO().setId(tenant.getId()).setContactUserId(userId));
|
||||
});
|
||||
|
||||
|
||||
// 往组织机台授权表新增信息
|
||||
MachineLimitDO machineLimitDO = MachineLimitDO.builder()
|
||||
.organId(tenant.getId())
|
||||
.build();
|
||||
machineLimitMapper.insert(machineLimitDO);
|
||||
|
||||
return tenant.getId();
|
||||
}
|
||||
|
||||
|
||||
+14
@@ -7,6 +7,7 @@
|
||||
|
||||
<result property="brandId" column="brandId"/>
|
||||
<result property="brand" column="brand"/>
|
||||
<result property="machineType" column="machineType"/>
|
||||
|
||||
<collection property="machineSimpleRespVOS" ofType="com.cf.imes.module.system.controller.admin.machine.vo.MachineSimpleRespVO" resultMap="MachineSimpleMap"/>
|
||||
|
||||
@@ -34,6 +35,19 @@
|
||||
|
||||
where smt.deleted = false and smb.machine_type = #{type}
|
||||
|
||||
<select id="selectMachineNoDefault" resultMap="MachineMap">
|
||||
|
||||
|
||||
select smb.id as brandId,
|
||||
smb.machine_type as machineType,
|
||||
smb.brand,
|
||||
smt.id,
|
||||
smt.name
|
||||
|
||||
from system_machine_brand smb
|
||||
left join system_machine_template smt on smb.id = smt.brand_id
|
||||
|
||||
where smt.deleted = false and smt.is_enabled = true and smt.is_default = false
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.cf.imes.module.system.dal.mysql.machine.MachineLimitMapper">
|
||||
|
||||
|
||||
<select id="selectOrganMachinePage" resultType="com.cf.imes.module.system.controller.admin.machine.vo.OrganMachineResp" parameterType="map">
|
||||
|
||||
|
||||
|
||||
select sml.*
|
||||
from system_machine_limit sml
|
||||
|
||||
left join system_organization so on sml.organ_id = so.id
|
||||
left join system_machine_template smt on sml.setting like concat(smt.id, '%')
|
||||
<where>
|
||||
sml.deleted = false
|
||||
and smt.deleted = false
|
||||
and smt.is_enabled = true
|
||||
and smt.is_default = false
|
||||
and so.status = 0
|
||||
|
||||
<if test="machinePage.organName !=null">
|
||||
and so.name like concat('%', #{machinePage.organName},'%')
|
||||
</if>
|
||||
|
||||
<if test="machinePage.machineName !=null">
|
||||
and smt.name like concat('%', #{machinePage.machineName},'%')
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user