20241230 更新
1.删除注释掉的代码
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.Interceptor;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* URL拦截, 做对应处理
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class URLInterceptor implements HandlerInterceptor {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(URLInterceptor.class);
|
||||
|
||||
/**
|
||||
* 请求前置处理(后置处理同理)
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param handler
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
String path = request.getServletPath();
|
||||
System.out.println(String.format("(entrustment 中的URL拦截) Request ---> Path=%s", path));
|
||||
return true;
|
||||
// logger.info(path);
|
||||
// if (path.matches("xxxxx")) {
|
||||
// logger.info("requestUrl: {}", path);
|
||||
// // 进行前置处理
|
||||
// return true;
|
||||
// // 或者 return false; 禁用某些请求
|
||||
// } else {
|
||||
// return true;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.Interceptor;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* 拦截器注入
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
@Autowired
|
||||
private URLInterceptor urlInterceptor;
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry){
|
||||
registry.addInterceptor(urlInterceptor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import digital.laboratory.platform.common.feign.RemoteWord2PDFService;
|
||||
import feign.Response;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Enumeration;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/papp/entrustment/test" )
|
||||
public class ATestController {
|
||||
private final RemoteWord2PDFService remoteWord2PDFService;
|
||||
|
||||
|
||||
@GetMapping("/convert")
|
||||
public String convert() throws IOException {
|
||||
|
||||
File file = new File("E:\\01.鉴定委托书--陕西分中心(1).docx");
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
MockMultipartFile mockMultipartFile = new MockMultipartFile("file", file.getName(), "image/jpg", fis);
|
||||
Response r = remoteWord2PDFService.word2pdf(mockMultipartFile);
|
||||
fis.close();
|
||||
File destFile = new File("E:\\", "test.pdf");
|
||||
FileUtils.copyInputStreamToFile(r.body().asInputStream(), destFile);
|
||||
return "OK";
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/ip")
|
||||
public String ip(HttpServletRequest request) throws IOException {
|
||||
String ret = "";
|
||||
|
||||
ret += "Request Headers:\n";
|
||||
ret += "---------------------------------\n";
|
||||
Enumeration headerNames = request.getHeaderNames();
|
||||
while(headerNames.hasMoreElements()){
|
||||
String paramName = (String)headerNames.nextElement();
|
||||
String paramValue = request.getHeader(paramName);
|
||||
ret += paramName+" = "+paramValue+"\n";
|
||||
}
|
||||
ret += "---------------------------------\n";
|
||||
ret += "\nrequest.getRequestedSessionId(): "+request.getRequestedSessionId();
|
||||
ret += "\nrequest.getMethod(): "+request.getMethod();
|
||||
ret += "\nrequest.getRequestURL(): "+request.getRequestURL();
|
||||
ret += "\nrequest.getRequestURI(): "+request.getRequestURI();
|
||||
ret += "\nrequest.getPathInfo(): "+request.getPathInfo();
|
||||
ret += "\nrequest.getContextPath(): "+request.getContextPath();
|
||||
ret += "\nrequest.getPathTranslated(): "+request.getPathTranslated();
|
||||
ret += "\nrequest.getQueryString(): "+request.getQueryString();
|
||||
ret += "\nrequest.getRemoteUser(): "+request.getRemoteUser();
|
||||
ret += "\nrequest.getRemoteAddr(): "+request.getRemoteAddr();
|
||||
ret += "\nrequest.getRemoteHost(): "+request.getRemoteHost();
|
||||
ret += "\nrequest.getRemotePort(): "+request.getRemotePort();
|
||||
ret += "\nrequest.getAuthType(): "+request.getAuthType();
|
||||
ret += "\nrequest.getServletPath(): "+request.getServletPath();
|
||||
|
||||
return "<pre>"+ret+"</pre>";
|
||||
}
|
||||
|
||||
String localVar = "";
|
||||
|
||||
@GetMapping("/var")
|
||||
public String var(@RequestParam(value = "var", required = false) String var, HttpServletRequest request) throws IOException {
|
||||
String ret = "";
|
||||
if (StrUtil.isNotBlank(var)) {
|
||||
localVar = var;
|
||||
ret += "Set localVar to ["+localVar+"]\n";
|
||||
}
|
||||
|
||||
ret += "localVar 的值是 ["+localVar+"]\n";
|
||||
|
||||
return "<pre>"+ret+"</pre>";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,196 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import digital.laboratory.platform.common.core.util.R;
|
||||
import digital.laboratory.platform.common.log.annotation.SysLog;
|
||||
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
|
||||
import digital.laboratory.platform.entrustment.entity.Deliverer;
|
||||
import digital.laboratory.platform.entrustment.service.DelivererService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.security.Principal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 送检员
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-08-16
|
||||
* @describe 送检员 前端控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/papp/entrustment/deliverer" )
|
||||
@Api(value = "deliverer", tags = "008-送检员管理")
|
||||
public class DelivererController {
|
||||
|
||||
private final DelivererService delivererService;
|
||||
|
||||
/**
|
||||
* 通过id查询送检员
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@GetMapping("/{id}" )
|
||||
// @PreAuthorize("@pms.hasPermission('entrustment_deliverer_get')" )
|
||||
public R getById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) {
|
||||
Principal principal = theHttpServletRequest.getUserPrincipal();
|
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
|
||||
|
||||
Deliverer deliverer = delivererService.getById(id);
|
||||
if (deliverer != null) {
|
||||
if (StrUtil.equalsIgnoreCase(dlpUser.getId(), deliverer.getOwnerUserId())) {
|
||||
return R.ok(deliverer);
|
||||
}
|
||||
else {
|
||||
return R.failed(String.format("你没有权限访问id为 %s 的送检员的数据", id));
|
||||
}
|
||||
}
|
||||
else {
|
||||
return R.failed(String.format("没有找到id为 %s 的送检员", id));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
* @param name 查询条件
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "列表查询", notes = "列表查询\n" +
|
||||
"参数:\n" +
|
||||
"<pre>\n" +
|
||||
"name 送检员名字, 可以模糊查询, 支持 like %name% " +
|
||||
"</pre>\n" +
|
||||
"")
|
||||
@GetMapping("/list" )
|
||||
// @PreAuthorize("@pms.hasPermission('entrustment_deliverer_get')" )
|
||||
public R getDelivererList(@RequestParam(value = "name", required = false)String name, HttpServletRequest theHttpServletRequest) {
|
||||
Principal principal = theHttpServletRequest.getUserPrincipal();
|
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
|
||||
//deliverer.setOwnerUserId(dlpUser.getId());
|
||||
|
||||
List<Deliverer> list = delivererService.list(Wrappers.<Deliverer>query()
|
||||
.eq("owner_user_id", dlpUser.getId()) // 只查询当前用户拥有的送检员
|
||||
.like(StrUtil.isNotBlank(name), "name", name)
|
||||
.orderByDesc("name")
|
||||
);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param deliverer 送检员
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@GetMapping("/page" )
|
||||
// @PreAuthorize("@pms.hasPermission('entrustment_deliverer_get')" )
|
||||
public R getDelivererPage(Page page, Deliverer deliverer, HttpServletRequest theHttpServletRequest) {
|
||||
Principal principal = theHttpServletRequest.getUserPrincipal();
|
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
|
||||
deliverer.setOwnerUserId(dlpUser.getId());
|
||||
|
||||
return R.ok(delivererService.page(page, Wrappers.<Deliverer>query()
|
||||
.eq("owner_user_id", dlpUser.getId()) // 只查询当前用户拥有的送检员
|
||||
.like(StrUtil.isNotBlank(deliverer.getName()), "name", deliverer.getName())
|
||||
.orderByDesc("name")
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增送检员
|
||||
* @param deliverer 送检员
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "新增送检员", notes = "新增送检员")
|
||||
@SysLog("新增送检员" )
|
||||
@PostMapping
|
||||
// @PreAuthorize("@pms.hasPermission('entrustment_deliverer_add')" )
|
||||
public R postAddObject(@RequestBody Deliverer deliverer, HttpServletRequest theHttpServletRequest) {
|
||||
Principal principal = theHttpServletRequest.getUserPrincipal();
|
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
|
||||
deliverer.setOwnerUserId(dlpUser.getId());
|
||||
deliverer.setId(IdWorker.get32UUID().toUpperCase());
|
||||
|
||||
if (delivererService.save(deliverer)) {
|
||||
return R.ok(deliverer, "新增送检员成功");
|
||||
}
|
||||
else {
|
||||
return R.failed(deliverer, "新增送检员失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改送检员
|
||||
* @param deliverer 送检员
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "修改送检员", notes = "修改送检员")
|
||||
@SysLog("修改送检员" )
|
||||
@PutMapping
|
||||
// @PreAuthorize("@pms.hasPermission('entrustment_deliverer_edit')" )
|
||||
public R putUpdateById(@RequestBody Deliverer deliverer, HttpServletRequest theHttpServletRequest) {
|
||||
Principal principal = theHttpServletRequest.getUserPrincipal();
|
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
|
||||
|
||||
Deliverer oldDeliverer = delivererService.getById(deliverer.getId());
|
||||
if (oldDeliverer != null) {
|
||||
if (StrUtil.equalsIgnoreCase(dlpUser.getId(), oldDeliverer.getOwnerUserId())) {
|
||||
deliverer.setOwnerUserId(dlpUser.getId());
|
||||
return R.ok(delivererService.updateById(deliverer));
|
||||
}
|
||||
else {
|
||||
return R.failed(String.format("你没有权限修改id为 %s 的送检员的数据", deliverer.getId()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
return R.failed(String.format("没有找到id为 %s 的送检员", deliverer.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除送检员
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除送检员", notes = "通过id删除送检员")
|
||||
@SysLog("通过id删除送检员" )
|
||||
@DeleteMapping("/{id}" )
|
||||
// @PreAuthorize("@pms.hasPermission('entrustment_deliverer_del')" )
|
||||
public R deleteById(@PathVariable String id, HttpServletRequest theHttpServletRequest) {
|
||||
Principal principal = theHttpServletRequest.getUserPrincipal();
|
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
|
||||
|
||||
Deliverer oldDeliverer = delivererService.getById(id);
|
||||
if (oldDeliverer != null) {
|
||||
if (StrUtil.equalsIgnoreCase(dlpUser.getId(), oldDeliverer.getOwnerUserId())) {
|
||||
if (delivererService.removeById(id)) {
|
||||
return R.ok(oldDeliverer, "送检员删除成功");
|
||||
}
|
||||
else {
|
||||
return R.failed(oldDeliverer, "送检员删除失败");
|
||||
}
|
||||
}
|
||||
else {
|
||||
return R.failed(String.format("你没有权限删除id为 %s 的送检员", id));
|
||||
}
|
||||
}
|
||||
else {
|
||||
return R.failed(String.format("没有找到id为 %s 的送检员", id));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import digital.laboratory.platform.common.core.util.R;
|
||||
import digital.laboratory.platform.common.log.annotation.SysLog;
|
||||
import digital.laboratory.platform.entrustment.entity.HairJob;
|
||||
import digital.laboratory.platform.entrustment.entity.SampleStoreLog;
|
||||
import digital.laboratory.platform.entrustment.service.HairJobService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 毛发检测任务
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-07-26
|
||||
* @describe 毛发检测任务 前端控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/papp/entrustment/hair_job" )
|
||||
@Api(value = "hair_job", tags = "毛发检测任务管理")
|
||||
public class HairJobController {
|
||||
|
||||
private final HairJobService hairJobService;
|
||||
|
||||
/**
|
||||
* 通过id查询毛发检测任务
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_get')" )
|
||||
public R getById(@PathVariable("id" ) String id) {
|
||||
return R.ok(hairJobService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param hairJob 毛发检测任务
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_get')" )
|
||||
public R<IPage<HairJob>> getHairJobPage(Page page, HairJob hairJob) {
|
||||
return R.ok(hairJobService.page(page, Wrappers.query(hairJob)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增毛发检测任务
|
||||
* @param hairJob 毛发检测任务
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "新增毛发检测任务", notes = "新增毛发检测任务")
|
||||
@SysLog("新增毛发检测任务" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_add')" )
|
||||
public R postAddObject(@RequestBody HairJob hairJob) {
|
||||
return R.ok(hairJobService.save(hairJob));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改毛发检测任务
|
||||
* @param hairJob 毛发检测任务
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "修改毛发检测任务", notes = "修改毛发检测任务")
|
||||
@SysLog("修改毛发检测任务" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_edit')" )
|
||||
public R putUpdateById(@RequestBody HairJob hairJob) {
|
||||
return R.ok(hairJobService.updateById(hairJob));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除毛发检测任务
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除毛发检测任务", notes = "通过id删除毛发检测任务")
|
||||
@SysLog("通过id删除毛发检测任务" )
|
||||
@DeleteMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_del')" )
|
||||
public R deleteById(@PathVariable String id) {
|
||||
return R.ok(hairJobService.removeById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import digital.laboratory.platform.common.core.util.R;
|
||||
import digital.laboratory.platform.common.log.annotation.SysLog;
|
||||
import digital.laboratory.platform.entrustment.entity.HairJobIdentificationMaterial;
|
||||
import digital.laboratory.platform.entrustment.service.HairJobIdentificationMaterialService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 毛发任务的检材信息
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-07-26
|
||||
* @describe 毛发任务的检材信息 前端控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/papp/entrustment/hair_job_identification_material" )
|
||||
@Api(value = "hair_job_identification_material", tags = "毛发任务的检材信息管理")
|
||||
public class HairJobIdentificationMaterialControllerx {
|
||||
|
||||
private final HairJobIdentificationMaterialService hairJobIdentificationMaterialService;
|
||||
|
||||
/**
|
||||
* 通过id查询毛发任务的检材信息
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_identification_material_get')" )
|
||||
public R<HairJobIdentificationMaterial> getById(@PathVariable("id" ) String id) {
|
||||
return R.ok(hairJobIdentificationMaterialService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param hairJobIdentificationMaterial 毛发任务的检材信息
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_identification_material_get')" )
|
||||
public R<IPage<HairJobIdentificationMaterial>> getHairJobIdentificationMaterialPage(Page page, HairJobIdentificationMaterial hairJobIdentificationMaterial) {
|
||||
return R.ok(hairJobIdentificationMaterialService.page(page, Wrappers.query(hairJobIdentificationMaterial)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增毛发任务的检材信息
|
||||
* @param hairJobIdentificationMaterial 毛发任务的检材信息
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "新增毛发任务的检材信息", notes = "新增毛发任务的检材信息")
|
||||
@SysLog("新增毛发任务的检材信息" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_identification_material_add')" )
|
||||
public R postAddObject(@RequestBody HairJobIdentificationMaterial hairJobIdentificationMaterial) {
|
||||
return R.ok(hairJobIdentificationMaterialService.save(hairJobIdentificationMaterial));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改毛发任务的检材信息
|
||||
* @param hairJobIdentificationMaterial 毛发任务的检材信息
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "修改毛发任务的检材信息", notes = "修改毛发任务的检材信息")
|
||||
@SysLog("修改毛发任务的检材信息" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_identification_material_edit')" )
|
||||
public R putUpdateById(@RequestBody HairJobIdentificationMaterial hairJobIdentificationMaterial) {
|
||||
return R.ok(hairJobIdentificationMaterialService.updateById(hairJobIdentificationMaterial));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除毛发任务的检材信息
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除毛发任务的检材信息", notes = "通过id删除毛发任务的检材信息")
|
||||
@SysLog("通过id删除毛发任务的检材信息" )
|
||||
@DeleteMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_identification_material_del')" )
|
||||
public R deleteById(@PathVariable String id) {
|
||||
return R.ok(hairJobIdentificationMaterialService.removeById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 送检员
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-08-16
|
||||
* @describe 送检员 实体类
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "b_deliverer", autoResultMap = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "送检员")
|
||||
public class Deliverer extends BaseEntity {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 送检员拥有者userId
|
||||
*/
|
||||
@ApiModelProperty(value="送检员拥有者userId")
|
||||
private String ownerUserId;
|
||||
|
||||
/**
|
||||
* 送检员姓名
|
||||
*/
|
||||
@ApiModelProperty(value="送检员姓名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 送检员职务
|
||||
*/
|
||||
@ApiModelProperty(value="送检员职务")
|
||||
private String position;
|
||||
|
||||
/**
|
||||
* 送检员证件名称
|
||||
*/
|
||||
@ApiModelProperty(value="送检员证件名称")
|
||||
private String cert;
|
||||
|
||||
/**
|
||||
* 送检员证件编号
|
||||
*/
|
||||
@ApiModelProperty(value="送检员证件编号")
|
||||
private String idnum;
|
||||
|
||||
/**
|
||||
* 送检员电话
|
||||
*/
|
||||
@ApiModelProperty(value="送检员电话")
|
||||
private String phone;
|
||||
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 毛发检测任务
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-07-26
|
||||
* @describe 毛发检测任务 实体类
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "b_hair_job", autoResultMap = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "毛发检测任务")
|
||||
public class HairJob extends BaseEntity {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value="id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 根任务id
|
||||
*/
|
||||
@ApiModelProperty(value="根任务id")
|
||||
private String rootId;
|
||||
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
@ApiModelProperty(value="任务名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 任务内容描述说明
|
||||
*/
|
||||
@ApiModelProperty(value="任务内容描述说明")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 任务编号
|
||||
*/
|
||||
@ApiModelProperty(value="任务编号")
|
||||
private String jobNo;
|
||||
|
||||
/**
|
||||
* 任务发布单位
|
||||
*/
|
||||
@ApiModelProperty(value="任务发布单位")
|
||||
private String jobIssueOrg;
|
||||
|
||||
/**
|
||||
* 任务执行单位
|
||||
*/
|
||||
@ApiModelProperty(value="任务执行单位")
|
||||
private String jobExecOrg;
|
||||
|
||||
/**
|
||||
* 任务来源
|
||||
*/
|
||||
@ApiModelProperty(value="任务来源")
|
||||
private String jobFrom;
|
||||
|
||||
/**
|
||||
* 任务截止日期
|
||||
*/
|
||||
@ApiModelProperty(value="任务截止日期")
|
||||
private LocalDateTime expirationDate;
|
||||
|
||||
/**
|
||||
* 任务开始日期
|
||||
*/
|
||||
@ApiModelProperty(value="任务开始日期")
|
||||
private LocalDateTime startDate;
|
||||
|
||||
/**
|
||||
* 任务备注
|
||||
*/
|
||||
@ApiModelProperty(value="任务备注")
|
||||
private String comments;
|
||||
|
||||
/**
|
||||
* 任务类型: 毛发检测/污水检测...
|
||||
*/
|
||||
@ApiModelProperty(value="任务类型: 毛发检测/污水检测...")
|
||||
private String jobType;
|
||||
|
||||
/**
|
||||
* xxx任务检测类型: 毛发检测:社区戒毒人员检测、公职人员、招考人员。/污水检测:污水处理厂、自然水体、其它水体。...
|
||||
*/
|
||||
@ApiModelProperty(value="xxx任务检测类型: 毛发检测:社区戒毒人员检测、公职人员、招考人员。/污水检测:污水处理厂、自然水体、其它水体。...")
|
||||
private String xxxjobIdentifyType;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,194 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 毛发任务的检材信息
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-07-26
|
||||
* @describe 毛发任务的检材信息 实体类
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "b_hair_job_identification_material", autoResultMap = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "毛发任务的检材信息")
|
||||
public class HairJobIdentificationMaterial extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 检材id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "检材id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 任务id
|
||||
*/
|
||||
@ApiModelProperty(value = "任务id")
|
||||
private String jobId;
|
||||
|
||||
/**
|
||||
* 任务清单项id
|
||||
*/
|
||||
@ApiModelProperty(value = "任务清单项id")
|
||||
private String jobItemId;
|
||||
|
||||
/**
|
||||
* 检材编号
|
||||
*/
|
||||
@ApiModelProperty(value = "检材编号")
|
||||
private String imNo;
|
||||
|
||||
/**
|
||||
* A样编号
|
||||
*/
|
||||
@ApiModelProperty(value = "A样编号")
|
||||
private String sample1No;
|
||||
|
||||
/**
|
||||
* B样编号
|
||||
*/
|
||||
@ApiModelProperty(value = "B样编号")
|
||||
private String sample2No;
|
||||
|
||||
/**
|
||||
* A样盒子
|
||||
*/
|
||||
@ApiModelProperty(value = "A样盒子")
|
||||
private String sample1BoxId;
|
||||
|
||||
/**
|
||||
* B样盒子
|
||||
*/
|
||||
@ApiModelProperty(value = "B样盒子")
|
||||
private String sample2BoxId;
|
||||
|
||||
/**
|
||||
* 所有者姓名
|
||||
*/
|
||||
@ApiModelProperty(value = "所有者姓名")
|
||||
private String personName;
|
||||
|
||||
/**
|
||||
* 所有者身份证号
|
||||
*/
|
||||
@ApiModelProperty(value = "所有者身份证号")
|
||||
private String personCard;
|
||||
|
||||
/**
|
||||
* 人员类别
|
||||
*/
|
||||
@ApiModelProperty(value = "人员类别")
|
||||
private String personType;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@ApiModelProperty(value = "项目名称")
|
||||
private String projectName;
|
||||
|
||||
// /**
|
||||
// * 社区戒毒人员在社区执行时间是否超过 6 个月
|
||||
// */
|
||||
// @ApiModelProperty(value = "社区戒毒人员在社区执行时间是否超过 6 个月")
|
||||
// private String executionTime;
|
||||
|
||||
/**
|
||||
* 曾经吸毒种类
|
||||
*/
|
||||
@ApiModelProperty(value = "曾经吸毒种类")
|
||||
private String drugType;
|
||||
|
||||
/**
|
||||
* 采样人
|
||||
*/
|
||||
@ApiModelProperty(value = "采样人")
|
||||
private String collector;
|
||||
|
||||
/**
|
||||
* 采样单位
|
||||
*/
|
||||
@ApiModelProperty(value = "采样单位")
|
||||
private String collectorGroup;
|
||||
|
||||
/**
|
||||
* 采样时间
|
||||
*/
|
||||
@ApiModelProperty(value = "采样时间")
|
||||
private LocalDateTime collectTime;
|
||||
|
||||
/**
|
||||
* 采样地点
|
||||
*/
|
||||
@ApiModelProperty(value = "采样地点")
|
||||
private String collectPlace;
|
||||
|
||||
/**
|
||||
* 监督人员
|
||||
*/
|
||||
@ApiModelProperty(value = "监督人员")
|
||||
private String supervisor;
|
||||
|
||||
/**
|
||||
* 受理时间
|
||||
*/
|
||||
@ApiModelProperty(value = "受理时间")
|
||||
private LocalDateTime acceptTime;
|
||||
|
||||
/**
|
||||
* 受理是否通过: 0=未受理, 1=受理通过, -1=受理被拒绝
|
||||
*/
|
||||
@ApiModelProperty(value = "受理是否通过: 0=未受理, 1=受理通过, -1=受理被拒绝")
|
||||
private Integer acceptPassed;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
/**
|
||||
* 检材名称
|
||||
*/
|
||||
@ApiModelProperty(value = "检材名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 检材数量
|
||||
*/
|
||||
@ApiModelProperty(value = "检材数量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
/**
|
||||
* A样数量
|
||||
*/
|
||||
@ApiModelProperty(value = "A样数量")
|
||||
private BigDecimal sample1Quantity;
|
||||
|
||||
/**
|
||||
* B样数量
|
||||
*/
|
||||
@ApiModelProperty(value = "B样数量")
|
||||
private BigDecimal sample2Quantity;
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
private String unit;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.handler;
|
||||
|
||||
import digital.laboratory.platform.common.core.entity.PersonFaceIdentifyInfo;
|
||||
import digital.laboratory.platform.common.core.util.Msg;
|
||||
import digital.laboratory.platform.common.core.util.R;
|
||||
import digital.laboratory.platform.sewage.entity.PersonalIdentityVerifier;
|
||||
import digital.laboratory.platform.sewage.feign.RemotePersonalIdentityVerifierService;
|
||||
import digital.laboratory.platform.sewage.feign.RemoteWebSocketService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ActiveMQListener {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ActiveMQListener.class);
|
||||
@Resource
|
||||
private RemoteWebSocketService webSocketService;
|
||||
@Resource
|
||||
private RemotePersonalIdentityVerifierService personalIdentityVerifierService;
|
||||
|
||||
/**
|
||||
*@Description: three MQ 接收方法
|
||||
*@Param:
|
||||
*@return:
|
||||
*@Author: gyDeBug
|
||||
*@date: 2021/9/30
|
||||
**/
|
||||
@JmsListener(destination = "${config.msgListener.hardwareTopicName}" ,containerFactory = "activeMQJmsListenerContainerFactory")
|
||||
public void receiveActiveMQ(Msg msg)throws Exception {
|
||||
Object obj =msg.getData();
|
||||
if (obj!=null) {
|
||||
if (obj instanceof PersonFaceIdentifyInfo) {
|
||||
//== 收到人脸识别消息
|
||||
PersonFaceIdentifyInfo info = (PersonFaceIdentifyInfo)obj;
|
||||
//查询该智能设备绑定的客户端电脑IP
|
||||
try{
|
||||
R<PersonalIdentityVerifier> data = personalIdentityVerifierService.getById(info.getDeviceId());
|
||||
if(data.getCode() == 200){
|
||||
String deviceIp = data.getData().getBindIp();
|
||||
//推送消息到人脸智能设备绑定的电脑
|
||||
R result = webSocketService.sendFaceRecognitionData(deviceIp,info);
|
||||
logger.info("推送消息结果:"+result.getMsg());
|
||||
}else{
|
||||
logger.info("==============服务调用异常!");
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("==============服务调用异常!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.handler;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
|
||||
import org.springframework.jms.config.JmsListenerContainerFactory;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author gyDeBug
|
||||
* @version 1.0
|
||||
* @date 2021/3/30 15:41
|
||||
* @description:ActiveMq多实例配置。
|
||||
*/
|
||||
@Configuration
|
||||
public class ActiveMqConfigs {
|
||||
|
||||
/**
|
||||
* activqmq 地址 账号密码注入
|
||||
* @param brokerUrl
|
||||
* @param username
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
@Bean(name = "activeMQConnectionFactory")
|
||||
public ActiveMQConnectionFactory activeMQConnectionFactory(
|
||||
@Value("${config.activemq.brokerUrl}") String brokerUrl,
|
||||
@Value("${config.activemq.user}") String username,
|
||||
@Value("${config.activemq.password}") String password) {
|
||||
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
|
||||
factory.setBrokerURL( brokerUrl );
|
||||
factory.setUserName( username );
|
||||
factory.setPassword( password );
|
||||
factory.setTrustedPackages(new ArrayList(Arrays.asList(
|
||||
("digital.laboratory.platform.common.core.util," +
|
||||
"digital.laboratory.platform.common.core.entity," +
|
||||
"java.time," +
|
||||
"java.time.chrono," +
|
||||
"java.io," +
|
||||
"java.lang"
|
||||
).split(","))));
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* JmsTemplate生成
|
||||
*
|
||||
* @param connectionFactory
|
||||
* @param pubSubDmain
|
||||
* @return
|
||||
*/
|
||||
@Bean(name = "activeMQJmsTemplate")
|
||||
public JmsTemplate activeMQJmsTemplate(
|
||||
@Qualifier("activeMQConnectionFactory") ActiveMQConnectionFactory connectionFactory,
|
||||
@Value("${config.activemq.pub-sub-domain}") boolean pubSubDmain) {
|
||||
JmsTemplate jmsTemplate = new JmsTemplate( connectionFactory );
|
||||
jmsTemplate.setPubSubDomain( pubSubDmain );
|
||||
return jmsTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* JmsListener工厂生成
|
||||
*
|
||||
* @param connectionFactory
|
||||
* @param pubSubDmain
|
||||
* @return
|
||||
*/
|
||||
@Bean(name = "activeMQJmsListenerContainerFactory")
|
||||
public JmsListenerContainerFactory activeMQJmsListenerContainerFactory(
|
||||
@Qualifier("activeMQConnectionFactory") ActiveMQConnectionFactory connectionFactory,
|
||||
@Value("${config.activemq.pub-sub-domain}") boolean pubSubDmain) {
|
||||
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
|
||||
factory.setConnectionFactory( connectionFactory );
|
||||
factory.setPubSubDomain( pubSubDmain );
|
||||
return factory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import digital.laboratory.platform.entrustment.entity.Deliverer;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 送检员 Mapper 接口
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-08-16
|
||||
* @describe 送检员 Mapper 类
|
||||
*/
|
||||
@Mapper
|
||||
public interface DelivererMapper extends BaseMapper<Deliverer> {
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import digital.laboratory.platform.entrustment.entity.HairJobIdentificationMaterial;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 毛发任务的检材信息 Mapper 接口
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-07-26
|
||||
* @describe 毛发任务的检材信息 Mapper 类
|
||||
*/
|
||||
@Mapper
|
||||
public interface HairJobIdentificationMaterialMapper extends BaseMapper<HairJobIdentificationMaterial> {
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import digital.laboratory.platform.entrustment.entity.HairJob;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 毛发检测任务 Mapper 接口
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-07-26
|
||||
* @describe 毛发检测任务 Mapper 类
|
||||
*/
|
||||
@Mapper
|
||||
public interface HairJobMapper extends BaseMapper<HairJob> {
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.misc;
|
||||
|
||||
import digital.laboratory.platform.common.core.constant.OSSDirectoryConstants;
|
||||
import digital.laboratory.platform.common.oss.service.OssFile;
|
||||
import digital.laboratory.platform.entrustment.handler.AppStartupRunner;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.velocity.VelocityContext;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class Template2html {
|
||||
private final OssFile ossFile;
|
||||
|
||||
/**
|
||||
* 根据模板生成检材标签的 html, 供 qz 打印使用
|
||||
*
|
||||
* @return html 字符串
|
||||
*/
|
||||
public String gethtml(String templateName, Map<String, Object> data) throws Exception {
|
||||
String templateFileName = AppStartupRunner.getCfg(templateName);
|
||||
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
ossFile.fileGet(OSSDirectoryConstants.TEMPLATE_DIRECTORY + "/"+ templateFileName, bos);
|
||||
String templateString = bos.toString("UTF-8");
|
||||
bos.close();
|
||||
|
||||
try {
|
||||
// 设置自定义指令使用的类
|
||||
Velocity.setProperty("userdirective",
|
||||
"digital.laboratory.platform.entrustment.misc.VelocityQRCodeImage," +
|
||||
"digital.laboratory.platform.entrustment.misc.VelocityBarCodeImage");
|
||||
//初始化模板
|
||||
Velocity.init();
|
||||
|
||||
//获取上下文
|
||||
VelocityContext context = new VelocityContext();
|
||||
//把数据填入上下文
|
||||
for (String key : data.keySet()) {
|
||||
context.put(key, data.get(key));
|
||||
}
|
||||
|
||||
StringWriter w = new StringWriter();
|
||||
Velocity.evaluate(context, w, "Velocity", templateString);
|
||||
w.flush();
|
||||
return w.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.misc;
|
||||
|
||||
import digital.laboratory.platform.entrustment.QRCodeUtils;
|
||||
import org.apache.velocity.context.InternalContextAdapter;
|
||||
import org.apache.velocity.exception.MethodInvocationException;
|
||||
import org.apache.velocity.exception.ParseErrorException;
|
||||
import org.apache.velocity.exception.ResourceNotFoundException;
|
||||
import org.apache.velocity.runtime.directive.Directive;
|
||||
import org.apache.velocity.runtime.parser.node.ASTIntegerLiteral;
|
||||
import org.apache.velocity.runtime.parser.node.ASTReference;
|
||||
import org.apache.velocity.runtime.parser.node.ASTStringLiteral;
|
||||
import org.apache.velocity.runtime.parser.node.Node;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
public class VelocityBarCodeImage extends Directive {
|
||||
@Override
|
||||
public String getName() {
|
||||
return "barcodeUrlData";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return LINE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染指令
|
||||
*
|
||||
* 模板中调用时, 格式化为: #qrcode(code [, width, height])
|
||||
* 参数 code 是必须的, 是字符串, 或字符串变量
|
||||
* 参数 width 和 height 是可选的, 是整数, 应该大于 0
|
||||
*
|
||||
* @param context
|
||||
* @param writer
|
||||
* @param node
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws ResourceNotFoundException
|
||||
* @throws ParseErrorException
|
||||
* @throws MethodInvocationException
|
||||
*/
|
||||
@Override
|
||||
public boolean render(InternalContextAdapter context, Writer writer,
|
||||
Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
|
||||
// System.out.println(String.format("node.jjtGetNumChildren()=%d", node.jjtGetNumChildren()));
|
||||
// for (int i=0; i<node.jjtGetNumChildren(); i++) {
|
||||
// Node sn = node.jjtGetChild(i);
|
||||
// System.out.println(String.format("node[%d] value=%s type=%d info=%d line=%d", i, sn.value(context), sn.getType(), sn.getInfo(), sn.getLine() ));
|
||||
// }
|
||||
if (node.jjtGetNumChildren()<1) {
|
||||
throw new IllegalArgumentException("必须要提供一个参数");
|
||||
//return false;
|
||||
}
|
||||
|
||||
String code = "nocode";
|
||||
int width = 400;
|
||||
int height = 30;
|
||||
|
||||
if (node.jjtGetNumChildren()>0) {
|
||||
Node sn = node.jjtGetChild(0);
|
||||
if ((sn instanceof ASTStringLiteral) || (sn instanceof ASTReference)) {
|
||||
code = (String)sn.value(context);
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("未知的参数类型: " + sn.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (node.jjtGetNumChildren()>1) {
|
||||
Node sn = node.jjtGetChild(1);
|
||||
if ((sn instanceof ASTIntegerLiteral) /*|| (sn instanceof ASTReference)*/) {
|
||||
Integer w =(Integer)sn.value(context);
|
||||
if ((w != null) && (w > 0)) {
|
||||
width = w;
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("未知的参数类型: " + sn.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (node.jjtGetNumChildren()>2) {
|
||||
Node sn = node.jjtGetChild(2);
|
||||
if ((sn instanceof ASTIntegerLiteral) /*|| (sn instanceof ASTReference)*/) {
|
||||
Integer h =(Integer)sn.value(context);
|
||||
if ((h != null) && (h > 0)) {
|
||||
height = h;
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("未知的参数类型: " + sn.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
String r = QRCodeUtils.getBarCode128ImageBase64(code, width, height);
|
||||
|
||||
writer.write(r);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.misc;
|
||||
|
||||
import digital.laboratory.platform.entrustment.QRCodeUtils;
|
||||
import org.apache.velocity.VelocityContext;
|
||||
import org.apache.velocity.app.VelocityEngine;
|
||||
import org.apache.velocity.context.InternalContextAdapter;
|
||||
import org.apache.velocity.exception.MethodInvocationException;
|
||||
import org.apache.velocity.exception.ParseErrorException;
|
||||
import org.apache.velocity.exception.ResourceNotFoundException;
|
||||
import org.apache.velocity.runtime.directive.Directive;
|
||||
import org.apache.velocity.runtime.parser.node.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class VelocityQRCodeImage extends Directive {
|
||||
@Override
|
||||
public String getName() {
|
||||
return "qrcodeUrlData";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return LINE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染指令
|
||||
*
|
||||
* 模板中调用时, 格式化为: #qrcode(code [, width, height])
|
||||
* 参数 code 是必须的, 是字符串, 或字符串变量
|
||||
* 参数 width 和 height 是可选的, 是整数, 应该大于 0
|
||||
*
|
||||
* @param context
|
||||
* @param writer
|
||||
* @param node
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws ResourceNotFoundException
|
||||
* @throws ParseErrorException
|
||||
* @throws MethodInvocationException
|
||||
*/
|
||||
@Override
|
||||
public boolean render(InternalContextAdapter context, Writer writer,
|
||||
Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
|
||||
// System.out.println(String.format("node.jjtGetNumChildren()=%d", node.jjtGetNumChildren()));
|
||||
// for (int i=0; i<node.jjtGetNumChildren(); i++) {
|
||||
// Node sn = node.jjtGetChild(i);
|
||||
// System.out.println(String.format("node[%d] value=%s type=%d info=%d line=%d", i, sn.value(context), sn.getType(), sn.getInfo(), sn.getLine() ));
|
||||
// }
|
||||
if (node.jjtGetNumChildren()<1) {
|
||||
throw new IllegalArgumentException("必须要提供一个参数");
|
||||
//return false;
|
||||
}
|
||||
|
||||
String code = "nocode";
|
||||
int width = 150;
|
||||
int height = 150;
|
||||
|
||||
if (node.jjtGetNumChildren()>0) {
|
||||
Node sn = node.jjtGetChild(0);
|
||||
if ((sn instanceof ASTStringLiteral) || (sn instanceof ASTReference)) {
|
||||
code = (String)sn.value(context);
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("未知的参数类型: " + sn.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (node.jjtGetNumChildren()>1) {
|
||||
Node sn = node.jjtGetChild(1);
|
||||
if ((sn instanceof ASTIntegerLiteral) /*|| (sn instanceof ASTReference)*/) {
|
||||
Integer w =(Integer)sn.value(context);
|
||||
if ((w != null) && (w > 0)) {
|
||||
width = w;
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("未知的参数类型: " + sn.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (node.jjtGetNumChildren()>2) {
|
||||
Node sn = node.jjtGetChild(2);
|
||||
if ((sn instanceof ASTIntegerLiteral) /*|| (sn instanceof ASTReference)*/) {
|
||||
Integer h =(Integer)sn.value(context);
|
||||
if ((h != null) && (h > 0)) {
|
||||
height = h;
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("未知的参数类型: " + sn.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
String r = QRCodeUtils.getQRCodeImageBase64(code, width, height);
|
||||
|
||||
writer.write(r);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import digital.laboratory.platform.entrustment.entity.CaseEvidence;
|
||||
import digital.laboratory.platform.entrustment.entity.Deliverer;
|
||||
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
|
||||
import digital.laboratory.platform.entrustment.entity.Taker;
|
||||
|
||||
/**
|
||||
* 送检员服务类
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-08-16
|
||||
* @describe 送检员 服务类
|
||||
*/
|
||||
public interface DelivererService extends IService<Deliverer> {
|
||||
|
||||
/**
|
||||
* 更新送检员
|
||||
* 以送检员的名字为关键字, 如果同名送检员存在, 更新其他属性; 如果同名送检员不存在, 则新增数据库记录
|
||||
* @param deliverer
|
||||
*/
|
||||
boolean renew(Deliverer deliverer);
|
||||
|
||||
Deliverer getByName(String name, String ownerUserId);
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import digital.laboratory.platform.entrustment.entity.Deliverer;
|
||||
import digital.laboratory.platform.entrustment.mapper.DelivererMapper;
|
||||
import digital.laboratory.platform.entrustment.service.DelivererService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 送检员服务实现类
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-08-16
|
||||
* @describe 送检员 服务实现类
|
||||
*/
|
||||
@Service
|
||||
public class DelivererServiceImpl extends ServiceImpl<DelivererMapper, Deliverer> implements DelivererService {
|
||||
/**
|
||||
* 更新送检员
|
||||
* 以送检员的名字为关键字, 如果同名送检员存在, 更新其他属性; 如果同名送检员不存在, 则新增数据库记录
|
||||
* @param deliverer
|
||||
*/
|
||||
@Override
|
||||
public boolean renew(Deliverer deliverer) {
|
||||
if (StrUtil.isBlank(deliverer.getName())) {
|
||||
return false;
|
||||
}
|
||||
List<Deliverer> list = baseMapper.selectList(Wrappers.<Deliverer>query()
|
||||
.eq("owner_user_id", deliverer.getOwnerUserId())
|
||||
.eq("name", deliverer.getName())
|
||||
);
|
||||
|
||||
if (list.size() > 0) {
|
||||
//== 存在同名送检员, 更新之
|
||||
deliverer.setId(list.get(0).getId());
|
||||
baseMapper.update(deliverer, Wrappers.<Deliverer>query()
|
||||
.eq("owner_user_id", deliverer.getOwnerUserId())
|
||||
.eq("name", deliverer.getName())
|
||||
);
|
||||
}
|
||||
else {
|
||||
deliverer.setId(IdWorker.get32UUID().toUpperCase());
|
||||
baseMapper.insert(deliverer);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Deliverer getByName(String name, String ownerUserId) {
|
||||
Deliverer deliverer = baseMapper.selectOne(Wrappers.<Deliverer>query()
|
||||
.eq("owner_user_id", ownerUserId)
|
||||
.eq("name", name)
|
||||
);
|
||||
return deliverer;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import digital.laboratory.platform.entrustment.entity.HairJobIdentificationMaterial;
|
||||
import digital.laboratory.platform.entrustment.mapper.HairJobIdentificationMaterialMapper;
|
||||
import digital.laboratory.platform.entrustment.service.HairJobIdentificationMaterialService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 毛发任务的检材信息服务实现类
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-07-26
|
||||
* @describe 毛发任务的检材信息 服务实现类
|
||||
*/
|
||||
@Service
|
||||
public class HairJobIdentificationMaterialServiceImpl extends ServiceImpl<HairJobIdentificationMaterialMapper, HairJobIdentificationMaterial> implements HairJobIdentificationMaterialService {
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import digital.laboratory.platform.entrustment.entity.HairJob;
|
||||
import digital.laboratory.platform.entrustment.mapper.HairJobMapper;
|
||||
import digital.laboratory.platform.entrustment.service.HairJobService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 毛发检测任务服务实现类
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-07-26
|
||||
* @describe 毛发检测任务 服务实现类
|
||||
*/
|
||||
@Service
|
||||
public class HairJobServiceImpl extends ServiceImpl<HairJobMapper, HairJob> implements HairJobService {
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import digital.laboratory.platform.entrustment.entity.HairJobIdentificationMaterial;
|
||||
|
||||
/**
|
||||
* 毛发任务的检材信息服务类
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-07-26
|
||||
* @describe 毛发任务的检材信息 服务类
|
||||
*/
|
||||
public interface HairJobIdentificationMaterialService extends IService<HairJobIdentificationMaterial> {
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package digital.laboratory.platform.entrustment.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import digital.laboratory.platform.entrustment.entity.HairJob;
|
||||
|
||||
/**
|
||||
* 毛发检测任务服务类
|
||||
*
|
||||
* @author Zhang Xiaolong created at 2022-07-26
|
||||
* @describe 毛发检测任务 服务类
|
||||
*/
|
||||
public interface HairJobService extends IService<HairJob> {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user