123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- package com.steerinfo.dil.controller;
- import com.steerinfo.dil.service.ITmstruckTotalResultService;
- 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 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.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import java.math.BigDecimal;
- import java.text.SimpleDateFormat;
- import java.util.List;
- import java.util.Map;
- /**
- * @ author :TXF
- * @ time :2021/10/27 10:24
- */
- @RestController
- @RequestMapping("/${api.version}/tmstrucktotalresults")
- public class TmstruckTotalResultController extends BaseRESTfulController {
- @Autowired
- ITmstruckTotalResultService tmstruckTotalResultService;
- @Autowired
- ColumnDataUtil columnDataUtil;
- private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- @ApiOperation(value="添加总实绩 ")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "map", value = "订单Id", required = false, dataType = "Map"),
- })
- @PostMapping("/addTotalResult")
- public int addTotalResult(@RequestBody(required=false) Map<String, Object> map){
- BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
- int i = tmstruckTotalResultService.addTotalResult(orderId);
- return i;
- }
- @ApiOperation(value="继续装补录实绩 ")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "map", value = "订单Id", required = false, dataType = "Map"),
- })
- @PostMapping("/copyAllResult")
- public int copyAllResult(@RequestBody(required=false) Map<String, Object> map){
- BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
- BigDecimal orderIdOld = DataChange.dataToBigDecimal(map.get("orderIdOld"));
- BigDecimal resultTotalIdOld = DataChange.dataToBigDecimal(map.get("resultTotalIdOld"));
- int i = tmstruckTotalResultService.copyAllResult(orderId,orderIdOld,resultTotalIdOld);
- return i;
- }
- /**
- * 展示计数实绩列表
- *
- */
- @ApiOperation(value="查询计数实绩列表")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
- @ApiImplicitParam(name = "apiId(364)", 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("/selectCountList")
- public RESTfulResult selectCountList(@RequestBody(required=false) Map<String,Object> mapValue,
- Integer apiId,
- Integer pageNum,
- Integer pageSize
- ){
- //不分页筛选数据
- PageHelper.startPage(pageNum,pageSize);
- //分页数据
- List<Map<String, Object>> countList = tmstruckTotalResultService.selectCountList(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null,countList);
- return success(pageList);
- }
- @ApiOperation(value="查询所有的包月作业实绩")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
- @ApiImplicitParam(name = "apiId(365)", 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("/getTmstruckMonthResult")
- public RESTfulResult getTmstruckMonthResult(@RequestBody(required=false) Map<String,Object> mapValue,
- Integer apiId,
- Integer pageNum,
- Integer pageSize
- ){
- //不分页筛选数据
- PageHelper.startPage(pageNum,pageSize);
- //分页数据
- List<Map<String, Object>> qualityResult = tmstruckTotalResultService.getTmstruckMonthResult(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null,qualityResult);
- return success(pageList);
- }
- @PostMapping("/getAllReverseResult")
- public RESTfulResult getAllReverseResult(@RequestBody(required=false) Map<String,Object> mapValue,
- Integer apiId,
- Integer pageNum,
- Integer pageSize,
- String con,
- String userId,
- String startTime,
- String endTime){
- PageHelper.startPage(pageNum,pageSize);
- mapValue.put("con",con);
- mapValue.put("userId",userId);
- DataChange.queryDataByDateTime(startTime,endTime,mapValue,sdfDateTime);
- //分页查询
- List<Map<String, Object>> qualityResult = tmstruckTotalResultService.getAllReverseResult(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null,qualityResult);
- return success(pageList);
- }
- /**
- * 修改订单线路ID,并迁移实绩。目前仅支持采购辅料
- * @param mapValue
- * @return
- */
- @PostMapping("/changeOrderLine")
- public RESTfulResult changeOrderLine(@RequestBody(required=false) Map<String,Object> mapValue){
- try{
- tmstruckTotalResultService.changeOrderLine(mapValue);
- }catch (Exception e){
- e.printStackTrace();
- if(e.getMessage()==null || e.getMessage().contains("Exception")){
- return failed("修改失败,未知原因!",e.getMessage());
- }else{
- return failed(e.getMessage());
- }
- }
- return success(1);
- }
- }
|