fix:app扫码查询相关接口添加编码过滤条件

main
HuangHuiKang 2 weeks ago
parent c2ec3f0dbf
commit ec455718f1

@ -167,10 +167,10 @@ public class MoldBrandController {
@GetMapping("/mold/get")
@Operation(summary = "获得模具")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('erp:mold-brand:query')")
public CommonResult<MoldDO> getMold(@RequestParam("id") Long id) {
return success(moldBrandService.getMold(id));
public CommonResult<MoldDO> getMold(@RequestParam(value = "id", required = false) Long id,
@RequestParam(value = "code", required = false) String code) {
return success(moldBrandService.getMold(id, code));
}
@GetMapping("/mold/export-excel")
@ -241,4 +241,4 @@ public class MoldBrandController {
return success(moldBrandService.getMoldBrandProduct(id));
}
}
}

@ -104,10 +104,10 @@ public class ErpProductController {
@GetMapping("/get")
@Operation(summary = "获得产品")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:product:query')")
public CommonResult<ErpProductRespVO> getProduct(@RequestParam("id") Long id) {
return success(productService.getProduct(id));
public CommonResult<ErpProductRespVO> getProduct(@RequestParam(value = "id", required = false) Long id,
@RequestParam(value = "code", required = false) String code) {
return success(productService.getProduct(id, code));
}
@GetMapping("/page")

@ -120,6 +120,8 @@ public interface MoldBrandService {
* @return
*/
MoldDO getMold(Long id);
MoldDO getMold(Long id, String code);
List<MoldDO> selectBy(MoldDO reqVO);
// ==================== 子表(模具产品) ====================
@ -187,4 +189,4 @@ public interface MoldBrandService {
List<MoldBrandTreeRespVO> getMoldBrandTree();
void regenerateCode(Long id, String code) throws UnsupportedEncodingException;
}
}

@ -256,6 +256,7 @@ public class MoldBrandServiceImpl implements MoldBrandService {
@Override
public MoldDO getMold(Long id) {
validateMoldExists(id);
MoldDO moldDO = moldMapper.selectById(id);
Map<String,List<MoldRepairLineDO>> moldRepairDOMap=new HashMap<>();
@ -308,6 +309,24 @@ public class MoldBrandServiceImpl implements MoldBrandService {
moldDO.setQrcodeUrl(qrcodeUrl);
return moldDO;
}
@Override
public MoldDO getMold(Long id, String code) {
if (id != null) {
return getMold(id);
}
if (StrUtil.isNotBlank(code)) {
MoldDO moldDO = moldMapper.selectOne(new LambdaQueryWrapperX<MoldDO>()
.like(MoldDO::getCode, code)
.orderByDesc(MoldDO::getId)
.last("LIMIT 1"));
if (moldDO == null) {
throw exception(MOLD_NOT_EXISTS);
}
return getMold(moldDO.getId());
}
throw exception(MOLD_NOT_EXISTS);
}
@Override
public List<MoldDO> selectBy(MoldDO reqVO){
return moldMapper.selectBy(reqVO);
@ -445,4 +464,4 @@ public class MoldBrandServiceImpl implements MoldBrandService {
return respVO;
}
}
}

@ -64,6 +64,8 @@ public interface ErpProductService {
*/
ErpProductRespVO getProduct(Long id);
ErpProductRespVO getProduct(Long id, String code);
/**
* VO
*
@ -138,4 +140,4 @@ public interface ErpProductService {
ErpProductImportRespVO importProductList(List<ErpProductImportExcelVO> importProducts, boolean isUpdateSupport);
void regenerateCode(Long id, String code) throws UnsupportedEncodingException;
}
}

@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.common.enums.CodeTypeEnum;
@ -325,6 +326,24 @@ public class ErpProductServiceImpl implements ErpProductService {
return respVO;
}
@Override
public ErpProductRespVO getProduct(Long id, String code) {
if (id != null) {
return getProduct(id);
}
if (StringUtils.isNotBlank(code)) {
ErpProductDO product = productMapper.selectOne(new LambdaQueryWrapperX<ErpProductDO>()
.like(ErpProductDO::getBarCode, code)
.orderByDesc(ErpProductDO::getId)
.last("LIMIT 1"));
if (product == null) {
throw exception(PRODUCT_NOT_EXISTS);
}
return getProduct(product.getId());
}
throw exception(PRODUCT_NOT_EXISTS);
}

@ -77,10 +77,10 @@ public class CriticalComponentController {
@GetMapping("/get")
@Operation(summary = "获得设备关键件")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:critical-component:query')")
public CommonResult<CriticalComponentRespVO> getCriticalComponent(@RequestParam("id") Long id) {
CriticalComponentDO criticalComponent = criticalComponentService.getCriticalComponent(id);
public CommonResult<CriticalComponentRespVO> getCriticalComponent(@RequestParam(value = "id", required = false) Long id,
@RequestParam(value = "code", required = false) String code) {
CriticalComponentDO criticalComponent = criticalComponentService.getCriticalComponent(id, code);
return success(BeanUtils.toBean(criticalComponent, CriticalComponentRespVO.class));
}
@ -179,4 +179,4 @@ public class CriticalComponentController {
return success(true);
}
}
}

@ -100,10 +100,10 @@ public class DeviceLedgerController {
@GetMapping("/get")
@Operation(summary = "获得设备台账")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:device-ledger:query')")
public CommonResult<DeviceLedgerRespVO> getDeviceLedger(@RequestParam("id") Long id) {
DeviceLedgerDO deviceLedger = deviceLedgerService.getDeviceLedger(id);
public CommonResult<DeviceLedgerRespVO> getDeviceLedger(@RequestParam(value = "id", required = false) Long id,
@RequestParam(value = "code", required = false) String code) {
DeviceLedgerDO deviceLedger = deviceLedgerService.getDeviceLedger(id, code);
DeviceLedgerRespVO respVO = BeanUtils.toBean(deviceLedger, DeviceLedgerRespVO.class);
String qrcodeUrl = qrcodeService.selectQrcodeUrlByIdAndCode(QrcodeBizTypeEnum.EQUIPMENT.getCode(),id,respVO.getDeviceCode());
@ -279,4 +279,4 @@ public class DeviceLedgerController {
}
}

@ -174,12 +174,13 @@ public class DvRepairController {
@GetMapping("/getRepairListByDeviceId")
@Operation(summary = "根据设备Id获得维修历史记录")
@Parameter(name = "deviceId", description = "设备Id", required = true, example = "1024")
@Parameter(name = "deviceId", description = "设备Id", required = false, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:ticket-management:query')")
public CommonResult<List<DvRepairLineRespVO>> getRepairListByDeviceId(@RequestParam("deviceId") Long deviceId,
public CommonResult<List<DvRepairLineRespVO>> getRepairListByDeviceId(@RequestParam(value = "deviceId", required = false) Long deviceId,
@RequestParam(value = "code", required = false) String code,
@RequestParam(name = "startTime",required = false) String startTime,
@RequestParam(name = "endTime",required = false) String endTime) {
List<DvRepairLineRespVO> dvRepairDOList = dvRepairService.getRepairListByDeviceId(deviceId,startTime,endTime,null);
List<DvRepairLineRespVO> dvRepairDOList = dvRepairService.getRepairListByDeviceId(deviceId, code, startTime, endTime, null);
return success(dvRepairDOList);
}
@ -196,7 +197,7 @@ public class DvRepairController {
HttpServletResponse response) throws IOException {
// 查询数据
List<DvRepairLineRespVO> dvRepairDOList = dvRepairService.getRepairListByDeviceId(deviceId,startTime,endTime,ids);
List<DvRepairLineRespVO> dvRepairDOList = dvRepairService.getRepairListByDeviceId(deviceId, null, startTime, endTime, ids);
// 设置响应头
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
@ -227,4 +228,4 @@ public class DvRepairController {
return dvSubjectRespVOPageResult;
}
}
}

@ -167,12 +167,13 @@ public class MoldRepairController {
@GetMapping("/getRepairListByMoldId")
@Operation(summary = "根据模具Id获得维修历史记录")
@Parameter(name = "moldId", description = "模具Id", required = true, example = "1024")
@Parameter(name = "moldId", description = "模具Id", required = false, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:mold_ticket-management:query')")
public CommonResult<List<MoldRepairLineRespVO>> getRepairListByMoldId(@RequestParam("moldId") Long moldId,
public CommonResult<List<MoldRepairLineRespVO>> getRepairListByMoldId(@RequestParam(value = "moldId", required = false) Long moldId,
@RequestParam(value = "code", required = false) String code,
@RequestParam(name = "startTime",required = false) String startTime,
@RequestParam(name = "endTime",required = false) String endTime) {
List<MoldRepairLineRespVO> moldRepairDOList = moldRepairService.getRepairListByMoldId(moldId,startTime,endTime,null);
List<MoldRepairLineRespVO> moldRepairDOList = moldRepairService.getRepairListByMoldId(moldId, code, startTime, endTime, null);
return success(moldRepairDOList);
}
@ -189,7 +190,7 @@ public class MoldRepairController {
HttpServletResponse response) throws IOException {
// 查询数据
List<MoldRepairLineRespVO> moldRepairDOList = moldRepairService.getRepairListByMoldId(moldId,startTime,endTime,ids);
List<MoldRepairLineRespVO> moldRepairDOList = moldRepairService.getRepairListByMoldId(moldId, null, startTime, endTime, ids);
// 设置响应头
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
@ -221,4 +222,4 @@ public class MoldRepairController {
return moldSubjectRespVOPageResult;
}
}
}

@ -140,12 +140,13 @@ public class MoldTicketManagementController {
@GetMapping("/getInspectionByMoldId")
@Operation(summary = "根据模具Id获得点检历史记录")
@Parameter(name = "moldId", description = "模具Id", required = true, example = "1024")
@Parameter(name = "moldId", description = "模具Id", required = false, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-management:query')")
public CommonResult< List<MoldTicketResultsDO>> getInspectionByMoldId(@RequestParam("moldId") Long moldId,
public CommonResult< List<MoldTicketResultsDO>> getInspectionByMoldId(@RequestParam(value = "moldId", required = false) Long moldId,
@RequestParam(value = "code", required = false) String code,
@RequestParam(name = "startTime",required = false) String startTime,
@RequestParam(name = "endTime",required = false) String endTime) {
List<MoldTicketResultsDO> moldTicketResultsDOList = moldticketManagementService.getInspectionByMoldId(moldId,startTime,endTime,"");
List<MoldTicketResultsDO> moldTicketResultsDOList = moldticketManagementService.getInspectionByMoldId(moldId, code, startTime, endTime, "");
return success(moldTicketResultsDOList);
}
@ -160,7 +161,7 @@ public class MoldTicketManagementController {
HttpServletResponse response) throws IOException {
// 查询数据
List<MoldTicketResultsDO> results = moldticketManagementService.getInspectionByMoldId(moldId, startTime, endTime, ids);
List<MoldTicketResultsDO> results = moldticketManagementService.getInspectionByMoldId(moldId, null, startTime, endTime, ids);
// 转换为VO并处理数据
List<MoldTicketInspectionExportVO> exportVos = results.stream()
@ -179,12 +180,13 @@ public class MoldTicketManagementController {
@GetMapping("/getMaintenanceByMoldId")
@Operation(summary = "根据模具Id获得保养历史记录")
@Parameter(name = "moldId", description = "模具Id", required = true, example = "1024")
@Parameter(name = "moldId", description = "模具Id", required = false, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:mold_ticket-management:query')")
public CommonResult<List<MoldTicketResultsDO>> getMaintenanceByMoldId(@RequestParam("moldId") Long moldId,
public CommonResult<List<MoldTicketResultsDO>> getMaintenanceByMoldId(@RequestParam(value = "moldId", required = false) Long moldId,
@RequestParam(value = "code", required = false) String code,
@RequestParam(name = "startTime",required = false) String startTime,
@RequestParam(name = "endTime",required = false) String endTime) {
List<MoldTicketResultsDO> moldticketResultsDOList = moldticketManagementService.getMaintenanceByMoldId(moldId,startTime,endTime,"");
List<MoldTicketResultsDO> moldticketResultsDOList = moldticketManagementService.getMaintenanceByMoldId(moldId, code, startTime, endTime, "");
return success(moldticketResultsDOList);
}
@ -200,7 +202,7 @@ public class MoldTicketManagementController {
HttpServletResponse response) throws IOException {
// 查询数据
List<MoldTicketResultsDO> results = moldticketManagementService.getMaintenanceByMoldId(moldId, startTime, endTime, ids);
List<MoldTicketResultsDO> results = moldticketManagementService.getMaintenanceByMoldId(moldId, null, startTime, endTime, ids);
// 转换为VO并处理数据
List<MoldTicketInspectionExportVO> exportVos = results.stream()
@ -276,4 +278,4 @@ public class MoldTicketManagementController {
return vo;
}
}
}

@ -160,12 +160,13 @@ public class TicketManagementController {
@GetMapping("/getInspectionByDeviceId")
@Operation(summary = "根据设备Id获得点检历史记录")
@Parameter(name = "deviceId", description = "设备Id", required = true, example = "1024")
@Parameter(name = "deviceId", description = "设备Id", required = false, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:ticket-management:query')")
public CommonResult< List<TicketResultsDO>> getInspectionByDeviceId(@RequestParam("deviceId") Long deviceId,
public CommonResult< List<TicketResultsDO>> getInspectionByDeviceId(@RequestParam(value = "deviceId", required = false) Long deviceId,
@RequestParam(value = "code", required = false) String code,
@RequestParam(name = "startTime",required = false) String startTime,
@RequestParam(name = "endTime",required = false) String endTime) {
List<TicketResultsDO> ticketResultsDOList = ticketManagementService.getInspectionByDeviceId(deviceId,startTime,endTime,"");
List<TicketResultsDO> ticketResultsDOList = ticketManagementService.getInspectionByDeviceId(deviceId, code, startTime, endTime, "");
return success(ticketResultsDOList);
}
@ -180,7 +181,7 @@ public class TicketManagementController {
HttpServletResponse response) throws IOException {
// 查询数据
List<TicketResultsDO> results = ticketManagementService.getInspectionByDeviceId(deviceId, startTime, endTime, ids);
List<TicketResultsDO> results = ticketManagementService.getInspectionByDeviceId(deviceId, null, startTime, endTime, ids);
// 转换为VO并处理数据
List<TicketInspectionExportVO> exportVos = results.stream()
@ -202,12 +203,13 @@ public class TicketManagementController {
@GetMapping("/getMaintenanceByDeviceId")
@Operation(summary = "根据设备Id获得保养历史记录")
@Parameter(name = "deviceId", description = "设备Id", required = true, example = "1024")
@Parameter(name = "deviceId", description = "设备Id", required = false, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:ticket-management:query')")
public CommonResult<List<TicketResultsDO>> getMaintenanceByDeviceId(@RequestParam("deviceId") Long deviceId,
public CommonResult<List<TicketResultsDO>> getMaintenanceByDeviceId(@RequestParam(value = "deviceId", required = false) Long deviceId,
@RequestParam(value = "code", required = false) String code,
@RequestParam(name = "startTime",required = false) String startTime,
@RequestParam(name = "endTime",required = false) String endTime) {
List<TicketResultsDO> ticketResultsDOList = ticketManagementService.getMaintenanceByDeviceId(deviceId,startTime,endTime,"");
List<TicketResultsDO> ticketResultsDOList = ticketManagementService.getMaintenanceByDeviceId(deviceId, code, startTime, endTime, "");
return success(ticketResultsDOList);
}
@ -223,7 +225,7 @@ public class TicketManagementController {
HttpServletResponse response) throws IOException {
// 查询数据
List<TicketResultsDO> results = ticketManagementService.getMaintenanceByDeviceId(deviceId, startTime, endTime, ids);
List<TicketResultsDO> results = ticketManagementService.getMaintenanceByDeviceId(deviceId, null, startTime, endTime, ids);
// 转换为VO并处理数据
List<TicketInspectionExportVO> exportVos = results.stream()
@ -299,4 +301,4 @@ public class TicketManagementController {
return vo;
}
}
}

@ -45,6 +45,8 @@ public interface CriticalComponentService {
*/
CriticalComponentDO getCriticalComponent(Long id);
CriticalComponentDO getCriticalComponent(Long id, String code);
/**
*
*
@ -63,4 +65,4 @@ public interface CriticalComponentService {
CriticalComponentImportRespVO importCriticalComponentList(List<CriticalComponentImportExcelVO> importComponents, boolean isUpdateSupport);
void regenerateCode(Long id, String code) throws UnsupportedEncodingException;
}
}

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.mes.service.criticalcomponent;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.common.enums.CodeTypeEnum;
import cn.iocoder.yudao.module.common.enums.QrcodeBizTypeEnum;
import cn.iocoder.yudao.module.common.service.qrcordrecord.QrcodeRecordService;
@ -197,6 +198,7 @@ public class CriticalComponentServiceImpl implements CriticalComponentService {
@Override
public CriticalComponentDO getCriticalComponent(Long id) {
validateCriticalComponentExists(id);
CriticalComponentDO criticalComponentDO = criticalComponentMapper.selectById(id);
String qrcodeUrl = qrcodeService.selectQrcodeUrlByIdAndCode(QrcodeBizTypeEnum.KEY_PART.getCode(),id,criticalComponentDO.getCode());
criticalComponentDO.setQrcodeUrl(qrcodeUrl);
@ -204,6 +206,24 @@ public class CriticalComponentServiceImpl implements CriticalComponentService {
}
@Override
public CriticalComponentDO getCriticalComponent(Long id, String code) {
if (id != null) {
return getCriticalComponent(id);
}
if (StringUtils.isNotBlank(code)) {
CriticalComponentDO criticalComponentDO = criticalComponentMapper.selectOne(new LambdaQueryWrapperX<CriticalComponentDO>()
.like(CriticalComponentDO::getCode, code)
.orderByDesc(CriticalComponentDO::getId)
.last("LIMIT 1"));
if (criticalComponentDO == null) {
throw exception(CRITICAL_COMPONENT_NOT_EXISTS);
}
return getCriticalComponent(criticalComponentDO.getId());
}
throw exception(CRITICAL_COMPONENT_NOT_EXISTS);
}
@Override
public PageResult<CriticalComponentDO> getCriticalComponentPage(CriticalComponentPageReqVO pageReqVO) {
return criticalComponentMapper.selectPage(pageReqVO);
@ -338,4 +358,4 @@ public class CriticalComponentServiceImpl implements CriticalComponentService {
);
}
}
}

@ -47,6 +47,8 @@ public interface DeviceLedgerService {
*/
DeviceLedgerDO getDeviceLedger(Long id);
DeviceLedgerDO getDeviceLedger(Long id, String code);
/**
*
*
@ -86,4 +88,4 @@ public interface DeviceLedgerService {
List<DeviceLedgerDO> getDeviceLedgerListByIds(Collection<Long> ids);
}
}

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.mes.service.deviceledger;
import cn.hutool.core.collection.CollStreamUtil;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.common.enums.CodeTypeEnum;
import cn.iocoder.yudao.module.common.enums.QrcodeBizTypeEnum;
import cn.iocoder.yudao.module.common.service.qrcordrecord.QrcodeRecordService;
@ -207,6 +208,7 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
@Override
public DeviceLedgerDO getDeviceLedger(Long id) {
validateDeviceLedgerExists(id);
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(id);
@ -298,6 +300,24 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
return deviceLedgerDO;
}
@Override
public DeviceLedgerDO getDeviceLedger(Long id, String code) {
if (id != null) {
return getDeviceLedger(id);
}
if (StringUtils.isNotBlank(code)) {
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectOne(new LambdaQueryWrapperX<DeviceLedgerDO>()
.like(DeviceLedgerDO::getDeviceCode, code)
.orderByDesc(DeviceLedgerDO::getId)
.last("LIMIT 1"));
if (deviceLedgerDO == null) {
throw exception(DEVICE_LEDGER_NOT_EXISTS);
}
return getDeviceLedger(deviceLedgerDO.getId());
}
throw exception(DEVICE_LEDGER_NOT_EXISTS);
}
@Override
public PageResult<DeviceLedgerDO> getDeviceLedgerPage(DeviceLedgerPageReqVO pageReqVO) {
@ -438,4 +458,4 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
return Collections.emptyList();
}
return deviceLedgerMapper.selectBatchIds(ids); }
}
}

@ -71,7 +71,7 @@ public interface DvRepairService {
void updateDvRepairStatus(@Valid DvRepirUpdateReqVO updateReqVO);
List<DvRepairLineRespVO> getRepairListByDeviceId(Long deviceId, String startTime, String endTime,String ids);
List<DvRepairLineRespVO> getRepairListByDeviceId(Long deviceId, String code, String startTime, String endTime, String ids);
Long getRepairListCountByRepairStatus();
@ -82,4 +82,4 @@ public interface DvRepairService {
List<DvRepairDO> getList();
List<DvRepairDO> getLatestList();
}
}

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.mes.service.dvrepair;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.erp.controller.admin.autocode.util.AutoCodeUtil;
import cn.iocoder.yudao.module.mes.controller.admin.dashboard.vo.dashboard.EventStatisticsVO;
@ -8,8 +9,10 @@ import cn.iocoder.yudao.module.mes.controller.admin.dvrepair.enums.RepairResultE
import cn.iocoder.yudao.module.mes.controller.admin.dvrepair.enums.RepairStatusEnum;
import cn.iocoder.yudao.module.mes.controller.admin.dvrepair.vo.*;
import cn.iocoder.yudao.module.mes.controller.admin.ticketresults.enums.JobResultEnum;
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairLineDO;
import cn.iocoder.yudao.module.mes.dal.mysql.deviceledger.DeviceLedgerMapper;
import cn.iocoder.yudao.module.mes.dal.mysql.dvrepair.DvRepairLineMapper;
import cn.iocoder.yudao.module.mes.dal.mysql.dvrepair.DvRepairMapper;
import com.alibaba.excel.util.StringUtils;
@ -44,6 +47,8 @@ public class DvRepairServiceImpl implements DvRepairService {
@Resource
private DvRepairMapper dvRepairMapper;
@Resource
private DeviceLedgerMapper deviceLedgerMapper;
@Resource
private DvRepairLineMapper dvRepairLineMapper;
@Resource
@ -196,12 +201,13 @@ public class DvRepairServiceImpl implements DvRepairService {
}
@Override
public List<DvRepairLineRespVO> getRepairListByDeviceId(Long deviceId, String startTime, String endTime,String ids) {
public List<DvRepairLineRespVO> getRepairListByDeviceId(Long deviceId, String code, String startTime, String endTime, String ids) {
DeviceLedgerDO deviceLedgerDO = getDeviceByIdOrCode(deviceId, code);
List<DvRepairLineRespVO> dvRepairLineRespVOS = new ArrayList<>();
LambdaQueryWrapper<DvRepairDO> wrapper = Wrappers.<DvRepairDO>lambdaQuery()
.eq(DvRepairDO::getDeviceId, deviceId);
.eq(DvRepairDO::getDeviceId, deviceLedgerDO.getId());
@ -270,6 +276,22 @@ public class DvRepairServiceImpl implements DvRepairService {
return dvRepairLineRespVOS;
}
private DeviceLedgerDO getDeviceByIdOrCode(Long deviceId, String code) {
DeviceLedgerDO deviceLedgerDO = null;
if (deviceId != null) {
deviceLedgerDO = deviceLedgerMapper.selectById(deviceId);
} else if (StringUtils.isNotBlank(code)) {
deviceLedgerDO = deviceLedgerMapper.selectOne(new LambdaQueryWrapperX<DeviceLedgerDO>()
.like(DeviceLedgerDO::getDeviceCode, code)
.orderByDesc(DeviceLedgerDO::getId)
.last("LIMIT 1"));
}
if (deviceLedgerDO == null) {
throw exception(TICKET_MANAGEMENT_NOT_EXISTS);
}
return deviceLedgerDO;
}
@Override
public Long getRepairListCountByRepairStatus() {
return dvRepairMapper.selectCount(Wrappers.<DvRepairDO>lambdaQuery()
@ -419,4 +441,4 @@ public class DvRepairServiceImpl implements DvRepairService {
dvRepairLineMapper.deleteByRepairId(repairId);
}
}
}

@ -74,7 +74,7 @@ public interface MoldRepairService {
void updateMoldRepairStatus(@Valid MoldRepairUpdateReqVO updateReqVO);
List<MoldRepairLineRespVO> getRepairListByMoldId(Long moldId, String startTime, String endTime, String ids);
List<MoldRepairLineRespVO> getRepairListByMoldId(Long moldId, String code, String startTime, String endTime, String ids);
Long getRepairListCountByRepairStatus();

@ -1,7 +1,9 @@
package cn.iocoder.yudao.module.mes.service.moldrepair;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.erp.controller.admin.autocode.util.AutoCodeUtil;
import cn.iocoder.yudao.module.mes.controller.admin.dashboard.vo.dashboard.EventStatisticsVO;
import cn.iocoder.yudao.module.common.controller.admin.moldrepair.enums.RepairResultEnum;
@ -15,6 +17,7 @@ import cn.iocoder.yudao.module.common.dal.dataobject.moldrepair.MoldRepairDO;
import cn.iocoder.yudao.module.common.dal.dataobject.moldrepair.MoldRepairLineDO;
import cn.iocoder.yudao.module.common.dal.mysql.moldrepair.MoldRepairLineMapper;
import cn.iocoder.yudao.module.common.dal.mysql.moldrepair.MoldRepairMapper;
import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldMapper;
import com.alibaba.excel.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -32,6 +35,7 @@ import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.MOLD_NOT_EXISTS;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
import org.springframework.util.CollectionUtils;
@ -51,6 +55,8 @@ public class MoldRepairServiceImpl implements MoldRepairService {
@Resource
private MoldRepairMapper moldRepairMapper;
@Resource
private MoldMapper moldMapper;
@Resource
private MoldRepairLineMapper moldRepairLineMapper;
@Resource
@ -250,12 +256,13 @@ public class MoldRepairServiceImpl implements MoldRepairService {
}
@Override
public List<MoldRepairLineRespVO> getRepairListByMoldId(Long moldId, String startTime, String endTime, String ids) {
public List<MoldRepairLineRespVO> getRepairListByMoldId(Long moldId, String code, String startTime, String endTime, String ids) {
MoldDO moldDO = getMoldByIdOrCode(moldId, code);
List<MoldRepairLineRespVO> moldRepairLineRespVOS = new ArrayList<>();
LambdaQueryWrapper<MoldRepairDO> wrapper = Wrappers.<MoldRepairDO>lambdaQuery()
.eq(MoldRepairDO::getMoldId, moldId);
.eq(MoldRepairDO::getMoldId, moldDO.getId());
@ -324,6 +331,22 @@ public class MoldRepairServiceImpl implements MoldRepairService {
return moldRepairLineRespVOS;
}
private MoldDO getMoldByIdOrCode(Long moldId, String code) {
MoldDO moldDO = null;
if (moldId != null) {
moldDO = moldMapper.selectById(moldId);
} else if (StringUtils.isNotBlank(code)) {
moldDO = moldMapper.selectOne(new LambdaQueryWrapperX<MoldDO>()
.like(MoldDO::getCode, code)
.orderByDesc(MoldDO::getId)
.last("LIMIT 1"));
}
if (moldDO == null) {
throw exception(MOLD_NOT_EXISTS);
}
return moldDO;
}
private LocalDateTime parseToLocalDateTime(String timeStr) {
if (StringUtils.isBlank(timeStr)) {
@ -455,4 +478,4 @@ public class MoldRepairServiceImpl implements MoldRepairService {
.last("LIMIT 100")
);
}
}
}

@ -58,9 +58,9 @@ public interface MoldTicketManagementService {
void batchUpdateJobStatus(@Valid MoldTicketManagementBatchUpdateReqVO reqVO);
List<MoldTicketResultsDO> getInspectionByMoldId(Long id, String startTime, String endTime, String ids);
List<MoldTicketResultsDO> getInspectionByMoldId(Long id, String code, String startTime, String endTime, String ids);
List<MoldTicketResultsDO> getMaintenanceByMoldId(Long id, String startTime, String endTime, String ids);
List<MoldTicketResultsDO> getMaintenanceByMoldId(Long id, String code, String startTime, String endTime, String ids);
Long getBaoyangListCountByJobStatus();
@ -75,4 +75,4 @@ public interface MoldTicketManagementService {
List<MoldTicketManagementDO> getList();
List<MoldTicketManagementDO> getLatestList();
}
}

@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.common.dal.dataobject.moldticketresults.MoldTicke
import cn.iocoder.yudao.module.common.dal.mysql.moldticketresults.MoldTicketResultsMapper;
import cn.iocoder.yudao.module.mes.dal.mysql.deviceledger.DeviceLedgerMapper;
import com.alibaba.excel.util.StringUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -30,6 +31,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.common.dal.mysql.moldticketmanagement.MoldTicketManagementMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.MOLD_NOT_EXISTS;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
/**
@ -107,10 +109,10 @@ public class MoldTicketManagementServiceImpl implements MoldTicketManagementServ
@Override
public List<MoldTicketResultsDO> getInspectionByMoldId(Long id, String startTime, String endTime, String ids) {
MoldDO moldDO = moldMapper.selectById(id);
public List<MoldTicketResultsDO> getInspectionByMoldId(Long id, String code, String startTime, String endTime, String ids) {
MoldDO moldDO = getMoldByIdOrCode(id, code);
//点检列表
List<MoldTicketResultsDO> inspectionList = moldTicketResultsMapper.findByMoldIdAndPlanType(id, MoldPlanTypeEnum.INSPECTION.getCode(),startTime,endTime,ids);
List<MoldTicketResultsDO> inspectionList = moldTicketResultsMapper.findByMoldIdAndPlanType(moldDO.getId(), MoldPlanTypeEnum.INSPECTION.getCode(),startTime,endTime,ids);
if(CollectionUtils.isNotEmpty(inspectionList)){
moldDO.setInspectionList(inspectionList);
}
@ -119,11 +121,11 @@ public class MoldTicketManagementServiceImpl implements MoldTicketManagementServ
}
@Override
public List<MoldTicketResultsDO> getMaintenanceByMoldId(Long id,String startTime,String endTime,String ids) {
MoldDO moldDO = moldMapper.selectById(id);
public List<MoldTicketResultsDO> getMaintenanceByMoldId(Long id, String code, String startTime, String endTime, String ids) {
MoldDO moldDO = getMoldByIdOrCode(id, code);
//保养列表
List<MoldTicketResultsDO> inspectionList = moldTicketResultsMapper.findByMoldIdAndPlanType(id, MoldPlanTypeEnum.MAINTENANCE.getCode(),startTime,endTime,ids);
List<MoldTicketResultsDO> inspectionList = moldTicketResultsMapper.findByMoldIdAndPlanType(moldDO.getId(), MoldPlanTypeEnum.MAINTENANCE.getCode(),startTime,endTime,ids);
if(CollectionUtils.isNotEmpty(inspectionList)){
moldDO.setInspectionList(inspectionList);
}
@ -131,6 +133,22 @@ public class MoldTicketManagementServiceImpl implements MoldTicketManagementServ
return inspectionList;
}
private MoldDO getMoldByIdOrCode(Long id, String code) {
MoldDO moldDO = null;
if (id != null) {
moldDO = moldMapper.selectById(id);
} else if (StringUtils.isNotBlank(code)) {
moldDO = moldMapper.selectOne(new LambdaQueryWrapperX<MoldDO>()
.like(MoldDO::getCode, code)
.orderByDesc(MoldDO::getId)
.last("LIMIT 1"));
}
if (moldDO == null) {
throw exception(MOLD_NOT_EXISTS);
}
return moldDO;
}
/**
* ID
*/
@ -200,4 +218,4 @@ public class MoldTicketManagementServiceImpl implements MoldTicketManagementServ
);
}
}
}

