package com.jeeplus.modules.API.works.report;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.jeeplus.common.json.AjaxJson;
import com.jeeplus.common.oss.OSSClientUtil;
import com.jeeplus.common.persistence.Page;
import com.jeeplus.common.utils.JPushClientUtil;
import com.jeeplus.common.utils.StringUtils;
import com.jeeplus.common.web.BaseController;
import com.jeeplus.modules.pushinfo.entity.Pushinfo;
import com.jeeplus.modules.pushinfo.service.PushinfoService;
import com.jeeplus.modules.sys.dao.OfficeDao;
import com.jeeplus.modules.sys.dao.UserDao;
import com.jeeplus.modules.sys.entity.Office;
import com.jeeplus.modules.sys.entity.User;
import com.jeeplus.modules.sys.entity.Workattachment;
import com.jeeplus.modules.sys.service.SystemService;
import com.jeeplus.modules.sys.service.WorkattachmentService;
import com.jeeplus.modules.sys.utils.UserUtils;
import com.jeeplus.modules.utils.ErrorCode;
import com.jeeplus.modules.work.dao.report.WorkReportRecordDao;
import com.jeeplus.modules.work.dao.review.WorkReportReviewDao;
import com.jeeplus.modules.work.entity.report.WorkReport;
import com.jeeplus.modules.work.entity.report.WorkReportRecord;
import com.jeeplus.modules.work.entity.review.WorkReportReview;
import com.jeeplus.modules.work.service.report.WorkReportService;
import com.jeeplus.modules.work.service.review.WorkReportReviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URLDecoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;


@Controller
@RequestMapping(value="${frontPath}/report/report")
public class ReportController extends BaseController {

	@Autowired
	private WorkReportRecordDao workReportRecordDao;

	@Autowired
	private WorkReportService workReportService;
	@Autowired
	private OfficeDao officeDao;

	@Autowired
	private WorkReportReviewService workReportReviewService;

	@Autowired
	private WorkReportReviewDao workReportReviewDao;

	@Autowired
	private UserDao userDao;

	@Autowired
	private PushinfoService pushinfoService;

	@Autowired
	private SystemService systemService;

	@Autowired
	private WorkattachmentService workattachmentService;


	/**
	 * 获取收到的工作日志
	 * @return
	 */
	@RequestMapping(value = "getReportListGet", method=RequestMethod.GET)
	@ResponseBody
	public AjaxJson getReportListGet(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
		AjaxJson j = new AjaxJson();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String userId = request.getParameter("userId");
		String type = request.getParameter("type");
		String pageNo = request.getParameter("pageNo");
		WorkReport workReport = new WorkReport();
		User user = UserUtils.get(userId);

		workReport.setCurrentUser(user);
		//workReport.setStatus("1");
		workReport.setType(type);
		workReport.setSelf(true);
		workReport.setCompanyId(user.getComId());
		List<Map<String, Object>> mapList = Lists.newArrayList();
		Page<WorkReport> page = workReportService.findGetPage(new Page<WorkReport>(request, response), workReport);
		List<WorkReport> list =page.getList();
		for (int i = 0; i < list.size(); i++) {
			WorkReport w = list.get(i);
			User user1 = userDao.get(w.getCreateBy());
			Map<String, Object> map = Maps.newHashMap();
			if(user1!=null){
				map.put("userName", user1.getName());
				map.put("photo", user1.getPhoto());
			}
			if (w.getCreateDate()!=null){
				w.setCreate(sdf.format(w.getCreateDate()));
			}
			List<Workattachment> workattachmentList = workattachmentService.getListByAttachmentIdAndFlag(w.getId(),"77");
			String thisFiles = "";
			if (workattachmentList!=null && workattachmentList.size()!=0){
				for (Workattachment workattachment : workattachmentList){
					thisFiles += workattachment.getUrl()+",";
				}
				if (thisFiles.length() > 1) {
					thisFiles = thisFiles.substring(0, thisFiles.length() - 1);
				}
				w.setThisFiles(thisFiles);
			}
			map.put("workReport", w);
			mapList.add(map);
		}
		if(mapList==null){
			j.setSuccess(false);
			j.setErrorCode(ErrorCode.code_2005);
			j.setMsg("获取工作日志列表失败");
			j.put("data", mapList);
		}else{
			if(Integer.parseInt(pageNo)<=page.getTotalPage()){
				j.setMsg("获取工作日志列表成功");
				j.put("data", mapList);
				j.setErrorCode(ErrorCode.code_1004);
			}else{
				j.setMsg("获取工作日志列表成功");
				j.put("data", Lists.newArrayList());
				j.setErrorCode(ErrorCode.code_1004);
			}
		}
		return j;
	}


