From b533116ebee1e22743cdff01264a261f7ede5c58 Mon Sep 17 00:00:00 2001 From: philip <244793088@qq.com> Date: Tue, 7 Sep 2021 23:53:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=BD=A6=E9=97=B4=E8=BD=AC=E5=85=A5?= =?UTF-8?q?=E8=BD=AC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WorkShopTransferController.java | 33 ++++++++++++++++--- .../mapper/WorkShopTransferMapper.java | 4 +++ .../impl/WorkShopTransferServiceImpl.java | 7 ++-- .../mapper/WorkShopTransferMapper.xml | 30 ++++++++++++----- 4 files changed, 57 insertions(+), 17 deletions(-) diff --git a/production/src/main/java/com/foreverwin/mesnac/production/controller/WorkShopTransferController.java b/production/src/main/java/com/foreverwin/mesnac/production/controller/WorkShopTransferController.java index 2a60573c..6a0da3bd 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/controller/WorkShopTransferController.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/controller/WorkShopTransferController.java @@ -3,6 +3,7 @@ package com.foreverwin.mesnac.production.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.foreverwin.mesnac.production.dto.WorkShopTransferDto; +import com.foreverwin.mesnac.production.mapper.WorkShopTransferMapper; import com.foreverwin.mesnac.production.model.WorkShopTransfer; import com.foreverwin.mesnac.production.service.WorkShopTransferService; import com.foreverwin.modular.core.util.CommonMethods; @@ -24,7 +25,8 @@ public class WorkShopTransferController { @Autowired public WorkShopTransferService workShopTransferService; - + @Autowired + public WorkShopTransferMapper workShopTransferMapper; /** * 查询转出数据 * @@ -73,6 +75,29 @@ public class WorkShopTransferController { workShopTransferService.transferIn(handleList); return R.ok(); } + /** + * 分页查询数据 + * + * @param frontPage 分页信息 + * @return + */ + @ResponseBody + @GetMapping("/page") + public R page(FrontPage frontPage, WorkShopTransfer workShopTransfer){ + IPage result; + QueryWrapper queryWrapper = new QueryWrapper<>(); + workShopTransfer.setSite(CommonMethods.getSite()); + queryWrapper.setEntity(workShopTransfer); + if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) { + //TODO modify global query + queryWrapper.lambda().and(wrapper -> wrapper + .like(WorkShopTransfer::getTransferNo, frontPage.getGlobalQuery()) + ); + } + result = workShopTransferService.page(frontPage.getPagePlus(), queryWrapper); + return R.ok(result); + } + /** * 根据id查询 * @@ -107,8 +132,8 @@ public class WorkShopTransferController { * @return */ @ResponseBody - @GetMapping("/page") - public R page(FrontPage frontPage, WorkShopTransfer workShopTransfer){ + @GetMapping("/transferNo") + public R getTransferNo(FrontPage frontPage, WorkShopTransfer workShopTransfer){ IPage result; QueryWrapper queryWrapper = new QueryWrapper<>(); workShopTransfer.setSite(CommonMethods.getSite()); @@ -119,7 +144,7 @@ public class WorkShopTransferController { .like(WorkShopTransfer::getTransferNo, frontPage.getGlobalQuery()) ); } - result = workShopTransferService.page(frontPage.getPagePlus(), queryWrapper); + result = workShopTransferMapper.getTransferNo(frontPage.getPagePlus(), queryWrapper); return R.ok(result); } diff --git a/production/src/main/java/com/foreverwin/mesnac/production/mapper/WorkShopTransferMapper.java b/production/src/main/java/com/foreverwin/mesnac/production/mapper/WorkShopTransferMapper.java index 9b9e5e63..b033931b 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/mapper/WorkShopTransferMapper.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/mapper/WorkShopTransferMapper.java @@ -1,5 +1,8 @@ package com.foreverwin.mesnac.production.mapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.foreverwin.mesnac.production.dto.WorkShopTransferDto; import com.foreverwin.mesnac.production.model.WorkShopTransfer; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -26,4 +29,5 @@ public interface WorkShopTransferMapper extends BaseMapper { List getInList(@Param("site") String site, @Param("workCenter") String workCenter,@Param("transferWorkCenter") String transferWorkCenter, @Param("transferNo") String transferNo, @Param("status") String status,@Param("sfc") String sfc); + IPage getTransferNo(Page pagePlus, @Param("ew")QueryWrapper queryWrapper); } \ No newline at end of file diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/WorkShopTransferServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/WorkShopTransferServiceImpl.java index c3749a3d..e71cf82a 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/WorkShopTransferServiceImpl.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/WorkShopTransferServiceImpl.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.foreverwin.mesnac.common.enums.DispatchStatusEnum; import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.service.SfcDispatchCommonService; +import com.foreverwin.mesnac.common.util.DateUtil; import com.foreverwin.mesnac.common.util.ExceptionUtil; import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.meapi.mapper.WorkCenterMapper; @@ -29,10 +30,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; -import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.util.ArrayList; -import java.util.Date; import java.util.List; import java.util.UUID; @@ -138,9 +137,7 @@ public class WorkShopTransferServiceImpl extends ServiceImpl transferOut(String handleList) { String site = CommonMethods.getSite(); String user = CommonMethods.getUser(); - Date date = new Date(System.currentTimeMillis()); - SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyyMMddHHmmss"); - String taskNo = dateFormat1.format(date); + String taskNo = DateUtil.getTimeString(); List returnList=new ArrayList<>(); String[] split = handleList.split(","); for (String sfc:split){ diff --git a/production/src/main/resources/mapper/WorkShopTransferMapper.xml b/production/src/main/resources/mapper/WorkShopTransferMapper.xml index bd4d0424..7e30e5fc 100644 --- a/production/src/main/resources/mapper/WorkShopTransferMapper.xml +++ b/production/src/main/resources/mapper/WorkShopTransferMapper.xml @@ -261,8 +261,26 @@ + \ No newline at end of file From 4d2f5f9b9983a06f8f766a4b35634b9c5feb0c73 Mon Sep 17 00:00:00 2001 From: zpl Date: Wed, 8 Sep 2021 09:12:29 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=B4=9F=E8=8D=B7?= =?UTF-8?q?=E7=8E=87=E6=8A=A5=E8=A1=A8=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/ReportDataMapper.xml | 139 +++++++++++------- 1 file changed, 89 insertions(+), 50 deletions(-) diff --git a/common/src/main/resources/mapper/ReportDataMapper.xml b/common/src/main/resources/mapper/ReportDataMapper.xml index 6bb7deec..94b20517 100644 --- a/common/src/main/resources/mapper/ReportDataMapper.xml +++ b/common/src/main/resources/mapper/ReportDataMapper.xml @@ -55,57 +55,93 @@ @@ -218,8 +254,11 @@ INSERT INTO Z_REPORT_DATE_TIME - SELECT #{site} ,TO_CHAR(TO_DATE(#{startFromDate},'YYYY-MM-DD') + ROWNUM -1, 'YYYY-MM-DD') , TO_DATE(#{startFromDate} || '16:00:00','yyyy-mm-dd hh24:mi:ss') + rownum -2 , - TO_DATE(#{startFromDate} || '16:00:00','yyyy-mm-dd hh24:mi:ss') + rownum -1 + SELECT '1000' ,TO_CHAR(TO_DATE(#{startFromDate},'YYYY-MM-DD') + ROWNUM -1, 'YYYY-MM-DD') DATE_TIME, + TO_DATE(#{startFromDate} || '00:00:00','yyyy-mm-dd hh24:mi:ss') + rownum -1 AM_START_DATE_TIME, + TO_DATE(#{startFromDate} || '04:00:00','yyyy-mm-dd hh24:mi:ss') + rownum -1 AM_END_DATE_TIME, + TO_DATE(#{startFromDate} || '05:00:00','yyyy-mm-dd hh24:mi:ss') + rownum -1 PM_START_DATE_TIME , + TO_DATE(#{startFromDate} || '09:00:00','yyyy-mm-dd hh24:mi:ss') + rownum -1 PM_END_DATE_TIME FROM dual CONNECT BY rownum <= to_date( #{startToDate}, 'yyyy-mm-dd') - to_date( #{startFromDate}, 'yyyy-mm-dd') + 1