| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import cn.hutool.core.util.CreditCodeUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.SuccessTip; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TDriverCommissionResp; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TDriverResp; |
| | | import com.stylefeng.guns.modular.system.controller.util.*; |
| | | import com.stylefeng.guns.modular.system.controller.util.ExcelUtil; |
| | | import com.stylefeng.guns.modular.system.controller.util.HttpUtils; |
| | | import com.stylefeng.guns.modular.system.controller.util.TokenUtils; |
| | | import com.stylefeng.guns.modular.system.controller.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.enums.UserTypeEnum; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.model.TDriver; |
| | | import com.stylefeng.guns.modular.system.model.TRechargeRecord; |
| | | import com.stylefeng.guns.modular.system.model.TRegion; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.logging.log4j.core.util.UuidUtil; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | |
| | | private TokenUtils tokenUtils; |
| | | @Autowired |
| | | private ITRechargeRecordService tRechargeRecordService; |
| | | |
| | | private Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | |
| | | */ |
| | | @RequestMapping(value = "/ocr") |
| | | @ResponseBody |
| | | public Object ocr(String imgUrl) { |
| | | public JSONObject ocr(MultipartFile multipartFile) { |
| | | /*String accessToken = redisTemplate.opsForValue().get(TokenUtils.ACCESS_TOKEN_CACHE_KEY); |
| | | if (!StringUtils.hasLength(accessToken)) { |
| | | accessToken = tokenUtils.getSimpleAccessToken(); |
| | |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | System.err.println(jsonObject); |
| | | return jsonObject;*/ |
| | | return tDriverService.ocr(imgUrl); |
| | | String originalFilename = multipartFile.getOriginalFilename(); |
| | | String[] filename = originalFilename.split("\\."); |
| | | log.info("tupian::"+filename[0]+"//"+filename[1]); |
| | | File file= null; |
| | | try { |
| | | file = File.createTempFile(filename[0], "."+filename[1]); |
| | | multipartFile.transferTo(file); |
| | | file.deleteOnExit(); |
| | | log.info("file:"+file.getName()); |
| | | } catch (IOException e) { |
| | | log.error("ocr识别失败:{}",e.getMessage()); |
| | | } |
| | | return tDriverService.ocr(file); |
| | | } |
| | | |
| | | /** |