	/**
	 * 获取发出的工作日志列表
	 * @return
	 */
	@RequestMapping(value = "getReportListOut", method=RequestMethod.GET)
	@ResponseBody
	public AjaxJson getReportListOut(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
		AjaxJson j = new AjaxJson();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String userId = request.getParameter("userId");
		String type = request.getParameter("type");
		String pageNo = request.getParameter("pageNo");
		WorkReport workReport = new WorkReport();
		User user = UserUtils.get(userId);
		workReport.setCurrentUser(user);
		workReport.setType(type);
		workReport.setStatus("1");
		workReport.setCompanyId(user.getComId());
		List<Map<String, Object>> mapList = Lists.newArrayList();
		Page<WorkReport> page = workReportService.findOutPage(new Page<WorkReport>(request, response), workReport);
		List<WorkReport> list =page.getList();
		for (int i = 0; i < list.size(); i++) {
			WorkReport w = list.get(i);
			User user1 = userDao.get(userId);
			Map<String, Object> map = Maps.newHashMap();
			if(user1 !=null){
				map.put("userName", user1.getName());
				map.put("photo", user1.getPhoto());
			}
			if (w.getCreateDate()!=null){
				w.setCreate(sdf.format(w.getCreateDate()));
			}
			List<Workattachment> workattachmentList = workattachmentService.getListByAttachmentIdAndFlag(w.getId(),"77");
			String thisFiles = "";
			if (workattachmentList!=null && workattachmentList.size()!=0){
				for (Workattachment workattachment : workattachmentList){
					thisFiles += workattachment.getUrl()+",";
				}
				if (thisFiles.length() > 1) {
					thisFiles = thisFiles.substring(0, thisFiles.length() - 1);
				}
				w.setThisFiles(thisFiles);
			}
			map.put("workReport", w);
			mapList.add(map);

		}
		if(mapList==null){
			j.setSuccess(false);
			j.setErrorCode(ErrorCode.code_2005);
			j.setMsg("获取工作日志列表失败");
			j.put("data", mapList);
		}else{
			if(Integer.parseInt(pageNo)<=page.getTotalPage()){
				j.setMsg("获取工作日志列表成功");
				j.put("data", mapList);
			}else{
				j.setMsg("获取工作日志列表成功");
				j.put("data", Lists.newArrayList());
			}
			j.setErrorCode(ErrorCode.code_1004);
		}
		return j;
	}

