门口门禁记录

pull/14/head
liulixin 2024-01-19 15:39:45 +08:00
parent dc28d0a652
commit 34f27ebfd4
5 changed files with 339 additions and 0 deletions

View File

@ -0,0 +1,70 @@
package com.zcloud.controller.gatemachine;
import com.zcloud.aspect.DockAnnotation;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.gatemachine.GateCarIOService;
import com.zcloud.util.ReturnMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/gateCar")
public class GateCarIOController extends BaseController {
@Resource
private GateCarIOService gateCarIOService;
@RequestMapping(value = "/page")
public ReturnMap page(Page page) {
ReturnMap returnMap = new ReturnMap();
PageData pageData = this.getPageData();
page.setPd(pageData);
List<PageData> data = gateCarIOService.getDatalistpage(page);
returnMap.put("varList", data);
returnMap.put("page", page);
return returnMap;
}
@RequestMapping(value = "/edit")
@DockAnnotation
public ReturnMap edit() {
PageData pd = this.getPageData();
gateCarIOService.edit(pd);
return ReturnMap.ok();
}
@RequestMapping(value = "/removeByIds")
@DockAnnotation
public ReturnMap removeByIds() {
PageData pageData = this.getPageData();
gateCarIOService.removeByIds(pageData);
return ReturnMap.ok();
}
@RequestMapping(value = "/add")
@DockAnnotation
public ReturnMap add() {
PageData pageData = this.getPageData();
gateCarIOService.save(pageData);
return ReturnMap.ok();
}
@RequestMapping(value = "/getIORecords")
public ReturnMap getIORecord(Page page) {
PageData pageData = this.getPageData();
page.setPd(pageData);
return ReturnMap.ok().put("data", gateCarIOService.getIORecord(page));
}
@RequestMapping(value = "/getEQCount")
public ReturnMap getTodayEQCount() {
PageData pageData = this.getPageData();
return ReturnMap.ok().put("data", gateCarIOService.getTodayEQCount(pageData));
}
}

View File

@ -0,0 +1,22 @@
package com.zcloud.mapper.datasource.gatemachine;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CzksGateCarIOMapper {
List<PageData> getDatalistPage(Page page);
void edit(PageData pd);
void removeByIds(PageData pageData);
void saveMineral(PageData pageData);
List<PageData> getIORecord(Page page);
PageData countGroceryEnterAndQuit(PageData pageData);
PageData countMineralEnterAndQuit(PageData pageData);
}

View File

@ -0,0 +1,22 @@
package com.zcloud.service.gatemachine;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
public interface GateCarIOService {
List<PageData> getDatalistpage(Page page);
List<PageData> getIORecord(Page page);
void edit(PageData pd);
void removeByIds(PageData pageData);
void save(PageData pageData);
PageData getTodayEQCount(PageData pageData);
}

View File

@ -0,0 +1,69 @@
package com.zcloud.service.gatemachine.impl;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.gatemachine.CzksGateCarIOMapper;
import com.zcloud.service.gatemachine.GateCarIOService;
import com.zcloud.util.InitPageDataUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* GateCarIOService IMPL
*/
@Service
public class GateCarIOServiceImpl implements GateCarIOService {
@Resource
private CzksGateCarIOMapper czksGateCarIOMapper;
@Resource
private InitPageDataUtil initPageDataUtil;
@Override
public List<PageData> getDatalistpage(Page page) {
return czksGateCarIOMapper.getDatalistPage(page);
}
@Override
public List<PageData> getIORecord(Page page) {
return czksGateCarIOMapper.getIORecord(page);
}
@Override
@Transactional(rollbackFor = Throwable.class)
public void edit(PageData pd) {
initPageDataUtil.initEdit(pd);
czksGateCarIOMapper.edit(pd);
}
@Override
@Transactional(rollbackFor = Throwable.class)
public void removeByIds(PageData pageData) {
initPageDataUtil.initEdit(pageData);
czksGateCarIOMapper.removeByIds(pageData);
}
@Override
@Transactional(rollbackFor = Throwable.class)
public void save(PageData pageData) {
initPageDataUtil.initSave(pageData, "RECORD_ID");
if ("".equals(pageData.get(""))) {
czksGateCarIOMapper.saveMineral(pageData);
} else {
}
}
@Override
public PageData getTodayEQCount(PageData PageData) {
PageData pageData = new PageData();
pageData.put("grocery", czksGateCarIOMapper.countGroceryEnterAndQuit(PageData));
pageData.put("mineral", czksGateCarIOMapper.countMineralEnterAndQuit(PageData));
return pageData;
}
}

