parent
709b6c2a7b
commit
6f965d2094
@ -0,0 +1,19 @@ |
|||||||
|
package com.bellmann.common.model; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class Tr069Xml { |
||||||
|
private String tagName; |
||||||
|
private String read; |
||||||
|
private String write; |
||||||
|
private String type; |
||||||
|
private List<Tr069Xml> children = new ArrayList<>(); |
||||||
|
public void addChild(Tr069Xml tr069Xml) { |
||||||
|
this.children.add(tr069Xml); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,54 @@ |
|||||||
|
package com.bellmann.common.util; |
||||||
|
|
||||||
|
import com.bellmann.common.model.Tr069Xml; |
||||||
|
import org.w3c.dom.Document; |
||||||
|
import org.w3c.dom.Element; |
||||||
|
import org.w3c.dom.NodeList; |
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder; |
||||||
|
import javax.xml.parsers.DocumentBuilderFactory; |
||||||
|
import java.io.File; |
||||||
|
import java.io.IOException; |
||||||
|
import java.io.InputStream; |
||||||
|
|
||||||
|
public class Tr069XmlUtils { |
||||||
|
|
||||||
|
public static Tr069Xml parseXML(InputStream xmlFile) { |
||||||
|
try { |
||||||
|
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); |
||||||
|
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); |
||||||
|
Document doc = dBuilder.parse(xmlFile); |
||||||
|
|
||||||
|
Element rootElement = doc.getDocumentElement(); |
||||||
|
return parseElement(rootElement); |
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
return null; |
||||||
|
}finally { |
||||||
|
if (xmlFile!=null){ |
||||||
|
try { |
||||||
|
xmlFile.close(); |
||||||
|
} catch (IOException e) { |
||||||
|
throw new RuntimeException(e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static Tr069Xml parseElement(Element element) { |
||||||
|
Tr069Xml tr069Xml = new Tr069Xml(); |
||||||
|
tr069Xml.setTagName(element.getTagName()); |
||||||
|
tr069Xml.setRead(element.getAttribute("READ")); |
||||||
|
tr069Xml.setWrite(element.getAttribute("WRITE")); |
||||||
|
tr069Xml.setType(element.getAttribute("TYPE")); |
||||||
|
|
||||||
|
NodeList children = element.getChildNodes(); |
||||||
|
for (int i = 0; i < children.getLength(); i++) { |
||||||
|
if (children.item(i) instanceof Element) { |
||||||
|
Element childElement = (Element) children.item(i); |
||||||
|
tr069Xml.addChild(parseElement(childElement)); |
||||||
|
} |
||||||
|
} |
||||||
|
return tr069Xml; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,38 @@ |
|||||||
|
package com.bellmann.config; |
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
import org.springframework.scheduling.annotation.EnableAsync; |
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
||||||
|
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor; |
||||||
|
|
||||||
|
@Configuration |
||||||
|
@EnableAsync |
||||||
|
public class ThreadPoolConfig { |
||||||
|
|
||||||
|
@Bean("threadPoolTaskExecutor") |
||||||
|
public ThreadPoolTaskExecutor threadPoolTaskExecutor(){ |
||||||
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); |
||||||
|
|
||||||
|
//设置核心线程数,线程池维护线程的最小数量,即使没有任务需要执行,也会一直存活
|
||||||
|
executor.setCorePoolSize(8); |
||||||
|
//如果设置allowCoreThreadTimeOut = true(默认是false)时,核心线程会超时关闭。
|
||||||
|
// executor.setAllowCoreThreadTimeOut(true);
|
||||||
|
//设置阻塞队列,当核心线程数达到最大时,新任务会放在该队列中排队等待执行
|
||||||
|
executor.setQueueCapacity(2000); |
||||||
|
//设置最大线程池数量,当线程数>corePoolSize(核心线程数),且阻塞队列满的时候。线程池会创建新线程池来处理业务
|
||||||
|
//阻塞队列已满时且当前线程数=maxPoolSize,线程池会拒绝处理任务二抛出异常
|
||||||
|
executor.setMaxPoolSize(64); |
||||||
|
//当线程空闲时间达到keepAliveSeconds时,线程会退出,直到线程数量=corePoolSize;
|
||||||
|
//允许线程空闲时间30s
|
||||||
|
executor.setKeepAliveSeconds(30); |
||||||
|
//Spring提供的ThreadPoolTaskExecutor提供setThreadNamePrefix()方法
|
||||||
|
//JDK提供的ThreadPoolExecutor不提供该方法
|
||||||
|
executor.setThreadNamePrefix("bellmann"); |
||||||
|
//拒绝策略,当pool达到最大时,如何处理新任务
|
||||||
|
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy()); |
||||||
|
executor.initialize(); |
||||||
|
return executor; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,66 @@ |
|||||||
|
package com.bellmann.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.common.model.Option; |
||||||
|
import com.bellmann.common.model.Tr069Xml; |
||||||
|
import com.bellmann.common.result.PageResult; |
||||||
|
import com.bellmann.common.result.Result; |
||||||
|
import com.bellmann.common.util.Tr069XmlUtils; |
||||||
|
import com.bellmann.model.form.Tr069VerForm; |
||||||
|
import com.bellmann.model.vo.Tr069VerVO; |
||||||
|
import com.bellmann.service.FileOptionService; |
||||||
|
import com.bellmann.service.Tr069VerService; |
||||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.io.InputStream; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Tag(name = "14.TR069数据模型") |
||||||
|
@RestController |
||||||
|
@RequestMapping("/api/tr069/v1") |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class Tr069VerController { |
||||||
|
|
||||||
|
private final Tr069VerService tr069VerService; |
||||||
|
|
||||||
|
private final FileOptionService fileOptionService; |
||||||
|
@PostMapping("/page") |
||||||
|
@Operation(summary = "tr069分页") |
||||||
|
public PageResult<Tr069VerVO> page(BasePageQuery query){ |
||||||
|
Page<Tr069VerVO> voPage = tr069VerService.page(query); |
||||||
|
return PageResult.success(voPage); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/tree/{fileId}") |
||||||
|
@Operation(summary = "tr069XML文件树") |
||||||
|
public Result<Tr069Xml> test(@PathVariable Long fileId){ |
||||||
|
InputStream download = fileOptionService.download(fileId); |
||||||
|
Tr069Xml tr069Xml = Tr069XmlUtils.parseXML(download); |
||||||
|
return Result.success(tr069Xml); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/tr069-model/option") |
||||||
|
@Operation(summary = "tr069文件选项") |
||||||
|
public Result<List<Option<Long>>> tr069ModelOption(){ |
||||||
|
return Result.success(tr069VerService.tr069ModelOption()); |
||||||
|
} |
||||||
|
@GetMapping("/{tr069Id}") |
||||||
|
@Operation(summary = "tr069表单") |
||||||
|
public Result<Tr069VerForm> tr069Form(@PathVariable Long tr069Id){ |
||||||
|
return Result.success(tr069VerService.tr069Form(tr069Id)); |
||||||
|
} |
||||||
|
@PostMapping("/edit") |
||||||
|
@Operation(summary = "修改tr069记录") |
||||||
|
public Result<Integer> editTr069Form(@RequestBody Tr069VerForm editTr069Form){ |
||||||
|
return Result.success(tr069VerService.editTr069Form(editTr069Form)); |
||||||
|
} |
||||||
|
@PostMapping("/add") |
||||||
|
@Operation(summary = "新增tr069记录") |
||||||
|
public Result<Integer> addTr069Form(@RequestBody Tr069VerForm editTr069Form){ |
||||||
|
return Result.success(tr069VerService.addTr069Form(editTr069Form)); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package com.bellmann.converter; |
||||||
|
|
||||||
|
import com.bellmann.model.entity.Service; |
||||||
|
import com.bellmann.model.vo.DeviceServiceVO; |
||||||
|
import org.mapstruct.Mapper; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
|
||||||
|
@Mapper(componentModel = "spring") |
||||||
|
public interface ServiceConverter { |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
package com.bellmann.converter; |
||||||
|
|
||||||
|
|
||||||
|
import com.bellmann.model.entity.Tr069Ver; |
||||||
|
import com.bellmann.model.form.Tr069VerForm; |
||||||
|
import org.mapstruct.Mapper; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 文件对象转换器 |
||||||
|
* |
||||||
|
* |
||||||
|
* @since 2022/7/29 |
||||||
|
*/ |
||||||
|
@Mapper(componentModel = "spring") |
||||||
|
public interface Tr069VerConverter { |
||||||
|
|
||||||
|
Tr069VerForm entity2Form(Tr069Ver tr069Ver); |
||||||
|
|
||||||
|
Tr069Ver form2Entity(Tr069VerForm editTr069Form); |
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
package com.bellmann.manger; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.model.vo.DeviceServiceVO; |
||||||
|
|
||||||
|
public interface ServiceManager { |
||||||
|
Page<DeviceServiceVO> pageDevVerService(Long typeAndVerId, BasePageQuery pageQuery); |
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
package com.bellmann.manger.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.converter.ServiceConverter; |
||||||
|
import com.bellmann.manger.ServiceManager; |
||||||
|
import com.bellmann.mapper.ServiceMapper; |
||||||
|
import com.bellmann.model.entity.Service; |
||||||
|
import com.bellmann.model.vo.DeviceServiceVO; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Component |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class ServiceManagerImpl implements ServiceManager { |
||||||
|
|
||||||
|
private final ServiceMapper serviceMapper; |
||||||
|
|
||||||
|
private final ServiceConverter serviceConverter; |
||||||
|
@Override |
||||||
|
public Page<DeviceServiceVO> pageDevVerService(Long typeAndVerId, BasePageQuery pageQuery) { |
||||||
|
int pageNum = pageQuery.getPageNum(); |
||||||
|
int pageSize = pageQuery.getPageSize(); |
||||||
|
Page<DeviceServiceVO> page = new Page<>(pageNum,pageSize); |
||||||
|
List<DeviceServiceVO> list = serviceMapper.pageDevVerService(page,typeAndVerId); |
||||||
|
return page.setRecords(list); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,15 @@ |
|||||||
|
package com.bellmann.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.model.entity.Service; |
||||||
|
import com.bellmann.model.vo.DeviceServiceVO; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Mapper |
||||||
|
public interface ServiceMapper extends BaseMapper<Service> { |
||||||
|
List<DeviceServiceVO> pageDevVerService(Page<DeviceServiceVO> page, @Param("typeAndVerId") Long typeAndVerId); |
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package com.bellmann.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.model.entity.Tr069Ver; |
||||||
|
import com.bellmann.model.vo.Tr069VerVO; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Mapper |
||||||
|
public interface Tr069VerMapper extends BaseMapper<Tr069Ver> { |
||||||
|
List<Tr069VerVO> tr069Page(Page<Tr069VerVO> page); |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package com.bellmann.model.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
@Data |
||||||
|
@TableName("itms_service") |
||||||
|
public class Service implements Serializable { |
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 3425958771027987055L; |
||||||
|
|
||||||
|
private Long servId; |
||||||
|
|
||||||
|
private String servName; |
||||||
|
|
||||||
|
private String servVerName; |
||||||
|
|
||||||
|
private String servDisplayName; |
||||||
|
|
||||||
|
private String servDesc; |
||||||
|
|
||||||
|
private Long pluginFileId; |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package com.bellmann.model.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.ToString; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
@Data |
||||||
|
@TableName("itms_tr069_ver") |
||||||
|
public class Tr069Ver implements Serializable { |
||||||
|
private static final long serialVersionUID = -1874730817920107148L; |
||||||
|
|
||||||
|
private Long tr069VerId; |
||||||
|
|
||||||
|
private String tr069VerName; |
||||||
|
|
||||||
|
private Date tr069VerCreateTime; |
||||||
|
|
||||||
|
private Date tr069VerModifyTime; |
||||||
|
|
||||||
|
private String tr069VerDesc; |
||||||
|
|
||||||
|
private Long fileId; |
||||||
|
} |
@ -0,0 +1,60 @@ |
|||||||
|
package com.bellmann.model.form; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-04-20 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@Schema(description = "文件记录表单") |
||||||
|
public class FileRecordForm { |
||||||
|
/** |
||||||
|
* 文件ID |
||||||
|
*/ |
||||||
|
@Schema(description = "文件ID") |
||||||
|
private Long fileId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文件类型 |
||||||
|
*/ |
||||||
|
@Schema(description = "文件类型") |
||||||
|
private String fileType; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文件名称 |
||||||
|
*/ |
||||||
|
@Schema(description = "文件名称") |
||||||
|
private String fileName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文件描述 |
||||||
|
*/ |
||||||
|
@Schema(description = "文件描述") |
||||||
|
private String fileDesc; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文件服务器ID |
||||||
|
*/ |
||||||
|
@Schema(description = "文件服务器ID") |
||||||
|
private Long fileServId; |
||||||
|
/** |
||||||
|
* 文件ftp保存地址 |
||||||
|
*/ |
||||||
|
@Schema(description = "文件ftp保存地址") |
||||||
|
private String fileUrl; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package com.bellmann.model.form; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Schema(description = "TR069模型表单") |
||||||
|
public class Tr069VerForm { |
||||||
|
|
||||||
|
@Schema(description = "id") |
||||||
|
private Long tr069VerId; |
||||||
|
|
||||||
|
@Schema(description = "名称") |
||||||
|
private String tr069VerName; |
||||||
|
|
||||||
|
@Schema(description = "描述信息") |
||||||
|
private String tr069VerDesc; |
||||||
|
|
||||||
|
@Schema(description = "文件ID") |
||||||
|
private Long fileId; |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package com.bellmann.model.vo; |
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Schema(description = "设备类型及设备软件版本支持的业务信息视图") |
||||||
|
public class DeviceServiceVO { |
||||||
|
|
||||||
|
@Schema(description = "id") |
||||||
|
private Long servId; |
||||||
|
|
||||||
|
@Schema(description = "业务名称") |
||||||
|
private String servName; |
||||||
|
|
||||||
|
@Schema(description = "业务版本") |
||||||
|
private String servVerName; |
||||||
|
|
||||||
|
@Schema(description = "业务显示名称") |
||||||
|
private String servDisplayName; |
||||||
|
|
||||||
|
@Schema(description = "业务描述") |
||||||
|
private String servDesc; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
package com.bellmann.model.vo; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Schema(description = "tr069数据模型列表视图") |
||||||
|
public class Tr069VerVO { |
||||||
|
|
||||||
|
@Schema(description = "id") |
||||||
|
private Long tr069VerId; |
||||||
|
|
||||||
|
@Schema(description = "模型名称") |
||||||
|
private String tr069VerName; |
||||||
|
|
||||||
|
@Schema(description = "描述信息") |
||||||
|
private String tr069VerDesc; |
||||||
|
|
||||||
|
@Schema(description = "文件名称") |
||||||
|
private String fileName; |
||||||
|
|
||||||
|
@Schema(description = "文件Id") |
||||||
|
private Long fileId; |
||||||
|
} |
@ -1,12 +1,27 @@ |
|||||||
package com.bellmann.service; |
package com.bellmann.service; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.common.model.Option; |
||||||
|
import com.bellmann.common.result.Result; |
||||||
import com.bellmann.model.query.DeviceTypeQuery; |
import com.bellmann.model.query.DeviceTypeQuery; |
||||||
import com.bellmann.model.vo.DeviceTypePageVO; |
import com.bellmann.model.vo.DeviceTypePageVO; |
||||||
import com.bellmann.model.vo.DeviceTypeVO; |
import com.bellmann.model.vo.DeviceTypeVO; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
public interface DeviceTypeService { |
public interface DeviceTypeService { |
||||||
Page<DeviceTypePageVO> page(DeviceTypeQuery query); |
Page<DeviceTypePageVO> page(DeviceTypeQuery query); |
||||||
|
|
||||||
DeviceTypeVO findDevTypeById(Long devTypeId); |
DeviceTypeVO findDevTypeById(Long devTypeId); |
||||||
|
|
||||||
|
List<Option<String>> vendorNameOption(); |
||||||
|
|
||||||
|
List<Option<String>> vendorOuiOption(String vendorName); |
||||||
|
|
||||||
|
List<Option<String>> typeNameOption(String vendorOui); |
||||||
|
|
||||||
|
List<Option<String>> hardVerOption(String typeName); |
||||||
|
|
||||||
|
Result<String> deleteByIds(ArrayList<Long> ids); |
||||||
} |
} |
||||||
|
@ -0,0 +1,4 @@ |
|||||||
|
package com.bellmann.service; |
||||||
|
|
||||||
|
public interface ServiceService { |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package com.bellmann.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.common.model.Option; |
||||||
|
import com.bellmann.model.form.Tr069VerForm; |
||||||
|
import com.bellmann.model.vo.Tr069VerVO; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface Tr069VerService { |
||||||
|
Page<Tr069VerVO> page(BasePageQuery query); |
||||||
|
|
||||||
|
List<Option<Long>> tr069ModelOption(); |
||||||
|
|
||||||
|
Tr069VerForm tr069Form(Long tr069Id); |
||||||
|
|
||||||
|
Integer editTr069Form(Tr069VerForm editTr069Form); |
||||||
|
|
||||||
|
Integer addTr069Form(Tr069VerForm editTr069Form); |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
package com.bellmann.service.impl; |
||||||
|
|
||||||
|
import com.bellmann.service.ServiceService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
@Service |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class ServiceServiceImpl implements ServiceService { |
||||||
|
} |
@ -0,0 +1,75 @@ |
|||||||
|
package com.bellmann.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.common.enums.FileTypeEnum; |
||||||
|
import com.bellmann.common.model.Option; |
||||||
|
import com.bellmann.converter.Tr069VerConverter; |
||||||
|
import com.bellmann.manger.FileRecordManager; |
||||||
|
import com.bellmann.mapper.Tr069VerMapper; |
||||||
|
import com.bellmann.model.entity.FileRecord; |
||||||
|
import com.bellmann.model.entity.Tr069Ver; |
||||||
|
import com.bellmann.model.form.Tr069VerForm; |
||||||
|
import com.bellmann.model.vo.Tr069VerVO; |
||||||
|
import com.bellmann.service.Tr069VerService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
@Service |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class Tr069VerServiceImpl implements Tr069VerService { |
||||||
|
|
||||||
|
private final Tr069VerMapper tr069VerMapper; |
||||||
|
|
||||||
|
private final FileRecordManager fileRecordManager; |
||||||
|
|
||||||
|
private final Tr069VerConverter tr069VerConverter; |
||||||
|
@Override |
||||||
|
public Page<Tr069VerVO> page(BasePageQuery query) { |
||||||
|
int pageNum = query.getPageNum(); |
||||||
|
int pageSize = query.getPageSize(); |
||||||
|
Page<Tr069VerVO> page = new Page<>(pageNum,pageSize); |
||||||
|
List<Tr069VerVO> list = tr069VerMapper.tr069Page(page); |
||||||
|
return page.setRecords(list); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<Option<Long>> tr069ModelOption() { |
||||||
|
List<FileRecord> list = fileRecordManager.findFileByType(FileTypeEnum.TR069_MODEL_FILE.getValue()); |
||||||
|
return list.stream().map(fileRecord -> { |
||||||
|
Option<Long> option = new Option<>(); |
||||||
|
option.setValue(fileRecord.getFileId()); |
||||||
|
option.setLabel(fileRecord.getFileName()); |
||||||
|
return option; |
||||||
|
}).collect(Collectors.toList()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Tr069VerForm tr069Form(Long tr069Id) { |
||||||
|
Tr069Ver tr069Ver = tr069VerMapper.selectOne(new LambdaQueryWrapper<Tr069Ver>() |
||||||
|
.eq(Tr069Ver::getTr069VerId, tr069Id) |
||||||
|
); |
||||||
|
return tr069VerConverter.entity2Form(tr069Ver); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Integer editTr069Form(Tr069VerForm editTr069Form) { |
||||||
|
Tr069Ver tr069Ver = tr069VerConverter.form2Entity(editTr069Form); |
||||||
|
tr069Ver.setTr069VerModifyTime(new Date()); |
||||||
|
return tr069VerMapper.update(tr069Ver,new LambdaQueryWrapper<Tr069Ver>() |
||||||
|
.eq(Tr069Ver::getTr069VerId,tr069Ver.getTr069VerId()) |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Integer addTr069Form(Tr069VerForm form) { |
||||||
|
Tr069Ver tr069Ver = tr069VerConverter.form2Entity(form); |
||||||
|
tr069Ver.setTr069VerCreateTime(new Date()); |
||||||
|
return tr069VerMapper.insert(tr069Ver) ; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper |
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.bellmann.mapper.ServiceMapper"> |
||||||
|
|
||||||
|
<select id="pageDevVerService" resultType="com.bellmann.model.vo.DeviceServiceVO"> |
||||||
|
SELECT |
||||||
|
itms_service.serv_id, |
||||||
|
itms_service.serv_name, |
||||||
|
itms_service.serv_ver_name, |
||||||
|
itms_service.serv_display_name, |
||||||
|
itms_service.serv_desc |
||||||
|
FROM |
||||||
|
itms_service |
||||||
|
INNER JOIN itms_tr069_service_map ON itms_service.serv_id = itms_tr069_service_map.serv_id |
||||||
|
INNER JOIN itms_device_type_ver ON itms_tr069_service_map.tr069_ver_id = itms_device_type_ver.tr069_ver_id |
||||||
|
WHERE |
||||||
|
itms_device_type_ver.type_and_ver_id = #{typeAndVerId} |
||||||
|
</select> |
||||||
|
</mapper> |
@ -0,0 +1,18 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper |
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.bellmann.mapper.Tr069VerMapper"> |
||||||
|
|
||||||
|
<select id="tr069Page" resultType="com.bellmann.model.vo.Tr069VerVO"> |
||||||
|
SELECT |
||||||
|
itms_tr069_ver.file_id, |
||||||
|
itms_tr069_ver.tr069_ver_desc, |
||||||
|
itms_tr069_ver.tr069_ver_id, |
||||||
|
itms_tr069_ver.tr069_ver_name, |
||||||
|
itms_file.file_name |
||||||
|
FROM |
||||||
|
itms_tr069_ver |
||||||
|
INNER JOIN itms_file ON itms_tr069_ver.file_id = itms_file.file_id; |
||||||
|
</select> |
||||||
|
</mapper> |
Loading…
Reference in new issue