Commit dae0f9f4 by zhouhaibao

Merge remote-tracking branch 'origin/master'

2 parents 0e9cc4b6 2dd56ff9
......@@ -8,8 +8,6 @@ import com.glsx.plat.exception.SystemMessage;
* @author zhouhaibao
*/
public enum ResultEnum {
SUCCESS(200, "成功"),
ERROR(500, "系统异常"),
PARAM_ERROR(1001, "参数错误"),
PARAM_EMPTY(1001, "参数错误:%s 不能为空"),
......@@ -42,8 +40,14 @@ public enum ResultEnum {
*/
TRACKHISTORY_HAS_EXCEED_LIMIT(12110004, "获取gps历史轨迹的数据条数已经超过最大限制"),
TRACKHISTORY_HAS_NO_DATA(12110005, "没有查询到历史轨迹数据"),
DEVICE_NOT_EXIST(12110006, "%s 设备不存在,请先入库!"),
DEVICE_NOT_EXIST(12110006, "%s 设备不存在,请先入库!");
/**
* 试驾围栏管理相关业务异常错误码,错误信息 1213开头
*/
ELECTRIC_FENCE_EXISTED(121230001, "围栏名称已存在")
;
private final Integer code;
private final String message;
......
......@@ -24,6 +24,8 @@ public interface ElectricFenceMapper extends CommonBaseMapper<ElectricFence> {
List<ElectricFence> selectAllNotDel();
ElectricFence selectByFenceName(@Param("fenceName") String fenceName);
/**
* 逻辑删除
*
......
......@@ -121,6 +121,9 @@ public class ElectricFenceService {
* @throws Exception
*/
public void addFenceHandler(ElectricFenceBO fenceBO) throws Exception {
checkElectricFence(fenceBO, false);
// 2021/5/24 围栏审核 特约店用户修改才提交
List<Long> shopOrgIds = trialDriveShopService.getShopOrgIds();
......@@ -147,6 +150,9 @@ public class ElectricFenceService {
* @throws Exception
*/
public void editFenceHandler(ElectricFenceBO fenceBO) throws Exception {
checkElectricFence(fenceBO, true);
// 2021/5/24 围栏审核 特约店用户修改才提交
List<Long> shopOrgIds = trialDriveShopService.getShopOrgIds();
......@@ -167,6 +173,26 @@ public class ElectricFenceService {
}
/**
* 校验存在性
*
* @param fenceBO
* @param updateFlag
*/
public void checkElectricFence(ElectricFenceBO fenceBO, boolean updateFlag) {
if (updateFlag) {
ElectricFence existFence = electricFenceMapper.selectByFenceName(fenceBO.getFenceName());
if (existFence != null && !fenceBO.getId().equals(existFence.getId())) {
throw new AdminException(ResultEnum.ELECTRIC_FENCE_EXISTED);
}
} else {
ElectricFence existFence = electricFenceMapper.selectByFenceName(fenceBO.getFenceName());
if (existFence != null) {
throw new AdminException(ResultEnum.ELECTRIC_FENCE_EXISTED);
}
}
}
/**
* 审批回调处理
*
* @param approvalData
......
......@@ -59,6 +59,15 @@
and id = #{id}
</select>
<select id="selectByFenceName" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_electric_fence
where del_flag = 0
and fence_name = #{fenceName}
limit 1
</select>
<select id="selectAllNotDel" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>,
......@@ -70,13 +79,14 @@
<select id="search" resultType="cn.com.glsx.admin.modules.model.ElectricFenceDTO">
select tef.id fenceId,
tef.fence_name fenceName,
ttds.shop_name shopName,
ttds.shop_code shopCode,
tu.username shopName,
tu.account shopCode,
ttds.shop_level shopLevel,
tef.created_date createdDate,
tef.created_by creatorId,
biz_fence_type as bizFenceType
from t_electric_fence tef
left join t_user tu on tu.id = tef.created_by
left join t_trial_drive_shop ttds on ttds.fence_id = tef.id
where tef.del_flag = 0
<if test="term != null and term !=''">
......@@ -94,12 +104,13 @@
<select id="export" resultType="cn.com.glsx.admin.modules.model.export.ElectricFenceExport">
select tef.id fenceId,
tef.fence_name fenceName,
ttds.shop_name shopName,
ttds.shop_code shopCode,
tu.username shopName,
tu.account shopCode,
ttds.shop_level shopLevel,
tef.created_date createdDate,
tef.created_by creatorId
from t_electric_fence tef
left join t_user tu on tu.id = tef.created_by
left join t_trial_drive_shop ttds on ttds.fence_id = tef.id
where tef.del_flag = 0
<if test="term != null and term !=''">
......
......@@ -29,8 +29,8 @@
<select id="search" resultType="cn.com.glsx.admin.modules.model.TrialDriveShopDTO">
select ttds.id shopId,
ttds.shop_name shopName,
ttds.shop_code shopCode,
tu.username shopName,
tu.account shopCode,
ttds.shop_level shopLevel,
ttds.area,
ttds.province,
......@@ -40,6 +40,7 @@
tef.fence_name fenceName,
ttds.created_by creatorId
from t_trial_drive_shop ttds
left join t_user tu on tu.id = ttds.created_by
left join t_electric_fence tef on tef.id = ttds.fence_id
where ttds.del_flag = 0
and tef.biz_fence_type = 13
......@@ -64,8 +65,8 @@
<select id="export" resultType="cn.com.glsx.admin.modules.model.export.TrialDriveShopExport">
select ttds.id shopId,
ttds.shop_name shopName,
ttds.shop_code shopCode,
tu.username shopName,
tu.account shopCode,
ttds.shop_level shopLevel,
ttds.area,
ttds.province,
......@@ -76,6 +77,7 @@
tef.fence_name fenceName,
ttds.created_by creatorId
from t_trial_drive_shop ttds
left join t_user tu on tu.id = ttds.created_by
left join t_electric_fence tef on tef.id = ttds.fence_id
where ttds.del_flag = 0
and tef.biz_fence_type = 13
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!