View File

@ -0,0 +1,156 @@
<?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.zcloud.mapper.datasource.gatemachine.CzksGateCarIOMapper">
<insert id="saveMineral">
INSERT INTO `qa-czks-prevention`.`work_mineral_io_record`
(RECORD_ID,
TRUCK_NO,
CAR_TEAM_NAME,
LRSJ,
JGSJ,
CGSJ,
LX,
GATE_MACHINE_ID,
PASS_TYPE,
ISDELETE,
CREATOR,
CREATTIME,
OPERATOR,
OPERATTIME)
VALUES (#{RECORD_ID},
#{TRUCK_NO},
#{CAR_TEAM_NAME},
#{LRSJ},
#{JGSJ},
#{CGSJ},
#{LX},
#{GATE_MACHINE_ID},
#{PASS_TYPE},
#{ISDELETE},
#{CREATOR},
#{CREATTIME},
#{OPERATOR},
#{OPERATTIME})
</insert>
<insert id="saveGrocery">
INSERT INTO `qa-czks-prevention`.`work_grocery_io_record`
(RECORD_ID,
TRUCK_NO,
CAR_TEAM_NAME,
LRSJ,
JGSJ,
CGSJ,
LX,
GATE_MACHINE_ID,
PASS_TYPE,
ISDELETE,
CREATOR,
CREATTIME,
OPERATOR,
OPERATTIME)
VALUES (#{RECORD_ID},
#{TRUCK_NO},
#{CAR_TEAM_NAME},
#{LRSJ},
#{JGSJ},
#{CGSJ},
#{LX},
#{GATE_MACHINE_ID},
#{PASS_TYPE},
#{ISDELETE},
#{CREATOR},
#{CREATTIME},
#{OPERATOR},
#{OPERATTIME})
</insert>
<select id="getIORecord" resultType="com.zcloud.entity.PageData">
select * from
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '0'">
`qa-czks-prevention`.`work_grocery_io_record` f
</if>
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '1'">
`qa-czks-prevention`.`work_mineral_io_record` f
</if>
where
<if test="pd.JGSJ != null and pd.JGSJ != ''">
f.JGSJ = #{pd.JGSJ}
</if>
<if test="pd.LX != null and pd.LX != ''">
and f.LX = #{pd.LX}
</if>
<if test="pd.TRUCK_NO != null and pd.TRUCK_NO != ''">
f.TRUCK_NO like CONCAT(CONCAT('%', #{pd.TRUCK_NO}),'%')
</if>
order by f.OPERATTIME desc
</select>
<update id="edit">
update
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '0'">
`qa-czks-prevention`.`work_grocery_io_record` f
</if>
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '1'">
`qa-czks-prevention`.`work_mineral_io_record` f
</if>
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
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '0'">
f.grocery_record_id=#{grocery_record_id}
</if>
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '1'">
f.mineral_record_id=#{mineral_record_id}
</if>
</update>
<update id="removeByIds">
update
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '0'">
`qa-czks-prevention`.`work_grocery_io_record` f
</if>
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '1'">
`qa-czks-prevention`.`work_mineral_io_record` f
</if>
set ISDELETE = 1
where 1=1
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '0'">
f.grocery_record_id=#{grocery_record_id}
</if>
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '1'">
f.mineral_record_id=#{mineral_record_id}
</if>
</update>
<select id="countGroceryEnterAndQuit" resultType="com.zcloud.entity.PageData" parameterType="pageData">
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`
from
`qa-czks-prevention`.`work_grocery_io_record` g
where
g.ISDELETE = 0
<if test="pageData.CREATTIME != null and pageData.CREATTIME != ''">
and day(g.CREATTIME) = day(NOW());
</if>
</select>
<select id="countMineralEnterAndQuit" resultType="com.zcloud.entity.PageData" parameterType="pageData">
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`
from
`qa-czks-prevention`.`work_mineral_io_record` m
where
m.ISDELETE = 0
<if test="pageData.CREATTIME != null and pageData.CREATTIME != ''">
and day(m.CREATTIME) = day(NOW());
</if>
</select>
</mapper>