From cfcd363e36b4fe098fc24e34a539642f6f165a6c Mon Sep 17 00:00:00 2001 From: liulixin Date: Tue, 23 Jan 2024 18:05:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=B8=E6=9C=BA=E5=87=BA=E5=85=A5=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gatemachine/GateCarIOController.java | 3 - .../gatemachine/CzksGateCarIOMapper.java | 16 ++- .../impl/GateCarIOServiceImpl.java | 39 ++++- .../gatemachine/CzksGateAreaMapper.xml | 67 +++++---- .../gatemachine/CzksGateCarIOMapper.xml | 136 ++++++++++-------- 5 files changed, 158 insertions(+), 103 deletions(-) diff --git a/src/main/java/com/zcloud/controller/gatemachine/GateCarIOController.java b/src/main/java/com/zcloud/controller/gatemachine/GateCarIOController.java index 3647b9e0..52d6bb86 100644 --- a/src/main/java/com/zcloud/controller/gatemachine/GateCarIOController.java +++ b/src/main/java/com/zcloud/controller/gatemachine/GateCarIOController.java @@ -45,7 +45,6 @@ public class GateCarIOController extends BaseController { * @return */ @RequestMapping(value = "/edit") - @DockAnnotation public ReturnMap edit() { PageData pd = this.getPageData(); gateCarIOService.edit(pd); @@ -57,7 +56,6 @@ public class GateCarIOController extends BaseController { * @return */ @RequestMapping(value = "/removeByIds") - @DockAnnotation public ReturnMap removeByIds() { PageData pageData = this.getPageData(); gateCarIOService.removeByIds(pageData); @@ -69,7 +67,6 @@ public class GateCarIOController extends BaseController { * @return */ @RequestMapping(value = "/add") - @DockAnnotation public ReturnMap add() { PageData pageData = this.getPageData(); gateCarIOService.save(pageData); diff --git a/src/main/java/com/zcloud/mapper/datasource/gatemachine/CzksGateCarIOMapper.java b/src/main/java/com/zcloud/mapper/datasource/gatemachine/CzksGateCarIOMapper.java index dfcc20ca..41d96a8c 100644 --- a/src/main/java/com/zcloud/mapper/datasource/gatemachine/CzksGateCarIOMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/gatemachine/CzksGateCarIOMapper.java @@ -8,19 +8,27 @@ import java.util.List; @Mapper public interface CzksGateCarIOMapper { - List getDatalistPage(Page page); + List getMineralDatalistPage(Page page); - void edit(PageData pd); + List getGroceryDatalistPage(Page page); - void removeByIds(PageData pageData); + int editGrocery(PageData pd); + + int editMineral(PageData pd); void saveMineral(PageData pageData); - List getIORecord(PageData pd); PageData countGroceryEnterAndQuit(PageData pd); + PageData countMineralEnterAndQuit(PageData pd); List getGroceryIORecords(PageData page); List getMineralIORecords(PageData page); + + void removeGroceryRecordByIds(PageData pageData); + + void removeMineralRecordByIds(PageData pageData); + + int saveGrocery(PageData pageData); } diff --git a/src/main/java/com/zcloud/service/gatemachine/impl/GateCarIOServiceImpl.java b/src/main/java/com/zcloud/service/gatemachine/impl/GateCarIOServiceImpl.java index c78688a6..3f25ef78 100644 --- a/src/main/java/com/zcloud/service/gatemachine/impl/GateCarIOServiceImpl.java +++ b/src/main/java/com/zcloud/service/gatemachine/impl/GateCarIOServiceImpl.java @@ -5,6 +5,7 @@ import com.zcloud.entity.PageData; import com.zcloud.mapper.datasource.gatemachine.CzksGateCarIOMapper; import com.zcloud.service.gatemachine.GateCarIOService; import com.zcloud.util.InitPageDataUtil; +import com.zcloud.util.UuidUtil; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -25,16 +26,22 @@ public class GateCarIOServiceImpl implements GateCarIOService { /** * 出入闸机车辆记录 + * * @param page * @return 记录 */ @Override public List getDatalistpage(Page page) { - return czksGateCarIOMapper.getDatalistPage(page); + if ("0".equals(page.getPd().get("areaType"))) { + return czksGateCarIOMapper.getMineralDatalistPage(page); + } else { + return czksGateCarIOMapper.getGroceryDatalistPage(page); + } } /** * 根据条件获取杂货/矿区闸机出入记录 + * * @return */ @Override @@ -44,39 +51,59 @@ public class GateCarIOServiceImpl implements GateCarIOService { /** * 编辑出入闸机车辆记录 + * * @return */ @Override @Transactional(rollbackFor = Exception.class) public void edit(PageData pd) { initPageDataUtil.initEdit(pd); - czksGateCarIOMapper.edit(pd); + if (pd.get("GROCERY_RECORD_ID") != null && !"".equals(pd.get("GROCERY_RECORD_ID"))) { + czksGateCarIOMapper.editGrocery(pd); + } else if (pd.get("MINERAL_RECORD_ID") != null && "".equals(pd.get("MINERAL_RECORD_ID"))) { + czksGateCarIOMapper.editMineral(pd); + } } /** * 删除出入闸机车辆记录 + * * @return */ @Override @Transactional(rollbackFor = Exception.class) - public void removeByIds(PageData pageData) { - initPageDataUtil.initEdit(pageData); - czksGateCarIOMapper.removeByIds(pageData); + public void removeByIds(PageData pd) { + initPageDataUtil.initEdit(pd); + if (pd.get("GROCERY_RECORD_ID") != null && !"".equals(pd.get("GROCERY_RECORD_ID"))) { + pd.put("ISDELETE", new Integer(1)); + czksGateCarIOMapper.removeGroceryRecordByIds(pd); + } else if (pd.get("MINERAL_RECORD_ID") != null && "".equals(pd.get("MINERAL_RECORD_ID"))) { + pd.put("ISDELETE", new Integer(1)); + czksGateCarIOMapper.removeMineralRecordByIds(pd); + } } /** * 添加出入闸机车辆记录 + * * @return */ @Override @Transactional(rollbackFor = Exception.class) public void save(PageData pageData) { initPageDataUtil.initSave(pageData, "RECORD_ID"); - czksGateCarIOMapper.saveMineral(pageData); + if (pageData.get("areaType") != null && !"GROCERY".equals(pageData.get("areaType"))) { + pageData.put("GROCERY_RECORD_ID", UuidUtil.get32UUID()); + czksGateCarIOMapper.saveGrocery(pageData); + } else if (pageData.get("areaType") != null && "MINERAL".equals(pageData.get("areaType"))) { + pageData.put("MINERAL_RECORD_ID", UuidUtil.get32UUID()); + czksGateCarIOMapper.saveMineral(pageData); + } } /** * 获取在场,离场,总量计数 + * * @return */ @Override diff --git a/src/main/resources/mybatis/datasource/gatemachine/CzksGateAreaMapper.xml b/src/main/resources/mybatis/datasource/gatemachine/CzksGateAreaMapper.xml index 7c209cb7..d4bced82 100644 --- a/src/main/resources/mybatis/datasource/gatemachine/CzksGateAreaMapper.xml +++ b/src/main/resources/mybatis/datasource/gatemachine/CzksGateAreaMapper.xml @@ -4,7 +4,10 @@ mk_gate_area - f.GATE_AREA_ID, + f + . + GATE_AREA_ID + , f.GATE_AREA_NAME, f.GATE_AREA_TYPE, f.LATITUDE, @@ -17,40 +20,44 @@ f.OPERATTIME - INSERT INTO + INSERT INTO + ( - GATE_AREA_ID, - GATE_AREA_NAME, - GATE_AREA_TYPE, - LATITUDE, - LONGITUDE, - CORPINFO_ID, - ISDELETE, - CREATOR, - CREATTIME, - OPERATOR, - OPERATTIME - ) + GATE_AREA_ID, + GATE_AREA_NAME, + GATE_AREA_TYPE, + LATITUDE, + LONGITUDE, + CORPINFO_ID, + ISDELETE, + CREATOR, + CREATTIME, + OPERATOR, + OPERATTIME + ) VALUES ( - #{GATE_AREA_ID}, - #{GATE_AREA_NAME}, - #{GATE_AREA_TYPE}, - #{LATITUDE}, - #{LONGITUDE}, - #{CORPINFO_ID}, - #{ISDELETE}, - #{CREATOR}, - #{CREATTIME}, - #{OPERATOR}, - #{OPERATTIME} - ) + #{GATE_AREA_ID}, + #{GATE_AREA_NAME}, + #{GATE_AREA_TYPE}, + #{LATITUDE}, + #{LONGITUDE}, + #{CORPINFO_ID}, + #{ISDELETE}, + #{CREATOR}, + #{CREATTIME}, + #{OPERATOR}, + #{OPERATTIME} + ) diff --git a/src/main/resources/mybatis/datasource/gatemachine/CzksGateCarIOMapper.xml b/src/main/resources/mybatis/datasource/gatemachine/CzksGateCarIOMapper.xml index 30963107..90cc0b04 100644 --- a/src/main/resources/mybatis/datasource/gatemachine/CzksGateCarIOMapper.xml +++ b/src/main/resources/mybatis/datasource/gatemachine/CzksGateCarIOMapper.xml @@ -3,7 +3,7 @@ INSERT INTO `qa-czks-prevention`.`work_mineral_io_record` - (RECORD_ID, + (MINERAL_RECORD_ID, TRUCK_NO, CAR_TEAM_NAME, LRSJ, @@ -17,7 +17,7 @@ CREATTIME, OPERATOR, OPERATTIME) - VALUES (#{RECORD_ID}, + VALUES (#{MINERAL_RECORD_ID}, #{TRUCK_NO}, #{CAR_TEAM_NAME}, #{LRSJ}, @@ -26,7 +26,7 @@ #{LX}, #{GATE_MACHINE_ID}, #{PASS_TYPE}, - #{ISDELETE}, + 0, #{CREATOR}, #{CREATTIME}, #{OPERATOR}, @@ -34,7 +34,7 @@ INSERT INTO `qa-czks-prevention`.`work_grocery_io_record` - (RECORD_ID, + (GROCERY_RECORD_ID, TRUCK_NO, CAR_TEAM_NAME, LRSJ, @@ -48,7 +48,7 @@ CREATTIME, OPERATOR, OPERATTIME) - VALUES (#{RECORD_ID}, + VALUES (#{GROCERY_RECORD_ID}, #{TRUCK_NO}, #{CAR_TEAM_NAME}, #{LRSJ}, @@ -57,7 +57,7 @@ #{LX}, #{GATE_MACHINE_ID}, #{PASS_TYPE}, - #{ISDELETE}, + 0, #{CREATOR}, #{CREATTIME}, #{OPERATOR}, @@ -65,7 +65,7 @@ - + update - - `qa-czks-prevention`.`work_grocery_io_record` f - - - `qa-czks-prevention`.`work_mineral_io_record` f - - set - TRUCK_NO=#{TRUCK_NO}, - CAR_TEAM_NAME=#{CAR_TEAM_NAME}, - LRSJ=#{LRSJ}, - JGSJ=#{JGSJ}, - CGSJ=#{CGSJ}, - LX=#{LX}, - PASS_TYPE=#{PASS_TYPE}, - ISDELETE=#{ISDELETE}, - CREATOR=#{CREATOR}, - CREATTIME=#{CREATTIME}, - OPERATOR=#{OPERATOR}, - OPERATTIME=#{OPERATTIME} - where 1=1 - - and f.grocery_record_id=#{grocery_record_id} - - - and f.mineral_record_id=#{mineral_record_id} - + `qa-czks-prevention`.`work_grocery_io_record` + set TRUCK_NO=#{TRUCK_NO}, + CAR_TEAM_NAME=#{CAR_TEAM_NAME}, + LRSJ=#{LRSJ}, + JGSJ=#{JGSJ}, + CGSJ=#{CGSJ}, + LX=#{LX}, + PASS_TYPE=#{PASS_TYPE}, + CREATOR=#{CREATOR}, + CREATTIME=#{CREATTIME}, + OPERATOR=#{OPERATOR}, + OPERATTIME=#{OPERATTIME} + where 1 = 1 + and GROCERY_RECORD_ID = #{GROCERY_RECORD_ID ,jdbcType=VARCHAR} - + update - - `qa-czks-prevention`.`work_grocery_io_record` f - - - `qa-czks-prevention`.`work_mineral_io_record` f - - set ISDELETE = 1 - where 1=1 - - and f.grocery_record_id=#{grocery_record_id} - - - and f.mineral_record_id=#{mineral_record_id} - + `qa-czks-prevention`.`work_mineral_io_record` + set TRUCK_NO=#{TRUCK_NO}, + CAR_TEAM_NAME=#{CAR_TEAM_NAME}, + LRSJ=#{LRSJ}, + JGSJ=#{JGSJ}, + CGSJ=#{CGSJ}, + LX=#{LX}, + PASS_TYPE=#{PASS_TYPE}, + CREATOR=#{CREATOR}, + CREATTIME=#{CREATTIME}, + OPERATOR=#{OPERATOR}, + OPERATTIME=#{OPERATTIME} + where 1 = 1 + and MINERAL_RECORD_ID = #{MINERAL_RECORD_ID ,jdbcType=VARCHAR} - select - count(case when g.PASS_TYPE = '0' then 0 end) as `entered`, - count(case when g.PASS_TYPE = '1' then 1 end) as `quited` + count(case when g.PASS_TYPE = '0' then 0 end) as `entered`, + count(case when g.PASS_TYPE = '1' then 1 end) as `quited` from - `qa-czks-prevention`.`work_grocery_io_record` g + `qa-czks-prevention`.`work_grocery_io_record` g where - g.ISDELETE = 0 + g.ISDELETE = 0 and day(g.CREATTIME) = day(NOW()); - select - count(case when m.PASS_TYPE = '0' then 0 end) as `entered`, - count(case when m.PASS_TYPE = '1' then 1 end) as `quited` + count(case when m.PASS_TYPE = '0' then 0 end) as `entered`, + count(case when m.PASS_TYPE = '1' then 1 end) as `quited` from - `qa-czks-prevention`.`work_mineral_io_record` m + `qa-czks-prevention`.`work_mineral_io_record` m where - m.ISDELETE = 0 + m.ISDELETE = 0 and day(m.CREATTIME) = day(NOW()); + + +