@ -59,9 +59,9 @@ public interface TicketManagementService {
void batchUpdateJobStatus(@Valid TicketManagementBatchUpdateReqVO reqVO);
List<TicketResultsDO> getInspectionByDeviceId(Long id,String startTime,String endTime,String ids);
List<TicketResultsDO> getInspectionByDeviceId(Long id, String code, String startTime, String endTime, String ids);
List<TicketResultsDO> getMaintenanceByDeviceId(Long id,String startTime,String endTime,String ids);
List<TicketResultsDO> getMaintenanceByDeviceId(Long id, String code, String startTime, String endTime, String ids);
Long getBaoyangListCountByJobStatus();
@ -76,4 +76,4 @@ public interface TicketManagementService {
List<TicketManagementDO> getList();
List<TicketManagementDO> getLatestList();
}
}

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.mes.service.ticketmanagement;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.mes.controller.admin.dashboard.vo.dashboard.EventStatisticsVO;
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.enums.JobStatusEnum;
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.enums.PlanTypeEnum;
@ -108,10 +109,10 @@ public class TicketManagementServiceImpl implements TicketManagementService {
}
@Override
public List<TicketResultsDO> getInspectionByDeviceId(Long id,String startTime,String endTime,String ids) {
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(id);
public List<TicketResultsDO> getInspectionByDeviceId(Long id, String code, String startTime, String endTime, String ids) {
DeviceLedgerDO deviceLedgerDO = getDeviceByIdOrCode(id, code);
//点检列表
List<TicketResultsDO> inspectionList = ticketResultsMapper.findByDeviceIdAndPlanType(id, PlanTypeEnum.INSPECTION.getCode(),startTime,endTime,ids);
List<TicketResultsDO> inspectionList = ticketResultsMapper.findByDeviceIdAndPlanType(deviceLedgerDO.getId(), PlanTypeEnum.INSPECTION.getCode(),startTime,endTime,ids);
if(CollectionUtils.isNotEmpty(inspectionList)){
deviceLedgerDO.setInspectionList(inspectionList);
}
@ -120,11 +121,11 @@ public class TicketManagementServiceImpl implements TicketManagementService {
}
@Override
public List<TicketResultsDO> getMaintenanceByDeviceId(Long id,String startTime,String endTime,String ids) {
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(id);
public List<TicketResultsDO> getMaintenanceByDeviceId(Long id, String code, String startTime, String endTime, String ids) {
DeviceLedgerDO deviceLedgerDO = getDeviceByIdOrCode(id, code);
//保养列表
List<TicketResultsDO> inspectionList = ticketResultsMapper.findByDeviceIdAndPlanType(id, PlanTypeEnum.MAINTENANCE.getCode(),startTime,endTime,ids);
List<TicketResultsDO> inspectionList = ticketResultsMapper.findByDeviceIdAndPlanType(deviceLedgerDO.getId(), PlanTypeEnum.MAINTENANCE.getCode(),startTime,endTime,ids);
if(CollectionUtils.isNotEmpty(inspectionList)){
deviceLedgerDO.setInspectionList(inspectionList);
}
@ -132,6 +133,22 @@ public class TicketManagementServiceImpl implements TicketManagementService {
return inspectionList;
}
private DeviceLedgerDO getDeviceByIdOrCode(Long id, String code) {
DeviceLedgerDO deviceLedgerDO = null;
if (id != null) {
deviceLedgerDO = deviceLedgerMapper.selectById(id);
} else if (StringUtils.isNotBlank(code)) {
deviceLedgerDO = deviceLedgerMapper.selectOne(new LambdaQueryWrapperX<DeviceLedgerDO>()
.like(DeviceLedgerDO::getDeviceCode, code)
.orderByDesc(DeviceLedgerDO::getId)
.last("LIMIT 1"));
}
if (deviceLedgerDO == null) {
throw exception(DEVICE_LEDGER_NOT_EXISTS);
}
return deviceLedgerDO;
}
@Override
public Long getBaoyangListCountByJobStatus() {
return ticketManagementMapper.selectCount(Wrappers.<TicketManagementDO>lambdaQuery()
@ -204,4 +221,4 @@ public class TicketManagementServiceImpl implements TicketManagementService {
.collect(Collectors.toList());
}
}
}

Loading…
Cancel
Save