package com.jeeplus.modules.workprojectcompletion.service;

import com.google.common.collect.Maps;
import com.jeeplus.common.persistence.Page;
import com.jeeplus.common.service.CrudService;
import com.jeeplus.common.utils.DateUtils;
import com.jeeplus.common.utils.MenuStatusEnum;
import com.jeeplus.common.utils.StringUtils;
import com.jeeplus.modules.act.entity.Act;
import com.jeeplus.modules.act.service.ActTaskService;
import com.jeeplus.modules.act.utils.ProcessDefCache;
import com.jeeplus.modules.sys.entity.Office;
import com.jeeplus.modules.sys.entity.Role;
import com.jeeplus.modules.sys.entity.User;
import com.jeeplus.modules.sys.utils.UserUtils;
import com.jeeplus.modules.workactivity.entity.Activity;
import com.jeeplus.modules.workactivity.entity.WorkActivityProcess;
import com.jeeplus.modules.workactivity.service.ActivityService;
import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
import com.jeeplus.modules.workclientinfo.dao.WorkClientAttachmentDao;
import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
import com.jeeplus.modules.workfullmanage.dao.WorkFullManageDao;
import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
import com.jeeplus.modules.workfullmanage.service.WorkFullRecordService;
import com.jeeplus.modules.workproject.dao.WorkProjectDao;
import com.jeeplus.modules.workproject.entity.WorkProject;
import com.jeeplus.modules.workproject.service.WorkProjectService;
import com.jeeplus.modules.workprojectcompletion.dao.WorkProjectCompletionDao;
import com.jeeplus.modules.workprojectcompletion.entity.WorkProjectCompletionInfo;
import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
import com.jeeplus.modules.workprojectnotify.util.UtilNotify;
import org.activiti.engine.ActivitiObjectNotFoundException;
import org.activiti.engine.HistoryService;
import org.activiti.engine.IdentityService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.history.HistoricTaskInstanceQuery;
import org.activiti.engine.runtime.ProcessInstance;
import org.apache.commons.lang.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

@Service
@Transactional(readOnly = true)
public class WorkProjectCompletionService extends CrudService<WorkProjectCompletionDao ,WorkProjectCompletionInfo> {

    @Autowired
    private WorkProjectCompletionDao workProjectCompletionDao;
    @Autowired
    private WorkClientAttachmentDao workClientAttachmentDao;
    @Autowired
    private RuntimeService runtimeService;

    @Autowired
    private IdentityService identityService;

    @Autowired
    private ActTaskService actTaskService;
    @Autowired
    protected HistoryService historyService;
    @Autowired
    private WorkFullManageDao workFullManageDao;
    @Autowired
    private WorkProjectNotifyService workProjectNotifyService;

    @Autowired
    private WorkProjectDao workProjectDao;
    @Autowired
    private WorkProjectService workProjectService;
    @Autowired
    private WorkFullRecordService workFullRecordService;
    @Autowired
    private WorkActivityMenuService workActivityMenuService;
    @Autowired
    private WorkActivityProcessService workActivityProcessService;
    @Autowired
    private ActivityService activityService;

    public WorkProjectCompletionInfo get(String id){
        WorkProjectCompletionInfo workProjectCompletionInfo =super.get(id);
        return workProjectCompletionInfo;
    }
    public WorkProjectCompletionInfo getByProjectId(String projectId){
        WorkProjectCompletionInfo workProjectCompletionInfo =dao.getByProjectId(projectId);
        return workProjectCompletionInfo;
    }

    public Page<WorkProjectCompletionInfo> findPage(Page<WorkProjectCompletionInfo> page, WorkProjectCompletionInfo workProjectCompletionInfo) {
        workProjectCompletionInfo.getSqlMap().put("dsf", dataScopeFilter(workProjectCompletionInfo.getCurrentUser(), "o", "u","", MenuStatusEnum.END.getValue()));
        workProjectCompletionInfo.setPage(page);
        List<WorkProjectCompletionInfo> list=dao.findList(workProjectCompletionInfo);
        page.setList(list);
        return page;
    }


