Newer
Older
huludao / src / main / java / com / newfiber / api / mobile / service / RiverPatrolService.java
package com.newfiber.api.mobile.service;

import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.newfiber.api.core.base.BaseService;
import com.newfiber.api.core.bean.RespBodyObj;
import com.newfiber.api.core.utils.DateUtils;
import com.newfiber.api.core.utils.NumberUtil;
import com.newfiber.api.core.utils.UUIDPK;
import com.newfiber.api.mobile.dao.PatrolProblemDao;
import com.newfiber.api.mobile.dao.ProcessProblemDao;
import com.newfiber.api.mobile.dao.RiverBusinessPicsDao;
import com.newfiber.api.mobile.model.domain.*;
import com.newfiber.api.pc.dao.RiverManage.PatrolDaysConfigDao;
import com.newfiber.api.pc.dao.RiverManage.RiverChiefDao;
import com.newfiber.api.pc.dao.RiverManage.RiverPatrolDao;
import com.newfiber.api.pc.model.River.PatrolDaysConfig;
import com.newfiber.api.pc.model.River.RiverPatrol;
import com.newfiber.api.pc.model.River.RiverUserRelation;
import com.newfiber.api.pc.service.RiverUserRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * 河长巡查表 Service
 * @author xcc
 * @date 2018-12-04 16:21:59
 */
@Service("riverPatrolService")
public class RiverPatrolService extends BaseService<RiverPatrolDao, RiverPatrol> {
	@Autowired
	private RiverPatrolDao riverPatrolDao;

	@Autowired
	private RiverBusinessPicsDao riverBusinessPicsDao;

	@Autowired
	private PatrolProblemDao patrolProblemDao;

	@Autowired
	private PatrolDaysConfigDao patrolDaysConfigDao;

	@Autowired
	private ProcessProblemDao processProblemDao;

	@Autowired
	private RiverChiefDao riverChiefDao;

	@Autowired
	private RiverUserRelationService riverUserRelationService;

	@Autowired
	private PatrolProblemStateService patrolProblemStateService;

	@Autowired
	private PatrolProblemService patrolProblemService;

	/** 根据条件获取河长巡查表列表(无分页) */
	public List<RiverPatrol> queryListByDivisionNo(Map<String, Object> map){
		List<RiverPatrol> riverPatrolList =  riverPatrolDao.queryListByDivisionNo(map);
		if(!CollectionUtil.isEmpty(riverPatrolList)){
			for (RiverPatrol riverPatrol : riverPatrolList) {
				String patrolNo = riverPatrol.getPatrolNo();
				List<RiverPatrol> riverPatrols = riverPatrolDao.queryCountByPatrolNo(patrolNo);
				riverPatrol.setProblemNum(riverPatrols.get(0).getProblemNum());
				if(riverPatrols.size() > 1){
					riverPatrol.setFinishedNum(riverPatrols.get(1).getProblemNum());
				}else{
					riverPatrol.setFinishedNum(0);
				}
			}
		}
		return riverPatrolList;
	}
	
	/** 
	 * @Description: 根据巡河编号查询对应的巡河详情
	 * @param patrolNo 
	 * @return: com.newfiber.api.pc.model.River.RiverPatrol
	 * @Author: Wmj 
	 * @Date: 2018/12/12 17:04
	 */ 
	public RiverPatrol queryInfoByPatrolNo(String userNo,String patrolNo){
		RiverPatrol riverPatrol = riverPatrolDao.queryInfoByPatrolNo(userNo,patrolNo);
		if(riverPatrol != null){
			//为了区分app与web端,改为在controller层做插入
//			if(riverPatrol.getPatrolPicsNo() != null && !riverPatrol.getPatrolPicsNo().equals("")){
//				String riverPicsNo = riverPatrol.getPatrolPicsNo();
//				List<RiverBusinessPics> picsList = riverBusinessPicsDao.queryListByPicsNo(riverPicsNo);
//				if(!picsList.isEmpty()){
//					for (RiverBusinessPics riverBusinessPics : picsList) {
//						riverBusinessPics.setRealPath(nginxfile+riverBusinessPics.getRiverPicsAddress());
//					}
//				}
//				riverPatrol.setPicsList(picsList);
//			}
			int problemNum = patrolProblemDao.queryProblemByPatrolNo(patrolNo);
			riverPatrol.setProblemNum(problemNum);
			if(problemNum > 0){
				int finishedNum = patrolProblemDao.queryFinishedByPatrolNo(patrolNo);
				riverPatrol.setFinishedNum(finishedNum);
			}else{
				riverPatrol.setFinishedNum(0);
			}
		}
		return riverPatrol;
	}

