设备、模板、景区设置
This commit is contained in:
parent
8c81a994c8
commit
68dbd6c38b
@ -1,6 +1,7 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity;
|
||||
import com.ycwl.basic.model.pc.device.req.DeviceAddOrUpdateReq;
|
||||
import com.ycwl.basic.model.pc.device.req.DeviceReqQuery;
|
||||
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
||||
@ -52,4 +53,15 @@ public class DeviceController {
|
||||
public ApiResponse updateStatus(@PathVariable("id") Long id) {
|
||||
return deviceService.updateStatus(id);
|
||||
}
|
||||
|
||||
@GetMapping("/config/{id}")
|
||||
public ApiResponse<DeviceConfigEntity> getConfig(@PathVariable("id") Long id) {
|
||||
return ApiResponse.success(deviceService.getConfig(id));
|
||||
}
|
||||
|
||||
@PostMapping("/saveConfig/{configId}")
|
||||
public ApiResponse saveConfig(@PathVariable("configId") Long configId, @RequestBody DeviceConfigEntity deviceConfigEntity) {
|
||||
deviceService.saveConfig(configId, deviceConfigEntity);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
}
|
||||
|
@ -72,4 +72,14 @@ public class ScenicController {
|
||||
return scenicService.updateConfigById(scenicConfig);
|
||||
}
|
||||
|
||||
@ApiOperation("查询景区配置")
|
||||
@GetMapping("/config/{id}")
|
||||
public ApiResponse<ScenicConfigEntity> getConfig(@PathVariable("id") Long id) {
|
||||
return ApiResponse.success(scenicService.getConfig(id));
|
||||
}
|
||||
@PostMapping("/saveConfig/{id}")
|
||||
public ApiResponse saveConfig(@PathVariable("id") Long id, @RequestBody ScenicConfigEntity config) {
|
||||
scenicService.saveConfig(id, config);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity;
|
||||
import com.ycwl.basic.model.pc.template.entity.TemplateConfigEntity;
|
||||
import com.ycwl.basic.model.pc.template.entity.TemplateEntity;
|
||||
import com.ycwl.basic.model.pc.template.req.TemplateReqQuery;
|
||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||
@ -60,4 +62,16 @@ public class TemplateController {
|
||||
public ApiResponse<Boolean> updateStatus(@RequestBody Long id) {
|
||||
return templateService.updateStatus(id);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/config/{id}")
|
||||
public ApiResponse<TemplateConfigEntity> getConfig(@PathVariable("id") Long id) {
|
||||
return ApiResponse.success(templateService.getConfig(id));
|
||||
}
|
||||
|
||||
@PostMapping("/saveConfig/{configId}")
|
||||
public ApiResponse saveConfig(@PathVariable("configId") Long configId, @RequestBody TemplateConfigEntity deviceConfigEntity) {
|
||||
templateService.saveConfig(configId, deviceConfigEntity);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
}
|
||||
|
@ -31,4 +31,6 @@ public interface DeviceMapper {
|
||||
ScenicDeviceCountVO deviceCountByScenicId(@Param("scenicId") Long scenicId,@Param("userId") Long userId);
|
||||
|
||||
DeviceConfigEntity getConfigByDeviceId(Long deviceId);
|
||||
int addConfig(DeviceConfigEntity deviceConfigEntity);
|
||||
int updateConfig(DeviceConfigEntity deviceConfigEntity);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.ycwl.basic.service.impl.pc;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.mapper.pc.DeviceMapper;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity;
|
||||
import com.ycwl.basic.model.pc.device.req.DeviceAddOrUpdateReq;
|
||||
import com.ycwl.basic.model.pc.device.req.DeviceReqQuery;
|
||||
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
||||
@ -65,4 +66,22 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
public ApiResponse updateStatus(Long id) {
|
||||
return ApiResponse.success(deviceMapper.updateStatus(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceConfigEntity getConfig(Long id) {
|
||||
DeviceConfigEntity config = deviceMapper.getConfigByDeviceId(id);
|
||||
if (config == null) {
|
||||
config = new DeviceConfigEntity();
|
||||
config.setId(SnowFlakeUtil.getLongId());
|
||||
config.setDeviceId(id);
|
||||
deviceMapper.addConfig(config);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveConfig(Long configId, DeviceConfigEntity config) {
|
||||
config.setId(configId);
|
||||
deviceMapper.updateConfig(config);
|
||||
}
|
||||
}
|
||||
|
@ -167,6 +167,25 @@ public class ScenicServiceImpl implements ScenicService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScenicConfigEntity getConfig(Long id) {
|
||||
ScenicConfigEntity config = scenicMapper.getConfig(id);
|
||||
if (config == null) {
|
||||
config = new ScenicConfigEntity();
|
||||
config.setId(SnowFlakeUtil.getLongId());
|
||||
config.setScenicId(id);
|
||||
config.setIsDefault(1);
|
||||
scenicMapper.addConfig(config);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveConfig(Long configId, ScenicConfigEntity config) {
|
||||
config.setId(configId);
|
||||
scenicMapper.updateConfigById(config);
|
||||
}
|
||||
|
||||
private IAcsClient getClient() {
|
||||
DefaultProfile profile = DefaultProfile.getProfile(
|
||||
faceDetectConfig.getRegion(),faceDetectConfig.getAccessKeyId(), faceDetectConfig.getAccessKeySecret());
|
||||
|
@ -3,6 +3,7 @@ package com.ycwl.basic.service.impl.pc;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.mapper.pc.TemplateMapper;
|
||||
import com.ycwl.basic.model.pc.template.entity.TemplateConfigEntity;
|
||||
import com.ycwl.basic.model.pc.template.entity.TemplateEntity;
|
||||
import com.ycwl.basic.model.pc.template.req.TemplateReqQuery;
|
||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||
@ -104,4 +105,22 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
return ApiResponse.fail("更新模版状态失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateConfigEntity getConfig(Long templateId) {
|
||||
TemplateConfigEntity config = templateMapper.getConfig(templateId);
|
||||
if (config == null) {
|
||||
config = new TemplateConfigEntity();
|
||||
config.setId(SnowFlakeUtil.getLongId());
|
||||
config.setTemplateId(templateId);
|
||||
templateMapper.addConfig(config);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveConfig(Long configId, TemplateConfigEntity config) {
|
||||
config.setId(configId);
|
||||
templateMapper.updateConfigById(config);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.ycwl.basic.service.pc;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity;
|
||||
import com.ycwl.basic.model.pc.device.req.DeviceAddOrUpdateReq;
|
||||
import com.ycwl.basic.model.pc.device.req.DeviceReqQuery;
|
||||
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
||||
@ -20,4 +21,7 @@ public interface DeviceService {
|
||||
ApiResponse addOrUpdate(DeviceAddOrUpdateReq deviceReqQuery);
|
||||
ApiResponse deleteById(Long id);
|
||||
ApiResponse updateStatus(Long id);
|
||||
|
||||
DeviceConfigEntity getConfig(Long id);
|
||||
void saveConfig(Long configId, DeviceConfigEntity config);
|
||||
}
|
||||
|
@ -28,4 +28,7 @@ public interface ScenicService {
|
||||
* @return
|
||||
*/
|
||||
ApiResponse<Boolean> updateConfigById(ScenicConfigEntity scenicConfig);
|
||||
|
||||
ScenicConfigEntity getConfig(Long id);
|
||||
void saveConfig(Long configId, ScenicConfigEntity config);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.ycwl.basic.service.pc;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.model.pc.template.entity.TemplateConfigEntity;
|
||||
import com.ycwl.basic.model.pc.template.entity.TemplateEntity;
|
||||
import com.ycwl.basic.model.pc.template.req.TemplateReqQuery;
|
||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||
@ -21,4 +22,8 @@ public interface TemplateService {
|
||||
ApiResponse<Integer> deleteById(Long id);
|
||||
ApiResponse<Boolean> update(TemplateEntity template);
|
||||
ApiResponse<Boolean> updateStatus(Long id);
|
||||
|
||||
TemplateConfigEntity getConfig(Long templateId);
|
||||
|
||||
void saveConfig(Long configId, TemplateConfigEntity config);
|
||||
}
|
||||
|
@ -4,6 +4,10 @@
|
||||
<insert id="add">
|
||||
insert into device(id, scenic_id, name, no, latitude, longitude) values (#{id}, #{scenicId}, #{name}, #{no}, #{latitude}, #{longitude})
|
||||
</insert>
|
||||
<insert id="addConfig">
|
||||
insert into device_config(id, device_id, create_time)
|
||||
values (#{id}, #{deviceId}, now())
|
||||
</insert>
|
||||
<update id="update">
|
||||
update device set scenic_id = #{scenicId}, name = #{name}, no = #{no}, longitude = #{longitude}, latitude = #{latitude}, update_at = now() where id = #{id}
|
||||
</update>
|
||||
@ -19,6 +23,17 @@
|
||||
END)
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateConfig">
|
||||
update device_config
|
||||
set store_type = #{storeType},
|
||||
store_config_json = #{storeConfigJson},
|
||||
store_expire_day = #{storeExpireDay},
|
||||
online_check = #{onlineCheck},
|
||||
online_max_interval = #{onlineMaxInterval},
|
||||
cut_pre = #{cutPre},
|
||||
cut_post = #{cutPost}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<delete id="deleteById">
|
||||
delete from device where id = #{id}
|
||||
</delete>
|
||||
|
@ -6,8 +6,8 @@
|
||||
values (#{id}, #{name}, #{introduction}, #{phone}, #{coverUrl},#{longitude}, #{latitude}, #{radius}, #{province}, #{city}, #{area}, #{address})
|
||||
</insert>
|
||||
<insert id="addConfig">
|
||||
insert into scenic_config(id, scenic_id, start_time, end_time, is_default)
|
||||
values (#{id}, #{scenicId}, #{startTime}, #{endTime}, #{isDefault})
|
||||
insert into scenic_config(id, scenic_id, create_time)
|
||||
values (#{id}, #{scenicId}, now())
|
||||
</insert>
|
||||
<update id="update">
|
||||
update
|
||||
@ -73,6 +73,10 @@
|
||||
<if test="isDefault!=null">
|
||||
is_default=#{isDefault},
|
||||
</if>
|
||||
book_routine=#{bookRoutine},
|
||||
sample_store_day=#{sampleStoreDay},
|
||||
video_store_day=#{videoStoreDay},
|
||||
max_journey_hour=#{maxJourneyHour},
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
@ -6,8 +6,8 @@
|
||||
values (#{id}, #{scenicId}, #{name}, #{pid}, #{isPlaceholder}, #{sourceUrl}, #{luts}, #{overlays}, #{audios}, #{coverUrl}, #{frameRate}, #{speed}, #{price})
|
||||
</insert>
|
||||
<insert id="addConfig">
|
||||
insert into template_config(template_id, is_default, minimal_placeholder_fill)
|
||||
values (#{templateId}, #{isDefault}, #{minimalPlaceholderFill})
|
||||
insert into template_config(id, template_id, create_time)
|
||||
values (#{id}, #{templateId}, now())
|
||||
</insert>
|
||||
<update id="update">
|
||||
update template
|
||||
@ -66,9 +66,7 @@
|
||||
select t.id, t.scenic_id, s.name as scenic_name, t.`name`, t.cover_url, t.status, t.create_time, t.update_time
|
||||
from template t left join scenic s on s.id = t.scenic_id
|
||||
<where>
|
||||
<if test="pid!=null" >
|
||||
pid = #{pid}
|
||||
</if>
|
||||
pid = 0
|
||||
<if test="scenicId!=null" >
|
||||
and scenic_id = #{scenicId}
|
||||
</if>
|
||||
|
Loading…
x
Reference in New Issue
Block a user