	/**
	 * 获取工作日志详情
	 * @return
	 */
	@RequestMapping(value = "getReportById", method=RequestMethod.GET)
	@ResponseBody
	public AjaxJson getReportById(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
		AjaxJson j = new AjaxJson();
		String reportId = request.getParameter("reportId");
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		WorkReport workReport = workReportService.get(reportId);
		Map<String,Object> map = Maps.newHashMap();
		if(workReport!=null){
			User user = userDao.get(workReport.getCreateBy());
			if(user!=null){
				map.put("userName", user.getName());
				map.put("photo",user.getPhoto());
			}
			map.put("type",workReport.getType());
			map.put("createDate",sdf.format(workReport.getCreateDate()));
			map.put("thisContent",workReport.getThisContent());
			List<Workattachment> workattachmentList = workattachmentService.getListByAttachmentIdAndFlag(workReport.getId(),"77");
			String thisFiles = "";
			if (workattachmentList!=null && workattachmentList.size()!=0){
				for (Workattachment workattachment : workattachmentList){
					thisFiles += workattachment.getUrl()+",";
				}
				if (thisFiles.length() > 1) {
					thisFiles = thisFiles.substring(0, thisFiles.length() - 1);
				}
			}
			map.put("thisFiles", thisFiles);
			//map.put("thisFiles",workReport.getThisFiles());
			map.put("nextContent",workReport.getNextContent());
			map.put("nextFiles",workReport.getNextFiles());
			map.put("remarks",workReport.getRemarks());
			map.put("companyId",workReport.getCompanyId());
		}
		//记录已读
		if (StringUtils.isNotBlank(workReport.getId())){
			workReportService.updateReadFlag(workReport);
		}
		if( map==null){
			j.setSuccess(false);
			j.setMsg("获取工作日志详情失败");
			j.setErrorCode(ErrorCode.code_2005);
			j.put("data",map);
		}
		else{
			j.put("data", map);
			j.setMsg("获取工作日志详情成功");
			j.setErrorCode(ErrorCode.code_1004);
		}

		return j;
	}

	/**
	 * 查看用户列表
	 * @param request
	 * @param response
	 * @param redirectAttributes
	 * @return
	 */
	@RequestMapping(value = "getUserByReportId", method=RequestMethod.GET)
	@ResponseBody
	public AjaxJson getUserByReportId(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
		AjaxJson j = new AjaxJson();
		String reportId = request.getParameter("reportId");
		String readFlag = request.getParameter("readFlag");
		WorkReportRecord workReportRecord = new WorkReportRecord();
		WorkReport workReport = new WorkReport();
		workReport.setId(reportId);
		workReportRecord.setReport(workReport);
		workReportRecord.setReadFlag(readFlag);
		List<Map<String, Object>> mapList = Lists.newArrayList();
		List<WorkReportRecord> list = workReportRecordDao.findUserList(workReportRecord);
		for (int i = 0; i < list.size(); i++) {
			WorkReportRecord w=list.get(i);
			User user = userDao.get(w.getUser());
			if(user!=null){
				Map<String, Object> map = Maps.newHashMap();
				map.put("userName", user.getName());
				map.put("photo", user.getPhoto());
				mapList.add(map);
			}
		}
		if( mapList==null){
			j.setSuccess(false);
			j.setMsg("获取用户失败");
			j.setErrorCode(ErrorCode.code_2005);
			j.put("data",mapList);
		}
		else{
			j.put("data", mapList);
			j.setMsg("获取用户成功");
			j.setErrorCode(ErrorCode.code_1004);
		}

		return j;
	}

