Commit d2e642be by 刘宇峰

特约店、围栏

1 parent 56e45b73
...@@ -116,4 +116,12 @@ public class ElectricFenceController { ...@@ -116,4 +116,12 @@ public class ElectricFenceController {
return R.ok(); return R.ok();
} }
@SysLog("同步围栏到数据侧(kafka)")
@GetMapping(value = "/syncdata")
@ApiOperation(value = "同步围栏到数据侧")
public R syncData() {
electricFenceService.syncFences();
return R.ok();
}
} }
...@@ -10,4 +10,6 @@ public interface ElectricFenceCopyMapper extends CommonBaseMapper<ElectricFenceC ...@@ -10,4 +10,6 @@ public interface ElectricFenceCopyMapper extends CommonBaseMapper<ElectricFenceC
ElectricFenceCopy selectByFenceId(@Param("fenceId") Long fenceId); ElectricFenceCopy selectByFenceId(@Param("fenceId") Long fenceId);
void updateFenceIdById(@Param("id") Long id, @Param("fenceId") Long fenceId);
} }
\ No newline at end of file \ No newline at end of file
...@@ -19,6 +19,8 @@ public interface ElectricFenceMapper extends CommonBaseMapper<ElectricFence> { ...@@ -19,6 +19,8 @@ public interface ElectricFenceMapper extends CommonBaseMapper<ElectricFence> {
ElectricFence selectById(@Param("id") Long id); ElectricFence selectById(@Param("id") Long id);
List<ElectricFence> selectAllNotDel();
/** /**
* 逻辑删除 * 逻辑删除
* *
......
...@@ -4,17 +4,14 @@ import cn.com.glsx.admin.modules.entity.ElectricFenceSns; ...@@ -4,17 +4,14 @@ import cn.com.glsx.admin.modules.entity.ElectricFenceSns;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper; import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
@Mapper @Mapper
public interface ElectricFenceSnsMapper extends CommonBaseMapper<ElectricFenceSns> { public interface ElectricFenceSnsMapper extends CommonBaseMapper<ElectricFenceSns> {
@Select("select * from t_electric_fence_sns where fence_id=#{fenceId} and source=1")
List<ElectricFenceSns> selectByFenceId(@Param("fenceId") Long fenceId); List<ElectricFenceSns> selectByFenceId(@Param("fenceId") Long fenceId);
/** /**
* 逻辑删除 * 逻辑删除
* *
......
...@@ -11,6 +11,7 @@ import java.util.List; ...@@ -11,6 +11,7 @@ import java.util.List;
public class SimpleTreeModel implements Serializable { public class SimpleTreeModel implements Serializable {
private Long id; private Long id;
private String code;
private String label; private String label;
private Long parentId; private Long parentId;
private Integer type; private Integer type;
......
...@@ -25,6 +25,7 @@ import cn.com.glsx.usercenter.api.dto.response.User; ...@@ -25,6 +25,7 @@ import cn.com.glsx.usercenter.api.dto.response.User;
import cn.com.glsx.usercenter.api.feign.OrganizationService; import cn.com.glsx.usercenter.api.feign.OrganizationService;
import cn.com.glsx.usercenter.api.feign.UserService; import cn.com.glsx.usercenter.api.feign.UserService;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -137,7 +138,7 @@ public class ElectricFenceService { ...@@ -137,7 +138,7 @@ public class ElectricFenceService {
ElectricFence fence = addFence(fenceBO); ElectricFence fence = addFence(fenceBO);
//向大数据推送新增围栏信息(kafka) //向大数据推送新增围栏信息(kafka)
// eFenceComponent.addElectricFence(fence); //eFenceComponent.addElectricFence(fence);
} }
} }
...@@ -183,9 +184,15 @@ public class ElectricFenceService { ...@@ -183,9 +184,15 @@ public class ElectricFenceService {
boolean addFlag = ObjectUtil.isNotNull(fenceCopy) && ObjectUtil.isNull(fenceCopy.getFenceId()); boolean addFlag = ObjectUtil.isNotNull(fenceCopy) && ObjectUtil.isNull(fenceCopy.getFenceId());
if (addFlag) { if (addFlag) {
refreshElectricFenceCopy2ElectricFence(fenceCopy, null); refreshElectricFenceCopy2ElectricFence(fenceCopy, null);
//向大数据推送新增围栏信息(kafka)
//eFenceComponent.addElectricFence(fence);
} else { } else {
fence = electricFenceMapper.selectById(approvalData.getBizId()); fence = electricFenceMapper.selectById(approvalData.getBizId());
refreshElectricFenceCopy2ElectricFence(fenceCopy, fence); refreshElectricFenceCopy2ElectricFence(fenceCopy, fence);
//向大数据推送围栏更新(kafka)
//eFenceComponent.updateElectricFence(fence);
} }
} else if (ApprovalStatusEnum.APPROVAL_STATUS_REJECT.getCode().equals(approvalData.getStatus())) { } else if (ApprovalStatusEnum.APPROVAL_STATUS_REJECT.getCode().equals(approvalData.getStatus())) {
...@@ -204,9 +211,9 @@ public class ElectricFenceService { ...@@ -204,9 +211,9 @@ public class ElectricFenceService {
BeanUtils.copyProperties(fenceBO, fence); BeanUtils.copyProperties(fenceBO, fence);
//设置定位信息类型为gps类型 默认都是创建gps类型围栏 //设置定位信息类型为gps类型 默认都是创建gps类型围栏
fence.setLocationType(1); fence.setLocationType(1);
fence.setRecord("操作时间:" + DateUtils.formatNormal(new Date()) // fence.setRecord("操作时间:" + DateUtils.formatNormal(new Date())
+ " 操作人:" + ShieldContextHolder.getAccount() + "(" + ShieldContextHolder.getUserId() + ")" // + " 操作人:" + ShieldContextHolder.getAccount() + "(" + ShieldContextHolder.getUserId() + ")"
+ "<br/>"); // + "<br/>");
if (fenceBO.getShopId() != null) { if (fenceBO.getShopId() != null) {
fence.setCreatedBy(fenceBO.getShopId()); fence.setCreatedBy(fenceBO.getShopId());
} else { } else {
...@@ -235,9 +242,9 @@ public class ElectricFenceService { ...@@ -235,9 +242,9 @@ public class ElectricFenceService {
BeanUtils.copyProperties(fenceBO, fenceCopy); BeanUtils.copyProperties(fenceBO, fenceCopy);
//设置定位信息类型为gps类型 默认都是创建gps类型围栏 //设置定位信息类型为gps类型 默认都是创建gps类型围栏
fenceCopy.setLocationType(1); fenceCopy.setLocationType(1);
fenceCopy.setRecord("操作时间:" + DateUtils.formatNormal(new Date()) // fenceCopy.setRecord("操作时间:" + DateUtils.formatNormal(new Date())
+ " 操作人:" + ShieldContextHolder.getAccount() + "(" + ShieldContextHolder.getUserId() + ")" // + " 操作人:" + ShieldContextHolder.getAccount() + "(" + ShieldContextHolder.getUserId() + ")"
+ "<br/>"); // + "<br/>");
if (fenceBO.getShopId() != null) { if (fenceBO.getShopId() != null) {
fenceCopy.setCreatedBy(fenceBO.getShopId()); fenceCopy.setCreatedBy(fenceBO.getShopId());
} else { } else {
...@@ -394,11 +401,14 @@ public class ElectricFenceService { ...@@ -394,11 +401,14 @@ public class ElectricFenceService {
if (ObjectUtil.isNull(fence)) { if (ObjectUtil.isNull(fence)) {
fence = new ElectricFence(); fence = new ElectricFence();
}
// TODO: 2021/5/27
BeanUtils.copyProperties(fenceCopy, fence); BeanUtils.copyProperties(fenceCopy, fence);
electricFenceMapper.insertUseGeneratedKeys(fence);
electricFenceCopyMapper.updateFenceIdById(fenceCopy.getId(), fence.getId());
} else {
BeanUtils.copyProperties(fenceCopy, fence);
electricFenceMapper.updateByPrimaryKey(fence);
}
return fence; return fence;
} }
...@@ -469,4 +479,12 @@ public class ElectricFenceService { ...@@ -469,4 +479,12 @@ public class ElectricFenceService {
electricFenceSnsMapper.logicDeleteByFenceId(fenceId); electricFenceSnsMapper.logicDeleteByFenceId(fenceId);
} }
public void syncFences() {
List<ElectricFence> fenceList = electricFenceMapper.selectAllNotDel();
fenceList.forEach(fence -> {
System.out.println(JSON.toJSONString(fence));
eFenceComponent.addElectricFence(fence);
});
}
} }
...@@ -252,10 +252,10 @@ public class TrialDriveShopService { ...@@ -252,10 +252,10 @@ public class TrialDriveShopService {
List<SimpleTreeModel> treeModelList = Lists.newArrayList(); List<SimpleTreeModel> treeModelList = Lists.newArrayList();
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
list.forEach(u -> { list.forEach(u -> {
SimpleTreeModel treeModel = new SimpleTreeModel(); SimpleTreeModel treeModel = new SimpleTreeModel();
treeModel.setId(u.getId()); treeModel.setId(u.getId());
treeModel.setLabel(u.getUsername()); treeModel.setLabel(u.getUsername());
treeModel.setCode(u.getAccount());
treeModel.setType(1); treeModel.setType(1);
treeModelList.add(treeModel); treeModelList.add(treeModel);
}); });
......
...@@ -53,6 +53,12 @@ ...@@ -53,6 +53,12 @@
lnglat lnglat
</sql> </sql>
<update id="updateFenceIdById">
update t_electric_fence_copy
set fence_id = #{fenceId}
where id = #{id}
</update>
<select id="selectByFenceId" resultMap="BaseResultMap"> <select id="selectByFenceId" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/>, <include refid="Base_Column_List"/>,
......
...@@ -59,6 +59,14 @@ ...@@ -59,6 +59,14 @@
and id = #{id} and id = #{id}
</select> </select>
<select id="selectAllNotDel" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>,
<include refid="Blob_Column_List"/>
from t_electric_fence
where del_flag = 0
</select>
<select id="search" resultType="cn.com.glsx.admin.modules.model.ElectricFenceDTO"> <select id="search" resultType="cn.com.glsx.admin.modules.model.ElectricFenceDTO">
select tef.id fenceId, select tef.id fenceId,
tef.fence_name fenceName, tef.fence_name fenceName,
......
...@@ -25,6 +25,15 @@ ...@@ -25,6 +25,15 @@
updated_date, updated_by updated_date, updated_by
</sql> </sql>
<select id="selectByFenceId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_electric_fence_sns
where fence_id = #{fenceId}
and source = 1
and del_flag = 0
</select>
<update id="logicDeleteByFenceId"> <update id="logicDeleteByFenceId">
update t_electric_fence_sns update t_electric_fence_sns
set del_flag = -1 set del_flag = -1
......
...@@ -112,7 +112,9 @@ public class AdminApplicationTests { ...@@ -112,7 +112,9 @@ public class AdminApplicationTests {
fenceBO.setAreaCode("12213"); fenceBO.setAreaCode("12213");
fenceBO.setAreaText("深圳"); fenceBO.setAreaText("深圳");
fenceBO.setTelNumbers("13800138000"); fenceBO.setTelNumbers("13800138000");
electricFenceService.updateFence(fenceBO); // electricFenceService.updateFence(fenceBO);
System.out.println(JSON.toJSONString(fenceBO));
} }
@Test @Test
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!