闸机出入记录功能

pull/14/head
liulixin 2024-01-23 18:05:30 +08:00
parent faac07b1b7
commit cfcd363e36
5 changed files with 158 additions and 103 deletions

View File

@ -45,7 +45,6 @@ public class GateCarIOController extends BaseController {
* @return * @return
*/ */
@RequestMapping(value = "/edit") @RequestMapping(value = "/edit")
@DockAnnotation
public ReturnMap edit() { public ReturnMap edit() {
PageData pd = this.getPageData(); PageData pd = this.getPageData();
gateCarIOService.edit(pd); gateCarIOService.edit(pd);
@ -57,7 +56,6 @@ public class GateCarIOController extends BaseController {
* @return * @return
*/ */
@RequestMapping(value = "/removeByIds") @RequestMapping(value = "/removeByIds")
@DockAnnotation
public ReturnMap removeByIds() { public ReturnMap removeByIds() {
PageData pageData = this.getPageData(); PageData pageData = this.getPageData();
gateCarIOService.removeByIds(pageData); gateCarIOService.removeByIds(pageData);
@ -69,7 +67,6 @@ public class GateCarIOController extends BaseController {
* @return * @return
*/ */
@RequestMapping(value = "/add") @RequestMapping(value = "/add")
@DockAnnotation
public ReturnMap add() { public ReturnMap add() {
PageData pageData = this.getPageData(); PageData pageData = this.getPageData();
gateCarIOService.save(pageData); gateCarIOService.save(pageData);

View File

@ -8,19 +8,27 @@ import java.util.List;
@Mapper @Mapper
public interface CzksGateCarIOMapper { public interface CzksGateCarIOMapper {
List<PageData> getDatalistPage(Page page); List<PageData> getMineralDatalistPage(Page page);
void edit(PageData pd); List<PageData> getGroceryDatalistPage(Page page);
void removeByIds(PageData pageData); int editGrocery(PageData pd);
int editMineral(PageData pd);
void saveMineral(PageData pageData); void saveMineral(PageData pageData);
List<PageData> getIORecord(PageData pd);
PageData countGroceryEnterAndQuit(PageData pd); PageData countGroceryEnterAndQuit(PageData pd);
PageData countMineralEnterAndQuit(PageData pd); PageData countMineralEnterAndQuit(PageData pd);
List<PageData> getGroceryIORecords(PageData page); List<PageData> getGroceryIORecords(PageData page);
List<PageData> getMineralIORecords(PageData page); List<PageData> getMineralIORecords(PageData page);
void removeGroceryRecordByIds(PageData pageData);
void removeMineralRecordByIds(PageData pageData);
int saveGrocery(PageData pageData);
} }

View File

@ -5,6 +5,7 @@ import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.gatemachine.CzksGateCarIOMapper; import com.zcloud.mapper.datasource.gatemachine.CzksGateCarIOMapper;
import com.zcloud.service.gatemachine.GateCarIOService; import com.zcloud.service.gatemachine.GateCarIOService;
import com.zcloud.util.InitPageDataUtil; import com.zcloud.util.InitPageDataUtil;
import com.zcloud.util.UuidUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -25,16 +26,22 @@ public class GateCarIOServiceImpl implements GateCarIOService {
/** /**
* *
*
* @param page * @param page
* @return * @return
*/ */
@Override @Override
public List<PageData> getDatalistpage(Page page) { public List<PageData> getDatalistpage(Page page) {
return czksGateCarIOMapper.getDatalistPage(page); if ("0".equals(page.getPd().get("areaType"))) {
return czksGateCarIOMapper.getMineralDatalistPage(page);
} else {
return czksGateCarIOMapper.getGroceryDatalistPage(page);
}
} }
/** /**
* / * /
*
* @return * @return
*/ */
@Override @Override
@ -44,39 +51,59 @@ public class GateCarIOServiceImpl implements GateCarIOService {
/** /**
* *
*
* @return * @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void edit(PageData pd) { public void edit(PageData pd) {
initPageDataUtil.initEdit(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 * @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void removeByIds(PageData pageData) { public void removeByIds(PageData pd) {
initPageDataUtil.initEdit(pageData); initPageDataUtil.initEdit(pd);
czksGateCarIOMapper.removeByIds(pageData); 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 * @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(PageData pageData) { public void save(PageData pageData) {
initPageDataUtil.initSave(pageData, "RECORD_ID"); initPageDataUtil.initSave(pageData, "RECORD_ID");
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); czksGateCarIOMapper.saveMineral(pageData);
} }
}
/** /**
* *
*
* @return * @return
*/ */
@Override @Override

View File

@ -4,7 +4,10 @@
<sql id="table"> mk_gate_area </sql> <sql id="table"> mk_gate_area </sql>
<sql id="filed"> <sql id="filed">
f.GATE_AREA_ID, f
.
GATE_AREA_ID
,
f.GATE_AREA_NAME, f.GATE_AREA_NAME,
f.GATE_AREA_TYPE, f.GATE_AREA_TYPE,
f.LATITUDE, f.LATITUDE,
@ -17,7 +20,8 @@
f.OPERATTIME f.OPERATTIME
</sql> </sql>
<insert id="save"> <insert id="save">
INSERT INTO <include refid="table"></include> INSERT INTO
<include refid="table"></include>
( (
GATE_AREA_ID, GATE_AREA_ID,
GATE_AREA_NAME, GATE_AREA_NAME,
@ -47,10 +51,13 @@
</insert> </insert>
<select id="getDatalistPage" resultType="com.zcloud.entity.PageData"> <select id="getDatalistPage" resultType="com.zcloud.entity.PageData">
select <include refid="filed"></include>, CONCAT_WS('--', f.LATITUDE,f.LONGITUDE) LONGTITUDEANDLATITUDE, select <include refid="filed"></include>, CONCAT_WS('--', f.LATITUDE,f.LONGITUDE) LONGTITUDEANDLATITUDE,
(select count(1) from BUS_GATEVIDEO v where v.GATE_AREA_ID = f.GATE_AREA_ID and v.ISDELETE = '0') as VIDEO_COUNT, (select count(1) from BUS_GATEVIDEO v where v.GATE_AREA_ID = f.GATE_AREA_ID and v.ISDELETE = '0') as
(select count(1) from mk_gate_machine m where m.GATE_AREA_ID = f.GATE_AREA_ID and m.ISDELETE = '0') as GATE_COUNT VIDEO_COUNT,
(select count(1) from mk_gate_machine m where m.GATE_AREA_ID = f.GATE_AREA_ID and m.ISDELETE = '0') as
GATE_COUNT
from from
<include refid="table"></include> f where f.ISDELETE = 0 <include refid="table"></include>
f where f.ISDELETE = 0
<if test="pd.GATE_AREA_NAME != null and pd.GATE_AREA_NAME != ''"> <if test="pd.GATE_AREA_NAME != null and pd.GATE_AREA_NAME != ''">
and f.GATE_AREA_NAME like CONCAT(CONCAT('%', #{pd.GATE_AREA_NAME}),'%') and f.GATE_AREA_NAME like CONCAT(CONCAT('%', #{pd.GATE_AREA_NAME}),'%')
</if> </if>
@ -76,7 +83,7 @@
and CORPINFO_ID in (select CORPINFO_ID from bus_corp_info where AREA = #{AREA} and ISDELETE = 0) and CORPINFO_ID in (select CORPINFO_ID from bus_corp_info where AREA = #{AREA} and ISDELETE = 0)
</if> </if>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"> <if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and CORPINFO_ID = #{CORPINFO_ID} and CORPINFO_ID=#{CORPINFO_ID}
</if> </if>
</select> </select>
<update id="edit"> <update id="edit">

View File

@ -3,7 +3,7 @@
<mapper namespace="com.zcloud.mapper.datasource.gatemachine.CzksGateCarIOMapper"> <mapper namespace="com.zcloud.mapper.datasource.gatemachine.CzksGateCarIOMapper">
<insert id="saveMineral"> <insert id="saveMineral">
INSERT INTO `qa-czks-prevention`.`work_mineral_io_record` INSERT INTO `qa-czks-prevention`.`work_mineral_io_record`
(RECORD_ID, (MINERAL_RECORD_ID,
TRUCK_NO, TRUCK_NO,
CAR_TEAM_NAME, CAR_TEAM_NAME,
LRSJ, LRSJ,
@ -17,7 +17,7 @@
CREATTIME, CREATTIME,
OPERATOR, OPERATOR,
OPERATTIME) OPERATTIME)
VALUES (#{RECORD_ID}, VALUES (#{MINERAL_RECORD_ID},
#{TRUCK_NO}, #{TRUCK_NO},
#{CAR_TEAM_NAME}, #{CAR_TEAM_NAME},
#{LRSJ}, #{LRSJ},
@ -26,7 +26,7 @@
#{LX}, #{LX},
#{GATE_MACHINE_ID}, #{GATE_MACHINE_ID},
#{PASS_TYPE}, #{PASS_TYPE},
#{ISDELETE}, 0,
#{CREATOR}, #{CREATOR},
#{CREATTIME}, #{CREATTIME},
#{OPERATOR}, #{OPERATOR},
@ -34,7 +34,7 @@
</insert> </insert>
<insert id="saveGrocery"> <insert id="saveGrocery">
INSERT INTO `qa-czks-prevention`.`work_grocery_io_record` INSERT INTO `qa-czks-prevention`.`work_grocery_io_record`
(RECORD_ID, (GROCERY_RECORD_ID,
TRUCK_NO, TRUCK_NO,
CAR_TEAM_NAME, CAR_TEAM_NAME,
LRSJ, LRSJ,
@ -48,7 +48,7 @@
CREATTIME, CREATTIME,
OPERATOR, OPERATOR,
OPERATTIME) OPERATTIME)
VALUES (#{RECORD_ID}, VALUES (#{GROCERY_RECORD_ID},
#{TRUCK_NO}, #{TRUCK_NO},
#{CAR_TEAM_NAME}, #{CAR_TEAM_NAME},
#{LRSJ}, #{LRSJ},
@ -57,7 +57,7 @@
#{LX}, #{LX},
#{GATE_MACHINE_ID}, #{GATE_MACHINE_ID},
#{PASS_TYPE}, #{PASS_TYPE},
#{ISDELETE}, 0,
#{CREATOR}, #{CREATOR},
#{CREATTIME}, #{CREATTIME},
#{OPERATOR}, #{OPERATOR},
@ -93,53 +93,56 @@
</if> </if>
order by f.OPERATTIME desc order by f.OPERATTIME desc
</select> </select>
<update id="edit"> <update id="editGrocery" parameterType="com.zcloud.entity.PageData">
update update
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '0'"> `qa-czks-prevention`.`work_grocery_io_record`
`qa-czks-prevention`.`work_grocery_io_record` f set TRUCK_NO=#{TRUCK_NO},
</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}, CAR_TEAM_NAME=#{CAR_TEAM_NAME},
LRSJ=#{LRSJ}, LRSJ=#{LRSJ},
JGSJ=#{JGSJ}, JGSJ=#{JGSJ},
CGSJ=#{CGSJ}, CGSJ=#{CGSJ},
LX=#{LX}, LX=#{LX},
PASS_TYPE=#{PASS_TYPE}, PASS_TYPE=#{PASS_TYPE},
ISDELETE=#{ISDELETE},
CREATOR=#{CREATOR}, CREATOR=#{CREATOR},
CREATTIME=#{CREATTIME}, CREATTIME=#{CREATTIME},
OPERATOR=#{OPERATOR}, OPERATOR=#{OPERATOR},
OPERATTIME=#{OPERATTIME} OPERATTIME=#{OPERATTIME}
where 1=1 where 1 = 1
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '0'"> and GROCERY_RECORD_ID = #{GROCERY_RECORD_ID ,jdbcType=VARCHAR}
and f.grocery_record_id=#{grocery_record_id}
</if>
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '1'">
and f.mineral_record_id=#{mineral_record_id}
</if>
</update> </update>
<update id="removeByIds"> <update id="editMineral" parameterType="com.zcloud.entity.PageData">
update update
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '0'"> `qa-czks-prevention`.`work_mineral_io_record`
`qa-czks-prevention`.`work_grocery_io_record` f set TRUCK_NO=#{TRUCK_NO},
</if> CAR_TEAM_NAME=#{CAR_TEAM_NAME},
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '1'"> LRSJ=#{LRSJ},
`qa-czks-prevention`.`work_mineral_io_record` f JGSJ=#{JGSJ},
</if> CGSJ=#{CGSJ},
set ISDELETE = 1 LX=#{LX},
where 1=1 PASS_TYPE=#{PASS_TYPE},
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '0'"> CREATOR=#{CREATOR},
and f.grocery_record_id=#{grocery_record_id} CREATTIME=#{CREATTIME},
</if> OPERATOR=#{OPERATOR},
<if test="pd.areaType != null and pd.areaType != '' and pd.areaType == '1'"> OPERATTIME=#{OPERATTIME}
and f.mineral_record_id=#{mineral_record_id} where 1 = 1
</if> and MINERAL_RECORD_ID = #{MINERAL_RECORD_ID ,jdbcType=VARCHAR}
</update> </update>
<select id="countGroceryEnterAndQuit" resultType="com.zcloud.entity.PageData" parameterType="pageData"> <update id="removeGroceryRecordByIds" parameterType="com.zcloud.entity.PageData">
update
`qa-czks-prevention`.`work_grocery_io_record`
set ISDELETE = #{ISDELETE ,jdbcType=INTEGER}
where 1 = 1
and GROCERY_RECORD_ID = #{GROCERY_RECORD_ID ,jdbcType=VARCHAR}
</update>
<update id="removeMineralRecordByIds" parameterType="com.zcloud.entity.PageData">
update
`qa-czks-prevention`.`work_mineral_io_record`
set ISDELETE = #{ISDELETE ,jdbcType=INTEGER}
where 1 = 1
and MINERAL_RECORD_ID = #{MINERAL_RECORD_ID ,jdbcType=VARCHAR}
</update>
<select id="countGroceryEnterAndQuit" resultType="com.zcloud.entity.PageData">
select select
count(case when g.PASS_TYPE = '0' then 0 end) as `entered`, 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 = '1' then 1 end) as `quited`
@ -151,7 +154,7 @@
and day(g.CREATTIME) = day(NOW()); and day(g.CREATTIME) = day(NOW());
</if> </if>
</select> </select>
<select id="countMineralEnterAndQuit" resultType="com.zcloud.entity.PageData" parameterType="pageData"> <select id="countMineralEnterAndQuit" resultType="com.zcloud.entity.PageData">
select select
count(case when m.PASS_TYPE = '0' then 0 end) as `entered`, 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 = '1' then 1 end) as `quited`
@ -163,4 +166,17 @@
and day(m.CREATTIME) = day(NOW()); and day(m.CREATTIME) = day(NOW());
</if> </if>
</select> </select>
<select id="getMineralDatalistPage" resultType="com.zcloud.entity.PageData">
select *
from `qa-czks-prevention`.`work_mineral_io_record` f
where f.ISDELETE = 0
order by f.OPERATTIME desc
</select>
<select id="getGroceryDatalistPage" resultType="com.zcloud.entity.PageData">
select *
from `qa-czks-prevention`.`work_grocery_io_record` f
where f.ISDELETE = 0
order by f.OPERATTIME desc
</select>
</mapper> </mapper>