package com.srs.web.controller.comprehensive;


import java.text.SimpleDateFormat;
import java.util.*;

import javax.servlet.http.HttpServletResponse;
import com.srs.common.core.domain.entity.SysUser;
import com.srs.common.core.domain.model.LoginUser;
import com.srs.common.utils.SecurityUtils;
import com.srs.comprehensive.domain.*;
import com.srs.comprehensive.domain.Vo.CphSearch;
import com.srs.comprehensive.service.*;
import com.srs.system.service.ISysPostService;
import com.srs.web.controller.common.RoleBool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.*;
import org.springframework.security.access.prepost.PreAuthorize;
import com.srs.common.core.controller.BaseController;
import com.srs.common.core.domain.AjaxResult;
import com.srs.common.utils.poi.ExcelUtil;
import com.srs.common.enums.BusinessType;
import com.srs.common.annotation.Log;
import com.srs.common.core.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 *
 * @author srs
 * @date 2024-03-16
 */
@RestController
@RequestMapping("/comprehensive/zxj/apply")
@Api(value = "【贫困生申请】管理", tags = "【贫困生申请】管理")
public class SrsZxjApplyController extends BaseController {
    @Autowired
    private ISrsZxjApplyService srsZxjApplyService;

    @Autowired
    private ISrsZxjApprovalRecordService srsZxjApprovalRecordService;

    @Autowired
    ISysPostService _postService;

    @Autowired
    private ISrsStudentService srsStudentService;

    @Autowired
    private ISrsKnrdApplyService knrdApplyService;

    @Autowired
    private  ISrsStuYearService srsStuYearService;


    @GetMapping("/listJwc")
    @ApiOperation("查询学工下的学生申请的列表")
    public TableDataInfo listJwc(CphSearch param){
        boolean hasRole = RoleBool.isJwc(getUserId(),_postService);
        if(hasRole){
            startPage();
            param.setStep("3");
            List<SrsZxjApply> list = srsZxjApplyService.listView(param);
            return getDataTable(list);
        }else{
            List<String> list = new ArrayList<>();
            return getDataTable(list);
        }
    }



    @GetMapping("/listXw")
    @ApiOperation("查询学务下的学生申请的列表")
    public TableDataInfo listXw(CphSearch param){
//        boolean hasRole = RoleBool.isXw(getUserId(),_postService);
        boolean ejxysj = RoleBool.isEjxysj(getUserId(), _postService);
        if(ejxysj){
            param.setDeptId(getDeptId());
            param.setStep("2");
            startPage();
            param.setUserName(getUsername());
            List<SrsZxjApply> list = srsZxjApplyService.listView(param);
            return getDataTable(list);
        }else{
            List<String> list = new ArrayList<>();
            return getDataTable(list);
        }
    }
    @PostMapping ("/countXw")
    @ApiOperation("查询学务下的学生申请的列表")
    public AjaxResult countXw(CphSearch param){
//        boolean hasRole = RoleBool.isXw(getUserId(),_postService);
        boolean ejxysj = RoleBool.isEjxysj(getUserId(), _postService);
        if(ejxysj){
            param.setDeptId(getDeptId());


            param.setUserName(getUsername());
            List<SrsZxjApply> list = srsZxjApplyService.countXw(param);
            return AjaxResult.success(list);
        }else{
            List<String> list = new ArrayList<>();
            return AjaxResult.success(list);
        }
    }

    @GetMapping("/listFdy")
    @ApiOperation("查询辅导员下的学生申请的列表")
    public TableDataInfo listFdy(CphSearch param){
        boolean hasRole = RoleBool.isFdy(getUserId(),_postService);
        if(hasRole){
            param.setTNo(getUsername());
            param.setStep("1");
            startPage();
            List<SrsZxjApply> list = srsZxjApplyService.listView(param);
            return getDataTable(list);
        }else{
            List<String> list = new ArrayList<>();
            return getDataTable(list);
        }
    }


    @GetMapping("/listOwn")
    @ApiOperation("查询学生自己申请的列表")
    public TableDataInfo listOwn(SrsZxjApply srsZxjApply){
        String stuNo = getUsername();

        startPage();
        srsZxjApply.setXh(stuNo);

        List<SrsZxjApply> list = srsZxjApplyService.selectSrsZxjApplyList(srsZxjApply);
        return getDataTable(list);
    }