	/**
	 * 添加工作日志
	 * @param request
	 * @param response
	 * @return
	 * @throws ParseException
	 */
	@RequestMapping(value = "addReport", method=RequestMethod.POST)
	@ResponseBody
	public AjaxJson addReport(HttpServletRequest request, HttpServletResponse response) throws Exception {
		AjaxJson j = new AjaxJson();
		HashMap<String, String> requestMap = findRequestMap(request);
		String type = URLDecoder.decode(requestMap.get("type")==null?"":requestMap.get("type"), "UTF-8");
		String thisContent =  URLDecoder.decode(requestMap.get("thisContent")==null?"":requestMap.get("thisContent"), "UTF-8");
		String nextContent = URLDecoder.decode(requestMap.get("nextContent")==null?"":requestMap.get("nextContent"), "UTF-8");
//	     String startDate = requestMap.get("startDate");
//	     String finishDate = requestMap.get("finishDate");
		String remarks = URLDecoder.decode(requestMap.get("remarks")==null?"":requestMap.get("remarks")==null?"":requestMap.get("remarks"), "UTF-8");
		String idsu =  URLDecoder.decode(requestMap.get("idsu")==null?"":requestMap.get("idsu"), "UTF-8");
		String idsg = URLDecoder.decode(requestMap.get("idsg")==null?"":requestMap.get("idsg"), "UTF-8");
		String officeIds = URLDecoder.decode(requestMap.get("officeIds")==null?"":requestMap.get("officeIds"), "UTF-8");
		String userId = URLDecoder.decode(requestMap.get("userId")==null?"":requestMap.get("userId"), "UTF-8");
		String thisFiles = URLDecoder.decode(requestMap.get("thisFiles")==null?"":requestMap.get("thisFiles"), "UTF-8");
		String nextFiles = URLDecoder.decode(requestMap.get("nextFiles")==null?"":requestMap.get("nextFiles"), "UTF-8");
		Office company = UserUtils.getSelectCompany();
		WorkReport workReport = new WorkReport();
		String officeId = URLDecoder.decode(requestMap.get("officeId")==null?"":requestMap.get("officeId"), "UTF-8");
        /*if(UserUtils.getSelectCompany() !=null) {
            companyId = UserUtils.getSelectCompany().getId();
        }else{
            companyId =UserUtils.getUser().getComId();
        }
        if(UserUtils.getSelectOffice() !=null) {
            officeId = UserUtils.getSelectOffice().getId();
        }else{
            officeId =UserUtils.getUser().getOffice().getId();
        }*/
		workReport.setCompanyId(company.getId());
		workReport.setOfficeId(officeId);
		workReport.setType(type);
		workReport.setThisContent(thisContent);
		//workReport.setThisFiles(thisFiles);
		workReport.setNextContent(nextContent);
		//workReport.setNextFiles(nextFiles);
		workReport.setStatus("1");
//	     workReport.setStartDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(startDate));
//	     workReport.setFinishDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(finishDate));
		workReport.setRemarks(remarks);
		Set<String> set = new HashSet<String>();
		if(officeIds !=null && !officeIds.equals("")){
			String [] offices = officeIds.split(",");
			for (int i = 0; i < offices.length; i++) {
				Office office = officeDao.get(offices[i]);
				List<User> users = new ArrayList<>();
				if ("2".equals(office.getType())) {
					users = systemService.findUserByOfficeId(offices[i]);
				}else {
					users = systemService.findUserByOffices(office,company);
				}
				for (User user:users){
					set.add(user.getId());
				}
			}
		}
		if(idsu !=null && !idsu.equals("")){
			String [] users = idsu.split(",");
			for (int i = 0; i < users.length; i++) {
				//userList.add(users[i]);
				set.add(users[i]);
			}
		}
		String recordIds = "";
		for (String id :set){
			recordIds += id +",";
		}
		if (StringUtils.isNotBlank(recordIds)){
			recordIds = recordIds.substring(0,recordIds.length()-1);
		}
		workReport.setWorkReportRecordIdsUser(recordIds);
		workReport.setWorkReportRecordIdsGroup(idsg);
		//  workReport.setWorkReportRecordIdsGroup(idsg);  //发布到群
		User user=UserUtils.get(userId);
		workReport.setCreateBy(user);
		workReport.setUpdateBy(user);
		workReportService.save(workReport);
		WorkReport w = workReportService.findNewId();
		if(w!=null){
			j.put("reportId", w.getId());
			j.setMsg("发布工作日志成功");
			j.setErrorCode(ErrorCode.code_1004);
		}else{
			j.put("reportId", "");
			j.setSuccess(false);
			j.setErrorCode(ErrorCode.code_2006);
			j.setMsg("发布工作日志失败");
		}
		return j;
	}



