|
|
@ -1,5 +1,9 @@ |
|
|
|
package yq.web.controller.mine; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.FileInputStream; |
|
|
|
import java.io.FileNotFoundException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.util.List; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
@ -16,11 +20,14 @@ import org.springframework.web.bind.annotation.PathVariable; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
import yq.common.annotation.Log; |
|
|
|
import yq.common.core.controller.BaseController; |
|
|
|
import yq.common.core.domain.AjaxResult; |
|
|
|
import yq.common.enums.BusinessType; |
|
|
|
import yq.common.exception.ServiceException; |
|
|
|
import yq.common.utils.FaceEnginUtil; |
|
|
|
import yq.framework.config.ServerConfig; |
|
|
|
import yq.system.domain.MineFace; |
|
|
|
import yq.system.service.IMineFaceService; |
|
|
|
import yq.common.utils.poi.ExcelUtil; |
|
|
@ -39,6 +46,8 @@ public class MineFaceController extends BaseController |
|
|
|
@Autowired |
|
|
|
private IMineFaceService mineFaceService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ServerConfig serverConfig; |
|
|
|
/** |
|
|
|
* 查询【请填写功能名称】列表 |
|
|
|
*/ |
|
|
@ -78,11 +87,19 @@ public class MineFaceController extends BaseController |
|
|
|
* 新增【请填写功能名称】 |
|
|
|
*/ |
|
|
|
@PreAuthorize("@ss.hasPermi('system:face:add')") |
|
|
|
@Log(title = "【人脸录入】", businessType = BusinessType.INSERT) |
|
|
|
@Log(title = "【人脸数据录入】", businessType = BusinessType.INSERT) |
|
|
|
@PostMapping |
|
|
|
public AjaxResult add(@Validated @RequestBody MineFace mineFace) |
|
|
|
{ |
|
|
|
|
|
|
|
public AjaxResult add(@Validated @RequestBody MineFace mineFace) throws IOException { |
|
|
|
if(StrUtil.isNotEmpty(mineFace.getFaceUrl())){ |
|
|
|
String url = serverConfig.getUrl() + mineFace.getFaceUrl(); |
|
|
|
File file = new File(url); |
|
|
|
if(!file.exists()) { |
|
|
|
throw new ServiceException("文件不存在"); |
|
|
|
} |
|
|
|
FileInputStream fileInputStream = new FileInputStream(file); |
|
|
|
byte[] bytes = FaceEnginUtil.uploadInput(fileInputStream); |
|
|
|
mineFace.setFaceByte(bytes); |
|
|
|
} |
|
|
|
return toAjax(mineFaceService.insertMineFace(mineFace)); |
|
|
|
} |
|
|
|
|
|
|
@ -94,6 +111,8 @@ public class MineFaceController extends BaseController |
|
|
|
@PutMapping |
|
|
|
public AjaxResult edit(@RequestBody MineFace mineFace) |
|
|
|
{ |
|
|
|
MineFace face = mineFaceService.selectMineFaceById(mineFace.getId()); |
|
|
|
|
|
|
|
return toAjax(mineFaceService.updateMineFace(mineFace)); |
|
|
|
} |
|
|
|
|
|
|
|