闸机出入记录功能

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
*/
@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);

View File

@ -8,19 +8,27 @@ import java.util.List;
@Mapper
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);
List<PageData> getIORecord(PageData pd);
PageData countGroceryEnterAndQuit(PageData pd);
PageData countMineralEnterAndQuit(PageData pd);
List<PageData> getGroceryIORecords(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.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<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
*/
@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

View File

@ -4,7 +4,10 @@
<sql id="table"> mk_gate_area </sql>
<sql id="filed">
f.GATE_AREA_ID,
f
.
GATE_AREA_ID
,
f.GATE_AREA_NAME,
f.GATE_AREA_TYPE,
f.LATITUDE,
@ -17,40 +20,44 @@
f.OPERATTIME
</sql>
<insert id="save">
INSERT INTO <include refid="table"></include>
INSERT INTO
<include refid="table"></include>
(
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}
)
</insert>
<select id="getDatalistPage" resultType="com.zcloud.entity.PageData">
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 mk_gate_machine m where m.GATE_AREA_ID = f.GATE_AREA_ID and m.ISDELETE = '0') as GATE_COUNT
(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 mk_gate_machine m where m.GATE_AREA_ID = f.GATE_AREA_ID and m.ISDELETE = '0') as
GATE_COUNT
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 != ''">
and f.GATE_AREA_NAME like CONCAT(CONCAT('%', #{pd.GATE_AREA_NAME}),'%')
</if>
@ -76,7 +83,7 @@
and CORPINFO_ID in (select CORPINFO_ID from bus_corp_info where AREA = #{AREA} and ISDELETE = 0)
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and CORPINFO_ID = #{CORPINFO_ID}
and CORPINFO_ID=#{CORPINFO_ID}
</if>
</select>
<update id="edit">

View File

@ -3,7 +3,7 @@
<mapper namespace="com.zcloud.mapper.datasource.gatemachine.CzksGateCarIOMapper">
<insert id="saveMineral">
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>
<insert id="saveGrocery">
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 @@
</insert>
<select id="getGroceryIORecords" resultType="com.zcloud.entity.PageData" parameterType="pd">
select * from
`qa-czks-prevention`.`work_grocery_io_record` f
`qa-czks-prevention`.`work_grocery_io_record` f
where 1=1
<if test="JGSJ != null and JGSJ != ''">
and f.JGSJ = #{JGSJ}
@ -80,7 +80,7 @@
</select>
<select id="getMineralIORecords" resultType="com.zcloud.entity.PageData" parameterType="pd">
select * from
`qa-czks-prevention`.`work_grocery_io_record` f
`qa-czks-prevention`.`work_grocery_io_record` f
where 1=1
<if test="JGSJ != null and JGSJ != ''">
and f.JGSJ = #{JGSJ}
@ -93,74 +93,90 @@
</if>
order by f.OPERATTIME desc
</select>
<update id="edit">
<update id="editGrocery" parameterType="com.zcloud.entity.PageData">
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'">
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>
`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>
<update id="removeByIds">
<update id="editMineral" parameterType="com.zcloud.entity.PageData">
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'">
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>
`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}
</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
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
<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 id="countMineralEnterAndQuit" resultType="com.zcloud.entity.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`
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
<if test="pageData.CREATTIME != null and pageData.CREATTIME != ''">
and day(m.CREATTIME) = day(NOW());
</if>
</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>