    /**
     * 查询【贫困生申请】列表
     */
    @PreAuthorize("@ss.hasPermi('system:apply:list')")
    @GetMapping("/list")
    @ApiOperation("查询【贫困生申请】列表")
    public TableDataInfo list(SrsZxjApply srsZxjApply) {
        startPage();
        List<SrsZxjApply> list = srsZxjApplyService.selectSrsZxjApplyList(srsZxjApply);
        return getDataTable(list);
    }

    /**
     * 导出【贫困生申请】列表
     */
//    @PreAuthorize("@ss.hasPermi('system:apply:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出【贫困生申请】列表")
    public void export(HttpServletResponse response, SrsZxjApply srsZxjApply) {
        List<SrsZxjApply> list = srsZxjApplyService.selectSrsZxjApplyList(srsZxjApply);
        ExcelUtil<SrsZxjApply> util = new ExcelUtil<SrsZxjApply>(SrsZxjApply.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【贫困生申请】详细信息
     */
    @GetMapping(value = "/{id}")
    @ApiOperation("获取【贫困生申请】详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(srsZxjApplyService.selectSrsZxjApplyById(id));
    }

    /**
     *
     */
    @Log(title = "【贫困生申请】", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("新增【贫困生申请】")
    public AjaxResult add(@RequestBody SrsZxjApply srsZxjApply) {
        Long step = srsZxjApply.getStep();
        srsZxjApply.setCsdj(null);
        srsZxjApply.setZzdj(null);
        srsZxjApply.setStatus1("未审核");
        srsZxjApply.setStatus2("未审核");
        srsZxjApply.setStatus3("未审核");
        //设置当前学年 listEnableYear
        SrsStuYear curYear = srsStuYearService.selectSrsStuYearById(srsZxjApply.getStuYearId());
        String stuYearName = curYear.getStuYearName();
        srsZxjApply.setStuYearId(curYear.getId());
        srsZxjApply.setApplyYear(stuYearName + "");
        int i = srsZxjApplyService.insertSrsZxjApply(srsZxjApply);
        addRecord(step, srsZxjApply.getId());
        return toAjax(i);
    }

    //助学金保存功能
    @PostMapping("/save")
    public AjaxResult save(@RequestBody SrsZxjApply srsZxjApply) {
        Long step = srsZxjApply.getStep();
        srsZxjApply.setCsdj(null);
        srsZxjApply.setZzdj(null);
        srsZxjApply.setStep(0L); //设置为保存
        SrsStuYear srsStuYear = srsStuYearService.selectSrsStuYearById(srsZxjApply.getStuYearId());
        //设置当前学年
        srsZxjApply.setStuYearId(srsStuYear.getId());
        srsZxjApply.setApplyYear(srsStuYear.getStuYearName());
        int i = srsZxjApplyService.insertSrsZxjApply(srsZxjApply);
        addRecord(step, srsZxjApply.getId());
        return toAjax(i);
    }
    //根据当前
    @PostMapping("/getStudentInfo")
    public AjaxResult getStudentInfo(@RequestBody SrsStudent srsStudent) {
        String stuNo = getUsername();//获取学号
        srsStudent.setStuNo(stuNo);
        SrsStudent result = srsZxjApplyService.selectStudentByXh(srsStudent);
        return  success(result);
    }




    @PostMapping("/pass/fdy")
    @ApiOperation("新增【贫困生申请】")
    public AjaxResult approvalFdy(@RequestBody SrsZxjApply srsZxjApply) {
        boolean hasRole = RoleBool.isFdy(getUserId(),_postService);
        if(!hasRole){
            return toAjax(0);

        }
        LoginUser loginUser = SecurityUtils.getLoginUser();
        SysUser user = loginUser.getUser();
        srsZxjApply.setFdygh(user.getUserName());
        srsZxjApply.setFdymc(user.getNickName());
        srsZxjApply.setStatus2("未审核");
        srsZxjApply.setStatus3("未审核");
        Long step = srsZxjApply.getStep();
        int i = srsZxjApplyService.updateSrsZxjApply(srsZxjApply);
        if (i > 0) {
            addRecord(step, srsZxjApply.getId());
        }
        return toAjax(i);
    }


    @PostMapping("/pass/ejxy")
    @ApiOperation("新增【贫困生申请】")
    public AjaxResult approvalEjxy(@RequestBody SrsZxjApply srsZxjApply) {
        boolean hasRole = RoleBool.isXw(getUserId(),_postService);
        boolean isEjxysj = RoleBool.isEjxysj(getUserId(),_postService);
        if(!isEjxysj){
            return toAjax(0);

        }
        srsZxjApply.setStatus3("未审核");
        Long step = srsZxjApply.getStep();
        LoginUser loginUser = SecurityUtils.getLoginUser();
        SysUser user = loginUser.getUser();
        srsZxjApply.setEjxyldmc(user.getNickName());
        srsZxjApply.setEjxyldgh(user.getUserName());

        int i = srsZxjApplyService.updateSrsZxjApply(srsZxjApply);

        if (i > 0) {
            addRecord(step, srsZxjApply.getId());
        }
        return toAjax(i);
    }

    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping("/pass/xxyj")
    @ApiOperation("新增【贫困生申请】")
    public AjaxResult approvalXxyj(@RequestBody SrsZxjApply srsZxjApply) {
        boolean hasRole = RoleBool.isJwc(getUserId(),_postService);
        if(!hasRole ){
            return toAjax(0);

        }
        Long step = srsZxjApply.getStep();
//        SrsZxjApply update = new SrsZxjApply();
//
//        update.setZzdj(srsZxjApply.getZzdj());
//        update.setId(srsZxjApply.getId());
//        update.setStep(step);
        LoginUser loginUser = SecurityUtils.getLoginUser();
        SysUser user = loginUser.getUser();
        srsZxjApply.setXxmc(user.getNickName());
        srsZxjApply.setXxgh(user.getUserName());
        int i = srsZxjApplyService.updateSrsZxjApply(srsZxjApply);
        if (i > 0) {
            addRecord(step, srsZxjApply.getId());
        }
        return toAjax(i);
    }

    @PostMapping("/updateSqly")
    @ApiOperation("修改申请理由（sqly）")
    public AjaxResult updateSqly(@RequestBody SrsZxjApply apply) {
        if (apply == null || apply.getId() == null || apply.getSqly() == null) {
            return AjaxResult.error("参数不完整");
        }
        int rows = srsZxjApplyService.updateSqly(apply.getId(), apply.getSqly());
        return toAjax(rows);
    }


    @PostMapping("/nopass")
    @ApiOperation("新增【贫困生申请】")
    public AjaxResult nopass(@RequestBody SrsZxjApprovalRecord record) {
        //查询
        SrsZxjApply srsZxjApply = srsZxjApplyService.selectSrsZxjApplyById(record.getApplyId());
        //辅导员
        boolean hasFdy = RoleBool.isFdy(getUserId(),_postService);
        //学务
        boolean isEjxysj = RoleBool.isEjxysj(getUserId(),_postService);
        //学工
        boolean hasJwc = RoleBool.isJwc(getUserId(),_postService);
        if(srsZxjApply.getStep() == 1 && !hasFdy){
            //辅导员才能驳回
            return toAjax(0);
        }
        if(srsZxjApply.getStep() == 2 && ( !isEjxysj)){
            //学务才能驳回
            return toAjax(0);
        }
        if(srsZxjApply.getStep() == 3 && !hasJwc){
            //学工才能驳回
            return toAjax(0);
        }
        if(srsZxjApply.getStep() == 4 || srsZxjApply.getStep() == -1 ){
            //审核结束了
            return toAjax(0);
        }
        SysUser sysUser = SecurityUtils.getLoginUser().getUser();
        record.setOperator(sysUser.getNickName());
        //更新步骤
        SrsZxjApply update = new SrsZxjApply();
        int i = 0;
        //拒绝
        if("0".equals(record.getStatus())){


            //辅导拒绝
            if(record.getStep() == 2){
                update.setStatus1("拒绝");
            }
            //二级学院拒绝
            if(record.getStep() == 3){
                update.setStatus2("拒绝");
            }
            //学校拒绝3
            if(record.getStep() == 4){
                update.setStatus3("拒绝");
            }
            Long step = new Long(-1);
            update.setStep(step);
            update.setId(record.getApplyId());
            i = srsZxjApplyService.updateSrsZxjApply(update);
        }
        //驳回
        if("2".equals(record.getStatus())){


            //辅导驳回
            if(record.getStep() == 2){
                update.setStatus1("驳回");
            }
            //二级学院驳回
            if(record.getStep() == 3){
                update.setStatus2("驳回");

            }
            //学校驳回
            if(record.getStep() == 4){
                update.setStatus3("驳回");


            }
//            Long step = new Long(0);
            //设置驳回至哪一步
            update.setStep(record.getTargetStep());
            update.setId(record.getApplyId());
            //驳回至学生
            if(record.getTargetStep() == 0){


                //清除所有审批过的

                update.setBjyjdj("");
                update.setFdymc("");
                update.setFdygh("");
                update.setFdyqmrq("");
                update.setFdyqm("");
                //清除二级学院的

                update.setEjxyyjdj("");
                update.setEjxyldgh("");
                update.setEjxyldmc("");
                update.setEjxyldqm("");
                update.setEjxyldqmrq("");
                //清除学务的
                update.setXxmc("");
                update.setXxgh("");

                update.setZzdj("");
                update.setXxqm("");
                update.setXxyjrq("");
            }
            //驳回至辅导员

            if(record.getTargetStep() == 1){
                //清除所有审批过的

                update.setBjyjdj("");
                update.setFdymc("");
                update.setFdygh("");
                update.setFdyqmrq("");
                update.setFdyqm("");
                //清除二级学院的
                update.setEjxyyjdj("");
                update.setEjxyldgh("");
                update.setEjxyldmc("");
                update.setEjxyldqm("");
                update.setEjxyldqmrq("");
                //清除学务的
                update.setXxmc("");
                update.setXxgh("");

                update.setZzdj("");
                update.setXxqm("");
                update.setXxyjrq("");


            }
            //驳回至二级
            if(record.getTargetStep() == 2){
                //清除二级学院的

                update.setEjxyyjdj("");
                update.setEjxyldgh("");
                update.setEjxyldmc("");
                update.setEjxyldqm("");
                update.setEjxyldqmrq("");
                //清除学务的
                update.setXxmc("");
                update.setXxgh("");

                update.setZzdj("");
                update.setXxqm("");
                update.setXxyjrq("");
            }
            i= srsZxjApplyService.updateSrsZxjApply(update);
        }
        int result = 0;
        if(i> 0){
            result = srsZxjApprovalRecordService.insertSrsZxjApprovalRecord(record);
        }
        return toAjax(result);
    }


    private void addRecord(Long step, Long applyId) {
        //添加历史记录
        SrsZxjApprovalRecord record = new SrsZxjApprovalRecord();

        record.setApplyId(applyId);
        //获取当前用户
        LoginUser loginUser = SecurityUtils.getLoginUser();
        SysUser user = loginUser.getUser();
        record.setOperator(user.getNickName());
        record.setStep(step);
        record.setStatus("1");
        record.setCreateTime(new Date());
        srsZxjApprovalRecordService.insertSrsZxjApprovalRecord(record);
    }

    /**
     * 修改【请填写功能名称】
     */
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    @ApiOperation("修改【贫困生申请】")
    public AjaxResult edit(@RequestBody SrsZxjApply srsZxjApply) {
        //查询
        SrsZxjApply result = srsZxjApplyService.selectSrsZxjApplyById(srsZxjApply.getId());
        if(result.getStep() == 3 ||  result.getStep() == 4 || result.getStep() == 2){
            return toAjax(0);
        }
        boolean hasRole = RoleBool.isFdy(getUserId(),_postService);
        if(result.getStep() == 1 && !hasRole){
            return toAjax(0);
        }
        Long step = srsZxjApply.getStep();
        if(step == 1){
            srsZxjApply.setStatus1("未审核");
            srsZxjApply.setStatus2("未审核");
            srsZxjApply.setStatus3("未审核");
            srsZxjApply.setFdyqmrq("");
            srsZxjApply.setFdyqm("");
            srsZxjApply.setEjxyldqm("");
            srsZxjApply.setEjxyldqmrq("");
            srsZxjApply.setZzdj("");

            if(result.getStep()!= step){
                addRecord(1L, srsZxjApply.getId());
            }else {
                addRecord(0L, srsZxjApply.getId());
            }
        }else{
            addRecord(step, srsZxjApply.getId());
        }


        int i = srsZxjApplyService.updateSrsZxjApply(srsZxjApply);

        return toAjax(i);
    }



    /**
     * 删除【请填写功能名称】
     */
    @Log(title = "【贫困生申请】", businessType = BusinessType.DELETE)
    @PostMapping("/{ids}")
    @ApiOperation("删除【贫困生申请】")
    public AjaxResult remove(@PathVariable Long[] ids) {

        return toAjax(srsZxjApplyService.deleteSrsZxjApplyByIds(ids));
    }


    /**
     * 撤回
     */


    @PostMapping("/isPoor")
    public AjaxResult isPoor(@RequestBody SrsZxjApply apply){

        return AjaxResult.success(check(apply));
    }
    //检查是否是贫困学生
    private AjaxResult check(SrsZxjApply apply){
        AjaxResult ajaxResult = new AjaxResult();
        String stuNo = getUsername();
        //根据学号查询是否是贫困生
        SrsKnrdApply srsKnrdApply = new SrsKnrdApply();
        srsKnrdApply.setXh(stuNo);
//        SrsStuYear curYear = srsStuYearService.listEnableYear().get(0);
//        srsKnrdApply.setApplyYear(curYear.getStuYearName());
        srsKnrdApply.setStuYearId(apply.getStuYearId());
        //根据学年查询是否申请了贫困生
        List<SrsKnrdApply> srsKnrdApplies = knrdApplyService.selectSrsKnrdApplyList(srsKnrdApply);
        if (srsKnrdApplies.size() == 0){
            //查询不到 不是困难学生
            ajaxResult.put("isPoor",false);
            ajaxResult.put("message","未认定贫困生,不能申请助学金!");
            return ajaxResult;
        }else {
            //使用最新的判断是否已经认定贫困生
            SrsKnrdApply result = srsKnrdApplies.get(srsKnrdApplies.size() - 1);
            if (result.getStep() == 0){
                //没走完流程，不是贫困生
                ajaxResult.put("message","未认定贫困生,不能申请助学金!");
                ajaxResult.put("isPoor",false);

                return ajaxResult;
            }else  if("4".equals(result.getXsqmyj())) {
                //查到了，但学校认定不困难,不是贫困生
                //查询不到 不是困难学生
                ajaxResult.put("isPoor",false);
                ajaxResult.put("message","认定不困难,不能申请助学金!");
                return ajaxResult;
            }else{
                //
                SrsZxjApply srsZxjApply = new SrsZxjApply();
                srsZxjApply.setXh(stuNo);
//                srsZxjApply.setApplyYear(curYear.getStuYearName());
                srsZxjApply.setStuYearId(apply.getStuYearId());
                //查询本学年是否申请了
                List<SrsZxjApply> srsZxjApplies = srsZxjApplyService.selectSrsZxjApplyList(srsZxjApply);
                if(srsZxjApplies.size() > 0){
                    //没走完流程，不是贫困生
                    ajaxResult.put("message","本学年已存在申请记录!");
                    ajaxResult.put("isPoor",false);
                    return ajaxResult;
                }
                ajaxResult.put("message","本学年已存在申请记录!");
                ajaxResult.put("isPoor",true);
                return ajaxResult;
            }
        }

    }

    @PostMapping("/nextApply")
    @ApiOperation("根据不同角色的未审批的学生申请")
    public AjaxResult nextApply(@RequestBody CphSearch param){

        if("1".equals(param.getStep())){
            return getNextFdy(param);
        }else if("2".equals(param.getStep())){
            return getNextXw(param);
        }else if("3".equals(param.step)){
            return getNextJwc(param);
        }else{
            return AjaxResult.success(null);
        }

    }

    public AjaxResult  getNextFdy(CphSearch param){
        //辅导员
        boolean hasFdy = RoleBool.isFdy(getUserId(),_postService);
        if(hasFdy){
            param.setTNo(getUsername());
            param.setStep("1");
            return AjaxResult.success(srsZxjApplyService.nextApply(param));
        }
        else{
            return AjaxResult.success(null);
        }

    }


    public AjaxResult  getNextXw(CphSearch param){

//        boolean hasXw = RoleBool.isXw(getUserId(),_postService);
        boolean ejxysj = RoleBool.isEjxysj(getUserId(), _postService);
        if( ejxysj){
            param.setDeptId(getDeptId());
            param.setStep("2");

            param.setUserName(getUsername());
            return AjaxResult.success(srsZxjApplyService.nextApply(param));

        }else{
            return AjaxResult.success(null);
        }

    }

    public AjaxResult  getNextJwc(CphSearch param){
        //学工
        boolean hasJwc = RoleBool.isJwc(getUserId(),_postService);
        if(hasJwc){
            param.setStep("3");
            SrsZxjApply srsZxjApply = srsZxjApplyService.nextApply(param);

            srsZxjApplyService.lock(srsZxjApply);
            return AjaxResult.success(srsZxjApply);
        }else{
            return AjaxResult.success(null);
        }

    }


    // 辅导员批量审批
    @PostMapping("/batchUpdateFdy")
    @ApiOperation("辅导员批量审核")
    public AjaxResult batchUpdate(@RequestBody SrsZxjApply srsZxjApply){
        //批量驳回和拒绝以及他通过
        int i = srsZxjApplyService.batchUpdate(srsZxjApply);
        return toAjax(i);
    }
//    //学务批量审批
//    @PostMapping("/batchUpdateXw")
//    @ApiOperation("学务批量审核")
//    public AjaxResult batchUpdate(){
//
//    }
//
//    //学工批量审批
//    @PostMapping("/batchUpdateXw")
//    @ApiOperation("学务批量审核")
//    public AjaxResult batchUpdate(){
//
//    }

    @PostMapping("/revoke")
    @ApiOperation("助学金申请测绘")
    public AjaxResult revoke(@RequestBody SrsZxjApply srsZxjApply) {
        int revoke = srsZxjApplyService.revoke(srsZxjApply);
        if(revoke > 0){
            return  AjaxResult.success("操作成功！");
        }else{
            return  AjaxResult.error("操作失败！");
        }

    }


    @PostMapping("/lock")
    public AjaxResult lock(@RequestBody SrsZxjApply srsZxjApply) {
        int lock = srsZxjApplyService.lock(srsZxjApply);
        if(lock > 0){
            return  AjaxResult.success("操作成功！");
        }else{
            return  AjaxResult.error("操作失败！");
        }

    }

    @PostMapping("/unlock")
    public AjaxResult unlock(@RequestBody SrsZxjApply srsZxjApply) {
        int unLock = srsZxjApplyService.unlock(srsZxjApply);
        if(unLock > 0){
            return  AjaxResult.success("操作成功！");
        }else{
            return  AjaxResult.error("操作失败！");
        }
    }
    @PostMapping("/jwcUpdateAll")
    @ApiOperation("学工处一键审核")
    public AjaxResult jwcUpdateAll(@RequestBody SrsZxjApply srsZxjApply){

        boolean hasRole = RoleBool.isJwc(getUserId(),_postService);
        if(hasRole){
            CphSearch param = new CphSearch();
            param.setStep("3");
            List<SrsZxjApply> list = srsZxjApplyService.listView(param);
            Long[] ids = new Long[list.size()];
            for (int i = 0; i < list.size(); i++) {
                ids[i] =  list.get(i).getId();
            }
            srsZxjApply.setIds(ids);

            //批量驳回和拒绝以及他通过
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            String formatDate = format.format(new Date());
            srsZxjApply.setXxyjrq(formatDate);
            int i = srsZxjApplyService.batchUpdate(srsZxjApply);
            return toAjax(i);
        }else{
            return toAjax(0);
        }


    }

    // 更新签名
    @PostMapping("/updateSignature")
    public AjaxResult updateSignature(@RequestBody CphSearch cphSearch){

        return  AjaxResult.success(srsZxjApplyService.updateSignature(cphSearch));
    }
//    {"status":"1","xxqm":"/profile/upload/2024/11/18/image-20240312130249969_20241118213051A004.png","xxyjrq":"2024年11月29日","step":4,"ids":[20646,20647],"xxyj":"bjyj","zzdj":"bjyjdj"}
}
