Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f4669efb10
|
|
@ -156,4 +156,28 @@ public class HttpHelper {
|
|||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 不带鉴权的请求
|
||||
* @param url
|
||||
* @param JSONBody
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String sendHttpPostForToken(String url, String JSONBody) throws Exception {
|
||||
System.err.println("JSONBody-=========:" + JSONBody);
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
httpPost.addHeader("Content-Type", "application/json");
|
||||
httpPost.setEntity(new StringEntity(JSONBody));
|
||||
CloseableHttpResponse response = httpClient.execute(httpPost);
|
||||
// System.out.println(response.getStatusLine().getStatusCode() + "\n");
|
||||
HttpEntity entity = response.getEntity();
|
||||
String responseContent = EntityUtils.toString(entity, "UTF-8");
|
||||
// System.out.println(responseContent);
|
||||
response.close();
|
||||
httpClient.close();
|
||||
return responseContent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.repair.controller;
|
||||
|
||||
import com.bonus.common.biz.utils.HttpHelper;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
|
|
@ -7,6 +8,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.material.repair.domain.*;
|
||||
import com.bonus.material.repair.domain.vo.OCRBean;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceSummaryVo;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
|
||||
import com.bonus.material.repair.domain.vo.RepairInputDetailsVo;
|
||||
|
|
@ -19,7 +21,8 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
|
@ -200,4 +203,36 @@ public class RepairController extends BaseController {
|
|||
List<RepairInputDetailsVo> list = service.getRepairedDetailList(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取Ocr code")
|
||||
@RequestMapping(value = "getOcrCode", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public JSONObject getOcrCode(OCRBean o) {
|
||||
String url = "http://10.138.55.102:10000/api_gqj/pre";
|
||||
JSONObject js = null;
|
||||
try {
|
||||
String jsonStr = JSONObject.toJSONString(o);
|
||||
String data = "{\"code\": \"fack_code\"}"; //HttpHelper.sendHttpPostForToken(url, jsonStr);
|
||||
js = JSONObject.parseObject(data);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return js;
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// String url = "http://10.138.55.102:10000/api_gqj/pre";
|
||||
// JSONObject js = null;
|
||||
// try {
|
||||
// OCRBean o = new OCRBean();
|
||||
// String jsonStr = JSONObject.toJSONString(o);
|
||||
// String data = "{\"code\": \"fack_code\"}"; //HttpHelper.sendHttpPostForToken(url, jsonStr);
|
||||
// js = JSONObject.parseObject(data);
|
||||
// System.out.println(js);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.material.repair.domain.vo;
|
||||
|
||||
public class OCRBean {
|
||||
|
||||
private String image;
|
||||
private String jiju_type;
|
||||
private String auth_lic;
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
public void setImage(String image) {
|
||||
this.image = image;
|
||||
}
|
||||
public String getJiju_type() {
|
||||
return jiju_type;
|
||||
}
|
||||
public void setJiju_type(String jiju_type) {
|
||||
this.jiju_type = jiju_type;
|
||||
}
|
||||
public String getAuth_lic() {
|
||||
return auth_lic;
|
||||
}
|
||||
public void setAuth_lic(String auth_lic) {
|
||||
this.auth_lic = auth_lic;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
Map<Long, List<RepairDeviceVO>> map = repairDeviceList.stream().collect(Collectors.groupingBy(RepairDeviceVO::getTypeId));
|
||||
for (Long key : map.keySet()) {
|
||||
List<RepairDeviceVO> tempList = map.get(key);
|
||||
List<RepairDeviceVO> toRepairList = tempList.stream().filter(o -> !"1".equals(o.getStatus())).collect(Collectors.toList());
|
||||
//List<RepairDeviceVO> toRepairList = tempList.stream().filter(o -> !"1".equals(o.getStatus())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(tempList)) {
|
||||
RepairDeviceSummaryVo vo = new RepairDeviceSummaryVo();
|
||||
Long[] ids = tempList.stream().map(RepairDeviceVO::getId).toArray(Long[]::new);
|
||||
|
|
@ -88,7 +88,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
int repairedNumSum = tempList.stream().mapToInt(RepairDeviceVO::getRepairedNum).sum();
|
||||
int scrapNumSum = tempList.stream().mapToInt(RepairDeviceVO::getScrapNum).sum();
|
||||
//BigDecimal typeCostSum = tempList.stream().map(RepairDeviceVO::getTotalCost).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
vo.setRepairDeviceList(toRepairList);
|
||||
vo.setRepairDeviceList(tempList);
|
||||
vo.setIds(ids);
|
||||
vo.setTypeRepairNum(repairNumSum);
|
||||
vo.setTypeRepairedNum(repairedNumSum);
|
||||
|
|
|
|||
Loading…
Reference in New Issue