123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- package com.steerinfo.dil.controller;
- import com.steerinfo.dil.feign.ESFeign;
- import com.steerinfo.dil.model.TmstruckReceiptResult;
- import com.steerinfo.dil.service.ITmstruckReceiptResultService;
- import com.steerinfo.dil.util.BaseRESTfulController;
- import com.steerinfo.dil.util.ColumnDataUtil;
- import com.steerinfo.dil.util.DataChange;
- import com.steerinfo.dil.util.PageListAdd;
- import com.steerinfo.framework.controller.RESTfulResult;
- import com.steerinfo.framework.service.pagehelper.PageHelper;
- import com.steerinfo.route.config.ImageFileUtils;
- import com.steerinfo.route.mapper.TmstruckArrivalResultMapper;
- import com.steerinfo.route.model.TmstruckReceiptResultChild;
- import com.steerinfo.route.service.impl.TmstruckReceiptResultChildServiceImpl;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiImplicitParams;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.math.BigDecimal;
- import java.text.SimpleDateFormat;
- import java.util.*;
- /**
- * TmstruckReceiptResult RESTful接口:
- * @author generator
- * @version 1.0-SNAPSHORT 2021-09-10 10:10
- * 类描述
- * 修订历史:
- * 日期:2021-09-10
- * 作者:generator
- * 参考:
- * 描述:TmstruckReceiptResult RESTful接口
- * @see null
- * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
- */
- @RestController
- @RequestMapping("/${api.version}/tmstruckreceiptresults")
- public class TmstruckReceiptResultController extends BaseRESTfulController {
- @Autowired
- ITmstruckReceiptResultService tmstruckReceiptResultService;
- @Autowired
- TmstruckArrivalResultMapper tmstruckArrivalResultMapper;
- @Autowired
- TmstruckReceiptResultChildServiceImpl tmstruckReceiptResultChildService;
- @Autowired
- ESFeign esFeign;
- @Autowired
- ColumnDataUtil columnDataUtil;
- @Autowired
- ImageFileUtils imageFileUtils;
- private final SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
- private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- // @ApiOperation(value="查询收货实绩")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
- // @ApiImplicitParam(name = "apiId(107)", value = "动态表头", required = false, dataType = "Integer"),
- // @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
- // @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
- // @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
- // })
- // @PostMapping("/getArrivalResult")
- // public RESTfulResult getArrivalResult(@RequestBody(required=false) Map<String,Object> mapValue,
- // Integer apiId,
- // Integer pageNum,
- // Integer pageSize,
- // Integer orderType,
- // String con
- // ){
- // mapValue.put("orderTypee", orderType);
- // PageHelper.startPage(pageNum,pageSize);
- // //分页数据
- // List<Map<String, Object>> receiveResult = tmstruckReceiptResultService.getReceiveResult(mapValue);
- // PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null,receiveResult);
- // return success(pageList);
- // }
- @ApiOperation(value="新增钢材到异地库达州站驻港人员确定收货")
- @PostMapping("/addSteelNzReceiptResult")
- public RESTfulResult addSteelNzReceiptResult(@RequestBody(required = false) Map<String, Object> map) {
- int i = tmstruckReceiptResultService.addSteelNzReceiptResult(map);
- return success(i);
- }
- /**
- * 新增收货实绩
- * @param map
- * @return
- */
- @ApiOperation(value="新增收货实绩")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "map", value = "收货实绩map", required = false, dataType = "java.util.Map")
- })
- @PostMapping(value = "/addTmstruckReceiptResult")
- public RESTfulResult addTmstruckReceiptResult(@RequestBody(required = false) Map<String, Object> map){
- BigDecimal alreadyExistsArrivalResult = tmstruckArrivalResultMapper.alreadyExistsArrivalResult((String) map.get("orderNumber"));
- if(alreadyExistsArrivalResult!=null){
- TmstruckReceiptResult tmstruckReceiptResult = new TmstruckReceiptResult();
- //获取运输订单号和收货点地址
- String orderNumber = (String) map.get("orderNumber");
- String resultArrivalAddress = (String) map.get("resultArrivalAddress");
- //获取空货箱照片、已签字的送货单照片
- String resultEmptyContainerPhoto = (String) map.get("url1");
- String resultSignedNotePhoto = (String) map.get("url2");
- tmstruckReceiptResult.setResultArrivalAddress(resultArrivalAddress);
- tmstruckReceiptResult.setResultEmptyContainerPhoto(resultEmptyContainerPhoto);
- tmstruckReceiptResult.setResultSignedNotePhoto(resultSignedNotePhoto);
- if(map.containsKey("url3")){
- //如果有,获取客户签收单照片
- String resultReceiveNotePhoto = (String) map.get("url3");
- tmstruckReceiptResult.setResultReceiveNotePhoto(resultReceiveNotePhoto);
- }
- //新增收货实绩主表
- BigDecimal receiptResultId = tmstruckReceiptResultService.addTmstruckReceiptResult(orderNumber, tmstruckReceiptResult);
- //初始化收货实绩子表信息
- TmstruckReceiptResultChild tmstruckReceiptResultChild = new TmstruckReceiptResultChild();
- //关联收货实绩主表
- tmstruckReceiptResultChild.setReceiptResultId(receiptResultId);
- //如果有,获取最多三张其他照片
- if(map.containsKey("fourFiles")){
- List<String> fourFiles = (List<String>) map.get("fourFiles");
- if(fourFiles.size()==0){}
- else if(fourFiles.size()==1){
- tmstruckReceiptResultChild.setOtherPhoto1(fourFiles.get(0));
- }else if(fourFiles.size()==2){
- tmstruckReceiptResultChild.setOtherPhoto1(fourFiles.get(0));
- tmstruckReceiptResultChild.setOtherPhoto2(fourFiles.get(1));
- }else {
- tmstruckReceiptResultChild.setOtherPhoto1(fourFiles.get(0));
- tmstruckReceiptResultChild.setOtherPhoto2(fourFiles.get(1));
- tmstruckReceiptResultChild.setOtherPhoto3(fourFiles.get(2));
- }
- }
- //新增收货实绩子表
- int i = tmstruckReceiptResultChildService.addTmstruckReceiptResultChild(tmstruckReceiptResultChild);
- return success(i);
- }else{
- return success(4);
- }
- }
- @ApiOperation(value="展示抵达实绩信息")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "apiId(470)", value = "表头", required = false, dataType = "Interger")
- })
- @PostMapping("/getArrivalResult")
- public RESTfulResult getArrivalResult(@RequestBody(required=false) Map<String, Object> mapValue,
- Integer apiId,
- Integer pageNum,
- Integer pageSize,
- String startTime,
- String endTime,
- String con){
- if (con != null && (con.equals("") || con.equals("undefined")) ) {
- con = null;
- }
- if (con != null && con.length() != 0) {
- mapValue.put("con","%" + con + "%");
- }
- DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);
- PageHelper.startPage(pageNum,pageSize);
- List<Map<String, Object>> receiptResultInfo = tmstruckReceiptResultService.getReceiptResultInfo(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId,null,receiptResultInfo);
- return success(pageList);
- }
- @ApiOperation(value = "获取抵达作业照片")
- @PostMapping("/getArrivalPhoto")
- public RESTfulResult getArrivalPhoto(@RequestParam String orderNumber){
- String receiptPhoto = tmstruckReceiptResultService.getReceiptPhoto(orderNumber);
- String photo =null;
- try {
- photo = imageFileUtils.downloadFile(receiptPhoto).toString();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return success(photo);
- }
- @ApiOperation(value="展示收货实绩信息")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "apiId(470)", value = "表头", required = false, dataType = "Interger")
- })
- @PostMapping("/getReceivingResult")
- public RESTfulResult getReceivingResult(@RequestBody(required=false) Map<String, Object> mapValue,
- Integer apiId,
- Integer pageNum,
- Integer pageSize,
- String startTime,
- String endTime,
- String con){
- if (con != null && (con.equals("") || con.equals("undefined")) ) {
- con = null;
- }
- if (con != null && con.length() != 0) {
- mapValue.put("con","%" + con + "%");
- }
- DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);
- PageHelper.startPage(pageNum,pageSize);
- List<Map<String, Object>> receiptResultInfo = tmstruckReceiptResultService.getReceivingResult(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId,null,receiptResultInfo);
- return success(pageList);
- }
- @ApiOperation(value = "获取收货作业照片")
- @PostMapping("/getReceivingPhoto")
- public RESTfulResult getReceivingPhoto(@RequestParam String orderNumber) throws Exception {
- List<Map<String,Object>> mapList = tmstruckReceiptResultService.getReceivingPhoto(orderNumber);
- Map<String,Object> result=new HashMap<>();
- for(Map<String,Object> map:mapList){
- if(map.containsKey("resultEmptyContainerPhoto") && map.get("resultEmptyContainerPhoto")!=null){
- String resultEmptyContainerPhoto = (String) imageFileUtils.downloadFile(map.get("resultEmptyContainerPhoto").toString());
- result.put("resultEmptyContainerPhoto",resultEmptyContainerPhoto);
- }
- if(map.containsKey("resultSignedNotePhoto") && map.get("resultSignedNotePhoto")!=null){
- String resultSignedNotePhoto = (String) imageFileUtils.downloadFile(map.get("resultSignedNotePhoto").toString());
- result.put("resultSignedNotePhoto",resultSignedNotePhoto);
- }
- //追加的图片
- if(map.containsKey("otherPhoto1") && map.get("otherPhoto1")!=null){
- String resultSignedNotePhoto =(String) imageFileUtils.downloadFile(map.get("otherPhoto1").toString());
- result.put("otherPhoto1",resultSignedNotePhoto);
- }
- if(map.containsKey("otherPhoto2") && map.get("otherPhoto2") !=null){
- String resultSignedNotePhoto =(String) imageFileUtils.downloadFile(map.get("otherPhoto2").toString());
- result.put("otherPhoto2",resultSignedNotePhoto);
- }
- if(map.containsKey("otherPhoto3") && map.get("otherPhoto3") !=null){
- String resultSignedNotePhoto =(String) imageFileUtils.downloadFile(map.get("otherPhoto3").toString());
- result.put("otherPhoto3",resultSignedNotePhoto);
- }
- }
- return success(result);
- }
- @ApiOperation(value = "获取收货作业照片")
- @PostMapping("/getReceivingPhotoByUrl")
- public Map<String,Object> getReceivingPhotoByUrl(@RequestParam String orderNumber) throws Exception {
- List<Map<String,Object>> mapList = tmstruckReceiptResultService.getReceivingPhoto(orderNumber);
- Map<String,Object> mapvalue = null;
- if (mapList!=null && mapList.size()>0){
- //必选的图片
- mapvalue=mapList.get(0);
- //追加的三张图片
- if(mapList.get(1)!=null){
- mapvalue.putAll(mapList.get(1));
- }
- }
-
- return mapvalue;
- }
- }
|