	/**
	 * @Description: 向巡查表中添加数据
	 * @param map
	 * @return: com.newfiber.api.core.bean.RespBodyObj<java.lang.Object>
	 * @Author: Wmj
	 * @Date: 2018/12/11 19:45
	 */
	public RespBodyObj<Object> insertData(Map<String, Object> map, HttpServletRequest request){
		//1.组装数据
		RiverPatrol riverPatrol = new RiverPatrol();
		String chiefUserNo = request.getHeader("userNo");
		//todo
		riverPatrol.setRiverChiefNo(chiefUserNo);
		riverPatrol.setPatrolStartTime((Date)map.get("patrolStartTime"));
		riverPatrol.setPatrolNo(UUIDPK.UUIDGenerator.getUUID());
		riverPatrol.setPatrolSummary((String)map.get("patrolSummary"));
		riverPatrol.setPatrolEndTime((Date)map.get("patrolEndTime"));
		riverPatrol.setPatrolName((String)map.get("patrolName"));
		riverPatrol.setPatrolDistance((BigDecimal)map.get("patrolDistance"));
		riverPatrol.setPatrolCoordinates((String)map.get("patrolCoordinates"));
		//2.上传巡河图片
		List<RiverBusinessPics> picsList = (List<RiverBusinessPics>)map.get("files");
		if(picsList!=null && !picsList.isEmpty()){
			String riverPicsNo = UUIDPK.UUIDGenerator.getUUID();
			riverPatrol.setPatrolPicsNo(riverPicsNo);
			savePatrolImg(riverPicsNo, chiefUserNo, picsList,"巡河问题图片");
		}
		//3.非河长用户,提交巡河流程到前端选择的河流中
		String riverNo = riverChiefDao.queryRiverNoByChiefUserNo(chiefUserNo);
		if(StringUtils.isEmpty(riverNo)){
			riverPatrol.setRiverNo((String)map.get("riverNo"));
		}else{
			riverPatrol.setRiverNo(riverNo);
		}
		//保存巡查记录
		int patrolResult = riverPatrolDao.insert(riverPatrol);
		//如果是巡查问题,向巡查问题表中增加数据
		if(patrolResult > 0){
			//绑定巡查记录编号
			List<String> list = (List<String>)map.get("problemNos");
			if(list!=null && list.size()>0){
				patrolProblemDao.updatePatrolNo(list,riverPatrol.getPatrolNo());
			}
		}
		return RespBodyObj.ok();
	}

	/**
	 * 添加问题
	 * @param map
	 * @param request
	 * @return
	 * @throws Exception
	 */
	public RespBodyObj saveProblem(Map<String, Object> map, HttpServletRequest request){
		String chiefUserNo = request.getHeader("userNo");
		//3.非河长用户,提交巡河流程到前端选择的河流中
		String riverPatrol = "";
		String riverNo = riverChiefDao.queryRiverNoByChiefUserNo(chiefUserNo);
		if(StringUtils.isEmpty(riverNo)){
			riverPatrol = (String)map.get("riverNo");
		}else{
			riverPatrol = riverNo;
		}
		//如果是巡查问题,向巡查问题表中增加数据
		if(!StringUtils.isEmpty(map.get("problemType"))){
			//提交巡查问题的操
			Map<String,String> result = new HashMap<>();
			result.put("problemNo",insertPatrolProblem(map, chiefUserNo, riverPatrol));
			return RespBodyObj.ok(result);
		}
		return RespBodyObj.error();
	}

