diff --git a/src/main/java/com/zcloud/controller/mkmj/MkmjAreaController.java b/src/main/java/com/zcloud/controller/mkmj/MkmjAreaController.java index 76545288..e9d7eb3b 100644 --- a/src/main/java/com/zcloud/controller/mkmj/MkmjAreaController.java +++ b/src/main/java/com/zcloud/controller/mkmj/MkmjAreaController.java @@ -38,7 +38,7 @@ public class MkmjAreaController extends BaseController { @RequestMapping(value="/add") @RequiresPermissions("mkmjArea:add") @ResponseBody - public ReturnMap add() throws Exception{ + public Object add() throws Exception{ PageData pd = new PageData(); pd = this.getPageData(); pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 添加时间 @@ -57,7 +57,7 @@ public class MkmjAreaController extends BaseController { @RequestMapping(value="/delete") @RequiresPermissions("mkmjArea:del") @ResponseBody - public ReturnMap delete() throws Exception{ + public Object delete() throws Exception{ PageData pd = new PageData(); pd = this.getPageData(); return mkmjAreaService.delete(pd); @@ -70,7 +70,7 @@ public class MkmjAreaController extends BaseController { @RequestMapping(value="/edit") @RequiresPermissions("mkmjArea:edit") @ResponseBody - public ReturnMap edit() throws Exception{ + public Object edit() throws Exception{ PageData pd = new PageData(); pd = this.getPageData(); pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 diff --git a/src/main/java/com/zcloud/controller/mkmj/MkmjAreaGateController.java b/src/main/java/com/zcloud/controller/mkmj/MkmjAreaGateController.java index 47555f1d..411da8ff 100644 --- a/src/main/java/com/zcloud/controller/mkmj/MkmjAreaGateController.java +++ b/src/main/java/com/zcloud/controller/mkmj/MkmjAreaGateController.java @@ -39,7 +39,7 @@ public class MkmjAreaGateController extends BaseController { @RequestMapping(value="/add") @RequiresPermissions("mkmjArea:add") @ResponseBody - public ReturnMap add() throws Exception{ + public Object add() throws Exception{ PageData pd = new PageData(); pd = this.getPageData(); pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 添加时间 @@ -58,7 +58,7 @@ public class MkmjAreaGateController extends BaseController { @RequestMapping(value="/delete") @RequiresPermissions("mkmjArea:del") @ResponseBody - public ReturnMap delete() throws Exception{ + public Object delete() throws Exception{ PageData pd = new PageData(); pd = this.getPageData(); return mkmjAreaGateService.delete(pd); @@ -71,7 +71,7 @@ public class MkmjAreaGateController extends BaseController { @RequestMapping(value="/edit") @RequiresPermissions("mkmjArea:edit") @ResponseBody - public ReturnMap edit() throws Exception{ + public Object edit() throws Exception{ PageData pd = new PageData(); pd = this.getPageData(); pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 @@ -126,13 +126,9 @@ public class MkmjAreaGateController extends BaseController { @RequestMapping(value="/savePosition") @ResponseBody public Object savePosition() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); - mkmjAreaGateService.savePosition(pd); //根据ID读取 - map.put("result", errInfo); - return map; + return mkmjAreaGateService.savePosition(pd); //根据ID读取 } } diff --git a/src/main/java/com/zcloud/controller/mkmj/MkmjGateVideoController.java b/src/main/java/com/zcloud/controller/mkmj/MkmjGateVideoController.java index 7ea6b036..ef86aa56 100644 --- a/src/main/java/com/zcloud/controller/mkmj/MkmjGateVideoController.java +++ b/src/main/java/com/zcloud/controller/mkmj/MkmjGateVideoController.java @@ -40,7 +40,7 @@ public class MkmjGateVideoController extends BaseController { @RequestMapping(value="/add") @RequiresPermissions("mkmjArea:add") @ResponseBody - public ReturnMap add() throws Exception{ + public Object add() throws Exception{ PageData pd = new PageData(); pd = this.getPageData(); pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 添加时间 @@ -59,7 +59,7 @@ public class MkmjGateVideoController extends BaseController { @RequestMapping(value="/delete") @RequiresPermissions("mkmjArea:del") @ResponseBody - public ReturnMap delete() throws Exception{ + public Object delete() throws Exception{ PageData pd = new PageData(); pd = this.getPageData(); return mkmjGateVideoService.delete(pd); @@ -72,7 +72,7 @@ public class MkmjGateVideoController extends BaseController { @RequestMapping(value="/edit") @RequiresPermissions("mkmjArea:edit") @ResponseBody - public ReturnMap edit() throws Exception{ + public Object edit() throws Exception{ PageData pd = new PageData(); pd = this.getPageData(); pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 diff --git a/src/main/java/com/zcloud/mapper/datasource/mkmj/MkmjGateVideoMapper.java b/src/main/java/com/zcloud/mapper/datasource/mkmj/MkmjGateVideoMapper.java index cdc7b589..7cf117e4 100644 --- a/src/main/java/com/zcloud/mapper/datasource/mkmj/MkmjGateVideoMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/mkmj/MkmjGateVideoMapper.java @@ -60,5 +60,12 @@ public interface MkmjGateVideoMapper { * @param pd */ void savePosition(PageData pd); + + /**. + * 校验名称是否重复 修改时传入数据id + * @param pageData + * @return + */ + PageData findByOnly(PageData pageData); } diff --git a/src/main/java/com/zcloud/service/mkmj/MkmjAreaGateService.java b/src/main/java/com/zcloud/service/mkmj/MkmjAreaGateService.java index a15b3155..7606f241 100644 --- a/src/main/java/com/zcloud/service/mkmj/MkmjAreaGateService.java +++ b/src/main/java/com/zcloud/service/mkmj/MkmjAreaGateService.java @@ -18,19 +18,19 @@ public interface MkmjAreaGateService { * @param pd * @throws Exception */ - public ReturnMap save(PageData pd)throws Exception; + public Object save(PageData pd)throws Exception; /**删除 * @param pd * @throws Exception */ - public ReturnMap delete(PageData pd)throws Exception; + public Object delete(PageData pd)throws Exception; /**修改 * @param pd * @throws Exception */ - public ReturnMap edit(PageData pd)throws Exception; + public Object edit(PageData pd)throws Exception; /**列表 * @param page @@ -54,13 +54,13 @@ public interface MkmjAreaGateService { * @param ArrayDATA_IDS * @throws Exception */ - public ReturnMap deleteAll(String[] ArrayDATA_IDS)throws Exception; + public Object deleteAll(String[] ArrayDATA_IDS)throws Exception; /** * 定位 * @param pd * @return */ - ReturnMap savePosition(PageData pd); + Object savePosition(PageData pd); } diff --git a/src/main/java/com/zcloud/service/mkmj/MkmjAreaService.java b/src/main/java/com/zcloud/service/mkmj/MkmjAreaService.java index 6834d684..5814723b 100644 --- a/src/main/java/com/zcloud/service/mkmj/MkmjAreaService.java +++ b/src/main/java/com/zcloud/service/mkmj/MkmjAreaService.java @@ -18,19 +18,19 @@ public interface MkmjAreaService { * @param pd * @throws Exception */ - public ReturnMap save(PageData pd)throws Exception; + public Object save(PageData pd)throws Exception; /**删除 * @param pd * @throws Exception */ - public ReturnMap delete(PageData pd)throws Exception; + public Object delete(PageData pd)throws Exception; /**修改 * @param pd * @throws Exception */ - public ReturnMap edit(PageData pd)throws Exception; + public Object edit(PageData pd)throws Exception; /**列表 * @param page diff --git a/src/main/java/com/zcloud/service/mkmj/MkmjGateVideoService.java b/src/main/java/com/zcloud/service/mkmj/MkmjGateVideoService.java index e7e605e7..105d2d78 100644 --- a/src/main/java/com/zcloud/service/mkmj/MkmjGateVideoService.java +++ b/src/main/java/com/zcloud/service/mkmj/MkmjGateVideoService.java @@ -18,19 +18,19 @@ public interface MkmjGateVideoService { * @param pd * @throws Exception */ - public ReturnMap save(PageData pd)throws Exception; + public Object save(PageData pd)throws Exception; /**删除 * @param pd * @throws Exception */ - public ReturnMap delete(PageData pd)throws Exception; + public Object delete(PageData pd)throws Exception; /**修改 * @param pd * @throws Exception */ - public ReturnMap edit(PageData pd)throws Exception; + public Object edit(PageData pd)throws Exception; /**列表 * @param page @@ -54,13 +54,13 @@ public interface MkmjGateVideoService { * @param ArrayDATA_IDS * @throws Exception */ - public ReturnMap deleteAll(String[] ArrayDATA_IDS)throws Exception; + public Object deleteAll(String[] ArrayDATA_IDS)throws Exception; /** * 定位 * @param pd * @return */ - ReturnMap savePosition(PageData pd); + Object savePosition(PageData pd); } diff --git a/src/main/java/com/zcloud/service/mkmj/impl/MkmjAreaGateServiceImpl.java b/src/main/java/com/zcloud/service/mkmj/impl/MkmjAreaGateServiceImpl.java index cf72bf25..71c86974 100644 --- a/src/main/java/com/zcloud/service/mkmj/impl/MkmjAreaGateServiceImpl.java +++ b/src/main/java/com/zcloud/service/mkmj/impl/MkmjAreaGateServiceImpl.java @@ -11,7 +11,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 说明:门口门禁区域闸机 @@ -30,45 +32,56 @@ public class MkmjAreaGateServiceImpl implements MkmjAreaGateService { * @param pd * @throws Exception */ - public ReturnMap save(PageData pd)throws Exception{ - ReturnMap returnMap = new ReturnMap(); + public Object save(PageData pd)throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; //保存校验名称不重复 PageData pageData = mkmjAreaGateMapper.findByOnly(pd); //查询不到重复数据 开始走业务 if(ObjectUtils.isEmpty(pageData)){ pd.put("AREA_GATE_ID", UuidUtil.get32UUID()); }else { - returnMap.error("名称已存在,请修改后重新提交"); - return returnMap; + map.put("result", "fail"); + map.put("msg", "名称已存在,请修改后重新提交"); + return map; } mkmjAreaGateMapper.save(pd); - return returnMap.ok("保存成功"); + map.put("result", errInfo); + map.put("msg", "保存成功"); + return map; } /**删除 * @param pd * @throws Exception */ - public ReturnMap delete(PageData pd)throws Exception{ - ReturnMap returnMap = new ReturnMap(); + public Object delete(PageData pd)throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; mkmjAreaGateMapper.delete(pd); - return returnMap.ok("删除成功"); + map.put("result", errInfo); + map.put("msg", "删除成功"); + return map; } /**修改 * @param pd * @throws Exception */ - public ReturnMap edit(PageData pd)throws Exception{ - ReturnMap returnMap = new ReturnMap(); + public Object edit(PageData pd)throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; PageData pageData = mkmjAreaGateMapper.findByOnly(pd); //查询不到重复数据 开始走业务 if(!ObjectUtils.isEmpty(pageData)){ - returnMap.error("名称已存在,请修改后重新提交"); - return returnMap; + map.put("result", "fail"); + map.put("msg", "名称已存在,请修改后重新提交"); + return map; } mkmjAreaGateMapper.edit(pd); - return returnMap.ok("编辑成功"); + map.put("result", errInfo); + map.put("msg", "编辑成功"); + return map; } /**列表 @@ -99,16 +112,23 @@ public class MkmjAreaGateServiceImpl implements MkmjAreaGateService { * @param ArrayDATA_IDS * @throws Exception */ - public ReturnMap deleteAll(String[] ArrayDATA_IDS)throws Exception{ - ReturnMap returnMap = new ReturnMap(); + public Object deleteAll(String[] ArrayDATA_IDS)throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; mkmjAreaGateMapper.deleteAll(ArrayDATA_IDS); - return returnMap.ok("删除成功"); + map.put("result", errInfo); + map.put("msg", "删除成功"); + return map; } @Override - public ReturnMap savePosition(PageData pd) { + public Object savePosition(PageData pd) { + Map map = new HashMap(); + String errInfo = "success"; mkmjAreaGateMapper.savePosition(pd); - return ReturnMap.ok("定位成功"); + map.put("result", errInfo); + map.put("msg", "定位成功"); + return map; } } diff --git a/src/main/java/com/zcloud/service/mkmj/impl/MkmjAreaServiceImpl.java b/src/main/java/com/zcloud/service/mkmj/impl/MkmjAreaServiceImpl.java index 18becb33..9e88e3da 100644 --- a/src/main/java/com/zcloud/service/mkmj/impl/MkmjAreaServiceImpl.java +++ b/src/main/java/com/zcloud/service/mkmj/impl/MkmjAreaServiceImpl.java @@ -12,7 +12,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 说明:门口门禁区域闸机 @@ -34,51 +36,71 @@ public class MkmjAreaServiceImpl implements MkmjAreaService { * @param pd * @throws Exception */ - public ReturnMap save(PageData pd)throws Exception{ + public Object save(PageData pd)throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; //保存校验名称不重复 PageData pageData = mkmjAreaMapper.findByOnly(pd); //查询不到重复数据 开始走业务 if(ObjectUtils.isEmpty(pageData)){ pd.put("AREA_ID", UuidUtil.get32UUID()); }else { - return ReturnMap.error("名称已存在,请修改后重新提交"); + map.put("result", "fail"); + map.put("msg", "名称已存在,请修改后重新提交"); + return map; } mkmjAreaMapper.save(pd); - return ReturnMap.ok("保存成功"); + map.put("result", errInfo); + map.put("msg", "保存成功"); + return map; } /**删除 * @param pd * @throws Exception */ - public ReturnMap delete(PageData pd)throws Exception{ + public Object delete(PageData pd)throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; //校验区域下是否还存在区域 存在则不让删除 List childList = mkmjAreaMapper.findByChild(pd); if(childList.size()>0){ - return ReturnMap.error("当前区域还存在下级区域,请删除当前区域的所有下级区域后进行删除"); + map.put("result", "fail"); + map.put("msg", "当前区域还存在下级区域,请删除当前区域的所有下级区域后进行删除"); + return map; } //校验区域下是否存在闸机,存在则不让删除 List gateList = mkmjAreaGateMapper.listAll(pd); if(gateList.size()>0){ - return ReturnMap.error("当前区域还存在闸机,请删除当前区域的所有闸机后进行删除"); + map.put("result", "fail"); + map.put("msg", "当前区域还存在闸机,请删除当前区域的所有闸机后进行删除"); + return map; } //两个校验都不存在 则可以删除 mkmjAreaMapper.delete(pd); - return ReturnMap.ok("删除成功"); + map.put("result", errInfo); + map.put("msg", "删除成功"); + return map; } /**修改 * @param pd * @throws Exception */ - public ReturnMap edit(PageData pd)throws Exception{ + public Object edit(PageData pd)throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; PageData pageData = mkmjAreaMapper.findByOnly(pd); //查询不到重复数据 开始走业务 if(!ObjectUtils.isEmpty(pageData)){ - return ReturnMap.error("名称已存在,请修改后重新提交"); + map.put("result", "fail"); + map.put("msg", "名称已存在,请修改后重新提交"); + return map; } mkmjAreaMapper.edit(pd); - return ReturnMap.ok("编辑成功"); + map.put("result", errInfo); + map.put("msg", "编辑成功"); + return map; } /**列表 diff --git a/src/main/java/com/zcloud/service/mkmj/impl/MkmjGateVideServiceImpl.java b/src/main/java/com/zcloud/service/mkmj/impl/MkmjGateVideServiceImpl.java index 16d85775..67f14f55 100644 --- a/src/main/java/com/zcloud/service/mkmj/impl/MkmjGateVideServiceImpl.java +++ b/src/main/java/com/zcloud/service/mkmj/impl/MkmjGateVideServiceImpl.java @@ -13,7 +13,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 说明:门口门禁区域闸机 @@ -32,28 +34,47 @@ public class MkmjGateVideServiceImpl implements MkmjGateVideoService { * @param pd * @throws Exception */ - public ReturnMap save(PageData pd)throws Exception{ - pd.put("GATE_VIDEO_ID",UuidUtil.get32UUID()); + public Object save(PageData pd)throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pageData = mkmjGateVideoMapper.findByOnly(pd); + if(ObjectUtils.isEmpty(pageData)){ + pd.put("GATE_VIDEO_ID",UuidUtil.get32UUID()); + }else { + map.put("result", "fail"); + map.put("msg", "当前闸机以绑定该摄像头,无法在此绑定"); + return map; + } mkmjGateVideoMapper.save(pd); - return ReturnMap.ok("保存成功"); + map.put("result", errInfo); + map.put("msg", "保存成功"); + return map; } /**删除 * @param pd * @throws Exception */ - public ReturnMap delete(PageData pd)throws Exception{ + public Object delete(PageData pd)throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; mkmjGateVideoMapper.delete(pd); - return ReturnMap.ok("删除成功"); + map.put("result", errInfo); + map.put("msg", "删除成功"); + return map; } /**修改 * @param pd * @throws Exception */ - public ReturnMap edit(PageData pd)throws Exception{ + public Object edit(PageData pd)throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; mkmjGateVideoMapper.edit(pd); - return ReturnMap.ok("编辑成功"); + map.put("result", errInfo); + map.put("msg", "编辑成功"); + return map; } /**列表 @@ -84,16 +105,20 @@ public class MkmjGateVideServiceImpl implements MkmjGateVideoService { * @param ArrayDATA_IDS * @throws Exception */ - public ReturnMap deleteAll(String[] ArrayDATA_IDS)throws Exception{ + public Object deleteAll(String[] ArrayDATA_IDS)throws Exception{ ReturnMap ReturnMap = new ReturnMap(); mkmjGateVideoMapper.deleteAll(ArrayDATA_IDS); return ReturnMap.ok("删除成功"); } @Override - public ReturnMap savePosition(PageData pd) { + public Object savePosition(PageData pd) { + Map map = new HashMap(); + String errInfo = "success"; mkmjGateVideoMapper.savePosition(pd); - return ReturnMap.ok("定位成功"); + map.put("result", errInfo); + map.put("msg", "定位成功"); + return map; } } diff --git a/src/main/resources/mybatis/datasource/mkmj/MkmjGateVideoMapper.xml b/src/main/resources/mybatis/datasource/mkmj/MkmjGateVideoMapper.xml index fd69ddea..d275b08c 100644 --- a/src/main/resources/mybatis/datasource/mkmj/MkmjGateVideoMapper.xml +++ b/src/main/resources/mybatis/datasource/mkmj/MkmjGateVideoMapper.xml @@ -164,4 +164,17 @@ where GATE_VIDEO_ID = #{GATE_VIDEO_ID} + + + +