package com.ruoyi.tc.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.tc.entity.*;
import com.ruoyi.tc.entity.po.*;
import com.ruoyi.tc.entity.request.AssestTaskXqRequest;
import com.ruoyi.tc.entity.request.AssetCurrentShRequest;
import com.ruoyi.tc.entity.request.AssetTaskPageRequest;
import com.ruoyi.tc.entity.request.AssetdwHcRequest;
import com.ruoyi.tc.entity.response.AssestTaskXqresponse;
import com.ruoyi.tc.entity.response.AssetTaskIdResponse;
import com.ruoyi.tc.entity.response.AssetdwHcResponse;
import com.ruoyi.tc.mapper.AssetTaskMapper;
import com.ruoyi.tc.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.time.LocalDateTime;
import java.util.Optional;

/**
 * 任务主表(AssetTask)表控制层
 *
 * @author makejava
 * @since 2024-11-18 13:22:58
 */
@Api(tags = "任务主表")
@RestController
@Transactional(rollbackFor = Exception.class)
@RequestMapping("/unit/assetTask")
public class AssetTaskController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private AssetTaskService assetTaskService;
    @Resource
    private AssetMiniProgramsService assetMiniProgramsService;
    @Resource
    private AssetCurrentCpService assetCurrentCpService;

    @Resource
    private AssetBusinessFormCpService assetBusinessFormCpService;

    @Resource
    private AssetBasicNetworkCpService assetBasicNetworkCpService;
    @Resource
    private AssetSupplyChainCpService assetSupplyChainCpService;

    @Resource
    private UnitOtherConcatCpService unitOtherConcatCpService;

    @Resource
    private AssetCurrentJyService assetCurrentJyService;

    @Resource
    private AssetBusinessFormJyService assetBusinessFormJyService;

    @Resource
    private AssetSupplyChainJyService assetSupplyChainJyService;

    @Resource
    AssetBasicNetworkJyService assetBasicNetworkJyService;

    @Resource
    private UnitOtherConcatJyservice unitOtherConcatJyservice;


    @Resource
    private AssetLcService assetLcService;


    @Resource
    private AssetCurrentService assetCurrentService;

    @Resource
    private AssetMiniProgramsCpService assetMiniProgramsCpService;

    @Resource
    private AssetOfficialAccountCpService assetOfficialAccountCpService;

    @Resource
    private AssetAppCpService assetAppCpService;


    @Resource
    private AssetEmailCpService assetEmailCpService;


    @Resource
    private AssetMiniProgramsJyService assetMiniProgramsJyService;

    @Resource
    private AssetOfficialAccountJyService assetOfficialAccountJyService;

    @Resource
    private AssetAppJyService assetAppJyService;

    @Resource
    private AssetEmailJyService assetEmailJyService;

    @Resource
    private AssetOfficialAccountService assetOfficialAccountService;

    @Resource
    private AssetAppService assetAppService;

    @Resource
    private AssetEmailService assetEmailService;

    @Resource
    private AssetTaskMapper assetTaskDao;

    /**
     * 分页查询
     *
     * @param assetTask   筛选条件
     * @param pageRequest 分页对象
     * @return 查询结果
     */
    @ApiOperation(value = "分页查询", response = AssetTask.class)
    @GetMapping("/page")
    public AjaxResult queryByPage(Page<AssetTask> assetTask, AssetTaskPageRequest pageRequest) {
        return AjaxResult.success(this.assetTaskService.queryByPage(assetTask, pageRequest));
    }

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @ApiOperation(value = "通过主键查询单条数据", response = AssetTaskIdResponse.class)
    @GetMapping("{id}")
    public AjaxResult queryById(@PathVariable("id") Integer id) {
        return AjaxResult.success(this.assetTaskService.queryById(id));
    }

    /**
     * 新增数据
     *
     * @param assetTask 实体
     * @return 新增结果
     */
    @ApiOperation(value = "新增数据")
    @PostMapping("/add")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult add(@RequestBody @Valid AssetTask assetTask) {
        assetTask.setTaskTime(LocalDateTime.now());
        this.assetTaskService.insert(assetTask);
        return AjaxResult.success();
    }

    /**
     * 编辑数据
     *
     * @param assetTask 实体
     * @return 编辑结果
     */
    @ApiOperation(value = "编辑数据")
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody @Valid AssetTask assetTask) {
        return AjaxResult.success(this.assetTaskService.update(assetTask));
    }

    /**
     * 删除数据
     *
     * @param id 主键
     * @return 删除是否成功
     */
    @ApiOperation(value = "删除数据")
    @PostMapping("/deleteById/{id}")
    public AjaxResult deleteById(@PathVariable("id") Integer id) {
        return AjaxResult.success(this.assetTaskService.deleteById(id));
    }


    /**
     * web资产任务审核详情信息
     *
     * @param taskId  任务id
     * @param assetId 资产id
     * @return
     */
    @ApiOperation(value = "web资产任务审核详情信息", response = AssetCurrent.class)
    @GetMapping("/taskSh")
    public AjaxResult taskSh(@RequestParam("taskId") int taskId, @RequestParam("assetId") int assetId) {

        return AjaxResult.success(assetTaskService.taskSh(taskId, assetId));
    }

    /**
     * 小程序资产任务审核详情信息
     *
     * @param taskId  任务id
     * @param assetId 资产id
     * @return
     */
    @ApiOperation(value = "小程序资产任务审核详情信息", response = AssetCurrent.class)
    @GetMapping("/minitaskSh")
    public AjaxResult minitaskSh(@RequestParam("taskId") int taskId, @RequestParam("assetId") int assetId) {

        return AjaxResult.success(assetTaskService.minitaskSh(taskId, assetId));
    }

    /**
     * 公众号资产任务审核详情信息
     *
     * @param taskId  任务id
     * @param assetId 资产id
     * @return
     */
    @ApiOperation(value = "公众号资产任务审核详情信息", response = AssetCurrent.class)
    @GetMapping("/officetaskSh")
    public AjaxResult officetaskSh(@RequestParam("taskId") int taskId, @RequestParam("assetId") int assetId) {

        return AjaxResult.success(assetTaskService.officetaskSh(taskId, assetId));
    }


    /**
     * 电子邮件资产任务审核详情信息
     *
     * @param taskId  任务id
     * @param assetId 资产id
     * @return
     */
    @ApiOperation(value = "电子邮件资产任务审核详情信息", response = AssetCurrent.class)
    @GetMapping("/emailtaskSh")
    public AjaxResult emailtaskSh(@RequestParam("taskId") int taskId, @RequestParam("assetId") int assetId) {

        return AjaxResult.success( assetTaskService.emailtaskSh(taskId, assetId));
    }

    /**
     * 移动应用程序资产任务审核详情信息
     *
     * @param taskId  任务id
     * @param assetId 资产id
     * @return
     */
    @ApiOperation(value = "移动应用程序资产", response = AssetCurrent.class)
    @GetMapping("/apptaskSh")
    public AjaxResult apptaskSh(@RequestParam("taskId") int taskId, @RequestParam("assetId") int assetId) {

        return AjaxResult.success(assetTaskService.apptaskSh(taskId, assetId));
    }

    /**
     * 资产核查信息
     *
     * @param page        分页参数
     * @param pageRequest 查询条件
     * @return
     */
    @ApiOperation(value = "资产核查信息", response = AssestTaskXqresponse.class)
    @GetMapping("/zcHc")
    public AjaxResult zcHc(Page<AssestTaskXqresponse> page, AssestTaskXqRequest pageRequest) {
        return AjaxResult.success(assetTaskService.zcHc(page, pageRequest));
    }


    /**
     * web单位端暂存报废
     *
     * @param assetCurrent 现有资产复制表
     * @return
     */
    @ApiOperation(value = "web单位端暂存报废")
    @PostMapping("/zc")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult zcHc(@RequestBody AssetCurrentCpPo assetCurrent) {
        //根据资产id和任务id删除五张表数据
        assetCurrentCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
        assetBusinessFormCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
        assetSupplyChainCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
        unitOtherConcatCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
        assetBasicNetworkCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
        //根据taskid获取当前任务的count数量
        AssetTask assetTask = assetTaskDao.getByTaskId(assetCurrent.getTaskId());
        int ygt = Optional.ofNullable(assetTask.getYgt()).orElse(0);
        AssetCurrent ac = new AssetCurrent();
        if (StringUtils.isBlank(assetCurrent.getBfyy())) {
            //待审批
            assetCurrent.setStatus(0);
        } else {
            //已报废
            assetCurrent.setStatus(5);
            assetCurrent.setXtzt("5");
            //已关停
            ygt++;
            assetTaskService.updateYgtByTaskId(assetCurrent.getTaskId(),ygt);

        }
        StringBuilder a = new StringBuilder();
        if (!assetCurrent.getGlymList().isEmpty()) {
            assetCurrent.getGlymList().forEach(x -> {
                a.append(x);
                a.append(",");
            });
        }
        assetCurrent.setGlym(a.toString());
        StringBuilder b = new StringBuilder();
        if (!assetCurrent.getGlIpList().isEmpty()) {
            assetCurrent.getGlymList().forEach(x -> {
                b.append(x);
                b.append(",");
            });
        }
        assetCurrent.setGlIp(b.toString());
//        assetCurrent.setCurrentId(null);
        BeanUtils.copyProperties(assetCurrent, ac);
        assetCurrentService.updateById(ac);
        assetCurrentCpService.save(assetCurrent);
        //新增新监管业务形态
        if (assetCurrent.getXjgywxt() != null) {
            assetCurrent.getXjgywxt().setAssetId(assetCurrent.getId());
            assetCurrent.getXjgywxt().setTaskId(assetCurrent.getTaskId());
            assetBusinessFormCpService.save(assetCurrent.getXjgywxt());
        }
        if (!assetCurrent.getGylxxList().isEmpty()) {
            for (AssetSupplyChainCpPo items : assetCurrent.getGylxxList()) {
                items.setAssetId(assetCurrent.getId());
                items.setTaskId(assetCurrent.getTaskId());

            }
            //新增供应链
            assetSupplyChainCpService.saveBatch(assetCurrent.getGylxxList());
        }
        if (!assetCurrent.getJcwlList().isEmpty()) {
            for (AssetBasicNetworkCpPo items : assetCurrent.getJcwlList()) {
                items.setAssetId(assetCurrent.getId());
                items.setTaskId(assetCurrent.getTaskId());

            }
            //新增基础网络
            assetBasicNetworkCpService.saveBatch(assetCurrent.getJcwlList());
        }
        if (!assetCurrent.getOtherConcat().isEmpty()) {
            for (UnitOtherConcatCpPo items : assetCurrent.getOtherConcat()) {
                items.setAssetId(assetCurrent.getId());
                items.setTaskId(assetCurrent.getTaskId());

            }
            //新增其他联系人
            unitOtherConcatCpService.saveBatch(assetCurrent.getOtherConcat());
        }
        return success();
    }

    /**
     * 单位端校验提交
     *
     * @param assetCurrent 现有资产复制表
     * @return
     */
    @ApiOperation(value = "单位端校验提交")
    @PostMapping("/jyTj")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult tj(@RequestBody AssetCurrentJyPo assetCurrent) {
        //根据资产id和任务id删除五张表数据
        assetCurrentCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
        assetBusinessFormCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
        assetSupplyChainCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
        unitOtherConcatCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
        assetBasicNetworkCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
        //新增流程节点时间
        AssetLc assetLc = new AssetLc();
        assetLc.setTaskId(assetCurrent.getTaskId());
        assetLc.setAssetName(assetCurrent.getXtmc());
        //当审核状态为审核不通过 单位端重新提交
//        if (assetCurrent.getStatus().equals(4)) {
//            assetLc.setTaskId(assetCurrent.getTaskId());
//            assetLc.setXfTime(LocalDateTime.now());
//            assetLc.setAssetName("单位重新核查提交时间" + assetCurrent.getXtmc());
//            assetLcService.insert(assetLc);
//        }

        StringBuilder a = new StringBuilder();
        if (!assetCurrent.getGlymList().isEmpty()) {
            assetCurrent.getGlymList().forEach(x -> {
                a.append(x);
                a.append(",");
            });
        }
        assetCurrent.setGlym(a.toString());
        StringBuilder b = new StringBuilder();
        if (!assetCurrent.getGlIpList().isEmpty()) {
            assetCurrent.getGlymList().forEach(x -> {
                b.append(x);
                b.append(",");
            });
        }
        assetCurrent.setGlIp(b.toString());
        assetCurrent.setStatus(1);
        //当审核状态为带待核查
        if (assetCurrent.getStatus().equals(1)) {
            assetLc.setXfTime(LocalDateTime.now());
            assetLc.setTaskId(assetCurrent.getTaskId());
            assetLc.setAssetName("单位核查完成提交" + assetCurrent.getXtmc());
            assetLcService.insert(assetLc);
        }
        assetCurrentJyService.save(assetCurrent);
        //新增新监管业务形态
        if (assetCurrent.getXjgywxt() != null) {
            assetCurrent.getXjgywxt().setAssetId(assetCurrent.getId());
            assetCurrent.getXjgywxt().setTaskId(assetCurrent.getTaskId());
            assetBusinessFormJyService.save(assetCurrent.getXjgywxt());
        }
        if (!assetCurrent.getGylxxList().isEmpty()) {
            for (AssetSupplyChainJyPo items : assetCurrent.getGylxxList()) {
                items.setAssetId(assetCurrent.getId());
                items.setTaskId(assetCurrent.getTaskId());
            }
            //新增供应链
            assetSupplyChainJyService.saveBatch(assetCurrent.getGylxxList());
        }
        if (!assetCurrent.getJcwlList().isEmpty()) {
            for (AssetBasicNetworkJyPo items : assetCurrent.getJcwlList()) {
                items.setAssetId(assetCurrent.getId());
                items.setTaskId(assetCurrent.getTaskId());
            }
            //新增基础网络
            assetBasicNetworkJyService.saveBatch(assetCurrent.getJcwlList());
        }
        if (!assetCurrent.getOtherConcat().isEmpty()) {
            for (UnitOtherConcatJyPo items : assetCurrent.getOtherConcat()) {
                items.setAssetId(assetCurrent.getId());
                items.setTaskId(assetCurrent.getTaskId());
            }
            //新增其他联系人
            unitOtherConcatJyservice.saveBatch(assetCurrent.getOtherConcat());
        }

        return success();
    }


    /**
     * 管理端审核
     *
     * @param req 请求类
     * @return
     */
    @ApiOperation(value = "管理端审核")
    @PostMapping("/sh")
    public AjaxResult sh(@RequestBody AssetCurrentShRequest req) {
        return AjaxResult.success(assetTaskService.sh(req));
    }


    /**
     * 管理端-单位核查情况
     *
     * @param req 请求类
     * @return
     */
    @ApiOperation(value = "管理端-单位核查情况", response = AssetdwHcResponse.class)
    @GetMapping("/dwHc")
    public AjaxResult dwHc(Page<AssetdwHcResponse> assetdwHcResponsePage, AssetdwHcRequest req) {
        return AjaxResult.success(assetTaskService.dwHc(assetdwHcResponsePage, req));
    }

    /**
     * 小程序单位端暂存报废
     *
     * @param assetMiniProgramsCpPo 小程序复制表
     * @return
     */
    @ApiOperation(value = "小程序单位端暂存报废")
    @PostMapping("/xcxzc")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult xcxzc(@RequestBody AssetMiniProgramsCpPo assetMiniProgramsCpPo) {
        //根据资产id和任务id删除数据
        assetMiniProgramsCpService.deletByAssetIdandTaskId(assetMiniProgramsCpPo.getAssetId(), assetMiniProgramsCpPo.getTaskId());
        //根据taskid获取当前任务的count数量
        AssetTask assetTask = assetTaskDao.getByTaskId(assetMiniProgramsCpPo.getTaskId());
        int ygt = Optional.ofNullable(assetTask.getYgt()).orElse(0);
        AssetMiniPrograms ac = new AssetMiniPrograms();
        if (StringUtils.isBlank(assetMiniProgramsCpPo.getBfyy())) {
            //待审批
            assetMiniProgramsCpPo.setStatus(0);
        } else {
            //已报废
            assetMiniProgramsCpPo.setStatus(5);
            ac.setIsbf(2);
            ac.setId(assetMiniProgramsCpPo.getAssetId());
            assetMiniProgramsService.updateById(ac);
            //已关停
            ygt++;
            assetTaskService.updateYgtByTaskId(assetMiniProgramsCpPo.getTaskId(),ygt);
        }
        assetMiniProgramsCpService.save(assetMiniProgramsCpPo);
        return success();
    }


    /**
     * 公众号单位端暂存报废
     *
     * @param assetOfficialAccountCpPo 公众号复制表
     * @return
     */
    @ApiOperation(value = "公众号单位端暂存报废")
    @PostMapping("/gzhzc")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult gzhzc(@RequestBody AssetOfficialAccountCpPo assetOfficialAccountCpPo) {
        //根据资产id和任务id删除数据
        assetOfficialAccountCpService.deletByAssetIdandTaskId(assetOfficialAccountCpPo.getAssetId(), assetOfficialAccountCpPo.getTaskId());
        //根据taskid获取当前任务的count数量
        AssetTask assetTask = assetTaskDao.getByTaskId(assetOfficialAccountCpPo.getTaskId());
        int ygt = Optional.ofNullable(assetTask.getYgt()).orElse(0);
        AssetOfficialAccount ac = new AssetOfficialAccount();
        if (StringUtils.isBlank(assetOfficialAccountCpPo.getBfyy())) {
            //待审批
            assetOfficialAccountCpPo.setStatus(0);
        } else {
            //已报废
            assetOfficialAccountCpPo.setStatus(5);
            ac.setIsbf(2);
            ac.setId(assetOfficialAccountCpPo.getAssetId());
            assetOfficialAccountService.updateById(ac);
            //已关停
            ygt++;
            assetTaskService.updateYgtByTaskId(assetOfficialAccountCpPo.getTaskId(),ygt);
        }

        assetOfficialAccountCpService.save(assetOfficialAccountCpPo);
        return success();
    }


    /**
     * 资产移动应用程序单位端暂存报废
     *
     * @param assetAppCpPo 资产移动应用程序复制表
     * @return
     */
    @ApiOperation(value = "资产移动应用程序单位端暂存报废")
    @PostMapping("/appzc")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult appzc(@RequestBody AssetAppCpPo assetAppCpPo) {
        //根据资产id和任务id删除数据
        assetAppCpService.deletByAssetIdandTaskId(assetAppCpPo.getAssetId(), assetAppCpPo.getTaskId());
        //根据taskid获取当前任务的count数量
        AssetTask assetTask = assetTaskDao.getByTaskId(assetAppCpPo.getTaskId());
        int ygt = Optional.ofNullable(assetTask.getYgt()).orElse(0);
        AssetApp ac = new AssetApp();
        if (StringUtils.isBlank(assetAppCpPo.getBfyy())) {
            //待审批
            assetAppCpPo.setStatus(0);
        } else {
            //已报废
            assetAppCpPo.setStatus(5);
            ac.setIsbf(2);
            ac.setId(assetAppCpPo.getAssetId());
            assetAppService.updateById(ac);
            //已关停
            ygt++;
            assetTaskService.updateYgtByTaskId(assetAppCpPo.getTaskId(),ygt);
        }

        assetAppCpService.save(assetAppCpPo);
        return success();
    }


    /**
     * 电子邮件单位端暂存报废
     *
     * @param assetEmailCpPo 电子邮件复制表
     * @return
     */
    @ApiOperation(value = "电子邮件单位端暂存报废")
    @PostMapping("/emailzc")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult emailzc(@RequestBody AssetEmailCpPo assetEmailCpPo) {
        //根据资产id和任务id删除数据
        assetEmailCpService.deletByAssetIdandTaskId(assetEmailCpPo.getAssetId(), assetEmailCpPo.getTaskId());
        //根据taskid获取当前任务的count数量
        AssetTask assetTask = assetTaskDao.getByTaskId(assetEmailCpPo.getTaskId());
        int ygt = Optional.ofNullable(assetTask.getYgt()).orElse(0);
        AssetEmail ac = new AssetEmail();
        if (StringUtils.isBlank(assetEmailCpPo.getBfyy())) {
            //待审批
            assetEmailCpPo.setStatus(0);
        } else {
            //已报废
            assetEmailCpPo.setStatus(5);
            ac.setIsbf(2);
            ac.setId(assetEmailCpPo.getAssetId());
            assetEmailService.updateById(ac);
            //已关停
            ygt++;
            assetTaskService.updateYgtByTaskId(assetEmailCpPo.getTaskId(),ygt);
        }


        assetEmailCpService.save(assetEmailCpPo);
        return success();
    }


    /**
     * 小程序单位端校验提交
     *
     * @param assetMiniProgramsJyPo 小程序资产复制表
     * @return
     */
    @ApiOperation(value = "小程序单位端校验提交")
    @PostMapping("/xcxjyTj")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult xcxJyTj(@RequestBody AssetMiniProgramsJyPo assetMiniProgramsJyPo) {
        assetMiniProgramsCpService.deletByAssetIdandTaskId(assetMiniProgramsJyPo.getAssetId(), assetMiniProgramsJyPo.getTaskId());
        //新增流程节点时间
        AssetLc assetLc = new AssetLc();
        assetLc.setTaskId(assetMiniProgramsJyPo.getTaskId());
        assetLc.setAssetName(assetMiniProgramsJyPo.getXcxmc());
        assetMiniProgramsJyPo.setStatus(1);
        //当审核状态为带待核查
        if (assetMiniProgramsJyPo.getStatus().equals(1)) {
            assetLc.setXfTime(LocalDateTime.now());
            assetLc.setTaskId(assetMiniProgramsJyPo.getTaskId());
            assetLc.setAssetName("单位核查完成提交" + assetMiniProgramsJyPo.getXcxmc());
            assetLcService.insert(assetLc);
        }
        assetMiniProgramsJyService.save(assetMiniProgramsJyPo);
        return success();
    }


    /**
     * 公众号单位端校验提交
     *
     * @param assetOfficialAccountJyPo 公众号资产复制表
     * @return
     */
    @ApiOperation(value = "公众号单位端校验提交")
    @PostMapping("/gzhjyTj")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult gzhjyTj(@RequestBody AssetOfficialAccountJyPo assetOfficialAccountJyPo) {
        assetOfficialAccountCpService.deletByAssetIdandTaskId(assetOfficialAccountJyPo.getAssetId(), assetOfficialAccountJyPo.getTaskId());
        //新增流程节点时间
        AssetLc assetLc = new AssetLc();
        assetLc.setTaskId(assetOfficialAccountJyPo.getTaskId());
        assetLc.setAssetName(assetOfficialAccountJyPo.getGzhmc());
        assetOfficialAccountJyPo.setStatus(1);
        //当审核状态为带待核查
        if (assetOfficialAccountJyPo.getStatus().equals(1)) {
            assetLc.setXfTime(LocalDateTime.now());
            assetLc.setTaskId(assetOfficialAccountJyPo.getTaskId());
            assetLc.setAssetName("单位核查完成提交" + assetOfficialAccountJyPo.getGzhmc());
            assetLcService.insert(assetLc);
        }
        assetOfficialAccountJyService.save(assetOfficialAccountJyPo);
        return success();
    }


    /**
     * 资产移动应用程序单位端校验提交
     *
     * @param assetAppJyPo 资产移动应用程序资产复制表
     * @return
     */
    @ApiOperation(value = "资产移动应用程序单位端校验提交")
    @PostMapping("/appjyTj")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult appjyTj(@RequestBody AssetAppJyPo assetAppJyPo) {
        //根据资产id和任务id删除数据
        assetAppCpService.deletByAssetIdandTaskId(assetAppJyPo.getAssetId(), assetAppJyPo.getTaskId());
        //新增流程节点时间
        AssetLc assetLc = new AssetLc();
        assetLc.setTaskId(assetAppJyPo.getTaskId());
        assetLc.setAssetName(assetAppJyPo.getAppName());
        assetAppJyPo.setStatus(1);
        //当审核状态为带待核查
        if (assetAppJyPo.getStatus().equals(1)) {
            assetLc.setXfTime(LocalDateTime.now());
            assetLc.setTaskId(assetAppJyPo.getTaskId());
            assetLc.setAssetName("单位核查完成提交" + assetAppJyPo.getAppName());
            assetLcService.insert(assetLc);
        }
        assetAppJyService.save(assetAppJyPo);
        return success();
    }


    /**
     * 电子邮件单位端校验提交
     *
     * @param assetEmailJyPo 电子邮件资产复制表
     * @return
     */
    @ApiOperation(value = "电子邮件单位端校验提交")
    @PostMapping("/emailjyTj")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult emailjyTj(@RequestBody AssetEmailJyPo assetEmailJyPo) {
        //根据资产id和任务id删除数据
        assetEmailCpService.deletByAssetIdandTaskId(assetEmailJyPo.getAssetId(), assetEmailJyPo.getTaskId());
        //新增流程节点时间
        AssetLc assetLc = new AssetLc();
        assetLc.setTaskId(assetEmailJyPo.getTaskId());
        assetLc.setAssetName(assetEmailJyPo.getDzyxhz());
        assetEmailJyPo.setStatus(1);
        //当审核状态为带待核查
        if (assetEmailJyPo.getStatus().equals(1)) {
            assetLc.setXfTime(LocalDateTime.now());
            assetLc.setTaskId(assetEmailJyPo.getTaskId());
            assetLc.setAssetName("单位核查完成提交" + assetEmailJyPo.getDzyxhz());
            assetLcService.insert(assetLc);
        }
        assetEmailJyService.save(assetEmailJyPo);
        return success();
    }
}