    /**
     * 查询附件列表
     * @param workClientAttachment
     * @return
     */
    @Transactional(readOnly = false)
    public List<WorkClientAttachment> findList(WorkClientAttachment workClientAttachment){
        return workClientAttachmentDao.findList(workClientAttachment);
    }
    /*
    * 提交项目竣工流程
    * */
    @Transactional(readOnly = false)
    public void save(WorkProjectCompletionInfo workProjectCompletionInfo,Map<String, Object> variables){
        super.save(workProjectCompletionInfo);
        /*identityService.setAuthenticatedUserId(workProjectCompletionInfo.getCurrentUser().getId());
        String businessKey = workProjectCompletionInfo.getId().toString();
        variables.put("type", ActUtils.PD_WORKCOMPLETE[0]);
        variables.put("busId", businessKey);
        variables.put("title", 1);//设置标题；*/
        identityService.setAuthenticatedUserId(workProjectCompletionInfo.getCurrentUser().getId());
        WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("28bc804ba6df46ab807b3fd30aa72e65",UserUtils.getSelectOffice());
        // 启动流程
        String businessKey = workProjectCompletionInfo.getId().toString();
        String processType = workActivityMenu.getProcessType();
        StringBuffer buffer = new StringBuffer();
        Activity activity = new Activity();
        if (StringUtils.isNotBlank(workActivityMenu.getId())){
            workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
            List<Activity> activities = workActivityMenu.getActivities();
            for (Activity a:activities){
                if (a.getDelFlag().equals("0") && a.getCount() == 1){
                    activity = a;
                }
            }
            buffer.append(activity.getRole().getEnname());
            variables.put("type", workActivityMenu.getProcessType());
        }else {
            processType= "projectCompleteAudit";
        }
        variables.put("type", processType);
        variables.put("busId", businessKey);
        variables.put("title", workProjectCompletionInfo.getRemarks());//设置标题；
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
        workProjectCompletionInfo.setProcessInstance(processInstance);
        // 更新流程实例ID
        workProjectCompletionInfo.setProcessInstanceId(processInstance.getId());
        workProjectCompletionDao.updateProcessInstanceId(workProjectCompletionInfo);
        List<Activity> list= workActivityMenu.getActivities();
        if (list!=null && list.size()!=0){
            workActivityProcessService.saveList(list,processInstance.getId());
        }else {
            WorkActivityProcess workActivityProcess = new WorkActivityProcess();
            workActivityProcess.setProcessKey(processType);
            workActivityProcess.setCount(1);
            workActivityProcess.setProcessInstanceId(processInstance.getId());
            workActivityProcess.setIsApproval("0");
            workActivityProcessService.save(workActivityProcess);
        }
        WorkProjectNotify workProjectNotify = UtilNotify
                .saveNotify(workProjectCompletionInfo.getId(),
                        null,
                        workFullManageDao.get(workProjectCompletionInfo.getProjectId()).getCompanyId(),
                        "项目竣工申请：待审批",
                        UserUtils.getUser().getName()+"发起项目竣工申请！",
                        "17",
                        "0",
                        "待审批",
                        variables.get("SSRHbmzr").toString());
        if(workActivityMenu!=null&&StringUtils.isNotBlank(workActivityMenu.getId())&&StringUtils.isNotBlank(activity.getId())){
            //角色审批
            if(StringUtils.isNotBlank(activity.getRole().getEnname())){
                workProjectNotify.setNotifyRole(buffer.toString());
                workProjectNotify.setUser(new User());
            }
            //人员审批
            if(StringUtils.isNotBlank(activity.getUser().getId())){
                workProjectNotify.setUser(new User(activity.getUser().getId()));
                workProjectNotify.setNotifyRole("");
            }
        }
        workProjectNotifyService
                    .save(workProjectNotify);


    }
    /*
    * 提交项目竣工流程
    * */
    @Transactional(readOnly = false)
    public void save(WorkProjectCompletionInfo workProjectCompletionInfo){
        super.save(workProjectCompletionInfo);
    }

