|
|
@ -1,11 +1,16 @@ |
|
|
|
package com.ccsens.wisdomcar.api; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import com.ccsens.cloudutil.annotation.MustLogin; |
|
|
|
import com.ccsens.util.JsonResponse; |
|
|
|
import com.ccsens.util.baidu.BaiDuDto; |
|
|
|
import com.ccsens.util.baidu.BaiDuUtil; |
|
|
|
import com.ccsens.util.baidu.BaiDuVo; |
|
|
|
import com.ccsens.util.bean.dto.QueryDto; |
|
|
|
import com.ccsens.wisdomcar.bean.dto.ProjectDto; |
|
|
|
import com.ccsens.wisdomcar.bean.vo.ProjectVo; |
|
|
|
import com.ccsens.wisdomcar.service.IProjectService; |
|
|
|
import com.ccsens.wisdomcar.util.Constant; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
@ -17,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMethod; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -51,4 +57,31 @@ public class ProjectController { |
|
|
|
log.info("查询称重和剂量:{}", list); |
|
|
|
return JsonResponse.newInstance().ok(list); |
|
|
|
} |
|
|
|
@MustLogin |
|
|
|
@ApiOperation(value = "查询开始时间", notes = "whj") |
|
|
|
@RequestMapping(value = "/getStartTime", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|
|
|
public JsonResponse<ProjectVo.GetStartTime> getStartTime(@ApiParam @Validated @RequestBody QueryDto<ProjectDto.GetStartTime> params){ |
|
|
|
log.info("查询开始时间:{}", params); |
|
|
|
ProjectVo.GetStartTime time = projectService.getStartTime(params.getParam(), params.getUserId()); |
|
|
|
log.info("查询开始时间结束:{}", time); |
|
|
|
return JsonResponse.newInstance().ok(time); |
|
|
|
} |
|
|
|
@MustLogin |
|
|
|
@ApiOperation(value = "图像识别", notes = "whj") |
|
|
|
@RequestMapping(value = "/identifyWords", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|
|
|
public JsonResponse<List<BaiDuVo.GeneralWord>> identifyWords(@ApiParam @Validated @RequestBody QueryDto<ProjectDto.Img> params){ |
|
|
|
log.info("图像识别:{}", params); |
|
|
|
BaiDuDto.GeneralBasic basic = new BaiDuDto.GeneralBasic(); |
|
|
|
basic.setUrl(params.getParam().getUrl()); |
|
|
|
BaiDuVo.GeneralBasic words = BaiDuUtil.accurateBasic(Constant.BaiDu.APP_KEY, Constant.BaiDu.SECRET_KEY, basic); |
|
|
|
List<BaiDuVo.GeneralWord> result; |
|
|
|
if (words != null && CollectionUtil.isNotEmpty(words.getWordsResult())) { |
|
|
|
result = words.getWordsResult(); |
|
|
|
} else { |
|
|
|
result = new ArrayList<>(); |
|
|
|
} |
|
|
|
log.info("图像识别结束:{}", result); |
|
|
|
return JsonResponse.newInstance().ok(result); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|