package com.lz.modules.performance.controller;


import com.alibaba.fastjson.JSONObject;
import com.lz.common.emun.ChartOptType;
import com.lz.common.emun.CheckStaffType;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.entity.StaffSimpleInfo;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.entity.*;
import com.lz.modules.flow.model.DepartManagers;
import com.lz.modules.flow.model.ResultModelDto;
import com.lz.modules.flow.model.ResultTagetLibDto;
import com.lz.modules.flow.req.ResultModelItemReq;
import com.lz.modules.flow.req.ResultTagetLibItemReq;
import com.lz.modules.flow.service.*;
import com.lz.modules.performance.service.ResultTagetLibService;
import com.lz.modules.sys.entity.app.ResultDetail;
import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultDetailService;
import com.lz.modules.sys.service.app.ResultRecordService;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collector;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/flowStart")
@Api(tags = "发起考核")
@Slf4j
public class FlowStartController {


    @Autowired
    private FlowStartService flowStartService;










     @GetMapping("/getById")
     public R getById(@RequestParam Long id, @RequestParam int type) {
         return flowStartService.getModelById(id, type);
     }


     @RequestMapping("/update")
     public R update(@RequestBody FlowStart flowStart) {
         flowStartService.updateFlowStartById(flowStart);
        return R.ok();
     }


     @PostMapping("/save")
    @ApiOperation("发起新的考核任务")
     @ApiResponses({@ApiResponse(code = 200, message = "成功", response = FlowStart.class)})
     public R save(@RequestBody @ApiParam FlowStart flowStart) {
         log.info("发起考核接受数据{}", flowStart);
         return flowStartService.saveStart(flowStart);
     }


    @RequestMapping("/delete")
    public R list(@RequestBody Long id) {
        flowStartService.deleteFlowStartById(id);
        return R.ok();
     }
}