    public WorkProjectCompletionInfo getByProcessInstanceId(String processInstanceId){
        WorkProjectCompletionInfo workProjectCompletionInfo = workProjectCompletionDao.getByProcessInstanceId(processInstanceId);
        return workProjectCompletionInfo;
    }



    /* * 审核审批保存
* @param testAudit
*/
    @Transactional(readOnly = false)
    public String auditSave(WorkProjectCompletionInfo workProjectCompletionInfo){
        try {
            String taskDefKey = workProjectCompletionInfo.getAct().getTaskDefKey();
            if(!"modifyApply".equals(taskDefKey)){
                actTaskService.claim(workProjectCompletionInfo.getAct().getTaskId(), UserUtils.getUser().getId());
            }
            String comment = ("yes".equals(workProjectCompletionInfo.getAct().getFlag())?"[同意] ":"[驳回] ")+workProjectCompletionInfo.getAct().getComment();
            Role role = UserUtils.getSelectRole().get(0);
            StringBuffer buffer = DateUtils.getByEnnme(role.getEnname());
            WorkProjectNotify workProjectNotify = new WorkProjectNotify();
            // 对不同环节的业务逻辑进行操作
            workProjectNotify.setUser(workProjectCompletionInfo.getCreateBy());
            workProjectNotify.setRemarks("待通知");
            // 设置意见
            workProjectCompletionInfo.getAct().setComment(comment);
            //业务逻辑对应的条件表达式
            String exp = "";
            Map<String, Object> vars = Maps.newHashMap();
            String str = "";
            User user = null;
            String notifyRole = "";
            List<Activity> activitieList = activityService.getByProcessInstanceId(workProjectCompletionInfo.getProcessInstanceId());
            WorkActivityMenu workActivityMenu = new WorkActivityMenu();
            if (activitieList!=null && activitieList.size()!=0){
                workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
                workActivityMenu.setActivities(activitieList);
            }

            WorkActivityProcess workActivityProcess = new WorkActivityProcess();
            WorkActivityProcess selectProcess = new WorkActivityProcess();
            selectProcess.setProcessInstanceId(workProjectCompletionInfo.getProcessInstanceId());
            List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectProcess);
            String taskCount = "";
            int key = 0;
            List<Activity> activities = workActivityMenu.getActivities();
            if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("projectCompleteAudit")) {
                key = 1;
                for (int i =0;i<workActivityProcesses.size();i++){
                    WorkActivityProcess activityProcess = workActivityProcesses.get(i);
                    String count = taskDefKey.replace("task","").replace("audit","");
                    if (taskDefKey.contains("audit") && (activityProcess.getCount()+"").contains(count)){
                        taskCount = count;
                        exp = "pass";
                        workActivityProcess.setId("");
                        workActivityProcess.setCount(0);
                        if (!"yes".equals(workProjectCompletionInfo.getAct().getFlag())) {
                            workProjectCompletionInfo.setProjectStatus("4");
                            str = "项目竣工：已撤销!";
                            workActivityProcess.setIsApproval("2");
                        }else {
                            workProjectCompletionInfo.setProjectStatus("1");
                            str = "项目竣工：重新申请!";
                            workActivityProcess.setIsApproval("1");
                        }
                    }else if ((activityProcess.getCount()+"").contains(count)){
                        workActivityProcess = activityProcess;
                        taskCount = count;
                        if (!workActivityProcess.getIsApproval().equals("0")){
                            workActivityProcess.setId("");
                        }
                        exp = "pass";
                        if (!"yes".equals(workProjectCompletionInfo.getAct().getFlag())) {
                            workProjectCompletionInfo.setProjectStatus("2");
                            str = "项目竣工：被驳回!";
                            workActivityProcess.setIsApproval("2");
                            String returnBack = "-1";
                            for (Activity activity:activities){
                                if(activity.getCount()==Integer.parseInt(count)){
                                    returnBack = activity.getReturnBack();
                                    break;
                                }
                            }
                            if (returnBack.equals("0")) {
                                workActivityProcess.setId("");
                            }

                        }else {
                            str = "项目竣工：待审批!";
                            workActivityProcess.setIsApproval("1");
                        }
                    }
                }
            }else {
                for (int i =0;i<workActivityProcesses.size();i++) {
                    workActivityMenu.setId(workActivityProcesses.get(0).getId());
                    workActivityMenu.setProcessType("projectCompleteAudit");
                    WorkActivityProcess activityProcess = workActivityProcesses.get(i);
                    String count = activityProcess.getCount() + "";
                    if (!activityProcess.getIsApproval().equals("0")){
                        workActivityProcess.setId("");
                    }
                    taskCount = "1";
                    // 审核环节
                    if ("bmzr".equals(taskDefKey) && count.contains("1")) {
                        workActivityProcess = activityProcess;
                        exp = "bmzrpass";
                        user = workProjectCompletionInfo.getCreateBy();
                        if("yes".equals(workProjectCompletionInfo.getAct().getFlag())){
                            str = "项目竣工信息：待审批!";
                            workProjectCompletionInfo.setProjectStatus("3");
                            workActivityProcess.setIsApproval("1");
                        }else{
                            str = "项目竣工信息：被驳回!";
                            workProjectCompletionInfo.setProjectStatus("2");
                            workActivityProcess.setIsApproval("2");
                        }
                    } else if ("modifyApply".equals(taskDefKey) && count.contains("0")) {
                        workActivityProcess.setCount(0);
                        exp = "modifyApply";
                        if("yes".equals(workProjectCompletionInfo.getAct().getFlag())){
                            notifyRole = buffer.append("bmzr").toString();
                            workProjectCompletionInfo.setProjectStatus("1");
                            workActivityProcess.setIsApproval("1");
                            str = "项目竣工信息：重新申请!";
                        }else{
                            workProjectCompletionInfo.setProjectStatus("4");
                            workActivityProcess.setIsApproval("2");
                            str = "项目竣工信息：已撤销!";
                        }
                        break;
                    }
                }

                // 未知环节，直接返回
            }
            workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workProjectCompletionInfo.getProcessInstanceId(),taskDefKey,"modifyApply",workProjectCompletionInfo.getAct().getFlag(),comment, activities);

            workProjectCompletionInfo.preUpdate();
            vars.put(exp, "yes".equals(workProjectCompletionInfo.getAct().getFlag())? true : false);
            actTaskService.complete(workProjectCompletionInfo.getAct().getTaskId(), workProjectCompletionInfo.getAct().getProcInsId(), workProjectCompletionInfo.getAct().getComment(), vars);
            String projectId = workProjectCompletionInfo.getProjectId();
            WorkFullManage workFullManage = workFullManageDao.get(projectId);
            //workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workFullPay.getProcessInstanceId(),taskDefKey,"modifyApply",workFullPay.getAct().getFlag(),comment, activities);
            WorkProjectNotify projectNotify = new WorkProjectNotify();
            projectNotify.setNotifyId(workProjectCompletionInfo.getId());
            workProjectNotifyService.readByNotifyId(projectNotify);
            workProjectNotify.setNotifyId(workProjectCompletionInfo.getId());
            workProjectNotify.setCompanyId(workFullManage.getCompanyId());
            workProjectNotify.setContent(workProjectCompletionInfo.getAct().getComment());
            workProjectNotify.setType("17");
            workProjectNotify.setStatus("0");
            WorkProjectNotify notifys = new WorkProjectNotify();
            notifys.setNotifyId(workProjectCompletionInfo.getId());
            workProjectNotifyService.readByNotifyId(notifys);
            boolean state = actTaskService.isProcessEnd(workProjectCompletionInfo.getAct().getProcInsId());
            if(!state) {
                WorkProjectNotify notify = new WorkProjectNotify();
                notify.setNotifyId(workProjectCompletionInfo.getId());
                workProjectNotifyService.readByNotifyId(notify);
                if("yes".equals(workProjectCompletionInfo.getAct().getFlag())){
                    workProjectCompletionInfo.setProjectStatus("3");
                    workProjectNotifyService
                            .save(UtilNotify
                                    .saveNotify(workProjectCompletionInfo.getId(),
                                            workProjectCompletionInfo.getCreateBy(),
                                            workFullManage.getCompanyId(),
                                            "您的项目竣工信息信息审核：已通过",
                                            workProjectCompletionInfo.getAct().getComment(),
                                            "17",
                                            "0",
                                            "待通知",
                                            ""));
                    HashMap<Object, Object> map = Maps.newHashMap();
                    map.put("status","5");
                    map.put("projectId",projectId);
                    workProjectCompletionDao.updateWorkFullManage(map);
                    String hostMaster = workFullManage.getHostMaster();
                    String hostMember = workFullManage.getHostMember();
                    String followMember = workFullManage.getFollowMember();
                    String followMaster = workFullManage.getFollowMaster();
                    String[] split = hostMaster.split(",");
                    String[] split1 = hostMember.split(",");
                    String[] split2 = followMember.split(",");
                    String[] split3 = followMaster.split(",");
                    Object[] objects = ArrayUtils.addAll(split, split1);
                    Object[] objects1 = ArrayUtils.addAll(split2, split3);
                    Object[] objects2 = ArrayUtils.addAll(objects, objects1);
                    Set<String> set = new HashSet<>();
                    for (int i = 0; i < objects2.length; i++) {
                        if(objects2[i] == null || "".equals(objects2[i])){
                            continue;
                        }
                        set.add(objects2[i].toString());
                    }
                    //移除项目登记人
                    if(set.contains(workFullManage.getCreateBy().getId())){
                        set.remove(workFullManage.getCreateBy().getId());
                    }
                    Iterator<String> iterator = set.iterator();
                    while (iterator.hasNext()){
                        String next = iterator.next();
                        workProjectNotifyService
                                .save(UtilNotify
                                        .saveNotify(workProjectCompletionInfo.getId(),
                                                UserUtils.get(next),
                                                workFullManage.getCompanyId(),
                                                "项目竣工已完成",
                                                workProjectCompletionInfo.getAct().getComment(),
                                                "17",
                                                "0",
                                                "待通知",
                                                ""));
                    }

                    WorkProject workProject = workProjectService.get(workFullManage.getWorkProject().getId());
                    workProject.setState("1");//1为能归档
                    workProjectDao.updateStatus(workProject);

                    //项目竣工完成  给归档管理员发送通知
    //                workFullRecordService.queryWjgly(UserUtils.getSelectCompany().getId(),"glygd");
                    workProjectNotifyService
                            .save(UtilNotify
                                    .saveNotify(workProjectCompletionInfo.getId(),
                                            null,
                                            workFullManage.getCompanyId(),
                                            "项目竣工已完成,请归档！！！",
                                            workProjectCompletionInfo.getAct().getComment(),
                                            "17",
                                            "0",
                                            "待通知",
                                            buffer + "glygd"));
                }else {
                    if (StringUtils.isNotBlank(workProjectCompletionInfo.getProjectStatus()) && !workProjectCompletionInfo.getProjectStatus().equals("4")){
                        workProjectCompletionInfo.setProjectStatus("2");
                        workProjectNotifyService
                                .save(UtilNotify
                                        .saveNotify(workProjectCompletionInfo.getId(),
                                                workProjectCompletionInfo.getCreateBy(),
                                                workFullManage.getCompanyId(),
                                                "项目竣工：未通过!",
                                                workProjectCompletionInfo.getAct().getComment(),
                                                "17",
                                                "0",
                                                "待通知",
                                                ""));
                    }
                }
            }else{
                if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("projectCompleteAudit")) {
                    workProjectNotify = UtilNotify
                            .saveNotify(workProjectCompletionInfo.getId(),
                                    new User(),
                                   workFullManage.getCompanyId(),
                                    str,
                                    workProjectCompletionInfo.getAct().getComment(),
                                    "17",
                                    "0",
                                    "待审批",
                                    "");
                    String count = taskDefKey.replace("audit","").replace("task","");

                    workProjectNotify = activityService.getByFlagAndTaskDefKey(
                            activities,
                            workProjectNotify,
                            taskDefKey,
                            workProjectCompletionInfo.getAct().getFlag(),
                            count,
                            workProjectCompletionInfo.getCreateBy());
                    workProjectNotifyService
                            .save(workProjectNotify);
                }else {
                    WorkProjectNotify notify = new WorkProjectNotify();
                    notify.setNotifyId(workProjectCompletionInfo.getId());
                    workProjectNotifyService.readByNotifyId(notify);
                    if (!"yes".equals(workProjectCompletionInfo.getAct().getFlag())){
                        workProjectNotifyService
                                .save(UtilNotify
                                        .saveNotify(workProjectCompletionInfo.getId(),
                                                user,
                                                workFullManageDao.get(projectId).getCompanyId(),
                                                str,
                                                workProjectCompletionInfo.getAct().getComment(),
                                                "17",
                                                "0",
                                                "重新申请",
                                                notifyRole));
                    }else{
                        workProjectNotifyService
                                .save(UtilNotify
                                        .saveNotify(workProjectCompletionInfo.getId(),
                                                user,
                                                workFullManageDao.get(projectId).getCompanyId(),
                                                str,
                                                workProjectCompletionInfo.getAct().getComment(),
                                                "17",
                                                "0",
                                                "待审批",
                                                notifyRole));
                    }
                }

            }
            workProjectCompletionDao.updateStatus(workProjectCompletionInfo);
            return "保存审核意见成功！";
        }catch (ActivitiObjectNotFoundException e){
            logger.error("ActivitiObjectNotFoundException e:"+e);
            return "流程已审批，不能重新审批！";
        }catch (Exception e){
            logger.error("Exception e:"+e);
            return "保存审核意见失败！！";
        }
    }
    @Transactional(readOnly = false)
    public void deleteProject(String projectId){
        workProjectCompletionDao.deleteProject(projectId);
    }

    /**
     * 获取已办任务
     * @return
     */
    public List<WorkProjectCompletionInfo> historicList(Act act){
        String userId = UserUtils.getUser().getId();
        HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery().finished().taskAssignee(userId);
        // 设置查询条件
        if (StringUtils.isNotBlank(act.getProcDefKey())){
            query.processDefinitionKey(act.getProcDefKey());
        }
        if(act != null){
            if (act.getBeginDate() != null){
                query.taskCompletedAfter(act.getBeginDate());
            }
            if (act.getBeginDate() != null){
                query.taskCompletedBefore(act.getEndDate());
            }
        }
        List<HistoricTaskInstance> list = query.list();
        List<WorkProjectCompletionInfo> list1 = new ArrayList<>();
        Office office = UserUtils.getSelectCompany();
        String companyId = office==null?"":office.getId();
        for (HistoricTaskInstance histTask : list) {
            WorkProjectCompletionInfo workProjectCompletionInfo = this.getByProcessInstanceId(histTask.getProcessInstanceId());
            if(workProjectCompletionInfo != null){
                WorkFullManage workFullManage = workFullManageDao.get(workProjectCompletionInfo.getProjectId());
                if (workProjectCompletionInfo != null && workFullManage.getCompanyId().equals(companyId)) {
                    workProjectCompletionInfo.setCreateBy(UserUtils.get(workProjectCompletionInfo.getCreateBy().getId()));
                    historyService.getHistoricIdentityLinksForProcessInstance(histTask.getProcessInstanceId());
                    act.setHistTask(histTask);
                    act.setVars(histTask.getProcessVariables());
                    act.setProcDef(ProcessDefCache.get(histTask.getProcessDefinitionId()));
                    act.setStatus("finish");
                    workProjectCompletionInfo.setAct(act);
                    list1.add(workProjectCompletionInfo);
                }
            }
        }
        return list1;
    }

    @Transactional(readOnly = false)
    public int updateFlag(WorkProjectCompletionInfo workProjectCompletionInfo){
        return workProjectCompletionDao.updateFlag(workProjectCompletionInfo);
    }
}