	/**
	 * 保存巡查图片
	 * @param riverPicsNo
	 * @param chiefUserNo
	 * @param picsList
	 */
	private void savePatrolImg(String riverPicsNo, String chiefUserNo, List<RiverBusinessPics> picsList,String fileName) {
			List<RiverBusinessPics> pic = JSON.parseArray(JSON.toJSONString(picsList),RiverBusinessPics.class);
			if (pic!=null &&!pic.isEmpty()) {
				for (RiverBusinessPics file : pic) {
					try {
						RiverBusinessPics riverBusinessPics = new RiverBusinessPics();
						riverBusinessPics.setRiverPicsNo(riverPicsNo);
						riverBusinessPics.setRiverPicsName(fileName);
						riverBusinessPics.setRiverPicsAddress(file.getRiverPicsAddress());
						riverBusinessPics.setCreateUserNo(chiefUserNo);
						riverBusinessPics.setCreateTime(new Date());
						riverBusinessPicsDao.insert(riverBusinessPics);
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
	}

	/**
	 * 提交巡查问题操作
	 * @param map
	 * @param chiefUserNo
	 * @param riverNo
	 */
	private String insertPatrolProblem(Map<String, Object> map, String chiefUserNo, String riverNo) {
		PatrolProblem patrolProblem = new PatrolProblem();
		String patrolProblemNo = UUIDPK.UUIDGenerator.getUUID();
		patrolProblem.setCurrentUserNo(chiefUserNo);
		patrolProblem.setPatrolProblemNo(patrolProblemNo);
		patrolProblem.setProblemType((String)map.get("problemType"));
		patrolProblem.setProblemState(2);
		patrolProblem.setProblemStateStr("待分配");
		patrolProblem.setProblemAddress((String)map.get("problemAddress"));
		patrolProblem.setProblemTime(new Date());
		patrolProblem.setProblemDescription((String)map.get("problemDescription"));
		List<RiverBusinessPics> pics = (List<RiverBusinessPics>)map.get("picsList");
		if(pics!=null && !pics.isEmpty()){
			String problemPicsNo = UUIDPK.UUIDGenerator.getUUID();
			patrolProblem.setProblemPicsNo(problemPicsNo);
			savePatrolImg(problemPicsNo, chiefUserNo, pics,"巡河进程问题图片");
		}

		String problemProcessNo = UUIDPK.UUIDGenerator.getUUID();
		patrolProblem.setProblemProcessNo(problemProcessNo);
		patrolProblem.setCoordinate((String)map.get("coordinate"));
		patrolProblem.setRiverNo(riverNo);
		//patrolProblem.setPatrolNo(patrolNo);
		//创建任务时,生成个人任务状态
        RiverUserRelation relation = riverRelation(chiefUserNo,riverNo, patrolProblem);

		boolean problemResult = patrolProblemService.insert(patrolProblem);
		//添加流程
		if(problemResult){
		    if(relation==null){
                //向巡查问题流程表中增加数据
                ProcessProblem processProblem = new ProcessProblem();
                //添加河道的关联
                processProblem.setProcessNo(problemProcessNo);
                processProblem.setUserNo(chiefUserNo);
                //根据当前用户和所巡查的河道查询其所在的组织
                String userOrg = riverPatrolDao.queryOrgNoByUserNo(chiefUserNo);
                processProblem.setUserOrg(userOrg);
                processProblem.setProcessNextOrg((String)map.get("processNextOrg"));
                processProblem.setProcessOption("提交问题给上级");
                processProblem.setProcessTime(new Date());
                processProblemDao.insert(processProblem);
            }else{
		    	//创建流程
				createProcess(problemProcessNo,chiefUserNo, relation,map);
			}
		}
		return patrolProblem.getPatrolProblemNo();
	}

	/**
	 * 巡河人员创建流程
	 * @param problemProcessNo
	 * @param relation
	 */
	private void createProcess(String problemProcessNo,String chiefUserNo, RiverUserRelation relation,Map<String,Object> map) {

		ProcessProblem processProblem = new ProcessProblem();
		List<RiverBusinessPics> processFiles = (List<RiverBusinessPics>)map.get("processFiles");
		if(processFiles!=null && !processFiles.isEmpty()){
			String riverPicsNo = UUIDPK.UUIDGenerator.getUUID();
			processProblem.setProcessPicsNo(riverPicsNo);
			savePatrolImg(riverPicsNo, chiefUserNo, processFiles,"巡河流程图片");
		}
		//向巡查问题流程表中增加数据
		processProblem.setProcessNo(problemProcessNo);
		processProblem.setUserNo(chiefUserNo);
		processProblem.setNextUserName(relation.getDutyUserNo());
		processProblem.setProcessState(1);
		processProblem.setProcessStateName("新建任务");
		processProblem.setProcessOption("新建任务");
		processProblem.setProcessTime(new Date());
		processProblemDao.insert(processProblem);

		//创建待派发流程
       /* ProcessProblem processProblem2 = new ProcessProblem();
        processProblem2.setProcessNo(problemProcessNo);
        processProblem2.setUserNo(relation.getDutyUserNo());
        processProblem2.setProcessState(2);
		processProblem.setProcessOption("待派发");
        processProblem2.setProcessStateName("待派发");
        processProblem2.setProcessTime(new Date());
        processProblemDao.insert(processProblem2);*/
    }

	/**
	 * 提交巡河问题时建立关联
	 * @param riverNo
	 * @param patrolProblem
	 */
	private RiverUserRelation riverRelation(String chiefUserNo,String riverNo, PatrolProblem patrolProblem) {
		//查询河道的关联用户
		RiverUserRelation relation = riverUserRelationService.selectByRiverNo(riverNo);
		if(relation != null){
		    //巡河人员
            patrolProblem.setCurrentUserNo(chiefUserNo);
            //负责人
            patrolProblem.setNextUserNo(relation.getHandlerNo());
			patrolProblem.setRiverRelation(relation.getId());
			//创建关联巡查问题表状态数据
			//1.添加巡查问题人员记录流程
			List<PatrolProblemState> states = new ArrayList<>();
			PatrolProblemState state = new PatrolProblemState();
			state.setPatrolProblemNo(patrolProblem.getPatrolProblemNo());
			state.setUserNo(chiefUserNo);
			state.setProblemState(3);
			state.setCreateTime(new Date());
			states.add(state);
			//2.添加负责人任务状态
			PatrolProblemState state2 = new PatrolProblemState();
			state2.setPatrolProblemNo(patrolProblem.getPatrolProblemNo());
			state2.setUserNo(relation.getDutyUserNo());
			state2.setProblemState(2);
			state2.setCreateTime(new Date());
			states.add(state2);
            //2.添加领导任务状态
            PatrolProblemState state3 = new PatrolProblemState();
            state3.setPatrolProblemNo(patrolProblem.getPatrolProblemNo());
            state3.setUserNo(relation.getLeaderNo());
            state3.setProblemState(3);
            states.add(state3);
			state3.setCreateTime(new Date());
			patrolProblemStateService.save(states);
		}
		return relation;
	}

	/**
	 * 统计本级河长应巡、已巡检次数
	 * @param map 起止时间,sid
	 * @return
	 * @throws Exception
	 */
	public Map<String,Object> pollingTimesCurrnt(Map<String, Object> map) throws Exception{
		Map<String,Object> result = new HashMap<String,Object>();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd Hh:mm:ss");
		Date st = sdf.parse((String)map.get("startTime"));
		Date et = sdf.parse((String)map.get("endTime"));
		map.put("st",st);
		map.put("et",et);
		List<ProblemStatistical> dataList = riverPatrolDao.pollingTimesCurrnt(map);
		//已巡检人数
		int finishPolling = 0;
		//未巡检人数
		int unfinishPolling = 0;
		for(ProblemStatistical ps:dataList){
			//获取对应河长巡检配置信息
			PatrolDaysConfig example = new PatrolDaysConfig();
			example.setChiefUserNo(ps.getCode());
			PatrolDaysConfig config = patrolDaysConfigDao.selectByCode(ps.getCode());
			if(config != null){
				//设置生效时间
				Date createTime = config.getUpdateTime()!=null?config.getUpdateTime():config.getCreateTime();
				//起止时间段应巡检次数
				int needDone = DateUtils.getMonthSpace(st.getTime()<createTime.getTime()?createTime:st,et)*config.getPatrolDays();
				ps.setTotal(needDone);
				//巡检次数和应巡次数比较
				if(ps.getNum()>=needDone){
					ps.setPercentage("100%");
				}else {
					ps.setPercentage(NumberUtil.getRoundingNum((ps.getNum()/(double)needDone),4)*100+"%");
				}
			}else{
				ps.setPercentage("0%");
			}
			if(ps.getNum()>0){
				finishPolling++;
			}else{
				unfinishPolling++;
			}
		}
		result.put("statisticsData",dataList);
		result.put("finishPolling",finishPolling);
		result.put("unfinishPolling",unfinishPolling);
		result.put("totalUser",finishPolling+unfinishPolling);
		return result;
	}

	/**
	 * 某时间段河长的巡查记录列表
	 * @author chg
	 * @date 2018-12-11
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<Map<String,Object>> pollingList(Map<String,Object> params) throws Exception{
		List<Map<String,Object>> result = new ArrayList<Map<String,Object>>();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date st = sdf.parse((String)params.get("startTime"));
		Date et = sdf.parse((String)params.get("endTime"));
		params.put("st",st);
		params.put("et",et);
		if(params.get("page")!= null && params.get("rows") != null){
			int startPage = ((int)params.get("page")-1)*((int)params.get("rows"));
			int pageSize = (int)params.get("rows");
			params.put("startPage",startPage);
			params.put("pageSize",pageSize);
		}
		List<RiverPatrol> dataList = riverPatrolDao.queryListByUserNo(params);
		for(RiverPatrol rp:dataList){
			Map<String,Object> map = new HashMap<String,Object>();
			map.put("code",rp.getPatrolNo());
			map.put("name",DateUtils.format(rp.getPatrolStartTime(),"yyyy年MM月dd日")+rp.getUserName()+rp.getRiverName());
			map.put("time",DateUtils.format(rp.getPatrolStartTime(),"yyyy-MM-dd HH:mm")+"至"+DateUtils.format(rp.getPatrolEndTime(),"HH:mm"));
			//问题个数
			EntityWrapper<PatrolProblem> proWrapper = new EntityWrapper<PatrolProblem>();
			proWrapper.eq("Patrol_No",rp.getPatrolNo());
			List<PatrolProblem> problems = patrolProblemDao.selectList(proWrapper);
			int total = problems != null?problems.size():0;
			//处理完成个数
			proWrapper.eq("Problem_State",2);
			problems = patrolProblemDao.selectList(proWrapper);
			int finished = problems != null?problems.size():0;
			map.put("problemTotal",total);
			map.put("problemFinished",finished);
			result.add(map);
		}
		return result;
	}

	/**
	 * 获取当前用户下级区域所有河长巡查距离总和
	 * @author chg
	 * @date 2018-12-11
	 * @param params
	 * @return
	 */
	public List<InspectTheDistance> queryDistance(Map<String,Object> params) throws ParseException{
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd Hh:mm:ss");
		params.put("st",sdf.parse((String)params.get("startTime")));
		params.put("et",sdf.parse((String)params.get("endTime")));
		if(params.get("page")!= null && params.get("rows") != null){
			int startPage = ((int)params.get("page")-1)*((int)params.get("rows"));
			int pageSize = (int)params.get("rows");
			params.put("startPage",startPage);
			params.put("pageSize",pageSize);
		}
		return riverPatrolDao.queryDistance(params);
	}

	/**
	 * 获取当前用户下级区域所有河长巡查次数总和
	 * @author chg
	 * @date 2018-12-11
	 * @param params
	 * @return
	 */
	public List<InspectTheDistance> pollingTimesSubordinate(Map<String,Object> params) throws ParseException{
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd Hh:mm:ss");
		params.put("st",sdf.parse((String)params.get("startTime")));
		params.put("et",sdf.parse((String)params.get("endTime")));
		if(params.get("page")!= null && params.get("rows") != null){
			int startPage = ((int)params.get("page")-1)*((int)params.get("rows"));
			int pageSize = (int)params.get("rows");
			params.put("startPage",startPage);
			params.put("pageSize",pageSize);
		}
		return riverPatrolDao.pollingTimesSubordinate(params);
	}

	/**
	 * 下级河长巡查统计
	 * @author chg
	 * @date 2018-12-11
	 * @param params
	 * @return
	 */
	public Map<String,Object> statisticalLowerLevel(Map<String,Object> params)throws ParseException{
		Map<String,Object> result = new HashMap<String,Object>();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd Hh:mm:ss");
		params.put("st",sdf.parse((String)params.get("startTime")));
		params.put("et",sdf.parse((String)params.get("endTime")));
		//下级区域应巡人数集合
		List<ProblemStatistical> dataList = riverPatrolDao.poollingUserNumSubordinate(params);
		//已巡总人数
		int totalDone = 0;
		//应巡总人数
		int totalNeedDone = 0;
		for(int i=0; i<dataList.size();i++){
			//应巡人数
			int a = riverPatrolDao.inspected(dataList.get(i).getCode(),sdf.parse((String)params.get("startTime")),sdf.parse((String)params.get("endTime")));
			dataList.get(i).setNum(a);
			//已巡次数
			int b = dataList.get(i).getTotal();
			dataList.get(i).setPercentage(NumberUtil.getRoundingNum(b>0?a/(double)b:0,4)*100+"%");
			totalDone +=b;
			totalNeedDone +=a;
		}
		//最高里程对象
		List<InspectTheDistance> theDistance1 = riverPatrolDao.queryDistance(params);
		if(theDistance1!= null && theDistance1.size()>0){
			result.put("farthest",theDistance1.get(0));
		}else {
			InspectTheDistance farthest = new InspectTheDistance();
			farthest.setMileage(0);
			farthest.setUserName("无");
			farthest.setDivisionName("无");
			result.put("farthest",farthest);
		}
		//巡查次数最多
		List<InspectTheDistance> theDistance2 = riverPatrolDao.pollingTimesSubordinate(params);
		if(theDistance2!= null && theDistance2.size()>0){
			result.put("theMost",theDistance2.get(0));
		}else {
			InspectTheDistance theMost = new InspectTheDistance();
			theMost.setNum(0);
			theMost.setUserName("无");
			theMost.setDivisionName("无");
			result.put("theMost",theMost);
		}
		result.put("dataList",dataList);
		result.put("totalDone",totalDone);
		result.put("totalUndone",totalNeedDone-totalDone);
		result.put("totalNeedDone",totalNeedDone);
		return result;
	}

	/**
	 * 获取指定区域所有河长巡查次数
	 * @author chg
	 * @date 2018-12-11
	 * @param params
	 * @return
	 */
	public List<InspectTheDistance> pollingTimesByDivisionNo(Map<String,Object> params) throws ParseException{
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd Hh:mm:ss");
		params.put("st",sdf.parse((String)params.get("startTime")));
		params.put("et",sdf.parse((String)params.get("endTime")));
		if(params.get("page")!= null && params.get("rows") != null){
			int startPage = ((int)params.get("page")-1)*((int)params.get("rows"));
			int pageSize = (int)params.get("rows");
			params.put("startPage",startPage);
			params.put("pageSize",pageSize);
		}
		return riverPatrolDao.pollingTimesByDivisionNo(params);
	}

	public List<RiverPatrol> queryList(Integer startRow, Integer pageSize, String userNo,String divisionNo) {
		List<RiverPatrol> riverPatrolList =  riverPatrolDao.queryList(startRow,pageSize,userNo,divisionNo);
		if(!CollectionUtil.isEmpty(riverPatrolList)){
			for (RiverPatrol riverPatrol : riverPatrolList) {
				String patrolNo = riverPatrol.getPatrolNo();
				List<RiverPatrol> riverPatrols = riverPatrolDao.queryCountByPatrolNo(patrolNo);
				riverPatrol.setProblemNum(riverPatrols.get(0).getProblemNum());
				if(riverPatrols.size() > 1){
					riverPatrol.setFinishedNum(riverPatrols.get(1).getProblemNum());
				}else{
					riverPatrol.setFinishedNum(0);
				}
			}
		}
		return riverPatrolList;
	}
}