	/**
	 * 查看公告的评论与回复列表
	 * @param request
	 * @param response
	 * @param redirectAttributes
	 * @return
	 */
	@RequestMapping(value = "getReviewList", method=RequestMethod.GET)
	@ResponseBody
	public AjaxJson getReviewList(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
		AjaxJson j = new AjaxJson();
		String reportId = request.getParameter("reportId");
		String pageNo = request.getParameter("pageNo");
		WorkReportReview workReportReview = new WorkReportReview();
		workReportReview.setReportId(reportId);
		List<Map<String,Object>> mapList = Lists.newArrayList();
		Page<WorkReportReview> page = workReportReviewService.findListByReportId(new Page<WorkReportReview>(request, response), workReportReview);
		List<WorkReportReview> list =page.getList();
		for (int i = 0; i < list.size(); i++) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			WorkReportReview w = list.get(i);
			Map<String,Object> map = Maps.newHashMap();
			if(w.getParentId()!=null && !w.getParentId().equals("0") && !w.getParentId().equals("")){
				WorkReportReview w1 = workReportReviewDao.get(w.getParentId());
				if(w1!=null){
					User u = userDao.get(w1.getCreateBy());
					if(u!=null){
						map.put("userName2", u.getName());
						map.put("userId2", u.getId());
					}else{
						map.put("userName2", "");
					}
				}else{
					map.put("userName2", "");
				}
			}else{
				map.put("userName2", "");
			}
			User user = userDao.get(w.getCreateBy());
			if(user!=null){
				map.put("userId", user.getId());
				map.put("userName",user.getName());
			}
			map.put("reviewId", w.getId());
			map.put("createDate",sdf.format(w.getCreateDate()));
			map.put("content", w.getContent());
			mapList.add(map);
		}

		if(mapList==null){
			j.setSuccess(false);
			j.setErrorCode(ErrorCode.code_2005);
			j.setMsg("获取评论列表失败");
			j.put("data", mapList);
			page.getPageNo();
		}else {
			if(Integer.parseInt(pageNo)<=page.getTotalPage()){
				j.setMsg("获取评论列表成功");
				j.put("data", mapList);
			}else{
				j.setMsg("获取评论列表成功");
				j.put("data",Lists.newArrayList());
			}
			j.setErrorCode(ErrorCode.code_1004);
		}
		return j;
	}

	/**
	 * 添加评论与回复
	 * @param request
	 * @param response
	 * @return
	 * @throws ParseException
	 */
	@Transactional
	@RequestMapping(value = "addComment", method=RequestMethod.POST)
	@ResponseBody
	public AjaxJson addComment(HttpServletRequest request, HttpServletResponse response) throws Exception {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		AjaxJson j = new AjaxJson();
		HashMap<String, String> requestMap = findRequestMap(request);
		String type = URLDecoder.decode(requestMap.get("type")==null?"":requestMap.get("type"), "UTF-8");
		String content = URLDecoder.decode(requestMap.get("content")==null?"":requestMap.get("content"), "UTF-8");
		String parentId = URLDecoder.decode(requestMap.get("parentId")==null?"":requestMap.get("parentId"), "UTF-8");
		String reportId = URLDecoder.decode(requestMap.get("reportId")==null?"":requestMap.get("reportId"), "UTF-8");
		String userId = URLDecoder.decode(requestMap.get("userId")==null?"":requestMap.get("userId"), "UTF-8");
		WorkReportReview workReportReview = new WorkReportReview();
		workReportReview.setType(type);
		workReportReview.setContent(content);
		workReportReview.setReportId(reportId);
		workReportReview.setParent(new WorkReportReview(parentId));
		if (userId ==null || userId.equals("")){
			userId = UserUtils.getUser().getId();
		}
		User user=UserUtils.get(userId);
		workReportReview.setCreateBy(user);
		workReportReview.setUpdateBy(user);
		workReportReview.preInsert();
		workReportReviewDao.insert(workReportReview);
		Map extras = new HashMap();
		Pushinfo pushinfo = new Pushinfo();
		WorkReport workReport = workReportService.get(reportId);
		String pushUserId = "";
		String typeName = "";
		String createDate = "";
		String companyId = "";
		if (workReport!=null){
			pushUserId = workReport.getCreateBy().getId()==null?"":workReport.getCreateBy().getId();
			typeName = workReport.getType()==null?"":workReport.getType();
			createDate = workReport.getCreateDate()==null?"":sdf.format(workReport.getCreateDate()).substring(5, 10);
			companyId = workReport.getCompanyId()==null?"":workReport.getCompanyId();
		}

		if (typeName.equals("1")){
			typeName = "日报";
		}else if (typeName.equals("2")){
			typeName = "周报";
		}else if (typeName.equals("3")){
			typeName = "月报";
		}
		String title = "工作日志";
		String contents= "";
		String remarks = "";
		String extrasType = "";
		if (type.equals("0")){
			contents=user.getName()+"评论了你"+createDate+"提交的"+typeName;
			extrasType = "3001";
			remarks = "评论内容："+content;
		}else {
			contents=user.getName()+"回复了你"+createDate+"的评论";
			remarks =  "回复内容："+content;
			extrasType = "3002";
			if (parentId!=null && !parentId.equals("")){
				WorkReportReview  review = workReportReviewService.get(parentId);
				String users = review.getCreateBy().getId();
				if (users!=null && users.equals(pushUserId)){
					extrasType = "3001";
				}
				pushUserId = users;
			}
		}
		pushinfo.setType(extrasType);
		extras.put("type", extrasType);
		extras.put("id", reportId);
		logger.info("------reportId="+reportId);

		pushinfo.setCurrentUser(UserUtils.getUser());
		pushinfo.setRemarks(remarks);
		pushinfo.setCompanyId(companyId);
		pushinfo.setUserId(UserUtils.getUser().getId());
		pushinfo.setMobile("ios,android");
		pushinfo.setPushId(reportId);
		pushinfo.setTitle(title);
		pushinfo.setContent(contents);
		pushinfo.setPushUserId(pushUserId);
		pushinfo.setStatus(typeName);
		pushinfo.setParentType("singleWorkReport");
		pushinfoService.save(pushinfo);
		extras.put("id", reportId);
		extras.put("typeName", typeName);
		String alias = pushUserId;
		if (!user.getId().equals(pushUserId)) {
			boolean b = JPushClientUtil.sendNotificationToAlias(title, contents, extras, alias);
			if (b) {
				j.setMsg("发布成功");
				j.setErrorCode(ErrorCode.code_1004);
			} else {
				j.setMsg("添加评论与回复推送失败");
				j.setErrorCode(ErrorCode.code_2006);
				j.setSuccess(false);
			}
		}else {
			j.setMsg("发布成功");
		}
		return j;
	}


	/**
	 * 保存工作日志文件
	 */
	@Transactional
	@ResponseBody
	@RequestMapping(value = "saveReportFile",method=RequestMethod.POST)
	public AjaxJson saveReportFile(MultipartHttpServletRequest multiRequest,HttpServletRequest servletRequest) throws Exception{
		AjaxJson j=new AjaxJson();
		try {
			String reportId = multiRequest.getParameter("reportId");
			WorkReport report =  workReportService.get(reportId);
			String thisFiles = report.getThisFiles();
			String filePaths= "";
			OSSClientUtil ossUtil =new OSSClientUtil();
			Iterator<String> fileNames = multiRequest.getFileNames();
			System.out.println("-----------开始------------------");
			while(fileNames.hasNext()){

				//取得上传文件
				MultipartFile file = multiRequest.getFile(fileNames.next());
				if(file != null){
					OSSClientUtil ossClientUtil = new OSSClientUtil();
					String filePath= workReportService.uploadFile(ossClientUtil,file,report,"77");
					//取得当前上传文件的文件名称
					//String filePath= ossUtil.uploadFile2OSS(file, "notify");
					filePaths = filePath;
				}
			}
			/*if(thisFiles==null || thisFiles.equals("")){
				if(filePaths.contains(",")){
					report.setThisFiles(filePaths.substring(1,filePaths.length()-1));
				}else {
					report.setThisFiles(filePaths);
				}
			}else{
				filePaths = thisFiles+","+filePaths;
				report.setThisFiles(filePaths);
			}
			workReportService.save(report);*/
			System.out.println("-----------结束------------------");
			j.put("filePath",filePaths);
			j.setSuccess(true);
			j.setErrorCode(ErrorCode.code_1004);
			j.setMsg("上传成功！");
		}catch (Exception e){
			j.put("filePath","");
			j.setSuccess(false);
			j.setMsg("上传失败！");
			j.setErrorCode(ErrorCode.code_2004);
		}finally {
			return j;
		}
	}
}
