Enford il y a 5 ans
Parent
commit
584ce850e5
79 fichiers modifiés avec 28086 ajouts et 0 suppressions
  1. 127 0
      src/main/java/com/jeeplus/modules/API/appversion/AppVersionController.java
  2. 650 0
      src/main/java/com/jeeplus/modules/API/caseinfo/CaseController.java
  3. 1550 0
      src/main/java/com/jeeplus/modules/API/easemob/EasemobController.java
  4. 89 0
      src/main/java/com/jeeplus/modules/API/iim/ImContactController.java
  5. 193 0
      src/main/java/com/jeeplus/modules/API/maillist/ColleagueController.java
  6. 63 0
      src/main/java/com/jeeplus/modules/API/maillist/ContactsController.java
  7. 222 0
      src/main/java/com/jeeplus/modules/API/maillist/GroupController.java
  8. 371 0
      src/main/java/com/jeeplus/modules/API/maillist/InviteController.java
  9. 1173 0
      src/main/java/com/jeeplus/modules/API/oa/AttendanceController.java
  10. 224 0
      src/main/java/com/jeeplus/modules/API/sys/LoginMobileController.java
  11. 377 0
      src/main/java/com/jeeplus/modules/API/sys/RegisterMobileController.java
  12. 82 0
      src/main/java/com/jeeplus/modules/API/sys/SessionController.java
  13. 67 0
      src/main/java/com/jeeplus/modules/API/userinfo/CurrentCompanyController.java
  14. 835 0
      src/main/java/com/jeeplus/modules/API/userinfo/JoinCompanyController.java
  15. 564 0
      src/main/java/com/jeeplus/modules/API/userinfo/ManageCompanyController.java
  16. 37 0
      src/main/java/com/jeeplus/modules/API/userinfo/ManageInfoController.java
  17. 380 0
      src/main/java/com/jeeplus/modules/API/userinfo/MyInfoController.java
  18. 112 0
      src/main/java/com/jeeplus/modules/API/userinfo/SearchController.java
  19. 268 0
      src/main/java/com/jeeplus/modules/API/userinfo/SetUpController.java
  20. 3291 0
      src/main/java/com/jeeplus/modules/API/works/Act/ActTaskMoblieController.java
  21. 230 0
      src/main/java/com/jeeplus/modules/API/works/approval/LeaveInterfaceController.java
  22. 164 0
      src/main/java/com/jeeplus/modules/API/works/approval/OverTimeController.java
  23. 444 0
      src/main/java/com/jeeplus/modules/API/works/appshow/WorkAppShowController.java
  24. 3610 0
      src/main/java/com/jeeplus/modules/API/works/businessmanagement/BusinessManagementController.java
  25. 375 0
      src/main/java/com/jeeplus/modules/API/works/calendar/CalendarController.java
  26. 308 0
      src/main/java/com/jeeplus/modules/API/works/goout/gooutMobileController.java
  27. 355 0
      src/main/java/com/jeeplus/modules/API/works/leavemobliecontroller/LeaveMobileController.java
  28. 258 0
      src/main/java/com/jeeplus/modules/API/works/manageCalendar/manageCalendarController.java
  29. 410 0
      src/main/java/com/jeeplus/modules/API/works/meeting/MeetingCortroller.java
  30. 57 0
      src/main/java/com/jeeplus/modules/API/works/moduleChoose/moduleChooseInterfaceCortroller.java
  31. 815 0
      src/main/java/com/jeeplus/modules/API/works/notify/NotifyController.java
  32. 265 0
      src/main/java/com/jeeplus/modules/API/works/oaallccontroller/OaAController.java
  33. 309 0
      src/main/java/com/jeeplus/modules/API/works/oabuycontroller/OaBController.java
  34. 281 0
      src/main/java/com/jeeplus/modules/API/works/oaevectioncontroller/OaEvectionMobileController.java
  35. 213 0
      src/main/java/com/jeeplus/modules/API/works/oaperformancecontroller/OaPController.java
  36. 124 0
      src/main/java/com/jeeplus/modules/API/works/outworksignin/WorkOutSignInInterfaceController.java
  37. 275 0
      src/main/java/com/jeeplus/modules/API/works/overtimecontroller/OverTimeMobileController.java
  38. 230 0
      src/main/java/com/jeeplus/modules/API/works/payment/PaymentMobileController.java
  39. 232 0
      src/main/java/com/jeeplus/modules/API/works/pettycash/PettyCashMobileController.java
  40. 231 0
      src/main/java/com/jeeplus/modules/API/works/pushInfo/pushInfoCortroller.java
  41. 646 0
      src/main/java/com/jeeplus/modules/API/works/report/ReportController.java
  42. 283 0
      src/main/java/com/jeeplus/modules/API/works/usesealcontroller/UseSealMobileController.java
  43. 832 0
      src/main/java/com/jeeplus/modules/API/works/workattendancecontroller/WorkAttendanceController.java
  44. 328 0
      src/main/java/com/jeeplus/modules/API/works/workreimbur/WorkReimburMobileController.java
  45. 20 0
      src/main/java/com/jeeplus/modules/act/dao/ActDao.java
  46. 440 0
      src/main/java/com/jeeplus/modules/act/entity/Act.java
  47. 75 0
      src/main/java/com/jeeplus/modules/act/rest/DispatcherServletConfiguration.java
  48. 39 0
      src/main/java/com/jeeplus/modules/act/rest/FilterServletOutputStream.java
  49. 48 0
      src/main/java/com/jeeplus/modules/act/rest/GenericResponseWrapper.java
  50. 63 0
      src/main/java/com/jeeplus/modules/act/rest/JsonpCallbackFilter.java
  51. 346 0
      src/main/java/com/jeeplus/modules/act/service/ActAuditService.java
  52. 178 0
      src/main/java/com/jeeplus/modules/act/service/ActModelService.java
  53. 335 0
      src/main/java/com/jeeplus/modules/act/service/ActProcessService.java
  54. 1112 0
      src/main/java/com/jeeplus/modules/act/service/ActTaskService.java
  55. 245 0
      src/main/java/com/jeeplus/modules/act/service/ActivityXmlService.java
  56. 107 0
      src/main/java/com/jeeplus/modules/act/service/ext/ActGroupEntityService.java
  57. 31 0
      src/main/java/com/jeeplus/modules/act/service/ext/ActGroupEntityServiceFactory.java
  58. 151 0
      src/main/java/com/jeeplus/modules/act/service/ext/ActUserEntityService.java
  59. 31 0
      src/main/java/com/jeeplus/modules/act/service/ext/ActUserEntityServiceFactory.java
  60. 234 0
      src/main/java/com/jeeplus/modules/act/utils/ActUtils.java
  61. 104 0
      src/main/java/com/jeeplus/modules/act/utils/DateConverter.java
  62. 94 0
      src/main/java/com/jeeplus/modules/act/utils/ProcessDefCache.java
  63. 33 0
      src/main/java/com/jeeplus/modules/act/utils/PropertyType.java
  64. 87 0
      src/main/java/com/jeeplus/modules/act/utils/Variable.java
  65. 138 0
      src/main/java/com/jeeplus/modules/act/web/ActModelController.java
  66. 222 0
      src/main/java/com/jeeplus/modules/act/web/ActProcessController.java
  67. 623 0
      src/main/java/com/jeeplus/modules/act/web/ActTaskController.java
  68. 22 0
      src/main/java/com/jeeplus/modules/activityassignment/dao/ActivityAssignmentDao.java
  69. 92 0
      src/main/java/com/jeeplus/modules/activityassignment/entity/ActivityAssignment.java
  70. 79 0
      src/main/java/com/jeeplus/modules/activityassignment/service/ActivityAssignmentService.java
  71. 212 0
      src/main/java/com/jeeplus/modules/activityassignment/web/ActivityAssignmentController.java
  72. 21 0
      src/main/java/com/jeeplus/modules/alterinfo/dao/AlterInfoDao.java
  73. 67 0
      src/main/java/com/jeeplus/modules/alterinfo/entity/AlterInfo.java
  74. 56 0
      src/main/java/com/jeeplus/modules/alterinfo/service/AlterInfoService.java
  75. 196 0
      src/main/java/com/jeeplus/modules/alterinfo/web/AlterInfoController.java
  76. 19 0
      src/main/java/com/jeeplus/modules/appversion/dao/AppversionsDao.java
  77. 72 0
      src/main/java/com/jeeplus/modules/appversion/entity/Appversions.java
  78. 57 0
      src/main/java/com/jeeplus/modules/appversion/service/AppversionsService.java
  79. 487 0
      src/main/java/com/jeeplus/modules/appversion/web/AppversionsController.java

+ 127 - 0
src/main/java/com/jeeplus/modules/API/appversion/AppVersionController.java

@@ -0,0 +1,127 @@
+package com.jeeplus.modules.API.appversion;
+
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.appversion.entity.Appversions;
+import com.jeeplus.modules.appversion.service.AppversionsService;
+import com.jeeplus.modules.utils.ErrorCode;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Controller
+@RequestMapping(value="${frontPath}/app/version")
+public class AppVersionController extends BaseController {
+
+    @Autowired
+    private AppversionsService appversionsService;
+
+    /**
+     * 查看用户最新版本信息
+     * @param type
+     * @return json数据
+     */
+    @RequestMapping(value = "getAppversion", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getAppversion(String type,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Appversions app = new Appversions();
+        if (type.equals("1")){
+            app.setRemarks("IOS");
+            app.setDelFlag("0");
+        }else if((type.equals("2"))){
+            app.setRemarks("Android");
+            app.setDelFlag("0");
+        }else {
+//            app.setRemarks("1");
+//            app.setDelFlag("1");
+            j.setSuccess(false);
+            j.setErrorCode(ErrorCode.code_2005);
+            j.setMsg("未查询到版本信息");
+            j.put("data",new HashMap());
+            return j;
+        }
+        List<Appversions> list = appversionsService.findList(app);
+        if(list==null || list.size()==0){
+            j.setSuccess(true);
+            j.setErrorCode(ErrorCode.code_1004);
+            j.setMsg("获取最新app版本信息成功");
+            j.put("data", new HashMap());
+        }else{
+            String version = list.get(0).getVersions();
+            String content = list.get(0).getContent();
+            String qrcode = list.get(0).getQrcode();
+            /*if (qrcode!=null){
+                qrcode = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+qrcode;
+            }*/
+            String creartDate = sdf.format(list.get(0).getCreateDate());
+            Map map = new HashMap();
+            map.put("id",list.get(0).getId());
+            map.put("version",version==null?"":version);
+            map.put("content",content==null?"":content);
+            if(type.equals("1")){
+                map.put("qrcode",qrcode==null?"":qrcode);
+                map.put("url",list.get(0).getUrl()==null?"":list.get(0).getUrl());
+            }
+            if(type.equals("2")){
+                map.put("qrcode",qrcode==null?"":"http://cdn.gangwaninfo.com/app-data/appVersion/qrcode_1535459137.png");
+                map.put("url",list.get(0).getUrl()==null?"":"http://cdn.gangwaninfo.com/app-data/appVersion/ruihuaoa.apk");
+            }
+            map.put("creartDate",creartDate==null?"":creartDate);
+            map.put("createBy",list.get(0).getCreateBy()==null?"":list.get(0).getCreateBy().getName());
+            map.put("files",list.get(0).getFiles()==null?"":list.get(0).getFiles());
+            map.put("remarks",list.get(0).getRemarks()==null?"":list.get(0).getRemarks());
+            j.put("data",map);
+            j.setMsg("获取最新app版本信息成功");
+            j.setErrorCode(ErrorCode.code_1004);
+        }
+        return j;
+    }
+
+    /**
+     *  根据 id 查询一条版本记录
+     * @param request 版本信息的id
+     * @return  json
+     */
+    @RequestMapping(value = "getAppversionById",method = RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getAppversionById(HttpServletRequest request,HttpServletResponse response){
+
+        AjaxJson j = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String id = request.getParameter("id");
+        Appversions app = appversionsService.get(id);
+
+        if(app != null){
+            Map<String,String> map = new HashMap<String,String>();
+            map.put("id",app.getId());
+            map.put("content",app.getContent());
+            map.put("createDate",sdf.format(app.getCreateDate()));
+            map.put("createBy",app.getCreateBy().getName());
+            map.put("versions",app.getVersions());
+            map.put("qrcode",app.getQrcode());
+            map.put("url",app.getUrl());
+            map.put("files",app.getFiles());
+            map.put("remarks",app.getRemarks());
+
+            j.put("data",map);
+            j.setSuccess(true);
+            j.setErrorCode(ErrorCode.code_1004);
+            j.setMsg("获取版本信息成功!");
+        }
+        return  j ;
+    }
+
+
+}

+ 650 - 0
src/main/java/com/jeeplus/modules/API/caseinfo/CaseController.java

@@ -0,0 +1,650 @@
+package com.jeeplus.modules.API.caseinfo;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.casebuildinfo.entity.CaseBuildInfo;
+import com.jeeplus.modules.casebuildinfo.service.CaseBuildInfoService;
+import com.jeeplus.modules.casecategory.entity.CaseCategory;
+import com.jeeplus.modules.casecategory.service.CaseCategoryService;
+import com.jeeplus.modules.casedesigninfo.entity.CaseDesignInfo;
+import com.jeeplus.modules.casedesigninfo.service.CaseDesignInfoService;
+import com.jeeplus.modules.caseexecuteinfo.entity.CaseExecuteInfo;
+import com.jeeplus.modules.caseexecuteinfo.service.CaseExecuteInfoService;
+import com.jeeplus.modules.caseinfo.dao.CaseInfoDao;
+import com.jeeplus.modules.caseinfo.entity.CaseInfo;
+import com.jeeplus.modules.caseinfo.service.CaseInfoService;
+import com.jeeplus.modules.casematerials.entity.CaseMaterials;
+import com.jeeplus.modules.casematerials.service.CaseMaterialsService;
+import com.jeeplus.modules.casematerialsnorm.entity.CaseMaterialsNorm;
+import com.jeeplus.modules.casematerialsnorm.service.CaseMaterialsNormService;
+import com.jeeplus.modules.casemechanicalnorm.entity.CaseMechanicalNorm;
+import com.jeeplus.modules.casemechanicalnorm.service.CaseMechanicalNormService;
+import com.jeeplus.modules.casemember.entity.CaseMember;
+import com.jeeplus.modules.casemember.service.CaseMemberService;
+import com.jeeplus.modules.casepeoplenorm.entity.CasePeopleNorm;
+import com.jeeplus.modules.casepeoplenorm.service.CasePeopleNormService;
+import com.jeeplus.modules.sys.entity.Area;
+import com.jeeplus.modules.sys.service.AreaService;
+import com.jeeplus.modules.utils.ErrorCode;
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLDecoder;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 案例接口
+ * @author
+ * @version
+ */
+@Controller
+@RequestMapping(value = "${frontPath}/caseinfo/caseInfo")
+public class CaseController extends BaseController {
+	@Autowired
+	private CaseInfoService caseInfoService;
+	@Autowired
+	private CaseCategoryService caseCategoryService;
+	@Autowired
+	private CaseBuildInfoService caseBuildInfoService;
+	@Autowired
+	private CaseDesignInfoService caseDesignInfoService;
+	@Autowired
+	private CaseExecuteInfoService caseExecuteInfoService;
+	@Autowired
+	private CaseMaterialsNormService caseMaterialsNormService;
+	@Autowired
+	private CaseMechanicalNormService caseMechanicalNormService;
+	@Autowired
+	private CasePeopleNormService casePeopleNormService;
+	@Autowired
+	private CaseMaterialsService caseMaterialsService;
+	@Autowired
+	private CaseMemberService caseMemberService;
+	@Autowired
+	private AreaService areaService;
+	@Autowired
+	private CaseInfoDao caseInfoDao;
+
+	/**
+	 * 获取案例库列表
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getCaseInfoListMap", method=RequestMethod.GET)
+	public AjaxJson caseInfo (HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		AjaxJson j = new AjaxJson();
+		try {
+			List<Map<String, Object>> mapList = Lists.newArrayList();
+			HashMap<String, String> requestMap = findRequestMap(request);
+			String cityId = URLDecoder.decode(requestMap.get("cityId") == null ? "" : requestMap.get("cityId"), "UTF-8");
+			String name = URLDecoder.decode(requestMap.get("name") == null ? "" : requestMap.get("name"), "UTF-8");
+			String classId = URLDecoder.decode(requestMap.get("classId") == null ? "" : requestMap.get("classId"), "UTF-8");
+			String dateOrder = URLDecoder.decode(requestMap.get("dateOrder") == null ? "" : requestMap.get("dateOrder"), "UTF-8");
+			String memberId = URLDecoder.decode(requestMap.get("memberId") == null ? "" : requestMap.get("memberId"), "UTF-8");
+			String cityName = URLDecoder.decode(requestMap.get("cityName") == null ? "" : requestMap.get("cityName"), "UTF-8");// 城市名称
+			String proName = URLDecoder.decode(requestMap.get("proName") == null ? "" : requestMap.get("proName"), "UTF-8");// 省级名称
+			String page_no = URLDecoder.decode(requestMap.get("page_no") == null ? "" : requestMap.get("page_no"), "UTF-8");
+			String page_size = URLDecoder.decode(requestMap.get("page_size") == null ? "" : requestMap.get("page_size"), "UTF-8");
+			if (cityId == null || "".equals(cityId) || "(null)".equals(cityId) || "0".equals(cityId)) {
+				cityId = null;
+				if (proName != null && !"".equals(proName) && !"".equals(cityName) && cityName != null) {
+					cityId = areaService.getAreaId(proName, cityName);
+				}
+			}
+			if(StringUtils.isBlank(page_no)){
+				page_no="1";
+			}
+			if(StringUtils.isBlank(page_size)){
+				page_size = "10";
+			}
+			Date startDate = null;
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+			CaseInfo caseInfo = new CaseInfo();
+			if(!"-1".equals(classId)) {
+				caseInfo.setCaseCategory(new CaseCategory(classId));
+			}
+			caseInfo.setStartDate(startDate);
+			caseInfo.setArea(new Area(cityId));
+			caseInfo.setName(name);
+			List<CaseInfo> caseInfoList3 = caseInfoService.findByAllLists(caseInfo);
+			j.setErrorCode(ErrorCode.code_1004);//正常数据
+			if((caseInfoList3 == null || caseInfoList3.size()== 0) && StringUtils.isBlank(name) && (StringUtils.isBlank(classId) || "-1".equals(classId))){
+				caseInfo.setArea(null);
+				caseInfoList3 = caseInfoService.findByAllLists(caseInfo);
+				j.setErrorCode(ErrorCode.code_3003);//全国数据
+			}
+			Page<CaseInfo> page = new Page<CaseInfo>();
+			page.setPageSize(Integer.parseInt(page_size));
+			page.setPageNo(Integer.parseInt(page_no));
+			caseInfo.setPage(page);
+			caseInfo.setDateOrder(dateOrder);
+			List<CaseInfo> caseInfoList = caseInfoService.findByAllLists(caseInfo);
+			List<CaseInfo> caseInfoList2 = new ArrayList<CaseInfo>();
+			//会员已购买的付费案例
+			CaseMember caseMember = new CaseMember();
+			caseMember.setMemberId(memberId);
+			List<CaseMember> caseMemberList = caseMemberService.findList(caseMember);
+			//过滤付费案例
+			for(int i = 0; i < caseInfoList.size(); i++){
+				CaseInfo c = caseInfoList.get(i);
+				if(caseMemberList!=null&&caseMemberList.size()!=0){
+					for(int k = 0; k < caseMemberList.size(); k++){
+						CaseMember caseMember1 = caseMemberList.get(k);
+						if(c.getId().equals(caseMember1.getCaseId())){
+							c.setShareStatus("3");
+						}
+					}
+				}
+				caseInfoList2.add(c);
+			}
+			int tp = (caseInfoList3.size() + Integer.parseInt(page_size) -1) / Integer.parseInt(page_size);//总页数
+			//获取案例列表
+			if (Integer.parseInt(page_no) <= tp && StringUtils.isNotBlank(memberId)) {
+				for (int i = 0; i < caseInfoList2.size(); i++) {
+					CaseInfo c = caseInfoList2.get(i);
+					Map<String, Object> map = Maps.newLinkedHashMap();
+					map.put("case_id", c.getId());
+					map.put("case_name", StringEscapeUtils.unescapeHtml4(c.getName()));
+					if (c.getCaseCategory() != null && !("").equals(c.getCaseCategory())) {
+						map.put("case_type", c.getCaseCategory().getName());
+						map.put("type_id", c.getCaseCategory().getId());
+					}
+					if (c.getArea() != null && !("").equals(c.getArea())) {
+						map.put("case_address", c.getArea().getName());
+						map.put("address_id", c.getArea().getId());
+					}
+					map.put("case_util", c.getPrice() + c.getUnit());
+					if (c.getStartDate() != null) {
+						map.put("case_date", c.getStartDate());
+					} else {
+						map.put("case_date", "");
+					}
+					map.put("case_pay", c.getShareStatus());
+					mapList.add(map);
+				}
+				if(StringUtils.isBlank(memberId)){
+					j.put("data", Lists.newArrayList());
+				}else{
+					j.put("data", mapList);
+				}
+			}else{
+				j.put("data", new ArrayList<>());
+			}
+			j.setMsg("获取案例库列表成功");
+
+		} catch (Exception e) {
+			logger.error("获取案例库列表失败:", e);
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("获取案例库列表失败");
+		}
+		return j;
+	}
+
+	/**
+	 * 获取已经购买的案例库列表
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getCaseInfoListBuyMap", method=RequestMethod.GET)
+	public AjaxJson caseInfoBuy (HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		AjaxJson j = new AjaxJson();
+		try {
+			List<Map<String, Object>> mapList = Lists.newArrayList();
+			HashMap<String, String> requestMap = findRequestMap(request);
+			String cityId = URLDecoder.decode(requestMap.get("cityId") == null ? "" : requestMap.get("cityId"), "UTF-8");
+			String name = URLDecoder.decode(requestMap.get("name") == null ? "" : requestMap.get("name"), "UTF-8");
+			String classId = URLDecoder.decode(requestMap.get("classId") == null ? "" : requestMap.get("classId"), "UTF-8");
+			String dateOrder = URLDecoder.decode(requestMap.get("dateOrder") == null ? "" : requestMap.get("dateOrder"), "UTF-8");
+			String memberId = URLDecoder.decode(requestMap.get("memberId") == null ? "" : requestMap.get("memberId"), "UTF-8");
+			String cityName = URLDecoder.decode(requestMap.get("cityName") == null ? "" : requestMap.get("cityName"), "UTF-8");// 城市名称
+			String proName = URLDecoder.decode(requestMap.get("proName") == null ? "" : requestMap.get("proName"), "UTF-8");// 省级名称
+			String page_no = URLDecoder.decode(requestMap.get("page_no") == null ? "" : requestMap.get("page_no"), "UTF-8");
+			String page_size = URLDecoder.decode(requestMap.get("page_size") == null ? "" : requestMap.get("page_size"), "UTF-8");
+			if (cityId == null || "".equals(cityId) || "(null)".equals(cityId)) {
+				if (proName != null && !"".equals(proName) && !"".equals(cityName) && cityName != null) {
+					cityId = areaService.getAreaId(proName, cityName);
+				}
+			}
+			if(StringUtils.isBlank(page_no)){
+				page_no="1";
+			}
+			if(StringUtils.isBlank(page_size)){
+				page_size = "10";
+			}
+			Date startDate = null;
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+			CaseInfo caseInfo = new CaseInfo();
+			if (!"-1".equals(classId)) {
+				caseInfo.setCaseCategory(new CaseCategory(classId));
+			}
+			caseInfo.setStartDate(startDate);
+			caseInfo.setArea(new Area(cityId));
+			caseInfo.setMemberId(memberId);
+			caseInfo.setName(name);
+			List<CaseInfo> caseInfoList3 = caseInfoDao.findBuyCase(caseInfo);
+			Page<CaseInfo> page = new Page<CaseInfo>();
+			page.setPageSize(Integer.parseInt(page_size));
+			page.setPageNo(Integer.parseInt(page_no));
+			caseInfo.setPage(page);
+			caseInfo.setDateOrder(dateOrder);
+			if(StringUtils.isNotBlank(memberId)){
+					Page p = caseInfoService.findBuyPage(page,caseInfo);
+					List<CaseInfo> caseInfoList2 = p.getList();
+					if(caseInfoList2!=null && caseInfoList2.size()>0){
+						for (CaseInfo c:
+							 caseInfoList2) {
+							c.setShareStatus("3");
+						}
+					}
+				int tp = (caseInfoList3.size() + Integer.parseInt(page_size) -1) / Integer.parseInt(page_size);//总页数
+				//获取案例列表
+				if (Integer.parseInt(page_no) <= tp && StringUtils.isNotBlank(memberId)) {
+					for (int i = 0; i < caseInfoList2.size(); i++) {
+						CaseInfo c = caseInfoList2.get(i);
+						Map<String, Object> map = Maps.newLinkedHashMap();
+						map.put("case_id", c.getId());
+						map.put("case_name", StringEscapeUtils.unescapeHtml4(c.getName()));
+						if (c.getCaseCategory() != null && !("").equals(c.getCaseCategory())) {
+							map.put("case_type", c.getCaseCategory().getName());
+							map.put("type_id", c.getCaseCategory().getId());
+						}
+						if (c.getArea() != null && !("").equals(c.getArea())) {
+							map.put("case_address", c.getArea().getName());
+							map.put("address_id", c.getArea().getId());
+						}
+						map.put("case_util", c.getPrice() + c.getUnit());
+						if (c.getStartDate() != null) {
+							map.put("case_date", c.getStartDate());
+						} else {
+							map.put("case_date", "");
+						}
+						map.put("case_pay", c.getShareStatus());
+						mapList.add(map);
+					}
+						j.put("data", mapList);
+				}else{
+					j.put("data", new ArrayList<>());
+				}
+			}else{
+				j.put("data", new ArrayList<>());
+			}
+			j.setMsg("获取案例库列表成功");
+
+		} catch (Exception e) {
+			logger.error("获取案例库列表失败:", e);
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("获取案例库列表失败");
+		}
+		return j;
+	}
+	/**
+	 * 获取案例库列表
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getCaseCategory", method=RequestMethod.GET)
+	public AjaxJson caseCategory (HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		AjaxJson j = new AjaxJson();
+		try {
+			List<Map<String, Object>> mapList = Lists.newArrayList();
+			HashMap<String, String> requestMap = findRequestMap(request);
+			String pId = URLDecoder.decode(requestMap.get("classId") == null ? "" : requestMap.get("classId"), "UTF-8");
+			CaseCategory caseCategory = new CaseCategory();
+			if(StringUtils.isNotBlank(pId)){
+				caseCategory.setParent(new CaseCategory(pId));
+			}
+			List<CaseCategory> caseInfoList = caseCategoryService.findList(caseCategory);
+			if(pId == "0"||("0").equals(pId)){
+				for (int i = 0; i < caseInfoList.size(); i++) {
+					CaseCategory c = caseInfoList.get(i);
+					Map<String, Object> map = Maps.newHashMap();
+					map.put("category_Id", c.getId());
+					map.put("category_Name", c.getName());
+					map.put("parent_id", c.getParent().getId());
+					mapList.add(map);
+				}
+			}else{
+				for (int i = 0; i < caseInfoList.size(); i++) {
+					CaseCategory c = caseInfoList.get(i);
+					Map<String, Object> map = Maps.newHashMap();
+					map.put("category_Id", c.getId());
+					map.put("category_Name", c.getName());
+					map.put("parent_id", c.getParent().getId());
+					List<Map<String, Object>> mapLists = Lists.newArrayList();
+					CaseCategory caseCategory1 = new CaseCategory();
+					caseCategory1.setParent(c);
+					List<CaseCategory> caseInfoLists = caseCategoryService.findList(caseCategory1);
+					for(int k = 0; k < caseInfoLists.size(); k++){
+						CaseCategory ck = caseInfoLists.get(k);
+						Map<String, Object> maps = Maps.newHashMap();
+						maps.put("category_Id", ck.getId());
+						maps.put("category_Name", ck.getName());
+						maps.put("parent_id", ck.getParent().getId());
+						mapLists.add(maps);
+					}
+					map.put("maplists",mapLists);
+					mapList.add(map);
+				}
+			}
+			j.put("data", mapList);
+			j.setErrorCode(ErrorCode.code_1004);
+			j.setMsg("获取案例分类列表成功");
+
+		} catch (Exception e) {
+			logger.error("获取案例分类列表失败:", e);
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("获取案例分类列表失败");
+		}
+		return j;
+	}
+	/**
+	 * 获取详情
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getCaseInfoMap", method=RequestMethod.GET)
+	public AjaxJson caseIf(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		AjaxJson j = new AjaxJson();
+		try {
+			List<Map<String, Object>> mapList1 = Lists.newArrayList();
+			List<Map<String, Object>> mapList2 = Lists.newArrayList();
+			List<Map<String, Object>> mapList3 = Lists.newArrayList();
+			HashMap<String, String> requestMap = findRequestMap(request);
+			String caseId = URLDecoder.decode(requestMap.get("caseId") == null ? "" : requestMap.get("caseId"), "UTF-8");
+			CaseInfo c = caseInfoService.get(caseId);
+			CaseBuildInfo caseBuildInfo = new CaseBuildInfo();// 建设单位子表列表
+			CaseDesignInfo caseDesignInfo = new CaseDesignInfo();// 设计单位子表列表
+			CaseExecuteInfo caseExecuteInfo = new CaseExecuteInfo();// 施工单位子表列表
+			caseBuildInfo.setCaseId(c.getId());
+			caseDesignInfo.setCaseId(c.getId());
+			caseExecuteInfo.setCaseId(c.getId());
+			List<CaseBuildInfo> buyDetailsList1 = caseBuildInfoService.findList(caseBuildInfo);
+			List<CaseDesignInfo> buyDetailsList2 = caseDesignInfoService.findList(caseDesignInfo);
+			List<CaseExecuteInfo> buyDetailsList3 = caseExecuteInfoService.findList(caseExecuteInfo);
+			Map<String, Object> map = Maps.newHashMap();
+			map.put("case_name", StringEscapeUtils.unescapeHtml4(c.getName()));
+			if(c.getCaseCategory()!=null&&!("").equals(c.getCaseCategory())){
+				map.put("case_type", c.getCaseCategory().getName());
+				map.put("type_id", c.getCaseCategory().getId());
+			}
+			if(c.getArea()!=null&&!("").equals(c.getArea())){
+				map.put("case_address", c.getArea().getName());
+				map.put("address_id", c.getArea().getId());
+			}
+			map.put("case_util", c.getPrice()+c.getUnit());
+			map.put("case_date", c.getStartDate());
+			/*map.put("case_from", c.getSource());*/
+			if(("1").equals(c.getSource())){
+				map.put("case_from", "论文");
+			}else if (("2").equals(c.getSource())){
+				map.put("case_from", "结算价");
+			}
+			else if (("3").equals(c.getSource())){
+				map.put("case_from", "专家评审");
+			}
+			else if (("4").equals(c.getSource())){
+				map.put("case_from", "其它");
+			}
+			if(("0").equals(c.getExt())){
+				//系统内项目
+				if(c.getProject()!=null&&!("").equals(c.getProject())){
+					map.put("case_belong", c.getProject().getProjectName());
+				}
+			}else if(("1").equals(c.getExt())){
+				//系统外项目
+				map.put("case_belong", c.getContractName());
+			}
+			for(int i = 0; i < buyDetailsList1.size(); i++){
+				CaseBuildInfo c1 = buyDetailsList1.get(i);
+				Map<String, Object> map1 = Maps.newHashMap();
+				map1.put("utilName", c1.getName());
+				map1.put("contact_name", c1.getLinkedman());
+				map1.put("email", c1.getEmail());
+				map1.put("phone", c1.getMobile());
+				mapList1.add(map1);
+			}
+			for(int i = 0; i < buyDetailsList2.size(); i++){
+				CaseDesignInfo c2 = buyDetailsList2.get(i);
+				Map<String, Object> map2 = Maps.newHashMap();
+				map2.put("utilName", c2.getName());
+				map2.put("contact_name", c2.getLinkedman());
+				map2.put("email", c2.getEmail());
+				map2.put("phone", c2.getMobile());
+				mapList2.add(map2);
+			}
+			for(int i = 0; i < buyDetailsList3.size(); i++){
+				CaseExecuteInfo c3 = buyDetailsList3.get(i);
+				Map<String, Object> map3 = Maps.newHashMap();
+				map3.put("utilName", c3.getName());
+				map3.put("contact_name", c3.getLinkedman());
+				map3.put("email", c3.getEmail());
+				map3.put("phone", c3.getMobile());
+				mapList3.add(map3);
+			}
+			map.put("constructionList", mapList1);
+			map.put("participateList", mapList2);
+			map.put("operationList", mapList3);
+			j.put("data", map);
+			j.setErrorCode(ErrorCode.code_1004);
+			j.setMsg("获取案例库详情成功");
+
+		} catch (Exception e) {
+			logger.error("获取案例库详情失败:", e);
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("获取案例库详情失败");
+		}
+		return j;
+	}
+
+	/**
+	 * 获取详情
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getCaseDetailMap", method=RequestMethod.GET)
+	public AjaxJson caseIfo(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		AjaxJson j = new AjaxJson();
+		try {
+			HashMap<String, String> requestMap = findRequestMap(request);
+			String caseId = URLDecoder.decode(requestMap.get("caseId") == null ? "" : requestMap.get("caseId"), "UTF-8");
+			String type = URLDecoder.decode(requestMap.get("type") == null ? "" : requestMap.get("type"), "UTF-8");
+			CaseInfo c = caseInfoService.get(caseId);
+			Map<String, Object> map = Maps.newHashMap();
+			if(("1").equals(type)){
+				map.put("detail",c.getPeculiarity());
+			}else if(("2").equals(type)){
+				map.put("detail",c.getFeature());
+			}else if(("3").equals(type)){
+				map.put("detail",c.getRecord());
+			}
+			j.put("data", map);
+			j.setErrorCode(ErrorCode.code_1004);
+			j.setMsg("获取案例库详情成功");
+
+		} catch (Exception e) {
+			logger.error("获取案例库详情失败:", e);
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("获取案例库详情失败");
+		}
+		return j;
+	}
+
+	/**
+	 * 获取详情
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getCaseInfoNormMap", method=RequestMethod.GET)
+	public AjaxJson caseIfNorm(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		AjaxJson j = new AjaxJson();
+		try {
+			List<Map<String, Object>> mapList = Lists.newArrayList();
+			HashMap<String, String> requestMap = findRequestMap(request);
+			String caseId = URLDecoder.decode(requestMap.get("caseId") == null ? "" : requestMap.get("caseId"), "UTF-8");
+			String type = URLDecoder.decode(requestMap.get("type") == null ? "" : requestMap.get("type"), "UTF-8");
+			CaseInfo c = caseInfoService.get(caseId);
+			CaseMaterialsNorm caseMaterialsNorm = new CaseMaterialsNorm();  //材料消耗量指标列表
+			CaseMechanicalNorm caseMechanicalNorm = new CaseMechanicalNorm();// 	机械消耗量指标列表
+			CasePeopleNorm casePeopleNorm = new CasePeopleNorm();   // 人工消耗量指标列表
+			caseMaterialsNorm.setCaseId(c.getId());
+			caseMechanicalNorm.setCaseId(c.getId());
+			casePeopleNorm.setCaseId(c.getId());
+			List<CaseMaterialsNorm> buyDetailsList7 = caseMaterialsNormService.findList(caseMaterialsNorm);
+			List<CaseMechanicalNorm> buyDetailsList8 = caseMechanicalNormService.findList(caseMechanicalNorm);
+			List<CasePeopleNorm> buyDetailsList9 = casePeopleNormService.findList(casePeopleNorm);
+			Map<String, Object> map = Maps.newHashMap();
+			map.put("case_util", c.getPrice()+c.getUnit());
+			if(("1").equals(type)){
+				//材料
+				for(int i = 0; i < buyDetailsList7.size(); i++){
+					CaseMaterialsNorm c7 = buyDetailsList7.get(i);
+					Map<String, Object> map7 = Maps.newHashMap();
+					map7.put("name",c7.getName());
+					map7.put("type",c7.getType());
+					map7.put("unitContent",c7.getUnitContent());
+					map7.put("unit",c7.getUnit());
+					map7.put("allPrice",c7.getAllPrice());
+					map7.put("proportion",c7.getProportion());
+					mapList.add(map7);
+				}
+			}else if(("2").equals(type)){
+				//机械
+				for(int i = 0; i < buyDetailsList8.size(); i++){
+					CaseMechanicalNorm c7 = buyDetailsList8.get(i);
+					Map<String, Object> map7 = Maps.newHashMap();
+					map7.put("name",c7.getName());
+					map7.put("type",c7.getType());
+					map7.put("unitContent",c7.getUnitContent());
+					map7.put("unit",c7.getUnit());
+					map7.put("allPrice",c7.getAllPrice());
+					map7.put("proportion",c7.getProportion());
+					mapList.add(map7);
+				}
+			}else if(("3").equals(type)){
+				//人工
+				for(int i = 0; i < buyDetailsList9.size(); i++){
+					CasePeopleNorm c7 = buyDetailsList9.get(i);
+					Map<String, Object> map7 = Maps.newHashMap();
+					map7.put("name",c7.getName());
+					map7.put("type",c7.getType());
+					map7.put("unitContent",c7.getUnitContent());
+					map7.put("unit",c7.getUnit());
+					map7.put("allPrice",c7.getAllPrice());
+					map7.put("proportion",c7.getProportion());
+					mapList.add(map7);
+				}
+			}
+			map.put("indicators_list",mapList);
+			j.put("data", map);
+			j.setErrorCode(ErrorCode.code_1004);
+			j.setMsg("获取案例库指标列表成功");
+
+		} catch (Exception e) {
+			logger.error("获取案例库指标列表失败:", e);
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("获取案例库指标列表失败");
+		}
+		return j;
+	}
+	/**
+	 * 获取详情
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getCaseInfoMaterialsMap", method=RequestMethod.GET)
+	public AjaxJson caseIfMaterials(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		AjaxJson j = new AjaxJson();
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		try {
+			List<Map<String, Object>> mapList = Lists.newArrayList();
+			HashMap<String, String> requestMap = findRequestMap(request);
+			String caseId = URLDecoder.decode(requestMap.get("caseId") == null ? "" : requestMap.get("caseId"), "UTF-8");
+			String materialName = URLDecoder.decode(requestMap.get("materialName") == null ? "" : requestMap.get("materialName"), "UTF-8");
+			CaseInfo c = caseInfoService.get(caseId);
+			CaseMaterials caseMaterials = new CaseMaterials();
+			caseMaterials.setCaseId(c.getId());
+			caseMaterials.setName(materialName);
+			List<CaseMaterials> buyDetailsList6 = caseMaterialsService.findList(caseMaterials);
+			for (int i = 0; i < buyDetailsList6.size(); i++) {
+				CaseMaterials c6 = buyDetailsList6.get(i);
+				Map<String, Object> map = Maps.newHashMap();
+				map.put("mata_name",c6.getName());
+				map.put("mata_model",c6.getSpecification());
+				map.put("util",c6.getCalculateUnit());
+				map.put("taxprice",c6.getTaxPrice());
+				map.put("addition_price",c6.getPrice());
+				map.put("Price_date", c6.getUseDate() == null ? "" : sdf.format(c6.getUseDate()));
+				map.put("rate",c6.getTax());
+				map.put("mata_from",c6.getSource());
+				map.put("material",c6.getMaterial());
+				map.put("brand",c6.getBrand());
+				if(c6.getArea()!=null && !("").equals(c6.getArea())){
+					map.put("address",c6.getArea().getName());
+				}
+				map.put("performance",c6.getPp());
+				mapList.add(map);
+			}
+			j.put("data", mapList);
+			j.setErrorCode(ErrorCode.code_1004);
+			j.setMsg("获取案例库材价列表成功");
+
+		} catch (Exception e) {
+			logger.error("获取案例库材价列表失败:", e);
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("获取案例库材价列表失败");
+		}
+		return j;
+	}
+
+	/**
+	 * 添加中间表
+	 */
+	@ResponseBody
+	@RequestMapping(value = "memberBuyCase", method=RequestMethod.GET)
+	public AjaxJson memberBuyCase(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		AjaxJson j = new AjaxJson();
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Map<String, Object> map = Maps.newHashMap();
+        try {
+			HashMap<String, String> requestMap = findRequestMap(request);
+			String caseId = URLDecoder.decode(requestMap.get("caseId") == null ? "" : requestMap.get("caseId"), "UTF-8");
+			String memberId = URLDecoder.decode(requestMap.get("memberId") == null ? "" : requestMap.get("memberId"), "UTF-8");
+			if(StringUtils.isBlank(caseId)){
+				j.put("status", "false");
+				j.setErrorCode(ErrorCode.code_2001);
+				j.setMsg("案例数据丢失购买付费案例失败");
+			}else if(StringUtils.isBlank(memberId)){
+                j.put("status", "false");
+				j.setErrorCode(ErrorCode.code_2001);
+				j.setMsg("会员数据丢失购买付费案例失败");
+			}else{
+				CaseMember c = new CaseMember();
+				c.setCaseId(caseId);
+				c.setMemberId(memberId);
+				caseMemberService.save(c);
+				j.put("status", "true");
+				j.setErrorCode(ErrorCode.code_1004);
+				j.setMsg("购买付费案例成功");
+			}
+		} catch (Exception e) {
+			logger.error("购买付费案例失败:", e);
+            j.put("status", "false");
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("购买付费案例失败");
+		}
+		return j;
+	}
+}

Fichier diff supprimé car celui-ci est trop grand
+ 1550 - 0
src/main/java/com/jeeplus/modules/API/easemob/EasemobController.java


+ 89 - 0
src/main/java/com/jeeplus/modules/API/iim/ImContactController.java

@@ -0,0 +1,89 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.API.iim;
+
+import com.alibaba.fastjson.JSONObject;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.IdGen;
+import com.jeeplus.common.utils.SmackUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.iim.entity.*;
+import com.jeeplus.modules.iim.service.LayGroupService;
+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.service.OfficeService;
+import com.jeeplus.modules.sys.service.SystemService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.sysuseroffice.entity.Useroffice;
+import com.jeeplus.modules.sysuseroffice.service.UserofficeService;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+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.io.IOException;
+import java.util.*;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 联系人Controller
+ * 
+ * @author jeeplus(seven修改)
+ * @version 2016-6-23
+ */
+//@Controller
+//@RequestMapping(value = "${frontPath}/iim/contact")
+public class ImContactController extends BaseController {
+
+//	@ResponseBody
+//	@RequestMapping(value = { "uploadImage", "uploadFile" })
+	public String uploadImage(HttpServletResponse response,MultipartHttpServletRequest multiRequest)
+			throws IllegalStateException, IOException {
+		String filepath = "";
+		String content = null;
+		LayFileJsonData data = new LayFileJsonData();
+		String contentType = "";
+		// 判断文件是否为空
+        Iterator<String> fileNames = multiRequest.getFileNames();
+        while(fileNames.hasNext()) {
+            //取得上传文件
+            MultipartFile file = multiRequest.getFile(fileNames.next());
+            if (!file.isEmpty()) {
+                contentType = file.getContentType();
+                // 文件保存路径
+                String realPath ="messages/"+ DateUtils.formatDate(new Date())+"/"+ UserUtils.getPrincipal() + "/";
+                OSSClientUtil ossUtil = new OSSClientUtil();
+                String newName = System.currentTimeMillis()+"-"+file.getOriginalFilename();
+
+                ossUtil.uploadFile2OSS(file.getInputStream(),realPath,newName);
+                filepath = Global.getAliDownloadUrl() + "/" + realPath + newName;
+
+                data.setName(file.getOriginalFilename());
+                data.setSrc(filepath);
+            }
+        }
+
+		ObjectMapper mapper = new ObjectMapper();
+		HashMap<String, Object> map = new HashMap<String, Object>();
+		map.put("code", "0");
+		map.put("data", data);
+
+		content = mapper.writeValueAsString(map);
+ 		return content;
+	}
+
+}

+ 193 - 0
src/main/java/com/jeeplus/modules/API/maillist/ColleagueController.java

@@ -0,0 +1,193 @@
+package com.jeeplus.modules.API.maillist;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.jeeplus.common.utils.CacheUtils;
+import com.jeeplus.modules.sys.service.SystemService;
+import com.jeeplus.modules.utils.ErrorCode;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.oa.dao.LeaveDao;
+import com.jeeplus.modules.oa.entity.Leave;
+import com.jeeplus.modules.sys.dao.AreaDao;
+import com.jeeplus.modules.sys.dao.OfficeDao;
+import com.jeeplus.modules.sys.dao.RoleDao;
+import com.jeeplus.modules.sys.dao.UserDao;
+import com.jeeplus.modules.sys.entity.Area;
+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.workovertimeform.entity.WorkOvertimeForm;
+
+
+
+/**
+ * 人员Controller
+ * @author zmy
+ * @version 2017-04-17
+ */
+
+@Controller
+@RequestMapping(value = "${frontPath}/maillist/colleague")
+
+public class ColleagueController extends BaseController{
+
+	@Autowired
+	private UserDao userDao;
+	@Autowired
+	private OfficeDao officeDao;
+	@Autowired
+	private RoleDao roleDao;
+	@Autowired
+	private AreaDao areaDao;
+	@Autowired
+	private SystemService systemService;
+	
+	/**
+	 * 公司人员列表
+	 */
+	    @ResponseBody
+		@RequestMapping(value = "getMailListColleagueList", method=RequestMethod.GET)
+		public AjaxJson findAllColleague (String companyId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes)
+		{  
+		 AjaxJson j=new AjaxJson();
+		 List<User> userList = systemService.findUserByCompanyId(companyId);
+         List<Map<String,Object>> mapList = Lists.newArrayList();
+         for(User u :userList){
+        	 Map<String,Object> map = Maps.newHashMap();
+        	 Office office = officeDao.get(u.getOffice());
+
+        	 map.put("id", u.getId());
+        	 map.put("photo", u.getPhoto());
+        	 map.put("name", u.getName());
+        	 map.put("mobile", u.getMobile());
+			 map.put("isgly", 0);
+             if(office!=null){
+                 map.put("officeName", office.getName());
+             }else{
+                 map.put("officeName", "");
+             }
+        	 if(u.getName() != null && !u.getName().trim().equalsIgnoreCase("")) {
+        		 char[] strChar = u.getName().trim().toCharArray();         		 
+        		 if(StringUtils.isChinese(strChar[0])){
+        			 String enName =  StringUtils.getPinYinHeadChar(u.getName().trim(),1);
+        			// System.out.println(enName.charAt(0));
+        			 map.put("initial",enName.charAt(0));
+        		 }else{
+        			// System.out.println(strChar[0]);
+        			 map.put("initial",strChar[0]);
+        		 }
+        	 }else{
+        		 map.put("initial","");
+        	 }
+        	 Role role1 = new Role();
+     		 role1.setUser(u);
+			 role1.setCompany(new Office(companyId));
+     		 List<Role> roleList=roleDao.findList(role1);
+     		 if (roleList!=null && roleList.size()!=0){
+				 for(Role role : roleList){
+					 if(org.apache.commons.lang3.StringUtils.isNotBlank(role.getEnname()) && role.getEnname().endsWith("gly")||role.getEnname().equals("system")){
+						 map.put("isgly", 1);
+					 }
+				 }
+			 }else {
+				 map.put("isgly", 0);
+			 }
+
+        	 mapList.add(map); 
+         }         
+         j.put("data",mapList);
+		 j.setMsg("获取公司人员列表成功");
+		 j.setErrorCode(ErrorCode.code_1004);
+		 return j;
+		}
+	 /**
+	  * 获取成员信息
+	  */
+	 @ResponseBody
+	 @RequestMapping(value = "getMailListColleagueInfoMap", method=RequestMethod.GET)
+	 public AjaxJson findColleagueInfo (String id,String officeId,String companyId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes)
+	 {
+		 AjaxJson j=new AjaxJson();
+		 User user=	UserUtils.get(id);
+		 if(user!=null){
+			 Office office = new Office();
+			 Office company = new Office();
+			 if (StringUtils.isNotBlank(officeId) && StringUtils.isNotBlank(companyId)){
+				 company = officeDao.get(officeId);
+				 office = officeDao.get(companyId);
+				 user.setOffice(company);
+				 user.setCompany(office);
+				 user.setCompanyName(company.getName());
+				 user.setOfficeName(office.getName());
+			 }else {
+				 office = officeDao.get(user.getOffice());
+				 company = officeDao.get(user.getCompany());
+			 }
+			 Leave leave = new Leave();
+			 leave.setCreateBy(user);
+			 WorkOvertimeForm over = new WorkOvertimeForm();
+			 over.setCreateBy(user);
+
+			 User user1=new User();
+			 user1.setId(id);
+			 Role role1 = new Role();
+			 role1.setUser(user1);
+			 List<Role> roleList = systemService.getRoleList(user.getId(),company.getId());
+			 if(roleList!=null && roleList.size()!=0){
+			 	for(Role r :roleList){
+			 		if(r.getCompany().getId().equals(company.getId())){
+						user.setRoleName(r.getName());
+					}
+				}
+			 }
+			 user.setOfficeName(office.getName());
+			 user.setCompanyName(company.getName());
+
+			 Map<String,Object> map = Maps.newHashMap();
+			 map.put("logo", company==null? "":company.getLogo());
+			 map.put("status", "0");
+			 map.put("userInfo", user);
+			 map.put("leaveStartTime", leave.getStartTime());
+			 map.put("leaveEndTime", leave.getEndTime());
+			 map.put("leaveDays", leave.getLeaveDays());
+			 map.put("workOverTimeStartTime", over.getStartTime());
+			 map.put("workOverTimeEndTime", over.getEndTime());
+			 map.put("workOverTimeLongTime", over.getLongTime());
+			 if(office.getArea()!=null && office.getArea().getId()!=null){
+				 Area area = areaDao.get(office.getArea());
+				 if(area!=null){
+					 map.put("aeraName", area.getName());
+				 }else{
+					 map.put("aeraName", "");
+				 }
+			 }else{
+				 map.put("aeraName", "");
+			 }
+			 j.put("data",map);
+		 }else{
+			 j.setSuccess(false);
+			 j.setMsg("获取用户个人信息失败");
+			 j.setErrorCode(ErrorCode.code_2005);
+			 j.put("data","");
+		 }
+
+		 return j;
+	 }
+}

+ 63 - 0
src/main/java/com/jeeplus/modules/API/maillist/ContactsController.java

@@ -0,0 +1,63 @@
+package com.jeeplus.modules.API.maillist;
+
+
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.jeeplus.modules.utils.ErrorCode;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.iim.entity.ChatHistory;
+import com.jeeplus.modules.iim.service.ChatHistoryService;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+
+/**
+ * 常用联系人Controller
+ * @author zmy
+ * @version 2017-04-17
+ */
+@Controller
+@RequestMapping(value = "${frontPath}/maillist/contacts")
+
+public class ContactsController extends BaseController{	
+	@Autowired
+	private ChatHistoryService chatHistoryService;
+	
+	@ResponseBody
+	@RequestMapping(value = "getMailListContactsList", method=RequestMethod.GET)
+	public AjaxJson getContactsList (String id,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes)
+	{  
+		AjaxJson j=new AjaxJson();	
+		User u = UserUtils.get(id);
+		ChatHistory chat = new ChatHistory();
+		chat.setUserid1(u.getLoginName());
+		List<ChatHistory> chatList=chatHistoryService.findList(chat);
+		List<Map<String,Object>> mapList = Lists.newArrayList();
+		for(int i = 0; i < chatList.size(); i++){
+			ChatHistory ch = chatList.get(i);
+			User user = UserUtils.getByLoginName(ch.getUserid2());
+			Map<String,Object> map = Maps.newHashMap();
+			map.put("id", user.getId());
+			map.put("name", user.getName());
+			map.put("mobile", user.getMobile());
+			map.put("photo", user.getPhoto());	
+			mapList.add(map);
+		}
+		j.put("data",mapList);
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+}

+ 222 - 0
src/main/java/com/jeeplus/modules/API/maillist/GroupController.java

@@ -0,0 +1,222 @@
+package com.jeeplus.modules.API.maillist;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.jeeplus.modules.utils.ErrorCode;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.IdGen;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.iim.dao.LayGroupDao;
+import com.jeeplus.modules.iim.dao.LayGroupUserDao;
+import com.jeeplus.modules.iim.entity.LayGroup;
+import com.jeeplus.modules.iim.entity.LayGroupUser;
+import com.jeeplus.modules.iim.service.LayGroupService;
+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.utils.UserUtils;
+/**
+ * 我的群组Controller
+ * @author zmy
+ * @version 2017-04-17
+ */
+@Controller
+@RequestMapping(value = "${frontPath}/maillist/groups")
+public class GroupController extends BaseController{
+	@Autowired
+	private LayGroupDao layGroupDao;
+	@Autowired
+	private LayGroupService layGroupService;
+	@Autowired
+	private UserDao userDao;
+	@Autowired
+	private LayGroupUserDao layGroupUserDao;
+	/**
+	 * 我创建的群组
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getMailListMyGroupList", method=RequestMethod.GET)
+	public AjaxJson findMyGroups(String id,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
+		AjaxJson j=new AjaxJson();
+		LayGroup laygroup=new LayGroup();
+		User user=new User();
+		user.setId(id);
+		laygroup.setCreateBy(user);
+		List<LayGroup> groupList=layGroupDao.findList(laygroup);
+		List<Map<String,Object>> mapList = Lists.newArrayList();
+		List<Map<String,Object>> mapList2 = Lists.newArrayList();
+		Map<String,Object> map2 = Maps.newHashMap();
+		map2.put("groupcount", groupList.size());
+		for(int i = 0; i < groupList.size(); i++){
+			LayGroup g = groupList.get(i);
+			Map<String,Object> map = Maps.newHashMap();
+			map.put("groupName",g.getGroupname());
+			map.put("avatar", g.getAvatar());
+			map.put("groupId", g.getId());
+			LayGroupUser lgu = new LayGroupUser();
+			lgu.setGroup(g);
+			List<LayGroupUser> lguList= layGroupUserDao.findList(lgu);
+			map.put("userCount", lguList.size());
+			mapList.add(map);						
+		}
+		map2.put("groupInfo", mapList);
+		mapList2.add(map2);
+		j.put("data", mapList2);
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+	/**
+	 * 我加入的群组
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getMailListAllGroupList", method=RequestMethod.GET)
+	public AjaxJson findAllGroups(String id,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
+		AjaxJson j=new AjaxJson();
+		User user=new User();
+		LayGroup laygroup=new LayGroup();
+		user.setId(id);	
+		laygroup.setCreateBy(user);
+		List<LayGroup> list=layGroupDao.findList(laygroup);
+		List<LayGroup> joinlist = layGroupService.findGroupList(user);
+		List<LayGroup> alllist=new ArrayList<LayGroup>();
+		alllist.addAll(list);
+		alllist.addAll(joinlist);				
+		List<Map<String,Object>> mapList2 = Lists.newArrayList();
+		Map<String,Object> map2 = Maps.newHashMap();
+		map2.put("groupcount", alllist.size());
+		List<Map<String,Object>> mapList = Lists.newArrayList();
+		for(int i = 0; i < alllist.size(); i++){
+			LayGroup g = alllist.get(i);
+			Map<String,Object> map = Maps.newHashMap();
+			map.put("groupName",g.getGroupname());
+			map.put("avatar", g.getAvatar());
+			map.put("groupId", g.getId());
+			LayGroupUser lgu = new LayGroupUser();
+			lgu.setGroup(g);
+			List<LayGroupUser> lguList= layGroupUserDao.findList(lgu);
+			map.put("userCount", lguList.size());
+			mapList.add(map);
+		}		
+		map2.put("groupInfo", mapList);
+		mapList2.add(map2);
+		j.put("data", mapList2);
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}	
+	/**
+	 * 添加群组成员
+	 */
+	@ResponseBody
+	@RequestMapping(value="addMailListUser",method=RequestMethod.GET)
+	public AjaxJson addMailListUser(String ids,String groupId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
+		AjaxJson j=new AjaxJson();
+		String idArry[]=ids.split(",");			
+		for(String id : idArry){		
+		User user=userDao.get(id);
+		LayGroup laygroup=layGroupService.get(groupId);
+		LayGroupUser lguser = new LayGroupUser();
+		lguser.setUser(user);
+		lguser.setGroup(laygroup);
+		 	if(layGroupUserDao.findList(lguser).size() == 0 && !user.getId().equals(laygroup.getCreateBy().getId())){
+		 		lguser.setId(IdGen.uuid());
+		 		lguser.preInsert();
+		 		layGroupUserDao.insert(lguser);	
+		 	}		 	
+		}	
+		j.setMsg("添加成员成功");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+	/**
+	 * 删除群组成员
+	 */
+	@ResponseBody
+	@RequestMapping(value="delMailListUser",method=RequestMethod.GET)
+	public AjaxJson delMailListUser(String lguserIds,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
+		AjaxJson j=new AjaxJson();
+		String idArry[]=lguserIds.split(",");
+		for(String id : idArry){
+			LayGroupUser lguser = new LayGroupUser();	
+			lguser.setId(id);
+			layGroupUserDao.delete(lguser);
+		}
+		j.setMsg("删除成员成功");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+	/**
+	 * 聊天信息
+	 */
+	@ResponseBody
+	@RequestMapping(value="getMailListMembersList",method=RequestMethod.GET)
+	public AjaxJson membersList(String groupId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
+		 AjaxJson j=new AjaxJson();
+		 List<Map<String,Object>> mapList = Lists.newArrayList();
+		 List<Map<String,Object>> mapList1 = Lists.newArrayList();
+		 LayGroup layg= new LayGroup();
+		 layg.setId(groupId);
+		 LayGroupUser lgu = new LayGroupUser();
+		 lgu.setGroup(layg);
+		 Map<String,Object> map = Maps.newHashMap();
+		 List<LayGroupUser> lguList= layGroupUserDao.findList(lgu);
+		 for(LayGroupUser lu:lguList){
+				User u = userDao.get(lu.getUser());
+				Map<String,Object> map1 = Maps.newHashMap();
+				map1.put("name", u.getName());
+				map1.put("photo",u.getPhoto());	
+				mapList1.add(map1);
+		 }	
+		 map.put("groupMembers", mapList1);
+		 map.put("groupName", layGroupDao.get(groupId).getGroupname());
+		 mapList.add(map);
+		 j.put("data",mapList);
+		 j.setErrorCode(ErrorCode.code_1004);
+		 return j;
+	}	
+	/**
+	 * 修改群名
+	 */
+	@ResponseBody
+	@RequestMapping(value="saveMailListGroupName",method=RequestMethod.GET)
+	public AjaxJson saveGroupName(String groupId,String groupName,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
+		AjaxJson j=new AjaxJson();
+		LayGroup lay = layGroupDao.get(groupId);
+		lay.setGroupname(groupName);
+		layGroupDao.update(lay);
+		j.setMsg("修改成功");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+	/**
+	 * 退出群组
+	 */
+	@ResponseBody
+	@RequestMapping(value="delMailListGroup",method=RequestMethod.GET)
+	public AjaxJson delGroup(String id,String groupId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
+		AjaxJson j=new AjaxJson();
+		User user =userDao.get(id);
+		LayGroup group = layGroupDao.get(groupId);
+		LayGroupUser layGroupUser =new LayGroupUser();
+		layGroupUser.setUser(user);
+		layGroupUser.setGroup(group);
+		layGroupUserDao.delete(layGroupUserDao.findList(layGroupUser).get(0));
+		j.setMsg("退出成功");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+}
+

+ 371 - 0
src/main/java/com/jeeplus/modules/API/maillist/InviteController.java

@@ -0,0 +1,371 @@
+package com.jeeplus.modules.API.maillist;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.API.easemob.EasemobController;
+import com.jeeplus.modules.sys.dao.OfficeDao;
+import com.jeeplus.modules.sys.dao.RoleDao;
+import com.jeeplus.modules.sys.dao.UserDao;
+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.service.OfficeService;
+import com.jeeplus.modules.sys.service.SystemService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.sysuseroffice.entity.Useroffice;
+import com.jeeplus.modules.sysuseroffice.service.UserofficeService;
+import com.jeeplus.modules.utils.ErrorCode;
+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.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+/**
+ * 邀请同事Controller
+ * @author zmy
+ * @version 2017-04-17
+ */
+@Controller
+@RequestMapping(value = "${frontPath}/maillist/invite")
+public class InviteController extends BaseController {
+	@Autowired
+	private RoleDao roleDao;
+	@Autowired
+	private OfficeDao officeDao;
+	@Autowired
+	private SystemService systemService;
+	@Autowired
+	private OfficeService officeService;
+    @Autowired
+	private UserofficeService userofficeService;
+
+	/**
+	 * 获取职位列表
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getMailListRoleList", method=RequestMethod.GET)
+	public AjaxJson findRole (String companyId,String officeId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
+		AjaxJson j=new AjaxJson(); 
+		Role role=new Role();
+		Office company = officeService.get(companyId);
+		role.setCompany(company);
+		role.setOffice(new Office(officeId));
+		List<Role> roleList=roleDao.findList(role);
+		/*List<Office> officeList = officeDao.findAllListByParentIds(company);
+		for (Office office:officeList){
+			if (office.getType().equals("1")){
+				Role r=new Role();
+				r.setCompany(office);
+				List<Role> roleLists = roleDao.findList(r);
+				roleList.addAll(roleLists);
+			}
+		}*/
+		List<Map<String,Object>> mapList = Lists.newArrayList();
+		for(int i = 0; i < roleList.size(); i++){
+			Map<String,Object> map = Maps.newHashMap();
+			Role r = roleList.get(i);
+			map.put("roleName", r.getName());
+			map.put("roleId", r.getId());
+			mapList.add(map);
+		}		
+		j.put("data", mapList);
+		j.setMsg("获取公司职位列表成功");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j; 
+	}
+	
+	/**
+	 * 获取部门列表
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getMailListOfficeList", method=RequestMethod.GET)
+	public AjaxJson findOffice (String companyId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
+		AjaxJson j=new AjaxJson();
+		try {
+			List<Map<String,Object>> mapList = Lists.newArrayList();
+			List<Map<String,Object>> maps = Lists.newArrayList();
+			Office company = officeService.get(companyId);
+			Map<String,Object> map1 = new HashMap<>();
+			map1.put("officeId",company.getId());
+			map1.put("officeName",company.getTopCompany());
+			map1.put("type","2");
+			maps.add(map1);
+			if (company.getType().equals("1")) {
+				company.setParent(new Office(companyId));
+				List<Office> officeList = officeDao.findListByParentId(company);
+				for (int i = 0; i < officeList.size(); i++) {
+					Office e = officeList.get(i);
+					if (e.getType().equals("2")) {
+						company.setParent(e);
+						Integer count = officeDao.findListByParentIdCount(company);
+						List<User> userList = systemService.findUserByOffices(e,company);
+						Map<String, Object> map = Maps.newHashMap();
+						map.put("count", userList.size());
+						map.put("officeId", e.getId());
+						map.put("type", count == null || count == 0 ? "0" : "1");
+						map.put("officeName", e.getTopCompany());
+						mapList.add(map);
+					} else {
+						if (e.getType().equals("1") && !"0,".equals(e.getParentIds())) {
+							logger.info("排除子公司数据");
+						} else {
+							List<User> userList = systemService.findUserByOffices(e, company);
+							Map<String, Object> map = Maps.newHashMap();
+							map.put("officeId", e.getId());
+							map.put("count", userList.size());
+							map.put("type", "2");
+							map.put("officeName", e.getTopCompany());
+							mapList.add(map);
+						}
+					}
+				}
+				j.put("data", mapList);
+				j.put("parents", maps);
+				j.setErrorCode(ErrorCode.code_1004);
+				j.setMsg("获取组织架构列表成功");
+			}else {
+				j.put("data", new HashMap<>());
+				j.put("parents", maps);
+				j.setErrorCode(ErrorCode.code_1004);
+				j.setMsg("获取组织架构失败,公司id错误");
+			}
+		}catch (Exception e){
+			j.setSuccess(false);
+			j.put("data", new HashMap<>());
+			j.put("parents", new HashMap<>());
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("获取组织架构失败");
+		}
+
+		return j; 
+	}
+	
+	/**
+	 * 获取部门员工列表
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getMailListMembersList", method=RequestMethod.GET)
+	public AjaxJson findMembers (String officeId,String type,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
+		AjaxJson j=new AjaxJson();
+		try{
+			List<Map<String, Object>> maps = Lists.newArrayList();
+			Office office = officeDao.get(officeId);
+			Map<String,Object> map1 = new HashMap<>();
+			map1.put("officeId",office.getId());
+			map1.put("officeName",office.getTopCompany());
+			map1.put("type",office.getType().equals("2")?"1":"2");
+			String[] parentIds = office.getParentIds().split(",");
+			for (String id:parentIds){
+				if (!id.equals("0")) {
+					Office o = officeDao.get(id);
+					Map<String,Object> map = new HashMap<>();
+					map.put("officeId",o.getId());
+					map.put("officeName",o.getTopCompany());
+					map.put("type",o.getType().equals("2")?"1":"2");
+					maps.add(map);
+				}
+			}
+			maps.add(map1);
+			if("0".equals(type)) {
+				List<User> userList = new ArrayList<>();
+				userList = systemService.findUserByOfficeId(officeId);
+				List<Map<String, Object>> glymapList = Lists.newArrayList();
+				for (int i = 0; i < userList.size(); i++) {
+					User user = userList.get(i);
+					Map<String, Object> map = Maps.newHashMap();
+					map.put("id", user.getId());
+					map.put("name", user.getName());
+					map.put("photo", user.getPhoto());
+					map.put("isgly", 0);
+					Role role = new Role();
+					role.setUser(user);
+					role.setCompany(UserUtils.getSelectCompany());
+					List<Role> roleList = roleDao.findList(role);
+					for (Role r : roleList) {
+						if (org.apache.commons.lang3.StringUtils.isNotBlank(r.getEnname()) && r.getEnname().endsWith("gly") || r.getEnname().equals("system")) {
+							map.put("isgly", 1);
+						}
+					}
+					glymapList.add(map);
+				}
+				j.put("data", glymapList);
+				j.setMsg("获取部门下员工列表成功");
+			}else {
+				List<Map<String,Object>> mapList = Lists.newArrayList();
+				Office company = UserUtils.getSelectCompany();
+				company.setParent(new Office(officeId));
+				List<Office> officeList = officeDao.findListByParentId(company);
+				for (int i = 0; i < officeList.size(); i++) {
+					Office e = officeList.get(i);
+					if (e.getType().equals("2")) {
+						company.setParent(e);
+						Integer count = officeDao.findListByParentIdCount(company);
+						List<User> userList = systemService.findUserByOffices(e,company);
+						Map<String, Object> map = Maps.newHashMap();
+						map.put("count", userList.size());
+						map.put("officeId", e.getId());
+						map.put("type", count==null||count==0?"0":"1");
+						map.put("officeName", e.getTopCompany());
+						mapList.add(map);
+					}else {
+						if (e.getType().equals("1") && !"0,".equals(e.getParentIds())){
+							logger.info("排除子公司数据");
+						}else{
+							List<User> userList = systemService.findUserByOffices(e,company);
+							Map<String, Object> map = Maps.newHashMap();
+							map.put("officeId", e.getId());
+							map.put("count", userList.size());
+							map.put("officeName", e.getTopCompany());
+							map.put("type", "2");
+							mapList.add(map);
+						}
+					}
+				}
+				j.put("data", mapList);
+				j.setMsg("获取组织架构列表成功");
+			}
+			j.put("parents", maps);
+			j.setErrorCode(ErrorCode.code_1004);
+		}catch (Exception e){
+			j.put("data", new HashMap<>());
+			j.put("parents",new HashMap<>());
+			j.setErrorCode(ErrorCode.code_2004);
+			if("0".equals(type)) {
+				j.setMsg("获取组织架构列表失败");
+			}else{
+				j.setMsg("获取部门下员工列表失败");
+			}
+
+		}
+		return j; 
+	}
+	
+	/**
+	 * 添加员工 (加入企业)
+	 */
+	  @ResponseBody
+	  @RequestMapping(value = "addMember",method=RequestMethod.POST)
+	  @Transactional
+	    public AjaxJson addMember(HttpServletRequest request, HttpServletResponse response) {
+		  AjaxJson j=new AjaxJson();
+		  try {
+			  HashMap<String, String> requestMap = findRequestMap(request);
+			  String userId = requestMap.get("userId");
+			  String roleId = requestMap.get("roleId");
+			  String userName = requestMap.get("userName");
+			  String mobile = requestMap.get("mobile");
+			  String companyId = requestMap.get("companyId");
+			  //String officeId = requestMap.get("officeId");
+			  User userLogin = UserUtils.getByLoginName(mobile);
+			  if (userLogin == null) {
+				  j.setMsg("员工添加失败,该手机号未注册");
+				  j.setSuccess(false);
+				  j.setErrorCode(ErrorCode.code_1003);
+				  return j;
+			  }
+			  if (StringUtils.isBlank(roleId) ){
+				  j.setMsg("员工添加失败,员工岗位或者部门不能为空!");
+				  j.setSuccess(false);
+				  j.setErrorCode(ErrorCode.code_1003);
+				  return j;
+			  }
+
+			  Role role = roleDao.get(roleId);
+			  String officeId = role.getOffice().getId();
+			  //User user = UserUtils.get(userId);
+			  List<Office> companyList = UserUtils.getAllCompany(userLogin);
+			  EasemobController controller = new EasemobController();
+			  controller.SendMessage();
+			  for (Office office : companyList) {
+				  if (role.getCompany().getId().equals(office.getId())) {
+					  j.setMsg("添加失败,该用户已是该企业员工");
+					  j.setSuccess(false);
+					  j.setErrorCode(ErrorCode.code_1009);
+					  return j;
+				  }
+			  }
+			  if (role.getCompany().getId()!=companyId || role.getCompany().getId().equals("1")){
+				  j.setMsg("保存用户'" + userLogin.getLoginName() + "'失败,当前公司没有这个岗位!");
+				  j.setSuccess(false);
+				  j.setErrorCode(ErrorCode.code_1009);
+				  return j;
+			  }
+			  //role.setOffice(new Office(officeId));
+			  /*List<Role> roleList =systemService.getRoleList(userLogin.getId(),"");
+			  boolean b = true;
+			  for (Role r : roleList){
+				  Office o = r.getCompany();
+				  if (companyId.equals(o.getId())){
+					  roleList.remove(r);
+					  roleList.add(new Role(roleId));
+					  b = false;
+					  break;
+				  }
+			  }
+			  if (b){
+				  roleList.add(new Role(roleId));
+			  }
+			  userLogin.setRoleList(roleList);
+			  if (roleIdList==null||roleIdList.size()==0){
+				  *//*addMessage(redirectAttributes, "保存用户'" + userLogin.getLoginName() + "'失败,岗位不能为空!");
+				  return "redirect:" + adminPath + "/sys/company/joinCompany?repage";*//*
+			  }*/
+			  String name = userLogin.getName();
+			  String roleName = requestMap.get("roleName");
+			  String officeName = requestMap.get("officeName");
+			  String ishide = requestMap.get("ishide");
+			  String no = requestMap.get("no");
+			  userLogin.setNo(no);
+			  userLogin.setIshide(ishide);
+			  userLogin.setName(name);
+			  userLogin.setRoleName(roleName);
+			  userLogin.setOfficeName(officeName);
+			  systemService.saveUserInfo(userLogin);
+			  systemService.assignUserToRole(role, userLogin,0);
+			  Useroffice useroffice = new Useroffice();
+			  useroffice.setCompanyId(companyId);
+			  useroffice.setOfficeId(officeId);
+			  useroffice.setStatus("3");
+			  useroffice.setDelFlag("0");
+			  useroffice.setRemarks("管理员邀请");
+			  useroffice.setMaster(UserUtils.getUser().getId());
+			  useroffice.setUserId(userLogin.getId());
+			  List<Useroffice> listOffice = userofficeService.findList(useroffice);
+			  if(listOffice==null || listOffice.size()==0){
+				  userofficeService.save(useroffice);
+			  }else {
+				  Useroffice oldUseroffice = listOffice.get(0);
+				  oldUseroffice.setOfficeId(request.getParameter("office.id"));
+				  userofficeService.save(oldUseroffice);
+			  }
+			  boolean bool = systemService.outUserInRole(new Role("1"), systemService.getUser(userLogin.getId()));
+			  if (bool){
+				  systemService.saveCurrentCompanyById(userLogin.getId(), companyId, officeId);
+			  }
+			  for (Office office : companyList) {
+				  if (role.getCompany().getId().equals(office.getId())) {
+					  //addMessage(redirectAttributes, "添加失败,该用户已是该企业员工");
+				  }
+			  }
+			  j.setMsg("员工添加成功");
+		  }catch (Exception e){
+			  j.setErrorCode(ErrorCode.code_2004);
+			  j.setSuccess(false);
+			  j.setMsg("员工添加失败");
+		  }
+		return j; 
+	}	  		
+	
+}

Fichier diff supprimé car celui-ci est trop grand
+ 1173 - 0
src/main/java/com/jeeplus/modules/API/oa/AttendanceController.java


+ 224 - 0
src/main/java/com/jeeplus/modules/API/sys/LoginMobileController.java

@@ -0,0 +1,224 @@
+package com.jeeplus.modules.API.sys;
+
+import java.io.IOException;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.jeeplus.common.utils.*;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullDesign;
+import com.jeeplus.modules.workfullmanage.service.WorkFullDesignService;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.apache.shiro.web.util.SavedRequest;
+import org.apache.shiro.web.util.WebUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.security.shiro.session.SessionDAO;
+import com.jeeplus.common.servlet.ValidateCodeServlet;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.iim.entity.MailBox;
+import com.jeeplus.modules.iim.entity.MailPage;
+import com.jeeplus.modules.oa.entity.OaNotify;
+import com.jeeplus.modules.sys.dao.UserDao;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.security.FormAuthenticationFilter;
+import com.jeeplus.modules.sys.security.SystemAuthorizingRealm.Principal;
+import com.jeeplus.modules.sys.service.SystemService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import redis.clients.jedis.Jedis;
+
+/**
+ * 登录Controller
+ *
+ * @author mengxy
+ * @version 2017-5-17
+ */
+@Controller
+public class LoginMobileController extends BaseController {
+
+	@Autowired
+	private SessionDAO sessionDAO;
+
+	@Autowired
+	private WorkFullDesignService workFullDesignService;
+
+	// @RequestMapping(value = "${frontPath}/login")
+	// public AjaxJson login(HttpServletRequest request, HttpServletResponse
+	// response, Model model){
+	//
+	//
+	// AjaxJson j=new AjaxJson();
+	// return j;
+	//
+	// }
+	/**
+	 * 管理登录
+	 *
+	 * @throws IOException
+	 */
+	@RequestMapping(value = "${frontPath}/login")
+	@ResponseBody
+	public AjaxJson login(HttpServletRequest request, HttpServletResponse response, Model model) throws IOException {
+		response.setHeader("Access-Control-Allow-Origin","*");
+		response.setHeader("Access-Control-Allow-Method","POST,GET");
+		Principal principal = UserUtils.getPrincipal();
+		AjaxJson j = new AjaxJson();
+
+		if (logger.isDebugEnabled()) {
+			//logger.debug("login, active session size: {}", sessionDAO.getActiveSessions(false).size());
+		}
+
+		if (principal != null && CacheUtils.get("selectRole") != null) {
+			j.setSuccess(false);
+			j.setMsg("已经登录!");
+			j.setErrorCode(ErrorCode.code_1006);
+			return j;
+		}
+
+		j.setSuccess(false);
+		j.setMsg("会话失效");
+		j.setErrorCode(ErrorCode.code_1001);
+		return j;
+
+		/*
+		// 如果已登录,再次访问主页,则退出原账号。
+		if (Global.TRUE.equals(Global.getConfig("notAllowRefreshIndex"))) {
+			CookieUtils.setCookie(response, "LOGINED", "false");
+		}
+
+		// 如果已经登录,则跳转到管理首页
+		if (principal != null && !principal.isMobileLogin()) {
+			return "redirect:" + frontPath;
+		}
+
+		SavedRequest savedRequest = WebUtils.getSavedRequest(request);// 获取跳转到login之前的URL
+		// 如果是手机没有登录跳转到到login,则返回JSON字符串
+		if (savedRequest != null) {
+			String queryStr = savedRequest.getQueryString();
+			if (queryStr != null && (queryStr.contains("__ajax") || queryStr.contains("mobileLogin"))) {
+				AjaxJson j = new AjaxJson();
+				j.setSuccess(false);
+				j.setErrorCode("0");
+				j.setMsg("没有登录!");
+				return renderString(response, j);
+			}
+		}
+
+		return "modules/sys/sysLogin";*/
+
+	}
+
+	/**
+	 * 登录失败,真正登录的POST请求由Filter完成
+	 */
+	@RequestMapping(value = "${frontPath}/login", method = RequestMethod.POST)
+    @ResponseBody
+	public AjaxJson loginFail(HttpServletRequest request, HttpServletResponse response) {
+		Principal principal = UserUtils.getPrincipal();
+		AjaxJson j = new AjaxJson();
+		// 如果已经登录,则跳转到管理首页
+		if (principal != null && CacheUtils.get("selectRole") != null) {
+			j.setSuccess(false);
+			j.setMsg("已经登录!");
+			j.setErrorCode(ErrorCode.code_1006);
+			return j;
+		}
+
+		String username = WebUtils.getCleanParam(request, FormAuthenticationFilter.DEFAULT_USERNAME_PARAM);
+		boolean rememberMe = WebUtils.isTrue(request, FormAuthenticationFilter.DEFAULT_REMEMBER_ME_PARAM);
+		boolean mobile = WebUtils.isTrue(request, FormAuthenticationFilter.DEFAULT_MOBILE_PARAM);
+		String exception = (String) request.getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME);
+		String message = (String) request.getAttribute(FormAuthenticationFilter.DEFAULT_MESSAGE_PARAM);
+		String companyName = (String) request.getAttribute(FormAuthenticationFilter.DEFAULT_COMPANY_PARAM);
+		if (StringUtils.isBlank(message) || StringUtils.equals(message, "null")) {
+			if(SecurityUtils.getSubject().getSession()!=null){
+				SecurityUtils.getSubject().logout();
+			}
+			message = "您的登录信息过期,请重新登录!";
+			j.setErrorCode(ErrorCode.code_1002);
+		}else if (message.equals("用户或密码错误, 请重试.")){
+            j.setErrorCode(ErrorCode.code_1002);
+        }else if (message.equals("登录失败, 该用户未注册.")){
+			j.setErrorCode(ErrorCode.code_1003);
+		}
+
+		if (logger.isDebugEnabled()) {
+			//logger.debug("login fail, active session size: {}, message: {}, exception: {}",sessionDAO.getActiveSessions(false).size(), message, exception);
+		}
+        UserUtils.saveSelectCompany();
+		j.setSuccess(false);
+		j.setMsg(message);
+		return j;
+	}
+
+
+	/**
+	 * 管理登录
+	 *
+	 * @throws IOException
+	 */
+	@ResponseBody
+	@RequestMapping(value = "${frontPath}/logout", method = RequestMethod.GET)
+	public AjaxJson logout(HttpServletRequest request, HttpServletResponse response) {
+		Principal principal = UserUtils.getPrincipal();
+		System.out.println("mobile logout");
+		AjaxJson j = new AjaxJson();
+		// 如果已经登录,则跳转到管理首页
+		Jedis jedis = null;
+		try {
+			jedis = JedisUtils.getResource();
+			String userId = jedis.get(UserUtils.getUser().getId());
+			if (StringUtils.isNotBlank(userId)){
+				jedis.del(userId);
+			}
+		} catch (Exception e) {
+			logger.error("getActiveSessions", e);
+		} finally {
+			JedisUtils.returnResource(jedis);
+		}
+		if (principal != null) {
+			UserUtils.getSubject().logout();
+		}
+
+		j.setSuccess(true);
+		j.setMsg("退出成功");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+
+//	@Transactional
+//	@RequestMapping("${frontPath}/testSw")
+//	@ResponseBody
+//	public AjaxJson testSw(){
+//		AjaxJson j = new AjaxJson();
+//		WorkFullDesign w = new WorkFullDesign();
+//		w.setLinkPhone("1");
+//		w.setUnitName("2");
+//		w.setUnitLinkMan("3");
+//		workFullDesignService.save(w);
+//		WorkFullDesign w1 = new WorkFullDesign();
+//		w1.setLinkPhone("1122");
+//		w1.setUnitName("21");
+//		w1.setUnitLinkMan("31");
+//		workFullDesignService.save(w1);
+//
+//		j.setSuccess(true);
+//		j.setMsg("退出成功");
+//		j.setErrorCode("-1");
+//		return j;
+//	}
+
+}

+ 377 - 0
src/main/java/com/jeeplus/modules/API/sys/RegisterMobileController.java

@@ -0,0 +1,377 @@
+package com.jeeplus.modules.API.sys;
+
+import com.easemob.server.example.api.impl.EasemobIMUsers;
+import com.google.common.collect.Lists;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.FileUtils;
+import com.jeeplus.common.utils.JedisUtils;
+import com.jeeplus.common.utils.RequestUtils;
+import com.jeeplus.common.utils.WordToPic;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.sys.dao.UserDao;
+import com.jeeplus.modules.sys.entity.Dict;
+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.service.DictService;
+import com.jeeplus.modules.sys.service.SystemService;
+import com.jeeplus.modules.sys.utils.DictUtils;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.tools.utils.TwoDimensionCode;
+import com.jeeplus.modules.utils.ErrorCode;
+import io.swagger.client.model.Nickname;
+import io.swagger.client.model.RegisterUsers;
+import net.sf.json.JSONObject;
+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 redis.clients.jedis.Jedis;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 注册Controller
+ *
+ * @author mengxy
+ * @version 2017-5-22
+ */
+@Controller
+
+public class RegisterMobileController extends BaseController {
+
+//	@Autowired
+//	private SystemConfigService systemConfigService;
+
+    @Autowired
+    private SystemService systemService;
+
+    @Autowired
+    private DictService dictService;
+
+    @Autowired
+    private UserDao userDao;
+
+    @RequestMapping(value = "test" , method=RequestMethod.GET)
+    public AjaxJson test(HttpServletRequest request, HttpServletResponse response) {
+        return new AjaxJson();
+    }
+
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "${frontPath}/registerUser", method = RequestMethod.POST)
+    public AjaxJson registerUser(HttpServletRequest request, HttpServletResponse response) {
+        Jedis jedis = null;
+        try {
+            jedis = JedisUtils.getResource();
+            HashMap<String, String> requestMap = RequestUtils.findRequestMap(request);
+            String mobile = requestMap.get("mobile");
+            String randomCode = requestMap.get("randomCode");
+            String name = requestMap.get("name");
+            String password = requestMap.get("password");
+            AjaxJson j = new AjaxJson();
+
+            if (!randomCode.equals(jedis.get(mobile)) || !"1".equals(jedis.get("1"))) {
+                String message= "验证码验证失败!";
+                j.setSuccess(false);
+                j.setMsg(message);
+                j.setErrorCode(ErrorCode.code_1011);
+                return j;
+            }
+            // 清除验证码
+            //request.getSession().getServletContext().removeAttribute(mobile);
+            jedis.del(mobile);
+            String url = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort();
+            String contextPath = request.getContextPath();
+            j = systemService.registerUser(mobile,randomCode,name,password,contextPath,url);
+            return j;
+        } catch (Exception e) {
+            //logger.error("getActiveSessions", e);
+            AjaxJson j = new AjaxJson();
+            String message= "验证码验证失败!";
+            j.setSuccess(false);
+            j.setMsg(message);
+            j.setErrorCode(ErrorCode.code_1011);
+            return j;
+        } finally {
+            JedisUtils.returnResource(jedis);
+        }
+
+       /* long time = System.currentTimeMillis();
+        try {
+            // 验证手机号是否已经注册
+            if (userDao.findUniqueByProperty("mobile", mobile) != null) {
+                // 如果是手机登录,则返回JSON字符串
+                j.setSuccess(false);
+                j.setErrorCode(ErrorCode.code_1007);
+                j.setMsg("手机号已经被使用!");
+                return j;
+            }
+            //		// 验证短信内容
+            //		if (!randomCode.equals(request.getSession().getServletContext().getAttribute(mobile))) {
+            //			// 如果是手机登录,则返回JSON字符串
+            //			j.setSuccess(false);
+            //			j.setErrorCode("3");
+            //			j.setMsg("手机验证码不正确!");
+            //			return j;
+            //		}
+
+            // 修正引用赋值问题,不知道为何,Company和Office引用的一个实例地址,修改了一个,另外一个跟着修改。
+            List<Dict> dictList = DictUtils.getDictList("defalut_role");
+            Dict dict = dictList.get(0);
+            Role role = systemService.getRole(dict.getValue());
+
+
+            // 密码MD5加密
+            user.setPasswordRemake(password);
+            user.setPassword(SystemService.entryptPassword(password));
+            user.setLoginName(mobile);
+
+            // 岗位数据有效性验证,过滤不在授权内的岗位
+            List<Role> roleList = Lists.newArrayList();
+            roleList.add(role);
+            user.setRoleList(roleList);
+            *//*
+             * //保存机构 user.setCompany(office); user.setOffice(office);
+             *//*
+            // 生成用户二维码,使用登录名
+            String realPath = Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL +time+ "/qrcode/";
+            FileUtils.createDirectory(realPath);
+            String picName = time + ".png"; // encoderImgId此处二维码的图片名
+            String filePath = realPath + picName; // 存放路径
+            TwoDimensionCode.encoderQRCode(user.getLoginName(), filePath, "png");// 执行生成二维码
+            user.setQrCode(request.getContextPath() + Global.USERFILES_BASE_URL +time+  "/qrcode/" + picName);
+            if (user.getQrCode()!=null && !user.getQrCode().equals("")){
+                InputStream inputStream = null;
+                HttpURLConnection httpURLConnection;
+                try {
+                    URL url = new URL(request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+ user.getQrCode());
+                    httpURLConnection = (HttpURLConnection) url.openConnection();
+                    // 设置网络连接超时时间
+                    httpURLConnection.setConnectTimeout(3000);
+                    // 设置应用程序要从网络连接读取数据
+                    httpURLConnection.setDoInput(true);
+
+                    httpURLConnection.setRequestMethod("GET");
+                    int responseCode = httpURLConnection.getResponseCode();
+                    if (responseCode == 200) {
+                        // 从服务器返回一个输入流
+                        inputStream = httpURLConnection.getInputStream();
+
+                    }
+                    OSSClientUtil ossUtil =new OSSClientUtil();
+                    String[] arr = user.getQrCode().split("/");
+                    String qrCodeName = System.currentTimeMillis()+arr[arr.length-1];
+                    ossUtil.uploadFile2OSS(inputStream, Global.getRqcode(),qrCodeName);
+                    user.setQrCode(Global.getAliyunUrl()+"/"+ Global.getRqcode() + qrCodeName);
+                } catch (MalformedURLException e) {
+                    e.printStackTrace();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                } finally {
+                    inputStream.close();
+                }
+            }
+            user.setName(name);
+            String realPathPhoto = Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL  +time+ "/img/";
+            FileUtils.createDirectory(realPathPhoto);
+            String picNamePhoto =time + ".png"; // encoderImgId此处二维码的图片名
+            String filePathPhoto = realPathPhoto + picNamePhoto; // 存放路径
+            //FontImageUtil.createImage(name.substring(0, 1), new Font("宋体", Font.BOLD, 100), new File(filePathPhoto), 200, 200);
+            WordToPic.TextToPic(name.substring(name.length()-2>0?name.length()-2:0,name.length()),200, 200, 55, filePathPhoto);
+            user.setPhoto(request.getContextPath() + Global.USERFILES_BASE_URL + time + "/img/"+picNamePhoto);
+            if (user.getPhoto()!=null && !user.getPhoto().equals("")){
+                InputStream inputStream = null;
+                HttpURLConnection httpURLConnection;
+                try {
+                    URL url = new URL(request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+ user.getPhoto());
+                    httpURLConnection = (HttpURLConnection) url.openConnection();
+                    // 设置网络连接超时时间
+                    httpURLConnection.setConnectTimeout(3000);
+                    // 设置应用程序要从网络连接读取数据
+                    httpURLConnection.setDoInput(true);
+
+                    httpURLConnection.setRequestMethod("GET");
+                    int responseCode = httpURLConnection.getResponseCode();
+                    if (responseCode == 200) {
+                        // 从服务器返回一个输入流
+                        inputStream = httpURLConnection.getInputStream();
+
+                    }
+                    OSSClientUtil ossUtil =new OSSClientUtil();
+                    String[] arr = user.getPhoto().split("/");
+                    String photoName = time+arr[arr.length-1];
+                    ossUtil.uploadFile2OSS(inputStream, Global.getPhoto(),photoName);
+                    user.setPhoto(Global.getAliyunUrl() + "/" + Global.getPhoto() + photoName);
+                } catch (MalformedURLException e) {
+                    e.printStackTrace();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                } finally {
+                    inputStream.close();
+                }
+            }
+            user.setMobile(mobile);
+            // 保存用户信息
+            user.setDefaultPhoto("0");
+            user.setComId("1");
+            user.setRole(new Role("1"));
+            user.setCompany(new Office("1"));
+            user.setOffice(new Office("5"));
+            systemService.saveUser(user);
+            // 清除当前用户缓存
+            if (user.getLoginName().equals(UserUtils.getUser().getLoginName())) {
+                UserUtils.clearCache();
+                // UserUtils.getCacheMap().clear();
+            }
+            request.getSession().getServletContext().removeAttribute(user.getMobile());// 清除验证码
+            //环信注册
+            RegisterUsers users = new RegisterUsers();
+            io.swagger.client.model.User user1 = new io.swagger.client.model.User().username(user.getId()).password(password);
+            users.add(user1);
+            Object result = easemobIMUsers.createNewIMUserSingle(users);
+            Nickname nickname =new Nickname();
+            nickname.setNickname(user.getName());
+            easemobIMUsers.modifyIMUserNickNameWithAdminToken(user.getId(),nickname);
+            logger.info(result.toString());
+            JSONObject json = JSONObject.fromObject(result);
+            j.put("IMUser", json);
+
+            j.setSuccess(true);
+            j.setMsg("注册用户'" + user.getLoginName() + "'成功");
+            j.put("userId", user.getId());
+            j.setErrorCode(ErrorCode.code_1004);
+        }catch (Exception e){
+            e.printStackTrace();
+            userDao.delete(user);
+        }*/
+
+    }
+
+    /**
+     * 获取验证码
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "${frontPath}/getRandomCode", method = RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getRegisterCode(HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson j = new AjaxJson();
+        String mobile = request.getParameter("mobile");
+        String type = request.getParameter("type");
+        logger.info(request.getContextPath()+"/f/getRandomCode?mobile="+mobile+"&type="+type);
+        Jedis jedis = null;
+        try {
+            // 验证手机号是否已经注册
+            if (userDao.findUniqueByProperty("mobile", mobile) != null) {
+                if (type.equals("1") || type.equals("4")) {
+                    j.setSuccess(false);
+                    j.setErrorCode(ErrorCode.code_1007);
+                    j.setMsg("手机号已经被使用!");
+                    return j;
+                }
+            }
+
+            String randomCode = String.valueOf((int) (Math.random() * 9000 + 1000));
+            HashMap<String,Object> result =UserUtils.sendRandomCodes(mobile, randomCode);
+            String statusCode = (String) result.get("statusCode");
+                //if (result.contains("Success") && result.contains("ok")) {
+                if (("000000").equals(statusCode)) {
+                    j.setSuccess(true);
+                    j.setErrorCode(ErrorCode.code_1004);
+                    j.setMsg("短信发送成功!");
+                    Map<String,Object> map = new HashMap<>();
+                    map.put("randomCode",randomCode);
+                    map.put("type",type);
+                    map.put("mobile",mobile);
+                    j.put("data",map);
+                    logger.info("../f/getRandomCode/  randomCode=" + randomCode);
+                    jedis = JedisUtils.getResource();
+                    if(jedis.get(mobile)!=null && jedis.get(type)!=null){
+                        jedis.del(mobile);
+                        jedis.del(type);
+                    }
+                    jedis.set(mobile, randomCode);
+                    jedis.setex(mobile, 300, randomCode);
+                    jedis.set(type, type);
+               /* if(request.getSession().getServletContext().getAttribute(mobile)!=null && request.getSession().getServletContext().getAttribute(type)!=null){
+                    request.getSession().getServletContext().removeAttribute(mobile);
+                    request.getSession().getServletContext().removeAttribute(type);
+                }
+                request.getSession().getServletContext().setAttribute(mobile, randomCode);
+                request.getSession().getServletContext().setAttribute(type, type);*/
+                } else {
+                    j.setSuccess(false);
+                    j.setErrorCode(ErrorCode.code_1008);
+                    j.setMsg("短信发送失败,错误代码:101,请联系管理员。");
+                    j.put("ErrorXml",result);
+                }
+
+
+        }catch (Exception e){
+            logger.info("5");
+            j.setSuccess(false);
+            j.setErrorCode(ErrorCode.code_1008);
+            j.setMsg("短信发送失败!");
+        }
+        finally {
+            JedisUtils.returnResource(jedis);
+        }
+        return j;
+    }
+
+    /**
+     * 验证手机验证码是否正确
+     */
+    @ResponseBody
+    @RequestMapping(value = "${frontPath}/validateMobileCode", method = RequestMethod.GET)
+    public AjaxJson validateMobileCode(HttpServletRequest request) {
+        HashMap<String, String> requestMap = RequestUtils.findRequestMap(request);
+        AjaxJson j = new AjaxJson();
+        String mobile = requestMap.get("mobile");
+        String randomCode = requestMap.get("randomCode");
+        String type = requestMap.get("type");
+        String message ="验证失败!";
+        Jedis jedis = null;
+        try {
+            jedis = JedisUtils.getResource();
+            String a= jedis.get(mobile);
+            if (randomCode.equals(jedis.get(mobile)) && type.equals(jedis.get(type))) {
+                message= "验证成功!";
+                j.setSuccess(true);
+                j.setMsg(message);
+                j.setErrorCode(ErrorCode.code_1004);
+            } else {
+                j.setSuccess(false);
+                j.setMsg(message);
+                j.setErrorCode(ErrorCode.code_1011);
+            }
+            return j;
+        } catch (Exception e) {
+            //logger.error("getActiveSessions", e);
+            j.setSuccess(false);
+            j.setMsg(message);
+            j.setErrorCode(ErrorCode.code_1011);
+            return j;
+        } finally {
+            JedisUtils.returnResource(jedis);
+        }
+    }
+}

+ 82 - 0
src/main/java/com/jeeplus/modules/API/sys/SessionController.java

@@ -0,0 +1,82 @@
+package com.jeeplus.modules.API.sys;
+
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.security.shiro.session.JedisSessionDAO;
+import com.jeeplus.common.security.shiro.session.SessionDAO;
+import com.jeeplus.common.utils.CacheUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.sys.security.FormAuthenticationFilter;
+import com.jeeplus.modules.sys.security.SystemAuthorizingRealm.Principal;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.UnavailableSecurityManagerException;
+import org.apache.shiro.authc.AuthenticationException;
+import org.apache.shiro.session.InvalidSessionException;
+import org.apache.shiro.session.Session;
+import org.apache.shiro.subject.Subject;
+import org.apache.shiro.web.util.WebUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Collection;
+
+/**
+ * 登录Controller
+ * 
+ * @author mengxy
+ * @version 2017-5-17
+ */
+@Controller
+
+public class SessionController extends BaseController {
+
+	@Autowired
+	private SessionDAO sessionDAO;
+
+	private JedisSessionDAO jedisSessionDAO;
+
+
+	/**
+	 * 管理session
+	 * 
+	 * @throws IOException
+	 */
+	@RequestMapping(value = "${frontPath}/session")
+	@ResponseBody
+	public AjaxJson sessionUpdate(HttpServletRequest request, HttpServletResponse response, Model model) throws IOException {
+		AjaxJson j = new AjaxJson();
+		Session session = null;
+		String sessionId = "";
+		try{
+			Subject subject = SecurityUtils.getSubject();
+			session = subject.getSession(false);
+			Session session1 = UserUtils.getSession();
+			session.touch();
+			//更新会话:SecurityUtils.getSubject().getSession().touch();
+			//停止会话:SecurityUtils.getSubject().getSession().stop();
+			sessionId = session.getId().toString();
+		}catch (InvalidSessionException e){
+			logger.error("Invalid session error", e);
+		}catch (UnavailableSecurityManagerException e2){
+			logger.error("Unavailable SecurityManager error", e2);
+		}
+		logger.info("登录成功返回的sessionId+++++++++++++" + sessionId);
+		j.setSuccess(true);
+		j.setMsg("session更新成功");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+
+	}
+
+
+
+}

+ 67 - 0
src/main/java/com/jeeplus/modules/API/userinfo/CurrentCompanyController.java

@@ -0,0 +1,67 @@
+package com.jeeplus.modules.API.userinfo;
+
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.service.SystemService;
+import com.jeeplus.modules.utils.ErrorCode;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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.servlet.mvc.support.RedirectAttributes;
+
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.sys.service.OfficeService;
+
+/**
+ * 当前企业Controller
+ * @author zmy
+ * @version 2017-04-17
+ */
+@Controller
+@RequestMapping(value = "${frontPath}/userInfo/currentcompany")
+public class CurrentCompanyController extends BaseController{
+
+	@Autowired
+	private SystemService systemService;
+	
+	/**
+	 * 获取当前企业列表
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getUserInfoCompanyList", method=RequestMethod.GET)
+	public AjaxJson findCompany (String id,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes)
+	{
+		AjaxJson j=new AjaxJson();
+		List<Map<String, Object>> companyList = systemService.getCurrentCompany(id);
+		j.put("data",companyList);
+		j.setErrorCode(ErrorCode.code_1004);
+		j.setMsg("获取企业列表成功");
+		return j;
+	}
+	/**
+	 * 切换用户当前企业
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getUserInfoCurrentCompany", method=RequestMethod.GET)
+	public AjaxJson getCurrentCompany (String id,String companyId,String officeId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes)
+	{  	
+					
+		AjaxJson j=new AjaxJson();
+		List<Map<String, Object>> companyList = systemService.saveCurrentCompanyById(id,companyId,officeId);
+		j.put("data",companyList);
+		j.setMsg("切换企业成功");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+		}	
+	}
+

+ 835 - 0
src/main/java/com/jeeplus/modules/API/userinfo/JoinCompanyController.java

@@ -0,0 +1,835 @@
+package com.jeeplus.modules.API.userinfo;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.JPushClientUtil;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.pushinfo.entity.Pushinfo;
+import com.jeeplus.modules.pushinfo.service.PushinfoService;
+import com.jeeplus.modules.sys.dao.CompanyDao;
+import com.jeeplus.modules.sys.dao.OfficeDao;
+import com.jeeplus.modules.sys.dao.RoleDao;
+import com.jeeplus.modules.sys.dao.UserDao;
+import com.jeeplus.modules.sys.entity.Company;
+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.service.CompanyService;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.service.SystemService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.sysuseroffice.entity.Useroffice;
+import com.jeeplus.modules.sysuseroffice.service.UserofficeService;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workcompanyinfo.service.CompanyinfoService;
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import com.jeeplus.modules.workprojectnotify.util.UtilNotify;
+import org.apache.commons.io.IOUtils;
+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.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 搜索企业Controller
+ * @author zmy
+ * @version 2017-04-17
+ */
+@Controller
+@RequestMapping(value = "${frontPath}/userInfo/searchcompany")
+public class JoinCompanyController extends BaseController{
+	@Autowired
+	private CompanyDao companyDao;
+	@Autowired
+	private OfficeDao officeDao;
+	@Autowired
+	private UserDao userDao;
+	@Autowired
+	private SystemService systemService;
+	@Autowired
+	private OfficeService officeService;
+	@Autowired
+	private UserofficeService userofficeService;
+    @Autowired
+    private CompanyinfoService companyinfoService;
+
+    @Autowired
+    private RoleDao roleDao;
+    @Autowired
+    private ActTaskService actTaskService;
+    @Autowired
+    private  PushinfoService pushinfoService;
+
+    @Autowired
+    private CompanyService companyService;
+    @Autowired
+    private WorkProjectNotifyService workProjectNotifyService;
+    private Lock lock = new ReentrantLock();
+	/**
+	 * 根据企业名称搜索
+	 * @throws UnsupportedEncodingException 
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getUserInfoSearchCompanyList", method=RequestMethod.GET)
+	public AjaxJson findCompany (String companyName,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) throws UnsupportedEncodingException
+	{  
+	   AjaxJson j=new AjaxJson();
+	   Office company=new Office();
+	   company.setName(companyName);
+	   company.setType("1");
+	   List<Office> companyList=officeDao.findListByCompanyName(company);
+	   List<Map<String,Object>> mapList = Lists.newArrayList();
+	   for(int i = 0; i < companyList.size(); i++){
+		   Map<String,Object> map = Maps.newHashMap();
+		   Office com=companyList.get(i);
+           if (!com.getId().equals("1")){
+               map.put("companyName", com.getName());
+               map.put("master", com.getMaster()==null || UserUtils.get(com.getMaster())==null?"":UserUtils.get(com.getMaster()).getName());
+               map.put("masterId", com.getMaster()==null ?"":com.getMaster());
+               map.put("companyLogo", com.getLogo() == null || com.getLogo().equals("") ? "" : com.getLogo());
+               map.put("companyId", com.getId());
+               Useroffice useroffice = new Useroffice();
+               useroffice.setCompanyId(com.getId());
+               useroffice.setStatus("3");
+               List<Useroffice> userofficeList=userofficeService.findList(useroffice);
+               map.put("count", userofficeList.size());
+               mapList.add(map);
+           }
+	   }
+	   j.put("data",mapList);
+       j.setErrorCode(ErrorCode.code_1004);
+       j.setMsg("获取企业信息成功");
+	   return j;
+	}
+
+    /**
+     * 启动加入公司流程
+     * @param
+     */
+    @Transactional
+    @RequestMapping(value = "saveJoinCompany", method = RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson saveJoinCompany(HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson ajaxJson = new AjaxJson();
+        try {
+            lock.lock();
+            HashMap<String, String> requestMap = findRequestMap(request);
+            Map<String, Object> variables = Maps.newHashMap();
+            Useroffice companyinfo = new Useroffice();
+            String master = URLDecoder.decode(requestMap.get("master")==null?"":requestMap.get("master"), "UTF-8");
+            String reason = URLDecoder.decode(requestMap.get("reason")==null?"":requestMap.get("reason"), "UTF-8");
+            String companyId = URLDecoder.decode(requestMap.get("companyId")==null?"":requestMap.get("companyId"), "UTF-8");
+            if(UserUtils.getSelectCompany().getId().equals(companyId)){
+                logger.error("加入公司流程失败:您是该企业员工");
+                ajaxJson.setSuccess(false);
+                ajaxJson.setErrorCode(ErrorCode.code_1009);
+                ajaxJson.setMsg("您已经是该企业员工,不能重复加入");
+                return ajaxJson;
+            }
+            //该公司下所有的岗位
+            List<Role> roleList = systemService.getRoleList("",companyId);
+            Role role = new Role();
+            if (roleList!=null && roleList.size()!=0){
+                for (Role r :roleList){
+                    //要的是管理员
+                    if (org.apache.commons.lang3.StringUtils.isNotBlank(r.getEnname()) && r.getEnname().equals("gly")){
+                        role = r;
+                        break;
+                    }
+                }
+            }
+            //该公司下拥有管理员岗位的所有员工
+            List<User> userList = userDao.findUserByRole(role);
+            //该公司下拥有管理员岗位的所有员工
+            List<String> assigneeList = new ArrayList<String>();
+            if (userList!=null && userList.size()!=0) {
+                for (User user : userList) {
+                    assigneeList.add(user.getId());
+                }
+            }
+
+            String delFlag="0";
+            variables.put("glyList", assigneeList);
+            variables.put("glycount",assigneeList.size());
+            companyinfo.setUserId(UserUtils.getUser().getId());//申请人
+            companyinfo.setCompanyId(companyId);//这一步必须
+            List<Useroffice> companyinfoList = companyinfoService.findListByCompany(companyinfo);
+            boolean state = false;
+            if (companyinfoList!=null){
+                if (companyinfoList.size()==0) {
+                    state = true;
+                }/*else{
+                    for (Useroffice companyinfo1:companyinfoList){
+                        if (companyinfo1.getStatus().equals("4")){
+                            state = true;
+                        }else {
+                            state = false;
+                            break;
+                        }
+                    }
+                }*/
+            }
+            if (state){
+                companyinfo.setStatus("1");
+                companyinfo.setDelFlag(delFlag);
+                companyinfo.setRemarks(reason);
+                companyinfo.setMaster(master);//
+                companyinfoService.save(companyinfo, variables);
+                ajaxJson.setSuccess(true);
+                ajaxJson.setErrorCode(ErrorCode.code_1004);
+                ajaxJson.setMsg("加入公司申请已经提交");
+                ajaxJson.put("id", companyinfo.getId());
+                String title = "团队申请";
+                String content="您有新的团队申请";
+                Map extras = new HashMap();
+                Pushinfo pushinfo = new Pushinfo();
+                pushinfo.setCurrentUser(UserUtils.getUser());
+                Office office = officeService.get(companyId);
+                if (reason.length()>16){
+                    reason = reason.substring(0,16)+"...";
+                }
+                reason = UserUtils.getUser().getName()+ "\n"
+                        +"申请加入:"+office==null || office.getName()==null || office.getName().equals("")?"":office.getName()+ "\n"
+                        +"申请理由:"+reason;
+                pushinfo.setRemarks(reason);
+                pushinfo.setUserId(UserUtils.getUser().getId());
+                pushinfo.setType("2002");
+                pushinfo.setPushId(companyinfo.getId());
+                pushinfo.setTitle(title);
+                pushinfo.setContent(content);
+                pushinfo.setParentType("singleCompanyNews");
+                pushinfo.setCompanyId(companyId);
+                pushinfo.setAddcontent("joincompany");
+                pushinfo.setMobile("ios,android");
+                pushinfo.setStatus("0");
+                extras.put("type", "2002");
+                extras.put("id", companyinfo.getId());
+                extras.put("userId",UserUtils.getUser().getId());
+                extras.put("userName",UserUtils.getUser().getName());
+                //向所有管理员发送推送
+                int num = 0 ;
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                String str = "申请人:"+UserUtils.getUser().getName()+",申请时间:"+sdf.format(new Date());
+                WorkProjectNotify workProjectNotify = UtilNotify
+                        .saveNotify(companyinfo.getId(),
+                                null,
+                                companyId,
+                                title,
+                                str,
+                                "75",
+                                "0",
+                                "待审批",
+                                ""
+                        );
+                if(assigneeList!=null && assigneeList.size()>0){
+                    for(String alias : assigneeList){
+                        if(StringUtils.isNotBlank(alias)){
+                            pushinfo.setPushUserId(alias);
+                            pushinfo.setId("");
+                            pushinfoService.save(pushinfo);
+                            boolean b = JPushClientUtil.sendNotificationToAlias(title, content, extras, alias);
+                            if(b) num++;
+                            workProjectNotify.setUser(new User(alias));
+                            workProjectNotify.setId("");
+                            workProjectNotify.setNotifyRole("公司管理员审批");
+                            workProjectNotifyService
+                                    .save(workProjectNotify);
+                            UserUtils.pushIm(alias,str);
+                        }
+                    }
+                }
+
+                if (num>0){
+                    ajaxJson.setMsg("申请加入公司流程成功!");
+                }else {
+                    ajaxJson.setMsg("申请加入公司流程成功");
+                    ajaxJson.setErrorCode(ErrorCode.code_2006);
+                    ajaxJson.setSuccess(false);
+                }
+            }else{
+                logger.error("申请加入公司流程失败:您已申请加入企业");
+                ajaxJson.setSuccess(false);
+                ajaxJson.setErrorCode(ErrorCode.code_1009);
+                ajaxJson.setMsg("您已申请加入企业,不能重复申请加入");
+                return ajaxJson;
+            }
+
+        } catch (Exception e) {
+            logger.error("申请加入公司流程失败:", e);
+            ajaxJson.setSuccess(false);
+            ajaxJson.setErrorCode(ErrorCode.code_2004);
+            ajaxJson.setMsg("申请加入公司流程失败");
+        }finally {
+            lock.unlock();
+        }
+
+        return ajaxJson;
+    }
+
+    /**
+     * 查看我的企业
+     * @param
+     * @return json数据
+     */
+    @RequestMapping(value = "getMyOfficeList", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getMyOfficeList(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        try{
+            String userId = request.getParameter("userId");
+            if (userId==null){
+                userId = UserUtils.getUser().getId();
+            }
+            Useroffice companyinfo = new Useroffice();
+            companyinfo.setUserId(userId);
+            companyinfo.setDelFlag("0");
+            List<Useroffice> companyinfoList = companyinfoService.findListByCompany(companyinfo);
+            List<Map<String,Object>> mapList = Lists.newArrayList();
+            if (companyinfoList!=null && companyinfoList.size()!=0){
+                for (Useroffice com :companyinfoList){
+                    if (!"3".equals(com.getStatus())){
+                        String companyId =com.getCompanyId();
+                        String status = com.getStatus();
+                        String companyInfoId = com.getId();
+                        Office off = officeService.get(companyId);
+                        Map<String,Object> map = Maps.newHashMap();
+                        map.put("companyName", off.getName());
+                        map.put("companyLogo", off.getLogo() == null ? "" : off.getLogo());
+                        map.put("companyQrcode", off.getCompanyQrcode()==null?"":off.getCompanyQrcode());
+                        map.put("companyId", off.getId());
+                        map.put("status", status);
+                        map.put("approvalId", companyInfoId);
+                        map.put("master", off.getMaster()==null || UserUtils.get(off.getMaster())==null?"":UserUtils.get(off.getMaster()).getName());
+                        map.put("masterId", off.getMaster()==null ?"":off.getMaster());
+                        Useroffice useroffice = new Useroffice();
+                        useroffice.setCompanyId(off.getId());
+                        useroffice.setStatus("3");
+                        List<Useroffice> userofficeList=userofficeService.findList(useroffice);
+                        map.put("count", userofficeList.size());
+                        List<Act> list2 = actTaskService.toMyStartedList(com.getProcessInstanceId());
+                        if (list2!=null && list2.size()!=0){
+                            Act act1 = list2.get(list2.size()-1);
+                            map.put("taskId", act1.getTaskId());
+                            map.put("taskName",act1.getTaskName());
+                            map.put("procInsId", act1.getProcInsId());
+                            map.put("procDefId", act1.getProcDefId());
+                            map.put("actStatus", act1.getStatus());
+                            map.put("taskDefKey", act1.getTaskDefKey());
+                            map.put("procDefKey", "joincompany");
+                        }
+                        map.put("isgly", 0);
+                        Role role2=new Role();
+                        role2.setCompany(off);
+                        role2.setUser(UserUtils.get(userId));
+                        List<Role> roleList2=roleDao.findList(role2);
+                        for(Role role : roleList2){
+                            map.put("officeId", role.getOffice().getId());
+                            map.put("officeName", role.getOffice().getName());
+                            if(org.apache.commons.lang3.StringUtils.isNotBlank(role.getEnname()) && role.getEnname().endsWith("gly")||role.getEnname().equals("system")){
+                                map.put("isgly", 1);
+                            }
+                            if(org.apache.commons.lang3.StringUtils.isNotBlank(role.getEnname()) && role.getEnname().endsWith("gly")||role.getEnname().equals("system")){
+                                List<User> userList2=userDao.findUserByRole(role);
+                                for (int k = 0; k < userList2.size(); k++) {
+                                    if(userList2.get(k)!=null ||userList2.get(k).equals("null")){
+                                        map.put("glyName", userList2.get(k).getName());
+                                    }
+                                }
+                            }else{
+                                map.put("glyName", "");
+                            }
+                        }
+                        mapList.add(map);
+                    }
+
+                }
+            }
+            j.put("maxNum",mapList.size());
+            j.put("data",mapList);
+            j.setMsg("获取列表成功");
+            j.setErrorCode(ErrorCode.code_1004);
+        }catch (Exception e){
+            logger.info("e="+e.getMessage());
+            j.setErrorCode(ErrorCode.code_2004);
+            j.setMsg("获取列表失败");
+            j.put("maxNum",0);
+            j.put("data","");
+        }
+        return j;
+    }
+
+	/**
+	 * 申请加入企业
+	 */
+	/*@ResponseBody
+	@RequestMapping(value = "joinCompany", method=RequestMethod.GET)
+	public AjaxJson joinCompany (String id,String companyId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) throws UnsupportedEncodingException
+	{  
+		AjaxJson j=new AjaxJson();	
+		Office company = officeService.get(companyId);//获取公司
+		Role comRole = systemService.getRoleByEnname(StringUtils.getPinYinHeadChar(company.getName(),2)+"xyg");//获取公司xyg的岗位
+		if(UserUtils.get(id).getId()!=null){
+			List<Office> companyList = UserUtils.getAllCompany(UserUtils.get(id));//获取用户所有企业
+			for (Office office : companyList) {
+				if(comRole.getCompany().getId().equals(office.getId())){
+					j.setMsg( "申请失败,你已是该企业成员");
+				}
+			}
+		}
+		List<Office> list = officeService.findList(true);//获取当前用户有权限访问的部门
+
+        EasemobInfo easemobImuser = new EasemobInfo();
+        for (int i=0; i<list.size(); i++){
+			Office e = list.get(i);
+			if (e.getName().equals(company.getName()+"人力部")){
+				UserUtils.getUser().setOffice(e);
+                easemobImuser.setUserId(UserUtils.getUser().getId());
+                easemobImuser.setGroupId(e.getGroupId());
+                easemobImuser.setJoinStatus("2");
+                easemobImuser.setGroupName(e.getGroupName());
+			}
+			if (e.getName().equals(company.getName())){
+				UserUtils.getUser().setCompany(e);
+                easemobImuser.setUserId(id);
+                easemobImuser.setGroupId(e.getGroupId());
+                easemobImuser.setJoinStatus("2");
+                easemobImuser.setGroupName(e.getGroupName());
+			}
+
+		}
+
+        easemobInfoService.save(easemobImuser);
+
+        if(comRole!=null){
+            UserUtils.getUser().setComId(comRole.getCompany().getId());
+            systemService.assignUserToRole(comRole, UserUtils.getUser());
+        }
+		systemService.outUserInRole(new Role("1"), UserUtils.getUser());
+		j.setMsg("您的申请已提交,请在“我的管理企业”中查看结果");
+		return j;				
+	}*/
+	/**
+	 * 申请内容详情
+	 */
+	@ResponseBody
+    @RequestMapping(value = "applicationContent",method=RequestMethod.POST)
+	    public AjaxJson applicationContent(String id,HttpServletRequest request, HttpServletResponse response) {
+		 String contentStr="";
+	      try {         
+	    	  InputStream  is = request.getInputStream();         
+	         contentStr= IOUtils.toString(is, "utf-8");     
+	          } catch (Exception e) {
+	                   e.printStackTrace();     
+	              }
+	      AjaxJson j=new AjaxJson();
+	      Map<String,String> requestMap= StringUtils.StringToJson(contentStr);
+	      String remarks =requestMap.get("remarks");	
+	      User user=new User();
+	      user.setId(id);
+	      Company company=new Company();
+	      company.setCreateBy(user);
+	      company.setRemarks(remarks);		
+	      company.preInsert();
+	      companyDao.insert(company);	      	      	      			
+	      j.setMsg("您的申请已提交,请在“我的管理企业”中查看结果");
+	      j.setErrorCode(ErrorCode.code_1004);
+	      return j; 
+	}
+
+
+	/**
+	 * 重新申请内容详情
+	 */
+	@ResponseBody
+	@RequestMapping(value = "againApplicationContent",method=RequestMethod.POST)
+	public AjaxJson againApplicationContent(String id,HttpServletRequest request, HttpServletResponse response) {
+		String contentStr="";
+		try {
+			InputStream  is = request.getInputStream();
+			contentStr= IOUtils.toString(is, "utf-8");
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		AjaxJson j=new AjaxJson();
+		Map<String,String> requestMap= StringUtils.StringToJson(contentStr);
+		String remarks =requestMap.get("remarks");
+		User user=new User();
+		user.setId(id);
+		Company company=new Company();
+		company.setCreateBy(user);
+		company.setRemarks(remarks);
+		company.preInsert();
+		companyDao.insert(company);
+		j.setMsg("您的申请已提交,请在“我的管理企业”中查看结果");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+    /**
+     * 重新申请加入企业
+     *//*
+    @ResponseBody
+    @RequestMapping(value = "getUserInfoAgainJoinCompanyList", method=RequestMethod.GET)
+    public AjaxJson againJoinCompany (String id,String companyId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) throws UnsupportedEncodingException
+    {
+        AjaxJson j=new AjaxJson();
+        Office company = officeService.get(companyId);
+        Role comRole = systemService.getRoleByEnname(StringUtils.getPinYinHeadChar(company.getName(),2)+"xyg");
+        if(UserUtils.get(id).getId()!=null){
+            List<Office> companyList = UserUtils.getAllCompany(UserUtils.get(id));
+            if(companyList!=null && companyList.size()!=0) {
+                for (Office office : companyList) {
+                    if (comRole!=null && comRole.getCompany().getId().equals(office.getId())) {
+                        j.setMsg("申请失败,你已是该企业成员");
+                    }
+                }
+            }
+        }
+        List<Office> list = officeService.findList(true);
+
+        EasemobInfo easemobImuser = new EasemobInfo();
+        for (int i=0; i<list.size(); i++){
+            Office e = list.get(i);
+            if (e.getName().equals(company.getName()+"人力部")){
+                UserUtils.getUser().setOffice(e);
+                easemobImuser.setUserId(id);
+                easemobImuser.setGroupId(e.getGroupId());
+                easemobImuser.setJoinStatus("2");
+                easemobImuser.setGroupName(e.getGroupName());
+            }
+            if (e.getName().equals(company.getName())){
+                UserUtils.getUser().setCompany(e);
+                easemobImuser.setUserId(id);
+                easemobImuser.setGroupId(e.getGroupId());
+                easemobImuser.setJoinStatus("2");
+                easemobImuser.setGroupName(e.getGroupName());
+            }
+
+        }
+
+        easemobInfoService.save(easemobImuser);
+        systemService.assignUserToRole(comRole, UserUtils.getUser());
+        systemService.outUserInRole(new Role("1"), UserUtils.getUser());
+        j.setMsg("您的申请已提交,请在“我的管理企业”中查看结果");
+        return j;
+    }*/
+
+    /**
+     * 根据推送的id拿到申请加入企业的详情,然后进行审批
+     */
+    @RequestMapping(value = "getJoinCompanyInfo",method = RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getJoinCompanyInfo(HttpServletRequest request){
+        AjaxJson ajaxJson = new AjaxJson();
+        try {
+
+            Map<String,String> requestMap = findRequestMap(request);
+            String companyinfoId = requestMap.get("companyinfoId");
+            Useroffice companyinfo  = companyinfoService.get(companyinfoId);
+            LinkedHashMap<String,Object> returnMap = new LinkedHashMap<>();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            if(companyinfo==null || StringUtils.isBlank(companyinfo.getId())){
+                ajaxJson.setSuccess(false);
+                ajaxJson.setMsg("无指定的审批消息或当前审批消息已过时,请刷新后重试!");
+                ajaxJson.setErrorCode(ErrorCode.code_2004);
+                return ajaxJson ;
+            }else{
+                String currentComId = UserUtils.getSelectCompany().getId();
+                String comId = StringUtils.isBlank(companyinfo.getCompanyId())?"":companyinfo.getCompanyId();
+
+                //如果是申请人只查看,不做审批
+                if(StringUtils.isNotBlank(companyinfo.getUserId()) && companyinfo.getUserId().equals(UserUtils.getUser().getId())){
+                    ajaxJson.setSuccess(true);
+                    ajaxJson.setErrorCode(ErrorCode.code_1004);
+                    ajaxJson.setMsg("获取申请详情成功");
+                    returnMap.put("userName",(UserUtils.getByUserId(companyinfo.getUserId())!=null)?UserUtils.getByUserId(companyinfo.getUserId()).getName():"");
+                    returnMap.put("companyName",(officeService.get(companyinfo.getCompanyId())!=null)?officeService.get(companyinfo.getCompanyId()).getName():"");
+                    returnMap.put("remarks",companyinfo.getRemarks());
+                    returnMap.put("officeName",(officeService.get(companyinfo.getOfficeId())!=null)?officeService.get(companyinfo.getOfficeId()).getName():"");
+                    returnMap.put("status",companyinfo.getStatus());
+                    ajaxJson.setBody(returnMap);
+                    return ajaxJson;
+                }
+            }
+
+            if(companyinfo!=null){
+                returnMap.put("companyinfoId",companyinfo.getId());
+                returnMap.put("userId",companyinfo.getUserId());
+                User user = UserUtils.get(companyinfo.getUserId());
+                returnMap.put("userName",user!=null?user.getName():"");
+                String companyId = companyinfo.getCompanyId();
+                //该公司下所有的岗位
+                List<Role> roleList = systemService.getRoleList("",companyId);
+                Role role = new Role();
+                if (roleList!=null && roleList.size()!=0){
+                    for (Role r :roleList){
+                        //要的是管理员而
+                        if (org.apache.commons.lang3.StringUtils.isNotBlank(r.getEnname()) && r.getEnname().endsWith("gly")){
+                            role = r;
+                            break;
+                        }
+                    }
+                }
+                //该公司下拥有管理员岗位的所有员工
+                List<User> userList = userDao.findUserByRole(role);
+                //该公司下拥有管理员岗位的所有员工
+                StringBuilder builder = new StringBuilder();
+                if (userList!=null && userList.size()!=0) {
+                    for (User u : userList) {
+                       if(StringUtils.isNotBlank(u.getId())){
+                           builder.append(",").append(u.getId());
+                       }
+                    }
+                }
+                String masterIds = "";
+                if(builder.length()>2){
+                    masterIds = builder.substring(1).toString();
+                }
+                returnMap.put("masterIds",masterIds);
+                returnMap.put("masterName",UserUtils.get(UserUtils.getUser().getId()).getName());
+                returnMap.put("companyId",companyId);
+                returnMap.put("companyName",UserUtils.getSelectCompany().getName());
+                returnMap.put("remarks",companyinfo.getRemarks());
+                returnMap.put("status",companyinfo.getStatus());
+                returnMap.put("createBy",companyinfo.getCreateBy()!=null?companyinfo.getCreateBy().getId():"");
+                returnMap.put("createDate",companyinfo.getCreateDate()!=null?sdf.format(companyinfo.getCreateDate()):"");
+                returnMap.put("updateBy",companyinfo.getUpdateBy()!=null?companyinfo.getUpdateBy().getId():"");
+                returnMap.put("updateDate",companyinfo.getUpdateDate()!=null?sdf.format(companyinfo.getUpdateDate()):"");
+                Pushinfo pushinfo = new Pushinfo();
+                pushinfo.setPushId(companyinfoId);
+                List<Pushinfo> pushinfos = pushinfoService.getByPushId(pushinfo);
+                if (pushinfos!=null && pushinfos.size()!=0) {
+                    Pushinfo push = pushinfos.get(0);
+                    if (StringUtils.isNotBlank(push.getStatus())&& push.getStatus().equals("1")){
+                        returnMap.put("selectStatus", "1");
+                        returnMap.put("officeName", companyinfo.getCreateBy().getOffice().getName());
+                        returnMap.put("comment", companyinfo.getRemarks());
+                        returnMap.put("actStuatus", companyinfo.getStatus());
+                    }else {
+                        returnMap.put("selectStatus", "0");
+                    }
+                }else {
+                    logger.error("获取申请详情失败");
+                    ajaxJson.setSuccess(false);
+                    ajaxJson.setErrorCode(ErrorCode.code_2004);
+                    ajaxJson.setMsg("获取申请详情失败,当前申请不存在");
+                }
+            }
+            ajaxJson.setSuccess(true);
+            ajaxJson.setErrorCode(ErrorCode.code_1004);
+            ajaxJson.setMsg("获取申请详情成功");
+            ajaxJson.setBody(returnMap);
+            return ajaxJson;
+        }catch (Exception e) {
+            e.printStackTrace();
+            logger.error("获取申请详情失败",e);
+            ajaxJson.setSuccess(false);
+            ajaxJson.setErrorCode(ErrorCode.code_2004);
+            ajaxJson.setMsg("获取申请详情失败");
+        }
+
+        return ajaxJson;
+    }
+
+    /**
+     * 根据Useroffice的id,查询出待办任务
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "getJoinCompanyAct",method = RequestMethod.GET)
+    public AjaxJson getJoinCompanyAct(Act act , HttpServletRequest request){
+        AjaxJson ajaxJson = new AjaxJson();
+        Map<String,String> requestMap = findRequestMap(request);
+        String companyinfoId = requestMap.get("companyinfoId");
+        if(StringUtils.isBlank(companyinfoId)){
+            logger.error("获取审核流程信息失败");
+            ajaxJson.setSuccess(false);
+            ajaxJson.setErrorCode(ErrorCode.code_2004);
+            ajaxJson.setMsg("获取审批流程信息失败");
+        }
+        try {
+            Useroffice companyinfo = companyinfoService.get(companyinfoId);
+            act.setProcDefKey("joincompany");
+
+            List<Act>  actList = actTaskService.todoList(act);
+            if(actList!=null && actList.size()>0){
+                for(Act a : actList){
+                    if(a!=null && a.getProcInsId().equals(companyinfo.getProcessInstanceId())){
+                        companyinfo.setAct(a);
+                        break;
+                    }
+                }
+            }
+
+            LinkedHashMap<String,Object> map = new LinkedHashMap<>();
+
+            act = companyinfo.getAct();
+            String taskDefKey = act.getTaskDefKey();
+            if("apply_end".equals(taskDefKey)) {
+
+                List<Map<String,String>> allDeptsList = new ArrayList<>();
+                Office office = officeService.get(companyinfo.getCompanyId());
+                List<Office> allDepts = officeService.getAllDepts(office.getId());
+                if(allDepts!=null && allDepts.size()>0){
+                    for(Office o : allDepts){
+                        Map<String,String> officeMap = new HashMap<>();
+                        officeMap.put("officeId",o.getId());
+                        officeMap.put("officeName",o.getName());
+                        allDeptsList.add(officeMap);
+                    }
+                }
+                User master = UserUtils.getUser();//审批人
+                companyinfo.setAct(act);
+                companyinfo.setMaster(master.getId());
+                String companyId = UserUtils.getSelectCompany().getId();
+                Role roles = new Role();
+                roles.setCompany(new Office(companyId));
+                List<Map<String,String>> allRolesList = new ArrayList<>();
+                List<Role> allRoles = UserUtils.getRoleListByCompany(roles);
+                if(allRoles!=null && allRoles.size()>0){
+                    for(Role r : allRoles){
+                        Map<String,String> roleMap = new HashMap<>();
+                        roleMap.put("roleId",r.getId());
+                        roleMap.put("roleName",r.getName());
+                        allRolesList.add(roleMap);
+                    }
+                }
+                companyinfoService.save(companyinfo);//更新操作
+                map.put("companyinfoId",companyinfoId);
+                map.put("masterId",master.getId());//审批人
+                map.put("masterName",master.getName());
+                map.put("companyId", office.getId());//公司
+                map.put("companyName", office.getName());
+                map.put("allDeptsList",allDeptsList);
+                map.put("allRolesList", allRolesList);
+                ajaxJson.setBody(map);
+                ajaxJson.setMsg("获取审批流程信息成功");
+                ajaxJson.setErrorCode(ErrorCode.code_1004);
+                ajaxJson.setSuccess(true);
+            }else{
+                ajaxJson.setMsg("没有待审批任务");
+                ajaxJson.setErrorCode(ErrorCode.code_1004);
+                ajaxJson.setSuccess(false);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.error("获取审批流程信息失败",e);
+            ajaxJson.setSuccess(false);
+            ajaxJson.setErrorCode(ErrorCode.code_2004);
+            ajaxJson.setMsg("获取审批流程信息失败");
+        }
+        return ajaxJson;
+    }
+
+    /**
+     *  保存审核信息
+     */
+    @Transactional
+    @RequestMapping("saveJoinCompanyAct")
+    @ResponseBody
+    public AjaxJson saveJoinCompanyAct(Act act,HttpServletRequest request){
+        AjaxJson ajaxJson = new AjaxJson();
+        Map<String,String> requestMap = findRequestMap(request);
+        LinkedHashMap<String,Object> map = new LinkedHashMap<>();
+        LinkedHashMap returnMap = new LinkedHashMap();
+        try {
+            lock.lock();
+            String companyinfoId = requestMap.get("companyinfoId");
+
+            String roleId = requestMap.get("roleId");
+            String flag = requestMap.get("flag");//['同意','拒绝']
+            String comment = requestMap.get("comment");
+            Useroffice useroffice = companyinfoService.get(companyinfoId);
+            act.setProcDefKey("joincompany");
+            List<Act>  actList = actTaskService.todoList(act);
+            if(actList!=null && actList.size()>0){
+                for(Act a : actList){
+                    if(a!=null && a.getProcInsId().equals(useroffice.getProcessInstanceId())){
+                        a.setFlag(flag);
+                        a.setComment(comment);
+                        useroffice.setAct(a);
+                        break;
+                    }
+                }
+            }
+            User master = UserUtils.getUser();
+            returnMap.put("flag",flag);
+            returnMap.put("joinUserId",useroffice.getUserId());
+            returnMap.put("joinUserName",UserUtils.get(useroffice.getUserId()).getName());
+            returnMap.put("masterId",master.getId());//审批人
+            returnMap.put("masterName",master.getName());
+            returnMap.put("comment",comment);
+            returnMap.put("status","0");
+            if(!"yes".equals(flag)){
+                companyinfoService.auditSave(useroffice);
+                ajaxJson.setBody(returnMap);
+                ajaxJson.setErrorCode("0000");
+                ajaxJson.setMsg("审批拒绝");
+                ajaxJson.setSuccess(false);
+            }else {
+                String companyId = useroffice.getCompanyId();
+                List<Company> companyList = companyService.getByCompany(companyId);
+                Company company = new Company();
+                if (companyList != null && companyList.size() != 0) {
+                    company = companyList.get(0);
+                }
+                returnMap.put("companyId",company.getId());
+                returnMap.put("companyName",company.getName());
+                Role comRole = new Role();
+                List<Role> roleList = systemService.getRoleList("",companyId);
+                if (StringUtils.isNotBlank(roleId) && roleList!=null && roleList.size()!=0){
+                    comRole = systemService.getRole(roleId);
+                    if(!roleList.contains(comRole)){
+                        comRole = systemService.getRoleByEnname( companyId,comRole.getOffice(),"yg");
+                    }
+                }else {
+                    comRole = systemService.getRoleByEnname( companyId, null,"yg");
+                }
+
+                useroffice.setRoleList(roleList);
+                Office office = officeService.get(comRole.getOffice());
+                returnMap.put("roleId",comRole.getId());
+                returnMap.put("roleName",comRole.getName());
+                returnMap.put("officeId",office.getId());
+                returnMap.put("officeName",office.getName());
+                String[] extra = new String[4];
+                extra[0] = useroffice.getUserId();
+                extra[1] = companyId;
+                extra[2] = comRole.getId();//不能直接用roleId
+                extra[3] = office.getId();//不能直接用roleId
+                companyinfoService.auditSave(useroffice,extra);
+                ajaxJson.setBody(returnMap);
+                ajaxJson.setErrorCode(ErrorCode.code_1004);
+                ajaxJson.setMsg("审批通过");
+                ajaxJson.setSuccess(true);
+            }
+
+        }catch (Exception e){
+            logger.error("审批失败",e);
+            ajaxJson.setSuccess(false);
+            ajaxJson.setErrorCode(ErrorCode.code_2004);
+            ajaxJson.setMsg("审批失败");
+            ajaxJson.setBody(map);
+        }finally {
+            lock.unlock();
+        }
+        return ajaxJson;
+    }
+}

+ 564 - 0
src/main/java/com/jeeplus/modules/API/userinfo/ManageCompanyController.java

@@ -0,0 +1,564 @@
+package com.jeeplus.modules.API.userinfo;
+
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.FileUtils;
+import com.jeeplus.common.utils.JPushClientUtil;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.iim.entity.LayGroup;
+import com.jeeplus.modules.iim.service.LayGroupService;
+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.RoleDao;
+import com.jeeplus.modules.sys.dao.UserDao;
+import com.jeeplus.modules.sys.entity.Company;
+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.service.CompanyService;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.service.SystemService;
+import com.jeeplus.modules.sys.service.UserService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.sysuseroffice.entity.Useroffice;
+import com.jeeplus.modules.sysuseroffice.service.UserofficeService;
+import com.jeeplus.modules.tools.utils.TwoDimensionCode;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workcompanyinfo.service.CompanyinfoService;
+import com.jeeplus.modules.workstaff.entity.WorkStaffBasicInfo;
+import com.jeeplus.modules.workstaff.service.WorkStaffBasicInfoService;
+import io.swagger.client.model.Group;
+import net.sf.json.JSONObject;
+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.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.*;
+
+
+/**
+ * 管理企业Controller
+ * @author zmy
+ * @version 2017-04-17
+ */
+@Controller
+@RequestMapping(value = "${frontPath}/userInfo/managecompany")
+public class ManageCompanyController extends BaseController{
+	@Autowired
+	private OfficeDao officeDao;
+	@Autowired
+	private CompanyService companyService;
+	@Autowired
+	private OfficeService officeService;
+	@Autowired
+	private UserDao userDao;
+	@Autowired
+	private RoleDao roleDao;
+	@Autowired
+	private UserofficeService userofficeService;
+	@Autowired
+	private SystemService systemService;
+    @Autowired
+    private CompanyinfoService companyinfoService;
+    @Autowired
+    private PushinfoService pushinfoService;
+    @Autowired
+    private LayGroupService layGroupService;
+    @Autowired
+    private WorkStaffBasicInfoService workStaffBasicInfoService;
+    @Autowired
+    private UserService userService;
+
+    /**
+     * 已加入企业
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveGroupId", method=RequestMethod.GET)
+    public AjaxJson saveGroupId (String companyId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) throws Exception{
+        AjaxJson j = new AjaxJson();
+        Office company = officeService.get(companyId);
+
+       /* Group group = new Group();
+        group.groupname(company.getName()+"官方群").desc(company.getName()+"官方群")._public(true).maxusers(1000).approval(true).owner(company.getMaster());
+        Object obj = easemobChatGroup.createChatGroup(group);
+        JSONObject json = JSONObject.fromObject(obj);
+
+        String groupid = null;
+        if(json!=null && !json.get("data").toString().equals("")){
+            JSONObject data = JSONObject.fromObject(json.get("data").toString());
+            if(data!=null && !data.get("groupid").toString().equals(""))
+                groupid = data.get("groupid").toString();
+        }*/
+        /*
+        EasemobInfo easemobImuser = new EasemobInfo();
+        easemobImuser.setUserId(company.getMaster());
+        easemobImuser.setGroupId(groupid);
+        easemobImuser.setJoinStatus("1");
+        easemobImuser.setGroupName(company.getName()+"官方群");
+        easemobInfoService.save(easemobImuser);*/
+        //生成公司二维码,使用公司名
+        String realPath = Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL
+                + company.getId() + "/qrcode/";
+        FileUtils.createDirectory(realPath);
+        String name= company.getId()+".png"; //encoderImgId此处二维码的图片名
+        String filePath = realPath + name;  //存放路径
+        String content = company.getId()+","+company.getName()+","+company.getMaster()+","+UserUtils.get(company.getMaster()).getName();
+        logger.info("encoderQRCode.content="+content);
+        TwoDimensionCode.encoderQRCode(content, filePath, "png");//执行生成二维码
+        OSSClientUtil ossUtil =new OSSClientUtil();
+        company.setCompanyQrcode(request.getContextPath() + Global.USERFILES_BASE_URL
+                + company.getId() + "/qrcode/" + name);
+        company.setCompanyQrcode(request.getContextPath() + Global.USERFILES_BASE_URL
+                + company.getId() + "/qrcode/" + name);
+        /*company.setGroupId(groupid);
+        company.setGroupName(company.getName() + "官方群");*/
+        if (company.getCompanyQrcode()!=null && !company.getCompanyQrcode().equals("")){
+            InputStream inputStream = null;
+            HttpURLConnection httpURLConnection;
+            try {
+                URL url = new URL(request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+ company.getCompanyQrcode());
+                httpURLConnection = (HttpURLConnection) url.openConnection();
+                // 设置网络连接超时时间
+                httpURLConnection.setConnectTimeout(3000);
+                // 设置应用程序要从网络连接读取数据
+                httpURLConnection.setDoInput(true);
+
+                httpURLConnection.setRequestMethod("GET");
+                int responseCode = httpURLConnection.getResponseCode();
+                if (responseCode == 200) {
+                    // 从服务器返回一个输入流
+                    inputStream = httpURLConnection.getInputStream();
+
+                }
+                String[] arr = company.getCompanyQrcode().split("/");
+                String qrcodeName = System.currentTimeMillis()+arr[arr.length-1];
+                ossUtil.uploadFile2OSS(inputStream, Global.getRqcode(), qrcodeName);
+                company.setCompanyQrcode(Global.getAliyunUrl() + "/" + Global.getRqcode() + qrcodeName);
+                logger.info("-------companyId  " + companyId);
+                logger.info("-------qrcode  "+company.getCompanyQrcode());
+            } catch (MalformedURLException e) {
+                e.printStackTrace();
+            } catch (IOException e) {
+                e.printStackTrace();
+            } finally {
+                inputStream.close();
+            }
+        }
+        return j;
+    }
+	/**
+	 * 已加入企业
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getUserInfoJoinCompanyList", method=RequestMethod.GET)
+	public AjaxJson findJoinCompany (String id,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes)
+	{
+		AjaxJson j=new AjaxJson();
+        User user =UserUtils.get(id);
+
+        String isManager = "1";
+        boolean b = UserUtils.isManager();
+        if (!b){
+            isManager = "0";
+        }
+		List<Office> companyList = UserUtils.getAllCompany(user);
+		HashSet<Office> hs = new HashSet<Office>(companyList);
+		List<Map<String,Object>> mapList = Lists.newArrayList();
+        Map maps = new HashMap();
+        maps.put("isManager",isManager);
+        if (hs!=null &&hs.size()!=0) {
+            for (Office off : hs) {
+                if (!off.getId().equals("1")) {
+                    Map<String, Object> map = Maps.newHashMap();
+                    map.put("companyName", off.getName());
+                    map.put("companyLogo", off.getLogo() == null ? "" : off.getLogo());
+                    map.put("companyQrcode", off.getCompanyQrcode() == null ? "" : off.getCompanyQrcode());
+                    map.put("companyId", off.getId());
+                    map.put("master", off.getMaster() == null || UserUtils.get(off.getMaster()) == null ? "" : UserUtils.get(off.getMaster()).getName());
+                    map.put("masterId", off.getMaster() == null ? "" : off.getMaster());
+                    Useroffice useroffice = new Useroffice();
+                    useroffice.setCompanyId(off.getId());
+                    useroffice.setStatus("3");
+                    List<Useroffice> userofficeList = userofficeService.findList(useroffice);
+                    map.put("count", userofficeList.size());
+                    map.put("isgly", 0);
+                    map.put("glyName", "");
+                    for (Useroffice useroffice1:userofficeList){
+                        if (useroffice1.getUserId().equals(user.getId())){
+                            map.put("officeId", useroffice1.getOfficeId());
+                            if (StringUtils.isNotBlank(useroffice1.getOfficeId())){
+                                map.put("officeName", officeService.get(useroffice1.getOfficeId()).getName());
+                            }else {
+                                map.put("officeName","");
+                            }
+                        }
+                    }
+
+                    Role role2 = new Role();
+                    role2.setCompany(off);
+                    role2.setUser(user);
+                    List<Role> roleList2 = roleDao.findList(role2);
+                    for (Role role : roleList2) {
+                       /* map.put("officeId", role.getOffice().getId());
+                        map.put("officeName", role.getOffice().getName());*/
+                        if (org.apache.commons.lang3.StringUtils.isNotBlank(role.getEnname()) && role.getEnname().endsWith("gly") || role.getEnname().equals("system")) {
+                            map.put("isgly", 1);
+                            List<User> userList2 = userDao.findUserByRole(role);
+                            for (int k = 0; k < userList2.size(); k++) {
+                                if (userList2.get(k) != null || userList2.get(k).equals("null")) {
+                                    map.put("glyName", userList2.get(k).getName());
+                                }
+                            }
+                            break;
+                        }
+                    }
+                    mapList.add(map);
+                }
+            }
+        }
+        maps.put("list",mapList);
+		j.put("data",maps);
+		j.setErrorCode(ErrorCode.code_1004);
+		j.setMsg("获取已加入企业列表成功");
+		return j;
+	}
+	/**
+	 * 企业申请记录
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getUserInfoManageCompanyList", method=RequestMethod.GET)
+	public AjaxJson findManageCompany (String id,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes)
+	{  
+		AjaxJson j=new AjaxJson();
+		Company company=new Company();
+
+		User user = UserUtils.get(id);		
+		company.setTuser(user);	
+		List<Company> companyList = companyService.findList(company);
+		List<Map<String,Object>> mapList = Lists.newArrayList();
+		for(int i = 0; i < companyList.size(); i++){
+			Map<String,Object> map = Maps.newHashMap();
+			Company com1=companyList.get(i);	
+			map.put("companyName", com1.getName());
+            map.put("useable", com1.getUSEABLE());
+			map.put("companyId", com1.getId());
+            String logo = com1.getLogo() == null ? "" :  com1.getLogo();
+            map.put("companyLogo", logo);
+            Office off=new Office();
+            off.setId(com1.getCompanyId());
+            //map.put("companyQrcode", off.getCompanyQrcode()==null?"":off.getCompanyQrcode());
+			User user2=new User();
+			user2.setCompany(off);
+			List<User> userList=userDao.findList(user2); 
+			map.put("count", userList.size());	
+			
+			Role role3 = new Role();
+			role3.setCompany(off);	
+			List<Role> roleList3=roleDao.findList(role3);
+			for(Role role : roleList3){	
+				if(org.apache.commons.lang3.StringUtils.isNotBlank(role.getEnname()) && role.getEnname().endsWith("gly")||role.getEnname().equals("system")){
+					List<User> userList3=userDao.findUserByRole(role);
+					for (int k = 0; k < userList3.size(); k++) {
+						if(userList3.get(k)!=null ||userList3.get(k).equals("null")){
+							map.put("glyName", userList3.get(k).getName());	
+						}
+					}
+				}else{
+					map.put("glyName", "");	
+				}
+			}
+			mapList.add(map);
+		}
+		j.put("data",mapList);
+        j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+	
+	/**
+	 * 提醒一下
+	 */
+	@Transactional
+	@ResponseBody
+	@RequestMapping(value = "remindApprover", method=RequestMethod.GET)
+	public AjaxJson remindApprover (String companyId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes)
+	{ 
+		AjaxJson j=new AjaxJson();
+        try {
+            Useroffice companyinfo = new Useroffice();
+            companyinfo.setCompanyId(companyId);
+            companyinfo.setUserId(UserUtils.getUser().getId());
+            Calendar c = Calendar.getInstance();
+            c.setTime(new Date());
+            c.add(Calendar.DATE, - 3);
+            Date now = c.getTime();
+            List<Useroffice> companyinfoList = companyinfoService.findListByCompany(companyinfo);
+            if (companyinfoList!=null && companyinfoList.size()!=0){
+                Useroffice com = companyinfoList.get(0);
+                if (com.getStatus().equals("1") || com.getStatus().equals("2")){
+                    com.setStatus("6");
+                    companyinfoService.update(com);
+                }else if (com.getStatus().equals("6")){
+                    Date updatedate = com.getUpdateDate();
+                    if (now.getTime()<updatedate.getTime()){
+                        j.setMsg("提醒失败,提醒间隔为三天");
+                        j.setErrorCode(ErrorCode.code_2003);
+                        return j;
+                    }
+                }
+                Map extras = new HashMap();
+                String title="团队申请";
+                Office office = officeService.get(companyId);
+                String content=UserUtils.getUser().getName()+"提醒你审批他加入"+office.getName();
+                extras.put("type", "2002");
+                //该公司下所有的岗位
+                List<Role> roleList = systemService.getRoleList("",companyId);
+                Role role = new Role();
+                if (roleList!=null && roleList.size()!=0){
+                    for (Role r :roleList){
+                        //要的是管理员
+                        if (org.apache.commons.lang3.StringUtils.isNotBlank(r.getEnname()) && r.getEnname().equals("gly")){
+                            role = r;
+                            break;
+                        }
+                    }
+                }
+                //该公司下拥有管理员岗位的所有员工
+                List<User> userList = userDao.findUserByRole(role);
+                //该公司下拥有管理员岗位的所有员工
+                String assignees = "";
+                if (userList!=null && userList.size()!=0) {
+                    for (User user : userList) {
+                        assignees += user.getId()+",";
+                    }
+                }
+                String aliase = assignees==null?"":assignees.substring(0,assignees.length()-1);
+                boolean b = JPushClientUtil.sendNotificationToAlias(title, content, extras, aliase);
+                if (b){
+                    j.setMsg("提醒成功");
+                    j.setErrorCode(ErrorCode.code_1004);
+                }else {
+                    j.setMsg("推送失败失败");
+                    j.setErrorCode(ErrorCode.code_2006);
+                    j.setSuccess(false);
+                }
+            }
+        }catch (Exception e){
+            j.setMsg("提醒失败");
+            j.setErrorCode(ErrorCode.code_2004);
+            j.setSuccess(false);
+        }
+		return j;
+	}
+
+	/**
+	 * 重新申请企业审核信息
+	 */
+	@ResponseBody
+	@RequestMapping(value = "aginJoinCompany", method=RequestMethod.GET)
+	public AjaxJson aginJoinCompany(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) throws Exception{
+		AjaxJson j = new AjaxJson();
+        HashMap<String, String> requestMap = findRequestMap(request);
+
+       /* String taskId = requestMap.get("taskId");
+        String taskName = requestMap.get("taskName");
+        String taskDefKey = requestMap.get("taskDefKey");
+        String procInsId = requestMap.get("procInsId");
+        String procDefId = requestMap.get("procDefId");
+        String flag = requestMap.get("flag");
+        String comment = requestMap.get("comment");
+        String companyInfoId = requestMap.get("companyInfoId");
+        Act act = new Act();
+        act.setTaskId(taskId);
+        act.setTaskName(taskName);
+        act.setTaskDefKey(taskDefKey);
+        act.setProcInsId(procInsId);
+        act.setProcDefId(procDefId);
+        act.setFlag(flag);
+        act.setComment(comment);
+        j.setMsg("流程审核成功");
+        j.setSuccess(true);
+        j.setErrorCode(ErrorCode.code_1004);
+        Useroffice companyinfo= companyinfoService.get(companyInfoId);
+        if (flag.equals("yes")){
+            companyinfo.setStatus("1");
+        }else {
+            companyinfo.setStatus("4");
+        }
+        companyinfo.setAct(act);
+        companyinfoService.auditSave(companyinfo);*/
+		/*List<Company> companyList = companyService.getByCompany(companyId);
+		if(companyList!=null && companyList.size()!=0){
+            Company company = companyList.get(0);
+            String id = company.getId();
+            company.setUSEABLE("0");
+            company.setUpdateBy(UserUtils.getUser());
+            company.setUpdateDate(new Date());
+            company.setId("");
+            companyService.save(company);//保存
+            Company company1 = companyService.get(id);
+            companyDao.deleteByLogic(company1);
+			j.setMsg("重新申请企业审核成功");
+		}else {
+			j.setMsg("申请公司不存在");
+		}*/
+        j.setMsg("接口已作废!");
+		return j;
+	}
+
+	/**
+	 * 企业信息详情
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getUserInfoCompanyInfoMap", method=RequestMethod.GET)
+	public AjaxJson findCompanyInfo (String companyId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes)
+	{  
+		AjaxJson j=new AjaxJson();
+		Office com= officeDao.get(companyId);		
+		Map<String,Object> map = Maps.newHashMap();
+        if (com!=null){
+            map.put("companyName", com.getName());
+            map.put("master", com.getMaster()==null || UserUtils.get(com.getMaster())==null?"":UserUtils.get(com.getMaster()).getName());
+            map.put("masterId", com.getMaster()==null ?"":com.getMaster());
+            map.put("companyLogo", com.getLogo()==null?"":com.getLogo());
+            map.put("companyQrcode", com.getCompanyQrcode()==null?"":com.getCompanyQrcode());
+            j.put("data",map);
+            j.setErrorCode(ErrorCode.code_1004);
+            j.setMsg("获取企业详情成功");
+        }else {
+            j.setMsg("公司id错误");
+            j.setSuccess(false);
+            j.setErrorCode(ErrorCode.code_2003);
+        }
+
+		return j;
+	}
+	/**
+	 * 退出企业
+	 */
+	@Transactional
+	@ResponseBody
+	@RequestMapping(value="delOffice",method=RequestMethod.GET)
+	public AjaxJson delOffice(String id,String companyId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
+		AjaxJson j=new AjaxJson();
+        //获取用户信息
+        User user = UserUtils.get(id);
+        if(user==null ||StringUtils.isBlank(user.getId())){
+            j.setMsg("您的用户不存在");
+            j.setErrorCode(ErrorCode.code_2003);
+            return j;
+        }
+
+        WorkStaffBasicInfo workStaffBasicInfo = new WorkStaffBasicInfo();
+        workStaffBasicInfo.setCompany(new Office(companyId));
+        workStaffBasicInfo.setUserId(user.getId());
+        Integer count = workStaffBasicInfoService.getByCompany(workStaffBasicInfo);
+        if (count == 0){
+            String str = userService.deleteUserByCompany(user,new Office(companyId),"");
+            str.replace("移除用户信息成功","退出企业成功");
+            j.setMsg(str);
+        }else{
+            j.setMsg("退出企业失败,不能退出企业");
+        }
+		/*Company coms = new Company();
+        coms.setUserId(id);
+        coms.setCompanyId(companyId);
+        List<Role> roleList = companyService.getUserRoleComManager(coms);
+        if(roleList != null&&roleList.size() > 0){
+            List<String> roleComList = companyService.getUserRoleManager(coms);
+            int num = 0;
+            for (String role: roleComList) {
+                if(roleList.get(0).getId().equals(role)) {
+                    num++;
+                    if(num>1){
+                        break;
+                    }
+                }
+            }
+            if( num == 1 ){//一个管理员
+                j.setSuccess(false);
+                j.setErrorCode(ErrorCode.code_1005);
+                j.setMsg("公司只有您一位管理员,您不能退出企业");
+                return j;
+            }
+        }
+		//公司信息
+		Office com=new Office();
+		com.setId(companyId);
+		//岗位信息
+		Role role=new Role();
+		role.setCompany(com);
+		role.setUser(user);
+		//用户获取公司下岗位信息
+		List<Role> roleLista = roleDao.findList(role);
+		for(Role r : roleLista){
+		    //根据用户岗位和用户判断
+            systemService.updateUserToRole(r,user);
+		}
+        if (user.getCompany().getId().equals(companyId)){
+            Role role1 = new Role();
+            role1.setUser(user);
+            List<Role> rolelist=roleDao.findList(role1);
+            if (rolelist!=null && rolelist.size()!=0){
+                String officeId = rolelist.get(0).getOffice().getId();
+                String company = rolelist.get(0).getCompany().getId();
+                systemService.saveCurrentCompanyById(id,company,officeId);
+            }
+            companyService.deleteWorkAppShow(companyId,id);
+        }
+        Useroffice companyinfo = new Useroffice();
+        companyinfo.setCompanyId(companyId);
+        companyinfo.setUserId(id);
+        List<Useroffice> companyinfoList = companyinfoService.findListByCompany(companyinfo);
+        if (companyinfoList!=null && companyinfoList.size()!=0){
+            for (Useroffice info:companyinfoList){
+                info.setDelFlag("1");
+                companyinfoService.save(info);
+                Pushinfo pushinfo = new Pushinfo();
+                pushinfo.setPushId(info.getId());
+                List<Pushinfo> pushinfos = pushinfoService.findList(pushinfo);
+                if (pushinfos!=null && pushinfos.size()!=0){
+                    pushinfoService.updateDelflagByPushId(info.getId(),"1");
+                }
+            }
+        }
+        Office office = officeService.get(companyId);
+        if (StringUtils.isNotBlank(office.getGroupId())){
+            LayGroup layGroup = layGroupService.getNoOwner(office.getGroupId());
+            if (layGroup!=null && !layGroup.getCreateBy().getId().equals(user.getId())){
+                layGroupService.deleteGroupUser(layGroup,user.getId());
+            }
+        }*/
+        /*String groupId = office.getGroupId();
+        String userId = user.getId();
+        Object result = easemobChatGroup.removeSingleUserFromChatGroup(groupId, userId);
+        if (result!=null){
+            logger.info(result.toString());
+        }*/
+        /*EasemobInfo e = new EasemobInfo();
+        e.setUserId(userId);
+        e.setJoinStatus("2");
+        e.setGroupId(groupId);
+        e.setDelFlag("1");
+        easemobInfoService.deleteByUserIdAndGroupId(e);*/
+		return j;
+	}
+}

+ 37 - 0
src/main/java/com/jeeplus/modules/API/userinfo/ManageInfoController.java

@@ -0,0 +1,37 @@
+package com.jeeplus.modules.API.userinfo;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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.servlet.mvc.support.RedirectAttributes;
+
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.sys.dao.UserDao;
+/**
+ * 信息管理Controller
+ * @author zmy
+ * @version 2017-05-03
+ */
+
+@Controller
+@RequestMapping(value = "${frontPath}/userInfo/manageInfo")
+public class  ManageInfoController extends BaseController{
+	@Autowired
+	private UserDao userDao;
+	
+	
+	@ResponseBody
+	@RequestMapping(value = "getUserInfoManageInfoMap", method=RequestMethod.GET)
+	public AjaxJson manageInfo (String id,String officeId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes)
+	{ 
+		AjaxJson j=new AjaxJson();		
+		j.put("data",userDao.get(id));		
+		return j;
+	}
+}

+ 380 - 0
src/main/java/com/jeeplus/modules/API/userinfo/MyInfoController.java

@@ -0,0 +1,380 @@
+package com.jeeplus.modules.API.userinfo;
+
+import com.jeeplus.common.bos.BOSClientUtil;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.FileUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.WordToPic;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.sys.dao.OfficeDao;
+import com.jeeplus.modules.sys.dao.RoleDao;
+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.service.SystemService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+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.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.List;
+/**
+ * 我的信息Controller
+ * @author zmy
+ * @version 2017-04-17
+ */
+@Controller
+@RequestMapping(value = "${frontPath}/userInfo/myinfo")
+public class MyInfoController extends BaseController{
+
+	@Autowired
+	private OfficeDao officeDao;	
+	@Autowired
+	private RoleDao roleDao;
+
+    @Autowired
+    private SystemService systemService;
+
+
+        /**
+         * 获取信息
+         */
+	@ResponseBody
+	@RequestMapping(value = "getUserInfoMyInfoMap", method=RequestMethod.GET)
+	public AjaxJson findMyInfo (String id,String officeId,String companyId, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes)
+	{
+		AjaxJson j=new AjaxJson();
+		User user= new User();
+		if (StringUtils.isNotBlank(id)){
+			user = UserUtils.getNoSession(id);
+		}else {
+			user = UserUtils.getUser();
+		}
+		Office company = officeDao.get(user.getCompany());//当前企业
+		Office office = officeDao.get(user.getOffice());//当前企业
+		if (StringUtils.isNotBlank(officeId) && StringUtils.isNotBlank(companyId)){
+			company = officeDao.get(officeId);
+			office = officeDao.get(companyId);
+			user.setOffice(company);
+			user.setCompany(office);
+			user.setCompanyName(company.getName());
+			user.setOfficeName(office.getName());
+		}
+		if(company == null || company.getId().equals("1")){
+            user.setCompanyName("");
+            user.setCompany(new Office());
+        } else{
+			user.setCompanyName(company.getName());
+			if (StringUtils.isBlank(companyId)) {
+				UserUtils.removeCache("selectCompany");
+				UserUtils.putCache("selectCompany", companyId);
+			}
+		}
+		if(office == null || office.getId().equals("5") || office.getId().equals("e0ef8af9cae6416f8bb359714a1b4244")){
+            user.setOfficeName("");
+            user.setOffice(new Office());
+        } else {
+            user.setOfficeName(office.getName());
+            if (StringUtils.isBlank(officeId)){
+				UserUtils.removeCache("selectOffice");
+				UserUtils.putCache("selectOffice",officeId);
+			}
+		}
+		logger.info(user.getId()+"-------------------------------"+company.getId());
+		logger.info(user.toString());
+		List<Role> roles = systemService.getRoleList(user.getId(),company.getId());
+		if (roles!=null && roles.size()!=0) {
+			Role role = roles.get(0);
+			if(org.apache.commons.lang3.StringUtils.isNotBlank(role.getEnname()) && role.getEnname().endsWith("gly")||role.getEnname().equals("system")){
+				user.setIsManager("1");
+			}else{
+				user.setIsManager("0");
+			}
+			user.setRoleName(role.getName());
+
+			UserUtils.removeCache("selectRole");
+			UserUtils.putCache("selectRole", roles);
+		}
+		j.put("data",user);
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+
+    /**
+     * 保存用户个人信息
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveUserInfo",method=RequestMethod.GET)
+    public AjaxJson saveUserInfo(HttpServletRequest request, HttpServletResponse response) throws Exception{
+        AjaxJson j=new AjaxJson();
+        HashMap<String, String> requestMap = findRequestMap(request);
+		logger.info("saveUserInfo-------------------------------------------");
+        logger.info("saveUserInfo:sign="+requestMap.get("sign"));
+		String name = URLDecoder.decode(requestMap.get("name")==null?"":requestMap.get("name"), "UTF-8");
+		String email = URLDecoder.decode(requestMap.get("email")==null?"":requestMap.get("email"), "UTF-8");
+		String sign = URLDecoder.decode(requestMap.get("sign")==null?"":requestMap.get("sign"), "UTF-8");
+		String sex = URLDecoder.decode(requestMap.get("sex")==null?"":requestMap.get("sex"), "UTF-8");
+		logger.info("saveUserInfo-------------------------------------------"+sign);
+		User user=UserUtils.getUser();
+        //根据姓名生成图片
+		if(StringUtils.isNotBlank(name) && !name.equals(user.getName())){
+			user.setName(name);
+			long time = System.currentTimeMillis();
+			String realPathPhoto = Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL  +time+ "/img/";
+			FileUtils.createDirectory(realPathPhoto);
+			String picNamePhoto =time + ".png"; // encoderImgId此处图片名
+			String filePathPhoto = realPathPhoto + picNamePhoto; // 存放路径
+			WordToPic.TextToPic(name.substring(name.length()-2>0?name.length()-2:0,name.length()),200, 200, 55, filePathPhoto);
+			String temp = request.getContextPath() + Global.USERFILES_BASE_URL + time + "/img/"+picNamePhoto;
+			if (StringUtils.isNotBlank(user.getDefaultPhoto()) && user.getDefaultPhoto().equals("0")){
+				InputStream inputStream = null;
+				HttpURLConnection httpURLConnection;
+				try {
+					URL url = new URL(request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+ temp);
+					httpURLConnection = (HttpURLConnection) url.openConnection();
+					// 设置网络连接超时时间
+					httpURLConnection.setConnectTimeout(3000);
+					// 设置应用程序要从网络连接读取数据
+					httpURLConnection.setDoInput(true);
+
+					httpURLConnection.setRequestMethod("GET");
+					int responseCode = httpURLConnection.getResponseCode();
+					if (responseCode == 200) {
+						// 从服务器返回一个输入流
+						inputStream = httpURLConnection.getInputStream();
+
+					}
+					/*OSSClientUtil ossUtil =new OSSClientUtil();
+					String[] arr = temp.split("/");
+					String photoName = System.currentTimeMillis()+arr[arr.length-1];
+					ossUtil.uploadFile2OSS(inputStream, Global.getPhoto(), photoName);*/
+					String path = new StringBuilder("/qrcode/")
+							.append(name+System.currentTimeMillis()).append(".png").toString();
+					BOSClientUtil bosClientUtil = new BOSClientUtil();
+					String uploadPath = bosClientUtil.upload(path, inputStream);
+					user.setPhoto(uploadPath);
+					FileUtils.delFile(Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL  +time);
+				} catch (MalformedURLException e) {
+					e.printStackTrace();
+				} catch (IOException e) {
+					e.printStackTrace();
+				} finally {
+					if(inputStream!=null){
+						try {
+							inputStream.close();
+						}catch (Exception e){
+							e.printStackTrace();
+						}
+					}
+				}
+			}
+		}
+		if(StringUtils.isNotBlank(email)) user.setEmail(email);
+        if(StringUtils.isNotBlank(sign)) user.setSign(sign);
+        if(StringUtils.isNotBlank(sex)) user.setSex(sex);
+        systemService.updateUserInfo(user);
+        j.setMsg("修改用户信息成功");
+        j.setErrorCode(ErrorCode.code_1004);
+        return j;
+    }
+
+
+	/**
+	 * 保存姓名
+	 */
+	 @ResponseBody
+	 @RequestMapping(value = "saveUserName",method=RequestMethod.GET)
+	    public AjaxJson saveUser(String id,HttpServletRequest request, HttpServletResponse response) {
+		 AjaxJson j=new AjaxJson();
+		 String name=request.getParameter("name");
+         User user=UserUtils.getUser();
+		 //根据姓名生成图片
+		 if(StringUtils.isNotBlank(name) && !name.equals(user.getName())){
+			 logger.info(name+"----"+user.getName());
+			 user.setName(name);
+			 long time = System.currentTimeMillis();
+			 String realPathPhoto = Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL  +time+ "/img/";
+			 FileUtils.createDirectory(realPathPhoto);
+			 String picNamePhoto =time + ".png"; // encoderImgId此处图片名
+			 String filePathPhoto = realPathPhoto + picNamePhoto; // 存放路径
+			 WordToPic.TextToPic(name.substring(name.length()-2>0?name.length()-2:0,name.length()),200, 200, 55, filePathPhoto);
+			 String temp = request.getContextPath() + Global.USERFILES_BASE_URL + time + "/img/"+picNamePhoto;
+			 if (StringUtils.isNotBlank(user.getDefaultPhoto()) && user.getDefaultPhoto().equals("0")){
+				 InputStream inputStream = null;
+				 HttpURLConnection httpURLConnection;
+				 try {
+					 logger.info("");
+					 URL url = new URL(request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+ temp);
+					 httpURLConnection = (HttpURLConnection) url.openConnection();
+					 // 设置网络连接超时时间
+					 httpURLConnection.setConnectTimeout(3000);
+					 // 设置应用程序要从网络连接读取数据
+					 httpURLConnection.setDoInput(true);
+
+					 httpURLConnection.setRequestMethod("GET");
+					 int responseCode = httpURLConnection.getResponseCode();
+					 if (responseCode == 200) {
+						 // 从服务器返回一个输入流
+						 inputStream = httpURLConnection.getInputStream();
+
+					 }
+					 OSSClientUtil ossUtil =new OSSClientUtil();
+					 String[] arr = temp.split("/");
+					 String photoName = System.currentTimeMillis()+arr[arr.length-1];
+					 ossUtil.uploadFile2OSS(inputStream, Global.getPhoto(), photoName);
+					 user.setPhoto(Global.getAliyunUrl()+"/"+ Global.getPhoto() + photoName);
+					 FileUtils.delFile(Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL  +time);
+				 } catch (MalformedURLException e) {
+					 e.printStackTrace();
+				 } catch (IOException e) {
+					 e.printStackTrace();
+				 } finally {
+					 if(inputStream!=null){
+						 try {
+							 inputStream.close();
+						 }catch (Exception e){
+							 e.printStackTrace();
+						 }
+					 }
+				 }
+			 }
+		 }
+		 if (user.getCompany()==null || StringUtils.isBlank(user.getCompany().getId())){
+			 user.setCompany(new Office("1"));
+		 }
+		 if (user.getOffice()==null || StringUtils.isBlank(user.getOffice().getId())){
+			 user.setOffice(new Office("5"));
+		 }
+         systemService.updateUserInfo(user);
+		 j.setMsg("修改姓名成功");
+		 j.setErrorCode(ErrorCode.code_1004);
+		 return j;
+	 }
+	 /**
+	  * 保存邮箱
+	  */
+	 @ResponseBody
+	 @RequestMapping(value = "saveUserEmail",method=RequestMethod.GET)
+		 public AjaxJson saveUserEmail(String id,HttpServletRequest request, HttpServletResponse response) {
+		 AjaxJson j=new AjaxJson();
+         String email=request.getParameter("email");
+         User user=UserUtils.getUser();
+			 user.setEmail(email);
+
+            systemService.updateUserInfo(user);
+			 j.setMsg("修改邮箱成功");
+			 j.setErrorCode(ErrorCode.code_1004);
+		 return j;
+	 }
+	 /**
+	  * 保存签名
+	  */
+	 @ResponseBody
+	 @RequestMapping(value = "saveUserSign",method=RequestMethod.POST)
+		 public AjaxJson saveUserSign(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException {
+		 AjaxJson j=new AjaxJson();
+		 HashMap<String, String> requestMap = findRequestMap(request);
+		 String sign = URLDecoder.decode(requestMap.get("sign")==null?"":requestMap.get("sign"), "UTF-8");
+
+		 String id =requestMap.get("id");
+		 User user=UserUtils.getUser();
+		 user.setSign(sign);
+         systemService.updateUserInfo(user);
+		 j.setMsg("设置签名成功");
+		 j.setErrorCode(ErrorCode.code_1004);
+		 return j;
+	 }
+	 /**
+	  * 保存性别
+	  */
+	 @ResponseBody
+	 @RequestMapping(value = "saveUserSex",method=RequestMethod.GET)
+		 public AjaxJson saveUserSex(String id,HttpServletRequest request, HttpServletResponse response) {
+		 AjaxJson j=new AjaxJson();
+		 String sex=request.getParameter("sex");
+         User user=UserUtils.getUser();
+		 user.setSex(sex);
+         systemService.updateUserInfo(user);
+         j.setMsg("保存性别成功");
+         j.setErrorCode(ErrorCode.code_1004);
+		 return j;
+	 }
+    /**
+     * 保存头像
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveUserPhoto",method=RequestMethod.POST)
+    public AjaxJson saveUserPhoto(MultipartHttpServletRequest muiltRequest,HttpServletRequest servletRequest) throws Exception{
+        AjaxJson j=new AjaxJson();
+		try {
+        User currentUser = UserUtils.getUser();
+			String oldPhoto = currentUser.getPhoto();
+			String aliyunUrl = Global.getAliyunUrl();
+			String aliDownloadUrl = Global.getAliDownloadUrl();
+			String cons = "";
+			if (oldPhoto.contains(aliyunUrl)){
+				cons = aliyunUrl;
+			}else if (oldPhoto.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
+				cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+			}else {
+				cons = aliDownloadUrl;
+			}
+			String key = "";
+			if(StringUtils.isNotBlank(oldPhoto)){
+				String[] arr = oldPhoto.split(cons+"/");
+				key = arr[1];
+			}
+        OSSClientUtil ossUtil =new OSSClientUtil();
+        String fileName = muiltRequest.getFileNames().next(); //得到文件名(注意。是content-type 中的name="file1",而不是真正的文件名)
+        MultipartFile file = muiltRequest.getFile(fileName);   //得到该文件
+        // 判断文件是否为空
+        if (!file.isEmpty()) {
+        	logger.info("key="+key);
+        	try {
+				ossUtil.deleteSingleObject(key);
+			}catch (Exception e){
+				logger.info("Exception e"+e);
+			}
+			//上面的删除方法里面有关闭oss客户端的操作,这里重新new一个
+			ossUtil = new OSSClientUtil();
+            String filePath= ossUtil.uploadFile2OSS(file, "photo");
+			logger.info("filePath:"+filePath);
+            currentUser.setPhoto(filePath);
+            currentUser.setDefaultPhoto("1");
+            systemService.updateUserInfo(currentUser);
+            j.put("filePath",filePath);
+        }
+        j.setMsg("上传成功!");
+        j.setErrorCode(ErrorCode.code_1004);
+		logger.info("j:"+j.toString());
+		}catch (Exception e){
+			j.put("filePath","");
+			j.setSuccess(false);
+			j.setMsg("上传失败!");
+			j.setErrorCode(ErrorCode.code_2004);
+		}finally {
+			return j;
+		}
+    }
+}

+ 112 - 0
src/main/java/com/jeeplus/modules/API/userinfo/SearchController.java

@@ -0,0 +1,112 @@
+package com.jeeplus.modules.API.userinfo;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.sysuseroffice.entity.Useroffice;
+import com.jeeplus.modules.sysuseroffice.service.UserofficeService;
+import com.jeeplus.modules.utils.ErrorCode;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.sys.dao.UserDao;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+
+/**
+ * 查找用户Controller
+ * 
+ * @author zmy
+ * @version 2017-04-17
+ */
+@Controller
+@RequestMapping(value = "${frontPath}/userInfo/search")
+public class SearchController extends BaseController {
+	@Autowired
+	private UserDao userDao;
+    @Autowired
+    private UserofficeService userofficeService;
+
+    @ResponseBody
+    @RequestMapping(value = "getUserInfoSearchList", method=RequestMethod.GET)
+    public AjaxJson findCompanyUser(String nameOrMobile, HttpServletRequest request, HttpServletResponse response,
+                                RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        User user = UserUtils.getUser();
+        Useroffice useroffice = new Useroffice();
+        List<Office> companyList = UserUtils.getAllCompany(user);
+        List companyIds = new ArrayList();
+        for (Office office:companyList){
+            companyIds.add(office.getId());
+        }
+        useroffice.setCompanyIds(companyIds);
+        useroffice.setName(nameOrMobile);
+        useroffice.setDelFlag("0");
+        List<Useroffice> list = userofficeService.searchUsersGroupByUserId(useroffice);
+        if (list==null || list.size()==0) {
+            useroffice.setMobile(nameOrMobile);
+            useroffice.setName(null);
+            list = userofficeService.searchUsersGroupByUserId(useroffice);
+        }
+        List<Map<String,Object>> mapList = Lists.newArrayList();
+        for(int i = 0; i < list.size(); i++){
+            Map<String,Object> map = Maps.newHashMap();
+            User u = list.get(i).getUser();
+            map.put("photo", u.getPhoto());
+            map.put("name", u.getName());
+            map.put("office", u.getOfficeName());
+            map.put("officeId", u.getOffice().getId());
+            map.put("companyId", u.getCompany().getId());
+            map.put("id", u.getId());
+            mapList.add(map);
+        }
+        j.put("data", mapList);
+        j.setErrorCode(ErrorCode.code_1004);
+        return j;
+    }
+
+	@ResponseBody
+	@RequestMapping(value = "getUserInfoAllList", method=RequestMethod.GET)
+	public AjaxJson findAllUser(String nameOrMobile, HttpServletRequest request, HttpServletResponse response,
+			RedirectAttributes redirectAttributes) {
+		AjaxJson j = new AjaxJson();
+		User user = new User();
+		List<User> list = new ArrayList<User>();
+		user.setName(nameOrMobile);
+		if (userDao.searchUsers(user) != null) {
+			list = userDao.searchUsers(user);
+		}
+		if (list.size()==0) {
+			user.setMobile(nameOrMobile);
+			user.setName(null);
+			list = userDao.searchUsers(user);
+		}
+		List<Map<String,Object>> mapList = Lists.newArrayList();
+		for(int i = 0; i < list.size(); i++){
+			Map<String,Object> map = Maps.newHashMap();
+			User u = list.get(i);
+			map.put("photo", u.getPhoto());
+			map.put("name", u.getName());
+			map.put("office", u.getOffice().getName());	
+			map.put("id", u.getId());
+			mapList.add(map); 
+		}
+        logger.info("mapList.size="+mapList.size());
+		j.put("data", mapList);
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+}

+ 268 - 0
src/main/java/com/jeeplus/modules/API/userinfo/SetUpController.java

@@ -0,0 +1,268 @@
+package com.jeeplus.modules.API.userinfo;
+
+import java.io.InputStream;
+import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+import com.easemob.server.example.api.impl.EasemobIMUsers;
+import com.jeeplus.common.utils.CacheUtils;
+import com.jeeplus.common.utils.JedisUtils;
+import com.jeeplus.common.utils.RequestUtils;
+import com.jeeplus.modules.sys.security.SystemAuthorizingRealm;
+import com.jeeplus.modules.utils.ErrorCode;
+import io.swagger.client.model.NewPassword;
+import org.apache.commons.io.IOUtils;
+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 com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.sys.dao.SuggestionDao;
+import com.jeeplus.modules.sys.dao.UserDao;
+import com.jeeplus.modules.sys.entity.Suggestion;
+import com.jeeplus.modules.sys.entity.SystemConfig;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.SystemConfigService;
+import com.jeeplus.modules.sys.service.SystemService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+
+import net.sf.json.JSONObject;
+import redis.clients.jedis.Jedis;
+
+
+/**
+ * 设置Controller
+ * @author zmy
+ * @version 2017-04-17
+ */
+@Controller
+@RequestMapping(value = "${frontPath}/userInfo/setup")
+public class SetUpController extends BaseController{
+	@Autowired
+	private UserDao userDao;
+	@Autowired
+	private SystemService systemService;
+	@Autowired
+	private SuggestionDao suggestionDao;
+	@Autowired
+	private SystemConfigService systemConfigService;
+	
+
+	/**
+	 * 意见反馈
+	 */
+	 @ResponseBody
+	 @RequestMapping(value = "saveSuggestion",method=RequestMethod.POST)
+		 public AjaxJson saveSuggestion(String id,HttpServletRequest request, HttpServletResponse response)throws Exception  {
+		 AjaxJson j=new AjaxJson();
+		 HashMap<String, String> requestMap = findRequestMap(request);
+         String content = URLDecoder.decode(requestMap.get("content")==null?"":requestMap.get("content"), "UTF-8");
+		 User user=UserUtils.get(id);
+		 Suggestion suggestion=new Suggestion();
+		 suggestion.setCreateBy(user);
+	     suggestion.setContent(content);//参数赋值
+		 suggestion.preInsert(); //自动生成ID 、createDate、createBy(createBy为登录用户、接口下该值为空)
+		 suggestionDao.insert(suggestion); 
+		 j.setMsg("感谢您的反馈");
+		 j.setErrorCode(ErrorCode.code_1004);
+		 return j;
+	 }	
+	 /**
+	  * 消息通知
+	  */
+//	 @ResponseBody
+//	 @RequestMapping(value = "saveNotify",method=RequestMethod.GET)
+//	 	public AjaxJson saveNotify(String id,String notifyId,HttpServletRequest request, HttpServletResponse response) {
+//		AjaxJson j=new AjaxJson(); 
+//		User user=new User();
+//		user=userDao.get(id);
+//		OaNotify notify=new OaNotify();
+//		notify.setId(notifyId);				
+//		return j;
+//	 }
+
+
+    //修改密码
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "modifyPwd", method = RequestMethod.POST)
+    public AjaxJson modifyPwd(HttpServletRequest request, HttpServletResponse response) {
+        HashMap<String, String> requestMap = findRequestMap(request);
+        AjaxJson j = new AjaxJson();
+        String oldPassword = requestMap.get("oldPassword");
+        String newPassword = requestMap.get("newPassword");
+        String userId = requestMap.get("userId");
+        String loginName = requestMap.get("loginName");
+        String isCodeModify = requestMap.get("isCodeModify");
+        String randomCode = requestMap.get("randomCode");
+        String type = requestMap.get("type");
+        Jedis jedis = null;
+        try {
+            jedis = JedisUtils.getResource();
+            if (StringUtils.isNotBlank(newPassword) && StringUtils.isNotBlank(userId)) {
+                User user = UserUtils.get(userId);
+                if (StringUtils.isNotBlank(oldPassword) && SystemService.validatePassword(oldPassword, user.getPassword())) {
+                    systemService.updatePasswordById(user.getId(), user.getLoginName(), newPassword);
+                    j.setMsg("修改成功");
+                    j.setErrorCode(ErrorCode.code_1004);
+                } else {
+                    j.setMsg("修改失败,旧密码错误");
+                    j.setSuccess(false);
+                    j.setErrorCode(ErrorCode.code_1012);
+                }
+            } else if (StringUtils.isNotBlank(newPassword) && StringUtils.isNotBlank(isCodeModify) && isCodeModify.equals("yes") && StringUtils.isNotBlank(loginName) && StringUtils.isNotBlank(randomCode) &&  StringUtils.isNotBlank(type)) {
+                //if (randomCode.equals(request.getSession().getServletContext().getAttribute(loginName)) && type.equals(request.getSession().getServletContext().getAttribute(type))) {
+                if (randomCode.equals(jedis.get(loginName)) && type.equals(jedis.get(type))) {
+                    User user = UserUtils.getByLoginNameNoSesion(loginName);
+                    NewPassword psd = new NewPassword().newpassword(newPassword);
+                    EasemobIMUsers easemobIMUsers = new EasemobIMUsers();
+                    Object result = easemobIMUsers.getIMUserByUserName(user.getId());
+                    if (result != null) {
+                        Object result1 = easemobIMUsers.modifyIMUserPasswordWithAdminToken(user.getId(), psd);
+                        logger.info(result1.toString());
+                    }
+                    systemService.updatePasswordById(user.getId(), user.getLoginName(), newPassword);
+                    j.setMsg("修改成功");
+                    j.setErrorCode(ErrorCode.code_1004);
+                }else {
+                    j.setMsg("修改失败,验证错误");
+                    j.setSuccess(false);
+                    j.setErrorCode(ErrorCode.code_1012);
+                }
+
+            } else {
+                j.setMsg("修改失败,验证错误");
+                j.setSuccess(false);
+                j.setErrorCode(ErrorCode.code_1012);
+            }
+        }catch (Exception e){
+            j.setMsg("修改失败");
+            j.setSuccess(false);
+            j.setErrorCode(ErrorCode.code_2004);
+        }
+        finally {
+            JedisUtils.returnResource(jedis);
+        }
+
+        return j;
+    }
+
+    /**
+     * 验证密码
+     */
+    @ResponseBody
+    @RequestMapping(value = "validatePassword",method=RequestMethod.POST)
+    public AjaxJson validatePassword(HttpServletRequest request, HttpServletResponse response) {
+        HashMap<String, String> requestMap = findRequestMap(request);
+        AjaxJson j=new AjaxJson();
+        String password=requestMap.get("password");
+        String userId=requestMap.get("userId");
+        if(!userId.equals(UserUtils.getUser().getId())){
+            j.setMsg("验证失败,用户id错误");
+            j.setErrorCode(ErrorCode.code_2003);
+            j.setSuccess(false);
+            return j;
+        }
+        User user=UserUtils.getUser();
+        if(SystemService.validatePassword(password,user.getPassword())){
+            j.setErrorCode(ErrorCode.code_1004);
+            j.setSuccess(true);
+            j.setMsg("密码正确");
+        }else{
+            j.setErrorCode(ErrorCode.code_1012);
+            j.setSuccess(false);
+            j.setMsg("密码错误");
+        }
+        return j;
+    }
+
+
+    /**
+     * 更换手机号
+     */
+    @ResponseBody
+    @RequestMapping(value = "updateMobile",method=RequestMethod.POST)
+    public AjaxJson updateMobile(HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson j=new AjaxJson();
+        HashMap<String, String> requestMap = findRequestMap(request);
+        String userId=requestMap.get("userId");
+        String mobile=requestMap.get("mobile");
+        User user=UserUtils.getUser();
+        if(user == null || user.getId() ==null){
+            user = UserUtils.get(userId);
+        }
+        if(userDao.findUniqueByProperty("login_name", mobile)==null){
+            user.setLoginName(mobile);
+            user.setMobile(mobile);
+            systemService.updateMo(user);
+            CacheUtils.remove("userCache");
+            j.setMsg("更换成功");
+            j.setErrorCode(ErrorCode.code_1004);
+        }else{
+            j.setErrorCode(ErrorCode.code_1007);
+            j.setMsg("更换失败,该手机号已有用户使用");
+        }
+        UserUtils.getNoSession(userId);
+        return j;
+    }
+
+    /**
+     * 修改密码
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "savePassword",method=RequestMethod.POST)
+    public AjaxJson savePassword(String id,HttpServletRequest request, HttpServletResponse response) {
+        HashMap<String, String> requestMap = findRequestMap(request);
+        AjaxJson j=new AjaxJson();
+        String oldPassword=requestMap.get("oldPassword");
+        String newPassword=requestMap.get("newPassword");
+        User user=new User();
+        user=userDao.get(id);
+        if(SystemService.validatePassword(oldPassword,user.getPassword())){
+            systemService.updatePasswordById(user.getId(), user.getLoginName(), newPassword);
+            j.setMsg("修改成功");
+            j.setErrorCode(ErrorCode.code_1004);
+        }else{
+            j.setMsg("修改失败,旧密码错误");
+            j.setErrorCode(ErrorCode.code_2003);
+        }
+        return j;
+    }
+
+    /**
+     *审批 (*审批成功)
+     *
+     * @param
+     */
+    @ResponseBody
+    @RequestMapping(value = "updateUser", method = RequestMethod.GET)
+    public AjaxJson updateUser(HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson json = new AjaxJson();
+        User u = new User();
+        u.setCompany(UserUtils.getSelectCompany());
+        List<User> users = userDao.findList(u);
+        for (User user:users){
+            if (!user.getId().equals("1")) {
+                systemService.updatePasswordById(user.getId(), user.getLoginName(), systemService.encrypeString("123456"));
+            }
+        }
+        json.setSuccess(true);
+        json.setMsg("修改成功");
+        json.setErrorCode(ErrorCode.code_1004);
+        return json;
+    }
+
+}

Fichier diff supprimé car celui-ci est trop grand
+ 3291 - 0
src/main/java/com/jeeplus/modules/API/works/Act/ActTaskMoblieController.java


+ 230 - 0
src/main/java/com/jeeplus/modules/API/works/approval/LeaveInterfaceController.java

@@ -0,0 +1,230 @@
+package com.jeeplus.modules.API.works.approval;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.modules.utils.ErrorCode;
+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 com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.oa.dao.LeaveDao;
+import com.jeeplus.modules.oa.entity.Leave;
+import com.jeeplus.modules.sys.entity.User;
+
+@Controller
+@RequestMapping(value = "${frontPath}/leave")
+public class LeaveInterfaceController extends BaseController {
+
+	@Autowired
+	private LeaveDao leaveDao;
+
+	/**
+	 * 查询 我的审批
+	 *
+	 * @param
+	 * @param request
+	 * @param response
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping(value = "myLeaveList", method = RequestMethod.GET)
+	public AjaxJson myLeaveList(HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j = new AjaxJson();
+		String userId = request.getParameter("userId");
+
+		User user = new User();
+		user.setId(userId);
+		Leave leave = new Leave();
+		leave.setUser(new User(userId));
+		leave.setCreateBy(user);
+		List<Leave> list = leaveDao.findList(leave);
+		j.put("data", list);
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+
+	}
+
+	/**
+	 * 启动请假申请
+	 *
+	 * @param request
+	 * @param response
+	 * @return
+	 * @throws ParseException
+	 */
+	@ResponseBody
+	@RequestMapping(value = "applyForLeave", method = RequestMethod.POST)
+	public AjaxJson applyForLeave(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+		AjaxJson json = new AjaxJson();
+		HashMap<String, String> requestMap = findRequestMap(request);
+		//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		String start = request.getParameter("startTime");
+		String end = request.getParameter("endTime");
+		//Date startTime = sdf.parse(start);//格式化时间2017-07-22 13:15:16
+		//Date endTime = sdf.parse(end);//格式化时间
+		String id = request.getParameter("userId");
+		String reason = request.getParameter("reason");
+		String leaveTime = request.getParameter("leaveTime"); // 新加字段 请假时长
+		String leaveDays = request.getParameter("leaveDays"); // 新加字段 请假天数
+		String leaveType = request.getParameter("leaveType");
+		String approverId = request.getParameter("approverId");//审批人
+		String CCId = request.getParameter("CCId");//抄送人7
+		String delFlag="0"; //审核流程状态标记 0 待审核 1 审核完成
+		User user = new User();
+		Leave leave = new Leave();
+		User approver =new User();
+		approver.setId(approverId);
+		User CC = new User();
+		CC.setId(CCId);
+		user.setId(id);
+		leave.setUser(user);
+		leave.setReason(reason);
+		leave.setStartTime(start);
+		leave.setEndTime(end);
+		leave.setLeaveTime(leaveTime);
+		leave.setLeaveDays(leaveDays);
+		leave.setLeaveType(leaveType);
+		leave.setCreateBy(user);
+		leave.setUpdateBy(user);
+		leave.setDelFlag(delFlag);
+		leave.preInsert();
+		leaveDao.insert(leave);
+		json.setMsg("提交成功");
+		json.setErrorCode(ErrorCode.code_1004);
+		return json;
+	}
+
+	/**
+	 * 修改请假申请
+	 *
+	 * @param leaveId
+	 * @param request
+	 * @param response
+	 * @return
+	 * @throws ParseException
+	 * locahost8080/jee/f/leave/modifyLeave
+	 */
+	@ResponseBody
+	@RequestMapping(value = "modifyLeave", method = RequestMethod.POST)
+	public AjaxJson modifyLeave(String leaveId, HttpServletRequest request, HttpServletResponse response)
+			throws ParseException {
+		AjaxJson json = new AjaxJson();
+		//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String startTime = request.getParameter("startTime");
+        String endTime = request.getParameter("endTime");
+		String id = request.getParameter("userId");
+		String reason = request.getParameter("reason");
+		String leaveTime = request.getParameter("leaveTime"); // 新加字段 请假时长
+		String leaveDays = request.getParameter("leaveDays"); // 新加字段 请假天数
+		String leaveType = request.getParameter("leaveType");
+		User user = new User();
+		Leave leave = new Leave();
+		user.setId(id);
+		if (leaveDao.get(leaveId) != null) {
+			leave.setReason(reason);
+			leave.setStartTime(startTime);
+			leave.setEndTime(endTime);
+			leave.setLeaveTime(leaveTime);
+			leave.setLeaveDays(leaveDays);
+			leave.setLeaveType(leaveType);
+			leave.setUpdateBy(user);
+			leave.preInsert();
+			leaveDao.update(leave);
+			json.setMsg("提交请假申请成功");
+			json.setErrorCode(ErrorCode.code_1004);
+		}
+
+		return json;
+	}
+
+	/**
+	 * 删除
+	 *
+	 * @param leaveId
+	 */
+	@ResponseBody
+	@RequestMapping(value = "delLeave", method = RequestMethod.GET)
+	public AjaxJson delLeave(String leaveId, HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson json = new AjaxJson();
+
+		Leave leave = new Leave();
+		leave.setId(leaveId);
+		leaveDao.delete(leave);
+
+		if (leaveDao.get(leave) == null) {
+			json.setMsg("删除成功");
+			json.setErrorCode(ErrorCode.code_1004);
+		} else {
+			json.setMsg("删除失败");
+			json.setErrorCode(ErrorCode.code_2004);
+		}
+		return json;
+	}
+
+	/**
+	 * 查询
+	 */
+	@ResponseBody
+	@RequestMapping(value = "approverIdList", method = RequestMethod.GET)
+	public void approverIdList(String leaveId,HttpServletRequest request, HttpServletResponse response) {
+
+	}
+	/**
+	 * 请假详情
+	 */
+
+	@ResponseBody
+	@RequestMapping(value = "getleave", method = RequestMethod.GET)
+	public AjaxJson getleave(String leaveId,HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson json = new AjaxJson();
+		Leave leave = new Leave();
+		leave.setId(leaveId);
+		Leave leave1=leaveDao.get(leaveId);//get底层方法问题,获取不到,get获取null
+		json.setSuccess(true);
+		json.setErrorCode(ErrorCode.code_1004);
+		json.put("data",leave1);
+		return json;
+	}
+	/**
+	 *审批 (*审批成功)
+	 *
+	 * @param
+	 */
+	@ResponseBody
+	@RequestMapping(value = "auditSave", method = RequestMethod.POST)
+	public AjaxJson auditSave(HttpServletRequest request, HttpServletResponse response) {
+		String delFlag=request.getParameter("delFlag");
+		String id = request.getParameter("userId");
+		String leaveDetails = request.getParameter("leaveDetails");
+		String leaveId = request.getParameter("leaveId");
+		Leave leave=new Leave();
+		leave.setId(leaveId);
+		leave.setDelFlag(delFlag);
+		leave.setLeaveDetails(leaveDetails);
+		User user = new User();
+		user.setId(id);
+		leave.setUpdateBy(user);
+		leaveDao.update(leave);
+		AjaxJson json = new AjaxJson();
+		json.setSuccess(true);
+		json.setMsg("审核成功");
+		json.setErrorCode(ErrorCode.code_1004);
+		return json;
+	}
+
+}

+ 164 - 0
src/main/java/com/jeeplus/modules/API/works/approval/OverTimeController.java

@@ -0,0 +1,164 @@
+package com.jeeplus.modules.API.works.approval;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.workovertimeform.dao.WorkOvertimeFormDao;
+import com.jeeplus.modules.workovertimeform.entity.WorkOvertimeForm;
+
+@Controller
+@RequestMapping(value = "${frontPath}/overtime")
+
+public class OverTimeController extends BaseController {
+
+	@Autowired
+	private WorkOvertimeFormDao workOvertimeFormDao;
+
+	/**
+	 * 查询
+	 * 
+	 * @author 李韵轩
+	 * @param userId
+	 * @param request
+	 * @param response
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping(value = "myOverTimeList", method = RequestMethod.GET)
+	public AjaxJson myOverTimeList(String userId, HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson json = new AjaxJson();
+		User user = new User();
+		user.setId(userId);
+		WorkOvertimeForm over = new WorkOvertimeForm();
+		over.setUser(user);
+		List<WorkOvertimeForm> list = workOvertimeFormDao.findList(over);
+		json.put("data", list);
+		json.setErrorCode(ErrorCode.code_1004);
+		return json;
+	}
+
+	/**
+	 * 新建加班申请
+	 * 
+	 * @author 朱明月
+	 * @param request
+	 * @param response
+	 * @return
+	 * @throws ParseException
+	 */
+	@ResponseBody
+	@RequestMapping(value = "addOverTime", method = RequestMethod.POST)
+	public AjaxJson addOverTime(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+		AjaxJson json = new AjaxJson();
+		//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		String startTime = request.getParameter("startTime");
+        String endTime = request.getParameter("endTime");
+		String id = request.getParameter("userId");
+		String isHolidays = request.getParameter("isHolidays");
+		String remarks = request.getParameter("remarks");
+		String longTime = request.getParameter("longTime");
+		User user = new User();
+		WorkOvertimeForm over = new WorkOvertimeForm();
+		user.setId(id);
+		over.setUser(user);
+		over.setStartTime(startTime);
+		over.setEndTime(endTime);
+		over.setLongTime(longTime);
+		over.setIsHolidays(isHolidays);
+		over.setRemarks(remarks);
+		over.setCreateBy(user);
+		over.setCreateBy(user);
+		over.setUpdateBy(user);
+		over.setCompanyId(UserUtils.getSelectCompany().getId());
+		over.preInsert();
+		workOvertimeFormDao.insert(over);
+		json.setMsg("提交加班申请成功");
+		json.setErrorCode(ErrorCode.code_1004);
+		return json;
+	}
+
+	/**
+	 * 修改加班申请
+	 * 
+	 * @throws ParseException
+	 */
+	@ResponseBody
+	@RequestMapping(value = "updateOverTime", method = RequestMethod.POST)
+	public AjaxJson updateOverTime(String overId, HttpServletRequest request, HttpServletResponse response)
+			throws ParseException {
+		AjaxJson json = new AjaxJson();
+		//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String startTime = request.getParameter("startTime");
+        String endTime = request.getParameter("endTime");
+		String id = request.getParameter("userId");
+		String isHolidays = request.getParameter("isHolidays");
+		String remarks = request.getParameter("remarks");
+		String longTime = request.getParameter("longTime");
+		User user = new User();
+		WorkOvertimeForm over = new WorkOvertimeForm();
+		user.setId(id);
+		if (workOvertimeFormDao.get(overId) != null) {
+			if (remarks != null || remarks != "") {
+				over.setRemarks(remarks);
+			}
+			if (startTime != null) {
+				over.setStartTime(startTime);
+			}
+			if (endTime != null) {
+				over.setEndTime(endTime);
+			}
+			if (longTime != null || longTime != "") {
+				over.setLongTime(longTime);
+			}
+			if (isHolidays != null || isHolidays != "") {
+				over.setIsHolidays(isHolidays);
+			}
+			if (user != null || remarks != "") {
+				over.setCreateBy(user);
+			}
+		}
+		over.preUpdate();
+		workOvertimeFormDao.update(over);
+		json.setMsg("提交加班申请成功");
+		json.setErrorCode(ErrorCode.code_1004);
+		return json;
+	}
+
+	/**
+	 * 删除加班申请
+	 * 
+	 * @throws ParseException
+	 */
+	@ResponseBody
+	@RequestMapping(value = "delOverTime", method = RequestMethod.GET)
+	public AjaxJson delOverTime(String overId, HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson json = new AjaxJson();
+		WorkOvertimeForm over = new WorkOvertimeForm();
+		over.setId(overId);
+		workOvertimeFormDao.delete(over);
+		if (workOvertimeFormDao.get(over) == null) {
+			json.setMsg("删除成功");
+			json.setErrorCode(ErrorCode.code_1004);
+		} else {
+			json.setMsg("删除失败");
+			json.setErrorCode(ErrorCode.code_2004);
+		}
+		return json;
+	}
+}

+ 444 - 0
src/main/java/com/jeeplus/modules/API/works/appshow/WorkAppShowController.java

@@ -0,0 +1,444 @@
+package com.jeeplus.modules.API.works.appshow;
+
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.JedisUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.appversion.entity.Appversions;
+import com.jeeplus.modules.appversion.service.AppversionsService;
+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.utils.ErrorCode;
+import com.jeeplus.modules.workappshow.entity.Workappshow;
+import com.jeeplus.modules.workappshow.service.WorkappshowService;
+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.servlet.mvc.support.RedirectAttributes;
+import redis.clients.jedis.Jedis;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+@Controller
+@RequestMapping(value="${frontPath}/app/show")
+public class WorkAppShowController extends BaseController {
+
+    @Autowired
+    private WorkappshowService workappshowService;
+
+    private  Lock lock = new ReentrantLock();
+
+    /**
+     * 获取用户APP端信息展示
+     * @return json数据
+     */
+    @Transactional
+        @RequestMapping(value = "getAppShow", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getAppShow(String userId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            lock.lock();
+            if (userId == null || userId.equals("")){
+                userId = UserUtils.getUser().getId();
+            }
+            boolean status = false;
+            User user = UserUtils.getUser();
+            String comId = user.getComId();
+            if (comId.equals("1")){
+                status = true;
+            }
+            Workappshow workappshow = new Workappshow();
+            workappshow.setUserId(userId);
+            workappshow.setDelFlag("0");
+            workappshow.setCompanyId(UserUtils.get(userId).getComId());
+            List<Workappshow> list = workappshowService.findList(workappshow);
+            if(!status && list==null){
+                j.setSuccess(false);
+                j.setErrorCode(ErrorCode.code_2005);
+                j.setMsg("获取用户APP端信息展示失败");
+                j.put("data", new HashMap<>());
+            }else{
+                Workappshow workappshow1 = new Workappshow();
+                Map map = new HashMap();
+                if (list.size()==0){
+                    Workappshow appshow = new Workappshow();
+                    if (status){
+                        appshow.setUserId(userId);
+                        appshow.setDelFlag("1");
+                        appshow.setAuditStatus("1");
+                        appshow.setCalendarStatus("1");
+                        appshow.setCompanyRuleStatus("1");
+                        appshow.setNotifyStatus("1");
+                        appshow.setSignInStatus("1");
+                        appshow.setReportStatus("1");
+                        appshow.setMeetingStatus("1");
+                        appshow.setBusinessStatus("1");
+                        appshow.setUserId(userId);
+                        appshow.setCompanyId(UserUtils.getSelectCompany().getId());
+                        appshow.setManageCalendarStatus("1");
+                    }else {
+                        appshow.setUserId(userId);
+                        appshow.setDelFlag("0");
+                        appshow.setAuditStatus("0");
+                        appshow.setCalendarStatus("0");
+                        appshow.setCompanyRuleStatus("0");
+                        appshow.setNotifyStatus("0");
+                        appshow.setSignInStatus("0");
+                        appshow.setReportStatus("0");
+                        appshow.setMeetingStatus("0");
+                        appshow.setBusinessStatus("0");
+                        appshow.setUserId(userId);
+                        appshow.setCompanyId(UserUtils.getSelectCompany().getId());
+                        if (UserUtils.isManager()) {
+                            appshow.setManageCalendarStatus("0");
+                        } else {
+                            appshow.setManageCalendarStatus("1");
+                        }
+                        workappshowService.save(appshow);
+                    }
+                    list.add(appshow);
+                }
+                if (list.size()!=0){
+                    workappshow1 = list.get(0);
+                    map.put("notifyStatus",workappshow1.getNotifyStatus());
+                    map.put("companyRuleStatus",workappshow1.getCompanyRuleStatus());
+                    map.put("reportStatus",workappshow1.getReportStatus());
+                    map.put("calendarStatus",workappshow1.getCalendarStatus());
+                    map.put("auditStatus",workappshow1.getAuditStatus());
+                    map.put("signInStatus",workappshow1.getSignInStatus());
+                    map.put("businessStatus",workappshow1.getBusinessStatus());
+                    map.put("companyName",UserUtils.getSelectCompany().getName());
+                    map.put("companyId",UserUtils.getSelectCompany().getId());
+                    if (UserUtils.isManager()){
+                        map.put("manageCalendarStatus",workappshow1.getManageCalendarStatus());
+                        map.put("isManager","1");
+                    }else {
+                        map.put("isManager","0");
+                    }
+                }
+                j.put("data",map);
+                j.setMsg("获取用户APP端信息展示成功");
+                j.setErrorCode(ErrorCode.code_1004);
+            }
+        }catch (Exception e){
+            logger.info("Exception = "+e.getMessage());
+            j.setMsg("获取用户APP端信息展示失败");
+            j.setErrorCode(ErrorCode.code_2004);
+            j.setSuccess(false);
+        }finally {
+            lock.unlock();
+        }
+        return j;
+    }
+
+    /**
+     * 获取用户APP端信息展示
+     * @return json数据
+     */
+    @Transactional
+    @RequestMapping(value = "getAppShowNew", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getAppShowNew(String userId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        if (userId == null || userId.equals("")){
+            userId = UserUtils.getUser().getId();
+        }
+        boolean lockStatus = false;
+        Jedis jedis = null;
+        try {
+            jedis = JedisUtils.getResource();
+            if (jedis.get(userId)==null){
+                jedis.set(userId,userId);
+            }else {
+                jedis.del(userId);
+                lock.lock();
+                lockStatus = true;
+            }
+            /*if (request.getSession().getServletContext().getAttribute(userId)==null){
+                request.getSession().getServletContext().setAttribute(userId, userId);
+                //logger.info("--------------------------------uId="+request.getSession().getServletContext().getAttribute(userId));
+            }else {
+                request.getSession().getServletContext().removeAttribute(userId);
+                //logger.info("--------------------------------userId="+request.getSession().getServletContext().getAttribute(userId));
+                lock.lock();
+                lockStatus = true;
+             }*/
+            boolean status = false;
+            User user = UserUtils.getUser();
+            String comId = user.getComId();
+            if (comId.equals("1")){
+                status = true;
+            }
+            Workappshow workappshow = new Workappshow();
+            workappshow.setUserId(userId);
+            workappshow.setDelFlag("0");
+            workappshow.setCompanyId(UserUtils.get(userId).getComId());
+            List<Workappshow> list = workappshowService.findList(workappshow);
+            if(!status && list==null){
+                j.setSuccess(false);
+                j.setErrorCode(ErrorCode.code_2005);
+                j.setMsg("获取用户APP端信息展示失败");
+                j.put("data", new HashMap<>());
+            }else{
+                Workappshow workappshow1 = new Workappshow();
+                Map map = new HashMap();
+                if (list.size()==0){
+                    Workappshow appshow = new Workappshow();
+                    if (status){
+                        appshow.setUserId(userId);
+                        appshow.setDelFlag("1");
+                        appshow.setAuditStatus("1");
+                        appshow.setCompanyRuleStatus("1");
+                        appshow.setCalendarStatus("1");
+                        appshow.setNotifyStatus("1");
+                        appshow.setReportStatus("1");
+                        appshow.setSignInStatus("1");
+                        appshow.setMeetingStatus("1");
+                        appshow.setBusinessStatus("1");
+                        appshow.setUserId(userId);
+                        appshow.setCompanyId(UserUtils.getSelectCompany().getId());
+                        appshow.setManageCalendarStatus("1");
+                    }else {
+                        appshow.setUserId(userId);
+                        appshow.setDelFlag("0");
+                        appshow.setAuditStatus("0");
+                        appshow.setCalendarStatus("0");
+                        appshow.setCompanyRuleStatus("0");
+                        appshow.setReportStatus("0");
+                        appshow.setNotifyStatus("0");
+                        appshow.setSignInStatus("0");
+                        appshow.setMeetingStatus("0");
+                        appshow.setBusinessStatus("0");
+                        appshow.setUserId(userId);
+                        appshow.setCompanyId(UserUtils.getSelectCompany().getId());
+                        if (UserUtils.isManager()) {
+                            appshow.setManageCalendarStatus("0");
+                        } else {
+                            appshow.setManageCalendarStatus("1");
+                        }
+                        workappshowService.save(appshow);
+                    }
+                    list.add(appshow);
+                }
+                if (list.size()!=0){
+                    workappshow1 = list.get(0);
+                    map.put("notifyStatus",workappshow1.getNotifyStatus());
+                    map.put("companyRuleStatus",workappshow1.getCompanyRuleStatus());
+                    map.put("reportStatus",workappshow1.getReportStatus());
+                    map.put("calendarStatus",workappshow1.getCalendarStatus());
+                    map.put("auditStatus",workappshow1.getAuditStatus());
+                    map.put("signInStatus",workappshow1.getSignInStatus());
+                    map.put("meetingStatus",workappshow1.getMeetingStatus()==null?"1":workappshow1.getMeetingStatus());
+                    map.put("businessStatus",workappshow1.getBusinessStatus()==null?"1":workappshow1.getBusinessStatus());
+                    map.put("companyName",UserUtils.getSelectCompany().getName());
+                    map.put("companyId",UserUtils.getSelectCompany().getId());
+                    if (UserUtils.isManager()){
+                        map.put("manageCalendarStatus",workappshow1.getManageCalendarStatus());
+                        map.put("isManager","1");
+                    }else {
+                        map.put("isManager","0");
+                    }
+                }
+                j.put("data",map);
+                j.setMsg("获取用户APP端信息展示成功");
+                j.setErrorCode(ErrorCode.code_1004);
+            }
+        }catch (Exception e){
+            logger.info("Exception = "+e.getMessage());
+            j.setMsg("获取用户APP端信息展示失败");
+            j.setErrorCode(ErrorCode.code_2004);
+            j.setSuccess(false);
+        }finally {
+            if (lockStatus){
+                lock.unlock();
+            }else {
+                //request.getSession().getServletContext().removeAttribute(userId);
+                jedis.del(userId);
+            }
+            JedisUtils.returnResource(jedis);
+        }
+        return j;
+    }
+
+    /**
+     * 查看用户公告信息
+     * @return json数据
+     */
+    @RequestMapping(value = "createAppShow", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson createAppShow(String userId,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        try {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            if (userId == null || userId.equals("")){
+                userId = UserUtils.getUser().getId();
+            }
+            Workappshow appshow = new Workappshow();
+            appshow.setDelFlag("0");
+            appshow.setUserId(userId);
+            List<Workappshow> list = workappshowService.findList(appshow);
+            if (list!=null && list.size()!=0){
+                j.setMsg("添加用户APP端信息展示失败,信息已存在");
+                j.setErrorCode(ErrorCode.code_1009);
+                j.setSuccess(true);
+                return j;
+            }
+            Workappshow workappshow = new Workappshow();
+            workappshow.setUserId(userId);
+            workappshow.setDelFlag("0");
+            workappshow.setAuditStatus("0");
+            workappshow.setCalendarStatus("0");
+            workappshow.setCompanyRuleStatus("0");
+            workappshow.setNotifyStatus("0");
+            workappshow.setReportStatus("0");
+            workappshow.setMeetingStatus("0");
+            workappshow.setSignInStatus("0");
+            workappshow.setBusinessStatus("0");
+            workappshow.setUserId(userId);
+            if (UserUtils.isManager()){
+                workappshow.setManageCalendarStatus("0");
+            }else {
+                workappshow.setManageCalendarStatus("1");
+            }
+            workappshowService.save(workappshow);
+        }catch (Exception e){
+            logger.info("Exception = "+e.getMessage());
+            j.setMsg("添加用户APP端信息展示失败");
+            j.setErrorCode(ErrorCode.code_2004);
+            j.setSuccess(false);
+        }
+         return j;
+    }
+
+    /**
+     * 查看用户公告信息
+     * @return json数据
+     */
+    @RequestMapping(value = "updateAppShow", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson updateAppShow(String userId,String auditStatus,String notifyStatus,String companyRuleStatus,String calendarStatus,
+                                  String reportStatus,String signInStatus,String manageCalendarStatus,String businessStatus,
+                                  HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson j = new AjaxJson();
+        try {
+            lock.lock();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            if (userId == null || userId.equals("")){
+                userId = UserUtils.getUser().getId();
+            }
+            Workappshow appshow = new Workappshow();
+            appshow.setDelFlag("0");
+            appshow.setUserId(userId);
+            appshow.setCompanyId(UserUtils.getSelectCompany().getId());
+            List<Workappshow> list = workappshowService.findList(appshow);
+            if (list!=null && list.size()!=0){
+                Workappshow workappshow = list.get(0);
+                workappshow.setUserId(userId);
+                workappshow.setDelFlag("0");
+                workappshow.setAuditStatus(auditStatus);
+                workappshow.setCalendarStatus(calendarStatus);
+                workappshow.setCompanyRuleStatus(companyRuleStatus);
+                workappshow.setNotifyStatus(notifyStatus);
+                workappshow.setReportStatus(reportStatus);
+                workappshow.setSignInStatus(signInStatus);
+                workappshow.setBusinessStatus(businessStatus);
+                workappshow.setMeetingStatus("1");
+                if (UserUtils.isManager()){
+                    workappshow.setManageCalendarStatus("0");
+                }else {
+                    workappshow.setManageCalendarStatus("1");
+                }
+                if (manageCalendarStatus!=null && !manageCalendarStatus.equals("")){
+                    workappshow.setManageCalendarStatus(manageCalendarStatus);
+                }
+                workappshowService.save(workappshow);
+            }else {
+                j.setMsg("修改用户APP端信息展示失败,用户信息不存在");
+                j.setErrorCode(ErrorCode.code_2005);
+                j.setSuccess(false);
+            }
+        }catch (Exception e){
+            logger.info("Exception = "+e.getMessage());
+            j.setMsg("修改用户APP端信息展示失败");
+            j.setErrorCode(ErrorCode.code_2004);
+            j.setSuccess(false);
+        }finally {
+            lock.unlock();
+        }
+        return j;
+    }
+
+
+    /**
+     * 查看用户公告信息
+     * @return json数据
+     */
+    @RequestMapping(value = "updateAppShowNew", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson updateAppShowNew(String userId,String auditStatus,String notifyStatus,String companyRuleStatus,String calendarStatus,
+                                  String reportStatus,String signInStatus,String meetingStatus,String manageCalendarStatus,String businessStatus,
+                                  HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson j = new AjaxJson();
+        try {
+            lock.lock();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            if (userId == null || userId.equals("")){
+                userId = UserUtils.getUser().getId();
+            }
+            Workappshow appshow = new Workappshow();
+            appshow.setDelFlag("0");
+            appshow.setUserId(userId);
+            appshow.setCompanyId(UserUtils.getSelectCompany().getId());
+            List<Workappshow> list = workappshowService.findList(appshow);
+            if (list!=null && list.size()!=0){
+                Workappshow workappshow = list.get(0);
+                workappshow.setUserId(userId);
+                workappshow.setDelFlag("0");
+                workappshow.setAuditStatus(auditStatus);
+                workappshow.setCalendarStatus(calendarStatus);
+                workappshow.setCompanyRuleStatus(companyRuleStatus);
+                workappshow.setNotifyStatus(notifyStatus);
+                workappshow.setReportStatus(reportStatus);
+                workappshow.setMeetingStatus(meetingStatus==null?"1":meetingStatus);
+                workappshow.setBusinessStatus(businessStatus==null?"1":businessStatus);
+                workappshow.setSignInStatus(signInStatus);
+                if (UserUtils.isManager()){
+                    workappshow.setManageCalendarStatus("0");
+                }else {
+                    workappshow.setManageCalendarStatus("1");
+                }
+                if (manageCalendarStatus!=null && !manageCalendarStatus.equals("")){
+                    workappshow.setManageCalendarStatus(manageCalendarStatus);
+                }
+                workappshowService.save(workappshow);
+            }else {
+                j.setMsg("修改用户APP端信息展示失败,用户信息不存在");
+                j.setErrorCode(ErrorCode.code_2005);
+                j.setSuccess(false);
+            }
+        }catch (Exception e){
+            logger.info("Exception = "+e.getMessage());
+            j.setMsg("修改用户APP端信息展示失败");
+            j.setErrorCode(ErrorCode.code_2004);
+            j.setSuccess(false);
+        }finally {
+            lock.unlock();
+        }
+        return j;
+    }
+
+}

Fichier diff supprimé car celui-ci est trop grand
+ 3610 - 0
src/main/java/com/jeeplus/modules/API/works/businessmanagement/BusinessManagementController.java


+ 375 - 0
src/main/java/com/jeeplus/modules/API/works/calendar/CalendarController.java

@@ -0,0 +1,375 @@
+package com.jeeplus.modules.API.works.calendar;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.jeeplus.modules.utils.ErrorCode;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.iim.dao.MyCalendarDao;
+import com.jeeplus.modules.iim.entity.MyCalendar;
+import com.jeeplus.modules.iim.service.MyCalendarService;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+
+@Controller
+@RequestMapping(value = "${frontPath}/work/calendar")
+public class CalendarController extends BaseController {
+
+	@Autowired
+	private MyCalendarDao myCalendarDao;
+
+	@Autowired
+	private MyCalendarService myCalendarService;
+
+	/**
+	 * 本月所有拥有日程的日期
+	 *
+	 * @param id
+	 * @param year
+	 * @param month
+	 * @param request
+	 * @param response
+	 * @param redirectAttributes
+	 * @return
+	 * @throws ParseException
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getMyCalendarList", method = RequestMethod.GET)
+	public AjaxJson findMyCalendarList(HttpServletRequest request, HttpServletResponse response,
+									   RedirectAttributes redirectAttributes) throws ParseException {
+		AjaxJson json = new AjaxJson();
+		String userId = request.getParameter("userId");
+		String date = request.getParameter("date");
+		String str[] = date.split("-");
+		if (str.length == 2) {
+			String year = str[0];
+			String month = str[1];
+			if (month.length() == 2) {
+
+				MyCalendar myCalendar = new MyCalendar();
+				User user = UserUtils.get(userId);
+				myCalendar.setUser(user);
+				myCalendar.setCompanyId(UserUtils.getSelectCompany().getId());
+				List<MyCalendar> list = myCalendarDao.findList(myCalendar);
+				List<Map<String, String>> mapList = new ArrayList<Map<String, String>>();
+				int count = DateUtils.getMaxDay(Integer.parseInt(year), Integer.parseInt(month));
+				/*
+				 * if(month.equals("02")){ if((Integer.parseInt(year)%4==0 &&
+				 * Integer.parseInt(year)%100!=0) ||
+				 * Integer.parseInt(year)%400==0){ count=29; }else{ count=28; }
+				 * }else if(month.equals("01") || month.equals("03") ||
+				 * month.equals("05") || month.equals("07")||
+				 * month.equals("08")|| month.equals("10")||month.equals("12")){
+				 * count=31; }else if(month.equals("04") || month.equals("06")
+				 * || month.equals("09") || month.equals("11")){ count=30; }
+				 */
+				for (int j = 1; j <= count; j++) {
+					List<MyCalendar> newList = new ArrayList<MyCalendar>();
+					for (int i = 0; i < list.size(); i++) {
+						String date1 = list.get(i).getStart();
+						String end = list.get(i).getEnd();
+						String dates[] = date1.split("-");
+						if (dates.length > 1) {
+							int dates2 = Integer.parseInt(dates[2].substring(0, 2));
+							if (end == null || end.equals("")) {
+								if (dates[0].equals(year) && dates[1].equals(month) && dates2 == j) {
+									newList.add(list.get(i));
+								}
+							} else {
+								String datesEnd[] = end.split("-");
+								if (datesEnd.length > 1) {
+									int end2 = Integer.parseInt(datesEnd[2].substring(0, 2));
+									if (dates[0].equals(year) && dates[1].equals(month) && dates2 <= j && j <= end2) {
+										newList.add(list.get(i));
+									}
+								}
+							}
+						}
+					}
+					// System.out.println("=================" + newList.size());
+					String day = "";
+					if (j < 10) {
+						day = "0" + j;
+					} else {
+						day = j + "";
+					}
+					if (newList.size() > 0) {
+						String listIds = "";
+						for (int a = 0; a < newList.size(); a++) {
+							listIds = listIds + newList.get(a).getId() + ",";
+						}
+						Map<String, String> map = new HashMap<String, String>();
+
+						map.put("day", year + "-" + month + "-" + day);
+						map.put("type", "1");// 1代表当天有值0 代表当天无值
+						map.put("calendarIds", listIds);
+						mapList.add(map);
+					} else {
+						Map<String, String> map = new HashMap<String, String>();
+						map.put("day", year + "-" + month + "-" + day);
+						map.put("type", "0");// 1代表当天有值 0代表当天无值
+						map.put("calendarIds", "");
+						mapList.add(map);
+					}
+				}
+				json.setMsg("获取日程成功");
+				json.put("data", mapList);
+				json.setErrorCode(ErrorCode.code_1004);
+			} else {
+				json.setMsg("日期格式错误,获取日程失败");
+				json.put("data", Lists.newArrayList());
+				json.setErrorCode(ErrorCode.code_2002);
+				json.setSuccess(false);
+			}
+		} else {
+			json.setMsg("日期格式错误,获取日程失败");
+			json.put("data", Lists.newArrayList());
+			json.setErrorCode(ErrorCode.code_2002);
+			json.setSuccess(false);
+		}
+		return json;
+	}
+
+	/**
+	 * 获取日程列表2
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getCalendarList", method = RequestMethod.GET)
+	public AjaxJson getCalendarList(HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j = new AjaxJson();
+		String userId = request.getParameter("userId");
+		User user = UserUtils.get(userId);
+		MyCalendar myCalendar = new MyCalendar();
+		myCalendar.setUser(user);
+		myCalendar.setCompanyId(UserUtils.getSelectCompany().getId());
+		List<MyCalendar> list = myCalendarDao.findList(myCalendar);
+		List<Map<String, Object>> mapList = Lists.newArrayList();
+		for (MyCalendar my : list) {
+			Map<String, Object> map = Maps.newHashMap();
+			String date = my.getStart();
+			String dates[] = date.split("-");
+			String day = dates[0] + "-" + dates[1] + "-" + dates[2].substring(0, 2);
+			map.put("date", day);
+			map.put("calendarId", my.getId());
+			map.put("type", "1");
+			mapList.add(map);
+		}
+
+		if (mapList != null) {
+			j.put("data", mapList);
+			j.setMsg("获取列表成功");
+			j.setErrorCode(ErrorCode.code_1004);
+		} else {
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("获取列表失败");
+			j.put("data", mapList);
+		}
+		return j;
+	}
+
+	/**
+	 * 获取某日的日程详情
+	 *
+	 * @param request
+	 * @param response
+	 * @param redirectAttributes
+	 * @return
+	 * @throws ParseException
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getTodayCalendarList", method = RequestMethod.GET)
+	public AjaxJson getTodayCalendarList(HttpServletRequest request, HttpServletResponse response,
+										 RedirectAttributes redirectAttributes) throws ParseException {
+		AjaxJson json = new AjaxJson();
+		String calendarIds = request.getParameter("calendarIds");
+		String ids[] = calendarIds.split(",");
+		List<Map<String, Object>> mapList = Lists.newArrayList();
+		List<MyCalendar> MycalendarList = new ArrayList<MyCalendar>();
+		for (int i = 0; i < ids.length; i++) {
+			MycalendarList.add(myCalendarDao.get(ids[i]));
+		}
+		for (MyCalendar my : MycalendarList) {
+			Map<String, Object> map = Maps.newHashMap();
+			if (my != null) {
+				map.put("calendarId", my.getId());
+				map.put("title", my.getTitle());
+				map.put("start", my.getStart());
+				map.put("end", my.getEnd());
+				map.put("location", my.getLocation());
+				map.put("notice", my.getNotice());
+				map.put("companyId", my.getCompanyId());
+				mapList.add(map);
+			}
+			// my.setUser(null); // 返回值内去掉user内容
+		}
+		if (mapList == null) {
+			json.setSuccess(false);
+			json.setErrorCode(ErrorCode.code_2004);
+			json.setMsg("获取当日日程失败");
+			json.put("data", mapList);
+		} else {
+			json.setMsg("获取当日日程成功");
+			json.put("data", mapList);
+			json.setErrorCode(ErrorCode.code_1004);
+		}
+		return json;
+
+	}
+
+	/**
+	 * 获取某日日程2
+	 */
+
+	@ResponseBody
+	@RequestMapping(value = "getCalendarByDate", method = RequestMethod.GET)
+	public AjaxJson getCalendarByDate(HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j = new AjaxJson();
+		MyCalendar myCalendar = new MyCalendar();
+		String date = request.getParameter("date");
+		User user = UserUtils.getUser();
+		String str[] = date.split("-");
+		myCalendar.setUser(user);
+		myCalendar.setStart(date+" 23:59:59");
+		myCalendar.setEnd(date+" 00:00:00");
+		myCalendar.setCompanyId(UserUtils.getSelectCompany().getId());
+		List<MyCalendar> list = myCalendarService.findListByDate(myCalendar);
+		List<Map<String, Object>> mapList = Lists.newArrayList();
+		if (list != null && !list.isEmpty()) {
+			for (MyCalendar my : list) {
+				Map<String, Object> map = Maps.newHashMap();
+				if (my != null) {
+					map.put("calendarId", my.getId());
+					map.put("title", my.getTitle());
+					map.put("start", my.getStart());
+					map.put("end", my.getEnd());
+					map.put("location", my.getLocation());
+					map.put("notice", my.getNotice());
+					map.put("companyId", my.getCompanyId());
+					mapList.add(map);
+				}
+			}
+			if (str.length == 3) {
+				if (str[1].length() == 2) {
+					if (str[2].length() == 2) {
+						j.put("data", mapList);
+						j.setMsg("获取当日日程成功");
+						j.setErrorCode(ErrorCode.code_1004);
+					} else {
+						j.setMsg("获取当日日程失败");
+						j.put("data", Lists.newArrayList());
+						j.setErrorCode(ErrorCode.code_2005);
+						j.setSuccess(false);
+					}
+				} else {
+					j.setMsg("获取当日日程失败");
+					j.put("data", Lists.newArrayList());
+					j.setErrorCode(ErrorCode.code_2005);
+					j.setSuccess(false);
+				}
+			} else {
+				j.setMsg("获取当日日程失败");
+				j.put("data", Lists.newArrayList());
+				j.setErrorCode(ErrorCode.code_2005);
+				j.setSuccess(false);
+			}
+		} else {
+			j.setMsg("今日无日程");
+			j.put("data", Lists.newArrayList());
+			j.setErrorCode(ErrorCode.code_1004);
+		}
+		return j;
+
+	}
+
+	/**
+	 * 获取日程详情
+	 *
+	 * @param request
+	 * @param response
+	 * @param redirectAttributes
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getCalendarDetail", method = RequestMethod.GET)
+	public AjaxJson getCalendarDetail(HttpServletRequest request, HttpServletResponse response,
+									  RedirectAttributes redirectAttributes) {
+		AjaxJson json = new AjaxJson();
+		String calendarId = request.getParameter("calendarId");
+		MyCalendar g = myCalendarDao.get(calendarId);
+		g.setUser(null);
+		json.put("data", g);
+		json.setErrorCode(ErrorCode.code_1004);
+		return json;
+
+	}
+
+	/**
+	 * 删除日程
+	 *
+	 * @param request
+	 * @param response
+	 * @param redirectAttributes
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping(value = "deleteCalendar", method = RequestMethod.GET)
+	public AjaxJson deleteCalendar(HttpServletRequest request, HttpServletResponse response,
+								   RedirectAttributes redirectAttributes) {
+		AjaxJson json = new AjaxJson();
+		String calendarId = request.getParameter("calendarId");
+		MyCalendar mycalendar = new MyCalendar();
+		mycalendar = myCalendarDao.get(calendarId);
+		if (calendarId != null && !calendarId.equals("") && mycalendar != null) {
+			myCalendarDao.delete(mycalendar);
+			json.setMsg("删除成功");
+			json.put("data", "success");
+			json.setErrorCode(ErrorCode.code_1004);
+		} else {
+			json.setMsg("删除失败");
+			json.put("data", "false");
+			json.setErrorCode(ErrorCode.code_2006);
+			json.setSuccess(false);
+		}
+		return json;
+	}
+
+	/**
+	 * 新增日程,修改日程
+	 *
+	 * @param request
+	 * @param response
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping(value = "saveCalendar", method = RequestMethod.POST)
+	public AjaxJson addCalendar(HttpServletRequest request, HttpServletResponse response)throws Exception {
+		AjaxJson j = new AjaxJson();
+		HashMap<String, String> requestMap = findRequestMap(request);
+
+		MyCalendar myCalendar = myCalendarService.saveCalendar(requestMap);
+
+		j.put("date", myCalendar.getStart());
+		j.setMsg("操作日程成功");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+}

+ 308 - 0
src/main/java/com/jeeplus/modules/API/works/goout/gooutMobileController.java

@@ -0,0 +1,308 @@
+package com.jeeplus.modules.API.works.goout;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.JPushClientUtil;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.pushinfo.entity.Pushinfo;
+import com.jeeplus.modules.pushinfo.service.PushinfoService;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workapprovalcopy.entity.ApprovalCopy;
+import com.jeeplus.modules.workapprovalcopy.service.ApprovalCopyService;
+import com.jeeplus.modules.workgoout.entity.GoOut;
+import com.jeeplus.modules.workgoout.service.GoOutService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.TaskService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 请假流程
+ */
+@RequestMapping(value = "${frontPath}/goout/goout")
+@Controller
+public class gooutMobileController extends BaseController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+    @Autowired
+    protected GoOutService gooutService;
+
+    @Autowired
+    protected RuntimeService runtimeService;
+
+    @Autowired
+    protected TaskService taskService;
+
+    @Autowired
+    private ApprovalCopyService approvalCopyService;
+
+    @Autowired
+    private ActTaskService actTaskService;
+
+    @Autowired
+    private PushinfoService pushinfoService;
+
+    /**
+     * 启动外出流程
+     * @param
+     */
+    @Transactional
+    @RequestMapping(value = "saveGoOut", method = RequestMethod.POST)
+    @ResponseBody
+    public AjaxJson saveGoOut(HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson ajaxJson = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            HashMap<String, String> requestMap = findRequestMap(request);
+            Map<String, Object> variables = Maps.newHashMap();
+            GoOut goOut=new GoOut();
+           /* Date startTime = sdf.parse(start);//格式化时间2017-07-22 13:15:16
+            Date endTime = sdf.parse(end);//格式化时间*/
+            //String remarks = requestMap.get("remarks"); // 新加字段 请假天数
+            String start = URLDecoder.decode(requestMap.get("startTime")==null?"":requestMap.get("startTime"), "UTF-8");
+            String end = URLDecoder.decode(requestMap.get("endTime")==null?"":requestMap.get("endTime"), "UTF-8");
+            String userId = URLDecoder.decode(requestMap.get("userId")==null?"":requestMap.get("userId"), "UTF-8");
+            String gooutDay = URLDecoder.decode(requestMap.get("gooutDay")==null?"":requestMap.get("gooutDay"), "UTF-8");
+            String gooutTime = URLDecoder.decode(requestMap.get("gooutTime")==null?"":requestMap.get("gooutTime"), "UTF-8");
+            String gooutReason = URLDecoder.decode(requestMap.get("gooutReason")==null?"":requestMap.get("gooutReason"), "UTF-8");
+            String approverId = URLDecoder.decode(requestMap.get("approverId")==null?"":requestMap.get("approverId"), "UTF-8");
+            String CCId = URLDecoder.decode(requestMap.get("CCId")==null?"":requestMap.get("CCId"), "UTF-8");
+            String delFlag="0"; //审核流程状态标记 0 待审核 1 审核完成
+            User user = new User();
+            String type = "1";
+            String alias = "1";
+            List<String> assigneeList=new ArrayList<String>(); //分配任务的人员
+            if(approverId!=null && !approverId.equals("")) {
+                if (approverId.contains(UserUtils.getUser().getId())){
+                    ajaxJson.setMsg("外出申请失败,审批人不能为本人");
+                    ajaxJson.setErrorCode(ErrorCode.code_1010);
+                    ajaxJson.setSuccess(false);
+                    return ajaxJson;
+                }
+                String[] approverIds = approverId.split(",");
+                for (int i =0 ;i<approverIds.length;i++){
+                    assigneeList.add(approverIds[i]);
+                }
+                type = approverIds.length+"";
+                alias = approverIds[0];
+            }
+            variables.put("assigneeList", assigneeList);
+            variables.put("count",assigneeList.size());
+            User CC = new User();
+            CC.setId(CCId);
+            user.setId(userId);
+            goOut.setGooutDay(gooutDay);
+            goOut.setGooutTime(gooutTime);
+            goOut.setGooutReason(gooutReason);
+            //goOut.setRemarks(remarks);
+            goOut.setUser(user);
+            goOut.setStartTime(start);
+            goOut.setEndTime(end);
+            goOut.setCreateBy(user);
+            goOut.setUpdateBy(user);
+            goOut.setStatus("1");
+            goOut.setDelFlag(delFlag);
+            goOut.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            goOut.setOfficeId(UserUtils.getSelectOffice()==null?"":UserUtils.getSelectOffice().getId());
+            gooutService.save(goOut, variables,type);
+            ApprovalCopy approvalCopy = new ApprovalCopy();
+            approvalCopy.setCCId(CCId==null?"":CCId);
+            approvalCopy.setUserId(userId);
+            approvalCopy.setType("goout");
+            approvalCopy.setApprovalId(goOut.getId());
+            approvalCopy.setRemarks(gooutReason);
+            approvalCopy.setApproverId(approverId);
+            approvalCopy.setReadFlag("0");
+            approvalCopyService.save(approvalCopy);
+
+            //给抄送人、审批人发送通知
+            if(approvalCopy!=null && org.apache.commons.lang3.StringUtils.isNotBlank(approvalCopy.getId())){
+                String chaosongIds = approvalCopy.getCCId();//给所有抄送人发送通知
+                String shenpiIds = alias;//给审批流程的第一个人发送通知
+                gooutService.sendNotify(chaosongIds,shenpiIds,approvalCopy.getApprovalId());
+                String content = "审批信息 申请人:" + user.getName() + ",外出申请: 待审批!";
+                UserUtils.pushIm(alias,content);
+            }
+
+            String title="审批";
+            String content =  UserUtils.getUser().getName()+"的外出申请需要你审批";
+            String status = "待审批";
+            String remarks =  "开始时间:"+start+ "\n"
+                    +"结束时间:"+end+ "\n"
+                    +"外出天数:"+gooutDay;
+            Map extras = new HashMap();
+            extras.put("type", "4001");
+            extras.put("id", goOut.getId());
+            extras.put("procDefKey", "goout");
+
+            boolean b = JPushClientUtil.sendNotificationToAlias(title, content, extras, alias);
+            Pushinfo pushinfo = new Pushinfo();
+            pushinfo.setCurrentUser(UserUtils.getUser());
+            pushinfo.setRemarks(remarks);
+            pushinfo.setUserId(UserUtils.getUser().getId());
+            pushinfo.setType("4001");
+            pushinfo.setPushId(goOut.getId());
+            pushinfo.setTitle(title);
+            pushinfo.setContent(content);
+            pushinfo.setStatus(status);
+            pushinfo.setPushUserId(alias);
+            pushinfo.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            pushinfo.setAddcontent("goout");
+            pushinfo.setMobile("ios,android");
+            pushinfo.setParentType("singleApproval");
+            pushinfoService.save(pushinfo);
+            if (b){
+                ajaxJson.setSuccess(true);
+                ajaxJson.setErrorCode(ErrorCode.code_1004);
+                ajaxJson.setMsg("外出申请已经提交");
+                ajaxJson.put("id", goOut.getId());
+            }else {
+                ajaxJson.setMsg("外出申请推送失败");
+                ajaxJson.setErrorCode(ErrorCode.code_2006);
+                ajaxJson.setSuccess(false);
+            }
+        } catch (Exception e) {
+            logger.error("外出申请流程失败:", e);
+            ajaxJson.setSuccess(false);
+            ajaxJson.setErrorCode(ErrorCode.code_2004);
+            ajaxJson.setMsg("外出申请流程失败");
+        }
+        return ajaxJson;
+    }
+
+
+    /**
+     * 查看待审批列表
+     * @param
+     * @return
+     * */
+    /*@RequestMapping(value = "todoList", method = RequestMethod.GET)
+    @ResponseBody
+     public AjaxJson todoList(String userId,HttpServletRequest request, HttpServletResponse response) throws Exception {
+     List<Leave> list = new ArrayList<Leave>();
+     if(userId!=null){
+         list = leaveService.findTodoTasks(userId);
+     }else if(UserUtils.getUser()!=null){
+         list = leaveService.findTodoTasks(UserUtils.getUser().getId());
+     }
+
+     AjaxJson json=new AjaxJson();
+     try {
+     LinkedHashMap<String, Object> map=new LinkedHashMap();
+     json.setSuccess(true);
+     json.setErrorCode("-1");
+     map.put("body",list);
+     json.setBody(map);
+     } catch (Exception e) {
+     logger.error("查看待审批列表失败:", e);
+     json.setSuccess(false);
+     json.setErrorCode("-1");
+     json.setMsg("查看待审批列表失败");
+     }
+     return json;
+     }*/
+
+    /**
+     * 保存附件
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveFile",method=RequestMethod.POST)
+    public AjaxJson saveFile(MultipartHttpServletRequest multiRequest,HttpServletRequest servletRequest) throws Exception{
+        AjaxJson j=new AjaxJson();
+        try {
+            System.out.println("-----------开始------------------");
+            String id = multiRequest.getParameter("id");
+            GoOut goOut =  gooutService.getById(id);
+            OSSClientUtil ossUtil =new OSSClientUtil();
+
+            Iterator<String> fileNames = multiRequest.getFileNames();
+            String thisFiles = goOut.getFiles();
+            String filePaths= "";
+
+            while(fileNames.hasNext()){
+
+                //取得上传文件
+                MultipartFile file = multiRequest.getFile(fileNames.next());
+                if(file != null){
+                    //取得当前上传文件的文件名称
+                    //String filePath= ossUtil.uploadFile2OSS(file, "goout");
+                    OSSClientUtil ossClientUtil = new OSSClientUtil();
+                    String filePath= gooutService.uploadFile(ossClientUtil,file,goOut,"75");
+                    filePaths = filePath;
+                }
+            }
+           /* if(thisFiles==null || thisFiles.equals("")){
+                if(filePaths.contains(",")){
+                    goOut.setFiles(filePaths.substring(1, filePaths.length() - 1));
+                }else {
+                    goOut.setFiles(filePaths);
+                }
+            }else{
+                filePaths = thisFiles+","+filePaths;
+                goOut.setFiles(filePaths);
+            }
+            gooutService.saveFile(goOut);*/
+            System.out.println("-----------结束------------------");
+            j.put("filePath",filePaths);
+            j.setSuccess(true);
+            j.setErrorCode(ErrorCode.code_1004);
+            j.setMsg("上传成功!");
+        }catch (Exception e){
+            j.put("filePath","");
+            j.setErrorCode(ErrorCode.code_2004);
+            j.setSuccess(false);
+            j.setMsg("上传失败!");
+        }finally {
+            return j;
+        }
+    }
+
+    /**
+     * 获取详情
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "getGoOutById", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getGoOutById(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        String id = request.getParameter("id");
+        String type = request.getParameter("type");
+        Map map = gooutService.getGoOutById(id,type);
+        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;
+    }
+
+}

+ 355 - 0
src/main/java/com/jeeplus/modules/API/works/leavemobliecontroller/LeaveMobileController.java

@@ -0,0 +1,355 @@
+package com.jeeplus.modules.API.works.leavemobliecontroller;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.JPushClientUtil;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.common.websocket.onchat.ChatServerPool;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.oa.entity.Leave;
+import com.jeeplus.modules.oa.service.LeaveService;
+import com.jeeplus.modules.pushinfo.entity.Pushinfo;
+import com.jeeplus.modules.pushinfo.service.PushinfoService;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workapprovalcopy.entity.ApprovalCopy;
+import com.jeeplus.modules.workapprovalcopy.service.ApprovalCopyService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.TaskService;
+import org.apache.commons.lang3.StringUtils;
+import org.java_websocket.WebSocket;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 请假流程
+ */
+@RequestMapping(value = "${frontPath}/leave/leave")
+@Controller
+public class LeaveMobileController  extends BaseController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+    @Autowired
+    protected LeaveService leaveService;
+
+    @Autowired
+    protected RuntimeService runtimeService;
+
+    @Autowired
+    protected TaskService taskService;
+
+    @Autowired
+    private ApprovalCopyService approvalCopyService;
+
+    @Autowired
+    private ActTaskService actTaskService;
+
+    @Autowired
+    private PushinfoService pushinfoService;
+
+    @RequestMapping(value = "cesi", method = RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson saveLeave(String approverId,HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson ajaxJson = new AjaxJson();
+        User approver =UserUtils.get(approverId);
+        if(approver==null || approver.getName()==null){
+            ajaxJson.setSuccess(false);
+            ajaxJson.setErrorCode(ErrorCode.code_2003);
+            ajaxJson.setMsg("请假申请流程失败,审批人不能为空");
+            return ajaxJson;
+        }
+        ajaxJson.setMsg("zzz");
+        return ajaxJson;
+    }
+    /**
+     * 启动请假流程
+     * @param
+     */
+    @Transactional
+    @RequestMapping(value = "saveLeave", method = RequestMethod.POST)
+    @ResponseBody
+    public AjaxJson saveLeave(HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson ajaxJson = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            HashMap<String, String> requestMap = findRequestMap(request);
+            logger.info("requestMap="+requestMap);
+            Map<String, Object> variables = Maps.newHashMap();
+            Leave leave=new Leave();
+            //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            /*Date startTime = sdf.parse(start);//格式化时间2017-07-22 13:15:16
+            Date endTime = sdf.parse(end);//格式化时间*/
+            String start = URLDecoder.decode(requestMap.get("startTime")==null?"":requestMap.get("startTime"), "UTF-8");
+            String end = URLDecoder.decode(requestMap.get("endTime")==null?"":requestMap.get("endTime"), "UTF-8");
+            logger.info("start="+start);
+            logger.info("end="+end);
+            String id = URLDecoder.decode(requestMap.get("userId")==null?"":requestMap.get("userId"), "UTF-8");
+            String reason = URLDecoder.decode(requestMap.get("reason")==null?"":requestMap.get("reason"), "UTF-8");
+            String leaveTime = URLDecoder.decode(requestMap.get("leaveTime")==null?"":requestMap.get("leaveTime"), "UTF-8");
+            String leaveType = URLDecoder.decode(requestMap.get("leaveType")==null?"":requestMap.get("leaveType"), "UTF-8");
+            String leaveDays = URLDecoder.decode(requestMap.get("leaveDays")==null?"":requestMap.get("leaveDays"), "UTF-8");
+            String approverId = URLDecoder.decode(requestMap.get("approverId")==null?"":requestMap.get("approverId"), "UTF-8");
+            String CCId = URLDecoder.decode(requestMap.get("CCId")==null?"":requestMap.get("CCId"), "UTF-8");
+
+            String delFlag="0"; //审核流程状态标记 0 待审核 1 审核完成
+            User user = new User();
+            String type = "1";
+            String alias = "1";
+            List<String> assigneeList=new ArrayList<String>(); //分配任务的人员
+            if(approverId!=null && !approverId.equals("")) {
+                if (approverId.contains(UserUtils.getUser().getId())){
+                    ajaxJson.setMsg("请假申请失败,审批人不能为本人");
+                    ajaxJson.setErrorCode(ErrorCode.code_2003);
+                    ajaxJson.setSuccess(false);
+                    return ajaxJson;
+                }
+                String[] approverIds = approverId.split(",");
+                for (int i =0 ;i<approverIds.length;i++){
+                    assigneeList.add(approverIds[i]);
+                    /*String key = "auditUserId"+ (i+1);
+                    variables.put(key, approverIds[i]);*/
+                }
+                type = approverIds.length+"";
+                alias = approverIds[0];
+            }
+            variables.put("assigneeList", assigneeList);
+            variables.put("count",assigneeList.size());
+            User CC = new User();
+            CC.setId(CCId);
+            user.setId(id);
+            leave.setUser(user);
+            leave.setReason(reason);
+            leave.setStartTime(start);
+            leave.setEndTime(end);
+            leave.setLeaveTime(leaveTime);
+            leave.setLeaveDays(leaveDays);
+            leave.setLeaveType(leaveType);
+            leave.setCreateBy(user);
+            leave.setUpdateBy(user);
+            leave.setStatus("1");
+            leave.setDelFlag(delFlag);
+            leave.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            leave.setOfficeId(UserUtils.getSelectOffice()==null?"":UserUtils.getSelectOffice().getId());
+            leaveService.save(leave, variables,type);
+            ApprovalCopy approvalCopy = new ApprovalCopy();
+            approvalCopy.setCCId(CCId==null?"":CCId);
+            approvalCopy.setUserId(id);
+            approvalCopy.setType("leave");
+            approvalCopy.setApprovalId(leave.getId());
+            approvalCopy.setRemarks(reason);
+            approvalCopy.setApproverId(approverId);
+            approvalCopy.setReadFlag("0");
+            approvalCopyService.save(approvalCopy);
+
+            //给抄送人、审批人发送通知
+            if(approvalCopy!=null && StringUtils.isNotBlank(approvalCopy.getId())){
+                String chaosongIds = approvalCopy.getCCId();//给所有抄送人发送通知
+                String shenpiIds = alias;//给审批流程的第一个人发送通知
+                leaveService.sendNotify(chaosongIds,shenpiIds,approvalCopy.getApprovalId());
+                UserUtils.pushIm(shenpiIds," 申请人:\" + user.getName() + \",请假申请 待审批!");
+                /*List<WebSocket> toUserConns = ChatServerPool.getWebSocketByUser(shenpiIds);
+                for (WebSocket toUserConn:toUserConns) {
+                    String message = "{\"to\":\""+alias+"\"," +
+                            "\"msg\":\"审批信息 申请人:" + user.getName() + ",请假申请 待审批!\"," +
+                            "\"useType\":\"sys\"}";
+                    ChatServerPool.sendMessageToUser(toUserConn, message);//同时向本人发送消息
+                }*/
+            }
+
+            String title="审批";
+            String content =  UserUtils.getUser().getName()+"的请假申请需要你审批";
+            String status = "待审批";
+            if (leaveType.equals("1")){
+                //1:事假、2:病假、3:调休、4:年假、5:婚假、6:产假、7:其他
+                leaveType = "事假";
+            }else if (leaveType.equals("2")){
+                leaveType = "病假";
+            }else if (leaveType.equals("3")){
+                leaveType = "调休";
+            }else if (leaveType.equals("4")){
+                leaveType = "年假";
+            }else if (leaveType.equals("5")){
+                leaveType = "婚假";
+            }else if (leaveType.equals("6")){
+                leaveType = "产假";
+            }else if (leaveType.equals("7")){
+                leaveType = "其他";
+            }
+            String remarks = "请假类型:"+leaveType+ "\n"
+                    +"开始时间:"+start+ "\n"
+                    +"结束时间:"+end;
+            Map extras = new HashMap();
+            extras.put("type", "4001");
+            extras.put("id", leave.getId());
+            extras.put("procDefKey", "leave");
+
+            boolean b = JPushClientUtil.sendNotificationToAlias(title, content, extras, alias);
+            Pushinfo pushinfo = new Pushinfo();
+            pushinfo.setCurrentUser(UserUtils.getUser());
+            pushinfo.setRemarks(remarks);
+            pushinfo.setUserId(UserUtils.getUser().getId());
+            pushinfo.setType("4001");
+            pushinfo.setPushId(leave.getId());
+            pushinfo.setTitle(title);
+            pushinfo.setContent(content);
+            pushinfo.setStatus(status);
+            pushinfo.setAddcontent("leave");
+            pushinfo.setPushUserId(alias);
+            pushinfo.setParentType("singleApproval");
+            pushinfo.setMobile("ios,android");
+            pushinfo.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            pushinfoService.save(pushinfo);
+            if (b){
+                ajaxJson.setSuccess(true);
+                ajaxJson.setErrorCode(ErrorCode.code_1004);
+                ajaxJson.setMsg("请假申请已经提交");
+                ajaxJson.put("id", leave.getId());
+            }else {
+                ajaxJson.setMsg("请假申请推送失败");
+                ajaxJson.setErrorCode(ErrorCode.code_2006);
+                ajaxJson.setSuccess(false);
+            }
+        } catch (Exception e) {
+            logger.error("启动请假流程失败:", e);
+            ajaxJson.setSuccess(false);
+            ajaxJson.setErrorCode(ErrorCode.code_2004);
+            ajaxJson.setMsg("启动请假流程失败");
+        }
+        return ajaxJson;
+    }
+
+
+    /**
+     * 查看待审批列表
+     * @param
+     * @return
+     * */
+    @RequestMapping(value = "todoList", method = RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson todoList(String userId,HttpServletRequest request, HttpServletResponse response) throws Exception {
+        List<Leave> list = new ArrayList<Leave>();
+        if(userId!=null){
+            list = leaveService.findTodoTasks(userId);
+        }else if(UserUtils.getUser()!=null){
+            list = leaveService.findTodoTasks(UserUtils.getUser().getId());
+        }
+
+        AjaxJson json=new AjaxJson();
+        try {
+            LinkedHashMap<String, Object> map=new LinkedHashMap();
+            json.setSuccess(true);
+            json.setErrorCode(ErrorCode.code_1004);
+            map.put("data",list);
+            json.setBody(map);
+        } catch (Exception e) {
+            logger.error("查看待审批列表失败:", e);
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2004);
+            json.setMsg("查看待审批列表失败");
+        }
+        return json;
+    }
+
+    /**
+     * 保存附件
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveFile",method=RequestMethod.POST)
+    public AjaxJson saveFile(MultipartHttpServletRequest multiRequest,HttpServletRequest servletRequest) throws Exception{
+        AjaxJson j=new AjaxJson();
+        try {
+            String id = multiRequest.getParameter("id");
+            Leave leave =  leaveService.getById(id);
+            OSSClientUtil ossUtil =new OSSClientUtil();
+
+            Iterator<String> fileNames = multiRequest.getFileNames();
+            String thisFiles = leave.getFiles();
+            String filePaths= "";
+            System.out.println("-----------开始------------------");
+            while(fileNames.hasNext()){
+
+                //取得上传文件
+                MultipartFile file = multiRequest.getFile(fileNames.next());
+                if(file != null){
+                    OSSClientUtil ossClientUtil = new OSSClientUtil();
+                    String filePath= leaveService.uploadFile(ossClientUtil,file,leave,"71");
+                    //取得当前上传文件的文件名称
+                    //String filePath= ossUtil.uploadFile2OSS(file, "leave");
+                    filePaths = filePath;
+                }
+            }
+            /*if(thisFiles==null || thisFiles.equals("")){
+                if(filePaths.contains(",")){
+                    leave.setFiles(filePaths.substring(1, filePaths.length() - 1));
+                }else {
+                    leave.setFiles(filePaths);
+                }
+            }else{
+                filePaths = thisFiles+","+filePaths;
+                leave.setFiles(filePaths);
+            }
+            leaveService.saveFile(leave);
+            */
+            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;
+        }
+    }
+
+    /**
+     * 获取详情
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "getLeaveById", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getLeaveById(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        String id = request.getParameter("id");
+        String type = request.getParameter("type");
+        Map map = leaveService.getLeaveById(id,type);
+        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;
+    }
+
+}

+ 258 - 0
src/main/java/com/jeeplus/modules/API/works/manageCalendar/manageCalendarController.java

@@ -0,0 +1,258 @@
+package com.jeeplus.modules.API.works.manageCalendar;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.modules.iim.entity.MyCalendar;
+import com.jeeplus.modules.oa.service.ManageCalendarService;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+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.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.ParseException;
+import java.util.*;
+import java.util.logging.Logger;
+
+/**
+ * Created by Meng on 2017/6/20.
+ */
+@Controller
+@RequestMapping(value = "${frontPath}/work/manageCalendar")
+public class manageCalendarController {
+
+    @Autowired
+    ManageCalendarService manageCalendarService;
+
+    /**
+     * 本月所有拥有报告的日期
+     *
+     * @return
+     * @throws java.text.ParseException
+     */
+    @ResponseBody
+    @RequestMapping(value = "getManageCalendarByMonth", method = RequestMethod.GET)
+    public AjaxJson getManageCalendarByMonth(HttpServletRequest request) throws ParseException {
+        AjaxJson json = new AjaxJson();
+        String userId = request.getParameter("userId");
+        String officeId = request.getParameter("officeId");
+        String date = request.getParameter("date");
+        User user;
+        if(UserUtils.getUser()!=null){
+            user =UserUtils.getUser();
+        }else {
+            user =UserUtils.get(userId);
+        }
+        if(!UserUtils.isManager()){
+            json.setMsg("当前用户在本公司非管理员,您无权查看管理日志");
+            json.setErrorCode(ErrorCode.code_1010);
+            json.setSuccess(false);
+            return json;
+        }
+        List list =  manageCalendarService.getManageCalendarByMonth(date);
+        json.put("data",list);
+        json.setErrorCode(ErrorCode.code_1004);
+        return json;
+    }
+
+    /**
+     * 指定日期所有报告
+     *
+     * @return
+     * @throws java.text.ParseException
+     */
+    @ResponseBody
+    @RequestMapping(value = "getManageCalendarByDate", method = RequestMethod.GET)
+    public AjaxJson getManageCalendarByDate(HttpServletRequest request) throws ParseException {
+        AjaxJson json = new AjaxJson();
+        String userId = request.getParameter("userId");
+
+        String date = request.getParameter("date");
+        User user = UserUtils.getUser();
+        if(user == null || user.getId() ==null){
+            user = UserUtils.get(userId);
+        }else{
+        }
+        try{
+            if(!UserUtils.isManager()){
+                json.setMsg("当前用户在本公司非管理员,您无权查看管理日志");
+                json.setErrorCode(ErrorCode.code_1010);
+                json.setSuccess(false);
+                return json;
+            }
+        }catch (Exception e){
+            json.setMsg("当前用户在本公司非管理员,您无权查看管理日志");
+            json.setErrorCode(ErrorCode.code_1010);
+            json.setSuccess(false);
+            return json;
+        }
+        List list =  manageCalendarService.getReportUserAppList(date);
+        json.put("data",list);
+        json.setErrorCode(ErrorCode.code_1004);
+        return json;
+    }
+
+    /**
+     * 指定日期所有用户
+     *
+     * @return
+     * @throws java.text.ParseException
+     */
+    @ResponseBody
+    @RequestMapping(value = "getUsersByDate", method = RequestMethod.GET)
+    public AjaxJson getUsersByDate(HttpServletRequest request) throws ParseException {
+        AjaxJson json = new AjaxJson();
+        String userId = request.getParameter("userId");
+        String count = request.getParameter("count");
+        String date = request.getParameter("date");
+        User user = UserUtils.getUser();
+        if(user == null || user.getId() ==null){
+            user = UserUtils.get(userId);
+        }else{
+        }
+        try{
+            if(!UserUtils.isManager()){
+                json.setMsg("当前用户在本公司非管理员,您无权查看管理日志");
+                json.setErrorCode(ErrorCode.code_1010);
+                json.setSuccess(false);
+                return json;
+            }
+        }catch (Exception e){
+            json.setMsg("当前用户在本公司非管理员,您无权查看管理日志");
+            json.setErrorCode(ErrorCode.code_1010);
+            json.setSuccess(false);
+            return json;
+        }
+
+        List list =  manageCalendarService.getReportUserAppList(date);
+        if(count.equals("1")){
+            Map map = (Map)list.get(0);
+            Map map1 = (Map)map.get("workReports");
+            List<Map> mapList1 =  (List)map1.get("workReport");
+            List list1 = new ArrayList();
+            json.put("data",mapList1);
+        }else if(count.equals("2")){
+            Map map = (Map)list.get(1);
+            Map map1 = (Map)map.get("workOutSignIns");
+            List<Map> mapList1 =  (List)map1.get("workOutSignIn");
+            json.put("data",mapList1);
+        }else if(count.equals("3")){
+            Map map = (Map)list.get(2);
+            List list1 = new ArrayList();
+            Map map1 = (Map)map.get("attendances");
+            List<Map> mapList1 =  (List)map1.get("late");
+            List<Map> mapList2 =  (List)map1.get("onDuty");
+            List<Map> mapList3 =  (List)map1.get("leaveEarly");
+            List<Map> mapList4 =  (List)map1.get("offDut");
+            if(mapList1!=null && mapList1.size()!=0){
+                for (Map m:mapList1){
+                    list1.add(m);
+                }
+            }
+            if(mapList2!=null && mapList2.size()!=0){
+                for (Map m:mapList2){
+                    list1.add(m);
+                }
+            }
+            if(mapList3!=null && mapList3.size()!=0){
+                for (Map m:mapList3){
+                    list1.add(m);
+                }
+            }
+            if(mapList4!=null && mapList4.size()!=0){
+                for (Map m:mapList4){
+                    list1.add(m);
+                }
+            }
+            json.put("data",list1);
+        }else if(count.equals("4")){
+            Map map = (Map)list.get(3);
+            List list1 = new ArrayList();
+            Map map1 = (Map)map.get("audits");
+            List<Map> mapList1 =  (List)map1.get("workSealFrom");
+            List<Map> mapList2 =  (List)map1.get("leave");
+            List<Map> mapList3 =  (List)map1.get("oaEvection");
+            List<Map> mapList4 =  (List)map1.get("workOvertimeForm");
+            if(mapList1!=null && mapList1.size()!=0){
+                for (Map m:mapList1){
+                    list1.add(m);
+                }
+            }
+            if(mapList2!=null && mapList2.size()!=0){
+                for (Map m:mapList2){
+                    list1.add(m);
+                }
+            }
+            if(mapList3!=null && mapList3.size()!=0){
+                for (Map m:mapList3){
+                    list1.add(m);
+                }
+            }
+            if(mapList4!=null && mapList4.size()!=0){
+                for (Map m:mapList4){
+                    list1.add(m);
+                }
+            }
+            json.put("data",list1);
+        }else if(count.equals("31")){
+            Map map = (Map)list.get(2);
+            Map map1 = (Map)map.get("attendances");
+            List<Map> mapList =  (List)map1.get("late");
+            json.put("data",mapList);
+        }else if(count.equals("32")){
+            Map map = (Map)list.get(2);
+            Map map1 = (Map)map.get("attendances");
+            List<Map> mapList =  (List)map1.get("onDuty");
+            json.put("data",mapList);
+        }else if(count.equals("33")){
+            Map map = (Map)list.get(2);
+            Map map1 = (Map)map.get("attendances");
+            List<Map> mapList = (List)map1.get("leaveEarly");
+            json.put("data",mapList);
+        }else if(count.equals("34")){
+            Map map = (Map)list.get(2);
+            Map map1 = (Map)map.get("attendances");
+            List<Map> mapList = (List)map1.get("offDut");
+            json.put("data",mapList);
+        }else if(count.equals("41")){
+            Map map = (Map)list.get(3);
+            Map map1 = (Map)map.get("audits");
+            List<Map> mapList = (List)map1.get("workSealFrom");
+            json.put("data",mapList);
+        }else if(count.equals("42")){
+            Map map = (Map)list.get(3);
+            Map map1 = (Map)map.get("audits");
+            List<Map> mapList = (List)map1.get("leave");
+            json.put("data",mapList);
+        }else if(count.equals("43")){
+            Map map = (Map)list.get(3);
+            Map map1 = (Map)map.get("audits");
+            List<Map> mapList = (List)map1.get("oaEvection");
+            json.put("data",mapList);
+        }else if(count.equals("44")){
+            Map map = (Map)list.get(3);
+            Map map1 = (Map)map.get("audits");
+            List<Map> mapList = (List)map1.get("workOvertimeForm");
+            json.put("data",mapList);
+        }else if(count.equals("45")){
+            Map map = (Map)list.get(3);
+            Map map1 = (Map)map.get("audits");
+            List<Map> mapList = (List)map1.get("workGoOut");
+            json.put("data",mapList);
+        }
+        json.setErrorCode(ErrorCode.code_1004);
+        return json;
+    }
+
+}

+ 410 - 0
src/main/java/com/jeeplus/modules/API/works/meeting/MeetingCortroller.java

@@ -0,0 +1,410 @@
+package com.jeeplus.modules.API.works.meeting;
+
+import com.easemob.server.example.api.impl.EasemobIMUsers;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.JPushClientUtil;
+import com.jeeplus.common.utils.JedisUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workmeeting.entity.Workmeetinginfo;
+import com.jeeplus.modules.workmeeting.entity.Workmeetinguser;
+import com.jeeplus.modules.workmeeting.service.WorkmeetinginfoService;
+import com.jeeplus.modules.workmeeting.service.WorkmeetinguserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import redis.clients.jedis.Jedis;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.*;
+
+@Controller
+@RequestMapping(value = "${frontPath}/meeting")
+public class MeetingCortroller extends BaseController {
+    @Autowired
+    private WorkmeetinginfoService workmeetinginfoService;
+    @Autowired
+    private WorkmeetinguserService workmeetinguserService;
+	@ResponseBody
+    @RequestMapping(value = "pushMeetingToUsers", method = RequestMethod.GET)
+    public AjaxJson pushMeetingToUsers(String id,String ids,String roomName,HttpServletRequest request, HttpServletResponse response) {
+        logger.info("pushMeetingToUsers------------------------------------------------");
+        logger.info("http://116.62.246.213:8084/jeeplus/f/meeting/pushMeetingToUsers?id="+id+"&ids="+ids+"&roomName"+roomName);
+        AjaxJson json = new AjaxJson();
+        try {
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2001);
+            if (StringUtils.isBlank(id)){
+                json.setMsg("获取失败:参数id不能为空");
+                return json;
+            }
+            if (StringUtils.isBlank(ids)){
+                json.setMsg("获取失败:参数ids不能为空");
+                return json;
+            }
+            if (StringUtils.isBlank(roomName)){
+                json.setMsg("获取失败:参数roomName不能为空");
+                return json;
+            }
+            User user = UserUtils.get(id);
+            String title= user.getName()+"邀请您加入会议!";
+            String content= user.getName()+"邀请您加入会议!";
+            List<String> list = new ArrayList<>();
+            Workmeetinginfo workmeetinginfo = new Workmeetinginfo();
+            workmeetinginfo.setRoomName(roomName);
+            List<Workmeetinginfo> Workmeetinginfos = workmeetinginfoService.findList(workmeetinginfo);
+            if (Workmeetinginfos==null || Workmeetinginfos.size()==0){
+                workmeetinginfo.setStatus("1");
+                workmeetinginfoService.save(workmeetinginfo);
+            }else {
+                workmeetinginfo = Workmeetinginfos.get(0);
+                if (!workmeetinginfo.getStatus().equals("1")){
+                    json.setMsg("当前会议已结束!");
+                    return json;
+                }
+            }
+            Workmeetinguser select = new Workmeetinguser();
+            select.setMeetingId(roomName);
+            select.setUser(new User(id));
+            Workmeetinguser meetinguser1 = workmeetinguserService.getByMeetingIdAndUser(select);
+            if (meetinguser1 == null){
+                meetinguser1 = new Workmeetinguser();
+                meetinguser1.setMeetingId(roomName);
+                meetinguser1.setUser(new User(id));
+            }
+            meetinguser1.setStatus("1");
+            meetinguser1.setType("1");
+            meetinguser1.preUpdate();
+            workmeetinguserService.save(meetinguser1);
+            if (ids.length()>0){
+                String[] userIds = ids.split(",");
+                for (String userId:userIds){
+                    Workmeetinguser workmeetinguser = new Workmeetinguser();
+                    workmeetinguser.setUser(new User(userId));
+                    workmeetinguser.setStatus("1");
+                    List<Workmeetinguser> userList = workmeetinguserService.getByUserId(workmeetinguser);
+                    if (userList==null || userList.size()==0){
+                        list.add(userId);
+                        Workmeetinguser selectUser = new Workmeetinguser();
+                        selectUser.setMeetingId(roomName);
+                        selectUser.setUser(new User(userId));
+                        Workmeetinguser meetinguser = workmeetinguserService.getByMeetingIdAndUser(selectUser);
+                        if (meetinguser == null){
+                            meetinguser = new Workmeetinguser();
+                        }
+                        meetinguser.setStatus("0");
+                        meetinguser.setUser(new User(userId));
+                        meetinguser.setMeetingId(roomName);
+                        meetinguser.setType("2");
+                        meetinguser.preUpdate();
+                        workmeetinguserService.save(meetinguser);
+                    }else {
+                        Workmeetinguser selectUser = new Workmeetinguser();
+                        selectUser.setMeetingId(roomName);
+                        selectUser.setUser(new User(id));
+                        Workmeetinguser meetinguser = workmeetinguserService.getByMeetingIdAndUser(selectUser);
+                        if (meetinguser == null){
+                            meetinguser = new Workmeetinguser();
+                        }
+                        meetinguser.setStatus("3");
+                        meetinguser.setUser(new User(userId));
+                        meetinguser.setMeetingId(roomName);
+                        meetinguser.setType("2");
+                        meetinguser.preUpdate();
+                        workmeetinguserService.save(meetinguser);
+                    }
+                }
+            }
+
+            Map extras = new HashMap();
+            extras.put("type", "6001");
+            extras.put("title", title);
+            extras.put("roomName", roomName);
+            extras.put("name", user.getName());
+            extras.put("photo", user.getPhoto());
+            LinkedHashMap<String, Object> map = new LinkedHashMap<>();
+            map.put("roomName", roomName);
+            if (list==null || list.size()==0){
+                json.setSuccess(false);
+                json.setMsg("用户忙!");
+                json.setErrorCode(ErrorCode.code_2005);
+                json.setBody(map);
+            }else {
+                Map<String,Object> map1 = JPushClientUtil.sendNotificationToAliasesMap(title, content, extras, list);
+                if (map1.get("status")!=null && map1.get("status").equals("true")) {
+                    List<String> returnList = (List<String>)map1.get("list");
+                    if (returnList!=null && returnList.size()!=0){
+                        for (String uid:returnList ){
+                            Workmeetinguser selectUser = new Workmeetinguser();
+                            selectUser.setMeetingId(roomName);
+                            selectUser.setUser(new User(uid));
+                            Workmeetinguser meetinguser = workmeetinguserService.getByMeetingIdAndUser(selectUser);
+                            meetinguser.setStatus("4");
+                            meetinguser.setUser(new User(uid));
+                            meetinguser.setMeetingId(roomName);
+                            meetinguser.setType("2");
+                            meetinguser.preUpdate();
+                            workmeetinguserService.save(meetinguser);
+                        }
+                    }
+                    json.setSuccess(true);
+                    json.setMsg("已通知用户参加会议!");
+                    json.setErrorCode(ErrorCode.code_1004);
+                    json.setBody(map);
+                } else {
+                    workmeetinguserService.deleteByRoomName(roomName);
+                    workmeetinginfoService.deleteByRoomName(roomName);
+                    json.setSuccess(false);
+                    json.setMsg("发送推送失败!");
+                    json.setErrorCode(ErrorCode.code_2004);
+                    json.setBody(map);
+                }
+            }
+        }catch (Exception e){
+            json.setSuccess(false);
+            json.setMsg("数据异常!");
+            json.setErrorCode(ErrorCode.code_2004);
+            logger.info("Exception e"+e);
+        }
+
+        return json;
+    }
+
+    @ResponseBody
+    @RequestMapping(value = "meetingUserInfo", method = RequestMethod.GET)
+    public AjaxJson meetingUserInfo(String roomName,HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson json = new AjaxJson();
+        try {
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2001);
+            if (StringUtils.isBlank(roomName)){
+                json.setMsg("获取失败:参数roomName不能为空");
+                return json;
+            }
+
+            List<Map<String,Object>> mapList = new ArrayList<>();
+            Workmeetinginfo workmeetinginfo = workmeetinginfoService.getByRoomName(roomName);
+            if(workmeetinginfo!=null && StringUtils.isNotBlank(workmeetinginfo.getId())) {
+                Workmeetinguser workmeetinguserSelect = new Workmeetinguser();
+                workmeetinguserSelect.setMeetingId(roomName);
+                List<Workmeetinguser> list = workmeetinguserService.getByMeetingId(workmeetinguserSelect);
+                if (list!=null && list.size()!=0){
+                    for (Workmeetinguser workmeetinguser: list){
+                        Map<String,Object> map = new HashMap<>();
+                        User user = workmeetinguser.getUser();
+                        if (user!=null && StringUtils.isNotBlank(user.getId())){
+                            map.put("userId",user.getId());
+                            map.put("name",user.getName());
+                            map.put("photo",user.getPhoto());
+                            map.put("status",workmeetinguser.getStatus());
+                            mapList.add(map);
+                        }
+                    }
+                }
+            }
+            json.setSuccess(true);
+            json.setMsg("已获取参与会议用户信息!");
+            json.setErrorCode(ErrorCode.code_1004);
+            json.put("data",mapList);
+            json.put("roomName",roomName);
+        }catch (Exception e){
+            json.setSuccess(false);
+            json.setMsg("数据异常!");
+            json.setErrorCode(ErrorCode.code_2004);
+        }
+
+        return json;
+    }
+
+    @ResponseBody
+    @RequestMapping(value = "meetingInfo", method = RequestMethod.GET)
+    public AjaxJson meetingInfo(String id,String type,String roomName,String status,HttpServletRequest request, HttpServletResponse response) {
+        logger.info("meetingInfo接口------------------------------------------------");
+        logger.info("http://116.62.246.213:8084/jeeplus/f/meeting/meetingInfo?id="+id+"&type="+type+"&roomName"+roomName);
+	    AjaxJson json = new AjaxJson();
+        try{
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2001);
+            if (StringUtils.isBlank(id)){
+                json.setMsg("获取失败:参数id不能为空");
+                return json;
+            }
+            if (StringUtils.isBlank(type)){
+                json.setMsg("获取失败:参数type不能为空");
+                return json;
+            }
+            if (StringUtils.isBlank(roomName)){
+                json.setMsg("获取失败:参数roomName不能为空");
+                return json;
+            }
+            User user = UserUtils.get(id);
+            Workmeetinguser workmeetinguser = new Workmeetinguser();
+            workmeetinguser.setMeetingId(roomName);
+            LinkedHashMap<String,Object> map = new LinkedHashMap<>();
+            if (type.equals("4")){
+                String title = user.getName()+"已结束会议";
+                map.put("info",title);
+                map.put("type","4");
+                List<Workmeetinguser> userList = workmeetinguserService.getByMeetingId(workmeetinguser);
+                if (userList != null && userList.size() != 0) {
+                    Map extras = new HashMap();
+                    extras.put("type", "6002");
+                    extras.put("roomName", roomName);
+                    List list = new ArrayList();
+                    for (Workmeetinguser wmu:userList){
+                        if(wmu.getType().equals("2") &&(wmu.getStatus().equals("1") || wmu.getStatus().equals("0"))){
+                            list.add(wmu.getUser().getId());
+                        }
+                    }
+                    Workmeetinguser select = new Workmeetinguser();
+                    select.setMeetingId(roomName);
+                    select.setStatus("2");
+                    select.preUpdate();
+                    workmeetinguserService.updateByRoomName(select);
+                    Workmeetinginfo workmeetinginfo = new Workmeetinginfo();
+                    workmeetinginfo.setRoomName(roomName);
+                    workmeetinginfo.setStatus("2");
+                    workmeetinginfo.preUpdate();
+                    workmeetinginfoService.updateByRoomName(workmeetinginfo);
+                    boolean b = JPushClientUtil.sendNotificationToAliases(title, title, extras, list);
+                    if (!b){
+                        json.setMsg("当前无推送人员!");
+                    }
+                }else {
+                    json.setMsg("获取失败:当前用户数据异常");
+                    return json;
+                }
+            }else {
+                Workmeetinguser meetingUser = new Workmeetinguser();
+                workmeetinguser.setUser(new User(id));
+                List<Workmeetinguser> userList = workmeetinguserService.getByMeetingId(workmeetinguser);
+                if (userList == null || userList.size() != 1) {
+                    json.setMsg("获取失败:当前用户重复加入");
+                    return json;
+                }
+                meetingUser = userList.get(0);
+                String state = "2";
+                if (type.equals("1")){
+                    map.put("info",user.getName()+"已申请接入");
+                    state = "1";
+                    map.put("type","1");
+                }else if (type.equals("2")){
+                    map.put("info",user.getName()+"已拒绝接入");
+                    meetingUser.setStatus("2");
+                    map.put("type","2");
+                    /*Map extras = new HashMap();
+                    extras.put("type", "6002");
+                    extras.put("status", "2");
+                    extras.put("roomName", roomName);
+                    boolean b = JPushClientUtil.sendNotificationToAlias(user.getName()+"已拒绝接入", user.getName()+"已拒绝接入", extras, meetingUser.getCreateBy().getId());
+                    if (!b){
+                        json.setSuccess(false);
+                        json.setMsg("推送失败!");
+                        return json;
+                    }*/
+                }else if (type.equals("3")){
+                    map.put("info",user.getName()+"已退出会议");
+                    map.put("type","3");
+                   /* Map extras = new HashMap();
+                    extras.put("type", "6002");
+                    extras.put("status", "3");
+                    extras.put("roomName", roomName);
+                    boolean b = JPushClientUtil.sendNotificationToAlias(user.getName()+"已退出会议", user.getName()+"已退出会议", extras, meetingUser.getCreateBy().getId());
+                    if (!b){
+                        json.setSuccess(false);
+                        json.setMsg("推送失败!");
+                        return json;
+                    }*/
+                }else {
+                    json.setMsg("获取失败:参数type类型错误");
+                    return json;
+                }
+                if(status==null || status.equals("0")) {
+                    Map extras = new HashMap();
+                    extras.put("type", "6003");
+                    extras.put("roomName", roomName);
+                    logger.info("---推送人:"+ meetingUser.getCreateBy().getId());
+                    logger.info("---meetingUser:"+ meetingUser.toString());
+                    boolean b = JPushClientUtil.sendNotificationToAlias(user.getName()+"会议状态改变", user.getName()+"会议状态改变", extras, meetingUser.getCreateBy().getId());
+                    if (!b){
+                        json.setSuccess(false);
+                        json.setMsg("推送失败!");
+                        return json;
+                    }
+                }
+
+                meetingUser.setStatus(state);
+                meetingUser.preUpdate();
+                workmeetinguserService.save(meetingUser);
+            }
+
+            json.setSuccess(true);
+            json.setErrorCode(ErrorCode.code_1004);
+        }catch (Exception e){
+            json.setSuccess(false);
+            json.setMsg("数据异常!");
+            json.setErrorCode(ErrorCode.code_2004);
+            logger.info("Exception e"+e);
+        }
+        return json;
+    }
+
+    @ResponseBody
+    @RequestMapping(value = "errOut", method = RequestMethod.GET)
+    public AjaxJson errOut(HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson json = new AjaxJson();
+        try{
+            User user = UserUtils.getUser();
+            logger.info("----------------------------------");
+            logger.info("user"+user.getId());
+            logger.info("----------------------------------");
+            Workmeetinguser workmeetinguser = new Workmeetinguser();
+            workmeetinguser.setUser(user);
+            workmeetinguser.setStatus("2");
+            workmeetinguser.preUpdate();
+            workmeetinguserService.updateByUser(workmeetinguser);
+            Jedis jedis = null;
+            try {
+                jedis = JedisUtils.getResource();
+                logger.info("-----UserUtils.getUser():"+UserUtils.getUser().getId());
+                String userId = jedis.get(UserUtils.getUser().getId());
+                if (StringUtils.isNotBlank(userId)){
+                    logger.info("-----"+userId);
+                    jedis.del(userId);
+                }
+                logger.info("-----"+(jedis.get(UserUtils.getUser().getId())==null?true:false));
+            } catch (Exception e) {
+                logger.error("getActiveSessions", e);
+            } finally {
+                JedisUtils.returnResource(jedis);
+            }
+            json.setSuccess(true);
+            json.setErrorCode(ErrorCode.code_1004);
+        }catch (Exception e){
+            json.setSuccess(false);
+            json.setMsg("数据异常!");
+            json.setErrorCode(ErrorCode.code_2004);
+            logger.info("Exception e"+e);
+        }
+        return json;
+    }
+
+    private static EasemobIMUsers easemobIMUsers = new EasemobIMUsers();
+
+    @ResponseBody
+    @RequestMapping(value = "userStatus", method = RequestMethod.GET)
+    public AjaxJson userStatus(HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson json = new AjaxJson();
+	    User user = UserUtils.getUser();
+        Object result = easemobIMUsers.getIMUserStatus(user.getId());
+        json.put("result",result);
+        return json;
+    }
+
+}

+ 57 - 0
src/main/java/com/jeeplus/modules/API/works/moduleChoose/moduleChooseInterfaceCortroller.java

@@ -0,0 +1,57 @@
+package com.jeeplus.modules.API.works.moduleChoose;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.jeeplus.modules.utils.ErrorCode;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.modules.dao.ModuleChooseDao;
+import com.jeeplus.modules.modules.entity.ModuleChoose;
+import com.jeeplus.modules.sys.entity.User;
+
+@Controller
+@RequestMapping(value = "${frontPath}/moduleChoose")
+public class moduleChooseInterfaceCortroller extends BaseController {
+
+	@Autowired
+	private ModuleChooseDao moduleChooseDao;
+
+	@ResponseBody
+	@RequestMapping(value = "getModuleChoose", method = RequestMethod.GET)
+	public AjaxJson getModuleChoose(String userId, HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson json = new AjaxJson();
+		User user = new User();
+		user.setId(userId);
+		ModuleChoose mc = new ModuleChoose();
+		mc.setUser(user);
+		List<ModuleChoose> list = moduleChooseDao.findList(mc);
+		json.put("data", list);
+		json.setErrorCode(ErrorCode.code_1004);
+		return json;
+	}
+
+	@ResponseBody
+	@RequestMapping(value = "modifyModuleChoose", method = RequestMethod.GET)
+	public AjaxJson modifyModuleChoose(String userId, String moduleId,HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson json = new AjaxJson();
+		User user = new User();
+		user.setId(userId);
+		ModuleChoose mc = new ModuleChoose();
+		mc.setUser(user);
+		mc.setModuleId(moduleId);
+		moduleChooseDao.update(mc);
+		json.setMsg("修改模块成功");
+		json.setErrorCode(ErrorCode.code_1004);
+		return json;
+	}
+
+}

+ 815 - 0
src/main/java/com/jeeplus/modules/API/works/notify/NotifyController.java

@@ -0,0 +1,815 @@
+package com.jeeplus.modules.API.works.notify;
+
+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.IdGen;
+import com.jeeplus.common.utils.JPushClientUtil;
+import com.jeeplus.common.utils.RequestUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.common.websocket.onchat.ChatServerPool;
+import com.jeeplus.modules.oa.dao.OaNotifyDao;
+import com.jeeplus.modules.oa.dao.OaNotifyRecordDao;
+import com.jeeplus.modules.oa.entity.OaNotify;
+import com.jeeplus.modules.oa.entity.OaNotifyRecord;
+import com.jeeplus.modules.oa.service.OaNotifyService;
+import com.jeeplus.modules.pushinfo.entity.Pushinfo;
+import com.jeeplus.modules.pushinfo.service.PushinfoService;
+import com.jeeplus.modules.serialnum.service.SerialNumTplService;
+import com.jeeplus.modules.sys.dao.OfficeDao;
+import com.jeeplus.modules.sys.dao.RoleDao;
+import com.jeeplus.modules.sys.dao.UserDao;
+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.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.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import org.java_websocket.WebSocket;
+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.SimpleDateFormat;
+import java.util.*;
+
+@Controller
+@RequestMapping(value="${frontPath}/notify/notify")
+public class NotifyController extends BaseController {
+
+    @Autowired
+    private OaNotifyDao oaNotifyDao;
+
+    @Autowired
+    private OaNotifyRecordDao oaNotifyRecordDao;
+
+    @Autowired
+    private OaNotifyService oaNotifyService;
+
+    @Autowired
+    private UserDao userDao;
+
+    @Autowired
+    private OfficeDao officeDao;
+
+    @Autowired
+    private RoleDao roleDao;
+
+    @Autowired
+    private SystemService systemService;
+    @Autowired
+    private WorkattachmentService workattachmentService;
+    @Autowired
+    private PushinfoService pushinfoService;
+    @Autowired
+    private SerialNumTplService serialNumTplService;
+    @Autowired
+    private WorkProjectNotifyService workProjectNotifyService;
+
+    /**
+     * 查看用户公告信息
+     * @return json数据
+     */
+    @RequestMapping(value = "getNotifyList")
+    @ResponseBody
+    public AjaxJson getNotices(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        Long x = System.currentTimeMillis();
+        AjaxJson j = new AjaxJson();
+        String userId = request.getParameter("userId");
+        String readFlag = request.getParameter("readFlag");
+        String pageNo = request.getParameter("pageNo");
+        OaNotify oaNotify = new OaNotify();
+        User user = UserUtils.get(userId);
+        oaNotify.setCurrentUser(user);
+        oaNotify.setStatus("1");
+        oaNotify.setCompany(new Office(user.getComId()));
+        oaNotify.setSelf(true);
+        //管理员查看所有
+        if(readFlag.equals("-1")){
+            //包括草稿状态
+            oaNotify.setReadFlag("");
+            try {
+                if (UserUtils.isManager()) {
+                    oaNotify.setSelf(false);
+                }
+            }catch (Exception e){
+
+            }
+        }else {
+            oaNotify.setReadFlag(readFlag);
+        }
+        //oaNotify.setCompany(UserUtils.getSelectCompany());
+        Page<OaNotify> page = oaNotifyService.findMyself(new Page<OaNotify>(request, response), oaNotify);
+        List<OaNotify> list=page.getList();
+        if(list==null){
+            j.setSuccess(false);
+            j.setErrorCode(ErrorCode.code_2005);
+            j.setMsg("获取列表失败");
+            j.put("data", list);
+        }else{
+            j.put("maxNum",page.getCount());
+            if(Integer.parseInt(pageNo)<=page.getTotalPage()){
+                for (OaNotify o:list){
+                    List<Workattachment> workattachmentList = workattachmentService.getListByAttachmentIdAndFlag(o.getId(),"79");
+                    String files = "";
+                    if (workattachmentList!=null && workattachmentList.size()!=0){
+                        for (Workattachment workattachment : workattachmentList){
+                            files += workattachment.getUrl()+",";
+                        }
+                        if (files.length() > 1) {
+                            files = files.substring(0, files.length() - 1);
+                        }
+                    }
+                    o.setFiles(files);
+                    if (o!=null && o.getContents()!=null && !o.getContents().equals("")){
+                        o.setState("1");
+                    }else {
+                        o.setState("2");
+                    }
+                    o.setContents("");
+                }
+                j.put("data",list);
+                j.setMsg("获取列表成功");
+                j.setErrorCode(ErrorCode.code_1004);
+            }else{
+                j.put("data", Lists.newArrayList());
+                j.setMsg("获取列表成功");
+                j.setErrorCode(ErrorCode.code_1004);
+            }
+        }
+        Long y = System.currentTimeMillis();
+        logger.info("----------------------x="+x);
+        logger.info("getNotifyList请求时间:"+(y-x)+"毫秒!");
+        logger.info("----------------------y="+y);
+        return j;
+    }
+
+    /**
+     * 查看公告详情
+     * @return  json数据
+     */
+    @RequestMapping(value = "getNotifyById", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getNotifyById(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        String notifyId = request.getParameter("notifyId");
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Map<String, Object> map = Maps.newHashMap();
+        OaNotify oaNotify = oaNotifyDao.get(notifyId);
+        if(oaNotify!=null){
+            User user = userDao.get(oaNotify.getCreateBy());
+            if(user!=null){
+                map.put("userName", user.getName());
+                map.put("photo", user.getPhoto());
+            }else{
+                map.put("userName", "");
+                map.put("photo", "");
+            }
+            map.put("title", oaNotify.getTitle());
+
+            String contents = "";
+            if(oaNotify.getContents()!=null && oaNotify.getContents().contains("img")){
+                String[] arr = oaNotify.getContents().split("<img alt=\"\" src=\"");
+                for(int i=0;i<arr.length;i++){
+                    if(i==0){
+                        contents += arr[0];
+                    }else {
+                        contents += "<img alt=\"\" src=\""+request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+arr[i];
+                    }
+
+                }
+                oaNotify.setContents(contents);
+                map.put("contents", contents);
+            }else {
+                map.put("contents", oaNotify.getContents());
+            }
+
+            String type = oaNotify.getType();
+            if(StringUtils.isNotBlank(type)){
+                if("1".equals(type)){type = "会议通告";}
+                if("2".equals(type)){type = "奖惩通告";}
+                if("3".equals(type)){type = "活动通告";}
+            }else{
+                type = "";
+            }
+            map.put("type",type);
+            List<Workattachment> workattachmentList = workattachmentService.getListByAttachmentIdAndFlag(oaNotify.getId(),"79");
+            String files = "";
+            if (workattachmentList!=null && workattachmentList.size()!=0){
+                for (Workattachment workattachment : workattachmentList){
+                    files += workattachment.getUrl()+",";
+                }
+                if (files.length() > 1) {
+                    files = files.substring(0, files.length() - 1);
+                }
+            }
+            map.put("files", files);
+            //map.put("files", oaNotify.getFiles());
+            map.put("content", oaNotify.getContent());
+            map.put("createDate",sdf.format(oaNotify.getCreateDate()));
+            map.put("readNum", oaNotify.getReadNum());
+            map.put("unReadNum", oaNotify.getUnReadNum());
+            map.put("companyId", oaNotify.getCompany().getId());
+            map.put("startDate", oaNotify.getStartDate());
+            map.put("endDate", oaNotify.getEndDate());
+            map.put("number", oaNotify.getNumber());
+
+            //记录已读
+            if (StringUtils.isNotBlank(oaNotify.getId())){
+                oaNotifyService.updateReadFlag(oaNotify);
+            }
+        }
+        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;
+    }
+
+
+
+    /**
+     * 查看用户
+     * @return  json数据
+     */
+    @RequestMapping(value = "getUserByOaNotifyId", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getUserByOaNotifyId(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        String notifyId = request.getParameter("notifyId");
+        String readFlag = request.getParameter("readFlag");
+        OaNotifyRecord oaNotifyRecord = new OaNotifyRecord();
+        OaNotify oaNotify= new OaNotify();
+        oaNotify.setId(notifyId);
+        oaNotifyRecord.setOaNotify(oaNotify);
+        oaNotifyRecord.setReadFlag(readFlag);
+        List<Map<String, Object>> mapList = Lists.newArrayList();
+        List<OaNotifyRecord> list =	oaNotifyRecordDao.findUserList(oaNotifyRecord);
+        for (int i = 0; i < list.size(); i++) {
+            OaNotifyRecord o=list.get(i);
+            User user = userDao.get(o.getUser());
+            if(user!=null){
+                Map<String, Object> map = Maps.newHashMap();
+                if(user.getName()==null){
+                    map.put("userName", "");
+                }else{
+                    map.put("userName", user.getName());
+                }
+                if(user.getPhoto()==null){
+                    map.put("photo", "");
+                }else{
+                    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
+     */
+    @RequestMapping(value = "addNotify", method=RequestMethod.POST)
+    @ResponseBody
+    public AjaxJson addNotify(HttpServletRequest request, HttpServletResponse response)throws Exception  {
+        AjaxJson j = new AjaxJson();
+        try {
+            HashMap<String, String> requestMap = findRequestMap(request);
+            String title = URLDecoder.decode(requestMap.get("title")==null?"":requestMap.get("title"), "UTF-8");
+            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 ids = URLDecoder.decode(requestMap.get("ids")==null?"":requestMap.get("ids"), "UTF-8");
+            String files = URLDecoder.decode(requestMap.get("files")==null?"":requestMap.get("files"), "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 startDate = URLDecoder.decode(requestMap.get("startDate")==null?"":requestMap.get("startDate"), "UTF-8");
+            String endDate = URLDecoder.decode(requestMap.get("endDate")==null?"":requestMap.get("endDate"), "UTF-8");
+            Office company  = UserUtils.getSelectCompany();
+            OaNotify oaNotify = new OaNotify();
+            Set<String> set = new HashSet<String>();
+            List<OaNotifyRecord> oaNotifyRecordOfficeList = Lists.newArrayList();
+            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())){
+                        OaNotifyRecord entity = new OaNotifyRecord();
+                        entity.setId(IdGen.uuid());
+                        entity.setOaNotify(oaNotify);
+                        entity.setOfficeId(offices[i]);
+                        oaNotifyRecordOfficeList.add(entity);
+                        users = systemService.findUserByOfficeId(offices[i]);
+                    }else {
+                        users = systemService.findUserByOffices(office,company);
+                        List<Office> officeList = officeDao.findAllListByParentIds(office);
+                        for (Office o:officeList){
+                            if ("2".equals(o.getType())){
+                                OaNotifyRecord entity = new OaNotifyRecord();
+                                entity.setId(IdGen.uuid());
+                                entity.setOaNotify(oaNotify);
+                                entity.setOfficeId(offices[i]);
+                                oaNotifyRecordOfficeList.add(entity);
+                            }
+                        }
+                    }
+                    for (User user:users){
+                        set.add(user.getId());
+                    }
+                }
+                oaNotify.setOaNotifyRecordOfficeList(oaNotifyRecordOfficeList);
+            }
+            if(ids !=null && !ids.equals("")){
+                String [] users = ids.split(",");
+                for (int i = 0; i < users.length; i++) {
+                    //userList.add(users[i]);
+                    set.add(users[i]);
+                }
+            }
+            String recordIds = "";
+            if (set!=null && set.size()!=0){
+                List aliases = new ArrayList();
+                for (String id :set){
+                    recordIds += id +",";
+                    aliases.add(id);
+                }
+                if (StringUtils.isNotBlank(recordIds)){
+                    recordIds = recordIds.substring(0,recordIds.length()-1);
+                }
+                //oaNotify.setCompany(UserUtils.getSelectCompany());
+                SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                try {
+                    oaNotify.setStartDate(sdfs.parse(startDate));
+                    oaNotify.setEndDate(sdfs.parse(endDate));
+                }catch (Exception e){
+                    j.put("notifyId", oaNotify.getId());
+                    j.setErrorCode(ErrorCode.code_2002);
+                    j.setMsg("发布公告失败,开始时间/结束时间格式异常");
+                    return j;
+                }
+                oaNotify.setTitle(title);
+                oaNotify.setType(type);
+                oaNotify.setContent(content);
+                oaNotify.setFiles(files);
+                oaNotify.setCompany(company);
+                oaNotify.setOffice(UserUtils.getSelectOffice());
+                oaNotify.setStatus("1");
+                oaNotify.setOaNotifyRecordIds(recordIds);
+                User user=UserUtils.get(userId);
+                oaNotify.setCreateBy(user);
+                oaNotify.setUpdateBy(user);
+//      oaNotify.preInsert();//自动生成ID 、createDate、createBy(createBy为登录用户、接口下该值为空)
+                oaNotify.setNumber(serialNumTplService.genSerialNum(UserUtils.getSelectCompany(), "17"));
+                oaNotifyService.save(oaNotify);
+
+
+                // 更新发送接受人记录
+                oaNotifyRecordDao.deleteByOaNotifyId(oaNotify.getId());
+                if (oaNotify.getOaNotifyRecordList().size() > 0){
+                    oaNotifyRecordDao.insertAll(oaNotify.getOaNotifyRecordList());
+                }
+                for (String uid:set){
+                    UserUtils.pushIm(uid,("公告消息 "+title));
+                   /* List<WebSocket> toUserConns = ChatServerPool.getWebSocketByUser(uid);
+                    for (WebSocket toUserConn : toUserConns) {
+                        String message = "{\"to\":\""+uid+"\"," +
+                                "\"msg\":\"公告消息 "+title+"\"," +
+                                "\"useType\":\"sys\"}";
+                        ChatServerPool.sendMessageToUser(toUserConn, message);//同时向本人发送消息
+                    }*/
+                }
+                Map extras = new HashMap();
+                extras.put("type", "2001");
+                extras.put("id", oaNotify.getId());
+                //发布状态发推送
+                if(StringUtils.isNotBlank(oaNotify.getStatus()) && "1".equals(oaNotify.getStatus())){
+
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                    String date = sdf.format(new Date());
+                    Pushinfo pushinfo = new Pushinfo();
+                    pushinfo.setCompanyId(UserUtils.getSelectCompany().getId());
+                    pushinfo.setMobile("ios,android");
+                    pushinfo.setCurrentUser(UserUtils.getUser());
+                    pushinfo.setRemarks(content);
+                    pushinfo.setUserId(UserUtils.getUser().getId());
+                    pushinfo.setType("2001");
+                    pushinfo.setPushId(oaNotify.getId());
+                    pushinfo.setTitle("公告");
+                    String status = oaNotify.getUpdateBy().getName() +"  "+date;
+                    pushinfo.setStatus(status);
+                    pushinfo.setContent(oaNotify.getTitle());
+                    pushinfo.setPushUserId(ids);
+                    pushinfo.setParentType("singleCompanyNews");
+                    if (oaNotify.getFiles()!=null &&oaNotify.getFiles().length()>0){
+                        pushinfo.setStatus(oaNotify.getFiles());
+                    }
+                    pushinfoService.save(pushinfo);
+
+                    boolean b = JPushClientUtil.sendNotificationToAliases(oaNotify.getTitle(), content, extras, aliases);
+                    j.put("notifyId", oaNotify.getId());
+                    j.setErrorCode(ErrorCode.code_1004);
+                    j.setMsg("发布公告成功");
+                }
+            }else {
+                j.put("notifyId", oaNotify.getId());
+                j.setErrorCode(ErrorCode.code_1004);
+                j.setMsg("发布公告失败,发送人不能为空");
+            }
+
+        }catch (Exception e){
+            j.put("notifyId", "");
+            j.setSuccess(false);
+            j.setErrorCode(ErrorCode.code_1004);
+            j.setMsg("发布公告失败");
+        }
+        return j;
+    }
+
+
+
+    /**
+     * 查看部门下的员工
+     * @param request
+     * @param response
+     * @param redirectAttributes
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "getUserByOffice", method=RequestMethod.GET)
+    public AjaxJson  getUserTreeData(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        String officeId = request.getParameter("officeId");
+        List<Map<String, Object>> mapList = Lists.newArrayList();
+        List<User> list = systemService.findUserByOfficeId(officeId);
+        Office office = officeDao.get(officeId);
+        for (int i = 0; i < list.size(); i++) {
+            User u = list.get(i);
+            Map<String, Object> map = Maps.newHashMap();
+            map.put("id", u.getId());
+            map.put("name",u.getName());
+            map.put("photo", u.getPhoto());
+            if(office!=null){
+                map.put("offcieName", office.getName());
+            }
+            mapList.add(map);
+        }
+        if(mapList==null){
+            j.setSuccess(false);
+            j.setMsg("获取部门人员失败");
+            j.setErrorCode(ErrorCode.code_2005);
+            j.put("data", mapList);
+        }else{
+            j.setMsg("获取部门人员信息成功");
+            j.put("data", mapList);
+            j.setErrorCode(ErrorCode.code_1004);
+        }
+        return j;
+    }
+
+
+
+    /**
+     * 查看公司下的部门
+     * @return
+     */
+    @RequestMapping(value = "getOffice", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getOffice(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        String userId = request.getParameter("userId");
+        String companyId = request.getParameter("companyId");
+        List<Map<String,Object>> mapList = Lists.newArrayList();
+        Role role1 = new Role();
+        User user = UserUtils.get(userId);
+        role1.setUser(user);
+        List<Role> roleList=roleDao.findList(role1);
+        Office comp =null;
+        for (Role role : roleList) {
+            if(role.getId() != null && role.getCompany() != null &&companyId.equals(role.getCompany().getId())){
+                comp=officeDao.get(companyId);
+            }
+        }
+        if(comp!=null){
+            Map<String,Object> map = Maps.newHashMap();
+            map.put("companyId",comp.getId());
+            map.put("companyName", comp.getName());
+            List<Map<String, Object>> mapList1 = Lists.newArrayList();
+            Office office = new Office();
+            office.setParentIds(comp.getId());
+            List<Office> list = officeDao.findByParentIdsLike(office);
+            for (int i = 0; i < list.size(); i++) {
+                Office e = list.get(i);
+                Map<String, Object> map1 = Maps.newHashMap();
+                map1.put("officeId", e.getId());
+                map1.put("officeName", e.getName());
+                mapList1.add(map1);
+            }
+            map.put("下属部门", mapList1);
+
+            mapList.add(map);
+        }
+
+
+		/*List<Map<String, Object>> mapList = Lists.newArrayList();
+		List<Office> list = officeService.findList(false);
+		for (int i=0; i<list.size(); i++){
+			Office e = list.get(i);
+				Map<String, Object> map = Maps.newHashMap();
+				map.put("id", e.getId());
+				map.put("pId", e.getParentId());
+				map.put("pIds", e.getParentIds());
+				map.put("name", e.getName());
+				mapList.add(map);
+
+		}*/
+        if(mapList==null){
+            j.setSuccess(false);
+            j.setErrorCode(ErrorCode.code_2005);
+            j.setMsg("获取公司机构失败");
+            j.put("data",mapList);
+
+        }else{
+            j.setMsg("获取公司机构成功");
+            j.put("data",mapList);
+            j.setErrorCode(ErrorCode.code_1004);
+        }
+        return j;
+    }
+    /**
+     * 保存公告附件
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveFile",method=RequestMethod.POST)
+    public AjaxJson saveFile(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) throws Exception{
+        AjaxJson j=new AjaxJson();
+        try {
+            HashMap<String, String> requestMap = findRequestMap(request);
+            String notifyId = URLDecoder.decode(requestMap.get("id")==null?"":requestMap.get("id"), "UTF-8");
+            String urls = URLDecoder.decode(requestMap.get("urls")==null?"":requestMap.get("urls"), "UTF-8");
+            String flag = URLDecoder.decode(requestMap.get("type")==null?"":requestMap.get("type"), "UTF-8");
+            User user = UserUtils.getUser();
+            Office company = UserUtils.getSelectCompany();
+            Calendar cal = Calendar.getInstance();
+            cal.setTime(new Date());
+            if (StringUtils.isNotBlank(urls)){
+                j.setMsg("上传成功!");
+                j.setErrorCode(ErrorCode.code_1004);
+                for (String url:urls.split(",")){
+                    String[] arr = url.split("/");
+                    String fileName = arr[arr.length-1];
+                    String[] typeArr = fileName.split("\\.");
+                    String type = typeArr[typeArr.length-1];
+                    Workattachment workattachment = new Workattachment();
+                    workattachment.setAttachmentUser(user.getId());
+                    workattachment.setUrl("http://cdn.gangwaninfo.com/"+url);
+                    workattachment.setAttachmentName(fileName);
+                    workattachment.setCompanyId(company.getId());
+                    workattachment.setAttachmentFlag(flag);
+                    workattachment.setType(type);
+                    workattachment.setAttachmentId(notifyId);
+                    workattachment.setId(IdGen.uuid());
+                    if (org.apache.commons.lang3.StringUtils.isNotBlank(user.getId())){
+                        workattachment.setUpdateBy(user);
+                        workattachment.setCreateBy(user);
+                    }
+                    cal.add(Calendar.SECOND, 1);
+                    workattachment.setCreateDate( cal.getTime());
+                    workattachment.setUpdateDate( cal.getTime());
+                    workattachmentService.insert(workattachment);
+                }
+            }else {
+                j.setSuccess(false);
+                j.setMsg("上传失败!");
+                j.setErrorCode(ErrorCode.code_2004);
+            }
+        }catch (Exception e){
+            j.setSuccess(false);
+            j.setMsg("上传失败!");
+            j.setErrorCode(ErrorCode.code_2004);
+        }finally {
+            return j;
+        }
+    }
+
+    /**
+     * 保存公告附件
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveNotifyFile",method=RequestMethod.POST)
+    public AjaxJson saveUserPhoto(MultipartHttpServletRequest multiRequest,HttpServletRequest servletRequest) throws Exception{
+        AjaxJson j=new AjaxJson();
+        try {
+            String notifyId = multiRequest.getParameter("notifyId");
+            OaNotify oaNotify =  oaNotifyService.get(notifyId);
+            OSSClientUtil ossUtil =new OSSClientUtil();
+
+            Iterator<String> fileNames = multiRequest.getFileNames();
+            String thisFiles = oaNotify.getFiles();
+            String filePaths= "";
+            System.out.println("-----------开始------------------");
+            while(fileNames.hasNext()){
+
+                //取得上传文件
+                MultipartFile file = multiRequest.getFile(fileNames.next());
+                if(file != null){
+                    //取得当前上传文件的文件名称
+                    //String filePath= ossUtil.uploadFile2OSS(file, "notify");
+                    OSSClientUtil ossClientUtil = new OSSClientUtil();
+                    String filePath= oaNotifyService.uploadFile(ossClientUtil,file,oaNotify,"79");
+                    filePaths = filePath;
+                }
+            }
+            /*if(thisFiles==null || thisFiles.equals("")){
+                if(filePaths.contains(",")){
+                    oaNotify.setFiles(filePaths.substring(1, filePaths.length() - 1));
+                }else {
+                    oaNotify.setFiles(filePaths);
+                }
+            }else{
+                filePaths = thisFiles+","+filePaths;
+                oaNotify.setFiles(filePaths);
+            }
+            logger.info(","+oaNotify.getFiles());
+            oaNotifyService.saveNotifyFile(oaNotify);*/
+            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;
+        }
+    }
+
+
+    /**
+     * 考勤规则权限密码验证 
+     * @param
+     * @param request
+     * @param response
+     * @param redirectAttributes
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "passwordAuth", method=RequestMethod.POST)
+    public AjaxJson  passwordAuth(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        HashMap<String, String> requestMap = RequestUtils.findRequestMap(request);
+        String password = requestMap.get("password");
+        String userId =  requestMap.get("userId");
+        if(userId == null || userId.equals("") ){
+            userId = UserUtils.getUser().getId();
+        }else{
+            if(!userId.equals(UserUtils.getUser().getId())){
+                j.setSuccess(false);
+                j.setMsg("用户名错误");
+                j.setErrorCode(ErrorCode.code_2003);
+                return j;
+            }
+        }
+        System.out.println("userId="+userId);
+        User user = systemService.getUser(userId);
+        boolean status = systemService.validatePassword(password,user.getPassword());
+        if(status){
+            j.setSuccess(status);
+            j.setMsg("考勤规则权限密码验证成功");
+            j.setErrorCode(ErrorCode.code_1004);
+        }else{
+            j.setSuccess(status);
+            j.setMsg("考勤规则权限密码验证失败");
+            j.setErrorCode(ErrorCode.code_1012);
+        }
+        return j;
+    }
+
+    /**
+     * 查看已读未读用户
+     * @return  json数据
+     */
+    @RequestMapping(value = "getNotifyRecord", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getNotifyRecord(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+
+        String notifyId = request.getParameter("notifyId");
+        OaNotifyRecord oaNotifyRecord = new OaNotifyRecord();
+        oaNotifyRecord.setOaNotify(new OaNotify(notifyId));
+        oaNotifyRecord.setReadFlag("1");
+        List<OaNotifyRecord> readList = oaNotifyRecordDao.findList(oaNotifyRecord);
+        OaNotifyRecord o = new OaNotifyRecord();
+        o.setOaNotify(new OaNotify(notifyId));
+        o.setReadFlag("0");
+        List<OaNotifyRecord> noReadList = oaNotifyRecordDao.findList(o);
+        List<Map<String, Object>> mapList1 = Lists.newArrayList();
+        List<Map<String, Object>> mapList2 = Lists.newArrayList();
+        Map<String, Object> totalMap = new HashMap<String, Object>();
+        if (readList != null && readList.size() != 0) {
+            for (OaNotifyRecord onr : readList) {
+                Map<String, Object> map = Maps.newHashMap();
+                map.put("userId", onr.getUser() == null ? "" : onr.getUser().getId());
+                map.put("photo", onr.getUser() == null ? "" : onr.getUser().getPhoto());
+                map.put("userName", onr.getUser() == null ? "" : onr.getUser().getName());
+                mapList1.add(map);
+            }
+        }
+        if (noReadList != null && noReadList.size() != 0) {
+            for (OaNotifyRecord onr : noReadList) {
+                Map<String, Object> map = Maps.newHashMap();
+                map.put("userId", onr.getUser() == null ? "" : onr.getUser().getId());
+                map.put("photo", onr.getUser() == null ? "" : onr.getUser().getPhoto());
+                map.put("userName", onr.getUser() == null ? "" : onr.getUser().getName());
+                mapList2.add(map);
+            }
+        }
+        totalMap.put("read", mapList1);
+        totalMap.put("unread", mapList2);
+
+        j.put("data", totalMap);
+        j.setMsg("获取公告读取用户成功");
+        j.setSuccess(true);
+        j.setErrorCode(ErrorCode.code_1004);
+        return j;
+    }
+
+    /**
+     * 删除公告详情
+     * @return  json数据
+     */
+    @RequestMapping(value = "deleteNotifyById", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson deleteNotifyById(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        String notifyId = request.getParameter("notifyId");
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        OaNotify oaNotify = oaNotifyDao.get(notifyId);
+        if(notifyId!=null){
+            WorkProjectNotify notify = new WorkProjectNotify();
+            notify.setNotifyId(oaNotify.getId());
+            //workProjectNotifyService.readByNotifyId(notify);
+            pushinfoService.updateDelflagByPushId(notify.getId(),"1");
+            //oaNotifyDao.delete(oaNotify);
+            oaNotifyRecordDao.deleteByOaNotifyId(notifyId);
+            oaNotify.setRemarks("关闭");
+            oaNotifyDao.saveRemarks(oaNotify);
+            j.put("data", "");
+            j.setMsg("删除公告成功");
+            j.setErrorCode(ErrorCode.code_1004);
+        }else{
+            j.setSuccess(false);
+            j.setMsg("获取公告失败");
+            j.setErrorCode(ErrorCode.code_2005);
+            j.put("data","");
+        }
+
+        return j;
+    }
+
+}

+ 265 - 0
src/main/java/com/jeeplus/modules/API/works/oaallccontroller/OaAController.java

@@ -0,0 +1,265 @@
+package com.jeeplus.modules.API.works.oaallccontroller;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.JPushClientUtil;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.common.websocket.onchat.ChatServerPool;
+import com.jeeplus.modules.oaall.entity.OaAll;
+import com.jeeplus.modules.oaall.service.OaAllService;
+import com.jeeplus.modules.oabuy.entity.OaBuy;
+import com.jeeplus.modules.oabuy.service.OaBuyService;
+import com.jeeplus.modules.pushinfo.entity.Pushinfo;
+import com.jeeplus.modules.pushinfo.service.PushinfoService;
+import com.jeeplus.modules.sys.dao.UserDao;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workapprovalcopy.entity.ApprovalCopy;
+import com.jeeplus.modules.workapprovalcopy.service.ApprovalCopyService;
+import org.java_websocket.WebSocket;
+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.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 流程
+ */
+@RequestMapping(value = "${frontPath}/oaall/oaall")
+@Controller
+public class OaAController extends BaseController {
+    @Autowired
+    private OaAllService oaAllService;
+    @Autowired
+    private UserDao userDao;
+
+    @Autowired
+    private ApprovalCopyService approvalCopyService;
+
+    @Autowired
+    private PushinfoService pushinfoService;
+
+    /**
+     * 启动采购申请
+     *
+     * @param request
+     * @param response
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveOaAll", method = RequestMethod.POST)
+    public AjaxJson oaAll(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+        AjaxJson json = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            Map<String, Object> variables = Maps.newHashMap();
+            HashMap<String, String> requestMap = findRequestMap(request);
+
+            String applyContent = URLDecoder.decode(requestMap.get("applyContent")==null?"":requestMap.get("applyContent"), "UTF-8");
+            String approveDetail = URLDecoder.decode(requestMap.get("approveDetail")==null?"":requestMap.get("approveDetail"), "UTF-8");
+            String id = URLDecoder.decode(requestMap.get("userId")==null?"":requestMap.get("userId"), "UTF-8");
+            String approverId = URLDecoder.decode(requestMap.get("approverId")==null?"":requestMap.get("approverId"), "UTF-8");
+            String CCId = URLDecoder.decode(requestMap.get("CCId")==null?"":requestMap.get("CCId"), "UTF-8");
+            String delFlag="0"; //审核流程状态标记 0 待审核 1 审核完成
+            User user = new User(); //记录请假人的
+            OaAll oaAll = new OaAll();
+            String type = "1";
+            String alias = "1";
+            List<String> assigneeList=new ArrayList<String>(); //分配任务的人员
+            if(approverId!=null && !approverId.equals("")) {
+                if (approverId.contains(UserUtils.getUser().getId())){
+                    json.setMsg("通用审批申请失败,审批人不能为本人");
+                    json.setErrorCode(ErrorCode.code_1010);
+                    json.setSuccess(false);
+                    return json;
+                }
+                String[] approverIds = approverId.split(",");
+                for (int i =0 ;i<approverIds.length;i++){
+                    assigneeList.add(approverIds[i]);
+                    /*String key = "auditUserId"+ (i+1);
+                    variables.put(key, approverIds[i]);*/
+                }
+                type = approverIds.length+"";
+                alias = approverIds[0];
+            }
+            variables.put("assigneeList", assigneeList);
+            variables.put("count",assigneeList.size());
+            User CC = new User();
+            CC.setId(CCId);
+            user.setId(id);
+            oaAll.setUser(user);
+            oaAll.setApplyContent(applyContent);
+            oaAll.setApproveDetail(approveDetail);
+            oaAll.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            oaAll.setOfficeId(UserUtils.getSelectOffice()==null?"":UserUtils.getSelectOffice().getId());
+            oaAll.setCreateBy(user);
+            oaAll.setUpdateBy(user);
+            oaAll.setDelFlag(delFlag);
+            oaAll.setStatus("1");
+            oaAllService.save(oaAll, variables);
+            ApprovalCopy approvalCopy = new ApprovalCopy();
+            approvalCopy.setCCId(CCId==null?"":CCId);
+            approvalCopy.setUserId(user.getId());
+            approvalCopy.setType("allApprove");
+            approvalCopy.setApprovalId(oaAll.getId());
+            approvalCopy.setApproverId(approverId);
+            approvalCopy.setReadFlag("0");
+            approvalCopyService.save(approvalCopy);
+            //给抄送人、审批人发送通知
+            if(approvalCopy!=null && org.apache.commons.lang3.StringUtils.isNotBlank(approvalCopy.getId())){
+                String chaosongIds = approvalCopy.getCCId();//给所有抄送人发送通知
+                String shenpiIds = alias;//给审批流程的第一个人发送通知
+                oaAllService.sendNotify(chaosongIds,shenpiIds,approvalCopy.getApprovalId());
+                UserUtils.pushIm(alias,"申请人:" + user.getName() + ",通用审批申请 待审批");
+               /* List<WebSocket> toUserConns = ChatServerPool.getWebSocketByUser(alias);
+                for (WebSocket toUserConn:toUserConns) {
+                    String message = "{\"to\":\""+alias+"\"," +
+                            "\"msg\":\"审批信息 申请人:" + user.getName() + ",通用审批申请 待审批!\"," +
+                            "\"useType\":\"sys\"}";
+                    ChatServerPool.sendMessageToUser(toUserConn, message);//同时向本人发送消息
+                }*/
+            }
+
+            //推送
+            String title = "审批";
+            String content = UserUtils.getUser().getName() + "的通用审批申请需要你审批";
+            String status = "待审批";
+            String remarks = "通用审批申请内容类型:" + oaAll.getApplyContent();
+            Map extras = new HashMap();
+            extras.put("type", "4001");
+            extras.put("id", oaAll.getId());
+            extras.put("procDefKey", "allApprove");
+
+            boolean b = JPushClientUtil.sendNotificationToAlias(title, content, extras, alias);
+            Pushinfo pushinfo = new Pushinfo();
+            pushinfo.setCurrentUser(UserUtils.getUser());
+            pushinfo.setRemarks(remarks);
+            pushinfo.setUserId(UserUtils.getUser().getId());
+            pushinfo.setType("4001");
+            pushinfo.setPushId(oaAll.getId());
+            pushinfo.setTitle(title);
+            pushinfo.setContent(content);
+            pushinfo.setStatus(status);
+            pushinfo.setAddcontent("allApprove");
+            pushinfo.setPushUserId(alias);
+            pushinfo.setParentType("singleApproval");
+            pushinfo.setMobile("ios,android");
+            pushinfo.setCompanyId(UserUtils.getSelectCompany() == null ? "" : UserUtils.getSelectCompany().getId());
+            pushinfoService.save(pushinfo);
+            if (b){
+                json.setSuccess(true);
+                json.setErrorCode(ErrorCode.code_1004);
+                json.setMsg("通用审批申请已经提交");
+                json.put("id", oaAll.getId());
+            }else {
+                json.setMsg("通用审批申请推送失败");
+                json.setErrorCode(ErrorCode.code_2006);
+                json.setSuccess(false);
+            }
+        } catch (Exception e) {
+            logger.error("启动通用审批流程失败:", e);
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2004);
+            json.setMsg("启动通用审批流程失败");
+        }
+        return json;
+    }
+
+    /**
+     * 保存附件
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveFile",method=RequestMethod.POST)
+    public AjaxJson saveFile(MultipartHttpServletRequest multiRequest,HttpServletRequest servletRequest) throws Exception{
+        AjaxJson j=new AjaxJson();
+        try {
+            String id = multiRequest.getParameter("id");
+            OaAll oaAll =  oaAllService.getById(id);
+            OSSClientUtil ossUtil =new OSSClientUtil();
+
+            Iterator<String> fileNames = multiRequest.getFileNames();
+            String thisFiles = oaAll.getFiles();
+            String filePaths= "";
+            System.out.println("-----------开始------------------");
+            while(fileNames.hasNext()){
+
+                //取得上传文件
+                MultipartFile file = multiRequest.getFile(fileNames.next());
+                if(file != null){
+                    //取得当前上传文件的文件名称
+                    //String filePath= ossUtil.uploadFile2OSS(file, "oaAll");
+                    OSSClientUtil ossClientUtil = new OSSClientUtil();
+                    String filePath= oaAllService.uploadFile(ossClientUtil,file,oaAll,"67");
+                    filePaths = filePath;
+                }
+            }
+            /*if(thisFiles==null || thisFiles.equals("")){
+                if(filePaths.contains(",")){
+                    oaAll.setFiles(filePaths.substring(1, filePaths.length() - 1));
+                }else {
+                    oaAll.setFiles(filePaths);
+                }
+            }else{
+                filePaths = thisFiles+","+filePaths;
+                oaAll.setFiles(filePaths);
+            }*/
+            System.out.println("-----------结束------------------");
+            oaAllService.saveFile(oaAll);
+            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;
+        }
+    }
+
+    /**
+     * 获取详情
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "getOaAllById", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getOaAllById(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        String id = request.getParameter("id");
+        String type = request.getParameter("type");
+        Map map = oaAllService.getLeaveById(id,type);
+        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;
+    }
+}

+ 309 - 0
src/main/java/com/jeeplus/modules/API/works/oabuycontroller/OaBController.java

@@ -0,0 +1,309 @@
+package com.jeeplus.modules.API.works.oabuycontroller;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.JPushClientUtil;
+import com.jeeplus.common.utils.JsonUtil;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.buydetails.entity.BuyDetails;
+import com.jeeplus.modules.oabuy.entity.OaBuy;
+import com.jeeplus.modules.oabuy.service.OaBuyService;
+import com.jeeplus.modules.pushinfo.entity.Pushinfo;
+import com.jeeplus.modules.pushinfo.service.PushinfoService;
+import com.jeeplus.modules.sys.dao.UserDao;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.sys.service.WorkattachmentService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workapprovalcopy.entity.ApprovalCopy;
+import com.jeeplus.modules.workapprovalcopy.service.ApprovalCopyService;
+import com.jeeplus.modules.workclientinfo.dao.WorkClientAttachmentDao;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
+import com.jeeplus.modules.workovertimeform.entity.WorkOvertimeForm;
+import com.jeeplus.modules.workovertimeform.service.WorkOvertimeFormService;
+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.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 流程
+ */
+@RequestMapping(value = "${frontPath}/oabuy/oabuy")
+@Controller
+public class OaBController extends BaseController {
+    @Autowired
+    private OaBuyService oaBuyService;
+    @Autowired
+    private UserDao userDao;
+    @Autowired
+    private WorkClientAttachmentDao workClientAttachmentService;
+    @Autowired
+    private WorkattachmentService workattachmentService;
+
+    @Autowired
+    private ApprovalCopyService approvalCopyService;
+
+    @Autowired
+    private PushinfoService pushinfoService;
+
+    /**
+     * 启动采购申请
+     *
+     * @param request
+     * @param response
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveOaBuy", method = RequestMethod.POST)
+    public AjaxJson oaBuy(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+        AjaxJson json = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        try {
+            Map<String, Object> variables = Maps.newHashMap();
+            HashMap<String, String> requestMap = findRequestMap(request);
+
+            String applyContent = URLDecoder.decode(requestMap.get("applyContent")==null?"":requestMap.get("applyContent"), "UTF-8");
+            String buySort = URLDecoder.decode(requestMap.get("buySort")==null?"":requestMap.get("buySort"), "UTF-8");
+            String id = URLDecoder.decode(requestMap.get("userId")==null?"":requestMap.get("userId"), "UTF-8");
+            String totalPrice = URLDecoder.decode(requestMap.get("totalPrice")==null?"":requestMap.get("totalPrice"), "UTF-8");
+            String deliverDate = URLDecoder.decode(requestMap.get("deliverDate")==null?"":requestMap.get("deliverDate"), "UTF-8");
+            String payStyle = URLDecoder.decode(requestMap.get("payStyle")==null?"":requestMap.get("payStyle"), "UTF-8");
+            String CCId = URLDecoder.decode(requestMap.get("CCId")==null?"":requestMap.get("CCId"), "UTF-8");
+            String approverId = URLDecoder.decode(requestMap.get("approverId")==null?"":requestMap.get("approverId"), "UTF-8");
+            String buyDetailsList = URLDecoder.decode(requestMap.get("buyDetailsList")==null?"":requestMap.get("buyDetailsList"), "UTF-8");
+            String remark = URLDecoder.decode(requestMap.get("remarks")==null?"":requestMap.get("remarks"), "UTF-8");
+            String delFlag="0"; //审核流程状态标记 0 待审核 1 审核完成
+            User user = new User(); //记录请假人的
+            OaBuy oaBuy = new OaBuy();
+            String type = "1";
+            String alias = "1";
+            List<String> assigneeList=new ArrayList<String>(); //分配任务的人员
+            if(approverId!=null && !approverId.equals("")) {
+                if (approverId.contains(UserUtils.getUser().getId())){
+                    json.setMsg("采购申请失败,审批人不能为本人");
+                    json.setErrorCode(ErrorCode.code_1010);
+                    json.setSuccess(false);
+                    return json;
+                }
+                String[] approverIds = approverId.split(",");
+                for (int i =0 ;i<approverIds.length;i++){
+                    assigneeList.add(approverIds[i]);
+                    /*String key = "auditUserId"+ (i+1);
+                    variables.put(key, approverIds[i]);*/
+                }
+                type = approverIds.length+"";
+                alias = approverIds[0];
+            }
+            variables.put("assigneeList", assigneeList);
+            variables.put("count",assigneeList.size());
+            User CC = new User();
+            CC.setId(CCId);
+            user.setId(id);
+            oaBuy.setUser(user);
+            oaBuy.setApplyContent(applyContent);
+            oaBuy.setBuySort(buySort);
+            if(StringUtils.isNotBlank(deliverDate)){
+                oaBuy.setDeliverDate(sdf.parse(deliverDate));
+            }
+            List<BuyDetails> buyDetailsList2 = new ArrayList<BuyDetails>();
+            if(StringUtils.isNotBlank(buyDetailsList)){
+                List<BuyDetails> detailsList = JsonUtil.json_to_list(buyDetailsList, BuyDetails.class);
+                if(detailsList!=null && detailsList.size()>0){
+                    for (int i = 0; i < detailsList.size(); i++) {
+                        BuyDetails buyDetails = detailsList.get(i);
+                        buyDetails.setId("");
+                        buyDetailsList2.add(buyDetails);
+                    }
+                }
+
+            }
+            oaBuy.setBuyDetailsList(buyDetailsList2);
+            oaBuy.setTotalPrice(totalPrice);
+            oaBuy.setPayStyle(payStyle);
+            oaBuy.setRemarks(remark);
+            oaBuy.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            oaBuy.setOfficeId(UserUtils.getSelectOffice()==null?"":UserUtils.getSelectOffice().getId());
+            oaBuy.setCreateBy(user);
+            oaBuy.setUpdateBy(user);
+            oaBuy.setDelFlag(delFlag);
+            oaBuy.setStatus("1");
+            oaBuyService.save(oaBuy, variables);
+            ApprovalCopy approvalCopy = new ApprovalCopy();
+            approvalCopy.setCCId(CCId==null?"":CCId);
+            approvalCopy.setUserId(user.getId());
+            approvalCopy.setType("oaBuy");
+            approvalCopy.setApprovalId(oaBuy.getId());
+            approvalCopy.setApproverId(approverId);
+            approvalCopy.setReadFlag("0");
+            approvalCopyService.save(approvalCopy);
+            //给抄送人、审批人发送通知
+            if(approvalCopy!=null && org.apache.commons.lang3.StringUtils.isNotBlank(approvalCopy.getId())){
+                String chaosongIds = approvalCopy.getCCId();//给所有抄送人发送通知
+                String shenpiIds = alias;//给审批流程的第一个人发送通知
+                oaBuyService.sendNotify(chaosongIds,shenpiIds,approvalCopy.getApprovalId());
+                String content = "审批信息 申请人:" + user.getName() + ",采购申请 待审批!";
+                UserUtils.pushIm(alias,content);
+            }
+
+            //推送
+            String title = "审批";
+            String content = UserUtils.getUser().getName() + "的采购申请需要你审批";
+            String status = "待审批";
+            String remarks = "采购申请内容类型:" + oaBuy.getApplyContent();
+            Map extras = new HashMap();
+            extras.put("type", "4001");
+            extras.put("id", oaBuy.getId());
+            extras.put("procDefKey", "oaBuy");
+
+            boolean b = JPushClientUtil.sendNotificationToAlias(title, content, extras, alias);
+            Pushinfo pushinfo = new Pushinfo();
+            pushinfo.setCurrentUser(UserUtils.getUser());
+            pushinfo.setRemarks(remarks);
+            pushinfo.setUserId(UserUtils.getUser().getId());
+            pushinfo.setType("4001");
+            pushinfo.setPushId(oaBuy.getId());
+            pushinfo.setTitle(title);
+            pushinfo.setContent(content);
+            pushinfo.setStatus(status);
+            pushinfo.setAddcontent("oaBuy");
+            pushinfo.setPushUserId(alias);
+            pushinfo.setParentType("singleApproval");
+            pushinfo.setMobile("ios,android");
+            pushinfo.setCompanyId(UserUtils.getSelectCompany() == null ? "" : UserUtils.getSelectCompany().getId());
+            pushinfoService.save(pushinfo);
+            if (b){
+                json.setSuccess(true);
+                json.setErrorCode(ErrorCode.code_1004);
+                json.setMsg("采购申请已经提交");
+                json.put("id", oaBuy.getId());
+            }else {
+                json.setMsg("采购申请推送失败");
+                json.setErrorCode(ErrorCode.code_2006);
+                json.setSuccess(false);
+            }
+        } catch (Exception e) {
+            logger.error("启动采购流程失败:", e);
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2004);
+            json.setMsg("启动采购流程失败");
+        }
+        return json;
+    }
+
+    /**
+     * 保存附件
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveFile",method=RequestMethod.POST)
+    public AjaxJson saveFile(MultipartHttpServletRequest multiRequest,HttpServletRequest servletRequest) throws Exception{
+        AjaxJson j=new AjaxJson();
+        try {
+            String id = multiRequest.getParameter("id");
+            OaBuy oaBuy =  oaBuyService.getById(id);
+            OSSClientUtil ossUtil =new OSSClientUtil();
+
+            Iterator<String> fileNames = multiRequest.getFileNames();
+            System.out.println("-----------开始------------------");
+           /* while(fileNames.hasNext()){
+                MultipartFile file = multiRequest.getFile(fileNames.next());
+                if(file != null && !file.isEmpty() &&file.getSize()>0){
+                    String fileName = file.getOriginalFilename();
+                    String fileType = fileName.substring(fileName.lastIndexOf("."));
+                    String url = ossUtil.uploadFile2OSS(file, "oaBuy");
+                    WorkClientAttachment workattachment = new WorkClientAttachment();
+                    workattachment.setUrl(url);
+                    workattachment.setType(fileType);
+                    workattachment.setAttachmentName(fileName);
+                    workattachment.setAttachmentUser(UserUtils.getUser().getId());
+                    workattachment.setAttachmentId(oaBuy.getId());
+                    workattachment.setAttachmentFlag("69");
+                    workClientAttachmentService.insert(workattachment);
+                }
+            }
+            List<Workattachment> attachmentList = workattachmentService.getListByAttachmentIdAndFlag(id, "69");
+            String filePath = ",";
+            if(attachmentList!=null && attachmentList.size()>0){
+                for (int i = 0; i < attachmentList.size(); i++) {
+                    if(StringUtils.isNotBlank(attachmentList.get(i).getUrl())){
+                        filePath += attachmentList.get(i).getUrl();
+                    }
+                }
+            }
+            if(filePath.length()>2){
+                filePath = filePath.substring(1);
+            }*/
+            String thisFiles = oaBuy.getFiles();
+            String filePaths= "";
+            while(fileNames.hasNext()){
+
+                //取得上传文件
+                MultipartFile file = multiRequest.getFile(fileNames.next());
+                if(file != null){
+                    //取得当前上传文件的文件名称
+                    //String filePath= ossUtil.uploadFile2OSS(file, "oaBuy");
+                    OSSClientUtil ossClientUtil = new OSSClientUtil();
+                    String filePath= oaBuyService.uploadFile(ossClientUtil,file,oaBuy,"69");
+                    filePaths = filePath;
+                }
+            }
+            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;
+        }
+    }
+
+    /**
+     * 获取详情
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "getOaBuyById", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getOaBuyById(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        String id = request.getParameter("id");
+        String type = request.getParameter("type");
+        Map map = oaBuyService.getBuyById(id,type);
+        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;
+    }
+}

+ 281 - 0
src/main/java/com/jeeplus/modules/API/works/oaevectioncontroller/OaEvectionMobileController.java

@@ -0,0 +1,281 @@
+package com.jeeplus.modules.API.works.oaevectioncontroller;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.JPushClientUtil;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.common.websocket.onchat.ChatServerPool;
+import com.jeeplus.modules.oa_evection.entity.oa_evection.OaEvection;
+import com.jeeplus.modules.oa_evection.service.oa_evection.OaEvectionService;
+import com.jeeplus.modules.pushinfo.entity.Pushinfo;
+import com.jeeplus.modules.pushinfo.service.PushinfoService;
+import com.jeeplus.modules.sys.dao.UserDao;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workapprovalcopy.entity.ApprovalCopy;
+import com.jeeplus.modules.workapprovalcopy.service.ApprovalCopyService;
+import org.java_websocket.WebSocket;
+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.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 出差流程
+ */
+@RequestMapping(value = "${frontPath}/oaevection/oaevection")
+@Controller
+public class OaEvectionMobileController extends BaseController {
+    @Autowired
+    private OaEvectionService oaEvectionService;
+
+    @Autowired
+    private UserDao userDao;
+
+    @Autowired
+    private ApprovalCopyService approvalCopyService;
+
+    @Autowired
+    private PushinfoService pushinfoService;
+
+    /**
+     * 启动出差申请
+     *
+     * @param request
+     * @param response
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveOaEvection", method = RequestMethod.POST)
+    public AjaxJson oaEvection(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        AjaxJson json = new AjaxJson();
+        try {
+            Map<String, Object> variables = Maps.newHashMap();
+            HashMap<String, String> requestMap = findRequestMap(request);
+           /* if(requestMap.get("startTime").equals("") || requestMap.get("endTime").equals("")
+                    || requestMap.get("userId").equals("")|| requestMap.get("address").equals("")
+                    || requestMap.get("dateCount").equals("")|| requestMap.get("CCId").equals("")){
+                json.setErrorCode("1");
+                json.setSuccess(false);
+                json.setMsg("必填参数不能为空");
+                return json;
+            }*/
+            //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String startTime = URLDecoder.decode(requestMap.get("startTime")==null?"":requestMap.get("startTime"), "UTF-8");
+            String endTime = URLDecoder.decode(requestMap.get("endTime")==null?"":requestMap.get("endTime"), "UTF-8");
+            String userId = URLDecoder.decode(requestMap.get("userId")==null?"":requestMap.get("userId"), "UTF-8");
+            String address = URLDecoder.decode(requestMap.get("address")==null?"":requestMap.get("address"), "UTF-8");
+            String dateCount = URLDecoder.decode(requestMap.get("dateCount")==null?"":requestMap.get("dateCount"), "UTF-8");
+            String reason = URLDecoder.decode(requestMap.get("reason")==null?"":requestMap.get("reason"), "UTF-8");
+            String approverId = URLDecoder.decode(requestMap.get("approverId")==null?"":requestMap.get("approverId"), "UTF-8");
+            String CCId = URLDecoder.decode(requestMap.get("CCId")==null?"":requestMap.get("CCId"), "UTF-8");
+
+            String delFlag="0"; //审核流程状态标记 0 待审核 1 审核完成
+            User user = new User(); //记录请假人的
+            OaEvection oaEvection = new OaEvection();
+            String type = "1";
+            String alias = "1";
+            List<String> assigneeList=new ArrayList<String>(); //分配任务的人员
+            if(approverId!=null && !approverId.equals("")) {
+                if (approverId.contains(UserUtils.getUser().getId())){
+                    json.setMsg("出差申请失败,审批人不能为本人");
+                    json.setErrorCode("101");
+                    json.setSuccess(false);
+                    return json;
+                }
+                String[] approverIds = approverId.split(",");
+                for (int i =0 ;i<approverIds.length;i++){
+                    assigneeList.add(approverIds[i]);
+                    /*String key = "auditUserId"+ (i+1);
+                    variables.put(key, approverIds[i]);*/
+                }
+                type = approverIds.length+"";
+                alias = approverIds[0];
+            }
+            variables.put("assigneeList", assigneeList);
+            variables.put("count",assigneeList.size());
+            User CC = new User();
+            CC.setId(CCId);
+            user.setId(userId);
+
+            oaEvection.setStartTime(startTime);
+            oaEvection.setEndTime(endTime);
+            oaEvection.setAddress(address);
+            oaEvection.setDateCount(dateCount);
+            oaEvection.setReason(reason);
+            oaEvection.setCreateBy(user);
+            oaEvection.setStatus("1");
+            oaEvection.setUpdateBy(user);
+            oaEvection.setDelFlag(delFlag);
+            oaEvection.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            oaEvection.setOfficeId(UserUtils.getSelectOffice()==null?"":UserUtils.getSelectOffice().getId());
+            oaEvectionService.submit(oaEvection,variables,type);
+            ApprovalCopy approvalCopy = new ApprovalCopy();
+            approvalCopy.setCCId(CCId==null?"":CCId);
+            approvalCopy.setUserId(userId);
+            approvalCopy.setType("evection");
+            approvalCopy.setRemarks(reason);
+            approvalCopy.setApprovalId(oaEvection.getId());
+            approvalCopy.setApproverId(approverId);
+            approvalCopy.setReadFlag("0");
+            approvalCopyService.save(approvalCopy);
+
+            //给抄送人、审批人发送通知
+            if (approvalCopy != null && org.apache.commons.lang3.StringUtils.isNotBlank(approvalCopy.getId())) {
+                String chaosongIds = approvalCopy.getCCId();//给所有抄送人发送通知
+                String shenpiIds = alias;//给审批流程的第一个人发送通知
+                oaEvectionService.sendNotify(chaosongIds, shenpiIds, approvalCopy.getApprovalId());
+                UserUtils.pushIm(alias,"申请人:" + user.getName() + ",出差申请 待审批!");
+                /*List<WebSocket> toUserConns = ChatServerPool.getWebSocketByUser(alias);
+                for (WebSocket toUserConn:toUserConns) {
+                    String message = "{\"to\":\""+alias+"\"," +
+                            "\"msg\":\"审批信息 申请人:" + user.getName() + ",出差申请 待审批!\"," +
+                            "\"useType\":\"sys\"}";
+                    ChatServerPool.sendMessageToUser(toUserConn, message);//同时向本人发送消息
+                }*/
+            }
+
+            String title="审批";
+            String content =  UserUtils.getUser().getName()+"的出差申请需要你审批";
+            String status = "待审批";
+            String remarks =  "开始时间:"+startTime+ "\n"
+                    +"结束时间:"+endTime+ "\n"
+                    +"出差地点:"+address;
+            Map extras = new HashMap();
+            extras.put("type", "4001");
+            extras.put("id", oaEvection.getId());
+            extras.put("procDefKey", "evection");
+
+            boolean b = JPushClientUtil.sendNotificationToAlias(title, content, extras, alias);
+            Pushinfo pushinfo = new Pushinfo();
+            pushinfo.setCurrentUser(UserUtils.getUser());
+            pushinfo.setRemarks(remarks);
+            pushinfo.setUserId(UserUtils.getUser().getId());
+            pushinfo.setType("4001");
+            pushinfo.setPushId(oaEvection.getId());
+            pushinfo.setTitle(title);
+            pushinfo.setStatus(status);
+            pushinfo.setContent(content);
+            pushinfo.setMobile("ios,android");
+            pushinfo.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            pushinfo.setAddcontent("evection");
+            pushinfo.setPushUserId(alias);
+            pushinfo.setParentType("singleApproval");
+            pushinfoService.save(pushinfo);
+            if (b){
+                json.setSuccess(true);
+                json.setErrorCode(ErrorCode.code_1004);
+                json.setMsg("出差申请已经提交");
+                json.put("id", oaEvection.getId());
+            }else {
+                json.setMsg("出差申请推送失败");
+                json.setErrorCode(ErrorCode.code_2006);
+                json.setSuccess(false);
+            }
+        } catch (Exception e) {
+            logger.error("启动出差流程失败:", e);
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2004);
+            json.setMsg("启动出差流程失败");
+        }
+        return json;
+    }
+
+    /**
+     * 保存附件
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveFile",method=RequestMethod.POST)
+    public AjaxJson saveFile(MultipartHttpServletRequest multiRequest,HttpServletRequest servletRequest) throws Exception{
+        AjaxJson j=new AjaxJson();
+        try {
+            String id = multiRequest.getParameter("id");
+            OaEvection oaEvection =  oaEvectionService.getById(id);
+            OSSClientUtil ossUtil =new OSSClientUtil();
+
+            Iterator<String> fileNames = multiRequest.getFileNames();
+            String thisFiles = oaEvection.getFiles();
+            String filePaths= "";
+            System.out.println("-----------开始------------------");
+            while(fileNames.hasNext()){
+
+                //取得上传文件
+                MultipartFile file = multiRequest.getFile(fileNames.next());
+                if(file != null){
+                    //取得当前上传文件的文件名称
+                    //String filePath= ossUtil.uploadFile2OSS(file, "evection");
+                    OSSClientUtil ossClientUtil = new OSSClientUtil();
+                    String filePath= oaEvectionService.uploadFile(ossClientUtil,file,oaEvection,"73");
+                    filePaths = filePath;
+                }
+            }
+            /*if(thisFiles==null || thisFiles.equals("")){
+                if(filePaths.contains(",")){
+                    oaEvection.setFiles(filePaths.substring(1, filePaths.length() - 1));
+                }else {
+                    oaEvection.setFiles(filePaths);
+                }
+            }else{
+                filePaths = thisFiles+","+filePaths;
+                oaEvection.setFiles(filePaths);
+            }
+            oaEvectionService.saveFile(oaEvection);*/
+            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;
+        }
+    }
+
+    /**
+     * 获取详情
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "getEvectionById", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getEvectionById(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        String id = request.getParameter("id");
+        String type = request.getParameter("type");
+        Map map = oaEvectionService.getEvectionById(id,type);
+        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;
+    }
+}

+ 213 - 0
src/main/java/com/jeeplus/modules/API/works/oaperformancecontroller/OaPController.java

@@ -0,0 +1,213 @@
+package com.jeeplus.modules.API.works.oaperformancecontroller;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.JPushClientUtil;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.oaperformance.entity.OaPerformance;
+import com.jeeplus.modules.oaperformance.service.OaPerformanceService;
+import com.jeeplus.modules.pushinfo.entity.Pushinfo;
+import com.jeeplus.modules.pushinfo.service.PushinfoService;
+import com.jeeplus.modules.sys.dao.UserDao;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workapprovalcopy.entity.ApprovalCopy;
+import com.jeeplus.modules.workapprovalcopy.service.ApprovalCopyService;
+import com.jeeplus.modules.workovertimeform.entity.WorkOvertimeForm;
+import com.jeeplus.modules.workovertimeform.service.WorkOvertimeFormService;
+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.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 流程
+ */
+@RequestMapping(value = "${frontPath}/oaperformance/oaperformance")
+@Controller
+public class OaPController extends BaseController {
+    @Autowired
+    private WorkOvertimeFormService workOvertimeFormService;
+    @Autowired
+    private OaPerformanceService oaPerformanceService;
+    @Autowired
+    private UserDao userDao;
+
+    @Autowired
+    private ApprovalCopyService approvalCopyService;
+
+    @Autowired
+    private PushinfoService pushinfoService;
+
+    /**
+     * 启动绩效自评
+     *
+     * @param request
+     * @param response
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveOaPerformance", method = RequestMethod.POST)
+    public AjaxJson oaPerformance(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+        AjaxJson json = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            Map<String, Object> variables = Maps.newHashMap();
+            HashMap<String, String> requestMap = findRequestMap(request);
+
+            String lastWork = URLDecoder.decode(requestMap.get("lastWork")==null?"":requestMap.get("lastWork"), "UTF-8");
+            String finishWork = URLDecoder.decode(requestMap.get("finishWork")==null?"":requestMap.get("finishWork"), "UTF-8");
+            String finishRate = URLDecoder.decode(requestMap.get("finishRate")==null?"":requestMap.get("finishRate"), "UTF-8");
+            String lastPerformance = URLDecoder.decode(requestMap.get("lastPerformance")==null?"":requestMap.get("lastPerformance"), "UTF-8");
+            String nowWork = URLDecoder.decode(requestMap.get("nowWork")==null?"":requestMap.get("nowWork"), "UTF-8");
+            String nowPlan = URLDecoder.decode(requestMap.get("nowPlan")==null?"":requestMap.get("nowPlan"), "UTF-8");
+            String id = URLDecoder.decode(requestMap.get("userId")==null?"":requestMap.get("userId"), "UTF-8");
+            String approverId = URLDecoder.decode(requestMap.get("approverId")==null?"":requestMap.get("approverId"), "UTF-8");
+            String CCId = URLDecoder.decode(requestMap.get("CCId")==null?"":requestMap.get("CCId"), "UTF-8");
+            String delFlag="0"; //审核流程状态标记 0 待审核 1 审核完成
+            User user = new User(); //记录申请人的
+            OaPerformance oaPerformance = new OaPerformance();
+            String type = "1";
+            String alias = "1";
+            List<String> assigneeList=new ArrayList<String>(); //分配任务的人员
+            if(approverId!=null && !approverId.equals("")) {
+                if (approverId.contains(UserUtils.getUser().getId())){
+                    json.setMsg("申请失败,审批人不能为本人");
+                    json.setErrorCode(ErrorCode.code_1010);
+                    json.setSuccess(false);
+                    return json;
+                }
+                String[] approverIds = approverId.split(",");
+                for (int i =0 ;i<approverIds.length;i++){
+                    assigneeList.add(approverIds[i]);
+                    /*String key = "auditUserId"+ (i+1);
+                    variables.put(key, approverIds[i]);*/
+                }
+                type = approverIds.length+"";
+                alias = approverIds[0];
+            }
+            variables.put("assigneeList", assigneeList);
+            variables.put("count",assigneeList.size());
+            User CC = new User();
+            CC.setId(CCId);
+            user.setId(id);
+            oaPerformance.setLastWork(lastWork);
+            oaPerformance.setFinishWork(finishWork);
+            oaPerformance.setFinishRate(finishRate);
+            oaPerformance.setLastPerformance(lastPerformance);
+            oaPerformance.setNowWork(nowWork);
+            oaPerformance.setNowPlan(nowPlan);
+            oaPerformance.setUser(user);
+            oaPerformance.setCreateBy(user);
+            oaPerformance.setUpdateBy(user);
+            oaPerformance.setStatus("1");
+            oaPerformance.setDelFlag("0");
+            oaPerformance.setCompanyId(UserUtils.getSelectCompany() == null ? "" : UserUtils.getSelectCompany().getId());
+            oaPerformance.setOfficeId(UserUtils.getSelectOffice()==null?"":UserUtils.getSelectOffice().getId());
+            oaPerformanceService.save(oaPerformance, variables);
+            ApprovalCopy approvalCopy = new ApprovalCopy();
+            approvalCopy.setCCId(CCId==null?"":CCId);
+            approvalCopy.setUserId(user.getId());
+            approvalCopy.setType("oaPerformance");
+            approvalCopy.setApprovalId(oaPerformance.getId());
+            approvalCopy.setApproverId(approverId);
+            approvalCopy.setReadFlag("0");
+            approvalCopyService.save(approvalCopy);
+
+            //给抄送人、审批人发送通知
+            if(approvalCopy!=null && org.apache.commons.lang3.StringUtils.isNotBlank(approvalCopy.getId())){
+                String chaosongIds = approvalCopy.getCCId();//给所有抄送人发送通知
+                String shenpiIds = alias;//给审批流程的第一个人发送通知
+                oaPerformanceService.sendNotify(chaosongIds,shenpiIds,approvalCopy.getApprovalId());
+                String content = "审批信息 申请人:" + user.getName() + ",绩效自评申请: 待审批!";
+                UserUtils.pushIm(alias,content);
+            }
+
+            //推送
+            String title = "审批";
+            String content = UserUtils.getUser().getName() + "的绩效自评申请需要你审批";
+            String status = "待审批";
+            String remarks = "绩效自评申请内容类型:" + oaPerformance.getLastPerformance();
+            Map extras = new HashMap();
+            extras.put("type", "4001");
+            extras.put("id", oaPerformance.getId());
+            extras.put("procDefKey", "oaPerformance");
+
+            boolean b = JPushClientUtil.sendNotificationToAlias(title, content, extras, alias);
+            Pushinfo pushinfo = new Pushinfo();
+            pushinfo.setCurrentUser(UserUtils.getUser());
+            pushinfo.setRemarks(remarks);
+            pushinfo.setUserId(UserUtils.getUser().getId());
+            pushinfo.setType("4001");
+            pushinfo.setPushId(oaPerformance.getId());
+            pushinfo.setTitle(title);
+            pushinfo.setContent(content);
+            pushinfo.setStatus(status);
+            pushinfo.setAddcontent("oaPerformance");
+            pushinfo.setPushUserId(alias);
+            pushinfo.setParentType("singleApproval");
+            pushinfo.setMobile("ios,android");
+            pushinfo.setCompanyId(UserUtils.getSelectCompany() == null ? "" : UserUtils.getSelectCompany().getId());
+            pushinfoService.save(pushinfo);
+            if (b){
+                json.setSuccess(true);
+                json.setErrorCode(ErrorCode.code_1004);
+                json.setMsg("绩效自评申请已经提交");
+                json.put("id", oaPerformance.getId());
+            }else {
+                json.setMsg("绩效自评申请推送失败");
+                json.setErrorCode(ErrorCode.code_2006);
+                json.setSuccess(false);
+            }
+        } catch (Exception e) {
+            logger.error("启动绩效自评流程失败:", e);
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2004);
+            json.setMsg("启动绩效自评流程失败");
+        }
+        return json;
+    }
+
+    /**
+     * 获取详情
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "getOaPerformanceById", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getOaPerformanceById(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        String id = request.getParameter("id");
+        String type = request.getParameter("type");
+        Map map = oaPerformanceService.getBuyById(id,type);
+        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;
+    }
+}

+ 124 - 0
src/main/java/com/jeeplus/modules/API/works/outworksignin/WorkOutSignInInterfaceController.java

@@ -0,0 +1,124 @@
+package com.jeeplus.modules.API.works.outworksignin;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.jeeplus.modules.utils.ErrorCode;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workoutsignin.dao.WorkOutSignInDao;
+import com.jeeplus.modules.workoutsignin.entity.WorkOutSignIn;
+import com.jeeplus.modules.workoutsignin.service.WorkOutSignInService;
+
+@Controller
+@RequestMapping(value = "${frontPath}/work/workOutSignIn")
+public class WorkOutSignInInterfaceController extends BaseController {
+	
+	@Autowired
+	private WorkOutSignInService workOutSignInService;
+
+	@Autowired
+	private WorkOutSignInDao workOutSignInDao;
+
+	/**
+	 * 外勤签到
+	 */
+	@ResponseBody
+	@RequestMapping(value = "saveSignIn", method = RequestMethod.POST)
+	public AjaxJson saveSignIn(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+		AjaxJson j = new AjaxJson();
+		HashMap<String,String> requestMap = findRequestMap(request);
+		String location = requestMap.get("location");
+		String locationInfo = requestMap.get("locationInfo");
+		String longitude = requestMap.get("longitude");
+		String latitude = requestMap.get("latitude");
+		User user = UserUtils.getUser();
+		WorkOutSignIn workOutSignIn = new WorkOutSignIn();
+		workOutSignIn.setUser(user);
+		workOutSignIn.setLocationName(location);
+		workOutSignIn.setLocationInfo(locationInfo);
+		workOutSignIn.setLatitude(latitude);
+		workOutSignIn.setLongitude(longitude);
+		workOutSignIn.setCompanyId(UserUtils.getSelectCompany().getId());
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		workOutSignInService.save(workOutSignIn);
+		j.setMsg("签到成功");
+        j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+
+	/**
+	 * 历史足迹
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getSignInHistory", method = RequestMethod.GET)
+	public AjaxJson getSignInHistory(HttpServletRequest request, HttpServletResponse response,
+			RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        try {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String pageNo = request.getParameter("pageNo");
+            User user = UserUtils.getUser();
+            WorkOutSignIn workOutSignIn = new WorkOutSignIn();
+            workOutSignIn.setUser(user);
+            workOutSignIn.setCompanyId(UserUtils.getSelectCompany().getId());
+            Page<WorkOutSignIn> page = workOutSignInService.findPage(new Page<WorkOutSignIn>(request, response), workOutSignIn);
+            List<WorkOutSignIn> list = page.getList();
+            List<Map<String, Object>> mapList = Lists.newArrayList();
+            for (WorkOutSignIn work : list) {
+                Map<String, Object> map = Maps.newHashMap();
+                map.put("location", work.getLocationName());
+                map.put("locationInfo", work.getLocationInfo());
+                map.put("time", sdf.format(work.getCreateDate()));
+                mapList.add(map);
+            }
+            if (pageNo == null || pageNo.equals("")) {
+                j.put("data", Lists.newArrayList());
+                j.setMsg("获取历史足迹失败");
+                j.setSuccess(false);
+                j.setErrorCode(ErrorCode.code_2005);
+            } else {
+                if (mapList == null) {
+                    j.put("data", Lists.newArrayList());
+                    j.setMsg("获取历史足迹成功");
+                    j.setSuccess(true);
+                    j.setErrorCode(ErrorCode.code_1004);
+                } 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);
+                    }
+                }
+            }
+        }catch (Exception e){
+            j.put("data", Lists.newArrayList());
+            j.setMsg("获取历史足迹失败");
+            j.setSuccess(false);
+            j.setErrorCode(ErrorCode.code_2004);
+        }
+		return j;
+	}
+
+}

+ 275 - 0
src/main/java/com/jeeplus/modules/API/works/overtimecontroller/OverTimeMobileController.java

@@ -0,0 +1,275 @@
+package com.jeeplus.modules.API.works.overtimecontroller;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.JPushClientUtil;
+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.UserDao;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workapprovalcopy.entity.ApprovalCopy;
+import com.jeeplus.modules.workapprovalcopy.service.ApprovalCopyService;
+import com.jeeplus.modules.workovertimeform.entity.WorkOvertimeForm;
+import com.jeeplus.modules.workovertimeform.service.WorkOvertimeFormService;
+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.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 加班流程
+ */
+@RequestMapping(value = "${frontPath}/overtime/overtime")
+@Controller
+public class OverTimeMobileController extends BaseController {
+    @Autowired
+    private WorkOvertimeFormService workOvertimeFormService;
+
+    @Autowired
+    private UserDao userDao;
+
+    @Autowired
+    private ApprovalCopyService approvalCopyService;
+
+    @Autowired
+    private PushinfoService pushinfoService;
+
+    /**
+     * 启动加班申请
+     *
+     * @param request
+     * @param response
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveOverTime", method = RequestMethod.POST)
+    public AjaxJson overTime(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+        AjaxJson json = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            Map<String, Object> variables = Maps.newHashMap();
+            HashMap<String, String> requestMap = findRequestMap(request);
+
+            /*if(requestMap.get("startTime").equals("") || requestMap.get("endTime").equals("")
+                    || requestMap.get("userId").equals("")|| requestMap.get("longTime").equals("")
+                    || requestMap.get("isHolidays").equals("")|| requestMap.get("CCId").equals("")){
+                json.setErrorCode("1");
+                json.setSuccess(false);
+                json.setMsg("必填参数不能为空");
+                return json;
+            }*/
+            //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String startTime = URLDecoder.decode(requestMap.get("startTime")==null?"":requestMap.get("startTime"), "UTF-8");
+            String endTime = URLDecoder.decode(requestMap.get("endTime")==null?"":requestMap.get("endTime"), "UTF-8");
+            String id = URLDecoder.decode(requestMap.get("userId")==null?"":requestMap.get("userId"), "UTF-8");
+            String longTime = URLDecoder.decode(requestMap.get("longTime")==null?"":requestMap.get("longTime"), "UTF-8");
+            String isHolidays = URLDecoder.decode(requestMap.get("isHolidays")==null?"":requestMap.get("isHolidays"), "UTF-8");
+            String reason = URLDecoder.decode(requestMap.get("reason")==null?"":requestMap.get("reason"), "UTF-8");
+            String approverId = URLDecoder.decode(requestMap.get("approverId")==null?"":requestMap.get("approverId"), "UTF-8");
+            String CCId = URLDecoder.decode(requestMap.get("CCId")==null?"":requestMap.get("CCId"), "UTF-8");
+            String delFlag="0"; //审核流程状态标记 0 待审核 1 审核完成
+            User user = new User(); //记录请假人的
+            WorkOvertimeForm workOvertimeForm = new WorkOvertimeForm();
+            String type = "1";
+            String alias = "1";
+            List<String> assigneeList=new ArrayList<String>(); //分配任务的人员
+            if(approverId!=null && !approverId.equals("")) {
+                if (approverId.contains(UserUtils.getUser().getId())){
+                    json.setMsg("加班申请失败,审批人不能为本人");
+                    json.setErrorCode(ErrorCode.code_1010);
+                    json.setSuccess(false);
+                    return json;
+                }
+                String[] approverIds = approverId.split(",");
+                for (int i =0 ;i<approverIds.length;i++){
+                    assigneeList.add(approverIds[i]);
+                    /*String key = "auditUserId"+ (i+1);
+                    variables.put(key, approverIds[i]);*/
+                }
+                type = approverIds.length+"";
+                alias = approverIds[0];
+            }
+            variables.put("assigneeList", assigneeList);
+            variables.put("count",assigneeList.size());
+            User CC = new User();
+            CC.setId(CCId);
+            user.setId(id);
+            workOvertimeForm.setUser(user);
+            workOvertimeForm.setStartTime(startTime);
+            workOvertimeForm.setEndTime(endTime);
+            workOvertimeForm.setLongTime(longTime);
+            workOvertimeForm.setIsHolidays(isHolidays);
+            workOvertimeForm.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            workOvertimeForm.setOfficeId(UserUtils.getSelectOffice()==null?"":UserUtils.getSelectOffice().getId());
+            workOvertimeForm.setOffice(UserUtils.getSelectOffice());
+            workOvertimeForm.setCreateBy(user);
+            workOvertimeForm.setUpdateBy(user);
+            workOvertimeForm.setDelFlag(delFlag);
+            workOvertimeForm.setStatus("1");
+            workOvertimeForm.setReason(reason);
+            workOvertimeFormService.present(workOvertimeForm, variables,type);
+            ApprovalCopy approvalCopy = new ApprovalCopy();
+            approvalCopy.setCCId(CCId==null?"":CCId);
+            approvalCopy.setUserId(id);
+            approvalCopy.setRemarks(reason);
+            approvalCopy.setType("overtime");
+            approvalCopy.setApproverId(approverId);
+            approvalCopy.setApprovalId(workOvertimeForm.getId());
+            approvalCopy.setReadFlag("0");
+            approvalCopyService.save(approvalCopy);
+
+            //给抄送人、审批人发送通知
+            if(approvalCopy!=null && org.apache.commons.lang3.StringUtils.isNotBlank(approvalCopy.getId())){
+                String chaosongIds = approvalCopy.getCCId();//给所有抄送人发送通知
+                String shenpiIds = alias;//给审批流程的第一个人发送通知
+                workOvertimeFormService.sendNotify(chaosongIds,shenpiIds,approvalCopy.getApprovalId());
+                String content = "审批信息 申请人:" + user.getName() + ",加班申请: 待审批!";
+                UserUtils.pushIm(alias,content);
+            }
+
+            String title="审批";
+            String content =  UserUtils.getUser().getName()+"的加班申请需要你审批";
+            String status = "待审批";
+            String remarks = "开始时间:"+workOvertimeForm.getStartTime()+ "\n"
+                    +"结束时间:"+workOvertimeForm.getEndTime()+ "\n"
+                    +"加班时长(小时):"+workOvertimeForm.getLongTime();
+            Map extras = new HashMap();
+            extras.put("type", "4001");
+            extras.put("id", workOvertimeForm.getId());
+            extras.put("procDefKey", "overtime");
+
+            boolean b = JPushClientUtil.sendNotificationToAlias(title, content, extras, alias);
+            Pushinfo pushinfo = new Pushinfo();
+            pushinfo.setCurrentUser(UserUtils.getUser());
+            pushinfo.setRemarks(remarks);
+            pushinfo.setUserId(UserUtils.getUser().getId());
+            pushinfo.setType("4001");
+            pushinfo.setPushId(workOvertimeForm.getId());
+            pushinfo.setTitle(title);
+            pushinfo.setContent(content);
+            pushinfo.setStatus(status);
+            pushinfo.setAddcontent("overtime");
+            pushinfo.setMobile("ios,android");
+            pushinfo.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            pushinfo.setPushUserId(alias);
+            pushinfo.setParentType("singleApproval");
+            pushinfoService.save(pushinfo);
+            if (b){
+                json.setSuccess(true);
+                json.setErrorCode(ErrorCode.code_1004);
+                json.setMsg("加班申请已经提交");
+                json.put("id", workOvertimeForm.getId());
+            }else {
+                json.setMsg("加班申请推送失败");
+                json.setErrorCode(ErrorCode.code_2006);
+                json.setSuccess(false);
+            }
+        } catch (Exception e) {
+            logger.error("启动加班流程失败:", e);
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2004);
+            json.setMsg("启动加班流程失败");
+        }
+        return json;
+    }
+
+    /**
+     * 保存附件
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveFile",method=RequestMethod.POST)
+    public AjaxJson saveFile(MultipartHttpServletRequest multiRequest,HttpServletRequest servletRequest) throws Exception{
+        AjaxJson j=new AjaxJson();
+        try {
+            String id = multiRequest.getParameter("id");
+            WorkOvertimeForm workOvertimeForm =  workOvertimeFormService.getById(id);
+            OSSClientUtil ossUtil =new OSSClientUtil();
+
+            Iterator<String> fileNames = multiRequest.getFileNames();
+            String thisFiles = workOvertimeForm.getFiles();
+            String filePaths= "";
+            System.out.println("-----------开始------------------");
+            while(fileNames.hasNext()){
+
+                //取得上传文件
+                MultipartFile file = multiRequest.getFile(fileNames.next());
+                if(file != null){
+                    //取得当前上传文件的文件名称
+                    OSSClientUtil ossClientUtil = new OSSClientUtil();
+                    String filePath= workOvertimeFormService.uploadFile(ossClientUtil,file,workOvertimeForm,"72");
+                    //String filePath= ossUtil.uploadFile2OSS(file, "overtimeform");
+                    filePaths = filePath;
+                }
+            }
+           /* if(thisFiles==null || thisFiles.equals("")){
+                if(filePaths.contains(",")){
+                    workOvertimeForm.setFiles(filePaths.substring(1, filePaths.length() - 1));
+                }else {
+                    workOvertimeForm.setFiles(filePaths);
+                }
+            }else{
+                filePaths = thisFiles+","+filePaths;
+                workOvertimeForm.setFiles(filePaths);
+            }
+            workOvertimeFormService.saveFile(workOvertimeForm);*/
+            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;
+        }
+    }
+
+    /**
+     * 获取详情
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "getOverTimeById", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getOverTimeById(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        String id = request.getParameter("id");
+        String type = request.getParameter("type");
+        Map map = workOvertimeFormService.getOverTimeById(id,type);
+        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;
+    }
+}

+ 230 - 0
src/main/java/com/jeeplus/modules/API/works/payment/PaymentMobileController.java

@@ -0,0 +1,230 @@
+package com.jeeplus.modules.API.works.payment;
+
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.JPushClientUtil;
+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.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workapprovalcopy.entity.ApprovalCopy;
+import com.jeeplus.modules.workapprovalcopy.service.ApprovalCopyService;
+import com.jeeplus.modules.workpayment.entity.WorkPayment;
+import com.jeeplus.modules.workpayment.service.WorkPaymentService;
+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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLDecoder;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 付款申请Controller
+ *
+ * @author fgy
+ * @version 2018-01-18
+ */
+@SuppressWarnings("all")
+@RequestMapping(value = "${frontPath}/payment/Payment")
+@Controller
+public class PaymentMobileController extends BaseController {
+    @Autowired
+    private WorkPaymentService workPaymentService;
+    @Autowired
+    private OfficeService officeService;
+    @Autowired
+    private ApprovalCopyService approvalCopyService;
+    @Autowired
+    private PushinfoService pushinfoService;
+
+    /**
+     * 启动付款申请
+     *
+     * @param request
+     * @param response
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "savePayment", method = RequestMethod.POST)
+    public AjaxJson savePayment(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+        AjaxJson json = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        try {
+            HashMap<String, String> requestMap = findRequestMap(request);
+            Map<String, Object> variables = Maps.newHashMap();
+            String reason = URLDecoder.decode(requestMap.get("reason")==null?"":requestMap.get("reason"), "UTF-8");
+            String amount = URLDecoder.decode(requestMap.get("amount")==null?"":requestMap.get("amount"), "UTF-8");
+            String approverId = URLDecoder.decode(requestMap.get("approverId")==null?"":requestMap.get("approverId"), "UTF-8");
+            String payDateStr = URLDecoder.decode(requestMap.get("payDateStr")==null?"":requestMap.get("payDateStr"), "UTF-8");
+            String payType = URLDecoder.decode(requestMap.get("payType")==null?"":requestMap.get("payType"), "UTF-8");
+            String payObject = URLDecoder.decode(requestMap.get("payObject")==null?"":requestMap.get("payObject"), "UTF-8");
+            String payBank = URLDecoder.decode(requestMap.get("payBank")==null?"":requestMap.get("payBank"), "UTF-8");
+            String payBankAccount = URLDecoder.decode(requestMap.get("payBankAccount")==null?"":requestMap.get("payBankAccount"), "UTF-8");
+            String remarks = URLDecoder.decode(requestMap.get("remarks")==null?"":requestMap.get("remarks"), "UTF-8");
+            String CCId = URLDecoder.decode(requestMap.get("CCId")==null?"":requestMap.get("CCId"), "UTF-8");
+            String type = "1";
+            String alias = "1";
+            List<String> assigneeList=new ArrayList<String>(); //分配任务的人员
+            if(approverId!=null && !approverId.equals("")) {
+                if (approverId.contains(UserUtils.getUser().getId())){
+                    json.setMsg("付款申请失败,审批人不能为本人");
+                    json.setErrorCode(ErrorCode.code_1010);
+                    json.setSuccess(false);
+                    return json;
+                }
+                String[] approverIds = approverId.split(",");
+                for (int i =0 ;i<approverIds.length;i++){
+                    assigneeList.add(approverIds[i]);
+                }
+                type = approverIds.length+"";
+                alias = approverIds[0];
+            }
+            variables.put("assigneeList", assigneeList);
+            variables.put("count",assigneeList.size());
+
+            Office company = UserUtils.getSelectCompany();
+            Office office = UserUtils.getSelectOffice();
+            User user = UserUtils.getUser();//
+
+            WorkPayment workPayment = new WorkPayment();
+            workPayment.setUser(user);
+            workPayment.setCompany(company);
+            workPayment.setOffice(office);
+            workPayment.setCreateBy(user);
+            workPayment.setUpdateBy(user);
+            workPayment.setDelFlag("0");
+            workPayment.setStatus("1");
+            workPayment.setDelFlag("0");
+            workPayment.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            workPayment.setOfficeId(UserUtils.getSelectOffice()==null?"":UserUtils.getSelectOffice().getId());
+            workPayment.setReason(reason);
+            workPayment.setAmount(amount);
+            workPayment.setCCid(CCId);
+            workPayment.setRemarks(remarks);
+            workPayment.setPayDate(sdf.parse(payDateStr));
+            workPayment.setPayType(payType);
+            workPayment.setPayObject(payObject);
+            workPayment.setPayBank(payBank);
+            workPayment.setPayBankAccount(payBankAccount);
+            workPaymentService.save(workPayment,variables,type);
+
+            ApprovalCopy approvalCopy = new ApprovalCopy();
+            approvalCopy.setCCId(workPayment.getCCid());
+            approvalCopy.setUserId(user.getId());
+            approvalCopy.setType("payment");
+            approvalCopy.setRemarks(workPayment.getReason());
+            approvalCopy.setApprovalId(workPayment.getId());
+            approvalCopy.setApproverId(approverId);
+            approvalCopy.setReadFlag("0");
+            approvalCopyService.save(approvalCopy);
+
+            //给抄送人、审批人发送通知
+            if(approvalCopy!=null && org.apache.commons.lang3.StringUtils.isNotBlank(approvalCopy.getId())){
+                String chaosongIds = approvalCopy.getCCId();//给所有抄送人发送通知
+                String shenpiIds = alias;//给审批流程的第一个人发送通知
+                workPaymentService.sendNotify(chaosongIds,shenpiIds,approvalCopy.getApprovalId());
+                String content = "审批信息 申请人:" + user.getName() + ",付款申请: 待审批!";
+                UserUtils.pushIm(alias,content);
+            }
+
+            String title="审批";
+            String content =  UserUtils.getUser().getName()+"的付款申请需要你审批";
+            String status = "待审批";
+            Office office1 = workPayment.getOffice();
+            String officeName = "";
+            if (office1!=null){
+                Office o = officeService.get(office1.getId());
+                officeName = o.getName();
+            }
+
+            String remakers = "付款申请部门:"+office.getName()+ "\n"
+//                    +"申请人:"+user.getName()+"\n"
+                    +"付款事由:"+workPayment.getReason()+"\n"
+                    +"付款金额:"+workPayment.getAmount()+"\n";
+            Map extras = new HashMap();
+            extras.put("type", "4001");
+            extras.put("id", workPayment.getId());
+            extras.put("procDefKey", "payment");
+
+            boolean b = JPushClientUtil.sendNotificationToAlias(title, content, extras, alias);
+            Pushinfo pushinfo = new Pushinfo();
+            pushinfo.setCurrentUser(UserUtils.getUser());
+            pushinfo.setRemarks(remakers);
+            pushinfo.setUserId(UserUtils.getUser().getId());
+            pushinfo.setType("4001");
+            pushinfo.setPushId(workPayment.getId());
+            pushinfo.setTitle(title);
+            pushinfo.setContent(content);
+            pushinfo.setPushUserId(alias);
+            pushinfo.setParentType("singleApproval");
+            pushinfo.setStatus(status);
+            pushinfo.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            pushinfo.setAddcontent("payment");
+            pushinfo.setMobile("ios,android");
+            pushinfoService.save(pushinfo);
+
+            if (b){
+                json.setSuccess(true);
+                json.setErrorCode(ErrorCode.code_1004);
+                json.setMsg("付款申请已经提交");
+                json.put("id", workPayment.getId());
+            }else {
+                json.setMsg("付款申请推送失败");
+                json.setErrorCode(ErrorCode.code_2006);
+                json.setSuccess(false);
+            }
+        } catch (Exception e) {
+            logger.error("启动付款申请流程失败:", e);
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2004);
+            json.setMsg("启动付款申请流程失败");
+        }
+        return json;
+    }
+
+
+
+    /**
+     * 获取详情
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "getPaymentById", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getPaymentById(HttpServletRequest request) {
+        AjaxJson ajaxJson = new AjaxJson();
+        String id = request.getParameter("id");
+        String type = request.getParameter("type");
+        Map map = workPaymentService.getPaymentById(id,type);
+        if( map==null){
+            ajaxJson.setSuccess(false);
+            ajaxJson.setMsg("获取付款申请详情失败");
+            ajaxJson.setErrorCode(ErrorCode.code_2005);
+            ajaxJson.put("data",map);
+        }
+        else{
+            ajaxJson.put("data", map);
+            ajaxJson.setMsg("获取付款申请详情成功");
+            ajaxJson.setErrorCode(ErrorCode.code_1004);
+        }
+
+        return ajaxJson;
+    }
+}

+ 232 - 0
src/main/java/com/jeeplus/modules/API/works/pettycash/PettyCashMobileController.java

@@ -0,0 +1,232 @@
+package com.jeeplus.modules.API.works.pettycash;
+
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.JPushClientUtil;
+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.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workapprovalcopy.entity.ApprovalCopy;
+import com.jeeplus.modules.workapprovalcopy.service.ApprovalCopyService;
+import com.jeeplus.modules.workpettycash.entity.WorkPettyCash;
+import com.jeeplus.modules.workpettycash.service.WorkPettyCashService;
+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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLDecoder;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 备用金申请Controller
+ *
+ * @author fgy
+ * @version 2018-01-17
+ */
+@SuppressWarnings("all")
+@RequestMapping(value = "${frontPath}/pettycash/pettyCash")
+@Controller
+public class PettyCashMobileController extends BaseController {
+
+    @Autowired
+    private WorkPettyCashService workPettyCashService;
+    @Autowired
+    private OfficeService officeService;
+
+    @Autowired
+    private ApprovalCopyService approvalCopyService;
+
+    @Autowired
+    private PushinfoService pushinfoService;
+
+
+    /**
+     * 启动备用金申请
+     *
+     * @param request
+     * @param response
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "savePettyCash", method = RequestMethod.POST)
+    public AjaxJson savePettyCash(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+        AjaxJson json = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        try {
+            HashMap<String, String> requestMap = findRequestMap(request);
+            Map<String, Object> variables = Maps.newHashMap();
+            String casherName = URLDecoder.decode(requestMap.get("casherName")==null?"":requestMap.get("casherName"), "UTF-8");
+            String applicantName = URLDecoder.decode(requestMap.get("applicantName")==null?"":requestMap.get("applicantName"), "UTF-8");
+            String applicantOfficeId = URLDecoder.decode(requestMap.get("applicantOfficeId")==null?"":requestMap.get("applicantOfficeId"), "UTF-8");
+            String reason = URLDecoder.decode(requestMap.get("reason")==null?"":requestMap.get("reason"), "UTF-8");
+            String amount = URLDecoder.decode(requestMap.get("amount")==null?"":requestMap.get("amount"), "UTF-8");
+            String approverId = URLDecoder.decode(requestMap.get("approverId")==null?"":requestMap.get("approverId"), "UTF-8");
+            String useDateStr = URLDecoder.decode(requestMap.get("useDateStr")==null?"":requestMap.get("useDateStr"), "UTF-8");
+            String returnDateStr = URLDecoder.decode(requestMap.get("returnDateStr")==null?"":requestMap.get("returnDateStr"), "UTF-8");
+            String remarks = URLDecoder.decode(requestMap.get("remarks")==null?"":requestMap.get("remarks"), "UTF-8");
+            String CCId = URLDecoder.decode(requestMap.get("CCId")==null?"":requestMap.get("CCId"), "UTF-8");
+            String type = "1";
+            String alias = "1";
+            List<String> assigneeList=new ArrayList<String>(); //分配任务的人员
+            if(approverId!=null && !approverId.equals("")) {
+                if (approverId.contains(UserUtils.getUser().getId())){
+                    json.setMsg("备用金申请失败,审批人不能为本人");
+                    json.setErrorCode(ErrorCode.code_1010);
+                    json.setSuccess(false);
+                    return json;
+                }
+                String[] approverIds = approverId.split(",");
+                for (int i =0 ;i<approverIds.length;i++){
+                    assigneeList.add(approverIds[i]);
+                }
+                type = approverIds.length+"";
+                alias = approverIds[0];
+            }
+            variables.put("assigneeList", assigneeList);
+            variables.put("count",assigneeList.size());
+
+            Office company = UserUtils.getSelectCompany();
+            Office office = UserUtils.getSelectOffice();
+            User user = UserUtils.getUser();
+
+            Office applicantOffice = officeService.get(applicantOfficeId);
+
+            WorkPettyCash workPettyCash = new WorkPettyCash();
+            workPettyCash.setCompany(company);
+            workPettyCash.setOffice(office);
+            workPettyCash.setCreateBy(user);
+            workPettyCash.setUpdateBy(user);
+            workPettyCash.setDelFlag("0");
+            workPettyCash.setStatus("1");
+            workPettyCash.setDelFlag("0");
+            workPettyCash.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            workPettyCash.setOfficeId(UserUtils.getSelectOffice()==null?"":UserUtils.getSelectOffice().getId());
+            workPettyCash.setReason(reason);
+            workPettyCash.setAmount(amount);
+            workPettyCash.setApplicantName(applicantName);
+            workPettyCash.setApplicantOffice(applicantOffice);
+            workPettyCash.setCasherName(casherName);
+            workPettyCash.setCCid(CCId);
+            workPettyCash.setRemarks(remarks);
+            workPettyCash.setUseDateStr(useDateStr);
+            workPettyCash.setUseDate(sdf.parse(useDateStr));
+            workPettyCash.setReturnDateStr(returnDateStr);
+            workPettyCash.setReturnDate(sdf.parse(returnDateStr));
+            workPettyCashService.save(workPettyCash,variables,type);
+
+            ApprovalCopy approvalCopy = new ApprovalCopy();
+            approvalCopy.setCCId(workPettyCash.getCCid());
+            approvalCopy.setUserId(user.getId());
+            approvalCopy.setType("pettyCash");
+            approvalCopy.setRemarks(workPettyCash.getReason());
+            approvalCopy.setApprovalId(workPettyCash.getId());
+            approvalCopy.setApproverId(approverId);
+            approvalCopy.setReadFlag("0");
+            approvalCopyService.save(approvalCopy);
+
+            //给抄送人、审批人发送通知
+            if(approvalCopy!=null && org.apache.commons.lang3.StringUtils.isNotBlank(approvalCopy.getId())){
+                String chaosongIds = approvalCopy.getCCId();//给所有抄送人发送通知
+                String shenpiIds = alias;//给审批流程的第一个人发送通知
+                workPettyCashService.sendNotify(chaosongIds,shenpiIds,approvalCopy.getApprovalId());
+                String content = "审批信息 申请人:" + user.getName() + ",备用金申请: 待审批!";
+                UserUtils.pushIm(alias,content);
+            }
+
+            String title="审批";
+            String content =  UserUtils.getUser().getName()+"的备用金申请需要你审批";
+            String status = "待审批";
+            String applicantOfficeName = applicantOffice.getName();
+
+            String remakers = "备用金申请部门:"+applicantOfficeName+ "\n"
+                    +"申请人"+applicantName+"\n"
+                    +"使用日期:"+ useDateStr
+                    +"归还日期:"+ returnDateStr;
+            Map extras = new HashMap();
+            extras.put("type", "4001");
+            extras.put("id", workPettyCash.getId());
+            extras.put("procDefKey", "pettyCash");
+
+            boolean b = JPushClientUtil.sendNotificationToAlias(title, content, extras, alias);
+            Pushinfo pushinfo = new Pushinfo();
+            pushinfo.setCurrentUser(UserUtils.getUser());
+            pushinfo.setRemarks(remakers);
+            pushinfo.setUserId(UserUtils.getUser().getId());
+            pushinfo.setType("4001");
+            pushinfo.setPushId(workPettyCash.getId());
+            pushinfo.setTitle(title);
+            pushinfo.setContent(content);
+            pushinfo.setPushUserId(alias);
+            pushinfo.setParentType("singleApproval");
+            pushinfo.setStatus(status);
+            pushinfo.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            pushinfo.setAddcontent("pettyCash");
+            pushinfo.setMobile("ios,android");
+            pushinfoService.save(pushinfo);
+
+            if (b){
+                json.setSuccess(true);
+                json.setErrorCode(ErrorCode.code_1004);
+                json.setMsg("备用金申请已经提交");
+                json.put("id", workPettyCash.getId());
+            }else {
+                json.setMsg("备用金申请推送失败");
+                json.setErrorCode(ErrorCode.code_2006);
+                json.setSuccess(false);
+            }
+        } catch (Exception e) {
+            logger.error("启动备用金申请流程失败:", e);
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2004);
+            json.setMsg("启动备用金申请流程失败");
+        }
+        return json;
+    }
+
+
+
+    /**
+     * 获取详情
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "getPettyCashById", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getPettyCashById(HttpServletRequest request) {
+        AjaxJson ajaxJson = new AjaxJson();
+        String id = request.getParameter("id");
+        String type = request.getParameter("type");
+        Map map = workPettyCashService.getPettyCashById(id,type);
+        if( map==null || map.size()==0){
+            ajaxJson.setSuccess(false);
+            ajaxJson.setMsg("获取备用金申请详情失败");
+            ajaxJson.setErrorCode(ErrorCode.code_2005);
+            ajaxJson.put("data",map);
+        }
+        else{
+            ajaxJson.put("data", map);
+            ajaxJson.setMsg("获取备用申请金详情成功");
+            ajaxJson.setErrorCode(ErrorCode.code_1004);
+        }
+
+        return ajaxJson;
+    }
+}

+ 231 - 0
src/main/java/com/jeeplus/modules/API/works/pushInfo/pushInfoCortroller.java

@@ -0,0 +1,231 @@
+package com.jeeplus.modules.API.works.pushInfo;
+
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.appversion.service.AppversionsService;
+import com.jeeplus.modules.pushinfo.entity.Pushinfo;
+import com.jeeplus.modules.pushinfo.service.PushinfoService;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.sysuseroffice.entity.Useroffice;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workcompanyinfo.service.CompanyinfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Controller
+@RequestMapping(value = "${frontPath}/pushInfo")
+public class pushInfoCortroller extends BaseController {
+
+	@Autowired
+	private PushinfoService pushinfoService;
+    @Autowired
+    private AppversionsService appversionsService;
+    @Autowired
+    private CompanyinfoService companyinfoService;
+
+	@ResponseBody
+	@RequestMapping(value = "pushInfoList", method = RequestMethod.GET)
+	public AjaxJson pushInfoList(HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson json = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        HashMap requestMap = findRequestMap(request);
+        String requestType = (String)requestMap.get("type");
+        String mobile  = (String)requestMap.get("mobile");
+        String companyId  = (String)requestMap.get("companyId");
+        String pageNo  = (String)requestMap.get("pageNo");
+        try {
+            Pushinfo pushinfo = new Pushinfo();
+            User user = UserUtils.getUser();
+            pushinfo.setDelFlag("0");
+            if (requestType!=null && requestType.equals("1")){
+                pushinfo.setParentType("all");
+                pushinfo.setPushUserId("allpushusers");
+            }else {
+                pushinfo.setPushUserId(user.getId());
+                pushinfo.setParentType("single");
+            }
+            if (mobile!=null){
+                if (mobile.equals("ios")){
+                    pushinfo.setMobile("ios");
+                }else if (mobile.equals("android")){
+                    pushinfo.setMobile("android");
+                }
+            }
+            if (companyId!=null){
+                pushinfo.setCompanyId(companyId);
+            }
+            Page<Pushinfo> page = pushinfoService.findPushList(new Page<Pushinfo>(request, response), pushinfo);
+            List<Pushinfo> list = page.getList();
+            List<Map> mapList = new ArrayList<>();
+            if(list==null){
+                json.setSuccess(false);
+                json.setErrorCode(ErrorCode.code_2005);
+                json.setMsg("获取列表失败");
+                json.put("data", mapList);
+            }else {
+                json.put("maxNum", page.getCount());
+                if(Integer.parseInt(pageNo)<=page.getTotalPage()) {
+                    for (Pushinfo p : list) {
+                        Map map = new HashMap();
+                        String type = p.getType();
+                        String createDate = sdf.format(p.getCreateDate()).substring(5, 10);
+                        String url = p.getAddcontent() == null ? "" : p.getAddcontent();
+                        map.put("type", p.getType() == null ? "" : p.getType());
+                        map.put("title", p.getTitle() == null ? "" : p.getTitle());
+                        map.put("content", p.getContent() == null ? "" : p.getContent());
+                        map.put("contents", p.getRemarks() == null ? "" : p.getRemarks());
+                        map.put("remarks", p.getStatus() == null ? "" : p.getStatus());
+                        map.put("id", p.getPushId() == null ? "" : p.getPushId());
+                        map.put("createDate", createDate == null ? "" : createDate);
+                        map.put("parentType", p.getParentType() == null ? "" : p.getParentType());
+                        String state = "";
+                        String procDefKey = "";
+                        String img = "";
+                        if (type.equals("2001") && p.getRemarks() != null) {
+                            url = "";
+                            if (StringUtils.isNotBlank(p.getAddcontent()) && (p.getAddcontent().contains("&gt;") || p.getAddcontent().contains("<p>"))) {
+                                state = "1";
+                            } else {
+                                state = "2";
+                            }
+                            //img = p.getAddcontent() == null || p.getAddcontent().equals("") ? "" : p.getAddcontent();
+                        } else if (type.contains("400") && p.getAddcontent() != null) {
+                            procDefKey = p.getAddcontent();
+                        } else if (type.equals("2002")){  //加入企业申请
+                            procDefKey = p.getAddcontent();
+                            Pushinfo pushinfo1 = new Pushinfo();
+                            pushinfo1.setPushId(p.getPushId());
+                            List<Pushinfo> pushinfos = pushinfoService.getByPushId(pushinfo1);
+                            try {
+                                Useroffice companyinfo  = companyinfoService.get(p.getPushId());
+                                if (pushinfos!=null && pushinfos.size()!=0) {
+                                    Pushinfo push = pushinfos.get(0);
+                                    if (StringUtils.isNotBlank(push.getStatus())&& push.getStatus().equals("1")){
+                                        map.put("selectStatus", "1");
+                                        map.put("officeName", companyinfo.getCreateBy().getOffice().getName());
+                                        map.put("comment", companyinfo.getRemarks());
+                                        map.put("actStuatus", companyinfo.getStatus());
+                                    }else {
+                                        map.put("selectStatus", "0");
+                                    }
+                                }else {
+                                    logger.error("获取推送列表失败");
+                                    json.setSuccess(false);
+                                    json.setErrorCode(ErrorCode.code_2004);
+                                    json.setMsg("获取推送列表失败,当前申请不存在");
+                                }
+                            }catch (Exception e){
+                                map = new HashMap();
+                            }
+                        }
+                        map.put("url",url );
+                        if (map!=null) {
+                            map.put("state", state);
+                            map.put("img", img);
+                            map.put("procDefKey", procDefKey);
+                            mapList.add(map);
+                        }
+                    }
+                    json.put("data", mapList);
+                }else {
+                    json.put("data", new ArrayList<>());
+                }
+                json.setErrorCode(ErrorCode.code_1004);
+            }
+        }catch (Exception e){
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2004);
+            json.setMsg("获取推送列表失败");
+        }
+		return json;
+	}
+
+    @ResponseBody
+    @RequestMapping(value = "pushCompanyInfoList", method = RequestMethod.GET)
+    public AjaxJson pushCompanyInfoList(String mobile,HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson json = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            if (mobile==null || mobile.equals("")){
+                json.setSuccess(false);
+                json.setErrorCode(ErrorCode.code_2003);
+                json.setMsg("获取失败:参数mobile不能为空");
+                return json;
+            }
+            User user = UserUtils.getUser();
+            List<Office> officeList = UserUtils.getAllCompany(user);
+            List<Map> mapList = new ArrayList<>();
+            if (officeList!=null && officeList.size()!=0){
+                for (Office office :officeList) {
+                    Pushinfo pushinfo = new Pushinfo();
+                    String companyId = office.getId();
+                    if (!companyId.equals("1")) {
+                        pushinfo.setCompanyId(companyId);
+                        pushinfo.setDelFlag("0");
+                        pushinfo.setPushUserId(user.getId());
+                        pushinfo.setParentType("single");
+                        pushinfo.setMobile(mobile);
+                        List<Pushinfo> list = pushinfoService.findList(pushinfo);
+                        if (list != null && list.size() != 0) {
+                            Pushinfo p = list.get(0);
+                            Map map = new HashMap();
+                            String type = p.getType();
+                            String createDate = sdf.format(p.getCreateDate()).substring(5, 10);
+                            map.put("type", p.getType() == null ? "" : p.getType());
+                            map.put("title", p.getTitle() == null ? "" : p.getTitle());
+                            map.put("content", p.getContent() == null ? "" : p.getContent());
+                            map.put("contents", p.getRemarks() == null ? "" : p.getRemarks());
+                            map.put("remarks", p.getStatus() == null ? "" : p.getStatus());
+                            map.put("id", p.getPushId() == null ? "" : p.getPushId());
+                            map.put("createDate", createDate == null ? "" : createDate);
+                            map.put("parentType", p.getParentType() == null ? "" : p.getParentType());
+                            map.put("companyId", p.getCompanyId());
+                            String state = "";
+                            String procDefKey = "";
+                            String img = "";
+                            if (type.equals("2001") && p.getRemarks() != null) {
+                                if (p.getRemarks().contains("&gt;")) {
+                                    state = "1";
+                                } else {
+                                    state = "2";
+                                }
+                                img = p.getAddcontent() == null || p.getAddcontent().equals("") ? "" : p.getAddcontent();
+                            } else if (type.contains("400") && p.getAddcontent() != null) {
+                                procDefKey = p.getAddcontent();
+                            }
+                            map.put("state", state);
+                            map.put("img", img);
+                            map.put("procDefKey", procDefKey);
+                            map.put("officeName", office.getName());
+                            map.put("officeLoge", office.getLogo() == null || office.getLogo().equals("") ? "" : office.getLogo());
+                            mapList.add(map);
+                        }
+                    }
+                }
+            }
+            json.put("data", mapList);
+            json.setErrorCode(ErrorCode.code_1004);
+        }catch (Exception e){
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2004);
+            json.setMsg("获取公司推送列表失败");
+        }
+        return json;
+    }
+
+}

+ 646 - 0
src/main/java/com/jeeplus/modules/API/works/report/ReportController.java

@@ -0,0 +1,646 @@
+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;
+		}
+	}
+}

+ 283 - 0
src/main/java/com/jeeplus/modules/API/works/usesealcontroller/UseSealMobileController.java

@@ -0,0 +1,283 @@
+package com.jeeplus.modules.API.works.usesealcontroller;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.JPushClientUtil;
+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.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workapprovalcopy.entity.ApprovalCopy;
+import com.jeeplus.modules.workapprovalcopy.service.ApprovalCopyService;
+import com.jeeplus.modules.worksealform.entity.WorkSealForm;
+import com.jeeplus.modules.worksealform.service.WorkSealFormService;
+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.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 用印流程
+ */
+@RequestMapping(value = "${frontPath}/useseal/useseal")
+@Controller
+public class UseSealMobileController extends BaseController {
+    @Autowired
+    private WorkSealFormService workSealFormService;
+
+    @Autowired
+    private OfficeService officeService;
+
+    @Autowired
+    private ApprovalCopyService approvalCopyService;
+
+    @Autowired
+    private PushinfoService pushinfoService;
+
+    /**
+     * 启动用印申请
+     *
+     * @param request
+     * @param response
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveUseSeal", method = RequestMethod.POST)
+    public AjaxJson useSeal(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+        AjaxJson json = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            HashMap<String, String> requestMap = findRequestMap(request);
+            Map<String, Object> variables = Maps.newHashMap();
+            //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String agentId = URLDecoder.decode(requestMap.get("agentId")==null?"":requestMap.get("agentId"), "UTF-8");
+            String sealType = URLDecoder.decode(requestMap.get("sealType")==null?"":requestMap.get("sealType"), "UTF-8");
+            String userId = URLDecoder.decode(requestMap.get("userId")==null?"":requestMap.get("userId"), "UTF-8");
+            String officeId = URLDecoder.decode(requestMap.get("officeId")==null?"":requestMap.get("officeId"), "UTF-8");
+            String documentCount = URLDecoder.decode(requestMap.get("documentCount")==null?"":requestMap.get("documentCount"), "UTF-8");
+            String documentName = URLDecoder.decode(requestMap.get("documentName")==null?"":requestMap.get("documentName"), "UTF-8");
+            String reason = URLDecoder.decode(requestMap.get("reason")==null?"":requestMap.get("reason"), "UTF-8");
+            String approverId = URLDecoder.decode(requestMap.get("approverId")==null?"":requestMap.get("approverId"), "UTF-8");
+            String applicationDate = URLDecoder.decode(requestMap.get("applicationDate")==null?"":requestMap.get("applicationDate"), "UTF-8");
+            String CCId = URLDecoder.decode(requestMap.get("CCId")==null?"":requestMap.get("CCId"), "UTF-8");
+            String delFlag = "0"; //审核流程状态标记 0 待审核 1 审核完成
+            User user = new User(); //记录
+            WorkSealForm workSealForm = new WorkSealForm();
+            String type = "1";
+            String alias = "1";
+            List<String> assigneeList=new ArrayList<String>(); //分配任务的人员
+            if(approverId!=null && !approverId.equals("")) {
+                if (approverId.contains(UserUtils.getUser().getId())){
+                    json.setMsg("用印申请失败,审批人不能为本人");
+                    json.setErrorCode(ErrorCode.code_1010);
+                    json.setSuccess(false);
+                    return json;
+                }
+                String[] approverIds = approverId.split(",");
+                for (int i =0 ;i<approverIds.length;i++){
+                    assigneeList.add(approverIds[i]);
+                }
+                type = approverIds.length+"";
+                alias = approverIds[0];
+            }
+            variables.put("assigneeList", assigneeList);
+            variables.put("count",assigneeList.size());
+            User agent = new User();//经办人
+            agent.setId(agentId);
+            Office office = new Office();//用印部门
+            office.setId(officeId);
+            //approver.setId(approverId);
+            User CC = new User();
+            CC.setId(CCId);
+            user.setId(userId);
+
+            workSealForm.setUser(agent);
+            //workSealForm.setUser(user);
+            workSealForm.setApplicationDate(applicationDate);
+            workSealForm.setDocumentCount(documentCount);
+            workSealForm.setDocumentName(documentName);
+            workSealForm.setSealType(sealType);
+            workSealForm.setOffice(office);
+            workSealForm.setCreateBy(user);
+            workSealForm.setUpdateBy(user);
+            workSealForm.setDelFlag(delFlag);
+            workSealForm.setReason(reason);
+            workSealForm.setStatus("1");
+            workSealForm.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            workSealForm.setOfficeId(UserUtils.getSelectOffice()==null?"":UserUtils.getSelectOffice().getId());
+            workSealFormService.save(workSealForm,variables,type);
+            ApprovalCopy approvalCopy = new ApprovalCopy();
+            approvalCopy.setCCId(CCId==null?"":CCId);
+            approvalCopy.setUserId(userId);
+            approvalCopy.setType("sealform");
+            approvalCopy.setRemarks(reason);
+            approvalCopy.setApprovalId(workSealForm.getId());
+            approvalCopy.setApproverId(approverId);
+            approvalCopy.setReadFlag("0");
+            approvalCopyService.save(approvalCopy);
+
+            //给抄送人、审批人发送通知
+            if(approvalCopy!=null && org.apache.commons.lang3.StringUtils.isNotBlank(approvalCopy.getId())){
+                String chaosongIds = approvalCopy.getCCId();//给所有抄送人发送通知
+                String shenpiIds = alias;//给审批流程的第一个人发送通知
+                workSealFormService.sendNotify(chaosongIds,shenpiIds,approvalCopy.getApprovalId());
+                String content = "审批信息 申请人:" + user.getName() + ",用印申请: 待审批!";
+                UserUtils.pushIm(alias,content);
+            }
+
+            String title="审批";
+            String content =  UserUtils.getUser().getName()+"的用印申请需要你审批";
+            String status = "待审批";
+            Office office1 = workSealForm.getOffice();
+            String officeName = "";
+            if (office1!=null){
+                Office o = officeService.get(office1.getId());
+                officeName = o.getName();
+            }
+            User agentUser = UserUtils.get(agentId);
+            String agentName = "";
+            if (agentUser!=null && agentUser.getName()!=null){
+                agentName =agentUser.getName();
+            }
+            String remakers = "用印部门:"+officeName+ "\n"
+                    +"经办人:"+agentName+ "\n"
+                    +"日期:"+workSealForm.getApplicationDate();
+            Map extras = new HashMap();
+            extras.put("type", "4001");
+            extras.put("id", workSealForm.getId());
+            extras.put("procDefKey", "sealform");
+
+            boolean b = JPushClientUtil.sendNotificationToAlias(title, content, extras, alias);
+            Pushinfo pushinfo = new Pushinfo();
+            pushinfo.setCurrentUser(UserUtils.getUser());
+            pushinfo.setRemarks(remakers);
+            pushinfo.setUserId(UserUtils.getUser().getId());
+            pushinfo.setType("4001");
+            pushinfo.setPushId(workSealForm.getId());
+            pushinfo.setTitle(title);
+            pushinfo.setContent(content);
+            pushinfo.setPushUserId(alias);
+            pushinfo.setParentType("singleApproval");
+            pushinfo.setStatus(status);
+            pushinfo.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            pushinfo.setAddcontent("sealform");
+            pushinfo.setMobile("ios,android");
+            pushinfoService.save(pushinfo);
+            if (b){
+                json.setSuccess(true);
+                json.setErrorCode(ErrorCode.code_1004);
+                json.setMsg("用印申请已经提交");
+                json.put("id", workSealForm.getId());
+            }else {
+                json.setMsg("用印申请推送失败");
+                json.setErrorCode(ErrorCode.code_2006);
+                json.setSuccess(false);
+            }
+        } catch (Exception e) {
+            logger.error("启动用印流程失败:", e);
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2004);
+            json.setMsg("启动用印流程失败");
+        }
+        return json;
+        }
+
+    /**
+     * 保存附件
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveFile",method=RequestMethod.POST)
+    public AjaxJson saveFile(MultipartHttpServletRequest multiRequest,HttpServletRequest servletRequest) throws Exception{
+        AjaxJson j=new AjaxJson();
+        try {
+            String id = multiRequest.getParameter("id");
+            WorkSealForm workSealForm =  workSealFormService.getById(id);
+            OSSClientUtil ossUtil =new OSSClientUtil();
+
+            Iterator<String> fileNames = multiRequest.getFileNames();
+            String thisFiles = workSealForm.getFiles();
+            String filePaths= "";
+            System.out.println("-----------开始------------------");
+            while(fileNames.hasNext()){
+
+                //取得上传文件
+                MultipartFile file = multiRequest.getFile(fileNames.next());
+                if(file != null){
+                    //取得当前上传文件的文件名称
+                    String filePath= ossUtil.uploadFile2OSS(file, "sealform");
+                    filePaths = filePath;
+                }
+            }
+           /* if(thisFiles==null || thisFiles.equals("")){
+                if(filePaths.contains(",")){
+                    workSealForm.setFiles(filePaths.substring(1, filePaths.length() - 1));
+                }else {
+                    workSealForm.setFiles(filePaths);
+                }
+            }else{
+                filePaths = thisFiles+","+filePaths;
+                workSealForm.setFiles(filePaths);
+            }
+            workSealFormService.saveFile(workSealForm);*/
+            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;
+        }
+    }
+
+    /**
+     * 获取详情
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "getUseSealById", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getUseSealById(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        AjaxJson j = new AjaxJson();
+        String id = request.getParameter("id");
+        String type = request.getParameter("type");
+        Map map = workSealFormService.getUseSealById(id,type);
+        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;
+    }
+}

+ 832 - 0
src/main/java/com/jeeplus/modules/API/works/workattendancecontroller/WorkAttendanceController.java

@@ -0,0 +1,832 @@
+package com.jeeplus.modules.API.works.workattendancecontroller;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.LocationUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+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.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workattendance.entity.WorkAttendanceInfo;
+import com.jeeplus.modules.workattendance.entity.WorkAttendancePlace;
+import com.jeeplus.modules.workattendance.entity.WorkAttendanceRule;
+import com.jeeplus.modules.workattendance.service.WorkAttendanceInfoService;
+import com.jeeplus.modules.workattendance.service.WorkAttendancePlaceService;
+import com.jeeplus.modules.workattendance.service.WorkAttendanceRuleService;
+import com.jeeplus.modules.workfield.entity.WorkField;
+import com.jeeplus.modules.workfield.service.WorkFieldService;
+import com.jeeplus.modules.workout.entity.WorkOut;
+import com.jeeplus.modules.workout.service.WorkOutService;
+import com.jeeplus.modules.workovertime.entity.WorkOvertime;
+import com.jeeplus.modules.workovertime.service.WorkOvertimeService;
+import groovy.util.IFileNameFinder;
+import org.apache.commons.collections.map.HashedMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.ui.Model;
+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.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+
+/**
+ * 考勤Controller
+ * @author mengxy
+ * @version 2017-5-10
+ */
+@Controller
+@RequestMapping(value = "${frontPath}/work/workAttendanceInfo")
+public class WorkAttendanceController extends BaseController {
+
+	@Autowired
+	private WorkAttendanceInfoService workAttendanceInfoService;
+	@Autowired
+	private UserDao userDao;
+	@Autowired
+	private WorkAttendancePlaceService workAttendancePlaceService;
+
+
+	/**
+	 * 考勤信息列表页面
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getAttendanceList" , method=RequestMethod.GET)
+	public AjaxJson getAttendanceList(HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j=new AjaxJson();
+		WorkAttendanceInfo workAttendanceInfo = new WorkAttendanceInfo();
+		String userId=request.getParameter("userId");
+		String pageNo=request.getParameter("pageNo");
+		workAttendanceInfo.setUserId(userId);
+		Page<WorkAttendanceInfo> page = workAttendanceInfoService.findPage(new Page<WorkAttendanceInfo>(request, response), workAttendanceInfo);
+
+		if(page==null ){
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("获取考勤信息失败");
+			j.put("data",page);
+		}else if(pageNo !=null &&Integer.parseInt(pageNo)>page.getTotalPage()){
+			j.put("data",new Page<WorkAttendanceInfo>());
+		    j.setMsg("获取考勤信息成功");
+		    j.setErrorCode(ErrorCode.code_1004);
+		}else{
+			j.setErrorCode(ErrorCode.code_1004);
+		    j.put("data", page);
+		    j.setMsg("获取考勤信息成功");
+		}
+		return j;
+	}
+
+	/**
+	 * 获取当月考勤
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getAttendanceListByMonth",method=RequestMethod.GET)
+	public AjaxJson getAttendanceListByMonth(HttpServletRequest request,HttpServletResponse response){
+		AjaxJson j = new AjaxJson();
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		String date = request.getParameter("date");
+		String str[] = date.split("-");
+		if(str.length==2){
+			String year = str[0];
+			String month = str[1];
+			if(month.length()==2){
+				WorkAttendanceInfo workAttendanceInfo = new WorkAttendanceInfo();
+				User user = UserUtils.getUser();
+				workAttendanceInfo.setUserId(user.getId());
+				workAttendanceInfo.setCompanyId(UserUtils.getSelectCompany().getId());
+				List<WorkAttendanceInfo> list = workAttendanceInfoService.findList(workAttendanceInfo);
+				List<Map<String,Object>> mapList = Lists.newArrayList();
+				int count=DateUtils.getMaxDay(Integer.parseInt(year),Integer.parseInt(month));
+				for (int i = 1; i <= count; i++) {
+					int counts = 0;
+					List<WorkAttendanceInfo> list1 = Lists.newArrayList();
+					String day = "";
+					if(i<10){
+						day="0"+i;
+					}else{
+						day=i+"";
+					}
+					String days = year+"-"+month+"-"+day;
+					int isHoliday = workAttendanceInfoService.isHolidays(days);
+					//Boolean isWeek = StringUtils.isWeek(days);
+					for(WorkAttendanceInfo o : list){
+						String date1 = sdf.format(o.getAttendanceDate());
+						String dates[] = date1.split("-");
+						int a = Integer.parseInt(dates[2]);
+						if(isHoliday==0 && dates[0].equals(year) && dates[1].equals(month) && a==i && !o.getAttendanceType().equals("0") && !o.getAttendanceType().equals("4") ){
+							counts ++;
+						}
+					}
+					Map<String,Object> map = Maps.newHashMap();
+                    map.put("day", days);
+                    map.put("type",counts);
+                    map.put("isHoliday",isHoliday);
+					mapList.add(map);
+				}
+				j.put("data",mapList);
+				j.setMsg("获取考勤记录成功");
+				j.setErrorCode(ErrorCode.code_1004);
+			}else{
+				j.setMsg("日期格式错误,获取打考勤录失败");
+				j.put("data", Lists.newArrayList());
+				j.setErrorCode(ErrorCode.code_2002);
+				j.setSuccess(false);
+			}
+		}else{
+			j.setMsg("日期格式错误,获取考勤记录失败");
+			j.put("data", Lists.newArrayList());
+			j.setErrorCode(ErrorCode.code_2002);
+			j.setSuccess(false);
+		}
+
+		return j;
+
+	}
+
+	/**
+	 * 考勤信息列表页面
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getAttendanceListByDate" , method=RequestMethod.GET)
+	public AjaxJson getAttendanceListByDate(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+		AjaxJson j = new AjaxJson();
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		SimpleDateFormat sdf1 = new SimpleDateFormat("HH:mm");
+        SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm:ss");
+		String date = request.getParameter("date");
+        String userId = request.getParameter("userId");
+		WorkAttendanceInfo WorkAttendanceInfo = new WorkAttendanceInfo();
+		if(userId!=null &&!userId.equals("")) {
+			WorkAttendanceInfo.setUserId(userId);
+		}else{
+			WorkAttendanceInfo.setUserId(UserUtils.getUser().getId());
+		}
+		WorkAttendanceInfo.setCompanyId(UserUtils.getSelectCompany().getId());
+		Date signDate = null;
+		try {
+			signDate = sdf.parse(date);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		WorkAttendanceInfo.setAttendanceDate(signDate);
+		List<WorkAttendanceInfo> attList = workAttendanceInfoService.findList(WorkAttendanceInfo);
+		List<Map<String,Object>> maps = new ArrayList<>();
+		if (attList==null){
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2005);
+			j.setMsg("获取考勤信息失败,当前用户无人员档案");
+			j.put("data", new HashMap<>());
+		}else {
+			if (attList.size() != 2) {
+				j.setSuccess(false);
+				j.setErrorCode(ErrorCode.code_2005);
+				j.setMsg("获取考勤信息失败");
+				j.put("data", maps);
+			} else {
+				int status1 = 0;
+				int status2 = 0;
+				int status3 = 0;
+				for (WorkAttendanceInfo workAttendanceInfo : attList) {
+					Map<String, Object> map = new HashMap<>();
+					map.put("am", workAttendanceInfo.getMorningAfternoon());//1上午 2下午
+					if (workAttendanceInfo.getType().equals("1")) {
+						if (workAttendanceInfo.getAttendanceType().equals("0")) {
+							status3++;
+						} else if (workAttendanceInfo.getAttendanceType().equals("4")) {
+							status1++;
+						} else {
+							status2++;
+						}
+						if (status1 == 2 || status2 == 2 || status3 == 2) {
+							continue;
+						}
+					}
+					map.put("type", workAttendanceInfo.getAttendanceType());//0未打卡,旷工,1内勤/2外勤/3出差/4请假/
+					map.put("attendanceDate", workAttendanceInfo.getAttendanceTime() == null ? "" : sdf2.format(workAttendanceInfo.getAttendanceTime()));//打卡时间
+					map.put("lateEarlyTime", workAttendanceInfo.getLateEarlyTime());//迟到/早退时长
+					map.put("lateEarly", workAttendanceInfo.getLateEarly());//0正常上班 1迟到 2早退
+					map.put("attendancePlace", workAttendanceInfo.getAttendancePlace());//考勤地点
+					map.put("isValid", workAttendanceInfo.getIsValid());//考勤时候有效 1有效 0 无效
+					map.put("isEdit", StringUtils.isBlank(workAttendanceInfo.getRemarks()) ? false : true);
+					maps.add(map);
+				}
+				j.setSuccess(true);
+				j.setErrorCode(ErrorCode.code_1004);
+				j.setMsg("获取考勤信息成功");
+				j.put("data", maps);
+			}
+		}
+		return j;
+	}
+
+	/**
+	 * 获取当前时间的接口,格式为*年*月*日 周*
+	 * @param request
+	 * @param response
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getTodayTime" , method=RequestMethod.GET)
+	public AjaxJson getTodayTime(HttpServletRequest request, HttpServletResponse response){
+		AjaxJson j=new AjaxJson();
+		Map<String,String> map = Maps.newHashMap();
+		Calendar now = Calendar.getInstance();
+		String time =  now.get(Calendar.YEAR)+"年"+ (now.get(Calendar.MONTH) + 1) + "月"+now.get(Calendar.DAY_OF_MONTH)+"日";
+		map.put("time",time);
+		//String week =new SimpleDateFormat("EEEE").format(new Date()).replace("星期","周")+"";
+		String[] weekDays = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"};
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(new Date());
+		int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
+		if (w < 0)
+			w = 0;
+		String week = weekDays[w];
+		map.put("week",week);
+		j.put("data",map);
+		return j;
+	}
+
+	/**
+	 *
+	 * @param request
+	 * @param response
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getTodayAttendance" , method=RequestMethod.GET)
+	public AjaxJson getTodayAttendance(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+		AjaxJson j=new AjaxJson();
+		WorkAttendanceInfo workAttendanceInfo = new WorkAttendanceInfo();
+		String userId=request.getParameter("userId");
+		String date =(new SimpleDateFormat("yyyy-MM-dd")).format(new Date());
+		//String date=request.getParameter("date");
+		if(userId!=null &&!userId.equals("")) {
+			workAttendanceInfo.setUserId(userId);
+		}else{
+
+			workAttendanceInfo.setUserId(UserUtils.getUser().getId());
+		}
+		workAttendanceInfo.setCompanyId(UserUtils.getSelectCompany().getId());
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		SimpleDateFormat sdf1 = new SimpleDateFormat("HH:mm");
+		SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm:ss");
+		Date signDate = null;
+		try {
+			signDate = sdf.parse(date);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		workAttendanceInfo.setAttendanceDate(signDate);
+		List<WorkAttendanceInfo> attList = workAttendanceInfoService.findListInfo(workAttendanceInfo);
+		if (attList==null){
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2005);
+			j.setMsg("获取考勤信息失败,当前用户无人员档案");
+			j.put("data", new HashMap<>());
+		}else {
+			if (attList.size() < 2) {
+				attList = workAttendanceInfoService.findList(workAttendanceInfo);
+			}
+			List<Map<String, Object>> maps = new ArrayList<>();
+			if (attList.size() != 2) {
+				j.setSuccess(false);
+				j.setErrorCode(ErrorCode.code_2005);
+				j.setMsg("获取考勤信息失败");
+				j.put("data", maps);
+			} else {
+				int count1 = 0;
+				int count2 = 0;
+				int countLeave1 = 0;
+				int countLeave2 = 0;
+				int status = 0;
+				int status1 = 0;
+				int c = 1;
+				for (WorkAttendanceInfo attendanceInfo : attList) {
+					Map<String, Object> map = new HashMap<>();
+					if (attendanceInfo.getType().equals("1")) {
+						if (attendanceInfo.getAttendanceType().equals("4")) {
+							status1++;
+						} else if (attendanceInfo.getAttendanceType().equals("0")) {
+							c = 0;
+						} else {
+							status++;
+						}
+						if (status1 == 2 || status == 2) {
+							if (status1 == 2) {
+								c = 0;
+							}
+							continue;
+						}
+					} else {
+						if (attendanceInfo.getType().equals("2")) {
+							if (!attendanceInfo.getAttendanceType().equals("0") && !attendanceInfo.getAttendanceType().equals("4")) {
+								status++;
+							}
+							if (status == 2) {
+								count1 = 1;
+								count2 = 1;
+							}
+						}
+						if (!attendanceInfo.getAttendanceType().equals("0")) {
+							if (attendanceInfo.getAttendanceType().equals("4")) {
+								if (attendanceInfo.getMorningAfternoon().equals("1")) {
+									countLeave1 = 1;
+								} else {
+									countLeave2 = 1;
+								}
+							} else {
+								if (attendanceInfo.getType().equals("2")) {
+									if (attendanceInfo.getMorningAfternoon().equals("1")) {
+										count1 = 1;
+									} else {
+										count2 = 1;
+									}
+								}
+							}
+						}
+					}
+					map.put("type", attendanceInfo.getAttendanceType());//0未打卡,旷工,1内勤/2外勤/3出差/4请假/
+					map.put("am", attendanceInfo.getMorningAfternoon());//1上午 2下午
+					map.put("attendanceDate", attendanceInfo.getAttendanceTime() == null ? "" : sdf2.format(attendanceInfo.getAttendanceTime()));//打卡时间
+					map.put("lateEarly", attendanceInfo.getLateEarly());//0正常上班 1迟到 2早退
+					map.put("lateEarlyTime", attendanceInfo.getLateEarlyTime());//迟到/早退时长
+					map.put("attendancePlace", attendanceInfo.getAttendancePlace());//考勤地点
+					map.put("isValid", attendanceInfo.getIsValid());//考勤时候有效 1有效 0 无效
+					maps.add(map);
+
+				}
+				j.setSuccess(true);
+				j.setErrorCode(ErrorCode.code_1004);
+				j.setMsg("获取考勤信息成功");
+				j.put("data", maps);
+				if (c == 1) {
+					if (countLeave1 == 1) {
+						if (countLeave2 == 1) {
+							j.put("count", 0);
+						} else {
+							j.put("count", 2);
+						}
+					} else {
+						if (countLeave2 == 1) {
+							j.put("count", 1);
+						} else {
+							if (count1 == 1) {
+								if (count2 == 1) {
+									j.put("count", 0);
+								} else {
+									j.put("count", 2);
+								}
+							} else {
+								j.put("count", 1);
+							}
+						}
+					}
+				} else {
+					j.put("count", 0);
+				}
+			}
+		}
+		return j;
+	}
+	
+	/**
+	 * 打卡接口
+	 */
+	@ResponseBody
+	@RequestMapping(value = "addPunchCard" , method=RequestMethod.GET)
+	public AjaxJson addPunchCard(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+		AjaxJson j=new AjaxJson();
+		WorkAttendanceInfo WorkAttendanceInfo = new WorkAttendanceInfo();
+		String userId = request.getParameter("userId");
+		String companyId = request.getParameter("companyId");
+		if(Strings.isNullOrEmpty(companyId)){
+			companyId = UserUtils.getSelectCompany().getId();
+		}
+		String ruleId = request.getParameter("ruleId");
+		String lnt = request.getParameter("lnt");
+		String lat = request.getParameter("lat");
+		String wifi=request.getParameter("wifi");
+		String cardType = request.getParameter("cardType");
+		String palce = request.getParameter("palce");
+		String ruleType = request.getParameter("ruleType");
+		String type = request.getParameter("type");
+		if(!type.equals("1") && !type.equals("2")){
+			j.setMsg("考勤类型异常");
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2003);
+			return j;
+		}
+		User user = UserUtils.getUser();
+		logger.info("http://localhost:8080/f/work/workAttendanceInfo/addPunchCard?userId="+userId+"&companyId="+companyId+"&ruleId="+ruleId+"&lnt="+lnt+"&lat="+lat+"&wifi="+wifi+"&cardType"+cardType+"&ruleType="+ruleType);
+		workAttendanceInfoService.addPunchCard(user,lnt,lat,wifi,cardType,ruleType,type,palce,j);
+		return j;
+	}
+
+	/**
+	 * 打卡接口
+	 */
+	@ResponseBody
+	@RequestMapping(value = "updatePunchCard" , method=RequestMethod.GET)
+	public AjaxJson updatePunchCard(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+		AjaxJson j=new AjaxJson();
+		WorkAttendanceInfo WorkAttendanceInfo = new WorkAttendanceInfo();
+		String userId = request.getParameter("userId");
+		String companyId = request.getParameter("companyId");
+		if(Strings.isNullOrEmpty(companyId)){
+			companyId = UserUtils.getSelectCompany().getId();
+		}
+		String lnt = request.getParameter("lnt");
+		String ruleId = request.getParameter("ruleId");
+		String lat = request.getParameter("lat");
+		String wifi=request.getParameter("wifi");
+		String cardType = request.getParameter("cardType");
+		String palce = request.getParameter("palce");
+		String ruleType = request.getParameter("ruleType");
+		String type = request.getParameter("type");
+		User user = UserUtils.getUser();
+		if(!type.equals("1") && !type.equals("2")){
+			j.setMsg("考勤类型异常");
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2003);
+			return j;
+		}
+		logger.info("http://localhost:8080/f/work/workAttendanceInfo/updatePunchCard?userId="+userId+"&companyId="+companyId+"&ruleId="+ruleId+"&lnt="+lnt+"&lat="+lat+"&wifi="+wifi+"&cardType"+cardType+"&ruleType="+ruleType);
+		workAttendanceInfoService.updatePunchCard(user,lnt,lat,wifi,cardType,ruleType,type,palce,j);
+		return j;
+	}
+
+	/**
+	 * 补卡接口
+	 */
+	@ResponseBody
+	@RequestMapping(value = "addPunchCardAudit" , method=RequestMethod.GET)
+	public AjaxJson addPunchCardAudit(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+		AjaxJson j=new AjaxJson();
+		/*String companyId = request.getParameter("companyId");
+		if(Strings.isNullOrEmpty(companyId)){
+			companyId = UserUtils.getSelectCompany().getId();
+		}
+		String ruleId = request.getParameter("ruleId");*/
+		String cardType = request.getParameter("cardType");
+		String ruleType = request.getParameter("ruleType");
+		String addendanceDate = request.getParameter("addendanceDate");
+		//String dateTime = request.getParameter("dateTime");
+		String reason = request.getParameter("reason");
+		User user = UserUtils.getUser();
+		if(!cardType.equals("1") && !cardType.equals("2") && !cardType.equals("3")){
+			j.setMsg("考勤类型异常");
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2003);
+			return j;
+		}
+		logger.info("http://localhost:8080/f/work/workAttendanceInfo/addPunchCardAudit?reason="+reason+"&addendanceDate="+addendanceDate+"&cardType"+cardType+"&ruleType="+ruleType);
+		workAttendanceInfoService.addPunchCardAudit(user,cardType,ruleType,addendanceDate,reason,j);
+		return j;
+	}
+
+	/**
+	 * 获取考勤规则接口
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getCompanyRule" , method=RequestMethod.GET)
+	public AjaxJson getCompanyRule(HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j=new AjaxJson();
+		WorkAttendanceInfo WorkAttendanceInfo = new WorkAttendanceInfo();
+		String ruleId = request.getParameter("ruleId");
+		String companyId = UserUtils.getSelectCompany().getId();
+        User user = UserUtils.getUser();
+        String officeId = UserUtils.getSelectOffice().getId();
+        WorkAttendanceRule workAttendanceRule = workAttendanceInfoService.findAttendanceRuleByCompany(companyId,ruleId,officeId,user);
+		if(workAttendanceRule==null || StringUtils.isBlank(workAttendanceRule.getId())){
+			j.put("data", new WorkAttendanceRule());
+		    j.setMsg("当前账号无考勤规则");
+		    j.setErrorCode(ErrorCode.code_1004);
+		}else{
+		    j.put("data", workAttendanceRule);
+		    j.setMsg("获取考勤规则成功");
+		    j.setErrorCode(ErrorCode.code_1004);
+		}
+		return j;
+	}
+
+	/**
+	 * 保存考勤规则接口
+	 */
+	@Transactional
+	@ResponseBody
+	@RequestMapping(value = "saveCompanyRule" , method=RequestMethod.GET)
+	public AjaxJson saveCompanyRule(HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j=new AjaxJson();
+        try {
+            WorkAttendanceRule WorkAttendanceRule = new WorkAttendanceRule();
+            WorkAttendanceRule oaAttRule = null;
+            String ruleId = request.getParameter("ruleId");
+
+            String companyId = request.getParameter("companyId");
+            String startTime = request.getParameter("startTime");
+            String endTime = request.getParameter("endTime");
+            //String workdays = request.getParameter("workdays");
+            /*String wifi = request.getParameter("wifi");
+            String wifiName = request.getParameter("wifiName");
+            String placeId = request.getParameter("place");
+            if ((wifi == null || wifi == "") && (placeId == null || placeId == "")) {
+                j.setSuccess(false);
+                j.setErrorCode("304");
+                j.setMsg("保存考勤规则失败!");
+                return j;
+            }*/
+            /*String wifia = request.getParameter("wifia");
+            String wifiNamea = request.getParameter("wifiNamea");
+            String wifib = request.getParameter("wifib");
+            String wifiNameb = request.getParameter("wifiNameb");
+            String wific = request.getParameter("wific");
+            String wifiNamec = request.getParameter("wifiNamec");
+            String wifid = request.getParameter("wifid");
+            String wifiNamed = request.getParameter("wifiNamed");
+            String wifie = request.getParameter("wifie");
+            String wifiNamee = request.getParameter("wifiNamee");
+            String placeIda = request.getParameter("placea");
+            String placeIdb = request.getParameter("placeb");
+            String placeIdc = request.getParameter("placec");
+            String placeIdd = request.getParameter("placed");
+            String placeIde = request.getParameter("placee");
+            companyId = UserUtils.getSelectCompany().getId();
+            if ((wifia == null || wifia == "") && (placeIda == null || placeIda == "")) {
+                j.setSuccess(false);
+                j.setErrorCode(ErrorCode.code_2004);
+                j.setMsg("保存考勤规则失败!");
+                return j;
+            }
+            if (StringUtils.isBlank(wifia)) {wifia = "-1";}
+            if (StringUtils.isBlank(wifib)) {wifib = "-1";}
+            if (StringUtils.isBlank(wific)) {wific = "-1";}
+            if (StringUtils.isBlank(wifid)) {wifid = "-1";}
+            if (StringUtils.isBlank(wifie)) {wifie = "-1";}
+            if (StringUtils.isBlank(wifiNamea)) {wifiNamea = "-1";}
+            if (StringUtils.isBlank(wifiNameb)) {wifiNameb = "-1";}
+            if (StringUtils.isBlank(wifiNamec)) {wifiNamec = "-1";}
+            if (StringUtils.isBlank(wifiNamed)) {wifiNamed = "-1";}
+            if (StringUtils.isBlank(wifiNamee)) {wifiNamee = "-1";}
+            if (StringUtils.isBlank(placeIda)) {placeIda = "-1";}
+            if (StringUtils.isBlank(placeIdb)) {placeIdb = "-1";}
+            if (StringUtils.isBlank(placeIdc)) {placeIdc = "-1";}
+            if (StringUtils.isBlank(placeIdd)) {placeIdd = "-1";}
+            if (StringUtils.isBlank(placeIde)) {placeIde = "-1";}
+            String wifi = wifia + "," + wifib + "," + wific + "," + wifid + "," + wifie;
+            String placeId = placeIda + "," + placeIdb + "," + placeIdc + "," + placeIdd + "," + placeIde;
+            String wifiName = wifiNamea + "," + wifiNameb + "," + wifiNamec + "," + wifiNamed + "," + wifiNamee;
+			*/
+            /*if (ruleId != null && !ruleId.equals("")) {
+                WorkAttendanceRule = WorkAttendanceRuleService.get(ruleId);
+            } else if (companyId != null && !companyId.equals("")) {
+                oaAttRule = WorkAttendanceRuleService.findAttendanceRuleByCompany(companyId);
+            } else {
+                j.setSuccess(false);
+                j.setErrorCode(ErrorCode.code_2006);
+                j.setMsg("保存考勤规则失败!");
+                return j;
+            }
+            if (oaAttRule != null) {
+                WorkAttendanceRule = oaAttRule;
+            }
+            WorkAttendanceRule.setCompany(new Office(companyId));
+            WorkAttendanceRule.setStartTime(startTime);
+            WorkAttendanceRule.setEndTime(endTime);
+            WorkAttendanceRule.setWorkdays(workdays);
+            WorkAttendanceRule.setWifi(wifi);
+            WorkAttendanceRule.setWifiName(wifiName);
+            WorkAttendanceRule.setPlaceId(placeId);
+            WorkAttendanceRule.setIsNewRecord(false);
+            WorkAttendanceRuleService.save(WorkAttendanceRule);
+            j.put("data", WorkAttendanceRule);
+            j.setMsg("保存考勤规则成功");
+            j.setErrorCode(ErrorCode.code_1004);*/
+        }catch (Exception e){
+            logger.info("e="+e.getMessage());
+            j.setErrorCode(ErrorCode.code_2004);
+            j.setSuccess(false);
+            j.setMsg("保存考勤规则失败");
+        }
+		return j;
+	}
+	
+	
+	
+	
+	/**
+	 * 删除考勤规则接口
+	 */
+	@ResponseBody
+	@RequestMapping(value = "deleteCompanyRule" , method=RequestMethod.GET)
+	public AjaxJson deleteCompanyRule(HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j=new AjaxJson();
+		WorkAttendanceRule WorkAttendanceRule = new WorkAttendanceRule();
+		String ruleId=request.getParameter("ruleId");
+		
+		/*String companyId=request.getParameter("companyId");
+		if(ruleId != null && !ruleId.equals("")){
+			WorkAttendanceRule =WorkAttendanceRuleService.get(ruleId);
+		}else if(companyId != null && !companyId.equals("")){
+			WorkAttendanceRule = WorkAttendanceRuleService.findAttendanceRuleByCompany(companyId); 
+		}
+		WorkAttendanceRuleService.delete(WorkAttendanceRule);*/
+		j.put("data", "success");
+		   
+		j.setMsg("删除考勤规则成功");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+	
+	/**
+	 * 获取考勤地点接口
+	 */
+	@ResponseBody
+	@RequestMapping(value = "getAttendancePlace" , method=RequestMethod.GET)
+	public AjaxJson getAttendancePlace(HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j=new AjaxJson();
+		WorkAttendanceRule WorkAttendanceRule = null;
+		String ruleId=request.getParameter("ruleId");
+		
+		/*String companyId=request.getParameter("companyId");
+        companyId = UserUtils.getSelectCompany().getId();
+		List<WorkAttendancePlace> WorkAttendancePlaceList =new ArrayList<WorkAttendancePlace>();
+		if(ruleId != null && !ruleId.equals("")){	
+			WorkAttendanceRule =WorkAttendanceRuleService.get(ruleId);
+		}else if(companyId != null && !companyId.equals("")){
+			WorkAttendanceRule = WorkAttendanceRuleService.findAttendanceRuleByCompany(companyId); 
+		}
+		if(WorkAttendanceRule==null){
+//			j.setSuccess(false);
+//			j.setErrorCode("-1");
+//			j.setMsg("考勤规则不存在");
+		}
+		WorkAttendancePlaceList = WorkAttendanceRuleService.findAttendancePlaceByCompany(companyId);
+
+		j.put("data", WorkAttendancePlaceList);*/
+		   
+		j.setMsg("获取考勤地点成功");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+	
+	
+	/**
+	 * 保存考勤地点接口
+	 */
+	@Transactional
+	@ResponseBody
+	@RequestMapping(value = "saveAttendancePlace" , method=RequestMethod.GET)
+	public AjaxJson saveAttendancePlace(HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j=new AjaxJson();
+		WorkAttendanceRule WorkAttendanceRule = null;
+		WorkAttendancePlace WorkAttendancePlace = new WorkAttendancePlace();
+		String ruleId=request.getParameter("ruleId");
+		
+		String placeId=request.getParameter("placeId");
+		String companyId=request.getParameter("companyId");
+		companyId = UserUtils.getUser().getComId();
+		String placeName=request.getParameter("placeName");
+		String placeScope=request.getParameter("placeScope");
+		
+		String longitude=request.getParameter("longitude");
+		String latitude=request.getParameter("latitude");
+		
+		if(placeName ==null || placeName.equals("")){
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2003);
+			j.setMsg("考勤地点不能为空!");
+			return j;
+		}
+		
+		/*if(placeScope ==null || placeScope.equals("")){
+			placeScope = "100";
+		}
+		
+		if(placeId != null && !placeId.equals("")){	
+			WorkAttendancePlace =WorkAttendanceRuleService.getWorkAttendancePlace(placeId);
+		}
+
+		if(ruleId != null && !ruleId.equals("")){	
+			WorkAttendanceRule =WorkAttendanceRuleService.get(ruleId);
+		}else if(companyId != null && !companyId.equals("")){
+			WorkAttendanceRule = WorkAttendanceRuleService.findAttendanceRuleByCompany(companyId); 
+		}
+
+		if(WorkAttendanceRule !=null){
+			WorkAttendancePlace.setCompany(new Office(companyId));
+			WorkAttendancePlace.setPlaceName(placeName);
+			WorkAttendancePlace.setPlaceScope(placeScope);
+			WorkAttendancePlace.setLongitude(longitude);
+			WorkAttendancePlace.setLatitude(latitude);
+			WorkAttendancePlace.setWorkAttendanceRule(WorkAttendanceRule);
+			WorkAttendanceRuleService.saveWorkAttendancePlace(WorkAttendancePlace);
+		}else if(companyId !=null  && !companyId.equals("")){
+			WorkAttendancePlace.setCompany(new Office(companyId));
+			WorkAttendancePlace.setPlaceName(placeName);
+			WorkAttendancePlace.setPlaceScope(placeScope);
+			WorkAttendancePlace.setLongitude(longitude);
+			WorkAttendancePlace.setLatitude(latitude);
+			//WorkAttendancePlace.setWorkAttendanceRule(WorkAttendanceRule);
+			WorkAttendanceRuleService.saveWorkAttendancePlace(WorkAttendancePlace);
+		}else{
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2003);
+			j.setMsg("考勤规则或公司不能为空!");
+			return j;
+		}*/
+		
+		j.put("data", WorkAttendancePlace);
+		   
+		j.setMsg("保存考勤规则成功");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+	
+	/**
+	 * 删除考勤地点接口
+	 */
+	@Transactional
+	@ResponseBody
+	@RequestMapping(value = "deleteAttendancePlace" , method=RequestMethod.GET)
+	public AjaxJson deleteAttendancePlace(HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j=new AjaxJson();
+		WorkAttendancePlace WorkAttendancePlace  = new WorkAttendancePlace();
+		String placeId = request.getParameter("placeId");
+		String ruleId = "";
+		String companyId = "";
+		/*if(placeId != null && !placeId.equals("")){
+			WorkAttendancePlace =WorkAttendanceRuleService.getWorkAttendancePlace(placeId);
+			if(WorkAttendancePlace == null){
+				j.setSuccess(false);
+				j.setErrorCode(ErrorCode.code_2005);
+				j.setMsg("考勤地点不存在!");
+				return j;
+			}
+			companyId = WorkAttendancePlace.getCompany().getId();
+			WorkAttendanceRule oaAttRule = WorkAttendanceRuleService.findAttendanceRuleByCompany(companyId);
+			String placeIds =  "";
+			String wifis =  "";
+			String wifiNames =  "";
+			String[] placeIdList = oaAttRule.getPlaceId().split(",");
+			String[] wifiList = oaAttRule.getWifi().split(",");
+			String[] wifiNameList = oaAttRule.getWifiName().split(",");
+			int count = -1;
+			for (int i =0 ;i<placeIdList.length;i++){
+				if (placeId.equals(placeIdList[i])){
+					placeIds += "-1"+",";
+					count = i;
+				}else {
+					placeIds += placeIdList[i]+",";
+				}
+			}
+			for (int i =0 ;i<wifiList.length;i++){
+				if (i == count){
+					wifis += "-1"+",";
+				}else {
+					wifis += wifiList[i]+",";
+				}
+			}
+			for (int i =0 ;i<wifiNameList.length;i++){
+				if (i == count){
+					wifiNames += "-1"+",";
+				}else {
+					wifiNames += wifiNameList[i]+",";
+				}
+			}
+			oaAttRule.setPlaceId(placeIds.substring(0,placeIds.length()-1));
+			oaAttRule.setWifi(wifis.substring(0,wifis.length()-1));
+			oaAttRule.setWifi(wifiNames.substring(0,wifiNames.length()-1));
+			WorkAttendanceRuleService.save(oaAttRule);
+			//ruleId = WorkAttendancePlace.getWorkAttendanceRule().getId();
+		}
+		WorkAttendanceRuleService.deletePlace(placeId);
+
+		List<WorkAttendancePlace> WorkAttendancePlaceList =new ArrayList<WorkAttendancePlace>();
+		if(ruleId != null && !ruleId.equals("")){	
+			WorkAttendancePlaceList= WorkAttendanceRuleService.getWorkAttendancePlaceByRule(ruleId);
+			j.put("data", WorkAttendancePlaceList);
+		}else if(companyId != null && !companyId.equals("")){
+			WorkAttendancePlaceList = WorkAttendanceRuleService.findAttendancePlaceByCompany(companyId);
+			j.put("data", WorkAttendancePlaceList);
+		}*/
+		j.setMsg("删除考勤地点成功");
+		j.setErrorCode(ErrorCode.code_1004);
+		return j;
+	}
+}

+ 328 - 0
src/main/java/com/jeeplus/modules/API/works/workreimbur/WorkReimburMobileController.java

@@ -0,0 +1,328 @@
+package com.jeeplus.modules.API.works.workreimbur;
+
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.JPushClientUtil;
+import com.jeeplus.common.utils.JsonUtil;
+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.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.service.WorkattachmentService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workapprovalcopy.entity.ApprovalCopy;
+import com.jeeplus.modules.workapprovalcopy.service.ApprovalCopyService;
+import com.jeeplus.modules.workreimbur.dao.WorkReimburDao;
+import com.jeeplus.modules.workreimbur.entity.WorkReimbur;
+import com.jeeplus.modules.workreimbur.entity.WorkReimburDetails;
+import com.jeeplus.modules.workreimbur.service.WorkReimburService;
+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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLDecoder;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * oa报销申请Controller
+ *
+ * @author fgy
+ * @version 2018-01-20
+ */
+@SuppressWarnings("all")
+@RequestMapping(value = "${frontPath}/workreimbur/WorkReimbur")
+@Controller
+public class WorkReimburMobileController extends BaseController {
+    @Autowired
+    private WorkReimburService workReimburService;
+    @Autowired
+    private OfficeService officeService;
+    @Autowired
+    private ApprovalCopyService approvalCopyService;
+    @Autowired
+    private PushinfoService pushinfoService;
+    @Autowired
+    private WorkReimburDao workReimburDao;
+    @Autowired
+    private WorkattachmentService workattachmentService;
+
+    /**
+     * 启动报销申请
+     *
+     * @param request
+     * @param response
+     */
+    @Transactional
+    @ResponseBody
+    @RequestMapping(value = "saveReimbur", method = RequestMethod.POST)
+    public AjaxJson savePayment(HttpServletRequest request, HttpServletResponse response) throws ParseException {
+        AjaxJson json = new AjaxJson();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        try {
+            HashMap<String, String> requestMap = findRequestMap(request);
+            Map<String, Object> variables = Maps.newHashMap();
+            String approverId = URLDecoder.decode(requestMap.get("approverId")==null?"":requestMap.get("approverId"), "UTF-8");
+            String remarks = URLDecoder.decode(requestMap.get("remarks")==null?"":requestMap.get("remarks"), "UTF-8");
+            String CCId = URLDecoder.decode(requestMap.get("CCId")==null?"":requestMap.get("CCId"), "UTF-8");
+            String detailsListJson = URLDecoder.decode(requestMap.get("detailsListJson")==null?"":requestMap.get("detailsListJson"), "UTF-8");
+            String type = "1";
+            String alias = "1";
+            List<String> assigneeList=new ArrayList<String>(); //分配任务的人员
+            if(approverId!=null && !approverId.equals("")) {
+                if (approverId.contains(UserUtils.getUser().getId())){
+                    json.setMsg("报销申请失败,审批人不能为本人");
+                    json.setErrorCode(ErrorCode.code_1010);
+                    json.setSuccess(false);
+                    return json;
+                }
+                String[] approverIds = approverId.split(",");
+                for (int i =0 ;i<approverIds.length;i++){
+                    assigneeList.add(approverIds[i]);
+                }
+                type = approverIds.length+"";
+                alias = approverIds[0];
+            }
+            variables.put("assigneeList", assigneeList);
+            variables.put("count",assigneeList.size());
+
+            Office company = UserUtils.getSelectCompany();
+            Office office = UserUtils.getSelectOffice();
+            User user = UserUtils.getUser();//
+
+            WorkReimbur workReimbur = new WorkReimbur();
+            workReimbur.setCompany(company);
+            workReimbur.setOffice(office);
+            workReimbur.setCreateBy(user);
+            workReimbur.setUpdateBy(user);
+            workReimbur.setDelFlag("0");
+            workReimbur.setStatus("1");
+            workReimbur.setDelFlag("0");
+            workReimbur.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            workReimbur.setOfficeId(UserUtils.getSelectOffice()==null?"":UserUtils.getSelectOffice().getId());
+            workReimbur.setCCid(CCId);
+            workReimbur.setRemarks(remarks);
+            workReimburService.save(workReimbur,variables,type);
+
+            List<WorkReimburDetails> detailsList = JsonUtil.json_to_list(detailsListJson, WorkReimburDetails.class);
+            if(detailsList!=null && detailsList.size()>0){
+                for (int i = 0; i < detailsList.size(); i++) {
+                    WorkReimburDetails reimburDetails = detailsList.get(i);
+                    String UUid = UUID.randomUUID().toString().replaceAll("-","");
+                    reimburDetails.setId(UUid);
+                    reimburDetails.setWorkReimburId(workReimbur.getId());
+                    workReimburDao.insertReimburDetail(reimburDetails);
+                }
+            }
+
+            ApprovalCopy approvalCopy = new ApprovalCopy();
+            approvalCopy.setCCId(workReimbur.getCCid());
+            approvalCopy.setUserId(user.getId());
+            approvalCopy.setType("reimbur");
+            approvalCopy.setRemarks(workReimbur.getRemarks());
+            approvalCopy.setApprovalId(workReimbur.getId());
+            approvalCopy.setApproverId(approverId);
+            approvalCopy.setReadFlag("0");
+            approvalCopyService.save(approvalCopy);
+
+            //给抄送人、审批人发送通知
+            if(approvalCopy!=null && org.apache.commons.lang3.StringUtils.isNotBlank(approvalCopy.getId())){
+                String chaosongIds = approvalCopy.getCCId();//给所有抄送人发送通知
+                String shenpiIds = alias;//给审批流程的第一个人发送通知
+                workReimburService.sendNotify(chaosongIds,shenpiIds,approvalCopy.getApprovalId());
+                String content = "审批信息 申请人:" + user.getName() + ",报销申请: 待审批!";
+                UserUtils.pushIm(alias,content);
+            }
+
+            String title="审批";
+            String content =  UserUtils.getUser().getName()+"的报销申请需要你审批";
+            String status = "待审批";
+            Office office1 = workReimbur.getOffice();
+            String officeName = "";
+            if (office1!=null){
+                Office o = officeService.get(office1.getId());
+                officeName = o.getName();
+            }
+
+            Map extras = new HashMap();
+            extras.put("type", "4001");
+            extras.put("id", workReimbur.getId());
+            extras.put("procDefKey", "reimbur");
+
+            boolean b = JPushClientUtil.sendNotificationToAlias(title, content, extras, alias);
+            Pushinfo pushinfo = new Pushinfo();
+            pushinfo.setCurrentUser(UserUtils.getUser());
+            pushinfo.setRemarks("oa报销申请");
+            pushinfo.setUserId(UserUtils.getUser().getId());
+            pushinfo.setType("4001");
+            pushinfo.setPushId(workReimbur.getId());
+            pushinfo.setTitle(title);
+            pushinfo.setContent(content);
+            pushinfo.setPushUserId(alias);
+            pushinfo.setParentType("singleApproval");
+            pushinfo.setStatus(status);
+            pushinfo.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+            pushinfo.setAddcontent("reimbur");
+            pushinfo.setMobile("ios,android");
+            pushinfoService.save(pushinfo);
+
+            if (b){
+                json.setSuccess(true);
+                json.setErrorCode(ErrorCode.code_1004);
+                json.setMsg("报销申请已经提交");
+                json.put("id", workReimbur.getId());
+            }else {
+                json.setMsg("报销申请推送失败");
+                json.setErrorCode(ErrorCode.code_2006);
+                json.setSuccess(false);
+            }
+        } catch (Exception e) {
+            logger.error("启动报销申请流程失败:", e);
+            json.setSuccess(false);
+            json.setErrorCode(ErrorCode.code_2004);
+            json.setMsg("启动报销申请流程失败");
+        }
+        return json;
+    }
+
+
+
+    /**
+     * 获取详情
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "getReimburById", method=RequestMethod.GET)
+    @ResponseBody
+    public AjaxJson getReimburById(HttpServletRequest request) {
+        AjaxJson ajaxJson = new AjaxJson();
+        String id = request.getParameter("id");
+        String type = request.getParameter("type");
+        Map map = workReimburService.getReimburById(id,type);
+        if( map==null){
+            ajaxJson.setSuccess(false);
+            ajaxJson.setMsg("获取报销申请详情失败");
+            ajaxJson.setErrorCode(ErrorCode.code_2005);
+            ajaxJson.put("data",map);
+        }
+        else{
+            ajaxJson.put("data", map);
+            ajaxJson.setMsg("获取报销申请详情成功");
+            ajaxJson.setErrorCode(ErrorCode.code_1004);
+        }
+
+        return ajaxJson;
+    }
+//    /**
+//     * 保存报销明细 (该接口暂时不用)
+//     * @param
+//     * @return
+//     */
+//    @Transactional
+//    @RequestMapping(value = "saveWorkReimburDetails", method=RequestMethod.POST)
+//    @ResponseBody
+//    public AjaxJson saveWorkReimburDetails(HttpServletRequest request) {
+//        AjaxJson ajaxJson = new AjaxJson();
+//        try {
+//            HashMap<String, String> requestMap = findRequestMap(request);
+//            Map<String, Object> variables = Maps.newHashMap();
+//            String reimburAmount = URLDecoder.decode(requestMap.get("reimburAmount")==null?"":requestMap.get("reimburAmount"), "UTF-8");
+//            String reimburCategory = URLDecoder.decode(requestMap.get("reimburCategory")==null?"":requestMap.get("reimburCategory"), "UTF-8");
+//            String reimburDetail = URLDecoder.decode(requestMap.get("reimburDetail")==null?"":requestMap.get("reimburDetail"), "UTF-8");
+//            String workReimburId = URLDecoder.decode(requestMap.get("workReimburId")==null?"":requestMap.get("workReimburId"), "UTF-8");
+//
+//            WorkReimburDetails reimburDetails = new WorkReimburDetails();
+//            String UUid = UUID.randomUUID().toString().replaceAll("-","");
+//            reimburDetails.setId(UUid);
+//            reimburDetails.setReimburAmount(reimburAmount);
+//            reimburDetails.setReimburCategory(reimburCategory);
+//            reimburDetails.setReimburDetail(reimburDetail);
+//            reimburDetails.setWorkReimburId(workReimburId);
+//            workReimburDao.insertReimburDetail(reimburDetails);
+//
+//            ajaxJson.put("reimburDetails",reimburDetails);
+//            ajaxJson.setSuccess(true);
+//            ajaxJson.setErrorCode(ErrorCode.code_1004);
+//            ajaxJson.setMsg("报销明细保存成功");
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//
+//        }
+//        return ajaxJson;
+//    }
+    /**
+     * 保存图片
+     * @param
+     * @return
+     */
+    @Transactional
+    @RequestMapping(value = "saveFile", method=RequestMethod.POST)
+    @ResponseBody
+    public AjaxJson saveFile(MultipartHttpServletRequest multiRequest) {
+        AjaxJson j=new AjaxJson();
+        try {
+            String id = multiRequest.getParameter("id");
+            WorkReimbur workReimbur =  workReimburDao.get(id);
+            OSSClientUtil ossClientUtil =new OSSClientUtil();
+            Iterator<String> fileNames = multiRequest.getFileNames();
+            while(fileNames.hasNext()){
+                MultipartFile file = multiRequest.getFile(fileNames.next());
+                if(file != null && !file.isEmpty() &&file.getSize()>0){
+                    String fileName = file.getOriginalFilename();
+                    String fileType = fileName.substring(fileName.lastIndexOf("."));
+                    String url = ossClientUtil.uploadFile2OSS(file,"workReimbur");
+                    Workattachment workattachment = new Workattachment();
+                    workattachment.setUrl(url);
+                    workattachment.setType(fileType);
+                    workattachment.setAttachmentName(fileName);
+                    workattachment.setAttachmentUser(UserUtils.getUser().getId());
+                    workattachment.setAttachmentId(workReimbur.getId());
+                    workattachment.setCompanyId(UserUtils.getSelectCompany().getId());
+                    workattachment.setAttachmentFlag("70");
+                    workattachmentService.save(workattachment);
+                }
+            }
+            List<Workattachment> attachmentList = workattachmentService.getListByAttachmentIdAndFlag(id, "70");
+            String files = "";
+            if(attachmentList!=null && attachmentList.size()>0){
+                for (int i = 0; i < attachmentList.size(); i++) {
+                    if(StringUtils.isNotBlank(attachmentList.get(i).getUrl())){
+                        files += "," + attachmentList.get(i).getUrl();
+                    }
+                }
+            }
+            if(files.startsWith(",")&&files.length()>2){
+                files = files.substring(1);
+            }
+            //j.put("attachmentList",attachmentList);
+            j.put("files",files);
+            j.setSuccess(true);
+            j.setErrorCode(ErrorCode.code_1004);
+            j.setMsg("上传成功!");
+        }catch (Exception e){
+            j.setSuccess(false);
+            j.setMsg("上传失败!");
+            j.setErrorCode(ErrorCode.code_2004);
+        }finally {
+            return j;
+        }
+    }
+
+}

+ 20 - 0
src/main/java/com/jeeplus/modules/act/dao/ActDao.java

@@ -0,0 +1,20 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.act.entity.Act;
+
+/**
+ * 审批DAO接口
+ * @author jeeplus
+ * @version 2014-05-16
+ */
+@MyBatisDao
+public interface ActDao extends CrudDao<Act> {
+
+	public int updateProcInsIdByBusinessId(Act act);
+	
+}

+ 440 - 0
src/main/java/com/jeeplus/modules/act/entity/Act.java

@@ -0,0 +1,440 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.entity;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.activiti.engine.history.HistoricActivityInstance;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.history.HistoricTaskInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.jeeplus.common.persistence.BaseEntity;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.TimeUtils;
+import com.jeeplus.modules.act.utils.Variable;
+
+/**
+ * 工作流Entity
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+public class Act extends BaseEntity<Act> {
+	
+	private static final long serialVersionUID = 1L;
+
+	private String taskId; 		// 任务编号
+	private String taskName; 	// 任务名称
+	private String taskDefKey; 	// 任务定义Key(任务环节标识)
+
+	private String procInsId; 	// 流程实例ID
+	private String procDefId; 	// 流程定义ID
+	private String procDefKey; 	// 流程定义Key(流程定义标识)
+
+	private String businessTable;	// 业务绑定Table
+	private String businessId;		// 业务绑定ID
+	
+	private String title; 		// 任务标题
+
+	private String status; 		// 任务状态(todo/claim/finish)
+
+//	private String procExecUrl; 	// 流程执行(办理)RUL
+	private String comment; 	// 任务意见
+	private String flag; 		// 意见状态
+	
+	private Task task; 			// 任务对象
+	
+	
+	private ProcessDefinition procDef; 	// 流程定义对象
+	private ProcessInstance procIns;	// 流程实例对象
+	private HistoricProcessInstance hisProcIns;	// 历史流程实例对象
+	private HistoricTaskInstance histTask; // 历史任务
+	private HistoricActivityInstance histIns;	//历史活动任务
+
+	private String assignee; // 任务执行人编号
+	private String assigneeName; // 任务执行人名称
+
+	private Variable vars; 		// 流程变量
+//	private Variable taskVars; 	// 流程任务变量
+	
+	private Date beginDate;	// 开始查询日期
+	private Date endDate;	// 结束查询日期
+	private String durationTime;
+	private List<Act> list; // 任务列表
+	private String roleName;
+
+
+	public Act() {
+		super();
+	}
+	
+
+	public String getTaskId() {
+		if (taskId == null && task != null){
+			taskId = task.getId();
+		}
+		return taskId;
+	}
+
+	public void setTaskId(String taskId) {
+		this.taskId = taskId;
+	}
+
+	public String getTaskName() {
+		if (taskName == null && task != null){
+			taskName = task.getName();
+		}
+		return taskName;
+	}
+
+	public void setTaskName(String taskName) {
+		this.taskName = taskName;
+	}
+
+	public String getTaskDefKey() {
+		if (taskDefKey == null && task != null){
+			taskDefKey = task.getTaskDefinitionKey();
+		}
+		return taskDefKey;
+	}
+
+	public void setTaskDefKey(String taskDefKey) {
+		this.taskDefKey = taskDefKey;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	public Date getTaskCreateDate() {
+		if (task != null){
+			return task.getCreateTime();
+		}
+		return null;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	public Date getTaskEndDate() {
+		if (histTask != null){
+			return histTask.getEndTime();
+		}
+		return null;
+	}
+	
+	@JsonIgnore
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	@JsonIgnore
+	public ProcessDefinition getProcDef() {
+		return procDef;
+	}
+
+	public void setProcDef(ProcessDefinition procDef) {
+		this.procDef = procDef;
+	}
+	
+	public String getProcDefName() {
+		return procDef.getName();
+	}
+
+	@JsonIgnore
+	public ProcessInstance getProcIns() {
+		return procIns;
+	}
+
+	public void setProcIns(ProcessInstance procIns) {
+		this.procIns = procIns;
+		if (procIns != null && procIns.getBusinessKey() != null&& procIns.getBusinessKey().contains(":")){
+			String[] ss = procIns.getBusinessKey().split(":");
+			setBusinessTable(ss[0]);
+			setBusinessId(ss[1]);
+		}else if (procIns != null && procIns.getBusinessKey() != null){
+			setBusinessId(procIns.getBusinessKey());
+		}
+	}
+	
+	public void setFinishedProcIns(HistoricProcessInstance procIns) {
+		//this.procIns = procIns;
+		if (procIns != null && procIns.getBusinessKey() != null&& procIns.getBusinessKey().contains(":")){
+			String[] ss = procIns.getBusinessKey().split(":");
+			setBusinessTable(ss[0]);
+			setBusinessId(ss[1]);
+		}else if (procIns != null && procIns.getBusinessKey() != null){
+			setBusinessId(procIns.getBusinessKey());
+		}
+	}
+
+//	public String getProcExecUrl() {
+//		return procExecUrl;
+//	}
+//
+//	public void setProcExecUrl(String procExecUrl) {
+//		this.procExecUrl = procExecUrl;
+//	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+	
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	@JsonIgnore
+	public HistoricTaskInstance getHistTask() {
+		return histTask;
+	}
+
+	public void setHistTask(HistoricTaskInstance histTask) {
+		this.histTask = histTask;
+	}
+
+	@JsonIgnore
+	public HistoricActivityInstance getHistIns() {
+		return histIns;
+	}
+
+	public void setHistIns(HistoricActivityInstance histIns) {
+		this.histIns = histIns;
+	}
+
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	public Date getBeginDate() {
+		return beginDate;
+	}
+
+	public void setBeginDate(Date beginDate) {
+		this.beginDate = beginDate;
+	}
+
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	public Date getEndDate() {
+		return endDate;
+	}
+
+	public void setEndDate(Date endDate) {
+		this.endDate = endDate;
+	}
+
+	public String getComment() {
+		return comment;
+	}
+
+	public void setComment(String comment) {
+		this.comment = comment;
+	}
+
+	public String getFlag() {
+		return flag;
+	}
+
+	public void setFlag(String flag) {
+		this.flag = flag;
+	}
+
+	public String getProcDefId() {
+		if (procDefId == null && task != null){
+			procDefId = task.getProcessDefinitionId();
+		}
+		return procDefId;
+	}
+
+	public void setProcDefId(String procDefId) {
+		this.procDefId = procDefId;
+	}
+
+	public String getProcInsId() {
+		if (procInsId == null && task != null){
+			procInsId = task.getProcessInstanceId();
+		}
+		return procInsId;
+	}
+
+	public void setProcInsId(String procInsId) {
+		this.procInsId = procInsId;
+	}
+
+	public String getBusinessId() {
+		return businessId;
+	}
+
+	public void setBusinessId(String businessId) {
+		this.businessId = businessId;
+	}
+
+	public String getBusinessTable() {
+		return businessTable;
+	}
+
+	public void setBusinessTable(String businessTable) {
+		this.businessTable = businessTable;
+	}
+
+	public String getAssigneeName() {
+		return assigneeName;
+	}
+
+	public void setAssigneeName(String assigneeName) {
+		this.assigneeName = assigneeName;
+	}
+
+	public String getAssignee() {
+		if (assignee == null && task != null){
+			assignee = task.getAssignee();
+		}
+		return assignee;
+	}
+
+	public void setAssignee(String assignee) {
+		this.assignee = assignee;
+	}
+
+	public List<Act> getList() {
+		return list;
+	}
+
+	public void setList(List<Act> list) {
+		this.list = list;
+	}
+
+	public Variable getVars() {
+		return vars;
+	}
+
+	public void setVars(Variable vars) {
+		this.vars = vars;
+	}
+	
+	/**
+	 * 通过Map设置流程变量值
+	 * @param map
+	 */
+	public void setVars(Map<String, Object> map) {
+		this.vars = new Variable(map);
+	}
+
+//	public Variable getTaskVars() {
+//		return taskVars;
+//	}
+//
+//	public void setTaskVars(Variable taskVars) {
+//		this.taskVars = taskVars;
+//	}
+//
+//	/**
+//	 * 通过Map设置流程任务变量值
+//	 * @param map
+//	 */
+//	public void setTaskVars(Map<String, Object> map) {
+//		this.taskVars = new Variable(map);
+//	}
+
+	/**
+	 * 获取流程定义KEY
+	 * @return
+	 */
+	public String getProcDefKey() {
+		if (StringUtils.isBlank(procDefKey) && StringUtils.isNotBlank(procDefId)){
+			procDefKey = StringUtils.split(procDefId, ":")[0];
+		}
+		return procDefKey;
+	}
+
+	public void setProcDefKey(String procDefKey) {
+		this.procDefKey = procDefKey;
+	}
+	
+	/**
+	 * 获取过去的任务历时
+	 * @return
+	 */
+	public String getDurationTime(){
+		if (histIns!=null && histIns.getDurationInMillis() != null){
+			return TimeUtils.toTimeString(histIns.getDurationInMillis());
+		}else {
+			return durationTime;
+		}
+	}
+
+	public void setDurationTime(String durationTime) {
+		this.durationTime = durationTime;
+	}
+
+	/**
+	 * 是否是一个待办任务
+	 * @return
+	 */
+	public boolean isTodoTask(){
+		return "todo".equals(status) || "claim".equals(status);
+	}
+	
+	/**
+	 * 是否是已完成任务
+	 * @return
+	 */
+	public boolean isFinishTask(){
+		
+		return "finish".equals(status) || StringUtils.isBlank(taskId);
+	}
+
+	@Override
+	public void preInsert() {
+		
+	}
+
+	@Override
+	public void preUpdate() {
+		
+	}
+
+
+	public HistoricProcessInstance getHisProcIns() {
+		return hisProcIns;
+	}
+
+
+	public void setHisProcIns(HistoricProcessInstance hisProcIns) {
+		this.hisProcIns = hisProcIns;
+	}
+
+	public String getRoleName() {
+		return roleName;
+	}
+
+	public void setRoleName(String roleName) {
+		this.roleName = roleName;
+	}
+
+	@Override
+	public String toString() {
+		return "Act [taskId=" + taskId + ", taskName=" + taskName + ", taskDefKey=" + taskDefKey + ", procInsId="
+				+ procInsId + ", procDefId=" + procDefId + ", procDefKey=" + procDefKey + ", businessTable="
+				+ businessTable + ", businessId=" + businessId + ", title=" + title + ", status=" + status
+				+ ", comment=" + comment + ", flag=" + flag + ", task=" + task + ", procDef=" + procDef + ", procIns="
+				+ procIns + ", hisProcIns=" + hisProcIns + ", histTask=" + histTask + ", histIns=" + histIns
+				+ ", assignee=" + assignee + ", assigneeName=" + assigneeName + ", vars=" + vars + ", beginDate="
+				+ beginDate + ", endDate=" + endDate + ", list=" + list + "]";
+	}
+
+	
+}
+
+

+ 75 - 0
src/main/java/com/jeeplus/modules/act/rest/DispatcherServletConfiguration.java

@@ -0,0 +1,75 @@
+package com.jeeplus.modules.act.rest;
+
+import java.util.List;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
+import org.springframework.web.servlet.i18n.SessionLocaleResolver;
+import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
+
+@Configuration
+@ComponentScan({"org.activiti.rest,org.activiti.conf"})
+@EnableAsync
+public class DispatcherServletConfiguration extends WebMvcConfigurationSupport {
+
+    private final Logger log = LoggerFactory.getLogger(DispatcherServletConfiguration.class);
+
+    @Autowired
+    private ObjectMapper objectMapper;
+
+    @Autowired
+    private Environment environment;
+
+    @Bean
+    public SessionLocaleResolver localeResolver() {
+        return new SessionLocaleResolver();
+    }
+
+    @Bean
+    public LocaleChangeInterceptor localeChangeInterceptor() {
+        log.debug("Configuring localeChangeInterceptor");
+        LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
+        localeChangeInterceptor.setParamName("language");
+        return localeChangeInterceptor;
+    }
+
+    @Bean
+    public RequestMappingHandlerMapping requestMappingHandlerMapping() {
+        log.debug("Creating requestMappingHandlerMapping");
+        RequestMappingHandlerMapping requestMappingHandlerMapping = new RequestMappingHandlerMapping();
+        requestMappingHandlerMapping.setUseSuffixPatternMatch(false);
+        Object[] interceptors = {localeChangeInterceptor()};
+        requestMappingHandlerMapping.setInterceptors(interceptors);
+        return requestMappingHandlerMapping;
+    }
+
+    @Override
+    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
+        addDefaultHttpMessageConverters(converters);
+        for (HttpMessageConverter<?> converter : converters) {
+            if (converter instanceof MappingJackson2HttpMessageConverter) {
+                MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = (MappingJackson2HttpMessageConverter) converter;
+                jackson2HttpMessageConverter.setObjectMapper(objectMapper);
+                break;
+            }
+        }
+    }
+
+    @Override
+    protected void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
+        configurer.favorPathExtension(false);
+    }
+
+}

+ 39 - 0
src/main/java/com/jeeplus/modules/act/rest/FilterServletOutputStream.java

@@ -0,0 +1,39 @@
+package com.jeeplus.modules.act.rest;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import javax.servlet.ServletOutputStream;
+//import javax.servlet.WriteListener;
+
+public class FilterServletOutputStream extends ServletOutputStream {
+
+    private DataOutputStream stream;
+   // private WriteListener writeListener;
+
+    public FilterServletOutputStream(OutputStream output) {
+        stream = new DataOutputStream(output);
+    }
+
+    public void write(int b) throws IOException {
+        stream.write(b);
+    }
+
+    public void write(byte[] b) throws IOException {
+        stream.write(b);
+    }
+
+    public void write(byte[] b, int off, int len) throws IOException {
+        stream.write(b, off, len);
+    }
+
+//    @Override
+//    public void setWriteListener(WriteListener writeListener) {
+//        this.writeListener = writeListener;
+//    }
+//
+//    @Override
+//    public boolean isReady() {
+//        return true;
+//    }
+}

+ 48 - 0
src/main/java/com/jeeplus/modules/act/rest/GenericResponseWrapper.java

@@ -0,0 +1,48 @@
+package com.jeeplus.modules.act.rest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintWriter;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+public class GenericResponseWrapper extends HttpServletResponseWrapper {
+    private ByteArrayOutputStream output;
+    private int contentLength;
+    private String contentType;
+
+    public GenericResponseWrapper(HttpServletResponse response) {
+        super(response);
+        output = new ByteArrayOutputStream();
+    }
+
+    public byte[] getData() {
+        return output.toByteArray();
+    }
+
+    public ServletOutputStream getOutputStream() {
+        return new FilterServletOutputStream(output);
+    }
+
+    public PrintWriter getWriter() {
+        return new PrintWriter(getOutputStream(), true);
+    }
+
+    public void setContentLength(int length) {
+        this.contentLength = length;
+        super.setContentLength(length);
+    }
+
+    public int getContentLength() {
+        return contentLength;
+    }
+
+    public void setContentType(String type) {
+        this.contentType = type;
+        super.setContentType(type);
+    }
+
+    public String getContentType() {
+        return contentType;
+    }
+} 

+ 63 - 0
src/main/java/com/jeeplus/modules/act/rest/JsonpCallbackFilter.java

@@ -0,0 +1,63 @@
+package com.jeeplus.modules.act.rest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Map;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JsonpCallbackFilter implements Filter {
+
+    private static Logger log = LoggerFactory.getLogger(JsonpCallbackFilter.class);
+
+    public void init(FilterConfig fConfig) throws ServletException {
+    }
+
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+        HttpServletRequest httpRequest = (HttpServletRequest) request;
+        HttpServletResponse httpResponse = (HttpServletResponse) response;
+
+        Map<String, String[]> parms = httpRequest.getParameterMap();
+
+        if (parms.containsKey("callback")) {
+            if (log.isDebugEnabled())
+                log.debug("Wrapping response with JSONP callback '" + parms.get("callback")[0] + "'");
+
+            OutputStream out = httpResponse.getOutputStream();
+
+            GenericResponseWrapper wrapper = new GenericResponseWrapper(httpResponse);
+
+            chain.doFilter(request, wrapper);
+
+            //handles the content-size truncation
+            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+            outputStream.write(new String(parms.get("callback")[0] + "(").getBytes());
+            outputStream.write(wrapper.getData());
+            outputStream.write(new String(");").getBytes());
+            byte jsonpResponse[] = outputStream.toByteArray();
+
+            wrapper.setContentType("text/javascript;charset=UTF-8");
+            wrapper.setContentLength(jsonpResponse.length);
+
+            out.write(jsonpResponse);
+
+            out.close();
+
+        } else {
+            chain.doFilter(request, response);
+        }
+    }
+
+    public void destroy() {
+    }
+}

+ 346 - 0
src/main/java/com/jeeplus/modules/act/service/ActAuditService.java

@@ -0,0 +1,346 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.service;
+
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.service.BaseService;
+import com.jeeplus.common.utils.JPushClientUtil;
+import com.jeeplus.common.websocket.onchat.ChatServerPool;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.oa.entity.Leave;
+import com.jeeplus.modules.oa.service.LeaveService;
+import com.jeeplus.modules.oa_evection.entity.oa_evection.OaEvection;
+import com.jeeplus.modules.oa_evection.service.oa_evection.OaEvectionService;
+import com.jeeplus.modules.oaall.entity.OaAll;
+import com.jeeplus.modules.oaall.service.OaAllService;
+import com.jeeplus.modules.oabuy.entity.OaBuy;
+import com.jeeplus.modules.oabuy.service.OaBuyService;
+import com.jeeplus.modules.oaperformance.entity.OaPerformance;
+import com.jeeplus.modules.oaperformance.service.OaPerformanceService;
+import com.jeeplus.modules.pushinfo.entity.Pushinfo;
+import com.jeeplus.modules.pushinfo.service.PushinfoService;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workgoout.entity.GoOut;
+import com.jeeplus.modules.workgoout.service.GoOutService;
+import com.jeeplus.modules.workovertimeform.entity.WorkOvertimeForm;
+import com.jeeplus.modules.workovertimeform.service.WorkOvertimeFormService;
+import com.jeeplus.modules.workpayment.entity.WorkPayment;
+import com.jeeplus.modules.workpayment.service.WorkPaymentService;
+import com.jeeplus.modules.workpettycash.entity.WorkPettyCash;
+import com.jeeplus.modules.workpettycash.service.WorkPettyCashService;
+import com.jeeplus.modules.workreimbur.entity.WorkReimbur;
+import com.jeeplus.modules.workreimbur.service.WorkReimburService;
+import com.jeeplus.modules.worksealform.entity.WorkSealForm;
+import com.jeeplus.modules.worksealform.service.WorkSealFormService;
+import org.activiti.engine.ActivitiObjectNotFoundException;
+import org.java_websocket.WebSocket;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 流程定义相关Service
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+@Service
+@Transactional(readOnly = true)
+public class ActAuditService extends BaseService {
+
+
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private LeaveService leaveService;
+	@Autowired
+	private GoOutService goOutService;
+	@Autowired
+	private WorkSealFormService workSealFormService;
+	@Autowired
+	private OaPerformanceService oaPerformanceService;
+	@Autowired
+	private OaBuyService oaBuyService;
+
+	@Autowired
+	private OaEvectionService oaEvectionService;
+	@Autowired
+	private WorkOvertimeFormService workOvertimeFormService;
+	@Autowired
+	private OaAllService oaAllService;
+
+	@Autowired
+	private WorkPettyCashService workPettyCashService;
+	@Autowired
+	private WorkPaymentService workPaymentService;
+	@Autowired
+	private WorkReimburService workReimburService;
+	@Autowired
+	private PushinfoService pushinfoService;
+
+	@Transactional(readOnly = false)
+	public AjaxJson saveAudit(Act act, String procInsId,String procDefKey, String comment,String approvalId, String type){
+		AjaxJson j = new AjaxJson();
+		j.setMsg("流程审核成功");
+		j.setSuccess(true);
+		j.setErrorCode(ErrorCode.code_1004);
+		try {
+			Map map = new HashMap();
+			String name = "";
+			String title="审批";
+			String content="";
+			String remarks="";
+			String aliase = "";
+			String pushStatus="";
+			if(procDefKey.equals("leave")){
+				name = "请假";
+				Leave leave = leaveService.getById(approvalId);
+				leave.setAct(act);
+				leave.setComment(comment);
+				leaveService.auditSave(leave);
+				map = leaveService.getLeaveById(approvalId,type);
+				String leaveType = map.get("leaveType").toString();
+				String startTime = map.get("startTime").toString();
+				String endTime = map.get("endTime").toString();
+				if (leaveType.equals("1")){
+					//1:事假、2:病假、3:调休、4:年假、5:婚假、6:产假、7:其他
+					leaveType = "事假";
+				}else if (leaveType.equals("2")){
+					leaveType = "病假";
+				}else if (leaveType.equals("3")){
+					leaveType = "调休";
+				}else if (leaveType.equals("4")){
+					leaveType = "年假";
+				}else if (leaveType.equals("5")){
+					leaveType = "婚假";
+				}else if (leaveType.equals("6")){
+					leaveType = "产假";
+				}else if (leaveType.equals("7")){
+					leaveType = "其他";
+				}
+				remarks = "请假类型:"+leaveType+ "\n"
+						+"开始时间:"+startTime+ "\n"
+						+"结束时间:"+endTime;
+			}else if(procDefKey.equals("goout")){
+				name = "外出";
+				GoOut out = goOutService.getById(approvalId);
+				out.setAct(act);
+				out.setComment(comment);
+				goOutService.auditSave(out);
+				map = goOutService.getGoOutById(approvalId,type);
+				String gooutDay = map.get("gooutDay").toString();
+				String startTime = map.get("startTime").toString();
+				String endTime = map.get("endTime").toString();
+				remarks =  "开始时间:"+startTime+ "\n"
+						+"结束时间:"+endTime+ "\n"
+						+"外出天数:"+gooutDay;
+			}else if(procDefKey.equals("evection")){
+				name = "出差";
+				OaEvection oaEvection = oaEvectionService.getById(approvalId);
+				oaEvection.setAct(act);
+				oaEvection.setComment(comment);
+				oaEvectionService.auditSave(oaEvection);
+				map = oaEvectionService.getEvectionById(approvalId, type);
+				String address = map.get("address").toString();
+				String startTime = map.get("startTime").toString();
+				String endTime = map.get("endTime").toString();
+				remarks =  "开始时间:"+startTime+ "\n"
+						+"结束时间:"+endTime+ "\n"
+						+"出差地点:"+address;
+			}else if(procDefKey.equals("overtime")){
+				name = "加班";
+				WorkOvertimeForm workOvertimeForm = workOvertimeFormService.getById(approvalId);
+				workOvertimeForm.setAct(act);
+				workOvertimeForm.setComment(comment);
+				workOvertimeFormService.auditSave(workOvertimeForm);
+				map = workOvertimeFormService.getOverTimeById(approvalId, type);
+				String longTime = map.get("longTime").toString();
+				String startTime = map.get("startTime").toString();
+				String endTime = map.get("endTime").toString();
+				remarks =  "开始时间:"+startTime+ "\n"
+						+"结束时间:"+endTime+ "\n"
+						+"加班时长(小时):"+longTime;
+			}else if(procDefKey.equals("sealform")){
+				name = "用印";
+				WorkSealForm workSealForm = workSealFormService.getById(approvalId);
+				workSealForm.setAct(act);
+				workSealForm.setComment(comment);
+				workSealFormService.auditSave(workSealForm);
+				map = workSealFormService.getUseSealById(approvalId, type);
+				remarks = "用印部门:"+ map.get("officeName")+"\n"
+						+"经办人:"+map.get("user")+ "\n"
+						+"日期:"+map.get("applicationDate");
+			}else if(procDefKey.equals("pettyCash")){
+				name = "备用金";
+				WorkPettyCash workPettyCash = workPettyCashService.getById(approvalId);
+				workPettyCash.setAct(act);
+				workPettyCash.setComment(comment);
+				workPettyCashService.auditSave(workPettyCash);
+				map = workPettyCashService.getPettyCashById(approvalId, type);
+				remarks = "备用金申请部门:"+map.get("applicantOfficeName")+ "\n"
+						+"申请人"+map.get("applicantName")+"\n"
+						+"使用日期:"+ map.get("useDateStr")+"\n"
+						+"归还日期:"+ map.get("returnDateStr");
+			}else if(procDefKey.equals("payment")){
+				name = "付款";
+				WorkPayment workPayment = workPaymentService.getById(approvalId);
+				workPayment.setAct(act);
+				workPayment.setComment(comment);
+				workPaymentService.auditSave(workPayment);
+				map = workPaymentService.getPaymentById(approvalId, type);
+				remarks = "付款申请部门:"+map.get("officeName")+ "\n"
+						+"付款事由:"+map.get("reason")+"\n"
+						+"付款金额:"+map.get("amount");
+			}else if(procDefKey.equals("reimbur")){
+				name = "报销";
+				WorkReimbur workReimbur = workReimburService.getById(approvalId);
+				workReimbur.setAct(act);
+				workReimbur.setComment(comment);
+				workReimburService.auditSave(workReimbur);
+				map = workReimburService.getReimburById(approvalId, type);
+				remarks = "报销申请部门:"+map.get("officeName")+ "\n"
+						+"报销总额:"+map.get("totalAmount");
+			}else if(procDefKey.equals("oaPerformance")){
+				name = "绩效自评";
+				OaPerformance oaPerformance = oaPerformanceService.getById(approvalId);
+				oaPerformance.setAct(act);
+				oaPerformance.setComment(comment);
+				oaPerformanceService.auditSave(oaPerformance);
+				map = oaPerformanceService.getBuyById(approvalId, type);
+				remarks = "绩效自评申请部门:"+map.get("officeName")+ "\n"
+						+"绩效自评内容:"+map.get("lastPerformance")+"\n"
+						+"绩效自评时间:"+map.get("createDate");
+			}else if(procDefKey.equals("allApprove")){
+				name = "通用审批";
+				OaAll oaAll = oaAllService.getById(approvalId);
+				oaAll.setAct(act);
+				oaAll.setComment(comment);
+				oaAllService.auditSave(oaAll);
+				map = oaAllService.getLeaveById(approvalId, type);
+				remarks = "通用审批申请部门:"+map.get("officeName")+ "\n"
+						+"通用审批内容:"+map.get("applyContent")+"\n"
+						+"通用审批详情:"+map.get("approveDetail");
+			}
+			else if(procDefKey.equals("oaBuy")){
+				name = "采购";
+				OaBuy oaBuy = oaBuyService.getById(approvalId);
+				oaBuy.setAct(act);
+				oaBuy.setComment(comment);
+				oaBuyService.auditSave(oaBuy);
+				map = oaBuyService.getBuyById(approvalId, type);
+				remarks = "采购申请部门:"+map.get("officeName")+ "\n"
+						+"采购申请原由:"+map.get("applyContent")+"\n"
+						+"采购申请时间:"+map.get("createDate");
+			}
+
+			String status = map.get("status").toString();
+			Pushinfo pushinfo = new Pushinfo();
+			Map extras = new HashMap();
+			if (status.equals("3") || status.equals("4") ){
+				extras.put("id", approvalId);
+				extras.put("procDefKey",procDefKey);
+				aliase = map.get("users").toString();
+				pushinfo.setCurrentUser(UserUtils.getUser());
+				pushinfo.setUserId(UserUtils.getUser().getId());
+				if (status.equals("3")){
+					content = "你的"+name+"申请已通过";
+					extras.put("type", "4003");
+					pushinfo.setType("4003");
+					pushStatus = "审批通过";
+				}else {
+					content = "你的"+name+"申请已驳回";
+					extras.put("type", "4004");
+					pushinfo.setType("4004");
+					pushStatus = "审批驳回";
+				}
+
+			}else if (status.equals("2")){
+				content = map.get("userName").toString()+"的"+name+"申请需要你审批";
+				extras.put("id", approvalId);
+				extras.put("procDefKey",procDefKey);
+				pushinfo.setCurrentUser(UserUtils.getUser());
+				pushinfo.setUserId(UserUtils.getUser().getId());
+				extras.put("type", "4001");
+				pushinfo.setType("4001");
+				pushStatus = "审批中";
+				List<Map> process = (List<Map>)map.get("process");
+				for (Map maps:process){
+					if(maps.get("activityName").equals("待审批")){
+						aliase = maps.get("userId").toString();
+					}
+				}
+			}
+			pushinfo.setPushId(approvalId);
+			pushinfo.setTitle(title);
+			pushinfo.setRemarks(remarks);
+			pushinfo.setContent(content);
+			pushinfo.setPushUserId(aliase);
+			pushinfo.setRemarks(remarks);
+			pushinfo.setStatus(pushStatus);
+			pushinfo.setAddcontent(procDefKey);
+			pushinfo.setParentType("singleApproval");
+			User user = UserUtils.get(aliase);
+			pushinfo.setMobile("ios,android");
+			if (user!=null && user.getCompany()!=null && user.getCompany().getId()!=null){
+				pushinfo.setCompanyId(user.getCompany().getId());
+			}
+			pushinfoService.save(pushinfo);
+			String str = "";
+			if (status.equals("3")){
+				str = "审批信息 申请人:" + user.getName() + name + "申请 已通过!";
+			}else if(status.equals("4")){
+				str = "审批信息 申请人:" + user.getName() + name + "申请 被驳回!";
+			}else {
+				str = "审批信息 申请人:" + user.getName() + name + "申请 待审批!";
+			}
+			UserUtils.pushIm(aliase,str);
+			/*ist<WebSocket> toUserConns = ChatServerPool.getWebSocketByUser(aliase);
+			for (WebSocket toUserConn:toUserConns) {
+
+				String message = "{\"to\":\""+aliase+"\"," +
+						"\"msg\":\""+str+"\"," +
+						"\"useType\":\"sys\"}";
+				ChatServerPool.sendMessageToUser(toUserConn, message);//同时向本人发送消息
+
+			}*/
+			UserUtils.pushMeIm("");
+			/*List<WebSocket> toUserConnList = ChatServerPool.getWebSocketByUser(UserUtils.getUser().getId());
+			for (WebSocket toUserConn:toUserConnList) {
+				String message = "{\"useType\":\"sys_me\"}";
+				ChatServerPool.sendMessageToUser(toUserConn, message);//同时向本人发送消息
+			}*/
+			Pushinfo selectPush = new Pushinfo();
+			selectPush.setPushId(approvalId);
+			selectPush.setPushUserId(UserUtils.getUser().getId());
+			List<Pushinfo> pushinfos = pushinfoService.findList(selectPush);
+			if (pushinfos!=null && pushinfos.size()!=0){
+				Pushinfo push = pushinfos.get(0);
+				push.setStatus(pushStatus);
+				pushinfoService.save(push);
+			}
+			JPushClientUtil.sendNotificationToAlias(title, content, extras, aliase);
+			j.put("data",map);
+			actTaskService.isProcessEnd(procInsId);
+		}catch (ActivitiObjectNotFoundException e){
+			logger.error("ActivitiObjectNotFoundException e:"+e);
+			j.setMsg("流程已审批,不能重新审批!");
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setSuccess(false);
+		}catch (Exception e){
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("流程审核失败");
+			j.setSuccess(false);
+			logger.info("e="+e.getMessage());
+		}
+		return j;
+	}
+
+
+
+}

+ 178 - 0
src/main/java/com/jeeplus/modules/act/service/ActModelService.java

@@ -0,0 +1,178 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.service;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.List;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.activiti.bpmn.converter.BpmnXMLConverter;
+import org.activiti.bpmn.model.BpmnModel;
+import org.activiti.editor.constants.ModelDataJsonConstants;
+import org.activiti.editor.language.json.converter.BpmnJsonConverter;
+import org.activiti.engine.ActivitiException;
+import org.activiti.engine.RepositoryService;
+import org.activiti.engine.repository.Deployment;
+import org.activiti.engine.repository.ModelQuery;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.BaseService;
+
+/**
+ * 流程模型相关Controller
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+@Service
+@Transactional(readOnly = true)
+public class ActModelService extends BaseService {
+
+	@Autowired
+	private RepositoryService repositoryService;
+
+	/**
+	 * 流程模型列表
+	 */
+	public Page<org.activiti.engine.repository.Model> modelList(Page<org.activiti.engine.repository.Model> page, String category) {
+
+		ModelQuery modelQuery = repositoryService.createModelQuery().latestVersion().orderByLastUpdateTime().desc();
+		
+		if (StringUtils.isNotEmpty(category)){
+			modelQuery.modelCategory(category);
+		}
+		
+		page.setCount(modelQuery.count());
+		page.setList(modelQuery.listPage(page.getFirstResult(), page.getMaxResults()));
+
+		return page;
+	}
+
+	/**
+	 * 创建模型
+	 * @throws UnsupportedEncodingException 
+	 */
+	@Transactional(readOnly = false)
+	public org.activiti.engine.repository.Model create(String name, String key, String description, String category) throws UnsupportedEncodingException {
+		ObjectMapper objectMapper = new ObjectMapper();
+		ObjectNode editorNode = objectMapper.createObjectNode();
+		editorNode.put("id", "canvas");
+		editorNode.put("resourceId", "canvas");
+		ObjectNode stencilSetNode = objectMapper.createObjectNode();
+		stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
+		editorNode.put("stencilset", stencilSetNode);
+		org.activiti.engine.repository.Model modelData = repositoryService.newModel();
+
+		description = StringUtils.defaultString(description);
+		modelData.setKey(StringUtils.defaultString(key));
+		modelData.setName(name);
+		modelData.setCategory(category);
+		modelData.setVersion(Integer.parseInt(String.valueOf(repositoryService.createModelQuery().modelKey(modelData.getKey()).count()+1)));
+
+		ObjectNode modelObjectNode = objectMapper.createObjectNode();
+		modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, name);
+		modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, modelData.getVersion());
+		modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, description);
+		modelData.setMetaInfo(modelObjectNode.toString());
+			
+		repositoryService.saveModel(modelData);
+		repositoryService.addModelEditorSource(modelData.getId(), editorNode.toString().getBytes("utf-8"));
+		
+		return modelData;
+	}
+
+	/**
+	 * 根据Model部署流程
+	 */
+	@Transactional(readOnly = false)
+	public String deploy(String id) {
+		String message = "";
+		try {
+			org.activiti.engine.repository.Model modelData = repositoryService.getModel(id);
+			BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
+			ObjectNode editorNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
+			BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
+			BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
+			byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
+			
+			String processName = modelData.getName();
+			if (!StringUtils.endsWith(processName, ".bpmn20.xml")){
+				processName += ".bpmn20.xml";
+			}
+//			System.out.println("========="+processName+"============"+modelData.getName());
+			ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
+			Deployment deployment = repositoryService.createDeployment().name(modelData.getName())
+					.addInputStream(processName, in).deploy();
+//					.addString(processName, new String(bpmnBytes)).deploy();
+			
+			// 设置流程分类
+			List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
+			for (ProcessDefinition processDefinition : list) {
+				repositoryService.setProcessDefinitionCategory(processDefinition.getId(), modelData.getCategory());
+				message = "部署成功,流程ID=" + processDefinition.getId();
+			}
+			if (list.size() == 0){
+				message = "部署失败,没有流程。";
+			}
+		} catch (Exception e) {
+			throw new ActivitiException("设计模型图不正确,检查模型正确性,模型ID="+id, e);
+		}
+		return message;
+	}
+	
+	/**
+	 * 导出model的xml文件
+	 * @throws IOException 
+	 * @throws JsonProcessingException 
+	 */
+	public void export(String id, HttpServletResponse response) {
+		try {
+			org.activiti.engine.repository.Model modelData = repositoryService.getModel(id);
+			BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
+			ObjectNode editorNode = (ObjectNode)new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
+			BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
+			BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
+			byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
+
+			ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
+			IOUtils.copy(in, response.getOutputStream());
+			String filename = bpmnModel.getMainProcess().getId() + ".bpmn20.xml";
+			response.setHeader("Content-Disposition", "attachment; filename=" + filename);
+			response.flushBuffer();
+		} catch (Exception e) {
+			throw new ActivitiException("导出model的xml文件失败,模型ID="+id, e);
+		}
+		
+	}
+
+	/**
+	 * 更新Model分类
+	 */
+	@Transactional(readOnly = false)
+	public void updateCategory(String id, String category) {
+		org.activiti.engine.repository.Model modelData = repositoryService.getModel(id);
+		modelData.setCategory(category);
+		repositoryService.saveModel(modelData);
+	}
+	
+	/**
+	 * 删除模型
+	 * @param id
+	 * @return
+	 */
+	@Transactional(readOnly = false)
+	public void delete(String id) {
+		repositoryService.deleteModel(id);
+	}
+}

+ 335 - 0
src/main/java/com/jeeplus/modules/act/service/ActProcessService.java

@@ -0,0 +1,335 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.service;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipInputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.activiti.bpmn.converter.BpmnXMLConverter;
+import org.activiti.bpmn.model.BpmnModel;
+import org.activiti.editor.constants.ModelDataJsonConstants;
+import org.activiti.editor.language.json.converter.BpmnJsonConverter;
+import org.activiti.engine.ActivitiException;
+import org.activiti.engine.HistoryService;
+import org.activiti.engine.RepositoryService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.history.HistoricProcessInstanceQuery;
+import org.activiti.engine.repository.Deployment;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.repository.ProcessDefinitionQuery;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.runtime.ProcessInstanceQuery;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.BaseService;
+import com.jeeplus.common.utils.StringUtils;
+
+/**
+ * 流程定义相关Controller
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+@Service
+@Transactional(readOnly = true)
+public class ActProcessService extends BaseService {
+
+	@Autowired
+	private RepositoryService repositoryService;
+	@Autowired
+	private RuntimeService runtimeService;	
+	@Autowired
+	private HistoryService historyService;
+
+	/**
+	 * 流程定义列表
+	 */
+	public Page<Object[]> processList(Page<Object[]> page, String category) {
+
+	    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
+	    		.latestVersion().orderByProcessDefinitionKey().asc();
+	    
+	    if (StringUtils.isNotEmpty(category)){
+	    	processDefinitionQuery.processDefinitionCategory(category);
+		}
+	    
+	    page.setCount(processDefinitionQuery.count());
+	    
+	    List<ProcessDefinition> processDefinitionList = processDefinitionQuery.listPage(page.getFirstResult(), page.getMaxResults());
+	    for (ProcessDefinition processDefinition : processDefinitionList) {
+	      String deploymentId = processDefinition.getDeploymentId();
+	      Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
+	      page.getList().add(new Object[]{processDefinition, deployment});
+	    }
+
+		return page;
+	}
+
+	/**
+	 * 运行中的流程
+	 */
+	public Page<ProcessInstance> runningList(Page<ProcessInstance> page, String procInsId, String procDefKey) {
+
+	    ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
+
+	    if (StringUtils.isNotBlank(procInsId)){
+		    processInstanceQuery.processInstanceId(procInsId);
+	    }
+	    
+	    if (StringUtils.isNotBlank(procDefKey)){
+		    processInstanceQuery.processDefinitionKey(procDefKey);
+	    }
+	    
+	    page.setCount(processInstanceQuery.count());
+	    page.setList(processInstanceQuery.listPage(page.getFirstResult(), page.getMaxResults()));
+		return page;
+	}
+	
+
+	/**
+	 * 已结束的流程
+	 */
+	public Page<HistoricProcessInstance> historyList(Page<HistoricProcessInstance> page, String procInsId, String procDefKey) {
+
+		HistoricProcessInstanceQuery query=historyService.createHistoricProcessInstanceQuery().finished()
+		.orderByProcessInstanceEndTime().desc();
+
+	    if (StringUtils.isNotBlank(procInsId)){
+	    	query.processInstanceId(procInsId);
+	    }
+	    
+	    if (StringUtils.isNotBlank(procDefKey)){
+	    	query.processDefinitionKey(procDefKey);
+	    }
+	    
+	    page.setCount(query.count());
+	    page.setList(query.listPage(page.getFirstResult(), page.getMaxResults()));
+		return page;
+	}
+	
+	/**
+	 * 读取资源,通过部署ID
+	 * @param processDefinitionId  流程定义ID
+	 * @param processInstanceId 流程实例ID
+	 * @param resourceType 资源类型(xml|image)
+	 */
+	public InputStream resourceRead(String procDefId, String proInsId, String resType) throws Exception {
+		
+		if (StringUtils.isBlank(procDefId)){
+			ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(proInsId).singleResult();
+			procDefId = processInstance.getProcessDefinitionId();
+		}
+		ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId).singleResult();
+		
+		String resourceName = "";
+		if (resType.equals("image")) {
+			resourceName = processDefinition.getDiagramResourceName();
+		} else if (resType.equals("xml")) {
+			resourceName = processDefinition.getResourceName();
+		}
+		
+		InputStream resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), resourceName);
+		return resourceAsStream;
+	}
+	
+	/**
+	 * 部署流程 - 保存
+	 * @param file
+	 * @return
+	 */
+	@Transactional(readOnly = false)
+	public String deploy(String exportDir, String category, MultipartFile file) {
+
+		String message = "";
+		
+		String fileName = file.getOriginalFilename();
+		
+		try {
+			InputStream fileInputStream = file.getInputStream();
+			Deployment deployment = null;
+			String extension = FilenameUtils.getExtension(fileName);
+			if (extension.equals("zip") || extension.equals("bar")) {
+				ZipInputStream zip = new ZipInputStream(fileInputStream);
+				deployment = repositoryService.createDeployment().addZipInputStream(zip).deploy();
+			} else if (extension.equals("png")) {
+				deployment = repositoryService.createDeployment().addInputStream(fileName, fileInputStream).deploy();
+			} else if (fileName.indexOf("bpmn20.xml") != -1) {
+				deployment = repositoryService.createDeployment().addInputStream(fileName, fileInputStream).deploy();
+			} else if (extension.equals("bpmn")) { // bpmn扩展名特殊处理,转换为bpmn20.xml
+				String baseName = FilenameUtils.getBaseName(fileName); 
+				deployment = repositoryService.createDeployment().addInputStream(baseName + ".bpmn20.xml", fileInputStream).deploy();
+			} else {
+				message = "不支持的文件类型:" + extension;
+			}
+			
+			List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
+
+			// 设置流程分类
+			for (ProcessDefinition processDefinition : list) {
+//					ActUtils.exportDiagramToFile(repositoryService, processDefinition, exportDir);
+				repositoryService.setProcessDefinitionCategory(processDefinition.getId(), category);
+				message += "部署成功,流程ID=" + processDefinition.getId() + "<br/>";
+			}
+			
+			if (list.size() == 0){
+				message = "部署失败,没有流程。";
+			}
+			
+		} catch (Exception e) {
+			throw new ActivitiException("部署失败!", e);
+		}
+		return message;
+	}
+	
+	/**
+	 * 设置流程分类
+	 */
+	@Transactional(readOnly = false)
+	public void updateCategory(String procDefId, String category) {
+		repositoryService.setProcessDefinitionCategory(procDefId, category);
+	}
+
+	/**
+	 * 挂起、激活流程实例
+	 */
+	@Transactional(readOnly = false)
+	public String updateState(String state, String procDefId) {
+		if (state.equals("active")) {
+			repositoryService.activateProcessDefinitionById(procDefId, true, null);
+			return "已激活ID为[" + procDefId + "]的流程定义。";
+		} else if (state.equals("suspend")) {
+			repositoryService.suspendProcessDefinitionById(procDefId, true, null);
+			return "已挂起ID为[" + procDefId + "]的流程定义。";
+		}
+		return "无操作";
+	}
+	
+	/**
+	 * 将部署的流程转换为模型
+	 * @param procDefId
+	 * @throws UnsupportedEncodingException
+	 * @throws XMLStreamException
+	 */
+	@Transactional(readOnly = false)
+	public org.activiti.engine.repository.Model convertToModel(String procDefId) throws UnsupportedEncodingException, XMLStreamException {
+		
+		ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId).singleResult();
+		InputStream bpmnStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(),
+		processDefinition.getResourceName());
+		XMLInputFactory xif = XMLInputFactory.newInstance();
+		InputStreamReader in = new InputStreamReader(bpmnStream, "UTF-8");
+		XMLStreamReader xtr = xif.createXMLStreamReader(in);
+		BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
+	
+		BpmnJsonConverter converter = new BpmnJsonConverter();
+		ObjectNode modelNode = converter.convertToJson(bpmnModel);
+		org.activiti.engine.repository.Model modelData = repositoryService.newModel();
+		modelData.setKey(processDefinition.getKey());
+		modelData.setName(processDefinition.getResourceName());
+		modelData.setCategory(processDefinition.getCategory());//.getDeploymentId());
+		modelData.setDeploymentId(processDefinition.getDeploymentId());
+		modelData.setVersion(Integer.parseInt(String.valueOf(repositoryService.createModelQuery().modelKey(modelData.getKey()).count()+1)));
+	
+		ObjectNode modelObjectNode = new ObjectMapper().createObjectNode();
+		modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, processDefinition.getName());
+		modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, modelData.getVersion());
+		modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, processDefinition.getDescription());
+		modelData.setMetaInfo(modelObjectNode.toString());
+	
+		repositoryService.saveModel(modelData);
+	
+		repositoryService.addModelEditorSource(modelData.getId(), modelNode.toString().getBytes("utf-8"));
+	
+		return modelData;
+	}
+	
+	/**
+	 * 导出图片文件到硬盘
+	 */
+	public List<String> exportDiagrams(String exportDir) throws IOException {
+		List<String> files = new ArrayList<String>();
+		List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().list();
+		
+		for (ProcessDefinition processDefinition : list) {
+			String diagramResourceName = processDefinition.getDiagramResourceName();
+			String key = processDefinition.getKey();
+			int version = processDefinition.getVersion();
+			String diagramPath = "";
+
+			InputStream resourceAsStream = repositoryService.getResourceAsStream(
+					processDefinition.getDeploymentId(), diagramResourceName);
+			byte[] b = new byte[resourceAsStream.available()];
+
+			@SuppressWarnings("unused")
+			int len = -1;
+			resourceAsStream.read(b, 0, b.length);
+
+			// create file if not exist
+			String diagramDir = exportDir + "/" + key + "/" + version;
+			File diagramDirFile = new File(diagramDir);
+			if (!diagramDirFile.exists()) {
+				diagramDirFile.mkdirs();
+			}
+			diagramPath = diagramDir + "/" + diagramResourceName;
+			File file = new File(diagramPath);
+
+			// 文件存在退出
+			if (file.exists()) {
+				// 文件大小相同时直接返回否则重新创建文件(可能损坏)
+				logger.debug("diagram exist, ignore... : {}", diagramPath);
+				
+				files.add(diagramPath);
+			} else {
+				file.createNewFile();
+				logger.debug("export diagram to : {}", diagramPath);
+
+				// wirte bytes to file
+				FileUtils.writeByteArrayToFile(file, b, true);
+				
+				files.add(diagramPath);
+			}
+			
+		}
+		
+		return files;
+	}
+
+	/**
+	 * 删除部署的流程,级联删除流程实例
+	 * @param deploymentId 流程部署ID
+	 */
+	@Transactional(readOnly = false)
+	public void deleteDeployment(String deploymentId) {
+		repositoryService.deleteDeployment(deploymentId, true);
+	}
+	
+	/**
+	 * 删除部署的流程实例
+	 * @param procInsId 流程实例ID
+	 * @param deleteReason 删除原因,可为空
+	 */
+	@Transactional(readOnly = false)
+	public void deleteProcIns(String procInsId, String deleteReason) {
+		runtimeService.deleteProcessInstance(procInsId, deleteReason);
+	}
+	
+}

Fichier diff supprimé car celui-ci est trop grand
+ 1112 - 0
src/main/java/com/jeeplus/modules/act/service/ActTaskService.java


+ 245 - 0
src/main/java/com/jeeplus/modules/act/service/ActivityXmlService.java

@@ -0,0 +1,245 @@
+package com.jeeplus.modules.act.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.service.BaseService;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import org.activiti.bpmn.BpmnAutoLayout;
+import org.activiti.bpmn.model.BpmnModel;
+import org.activiti.bpmn.model.EndEvent;
+import org.activiti.bpmn.model.ExclusiveGateway;
+import org.activiti.bpmn.model.Process;
+import org.activiti.bpmn.model.SequenceFlow;
+import org.activiti.bpmn.model.StartEvent;
+import org.activiti.bpmn.model.UserTask;
+import org.activiti.engine.*;
+import org.activiti.engine.repository.Deployment;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.apache.commons.lang.StringUtils;
+import org.junit.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ *
+ */
+
+/**
+ * @ClassName: ActivitiTest01
+ * @Description: TODO(activiti 工作流程图自动生成)
+ * @author liang
+ * @date 2016年4月20日 上午8:32:56
+ *
+ */
+@Service
+@Transactional(readOnly = true)
+public class ActivityXmlService extends BaseService {
+    @Autowired
+    private RepositoryService repositoryService;
+    @Autowired
+    private RuntimeService runtimeService;
+    @Autowired
+    private TaskService taskService;
+
+    public static void main(String[] args) {
+       /* try {
+            ActivityService.test01();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }*/
+    }
+
+    @Transactional(readOnly = false)
+    public void createActivityXml(String PROCESSID,String PROCESSNAME,List<Activity> list) {
+        logger.info(".........start...");
+        // 1. Build up the model from scratch
+        BpmnModel model = new BpmnModel();
+        Process process=new Process();
+        model.addProcess(process);
+        process.setId(PROCESSID);
+        process.setName(PROCESSNAME);
+        process.addFlowElement(createStartEvent());
+        for (int i = 0;i<list.size();i++){
+            Activity activity=list.get(i);
+            List<String> candidateGroupList=new ArrayList<String>();
+            if(activity.getRole().getEnname().contains("dsz") || activity.getRole().getEnname().contains("zjl") ){
+                Role role = UserUtils.getSelectRole().get(0);
+                String buffer = DateUtils.getByEnnme(role.getEnname()).toString();
+                candidateGroupList.add(buffer+"dsz");
+                candidateGroupList.add(buffer+"zjl");
+            }
+            String user = "";
+            /*String role = "";
+            if (activity.getUser()!=null && StringUtils.isNotBlank(activity.getUser().getId())){
+                user = "${user"+(i+1)+"}";
+            }
+            if (activity.getRole()!=null && StringUtils.isNotBlank(activity.getRole().getEnname())){
+                role = "${role"+(i+1)+"}";
+            }*/
+            process.addFlowElement(createUserTask("task"+(i+1), activity.getName(), activity.getRole().getEnname(),  activity.getUser().getId(),candidateGroupList,new ArrayList<String>()));
+            process.addFlowElement(createExclusiveGateway("createExclusiveGateway"+(i+1)));
+            if (StringUtils.isNotBlank(activity.getReturnBack()) && !activity.getReturnBack().equals("0")){
+                process.addFlowElement(createUserTask("audit"+(i+1), "重新申请", "", "${applyUserId}",new ArrayList<String>(),new ArrayList<String>()));
+                process.addFlowElement(createExclusiveGateway("createExclusiveGatewayAudit"+(i+1)));
+            }
+        }
+
+
+        process.addFlowElement(createEndEvent());
+        process.addFlowElement(createSequenceFlow("startEvent", "task1", "", ""));
+        /*process.addFlowElement(createSequenceFlow("task1", "createExclusiveGateway1", "", ""));
+        process.addFlowElement(createSequenceFlow("createExclusiveGateway1", "endEvent", "不通过", "${pass=='2'}"));
+        process.addFlowElement(createSequenceFlow("createExclusiveGateway1", "task2", "通过", "${pass=='1'}"));
+
+        process.addFlowElement(createSequenceFlow("task2", "createExclusiveGateway2", "", ""));
+        process.addFlowElement(createSequenceFlow("createExclusiveGateway2", "task1", "不通过", "${pass=='2'}"));
+        process.addFlowElement(createSequenceFlow("createExclusiveGateway2", "task3", "通过", "${pass=='1'}"));
+        process.addFlowElement(createSequenceFlow("task3", "createExclusiveGateway3", "", ""));
+        process.addFlowElement(createSequenceFlow("createExclusiveGateway3", "task2", "不通过", "${pass=='2'}"));
+        process.addFlowElement(createSequenceFlow("createExclusiveGateway3", "endEvent", "通过", "${pass=='1'}"));
+        */
+        for (int i = 0; i < list.size(); i++) {
+            Activity activity = list.get(i);
+            process.addFlowElement(createSequenceFlow("task"+(i+1), "createExclusiveGateway"+(i+1), "", ""));
+            if (i == list.size()-1){
+                process.addFlowElement(createSequenceFlow("createExclusiveGateway"+(i+1), "endEvent", "通过", "${pass}"));
+                if (activity.getReturnBack().equals("1")){
+                    process.addFlowElement(createSequenceFlow("createExclusiveGateway"+(i+1), "audit"+(i+1), "不通过", "${!pass}"));
+                    process.addFlowElement(createSequenceFlow("audit"+(i+1), "createExclusiveGatewayAudit"+(i+1), "", ""));
+                    if (i > 1){
+                        process.addFlowElement(createSequenceFlow("createExclusiveGatewayAudit"+(i+1), "task"+i, "重新发起发起", "${pass}"));
+                    }else {
+                        process.addFlowElement(createSequenceFlow("createExclusiveGatewayAudit"+(i+1), "task"+1, "重新发起发起", "${pass}"));
+                    }
+                    process.addFlowElement(createSequenceFlow("createExclusiveGatewayAudit"+(i+1), "endEvent", "撤销", "${!pass}"));
+                }else if (activity.getReturnBack().equals("2")){
+                    process.addFlowElement(createSequenceFlow("createExclusiveGateway"+(i+1), "audit"+(i+1), "不通过", "${!pass}"));
+                    process.addFlowElement(createSequenceFlow("audit"+(i+1), "createExclusiveGatewayAudit"+(i+1), "", ""));
+                    process.addFlowElement(createSequenceFlow("createExclusiveGatewayAudit"+(i+1), "task"+1, "重新发起发起", "${pass}"));
+                    process.addFlowElement(createSequenceFlow("createExclusiveGatewayAudit"+(i+1), "endEvent", "撤销", "${!pass}"));
+                }else {
+                    process.addFlowElement(createSequenceFlow("createExclusiveGateway"+(i+1), "endEvent", "不通过", "${!pass}"));
+                }
+            }else {
+                process.addFlowElement(createSequenceFlow("createExclusiveGateway"+(i+1), "task"+(i+2), "通过", "${pass}"));
+                if (activity.getReturnBack().equals("1")){
+                    process.addFlowElement(createSequenceFlow("createExclusiveGateway"+(i+1), "audit"+(i+1), "不通过", "${!pass}"));
+                    process.addFlowElement(createSequenceFlow("audit"+(i+1), "createExclusiveGatewayAudit"+(i+1), "", ""));
+                    if (i > 1){
+                        process.addFlowElement(createSequenceFlow("createExclusiveGatewayAudit"+(i+1), "task"+i, "重新发起发起", "${pass}"));
+                    }else {
+                        process.addFlowElement(createSequenceFlow("createExclusiveGatewayAudit"+(i+1), "task"+1, "重新发起发起", "${pass}"));
+                    }
+                    process.addFlowElement(createSequenceFlow("createExclusiveGatewayAudit"+(i+1), "endEvent", "撤销", "${!pass}"));
+                }else if (activity.getReturnBack().equals("2")){
+                    process.addFlowElement(createSequenceFlow("createExclusiveGateway"+(i+1), "audit"+(i+1), "不通过", "${!pass}"));
+                    process.addFlowElement(createSequenceFlow("audit"+(i+1), "createExclusiveGatewayAudit"+(i+1), "", ""));
+                    process.addFlowElement(createSequenceFlow("createExclusiveGatewayAudit"+(i+1), "task"+1, "重新发起发起", "${pass}"));
+                    process.addFlowElement(createSequenceFlow("createExclusiveGatewayAudit"+(i+1), "endEvent", "撤销", "${!pass}"));
+                }else {
+                    process.addFlowElement(createSequenceFlow("createExclusiveGateway"+(i+1), "endEvent", "不通过", "${!pass}"));
+                }
+            }
+        }
+
+       // 2. Generate graphical information
+        new BpmnAutoLayout(model).execute();
+
+        // 3. Deploy the process to the engine
+        Deployment deployment = repositoryService.createDeployment().addBpmnModel(PROCESSID+".bpmn", model).name(PROCESSID+"_deployment").deploy();
+
+        // 4. Start a process instance
+        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESSID);
+
+        // 5. Check if task is available
+        List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
+        Assert.assertEquals(1, tasks.size());
+
+        // 6. Save process diagram to a file
+        // InputStream processDiagram = repositoryService.getProcessDiagram(processInstance.getProcessDefinitionId());
+        // FileUtils.copyInputStreamToFile(processDiagram, new File("/deployments/"+PROCESSID+".png"));
+
+        // 7. Save resulting BPMN xml to a file
+        //  InputStream processBpmn = repositoryService.getResourceAsStream(deployment.getId(), PROCESSID+".bpmn");
+        // FileUtils.copyInputStreamToFile(processBpmn,new File("/deployments/"+PROCESSID+".bpmn"));
+        logger.info(".........end...");
+    }
+
+    protected static ProcessEngine getProcessEngine(){
+        ProcessEngine processEngine=ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration()
+                .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
+                .setJdbcUrl(Global.getJdbcUrl())
+                .setJdbcDriver(Global.getJdbcDriver())
+                .setJdbcUsername(Global.getJdbcUserName())
+                .setJdbcPassword(Global.getJdbcPassword())
+                .setDatabaseSchemaUpdate("true")
+                .setJobExecutorActivate(false)
+                .buildProcessEngine();
+        return processEngine;
+
+    }
+
+    /*任务节点*/
+    protected static UserTask createUserTask(String id, String name, String candidateGroup,String assignee,List<String> candidateGroupList,List<String> users) {
+        List<String> candidateGroups=new ArrayList<String>();
+        if (candidateGroupList!=null && candidateGroupList.size()!=0){
+            candidateGroups = candidateGroupList;
+        }else {
+            candidateGroups.add(candidateGroup);
+        }
+        UserTask userTask = new UserTask();
+        userTask.setName(name);
+        userTask.setId(id);
+        userTask.setCandidateGroups(candidateGroups);
+        if (users!=null && users.size()!=0){
+            userTask.setCandidateUsers(users);
+        }else {
+            userTask.setAssignee(assignee);
+        }
+        return userTask;
+    }
+
+    /*连线*/
+    protected static SequenceFlow createSequenceFlow(String from, String to,String name,String conditionExpression) {
+        SequenceFlow flow = new SequenceFlow();
+        flow.setSourceRef(from);
+        flow.setTargetRef(to);
+        flow.setName(name);
+        if(StringUtils.isNotEmpty(conditionExpression)){
+            flow.setConditionExpression(conditionExpression);
+        }
+        return flow;
+    }
+
+    /*排他网关*/
+    protected static ExclusiveGateway createExclusiveGateway(String id) {
+        ExclusiveGateway exclusiveGateway = new ExclusiveGateway();
+        exclusiveGateway.setId(id);
+        return exclusiveGateway;
+    }
+
+    /*开始节点*/
+    protected static StartEvent createStartEvent() {
+        StartEvent startEvent = new StartEvent();
+        startEvent.setId("startEvent");
+        startEvent.setInitiator("applyUserId");
+        startEvent.setName("开始");
+        return startEvent;
+    }
+
+    /*结束节点*/
+    protected static EndEvent createEndEvent() {
+        EndEvent endEvent = new EndEvent();
+        endEvent.setId("endEvent");
+        endEvent.setName("结束");
+        return endEvent;
+    }
+
+}

+ 107 - 0
src/main/java/com/jeeplus/modules/act/service/ext/ActGroupEntityService.java

@@ -0,0 +1,107 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.service.ext;
+
+import java.util.List;
+import java.util.Map;
+
+import com.jeeplus.modules.sys.entity.SysRoleActivity;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import org.activiti.engine.identity.Group;
+import org.activiti.engine.identity.GroupQuery;
+import org.activiti.engine.impl.GroupQueryImpl;
+import org.activiti.engine.impl.Page;
+import org.activiti.engine.impl.persistence.entity.GroupEntity;
+import org.activiti.engine.impl.persistence.entity.GroupEntityManager;
+import org.springframework.stereotype.Service;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.SpringContextHolder;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.SystemService;
+
+/**
+ * Activiti Group Entity Service
+ * @author jeeplus
+ * @version 2013-12-05
+ */
+@Service
+public class ActGroupEntityService extends GroupEntityManager {
+
+	private SystemService systemService;
+
+	public SystemService getSystemService() {
+		if (systemService == null){
+			systemService = SpringContextHolder.getBean(SystemService.class);
+		}
+		return systemService;
+	}
+	
+	public Group createNewGroup(String groupId) {
+		return new GroupEntity(groupId);
+	}
+
+	public void insertGroup(Group group) {
+//		getDbSqlSession().insert((PersistentObject) group);
+		throw new RuntimeException("not implement method.");
+	}
+
+	public void updateGroup(GroupEntity updatedGroup) {
+//		CommandContext commandContext = Context.getCommandContext();
+//		DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
+//		dbSqlSession.update(updatedGroup);
+		throw new RuntimeException("not implement method.");
+	}
+
+	public void deleteGroup(String groupId) {
+//		GroupEntity group = getDbSqlSession().selectById(GroupEntity.class, groupId);
+//		getDbSqlSession().delete("deleteMembershipsByGroupId", groupId);
+//		getDbSqlSession().delete(group);
+		throw new RuntimeException("not implement method.");
+	}
+
+	public GroupQuery createNewGroupQuery() {
+//		return new GroupQueryImpl(Context.getProcessEngineConfiguration().getCommandExecutorTxRequired());
+		throw new RuntimeException("not implement method.");
+	}
+
+//	@SuppressWarnings("unchecked")
+	public List<Group> findGroupByQueryCriteria(GroupQueryImpl query, Page page) {
+//		return getDbSqlSession().selectList("selectGroupByQueryCriteria", query, page);
+		throw new RuntimeException("not implement method.");
+	}
+
+	public long findGroupCountByQueryCriteria(GroupQueryImpl query) {
+//		return (Long) getDbSqlSession().selectOne("selectGroupCountByQueryCriteria", query);
+		throw new RuntimeException("not implement method.");
+	}
+
+	public List<Group> findGroupsByUser(String userId) {
+//		return getDbSqlSession().selectList("selectGroupsByUserId", userId);
+		List<Group> list = Lists.newArrayList();
+		User user = getSystemService().getUser(userId);
+		if (user != null && user.getRoleList() != null){
+			for (Role role : user.getRoleList()){
+				List<SysRoleActivity> sysRoleActivities = UserUtils.getByRole(role);
+				for (SysRoleActivity sysRoleActivity : sysRoleActivities){
+					list.add(ActUtils.toActivitiGroup(sysRoleActivity));
+				}
+			}
+		}
+		return list;
+	}
+
+	public List<Group> findGroupsByNativeQuery(Map<String, Object> parameterMap, int firstResult, int maxResults) {
+//		return getDbSqlSession().selectListWithRawParameter("selectGroupByNativeQuery", parameterMap, firstResult, maxResults);
+		throw new RuntimeException("not implement method.");
+	}
+
+	public long findGroupCountByNativeQuery(Map<String, Object> parameterMap) {
+//		return (Long) getDbSqlSession().selectOne("selectGroupCountByNativeQuery", parameterMap);
+		throw new RuntimeException("not implement method.");
+	}
+
+}

+ 31 - 0
src/main/java/com/jeeplus/modules/act/service/ext/ActGroupEntityServiceFactory.java

@@ -0,0 +1,31 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.service.ext;
+
+import org.activiti.engine.impl.interceptor.Session;
+import org.activiti.engine.impl.interceptor.SessionFactory;
+import org.activiti.engine.impl.persistence.entity.GroupIdentityManager;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * Activiti Group Entity Factory
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+public class ActGroupEntityServiceFactory implements SessionFactory {
+	
+	@Autowired
+	private ActGroupEntityService actGroupEntityService;
+	
+	public Class<?> getSessionType() {
+		// 返回原始的GroupIdentityManager类型
+		return GroupIdentityManager.class;
+	}
+
+	public Session openSession() {
+		// 返回自定义的GroupEntityManager实例
+		return actGroupEntityService;
+	}
+
+}

+ 151 - 0
src/main/java/com/jeeplus/modules/act/service/ext/ActUserEntityService.java

@@ -0,0 +1,151 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.service.ext;
+
+import java.util.List;
+import java.util.Map;
+
+import com.jeeplus.modules.sys.entity.SysRoleActivity;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import org.activiti.engine.identity.Group;
+import org.activiti.engine.identity.User;
+import org.activiti.engine.identity.UserQuery;
+import org.activiti.engine.impl.Page;
+import org.activiti.engine.impl.UserQueryImpl;
+import org.activiti.engine.impl.persistence.entity.IdentityInfoEntity;
+import org.activiti.engine.impl.persistence.entity.UserEntity;
+import org.activiti.engine.impl.persistence.entity.UserEntityManager;
+import org.springframework.stereotype.Service;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.SpringContextHolder;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.service.SystemService;
+
+/**
+ * Activiti User Entity Service
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+@Service
+public class ActUserEntityService extends UserEntityManager {
+
+	private SystemService systemService;
+
+	public SystemService getSystemService() {
+		if (systemService == null){
+			systemService = SpringContextHolder.getBean(SystemService.class);
+		}
+		return systemService;
+	}
+
+	public User createNewUser(String userId) {
+		return new UserEntity(userId);
+	}
+
+	public void insertUser(User user) {
+//		getDbSqlSession().insert((PersistentObject) user);
+		throw new RuntimeException("not implement method.");
+	}
+
+	public void updateUser(UserEntity updatedUser) {
+//		CommandContext commandContext = Context.getCommandContext();
+//		DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
+//		dbSqlSession.update(updatedUser);
+		throw new RuntimeException("not implement method.");
+	}
+
+	public UserEntity findUserById(String userId) {
+//		return (UserEntity) getDbSqlSession().selectOne("selectUserById", userId);
+		return ActUtils.toActivitiUser(getSystemService().getUser(userId));
+	}
+
+	public void deleteUser(String userId) {
+//		UserEntity user = findUserById(userId);
+//		if (user != null) {
+//			List<IdentityInfoEntity> identityInfos = getDbSqlSession().selectList("selectIdentityInfoByUserId", userId);
+//			for (IdentityInfoEntity identityInfo : identityInfos) {
+//				getIdentityInfoManager().deleteIdentityInfo(identityInfo);
+//			}
+//			getDbSqlSession().delete("deleteMembershipsByUserId", userId);
+//			user.delete();
+//		}
+		User user = findUserById(userId);
+		if (user != null) {
+			getSystemService().deleteUser(new com.jeeplus.modules.sys.entity.User(user.getId()));
+		}
+	}
+
+	public List<User> findUserByQueryCriteria(UserQueryImpl query, Page page) {
+//		return getDbSqlSession().selectList("selectUserByQueryCriteria", query, page);
+		throw new RuntimeException("not implement method.");
+	}
+
+	public long findUserCountByQueryCriteria(UserQueryImpl query) {
+//		return (Long) getDbSqlSession().selectOne("selectUserCountByQueryCriteria", query);
+		throw new RuntimeException("not implement method.");
+	}
+
+	public List<Group> findGroupsByUser(String userId) {
+//		return getDbSqlSession().selectList("selectGroupsByUserId", userId);
+		List<Group> list = Lists.newArrayList();
+		for (Role role : getSystemService().findRole(new Role(new com.jeeplus.modules.sys.entity.User(userId,null)))){
+			List<SysRoleActivity> sysRoleActivities = UserUtils.getByRole(role);
+			for (SysRoleActivity sysRoleActivity : sysRoleActivities){
+				list.add(ActUtils.toActivitiGroup(sysRoleActivity));
+			}
+		}
+		return list;
+	}
+
+	public UserQuery createNewUserQuery() {
+//		return new UserQueryImpl(Context.getProcessEngineConfiguration().getCommandExecutorTxRequired());
+		throw new RuntimeException("not implement method.");
+	}
+
+	public IdentityInfoEntity findUserInfoByUserIdAndKey(String userId, String key) {
+//		Map<String, String> parameters = new HashMap<String, String>();
+//		parameters.put("userId", userId);
+//		parameters.put("key", key);
+//		return (IdentityInfoEntity) getDbSqlSession().selectOne("selectIdentityInfoByUserIdAndKey", parameters);
+		throw new RuntimeException("not implement method.");
+	}
+
+	public List<String> findUserInfoKeysByUserIdAndType(String userId, String type) {
+//		Map<String, String> parameters = new HashMap<String, String>();
+//		parameters.put("userId", userId);
+//		parameters.put("type", type);
+//		return (List) getDbSqlSession().getSqlSession().selectList("selectIdentityInfoKeysByUserIdAndType", parameters);
+		throw new RuntimeException("not implement method.");
+	}
+
+	public Boolean checkPassword(String userId, String password) {
+//		User user = findUserById(userId);
+//		if ((user != null) && (password != null) && (password.equals(user.getPassword()))) {
+//			return true;
+//		}
+//		return false;
+		throw new RuntimeException("not implement method.");
+	}
+
+	public List<User> findPotentialStarterUsers(String proceDefId) {
+//		Map<String, String> parameters = new HashMap<String, String>();
+//		parameters.put("procDefId", proceDefId);
+//		return (List<User>) getDbSqlSession().selectOne("selectUserByQueryCriteria", parameters);
+		throw new RuntimeException("not implement method.");
+
+	}
+
+	public List<User> findUsersByNativeQuery(Map<String, Object> parameterMap, int firstResult, int maxResults) {
+//		return getDbSqlSession().selectListWithRawParameter("selectUserByNativeQuery", parameterMap, firstResult, maxResults);
+		throw new RuntimeException("not implement method.");
+	}
+
+	public long findUserCountByNativeQuery(Map<String, Object> parameterMap) {
+//		return (Long) getDbSqlSession().selectOne("selectUserCountByNativeQuery", parameterMap);
+		throw new RuntimeException("not implement method.");
+	}
+	
+}

+ 31 - 0
src/main/java/com/jeeplus/modules/act/service/ext/ActUserEntityServiceFactory.java

@@ -0,0 +1,31 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.service.ext;
+
+import org.activiti.engine.impl.interceptor.Session;
+import org.activiti.engine.impl.interceptor.SessionFactory;
+import org.activiti.engine.impl.persistence.entity.UserIdentityManager;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * Activiti User Entity Service Factory
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+public class ActUserEntityServiceFactory implements SessionFactory {
+	
+	@Autowired
+	private ActUserEntityService actUserEntityService;
+
+	public Class<?> getSessionType() {
+		// 返回原始的UserIdentityManager类型
+		return UserIdentityManager.class;
+	}
+
+	public Session openSession() {
+		// 返回自定义的GroupEntityManager实例
+		return actUserEntityService;
+	}
+
+}

+ 234 - 0
src/main/java/com/jeeplus/modules/act/utils/ActUtils.java

@@ -0,0 +1,234 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.utils;
+
+import com.fasterxml.jackson.annotation.JsonBackReference;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.annotation.FieldName;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.utils.Encodes;
+import com.jeeplus.common.utils.ObjectUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.entity.SysRoleActivity;
+import com.jeeplus.modules.sys.entity.User;
+import org.activiti.engine.impl.persistence.entity.GroupEntity;
+import org.activiti.engine.impl.persistence.entity.UserEntity;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 流程工具
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+public class ActUtils {
+
+//	private static Logger logger = LoggerFactory.getLogger(ActUtils.class);
+	
+	/**
+	 * 定义流程定义KEY,必须以“PD_”开头
+	 * 组成结构:string[]{"流程标识","业务主表表名"}
+	 */
+	public static final String[] PD_LEAVE = new String[]{"leave", "oa_leave"};
+	public static final String[] PD_ALLAPPROVE = new String[]{"allApprove", "oa_all"};
+	public static final String[] PD_TEST_AUDIT = new String[]{"test_audit", "oa_test_audit"};
+	public static final String[] PD_OABUY = new String[]{"oaBuy", "oa_buy"};//采购申请
+	public static final String[] PD_OAPERFORMANCE = new String[]{"oaPerformance", "oa_performance"};//绩效自评
+	public static final String[] PD_EXPENSE_ACCOUNT = new String[]{"expense_account", "oa_expense_account"};//网上报销流程
+	public static final String[] PD_NETWORK_SERVICE = new String[]{"network_service", "oa_network_service"};//网络报修流程
+	public static final String[] PD_REIMBURSEMENT = new String[]{"reimbursement", "work_reimbursement"};
+	public static final String[] PD_WORKFULLREOCRD = new String[]{"workfullrecord", "work_full_record"}; //项目归档
+	public static final String[] PD_ENGINEERINGRECORD = new String[]{"engineeringrecord", "work_full_record"}; //项目归档
+	public static final String[] PD_WORKFULLPAY = new String[]{"workfullpay", "work_full_pay"}; //工程计量支付
+	public static final String[] PD_INVOICE = new String[]{"invoice", "work_invoice"};
+	public static final String[] PD_OVERTIMEFORM = new String[]{"overtimeform","work_overtime_form"};
+	public static final String[] PD_GO_OUT = new String[]{"goout","go_out"};
+	public static final String[] PD_SEALFORM = new String[]{"sealform","work_seal_form"};
+	public static final String[] PD_OA_EVECTION = new String[]{"evection","oa_evection"};
+	public static final String[] PD_OA_PETTYCASH = new String[]{"pettyCash","work_petty_cash"};
+	public static final String[] PD_OA_PAYMENT = new String[]{"payment","work_payment"};
+	public static final String[] PD_OA_REIMBUR = new String[]{"reimbur","work_reimbur"};
+	public static final String[] PD_JOIN_COMPANY = new String[]{"joincompany","sys_company_info"};
+	public static final String[] PD_AUDIT_PROCESS1 = new String[]{"auditprocess1","sys_audit_process"};
+	public static final String[] PD_AUDIT_PROCESS2 = new String[]{"auditprocess2","sys_audit_process"};
+	public static final String[] PD_AUDIT_PROCESS3 = new String[]{"auditprocess3","sys_audit_process"};
+	public static final String[] PD_AUDIT_PROCESS4 = new String[]{"auditprocess4","sys_audit_process"};
+	public static final String[] PD_AUDIT_PROCESS5 = new String[]{"auditprocess5","sys_audit_process"};
+	public static final String[] PD_WORKCONTRACT = new String[]{"contractAudit", "work_contract_info"};
+	public static final String[] PD_CONTRACTINVALIDATE = new String[]{"contractInvalidate", "work_contract_info"};
+	public static final String[] PD_DEPOSIT = new String[]{"deposit", "project_deposit_management"};
+	public static final String[] PD_PREQUALIFICATION = new String[]{"prequalification", "work_bid_project"};
+	public static final String[] PD_WORKBIDINGDOCUMENT = new String[]{"workBidingDocument","work_biding_document"};//标书编制
+	public static final String[] PD_PROJECTALLOCATION = new String[]{"projectallocation","work_engineering_project"};
+	public static final String[] PD_WORKINVOICE = new String[]{"workinvoice","work_invoice"};
+	public static final String[] PD_WORKINVOICECANCLE = new String[]{"workinvoicecancle","work_invoice"};
+	public static final String[] PD_WORKFULLEXECUTE  = new String[]{"workFullExecute","work_full_execute"};//项目实施
+	public static final String[] PD_THREE_EXAMINATION  = new String[]{"threeexamination","work_engineering_project"};
+	public static final String[] PD_WORKFULLMEETINGMINUTES = new String[]{"workFullMeetingminutes","work_full_meetingminutes"};//会议纪要
+	public static final String[] PD_WORKFULLDESIGNCHANGE = new String[]{"workFullDesignchange","work_full_designchange"};//设计变更
+	public static final String[] PD_WORKFULLCONSTRUCTSHEET = new String[]{"workFullConstructsheet","work_full_constructsheet"};//施工联系单
+	public static final String[] PD_WORKFULLPROPRIETORSHEET = new String[]{"workFullProprietorsheet","work_full_proprietorsheet"};//业主联系单
+	public static final String[]  PD_WORKFULLSUPERVISORSHEET = new String[]{"workFullSupervisorsheet","work_full_supervisorsheet"};//监理联系单
+	public static final String[] PD_WORKVISA  = new String[]{"workVisa","work_visa"};
+	public static final String[] PD_WORASKCHECKPRICE  = new String[]{"workaskcheckprice","work_askcheckprice"};
+	public static final String[] PD_WORKCOMPLETE= new String[]{"projectCompleteAudit", "work_project_completion"};//项目竣工
+	public static final String[] PD_CASEINFO= new String[]{"caseInfo", "case_info"};//案例
+	public static final String[] PD_PROJECTRECORD= new String[]{"projectAudit"};//案例
+	//	/**
+//	 * 流程定义Map(自动初始化)
+//	 */
+//	private static Map<String, String> procDefMap = new HashMap<String, String>() {
+//		private static final long serialVersionUID = 1L;
+//		{
+//			for (Field field : ActUtils.class.getFields()){
+//				if(StringUtils.startsWith(field.getName(), "PD_")){
+//					try{
+//						String[] ss = (String[])field.get(null);
+//						put(ss[0], ss[1]);
+//					}catch (Exception e) {
+//						logger.debug("load pd error: {}", field.getName());
+//					}
+//				}
+//			}
+//		}
+//	};
+//	
+//	/**
+//	 * 获取流程执行(办理)URL
+//	 * @param procId
+//	 * @return
+//	 */
+//	public static String getProcExeUrl(String procId) {
+//		String url = procDefMap.get(StringUtils.split(procId, ":")[0]);
+//		if (StringUtils.isBlank(url)){
+//			return "404";
+//		}
+//		return url;
+//	}
+	
+	@SuppressWarnings({ "unused" })
+	public static Map<String, Object> getMobileEntity(Object entity,String spiltType){
+		if(spiltType==null){
+			spiltType="@";
+		}
+		Map<String, Object> map = Maps.newHashMap();
+
+		List<String> field = Lists.newArrayList();
+		List<String> value = Lists.newArrayList();
+		List<String> chinesName =Lists.newArrayList();
+		
+		try{
+			for (Method m : entity.getClass().getMethods()){
+				if (m.getAnnotation(JsonIgnore.class) == null && m.getAnnotation(JsonBackReference.class) == null && m.getName().startsWith("get")){
+					if (m.isAnnotationPresent(FieldName.class)) {
+						Annotation p = m.getAnnotation(FieldName.class);
+						FieldName fieldName=(FieldName) p;
+						chinesName.add(fieldName.value());
+					}else{
+						chinesName.add("");
+					}
+					if (m.getName().equals("getAct")){
+						Object act = m.invoke(entity, new Object[]{});
+						Method actMet = act.getClass().getMethod("getTaskId");
+						map.put("taskId", ObjectUtils.toString(m.invoke(act, new Object[]{}), ""));
+					}else{
+						field.add(StringUtils.uncapitalize(m.getName().substring(3)));
+						value.add(ObjectUtils.toString(m.invoke(entity, new Object[]{}), ""));
+					}
+				}
+			}
+		}catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		map.put("beanTitles", StringUtils.join(field, spiltType));
+		map.put("beanInfos", StringUtils.join(value, spiltType));
+		map.put("chineseNames", StringUtils.join(chinesName, spiltType));
+		
+		return map;
+	}
+	
+	/**
+	 * 获取流程表单URL
+	 * @param formKey
+	 * @param act 表单传递参数
+	 * @return
+	 */
+	public static String getFormUrl(String formKey, Act act){	
+		StringBuilder formUrl = new StringBuilder();	
+		String formServerUrl = Global.getConfig("activiti.form.server.url");
+		if (StringUtils.isBlank(formServerUrl)){
+			formUrl.append(Global.getAdminPath());
+		}else{
+			formUrl.append(formServerUrl);
+		}
+		
+		formUrl.append(formKey).append(formUrl.indexOf("?") == -1 ? "?" : "&");
+		formUrl.append("act.taskId=").append(act.getTaskId() != null ? act.getTaskId() : "");
+		formUrl.append("&act.taskName=").append(act.getTaskName() != null ? Encodes.urlEncode(act.getTaskName()) : "");
+		formUrl.append("&act.taskDefKey=").append(act.getTaskDefKey() != null ? act.getTaskDefKey() : "");
+		formUrl.append("&act.procInsId=").append(act.getProcInsId() != null ? act.getProcInsId() : "");
+		formUrl.append("&act.procDefId=").append(act.getProcDefId() != null ? act.getProcDefId() : "");
+		formUrl.append("&act.status=").append(act.getStatus() != null ? act.getStatus() : "");
+		formUrl.append("&id=").append(act.getBusinessId() != null ? act.getBusinessId() : "");
+		
+		return formUrl.toString();
+	}
+	
+	/**
+	 * 转换流程节点类型为中文说明
+	 * @param type 英文名称
+	 * @return 翻译后的中文名称
+	 */
+	public static String parseToZhType(String type) {
+		Map<String, String> types = new HashMap<String, String>();
+		types.put("userTask", "用户任务");
+		types.put("serviceTask", "系统任务");
+		types.put("startEvent", "开始节点");
+		types.put("endEvent", "结束节点");
+		types.put("exclusiveGateway", "条件判断节点(系统自动根据条件处理)");
+		types.put("inclusiveGateway", "并行处理任务");
+		types.put("callActivity", "子流程");
+		return types.get(type) == null ? type : types.get(type);
+	}
+
+	public static UserEntity toActivitiUser(User user){
+		if (user == null){
+			return null;
+		}
+		UserEntity userEntity = new UserEntity();
+		userEntity.setId(user.getId());
+		userEntity.setFirstName(user.getName());
+		userEntity.setLastName(StringUtils.EMPTY);
+		userEntity.setPassword(user.getPassword());
+		userEntity.setEmail(user.getEmail());
+		userEntity.setRevision(1);
+		return userEntity;
+	}
+	
+	public static GroupEntity toActivitiGroup(SysRoleActivity role){
+		if (role == null){
+			return null;
+		}
+		GroupEntity groupEntity = new GroupEntity();
+		groupEntity.setId(role.getEnname());
+		groupEntity.setName(role.getName());
+		groupEntity.setType("1");
+		groupEntity.setRevision(1);
+		return groupEntity;
+	}
+	
+	public static void main(String[] args) {
+		 User user = new User();
+		 System.out.println(getMobileEntity(user, "@"));
+	}
+}

+ 104 - 0
src/main/java/com/jeeplus/modules/act/utils/DateConverter.java

@@ -0,0 +1,104 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.utils;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.commons.beanutils.Converter;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 日期转换类
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+public class DateConverter implements Converter {
+
+	private static final Logger logger = LoggerFactory.getLogger(DateConverter.class);
+
+	private static final String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
+
+	private static final String DATETIME_PATTERN_NO_SECOND = "yyyy-MM-dd HH:mm";
+
+	private static final String DATE_PATTERN = "yyyy-MM-dd";
+
+	private static final String MONTH_PATTERN = "yyyy-MM";
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public Object convert(Class type, Object value) {
+		Object result = null;
+		if (type == Date.class) {
+			try {
+				result = doConvertToDate(value);
+			} catch (ParseException e) {
+				e.printStackTrace();
+			}
+		} else if (type == String.class) {
+			result = doConvertToString(value);
+		}
+		return result;
+	}
+
+	/**
+	 * Convert String to Date
+	 *
+	 * @param value
+	 * @return
+	 * @throws ParseException 
+	 */
+	private Date doConvertToDate(Object value) throws ParseException {
+		Date result = null;
+
+		if (value instanceof String) {
+			result = DateUtils.parseDate((String) value, new String[] { DATE_PATTERN, DATETIME_PATTERN,
+					DATETIME_PATTERN_NO_SECOND, MONTH_PATTERN });
+
+			// all patterns failed, try a milliseconds constructor
+			if (result == null && StringUtils.isNotEmpty((String) value)) {
+
+				try {
+					result = new Date(new Long((String) value).longValue());
+				} catch (Exception e) {
+					logger.error("Converting from milliseconds to Date fails!");
+					e.printStackTrace();
+				}
+
+			}
+
+		} else if (value instanceof Object[]) {
+			// let's try to convert the first element only
+			Object[] array = (Object[]) value;
+
+			if (array.length >= 1) {
+				value = array[0];
+				result = doConvertToDate(value);
+			}
+
+		} else if (Date.class.isAssignableFrom(value.getClass())) {
+			result = (Date) value;
+		}
+		return result;
+	}
+
+	/**
+	 * Convert Date to String
+	 *
+	 * @param value
+	 * @return
+	 */
+	private String doConvertToString(Object value) {
+		SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATETIME_PATTERN);
+		String result = null;
+		if (value instanceof Date) {
+			result = simpleDateFormat.format(value);
+		}
+		return result;
+	}
+
+}

+ 94 - 0
src/main/java/com/jeeplus/modules/act/utils/ProcessDefCache.java

@@ -0,0 +1,94 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.utils;
+
+import java.util.List;
+
+import org.activiti.engine.RepositoryService;
+import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
+import org.activiti.engine.impl.pvm.process.ActivityImpl;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.apache.commons.lang3.ObjectUtils;
+
+import com.jeeplus.common.utils.CacheUtils;
+import com.jeeplus.common.utils.SpringContextHolder;
+
+/**
+ * 流程定义缓存
+ * @author jeeplus
+ * @version 2013-12-05
+ */
+public class ProcessDefCache {
+
+	private static final String ACT_CACHE = "actCache";
+	private static final String ACT_CACHE_PD_ID_ = "pd_id_";
+	
+	/**
+	 * 获得流程定义对象
+	 * @param procDefId
+	 * @return
+	 */
+	public static ProcessDefinition get(String procDefId) {
+		ProcessDefinition pd = (ProcessDefinition)CacheUtils.get(ACT_CACHE, ACT_CACHE_PD_ID_ + procDefId);
+		if (pd == null) {
+			RepositoryService repositoryService = SpringContextHolder.getBean(RepositoryService.class);
+//			pd = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(pd);
+			pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId).singleResult();
+			if (pd != null) {
+				CacheUtils.put(ACT_CACHE, ACT_CACHE_PD_ID_ + procDefId, pd);
+			}
+		}
+		return pd;
+	}
+
+	/**
+	 * 获得流程定义的所有活动节点
+	 * @param procDefId
+	 * @return
+	 */
+	public static List<ActivityImpl> getActivitys(String procDefId) {
+		ProcessDefinition pd = get(procDefId);
+		if (pd != null) {
+			return ((ProcessDefinitionEntity) pd).getActivities();
+		}
+		return null;
+	}
+	
+	/**
+	 * 获得流程定义活动节点
+	 * @param procDefId
+	 * @param activityId
+	 * @return
+	 */
+	public static ActivityImpl getActivity(String procDefId, String activityId) {
+		ProcessDefinition pd = get(procDefId);
+		if (pd != null) {
+			List<ActivityImpl> list = getActivitys(procDefId);
+			if (list != null){
+				for (ActivityImpl activityImpl : list) {
+					if (activityId.equals(activityImpl.getId())){
+						return activityImpl;
+					}
+				}
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * 获取流程定义活动节点名称
+	 * @param procDefId
+	 * @param activityId
+	 * @return
+	 */
+	@SuppressWarnings("deprecation")
+	public static String getActivityName(String procDefId, String activityId) {
+		ActivityImpl activity = getActivity(procDefId, activityId);
+		if (activity != null) {
+			return ObjectUtils.toString(activity.getProperty("name"));
+		}
+		return null;
+	}
+
+}

+ 33 - 0
src/main/java/com/jeeplus/modules/act/utils/PropertyType.java

@@ -0,0 +1,33 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.utils;
+
+import java.util.Date;
+
+/**
+ * 属性数据类型
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+public enum PropertyType {
+	
+	S(String.class), 
+	I(Integer.class), 
+	L(Long.class), 
+	F(Float.class), 
+	N(Double.class),
+	D(Date.class), 
+	SD(java.sql.Date.class), 
+	B(Boolean.class);
+
+	private Class<?> clazz;
+
+	private PropertyType(Class<?> clazz) {
+		this.clazz = clazz;
+	}
+
+	public Class<?> getValue() {
+		return clazz;
+	}
+}

+ 87 - 0
src/main/java/com/jeeplus/modules/act/utils/Variable.java

@@ -0,0 +1,87 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.utils;
+
+import java.util.Map;
+
+import org.apache.commons.beanutils.ConvertUtils;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.utils.StringUtils;
+
+/**
+ * 流程变量对象
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+public class Variable {
+
+	private Map<String, Object> map = Maps.newHashMap();
+	
+	private String keys;
+	private String values;
+	private String types;
+
+	public Variable (){
+		
+	}
+	
+	public Variable (Map<String, Object> map){
+		this.map = map;
+	}
+
+	public String getKeys() {
+		return keys;
+	}
+
+	public void setKeys(String keys) {
+		this.keys = keys;
+	}
+
+	public String getValues() {
+		return values;
+	}
+
+	public void setValues(String values) {
+		this.values = values;
+	}
+
+	public String getTypes() {
+		return types;
+	}
+
+	public void setTypes(String types) {
+		this.types = types;
+	}
+
+	@JsonIgnore
+	public Map<String, Object> getVariableMap() {
+
+		ConvertUtils.register(new DateConverter(), java.util.Date.class);
+
+		if (StringUtils.isBlank(keys)) {
+			return map;
+		}
+
+		String[] arrayKey = keys.split(",");
+		String[] arrayValue = values.split(",");
+		String[] arrayType = types.split(",");
+		for (int i = 0; i < arrayKey.length; i++) {
+			String key = arrayKey[i];
+			String value = arrayValue[i];
+			String type = arrayType[i];
+
+			Class<?> targetType = Enum.valueOf(PropertyType.class, type).getValue();
+			Object objectValue = ConvertUtils.convert(value, targetType);
+			map.put(key, objectValue);
+		}
+		return map;
+	}
+
+	public Map<String, Object> getMap() {
+		return map;
+	}
+
+}

+ 138 - 0
src/main/java/com/jeeplus/modules/act/web/ActModelController.java

@@ -0,0 +1,138 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.service.ActModelService;
+
+/**
+ * 流程模型相关Controller
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/act/model")
+public class ActModelController extends BaseController {
+
+	@Autowired
+	private ActModelService actModelService;
+
+	/**
+	 * 流程模型列表
+	 */
+	@RequiresPermissions("act:model:list")
+	@RequestMapping(value = { "list", "" })
+	public String modelList(String category, HttpServletRequest request, HttpServletResponse response, Model model) {
+
+		Page<org.activiti.engine.repository.Model> page = actModelService.modelList(
+				new Page<org.activiti.engine.repository.Model>(request, response), category);
+
+		model.addAttribute("page", page);
+		model.addAttribute("category", category);
+
+		return "modules/act/actModelList";
+	}
+
+	/**
+	 * 创建模型
+	 */
+	@RequiresPermissions("act:model:create")
+	@RequestMapping(value = "create", method = RequestMethod.GET)
+	public String create(Model model) {
+		return "modules/act/actModelCreate";
+	}
+	
+	/**
+	 * 创建模型
+	 */
+	@RequiresPermissions("act:model:create")
+	@RequestMapping(value = "create", method = RequestMethod.POST)
+	public String create(String name, String key, String description, String category,
+			HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+			actModelService.create(name, key, description, category);
+			redirectAttributes.addFlashAttribute("message", "添加模型成功");
+			
+		} catch (Exception e) {
+			redirectAttributes.addFlashAttribute("message", "添加模型失败");
+			
+			logger.error("创建模型失败:", e);
+		}
+		return "redirect:" + adminPath + "/act/model";
+	}
+
+	/**
+	 * 根据Model部署流程
+	 */
+	@RequiresPermissions("act:model:deploy")
+	@RequestMapping(value = "deploy")
+	public String deploy(String id, RedirectAttributes redirectAttributes) {
+		String message = actModelService.deploy(id);
+		redirectAttributes.addFlashAttribute("message", message);
+		return "redirect:" + adminPath + "/act/model";
+	}
+	
+	/**
+	 * 导出model的xml文件
+	 */
+	@RequiresPermissions("act:model:export")
+	@RequestMapping(value = "export")
+	public void export(String id, HttpServletResponse response) {
+		actModelService.export(id, response);
+	}
+
+	/**
+	 * 更新Model分类
+	 */
+	@RequiresPermissions("act:model:edit")
+	@RequestMapping(value = "updateCategory")
+	public String updateCategory(String id, String category, RedirectAttributes redirectAttributes) {
+		actModelService.updateCategory(id, category);
+		redirectAttributes.addFlashAttribute("message", "设置成功,模块ID=" + id);
+		return "redirect:" + adminPath + "/act/model";
+	}
+	
+	/**
+	 * 删除Model
+	 * @param id
+	 * @param redirectAttributes
+	 * @return
+	 */
+	@RequiresPermissions("act:model:del")
+	@RequestMapping(value = "delete")
+	public String delete(String id, RedirectAttributes redirectAttributes) {
+		actModelService.delete(id);
+		redirectAttributes.addFlashAttribute("message", "删除成功,模型ID=" + id);
+		return "redirect:" + adminPath + "/act/model";
+	}
+	
+	/**
+	 * 删除Model
+	 * @param id
+	 * @param redirectAttributes
+	 * @return
+	 */
+	@RequiresPermissions("act:model:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			actModelService.delete(id);
+		}
+		redirectAttributes.addFlashAttribute("message", "删除成功");
+		return "redirect:" + adminPath + "/act/model";
+	}
+}

+ 222 - 0
src/main/java/com/jeeplus/modules/act/web/ActProcessController.java

@@ -0,0 +1,222 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.web;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.stream.XMLStreamException;
+
+import com.jeeplus.modules.act.service.ActivityXmlService;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import org.activiti.engine.HistoryService;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+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.servlet.mvc.support.RedirectAttributes;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.service.ActProcessService;
+
+/**
+ * 流程定义相关Controller
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/act/process")
+public class ActProcessController extends BaseController {
+
+	@Autowired
+	private ActProcessService actProcessService;
+
+	@Autowired
+	private HistoryService historyService;
+
+	@Autowired
+	private ActivityXmlService activityService;
+	/**
+	 * 流程定义列表
+	 */
+	@RequiresPermissions("act:process:edit")
+	@RequestMapping(value = {"list", ""})
+	public String processList(String category, HttpServletRequest request, HttpServletResponse response, Model model) {
+		/*
+		 * 保存两个对象,一个是ProcessDefinition(流程定义),一个是Deployment(流程部署)
+		 */
+		Page<Object[]> page = actProcessService.processList(new Page<Object[]>(request, response), category);
+		model.addAttribute("page", page);
+		model.addAttribute("category", category);
+		return "modules/act/actProcessList";
+	}
+
+	/**
+	 * 运行中的实例列表
+	 */
+	@RequiresPermissions("act:process:edit")
+	@RequestMapping(value = "running")
+	public String runningList(String procInsId, String procDefKey, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<ProcessInstance> page = actProcessService.runningList(new Page<ProcessInstance>(request, response), procInsId, procDefKey);
+		model.addAttribute("page", page);
+		model.addAttribute("procInsId", procInsId);
+		model.addAttribute("procDefKey", procDefKey);
+		return "modules/act/actProcessRunningList";
+	}
+
+	/**
+	 * 已结束的实例
+	 */
+	@RequiresPermissions("act:process:edit")
+	@RequestMapping(value = "historyList")
+	public String historyList(String procInsId, String procDefKey, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<HistoricProcessInstance> page = actProcessService.historyList(new Page<HistoricProcessInstance>(request, response), procInsId, procDefKey);
+		model.addAttribute("page", page);
+		model.addAttribute("procInsId", procInsId);
+		model.addAttribute("procDefKey", procDefKey);
+		return "modules/act/actProcessHistoryList";
+	}
+
+
+	/**
+	 * 读取资源,通过部署ID
+	 * @param processDefinitionId  流程定义ID
+	 * @param processInstanceId 流程实例ID
+	 * @param resourceType 资源类型(xml|image)
+	 * @param response
+	 * @throws Exception
+	 */
+	@RequiresPermissions("act:process:edit")
+	@RequestMapping(value = "resource/read")
+	public void resourceRead(String procDefId, String proInsId, String resType, HttpServletResponse response) throws Exception {
+		InputStream resourceAsStream = actProcessService.resourceRead(procDefId, proInsId, resType);
+		byte[] b = new byte[1024];
+		int len = -1;
+		while ((len = resourceAsStream.read(b, 0, 1024)) != -1) {
+			response.getOutputStream().write(b, 0, len);
+		}
+	}
+
+	/**
+	 * 部署流程
+	 */
+	@RequiresPermissions("act:process:edit")
+	@RequestMapping(value = "/deploy", method=RequestMethod.GET)
+	public String deploy(Model model) {
+		return "modules/act/actProcessDeploy";
+	}
+
+	/**
+	 * 部署流程 - 保存
+	 * @param file
+	 * @return
+	 */
+	@RequiresPermissions("act:process:edit")
+	@RequestMapping(value = "/deploy", method=RequestMethod.POST)
+	public String deploy(@Value("#{APP_PROP['activiti.export.diagram.path']}") String exportDir,
+						 String category, MultipartFile file, RedirectAttributes redirectAttributes) {
+
+		String fileName = file.getOriginalFilename();
+
+		if (StringUtils.isBlank(fileName)){
+			redirectAttributes.addFlashAttribute("message", "请选择要部署的流程文件");
+		}else{
+			String message = actProcessService.deploy(exportDir, category, file);
+			redirectAttributes.addFlashAttribute("message", message);
+		}
+
+		return "redirect:" + adminPath + "/act/process";
+	}
+
+	/**
+	 * 设置流程分类
+	 */
+	@RequiresPermissions("act:process:edit")
+	@RequestMapping(value = "updateCategory")
+	public String updateCategory(String procDefId, String category, RedirectAttributes redirectAttributes) {
+		actProcessService.updateCategory(procDefId, category);
+		return "redirect:" + adminPath + "/act/process";
+	}
+
+	/**
+	 * 挂起、激活流程实例
+	 */
+	@RequiresPermissions("act:process:edit")
+	@RequestMapping(value = "update/{state}")
+	public String updateState(@PathVariable("state") String state, String procDefId, RedirectAttributes redirectAttributes) {
+		String message = actProcessService.updateState(state, procDefId);
+		redirectAttributes.addFlashAttribute("message", message);
+		return "redirect:" + adminPath + "/act/process";
+	}
+
+	/**
+	 * 将部署的流程转换为模型
+	 * @param procDefId
+	 * @param redirectAttributes
+	 * @return
+	 * @throws UnsupportedEncodingException
+	 * @throws XMLStreamException
+	 */
+	@RequiresPermissions("act:process:edit")
+	@RequestMapping(value = "convert/toModel")
+	public String convertToModel(String procDefId, RedirectAttributes redirectAttributes) throws UnsupportedEncodingException, XMLStreamException {
+		org.activiti.engine.repository.Model modelData = actProcessService.convertToModel(procDefId);
+		redirectAttributes.addFlashAttribute("message", "转换模型成功,模型ID="+modelData.getId());
+		return "redirect:" + adminPath + "/act/model";
+	}
+
+	/**
+	 * 导出图片文件到硬盘
+	 */
+	@RequiresPermissions("act:process:edit")
+	@RequestMapping(value = "export/diagrams")
+	@ResponseBody
+	public List<String> exportDiagrams(@Value("#{APP_PROP['activiti.export.diagram.path']}") String exportDir) throws IOException {
+		List<String> files = actProcessService.exportDiagrams(exportDir);
+		return files;
+	}
+
+	/**
+	 * 删除部署的流程,级联删除流程实例
+	 * @param deploymentId 流程部署ID
+	 */
+	@RequiresPermissions("act:process:edit")
+	@RequestMapping(value = "delete")
+	public String delete(String deploymentId) {
+		actProcessService.deleteDeployment(deploymentId);
+		return "redirect:" + adminPath + "/act/process";
+	}
+
+	/**
+	 * 删除流程实例
+	 * @param procInsId 流程实例ID
+	 * @param reason 删除原因
+	 */
+	@RequiresPermissions("act:process:edit")
+	@RequestMapping(value = "deleteProcIns")
+	public String deleteProcIns(String procInsId, String reason, RedirectAttributes redirectAttributes) {
+		if (StringUtils.isBlank(reason)){
+			addMessage(redirectAttributes, "请填写作废原因");
+		}else{
+			actProcessService.deleteProcIns(procInsId, reason);
+			addMessage(redirectAttributes, "作废成功,流程实例ID=" + procInsId);
+		}
+		return "redirect:" + adminPath + "/act/process/running/";
+	}
+
+}

+ 623 - 0
src/main/java/com/jeeplus/modules/act/web/ActTaskController.java

@@ -0,0 +1,623 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.act.web;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.Collections3;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.entity.SysRoleActivity;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.SystemService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.entity.WorkActivityProcess;
+import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 流程个人任务相关Controller
+ * @author jeeplus
+ * @version 2013-11-03
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/act/task")
+public class ActTaskController extends BaseController {
+
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private WorkActivityProcessService workActivityProcessService;
+	@Autowired
+	private SystemService systemService;
+
+	/**
+	 * 获取待办列表
+	 * @param act 流程定义标识
+	 * @return
+	 */
+	@RequestMapping(value = {"todo", ""})
+	public String todoList(Act act, HttpServletResponse response, Model model) throws Exception {
+
+		System.out.println("act---------------"+act.toString());
+		List<Act> list = actTaskService.todoList(act);
+		model.addAttribute("list", list);
+
+
+		if (UserUtils.getPrincipal().isMobileLogin()){
+			return renderString(response, list);
+		}
+		return "modules/act/actTaskTodoList";
+	}
+
+	/**
+	 * 获取已办任务
+	 * @param act 流程定义标识
+	 * @return
+	 */
+	@RequestMapping(value = "historic")
+	public String historicList(Act act, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
+		Page<Act> page = actTaskService.historicList(new Page<Act>(request, response), act);
+		System.out.println("actHistoric"+act.toString());
+		model.addAttribute("page", page);
+		if (UserUtils.getPrincipal().isMobileLogin()){
+			return renderString(response, page);
+		}
+		return "modules/act/actTaskHistoricList";
+	}
+
+	/**
+	 * 获取流转历史列表
+	 * @param startAct 开始活动节点名称
+	 * @param endAct 结束活动节点名称
+	 */
+	@RequestMapping(value = "histoicFlow")
+	public String histoicFlow(Act act, String startAct, String endAct, Model model){
+		if (StringUtils.isNotBlank(act.getProcInsId())){
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessInstanceId(act.getProcInsId());
+			/*List<Act> histoicFlows = new ArrayList<>();
+			List<Act> histoicFlowList = actTaskService.histoicFlowList(act.getProcInsId(), startAct, endAct);
+			histoicFlows = getList(histoicFlowList);*/
+			List<WorkActivityProcess> list = workActivityProcessService.findByProcInsId(workActivityProcess);
+			workActivityProcess.setIsApproval("0");
+			List<WorkActivityProcess> lists = workActivityProcessService.findByProcInsIdAudit(workActivityProcess);
+			List<WorkActivityProcess> beginList = workActivityProcessService.findByProcInsIdAndIsApproval(workActivityProcess);
+			List<Act> histoicFlows = new ArrayList<>();
+			Date beginDate = new Date();
+			String userName = "";
+			Date endDate = new Date();
+			if (beginList!=null && beginList.size()!=0){
+				beginDate = beginList.get(0).getCreateDate();
+				userName = beginList.get(0).getCreateBy().getName();
+			}else {
+				if (lists!=null && lists.size()!=0){
+					beginDate = lists.get(lists.size()-1).getCreateDate();
+				}
+			}
+			if (list!=null && list.size()!=0){
+				endDate = list.get(list.size()-1).getUpdateDate();
+			}
+
+
+			if (list!=null && lists!=null && list.size()==0 && lists.size()==0){
+				List<Act> histoicFlowList = actTaskService.histoicFlowList(act.getProcInsId(), startAct, endAct);
+				histoicFlows = getList(histoicFlowList);
+			}else {
+				Act act1 = new Act();
+				act1.setBeginDate(beginDate);
+				act1.setEndDate(beginDate);
+				act1.setTaskName("开始");
+				act1.setComment("发起申请");
+				act1.setDurationTime("0秒");
+				if (StringUtils.isNotBlank(userName)){
+					act1.setAssigneeName(userName);
+				}else if(lists.size()!=0){
+					act1.setAssigneeName(UserUtils.get(lists.get(lists.size()-1).getCreateBy().getId()).getName());
+				}else if (list.size()!=0){
+					act1.setAssigneeName(UserUtils.get(list.get(list.size()-1).getCreateBy().getId()).getName());
+				}
+
+				histoicFlows.add(act1);
+				for (int i =0;i<list.size();i++){
+					WorkActivityProcess activityProcess = list.get(i);
+					Act a = new Act();
+					if (activityProcess.getActivity() ==null){
+						if (StringUtils.isNotBlank(userName)){
+							a.setAssigneeName(userName);
+						}else if (lists!=null && lists.size()!=0){
+							a.setAssigneeName(UserUtils.get(lists.get(lists.size()-1).getCreateBy().getId()).getName());
+						}else {
+							a.setAssigneeName(UserUtils.get(list.get(list.size()-1).getCreateBy().getId()).getName());
+						}
+						if("销假申请".equals(activityProcess.getRemarks())||"续假申请".equals(activityProcess.getRemarks())){
+							a.setTaskName("开始");
+						}else{
+							a.setTaskName("重申|撤销");
+						}
+					}else if (activityProcess.getActivity().getUser()!=null && StringUtils.isNotBlank(activityProcess.getActivity().getUser().getId())){
+						String id = activityProcess.getActivity().getUser().getId();
+						if ("1".equals(id)){
+							a.setAssigneeName("负责人");
+						}else {
+							a.setAssigneeName(UserUtils.get(activityProcess.getActivity().getUser().getId()).getName());
+						}
+						a.setTaskName(activityProcess.getActivity().getName());
+					}else{
+						User user = new User();
+						if (activityProcess.getUpdateBy()!=null && StringUtils.isNotBlank(activityProcess.getUpdateBy().getId())){
+							user = UserUtils.get(activityProcess.getUpdateBy().getId());
+						}
+						SysRoleActivity role = activityProcess.getActivity().getRole();
+						String buffer = UserUtils.getRoleActivityEnname(UserUtils.getSelectCompany().getId(),UserUtils.getUser());
+						if (role.getEnname().contains(buffer.toString())){
+							SysRoleActivity r = systemService.getRoleActivityByEnname(role.getEnname());
+							if(r!=null&&!"".equals(r)){
+								a.setRoleName(r.getName());
+								a.setAssigneeName(user.getName());
+							}
+						}else {
+							SysRoleActivity r = systemService.getRoleActivityByEnname(buffer+role.getEnname());
+							if(r!=null&&!"".equals(r)){
+								a.setRoleName(r.getName());
+								a.setAssigneeName(user.getName());
+							}else if(r==null&&"qyr".equals(role.getEnname())){
+								a.setRoleName("签约人");
+								a.setAssigneeName(user.getName());
+							}else if(r==null&&"master".equals(role.getEnname())){
+								a.setRoleName("负责人");
+								a.setAssigneeName(user.getName());
+							}else if(r==null&&"sqr".equals(role.getEnname())){
+								a.setRoleName("申请人");
+								a.setAssigneeName(user.getName());
+							}
+						}
+						a.setTaskName(activityProcess.getActivity().getName());
+					}
+
+					a.setComment(activityProcess.getRemarks());
+					if (compareDate(beginDate,activityProcess.getUpdateDate())!=0) {
+						if (i==0){
+							a.setBeginDate(beginDate);
+							a.setEndDate(activityProcess.getUpdateDate());
+						}else {
+							a.setBeginDate(list.get(i-1).getUpdateDate());
+							a.setEndDate(activityProcess.getUpdateDate());
+						}
+					}
+					if (a.getBeginDate()!=null && a.getEndDate()!=null){
+						String durationTime = "";
+						long time = 0;
+						if (a.getEndDate().getTime()>a.getBeginDate().getTime()){
+							time = a.getEndDate().getTime() - a.getBeginDate().getTime();
+						}else {
+							time = a.getBeginDate().getTime() - a.getEndDate().getTime() ;
+						}
+
+						time /= 1000;
+						long day = time/(24*3600);
+						if (day != 0){
+							durationTime = day+"天";
+						}
+						time = time % (24*3600);
+						long hour = time/3600;
+						if (hour != 0){
+							durationTime += hour+"小时";
+						}
+						time = time % 3600;
+						long min = time/60;
+						if (min != 0){
+							durationTime += min+"分";
+						}
+						time = time % 60;
+						long sec = time;
+						if (sec != 0){
+							durationTime += sec+"秒";
+						}
+						a.setDurationTime(durationTime);
+					}
+					histoicFlows.add(a);
+				}
+				for (int i =0;i<lists.size();i++){
+					WorkActivityProcess activityProcess = lists.get(i);
+					Act a = new Act();
+					if (activityProcess.getActivity() ==null) {
+						if (StringUtils.isNotBlank(userName)) {
+							a.setAssigneeName(userName);
+						} else {
+							a.setAssigneeName(UserUtils.get(lists.get(lists.size() - 1).getCreateBy().getId()).getName());
+						}
+						if("销假申请".equals(activityProcess.getRemarks())||"续假申请".equals(activityProcess.getRemarks())){
+							a.setTaskName("开始");
+						}else{
+							a.setTaskName("重申|撤销");
+						}
+					}else if (activityProcess.getActivity().getUser()!=null && StringUtils.isNotBlank(activityProcess.getActivity().getUser().getId())){
+						String id = activityProcess.getActivity().getUser().getId();
+						if ("1".equals(id)){
+							a.setRoleName("负责人");
+						}else {
+							a.setAssigneeName(UserUtils.get(activityProcess.getActivity().getUser().getId()).getName());
+						}
+						a.setTaskName(activityProcess.getActivity().getName());
+					}else{
+						SysRoleActivity role = activityProcess.getActivity().getRole();
+						String buffer = UserUtils.getRoleActivityEnname(UserUtils.getSelectCompany().getId(),UserUtils.getUser());
+						if (activityProcess.getProcessUserList()!=null && activityProcess.getProcessUserList().size()!=0){
+							a.setAssigneeName(Collections3.extractToString(activityProcess.getProcessUserList(), "name", ","));
+						}
+						if("master".equals(role.getEnname())){
+							a.setRoleName("负责人");
+						}else if("qyr".equals(role.getEnname())){
+							a.setRoleName("签约人");
+						}else if("sqr".equals(role.getEnname())){
+							a.setRoleName("申请人");
+                            a.setAssigneeName(UserUtils.get(lists.get(lists.size() - 1).getCreateBy().getId()).getName());
+						}else {
+							if (role.getEnname().contains(buffer)){
+								SysRoleActivity r = systemService.getRoleActivityByEnname(role.getEnname());
+								a.setRoleName(r.getName());
+							}else {
+								//如果流程中指定的角色为董事长dsz,而该公司下没有这样角色,则r=null,空指针
+								SysRoleActivity r = systemService.getRoleActivityByEnname(buffer+role.getEnname());
+								a.setRoleName(r!=null?r.getName():"");
+							}
+						}
+						a.setTaskName(activityProcess.getActivity().getName());
+					}
+
+					a.setComment(activityProcess.getRemarks());
+					if (i==0){
+						a.setBeginDate(endDate);
+					}
+					histoicFlows.add(a);
+				}
+			}
+			model.addAttribute("histoicFlowList", histoicFlows);
+		}
+		return "modules/act/actTaskHistoricFlow";
+	}
+
+	/**
+	 * 获取流程流向图
+	 * @param act 流程实例
+	 * @param startAct 开始活动节点名称
+	 * @param endAct 结束活动节点名称
+	 */
+	@RequestMapping(value = "flowChart")
+	public String flowChart(Act act, String startAct, String endAct, Model model){
+		if (StringUtils.isNotBlank(act.getProcInsId())){
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessInstanceId(act.getProcInsId());
+			/*List<Act> histoicFlows = new ArrayList<>();
+			List<Act> histoicFlowList = actTaskService.histoicFlowList(act.getProcInsId(), startAct, endAct);
+			histoicFlows = getList(histoicFlowList);*/
+			List<WorkActivityProcess> list = workActivityProcessService.findByProcInsId(workActivityProcess);
+			workActivityProcess.setIsApproval("0");
+			List<WorkActivityProcess> lists = workActivityProcessService.findByProcInsId(workActivityProcess);
+			List<Act> histoicFlows = new ArrayList<>();
+			if (lists!=null && lists.size()!=0){
+				if (list!=null && list.size()!=0){
+					WorkActivityProcess activityProcess = list.get(list.size()-1);
+					Act a = new Act();
+					if (activityProcess.getActivity() ==null){
+						a.setTaskName("重申|撤销");
+					}else if (activityProcess.getActivity().getUser()!=null && StringUtils.isNotBlank(activityProcess.getActivity().getUser().getId())){
+						a.setTaskName(activityProcess.getActivity().getName());
+					}else{
+						a.setTaskName(activityProcess.getActivity().getName());
+					}
+					a.setComment(activityProcess.getRemarks());
+					histoicFlows.add(a);
+				}else {
+					Act act1 = new Act();
+					act1.setTaskName("开始");
+					histoicFlows.add(act1);
+				}
+				if (lists.size()==1){
+					WorkActivityProcess activityProcess = lists.get(0);
+					Act a = new Act();
+					if (activityProcess.getActivity() ==null) {
+						a.setTaskName("重申|撤销");
+					}else if (activityProcess.getActivity().getUser()!=null && StringUtils.isNotBlank(activityProcess.getActivity().getUser().getId())){
+						a.setTaskName(activityProcess.getActivity().getName());
+					}else{
+						a.setTaskName(activityProcess.getActivity().getName());
+					}
+					histoicFlows.add(a);
+					Act act1 = new Act();
+					act1.setTaskName("结束");
+					histoicFlows.add(act1);
+				}else {
+					for (int i = 0; i < 2; i++) {
+						WorkActivityProcess activityProcess = lists.get(i);
+						Act a = new Act();
+						if (activityProcess.getActivity() == null) {
+							a.setTaskName("重申|撤销");
+						} else if (activityProcess.getActivity().getUser() != null && StringUtils.isNotBlank(activityProcess.getActivity().getUser().getId())) {
+							a.setTaskName(activityProcess.getActivity().getName());
+						} else {
+							a.setTaskName(activityProcess.getActivity().getName());
+						}
+						histoicFlows.add(a);
+					}
+				}
+			}else {
+				if (list!=null && list.size()>2){
+					for (int i = list.size()-2;i<list.size();i++){
+						WorkActivityProcess activityProcess = list.get(i);
+						Act a = new Act();
+						if (activityProcess.getActivity() ==null){
+							a.setTaskName("重申|撤销");
+						}else if (activityProcess.getActivity().getUser()!=null && StringUtils.isNotBlank(activityProcess.getActivity().getUser().getId())){
+							a.setTaskName(activityProcess.getActivity().getName());
+						}else{
+							a.setTaskName(activityProcess.getActivity().getName());
+						}
+						a.setComment(activityProcess.getRemarks());
+						histoicFlows.add(a);
+					}
+					Act act2 = new Act();
+					act2.setTaskName("结束");
+					histoicFlows.add(act2);
+				}else if (list!=null && list.size()==1){
+					Act act1 = new Act();
+					act1.setTaskName("开始");
+					histoicFlows.add(act1);
+					WorkActivityProcess activityProcess = list.get(list.size()-1);
+					Act a = new Act();
+					if (activityProcess.getActivity() ==null){
+						a.setTaskName("重申|撤销");
+					}else if (activityProcess.getActivity().getUser()!=null && StringUtils.isNotBlank(activityProcess.getActivity().getUser().getId())){
+						a.setTaskName(activityProcess.getActivity().getName());
+					}else{
+						a.setTaskName(activityProcess.getActivity().getName());
+					}
+					a.setComment(activityProcess.getRemarks());
+					histoicFlows.add(a);
+					Act act2 = new Act();
+					act2.setTaskName("结束");
+					histoicFlows.add(act2);
+				}
+			}
+			model.addAttribute("histoicFlowList", histoicFlows);
+		}
+		return "modules/act/actTaskFlowChart";
+	}
+
+	public List getList(List<Act> list){
+		try {
+			List<Act> histoicFlows = new ArrayList<Act>();
+			if (list != null && list.size() == 2) {
+				if (list.get(1).getEndDate() == null) {
+					histoicFlows.add(list.get(1));
+					histoicFlows.add(list.get(0));
+				} else {
+					histoicFlows.addAll(list);
+				}
+			} else {
+				histoicFlows.addAll(list);
+			}
+			return histoicFlows;
+		}catch (Exception e){
+			return list;
+		}
+
+	}
+
+
+	/**
+	 * 获取流程列表
+	 * @param category 流程分类
+	 */
+	@RequestMapping(value = "process")
+	public String processList(String category, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<Object[]> page = new Page<Object[]>(request, response);
+		page = actTaskService.processList(page, category);
+		model.addAttribute("page", page);
+		model.addAttribute("category", category);
+		return "modules/act/actTaskProcessList";
+	}
+
+	/**
+	 * 获取流程表单
+	 * @param act	任务ID
+	 */
+	@RequestMapping(value = "form")
+	public String form(Act act, HttpServletRequest request, Model model){
+		// 获取流程XML上的表单KEY
+		System.out.println("act"+"-------------"+act.toString());
+		String formKey = actTaskService.getFormKey(act.getProcDefId(), act.getTaskDefKey());
+		// 获取流程实例对象
+		if (act.getProcInsId() != null){
+			if(actTaskService.getProcIns(act.getProcInsId())!=null){
+				act.setProcIns(actTaskService.getProcIns(act.getProcInsId()));
+			}else{
+				act.setFinishedProcIns(actTaskService.getFinishedProcIns(act.getProcInsId()));
+			}
+
+		}
+		return "redirect:" + ActUtils.getFormUrl(formKey, act);
+
+		// 传递参数到视图
+//		String formUrl = ActUtils.getFormUrl(formKey, act);
+//		model.addAttribute("act", act);
+//		model.addAttribute("formUrl", formUrl);
+//		return "modules/act/actTaskForm";
+	}
+
+	/**
+	 * 启动流程
+	 * @param act 流程定义KEY
+	 * @param table 业务表表名
+	 * @param id	业务表编号
+	 */
+	@RequestMapping(value = "start")
+	@ResponseBody
+	public String start(Act act, String table, String id, Model model) throws Exception {
+		actTaskService.startProcess(act.getProcDefKey(), act.getBusinessId(), act.getBusinessTable(), act.getTitle());
+		return "true";//adminPath + "/act/task";
+	}
+
+	/**
+	 * 签收任务
+	 * @param act 任务ID
+	 */
+	@RequestMapping(value = "claim")
+	@ResponseBody
+	public String claim(Act act) {
+		String userId = UserUtils.getUser().getId();//ObjectUtils.toString(UserUtils.getUser().getId());
+		actTaskService.claim(act.getTaskId(), userId);
+		return "true";//adminPath + "/act/task";
+	}
+
+	/**
+	 * 完成任务
+	 * @param act 任务ID
+	 * 		vars.keys=flag,pass
+	 * 		vars.values=1,true
+	 * 		vars.types=S,B  @see com.jeeplus.jeeplus.modules.act.utils.PropertyType
+	 */
+	@RequestMapping(value = "complete")
+	@ResponseBody
+	public String complete(Act act) {
+		actTaskService.complete(act.getTaskId(), act.getProcInsId(), act.getComment(), act.getVars().getVariableMap());
+		return "true";//adminPath + "/act/task";
+	}
+
+	/**
+	 * 读取带跟踪的图片
+	 */
+	@RequestMapping(value = "trace/photo/{procDefId}/{execId}")
+	public void tracePhoto(@PathVariable("procDefId") String procDefId, @PathVariable("execId") String execId, HttpServletResponse response) throws Exception {
+		InputStream imageStream = actTaskService.tracePhoto(procDefId, execId);
+
+		// 输出资源内容到相应对象
+		byte[] b = new byte[1024];
+		int len;
+		while ((len = imageStream.read(b, 0, 1024)) != -1) {
+			response.getOutputStream().write(b, 0, len);
+		}
+	}
+
+	/**
+	 * 输出跟踪流程信息
+	 *
+	 * @param proInsId
+	 * @return
+	 * @throws Exception
+	 */
+	@ResponseBody
+	@RequestMapping(value = "trace/info/{proInsId}")
+	public List<Map<String, Object>> traceInfo(@PathVariable("proInsId") String proInsId) throws Exception {
+		List<Map<String, Object>> activityInfos = actTaskService.traceProcess(proInsId);
+		return activityInfos;
+	}
+
+	/**
+	 * 显示流程图
+
+	 @RequestMapping(value = "processPic")
+	 public void processPic(String procDefId, HttpServletResponse response) throws Exception {
+	 ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId).singleResult();
+	 String diagramResourceName = procDef.getDiagramResourceName();
+	 InputStream imageStream = repositoryService.getResourceAsStream(procDef.getDeploymentId(), diagramResourceName);
+	 byte[] b = new byte[1024];
+	 int len = -1;
+	 while ((len = imageStream.read(b, 0, 1024)) != -1) {
+	 response.getOutputStream().write(b, 0, len);
+	 }
+	 }*/
+
+	/**
+	 * 获取跟踪信息
+
+	 @RequestMapping(value = "processMap")
+	 public String processMap(String procDefId, String proInstId, Model model)
+	 throws Exception {
+	 List<ActivityImpl> actImpls = new ArrayList<ActivityImpl>();
+	 ProcessDefinition processDefinition = repositoryService
+	 .createProcessDefinitionQuery().processDefinitionId(procDefId)
+	 .singleResult();
+	 ProcessDefinitionImpl pdImpl = (ProcessDefinitionImpl) processDefinition;
+	 String processDefinitionId = pdImpl.getId();// 流程标识
+	 ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
+	 .getDeployedProcessDefinition(processDefinitionId);
+	 List<ActivityImpl> activitiList = def.getActivities();// 获得当前任务的所有节点
+	 List<String> activeActivityIds = runtimeService.getActiveActivityIds(proInstId);
+	 for (String activeId : activeActivityIds) {
+	 for (ActivityImpl activityImpl : activitiList) {
+	 String id = activityImpl.getId();
+	 if (activityImpl.isScope()) {
+	 if (activityImpl.getActivities().size() > 1) {
+	 List<ActivityImpl> subAcList = activityImpl
+	 .getActivities();
+	 for (ActivityImpl subActImpl : subAcList) {
+	 String subid = subActImpl.getId();
+	 System.out.println("subImpl:" + subid);
+	 if (activeId.equals(subid)) {// 获得执行到那个节点
+	 actImpls.add(subActImpl);
+	 break;
+	 }
+	 }
+	 }
+	 }
+	 if (activeId.equals(id)) {// 获得执行到那个节点
+	 actImpls.add(activityImpl);
+	 System.out.println(id);
+	 }
+	 }
+	 }
+	 model.addAttribute("procDefId", procDefId);
+	 model.addAttribute("proInstId", proInstId);
+	 model.addAttribute("actImpls", actImpls);
+	 return "modules/act/actTaskMap";
+	 }*/
+
+	/**
+	 * 删除任务
+	 * @param taskId 流程实例ID
+	 * @param reason 删除原因
+	 */
+	@RequiresPermissions("act:process:edit")
+	@RequestMapping(value = "deleteTask")
+	public String deleteTask(String taskId, String reason, RedirectAttributes redirectAttributes) {
+		if (StringUtils.isBlank(reason)){
+			addMessage(redirectAttributes, "请填写删除原因");
+		}else{
+			actTaskService.deleteTask(taskId, reason);
+			addMessage(redirectAttributes, "删除任务成功,任务ID=" + taskId);
+		}
+		return "redirect:" + adminPath + "/act/task";
+	}
+
+	public int compareDate(Date d1,Date d2){
+		if (d1.getTime() > d2.getTime()) {
+			return 1;
+		} else if (d1.getTime() < d2.getTime()) {
+			return -1;
+		} else {//相等
+			return 0;
+		}
+	}
+}

+ 22 - 0
src/main/java/com/jeeplus/modules/activityassignment/dao/ActivityAssignmentDao.java

@@ -0,0 +1,22 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.activityassignment.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.activityassignment.entity.ActivityAssignment;
+
+import javax.xml.crypto.Data;
+import java.util.Date;
+
+/**
+ * 工作流任务委托DAO接口
+ * @author 杨帆
+ * @version 2018-04-27
+ */
+@MyBatisDao
+public interface ActivityAssignmentDao extends CrudDao<ActivityAssignment> {
+    ActivityAssignment getByUserIdAndDate(ActivityAssignment activityAssignment);
+	
+}

+ 92 - 0
src/main/java/com/jeeplus/modules/activityassignment/entity/ActivityAssignment.java

@@ -0,0 +1,92 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.activityassignment.entity;
+
+import com.jeeplus.modules.sys.entity.User;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * 工作流任务委托Entity
+ * @author 杨帆
+ * @version 2018-04-27
+ */
+public class ActivityAssignment extends DataEntity<ActivityAssignment> {
+	
+	private static final long serialVersionUID = 1L;
+	private String type;		// 委托类型
+	private User user;		// 委托人
+	private Date startDate;		// 委托开始时间
+	private Date endDate;		// 委托结束时间
+	private String companyId;		// 公司id
+	private String view;
+	private String branchOffice;
+	
+	public ActivityAssignment() {
+		super();
+	}
+
+	public ActivityAssignment(String id){
+		super(id);
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+	
+	public User getUser() {
+		return user;
+	}
+
+	public void setUser(User user) {
+		this.user = user;
+	}
+	
+	public Date getStartDate() {
+		return startDate;
+	}
+
+	public void setStartDate(Date startDate) {
+		this.startDate = startDate;
+	}
+	
+	public Date getEndDate() {
+		return endDate;
+	}
+
+	public void setEndDate(Date endDate) {
+		this.endDate = endDate;
+	}
+	
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+
+	public String getView() {
+		return view;
+	}
+
+	public void setView(String view) {
+		this.view = view;
+	}
+
+	public String getBranchOffice() {
+		return branchOffice;
+	}
+
+	public void setBranchOffice(String branchOffice) {
+		this.branchOffice = branchOffice;
+	}
+}

+ 79 - 0
src/main/java/com/jeeplus/modules/activityassignment/service/ActivityAssignmentService.java

@@ -0,0 +1,79 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.activityassignment.service;
+
+import java.util.List;
+
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.activityassignment.entity.ActivityAssignment;
+import com.jeeplus.modules.activityassignment.dao.ActivityAssignmentDao;
+
+/**
+ * 工作流任务委托Service
+ * @author 杨帆
+ * @version 2018-04-27
+ */
+@Service
+@Transactional(readOnly = true)
+public class ActivityAssignmentService extends CrudService<ActivityAssignmentDao, ActivityAssignment> {
+	@Autowired
+	private OfficeService officeService;
+
+	public ActivityAssignment get(String id) {
+		return super.get(id);
+	}
+	
+	public List<ActivityAssignment> findList(ActivityAssignment activityAssignment) {
+		return super.findList(activityAssignment);
+	}
+	
+	public Page<ActivityAssignment> findPage(Page<ActivityAssignment> page, ActivityAssignment activityAssignment) {
+		activityAssignment.setCompanyId(UserUtils.getSelectCompany().getId());
+		if (!UserUtils.isManager()){
+			activityAssignment.setCreateBy(UserUtils.getUser());
+		}else {
+			List<Role> roles = UserUtils.getSelectRole();
+			String branchOffice = "";
+			for (Role role:roles){
+				if (role.getEnname().equals("gly")){
+					branchOffice = "";
+					break;
+				}else if (role.getEnname().equals("fgly")){
+					Office office = officeService.get(role.getOffice());
+					branchOffice += office.getBranchOffice()+",";
+				}
+			}
+			activityAssignment.setBranchOffice(branchOffice);
+			//activityAssignment.getSqlMap().put("dsf", dataScopeFilter(activityAssignment.getCurrentUser(), "o", "u","s"));
+		}
+		return super.findPage(page, activityAssignment);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(ActivityAssignment activityAssignment) {
+		if (StringUtils.isBlank(activityAssignment.getCompanyId())){
+			activityAssignment.setCompanyId(UserUtils.getSelectCompany().getId());
+		}
+		super.save(activityAssignment);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(ActivityAssignment activityAssignment) {
+		super.delete(activityAssignment);
+	}
+	
+	
+	
+	
+}

+ 212 - 0
src/main/java/com/jeeplus/modules/activityassignment/web/ActivityAssignmentController.java

@@ -0,0 +1,212 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.activityassignment.web;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.modules.activityassignment.entity.ActivityAssignment;
+import com.jeeplus.modules.activityassignment.service.ActivityAssignmentService;
+
+/**
+ * 工作流任务委托Controller
+ * @author 杨帆
+ * @version 2018-04-27
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/activityassignment/activityAssignment")
+public class ActivityAssignmentController extends BaseController {
+
+	@Autowired
+	private ActivityAssignmentService activityAssignmentService;
+	
+	@ModelAttribute
+	public ActivityAssignment get(@RequestParam(required=false) String id) {
+		ActivityAssignment entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = activityAssignmentService.get(id);
+		}
+		if (entity == null){
+			entity = new ActivityAssignment();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 工作流任务委托列表页面
+	 */
+	@RequiresPermissions("activityassignment:activityAssignment:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(ActivityAssignment activityAssignment, HttpServletRequest request, HttpServletResponse response, Model model) {
+		activityAssignment.setStartDate(new Date());
+		Page<ActivityAssignment> page = activityAssignmentService.findPage(new Page<ActivityAssignment>(request, response), activityAssignment);
+		List<ActivityAssignment> lists = page.getList();
+		for(int i=0;i< lists.size();i++)
+		{
+			ActivityAssignment e = lists.get(i);
+			String s = e.getRemarks();
+			s = s.replaceAll("\r\n"," ");
+			s = s.replace('\n',' ');
+			e.setRemarks(s);
+			lists.set(i,e);
+		}
+		page.setList(lists);
+		model.addAttribute("page", page);
+		return "modules/activityassignment/activityAssignmentList";
+	}
+
+	/**
+	 * 查看,增加,编辑工作流任务委托表单页面
+	 */
+	@RequiresPermissions(value={"activityassignment:activityAssignment:view","activityassignment:activityAssignment:add","activityassignment:activityAssignment:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(ActivityAssignment activityAssignment, Model model) {
+		model.addAttribute("activityAssignment", activityAssignment);
+		if (activityAssignment!=null && "view".equals(activityAssignment.getView())){
+			return "modules/activityassignment/activityAssignmentView";
+		}
+		return "modules/activityassignment/activityAssignmentForm";
+	}
+
+	/**
+	 * 保存工作流任务委托
+	 */
+	@RequiresPermissions(value={"activityassignment:activityAssignment:add","activityassignment:activityAssignment:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(ActivityAssignment activityAssignment, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, activityAssignment)){
+			return form(activityAssignment, model);
+		}
+		if(!activityAssignment.getIsNewRecord()){//编辑表单保存
+			ActivityAssignment t = activityAssignmentService.get(activityAssignment.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(activityAssignment, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			activityAssignmentService.save(t);//保存
+		}else{//新增表单保存
+			activityAssignmentService.save(activityAssignment);//保存
+		}
+		addMessage(redirectAttributes, "保存工作流任务委托成功");
+		return "redirect:"+Global.getAdminPath()+"/activityassignment/activityAssignment/?repage";
+	}
+	
+	/**
+	 * 删除工作流任务委托
+	 */
+	@RequiresPermissions("activityassignment:activityAssignment:del")
+	@RequestMapping(value = "delete")
+	public String delete(ActivityAssignment activityAssignment, RedirectAttributes redirectAttributes) {
+		activityAssignmentService.delete(activityAssignment);
+		addMessage(redirectAttributes, "删除工作流任务委托成功");
+		return "redirect:"+Global.getAdminPath()+"/activityassignment/activityAssignment/?repage";
+	}
+	
+	/**
+	 * 批量删除工作流任务委托
+	 */
+	@RequiresPermissions("activityassignment:activityAssignment:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			activityAssignmentService.delete(activityAssignmentService.get(id));
+		}
+		addMessage(redirectAttributes, "删除工作流任务委托成功");
+		return "redirect:"+Global.getAdminPath()+"/activityassignment/activityAssignment/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("activityassignment:activityAssignment:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(ActivityAssignment activityAssignment, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "工作流任务委托"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<ActivityAssignment> page = activityAssignmentService.findPage(new Page<ActivityAssignment>(request, response, -1), activityAssignment);
+    		new ExportExcel("工作流任务委托", ActivityAssignment.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出工作流任务委托记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/activityassignment/activityAssignment/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequiresPermissions("activityassignment:activityAssignment:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<ActivityAssignment> list = ei.getDataList(ActivityAssignment.class);
+			for (ActivityAssignment activityAssignment : list){
+				try{
+					activityAssignmentService.save(activityAssignment);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条工作流任务委托记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条工作流任务委托记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入工作流任务委托失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/activityassignment/activityAssignment/?repage";
+    }
+	
+	/**
+	 * 下载导入工作流任务委托数据模板
+	 */
+	@RequiresPermissions("activityassignment:activityAssignment:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "工作流任务委托数据导入模板.xlsx";
+    		List<ActivityAssignment> list = Lists.newArrayList(); 
+    		new ExportExcel("工作流任务委托数据", ActivityAssignment.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/activityassignment/activityAssignment/?repage";
+    }
+	
+	
+	
+
+}

+ 21 - 0
src/main/java/com/jeeplus/modules/alterinfo/dao/AlterInfoDao.java

@@ -0,0 +1,21 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.alterinfo.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.alterinfo.entity.AlterInfo;
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
+
+/**
+ * 变更作废明细DAO接口
+ * @author lw
+ * @version 2018-04-13
+ */
+@MyBatisDao
+public interface AlterInfoDao extends CrudDao<AlterInfo> {
+
+
+    AlterInfo getByContractInfo(WorkContractInfo workContractInfo);
+}

+ 67 - 0
src/main/java/com/jeeplus/modules/alterinfo/entity/AlterInfo.java

@@ -0,0 +1,67 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.alterinfo.entity;
+
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * 变更作废明细Entity
+ * @author lw
+ * @version 2018-04-13
+ */
+public class AlterInfo extends DataEntity<AlterInfo> {
+	
+	private static final long serialVersionUID = 1L;
+	private String reason;		// 原因
+	private String type;		// 模块标识(1:合同)
+	private String beforeId;		// 业务id
+	private String style;		// 业务类型(1:作废2:变更)
+	
+	public AlterInfo() {
+		super();
+	}
+
+	public AlterInfo(String id){
+		super(id);
+	}
+
+	@ExcelField(title="原因", align=2, sort=7)
+	public String getReason() {
+		return reason;
+	}
+
+	public void setReason(String reason) {
+		this.reason = reason;
+	}
+	
+	@ExcelField(title="模块标识", align=2, sort=8)
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+	
+	@ExcelField(title="业务id", align=2, sort=9)
+	public String getBeforeId() {
+		return beforeId;
+	}
+
+	public void setBeforeId(String beforeId) {
+		this.beforeId = beforeId;
+	}
+	
+	@ExcelField(title="业务类型", align=2, sort=10)
+	public String getStyle() {
+		return style;
+	}
+
+	public void setStyle(String style) {
+		this.style = style;
+	}
+	
+}

+ 56 - 0
src/main/java/com/jeeplus/modules/alterinfo/service/AlterInfoService.java

@@ -0,0 +1,56 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.alterinfo.service;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.alterinfo.dao.AlterInfoDao;
+import com.jeeplus.modules.alterinfo.entity.AlterInfo;
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 变更作废明细Service
+ * @author lw
+ * @version 2018-04-13
+ */
+@Service
+@Transactional(readOnly = true)
+public class AlterInfoService extends CrudService<AlterInfoDao, AlterInfo> {
+
+	@Autowired
+	private AlterInfoDao alterInfoDao;
+
+	public AlterInfo get(String id) {
+		return super.get(id);
+	}
+	
+	public List<AlterInfo> findList(AlterInfo alterInfo) {
+		return super.findList(alterInfo);
+	}
+	
+	public Page<AlterInfo> findPage(Page<AlterInfo> page, AlterInfo alterInfo) {
+		return super.findPage(page, alterInfo);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(AlterInfo alterInfo) {
+		super.save(alterInfo);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(AlterInfo alterInfo) {
+		super.delete(alterInfo);
+	}
+
+
+	//作废申请理由
+	public AlterInfo getByContractInfo(WorkContractInfo workContractInfo) {
+		return alterInfoDao.getByContractInfo(workContractInfo);
+	}
+}

+ 196 - 0
src/main/java/com/jeeplus/modules/alterinfo/web/AlterInfoController.java

@@ -0,0 +1,196 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.alterinfo.web;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.modules.alterinfo.entity.AlterInfo;
+import com.jeeplus.modules.alterinfo.service.AlterInfoService;
+
+/**
+ * 变更作废明细Controller
+ * @author lw
+ * @version 2018-04-13
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/alterinfo/alterInfo")
+public class AlterInfoController extends BaseController {
+
+	@Autowired
+	private AlterInfoService alterInfoService;
+	
+	@ModelAttribute
+	public AlterInfo get(@RequestParam(required=false) String id) {
+		AlterInfo entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = alterInfoService.get(id);
+		}
+		if (entity == null){
+			entity = new AlterInfo();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 变更作废明细列表页面
+	 */
+	@RequiresPermissions("alterinfo:alterInfo:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(AlterInfo alterInfo, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<AlterInfo> page = alterInfoService.findPage(new Page<AlterInfo>(request, response), alterInfo); 
+		model.addAttribute("page", page);
+		return "modules/alterinfo/alterInfoList";
+	}
+
+	/**
+	 * 查看,增加,编辑变更作废明细表单页面
+	 */
+	@RequiresPermissions(value={"alterinfo:alterInfo:view","alterinfo:alterInfo:add","alterinfo:alterInfo:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(AlterInfo alterInfo, Model model) {
+		model.addAttribute("alterInfo", alterInfo);
+		return "modules/alterinfo/alterInfoForm";
+	}
+
+	/**
+	 * 保存变更作废明细
+	 */
+	@RequiresPermissions(value={"alterinfo:alterInfo:add","alterinfo:alterInfo:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(AlterInfo alterInfo, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, alterInfo)){
+			return form(alterInfo, model);
+		}
+		if(!alterInfo.getIsNewRecord()){//编辑表单保存
+			AlterInfo t = alterInfoService.get(alterInfo.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(alterInfo, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			alterInfoService.save(t);//保存
+		}else{//新增表单保存
+			alterInfoService.save(alterInfo);//保存
+		}
+		addMessage(redirectAttributes, "保存变更作废明细成功");
+		return "redirect:"+Global.getAdminPath()+"/alterinfo/alterInfo/?repage";
+	}
+	
+	/**
+	 * 删除变更作废明细
+	 */
+	@RequiresPermissions("alterinfo:alterInfo:del")
+	@RequestMapping(value = "delete")
+	public String delete(AlterInfo alterInfo, RedirectAttributes redirectAttributes) {
+		alterInfoService.delete(alterInfo);
+		addMessage(redirectAttributes, "删除变更作废明细成功");
+		return "redirect:"+Global.getAdminPath()+"/alterinfo/alterInfo/?repage";
+	}
+	
+	/**
+	 * 批量删除变更作废明细
+	 */
+	@RequiresPermissions("alterinfo:alterInfo:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			alterInfoService.delete(alterInfoService.get(id));
+		}
+		addMessage(redirectAttributes, "删除变更作废明细成功");
+		return "redirect:"+Global.getAdminPath()+"/alterinfo/alterInfo/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("alterinfo:alterInfo:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(AlterInfo alterInfo, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "变更作废明细"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<AlterInfo> page = alterInfoService.findPage(new Page<AlterInfo>(request, response, -1), alterInfo);
+    		new ExportExcel("变更作废明细", AlterInfo.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出变更作废明细记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/alterinfo/alterInfo/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequiresPermissions("alterinfo:alterInfo:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<AlterInfo> list = ei.getDataList(AlterInfo.class);
+			for (AlterInfo alterInfo : list){
+				try{
+					alterInfoService.save(alterInfo);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条变更作废明细记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条变更作废明细记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入变更作废明细失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/alterinfo/alterInfo/?repage";
+    }
+	
+	/**
+	 * 下载导入变更作废明细数据模板
+	 */
+	@RequiresPermissions("alterinfo:alterInfo:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "变更作废明细数据导入模板.xlsx";
+    		List<AlterInfo> list = Lists.newArrayList(); 
+    		new ExportExcel("变更作废明细数据", AlterInfo.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/alterinfo/alterInfo/?repage";
+    }
+	
+	
+	
+
+}

+ 19 - 0
src/main/java/com/jeeplus/modules/appversion/dao/AppversionsDao.java

@@ -0,0 +1,19 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.appversion.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.appversion.entity.Appversions;
+
+/**
+ * app版本信息DAO接口
+ * @author YangFan
+ * @version 2017-07-07
+ */
+@MyBatisDao
+public interface AppversionsDao extends CrudDao<Appversions> {
+
+	
+}

+ 72 - 0
src/main/java/com/jeeplus/modules/appversion/entity/Appversions.java

@@ -0,0 +1,72 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.appversion.entity;
+
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * app版本信息Entity
+ * @author YangFan
+ * @version 2017-07-07
+ */
+public class Appversions extends DataEntity<Appversions> {
+	
+	private static final long serialVersionUID = 1L;
+	private String versions;		// 版本信息
+	private String files;		// 下载地址
+	private String content;		// 下载地址
+    private String qrcode; //下载二维码
+	private String url;   //URL连接
+
+    public Appversions() {
+		super();
+	}
+
+	public Appversions(String id){
+		super(id);
+	}
+
+    public String getQrcode() {
+        return qrcode;
+    }
+
+    public void setQrcode(String qrcode) {
+        this.qrcode = qrcode;
+    }
+
+	@ExcelField(title="版本信息", align=2, sort=7)
+	public String getVersions() {
+		return versions;
+	}
+
+	public void setVersions(String versions) {
+		this.versions = versions;
+	}
+	
+	@ExcelField(title="下载地址", align=2, sort=8)
+	public String getFiles() {
+		return files;
+	}
+
+	public void setFiles(String files) {
+		this.files = files;
+	}
+
+	public String getContent() {
+		return content;
+	}
+
+	public void setContent(String content) {
+		this.content = content;
+	}
+
+	public String getUrl() {
+		return url;
+	}
+	public void setUrl(String url) {
+		this.url = url;
+	}
+}

+ 57 - 0
src/main/java/com/jeeplus/modules/appversion/service/AppversionsService.java

@@ -0,0 +1,57 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.appversion.service;
+
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.appversion.dao.AppversionsDao;
+import com.jeeplus.modules.appversion.entity.Appversions;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * app版本信息Service
+ * @author YangFan
+ * @version 2017-07-07
+ */
+@Service
+@Transactional(readOnly = true)
+public class AppversionsService extends CrudService<AppversionsDao, Appversions> {
+
+	public Appversions get(String id) {
+		return super.get(id);
+	}
+	
+	public List<Appversions> findList(Appversions appversions) {
+		return super.findList(appversions);
+	}
+	
+	public Page<Appversions> findPage(Page<Appversions> page, Appversions appversions) {
+		return super.findPage(page, appversions);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(Appversions appversions, MultipartFile appFile) {
+		if(appFile !=null && !appFile.isEmpty() && appFile.getSize()>0){
+			OSSClientUtil ossClientUtil = new OSSClientUtil();
+			String aliyunUrl = ossClientUtil.uploadImg2OSSAndroid(appFile, "appData");
+			appversions.setUrl(aliyunUrl);
+		}
+		super.save(appversions);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(Appversions appversions) {
+		super.delete(appversions);
+	}
+
+
+
+
+}

+ 487 - 0
src/main/java/com/jeeplus/modules/appversion/web/AppversionsController.java

@@ -0,0 +1,487 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.appversion.web;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.*;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.appversion.entity.Appversions;
+import com.jeeplus.modules.appversion.service.AppversionsService;
+import com.jeeplus.modules.pushinfo.entity.Pushinfo;
+import com.jeeplus.modules.pushinfo.service.PushinfoService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.tools.utils.TwoDimensionCode;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * app版本信息Controller
+ * @author YangFan
+ * @version 2017-07-07
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/appversion/appversions")
+public class AppversionsController extends BaseController {
+
+	@Autowired
+	private AppversionsService appversionsService;
+	@Autowired
+	private PushinfoService pushinfoService;
+
+	@ModelAttribute
+	public Appversions get(@RequestParam(required=false) String id) {
+		Appversions entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = appversionsService.get(id);
+		}
+		if (entity == null){
+			entity = new Appversions();
+		}
+		return entity;
+	}
+	
+	/**
+	 * app版本信息列表页面
+	 */
+	@RequiresPermissions("appversion:appversions:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(Appversions appversions, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<Appversions> page = appversionsService.findPage(new Page<Appversions>(request, response), appversions);
+		model.addAttribute("page", page);
+		return "modules/appversion/appVersionsList";
+	}
+
+	/**
+	 * 查看,增加,编辑app版本信息表单页面
+	 */
+	@RequiresPermissions(value={"appversion:appversions:view","appversion:appversions:add","appversion:appversions:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(Appversions appversions, Model model,@RequestParam(value = "readAttr",required = false)String readAttr) {
+		model.addAttribute("readAttr",StringUtils.isBlank(readAttr)?"false":"true");
+		model.addAttribute("appversions", appversions);
+		return "modules/appversion/appVersionsForm";
+	}
+
+	/**
+	 *  不使用ckfinder 工具,直接上传到阿里云
+	 * @param appversions
+	 * @param model
+	 * @param request
+	 * @param redirectAttributes
+	 * @return
+	 * @throws Exception
+	 */
+	@RequiresPermissions(value={"appversion:appversions:add","appversion:appversions:edit"},logical=Logical.OR)
+	@RequestMapping(value = "saveFiles")
+	public String saveFiles(Appversions appversions, Model model,HttpServletRequest request, RedirectAttributes redirectAttributes)throws Exception{
+		if (!beanValidator(model, appversions)){
+			return form(appversions, model,"");
+		}
+		String urls = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort();
+		String middUrl = request.getContextPath()+"uploadFiles/appversion";
+		if(!appversions.getIsNewRecord()){//编辑表单保存
+			Appversions t = appversionsService.get(appversions.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(appversions, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			//重新生成二维码
+			createQrCode(t,urls,middUrl);
+			//附件上传
+			fileUpload(request,t);
+			appversionsService.save(t);//保存
+			//推送新版本信息
+			pushAppversionsInfo(t);
+		}else{//新增表单保存
+			if (appversions.getFiles()!=null && appversions.getFiles().contains("|")){
+				appversions.setFiles(appversions.getFiles().replace("|",""));
+			}else {
+				appversions.setFiles("");
+			}
+			//生成二维码
+			createQrCode(appversions,urls,middUrl);
+
+			//附件上传到阿里云
+			InputStream inputStream = null;
+			HttpURLConnection httpURLConnection;
+			if (appversions.getFiles()!=null && !appversions.getFiles().equals("")){
+				String files = appversions.getFiles().replace("|","");
+				try {
+					URL url = new URL(request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+ files);
+					httpURLConnection = (HttpURLConnection) url.openConnection();
+					// 设置网络连接超时时间
+					httpURLConnection.setConnectTimeout(3000);
+					// 设置应用程序要从网络连接读取数据
+					httpURLConnection.setDoInput(true);
+					httpURLConnection.setRequestMethod("GET");
+					int responseCode = httpURLConnection.getResponseCode();
+					if (responseCode == 200) {
+						// 从服务器返回一个输入流
+						inputStream = httpURLConnection.getInputStream();
+					}
+					OSSClientUtil ossUtil =new OSSClientUtil();
+					String[] arr = appversions.getFiles().split("/");
+					logger.info("arr[arr.length-1]="+arr[arr.length-1]);
+					String name = System.currentTimeMillis()+arr[arr.length-1];
+					ossUtil.uploadFile2OSS(inputStream,  Global.getAppData(),name);
+					appversions.setFiles(Global.getAliyunUrl()+"/"+Global.getAppData()+name);
+
+				} catch (MalformedURLException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				} catch (IOException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				} finally {
+					inputStream.close();
+				}
+			}
+			appversionsService.save(appversions);//保存
+			//推送版本更新信息
+			pushAppversionsInfo(appversions);
+		}
+		addMessage(redirectAttributes, "保存app版本信息成功");
+		return "redirect:"+Global.getAdminPath()+"/appversion/appversions/?repage";
+	}
+	/**
+	 * 保存app版本信息
+	 */
+	@RequiresPermissions(value={"appversion:appversions:add","appversion:appversions:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(Appversions appversions, Model model,HttpServletRequest request,
+					   RedirectAttributes redirectAttributes,
+					   @RequestParam(value = "appFile",required = false) MultipartFile appFile) throws Exception{
+		if (!beanValidator(model, appversions)){
+			return form(appversions, model,"");
+		}
+
+		if("ios".equals(appversions.getRemarks().toLowerCase())){
+			//ios版本
+			String iosAddress = "";
+			Properties prop =  new  Properties();
+			InputStream in = this.getClass().getClassLoader().getResourceAsStream("/app-ios.properties");
+			try  {
+				prop.load(in);
+				iosAddress = prop.getProperty( "ios" ).trim();
+
+				appversions.setUrl(iosAddress);
+				//生成并上传二维码到阿里云
+				createQrCode_ios_android(request,appversions,iosAddress,"");
+			}  catch  (IOException e) {
+				e.printStackTrace();
+			}
+			if(!StringUtils.isBlank(iosAddress)){
+				appversions.setUrl(iosAddress);
+			}
+			appversionsService.save(appversions,null);
+		}
+		if("Android".equalsIgnoreCase(appversions.getRemarks())){
+			appversionsService.save(appversions,appFile);
+			//生成并上传二维码到阿里云
+			String aliyunUrl = appversions.getUrl();
+			createQrCode_ios_android(request,appversions,"",aliyunUrl);
+		}
+
+		pushAppversionsInfo(appversions);
+		addMessage(redirectAttributes, "保存app版本信息成功");
+		return "redirect:"+Global.getAdminPath()+"/appversion/appversions/?repage";
+	}
+
+	//附件上传到阿里云
+	public void fileUpload(HttpServletRequest request,Appversions t){
+		InputStream inputStream = null;
+		HttpURLConnection httpURLConnection;
+		if (t.getFiles()!=null && !t.getFiles().equals("")){
+			String files = t.getFiles().replace("|","");
+			try {
+				URL url = new URL(request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+ files);
+				httpURLConnection = (HttpURLConnection) url.openConnection();
+				// 设置网络连接超时时间
+				httpURLConnection.setConnectTimeout(3000);
+				// 设置应用程序要从网络连接读取数据
+				httpURLConnection.setDoInput(true);
+				httpURLConnection.setRequestMethod("GET");
+				int responseCode = httpURLConnection.getResponseCode();
+				if (responseCode == 200) {
+					// 从服务器返回一个输入流
+					inputStream = httpURLConnection.getInputStream();
+				}
+				OSSClientUtil ossUtil =new OSSClientUtil();
+				String[] arr = t.getFiles().split("/");
+				logger.info("arr[arr.length-1]="+arr[arr.length-1]);
+				String name = System.currentTimeMillis()+arr[arr.length-1];
+				ossUtil.uploadFile2OSS(inputStream,  Global.getAppData(),name);
+				t.setFiles(Global.getAliyunUrl()+"/"+Global.getAppData()+name);
+
+			} catch (MalformedURLException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} catch (IOException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} finally {
+				try {
+					if(inputStream != null){
+						inputStream.close();
+					}
+				}catch (IOException e){
+					e.printStackTrace();
+				}
+			}
+		}
+	}
+	/**
+	 * 按照Android或IOS机型分别推送版本更新信息
+	 * @param
+	 */
+	private void pushAppversionsInfo(Appversions appversions){
+		String remarks = appversions.getRemarks();
+		Map extras = new HashMap();
+		String title = "版本更新";
+		String content = appversions.getContent();
+		extras.put("versions",appversions.getVersions());
+		extras.put("type","1002");
+		extras.put("url",appversions.getUrl());
+		//type 1002  url
+
+		JPushClientUtil.sendNotificationTo_Android_or_IOS(remarks,title,content,extras);
+
+		Pushinfo pushinfo = new Pushinfo();
+		pushinfo.setCurrentUser(UserUtils.getUser());
+		pushinfo.setRemarks(appversions.getContent());
+		pushinfo.setUserId(UserUtils.getUser().getId());
+		pushinfo.setType("1002");
+		pushinfo.setPushId(appversions.getId());
+		pushinfo.setTitle(title);
+		pushinfo.setContent(appversions.getVersions()+"版本新功能介绍");
+		pushinfo.setStatus("版本更新");
+		pushinfo.setPushUserId("allpushusers");//
+		pushinfo.setCompanyId(UserUtils.getSelectCompany()==null?"":UserUtils.getSelectCompany().getId());
+		pushinfo.setAddcontent(appversions.getUrl());
+		pushinfo.setMobile(remarks.toLowerCase());
+		pushinfo.setParentType("allVersion");
+
+		pushinfoService.save(pushinfo);
+
+	}
+	//ios的下载地址是固定的,Android的下载地址为阿里云,根据下载地址生成二维码
+	private void createQrCode_ios_android(HttpServletRequest request,Appversions appversions,String iosAddress , String aliyunUrl)throws Exception{
+
+		if(appversions!=null){
+			String filePath = "" ;
+			if(!StringUtils.isBlank(iosAddress)){
+				String iosQrcode_local = request.getSession().getServletContext().getRealPath("local_upload/ios_qrcode/")+System.currentTimeMillis();
+				new File(iosQrcode_local).mkdirs();
+				String name =System.currentTimeMillis()+ ".png";
+				filePath = iosQrcode_local+File.separator+name;
+				//生成二维码
+				TwoDimensionCode.encoderQRCode(iosAddress,filePath,"png");
+			}else if(!StringUtils.isBlank(aliyunUrl)){
+				String androidQrcode_local = request.getSession().getServletContext().getRealPath("local_upload/android_qrcode/")+System.currentTimeMillis();
+				new File(androidQrcode_local).mkdirs();
+				String name =System.currentTimeMillis()+ ".png";
+				filePath = androidQrcode_local+File.separator+name;
+				//生成二维码
+				TwoDimensionCode.encoderQRCode(aliyunUrl,filePath,"png");
+			}
+
+			//上传二维码
+			OSSClientUtil ossUtil = new OSSClientUtil();
+			InputStream inputStream = null;
+			try {
+				inputStream = new FileInputStream(new File(filePath));
+				String qrcodeName = iosAddress+aliyunUrl+System.currentTimeMillis()+filePath.substring(filePath.lastIndexOf("."));
+				ossUtil.uploadFile2OSS(inputStream, Global.getAppData(), qrcodeName);
+				appversions.setQrcode(Global.getAliyunUrl()+"/"+Global.getAppData()+qrcodeName);
+			} catch (Exception e) {
+				e.printStackTrace();
+			} finally {
+				try{
+					if(inputStream != null){
+						inputStream.close();
+					}
+				}catch (Exception e){
+					e.printStackTrace();
+				}
+			}
+		}
+
+	}
+	/**  该方法已废弃;
+	 * 输入字符串,生成二维码信息
+	 * @param appversions
+	 * @param urls
+	 * @param middUrl
+	 * @throws Exception
+	 */
+	private void createQrCode(Appversions appversions,String urls,String middUrl)throws Exception{
+		try {
+			long curr = System.currentTimeMillis();
+			String realPath = Global.getUserfilesBaseDir()+Global.USERFILES_BASE_URL+curr+"/qrcode/";
+			FileUtils.createDirectory(realPath);
+			String name = System.currentTimeMillis()+".png";
+			String filePath = realPath + name;
+
+			if (appversions.getUrl()!=null && !appversions.getUrl().equals("")){
+				String content = appversions.getUrl();
+				logger.error("encodeQrCode.content="+content);
+				TwoDimensionCode.encoderQRCode(content,filePath,"png");//执行生成二维码
+				OSSClientUtil ossUtil =new OSSClientUtil();
+
+				appversions.setQrcode(middUrl+curr+"/qrcode/"+name);
+
+				InputStream inputStream = null;
+				HttpURLConnection httpURLConnection;
+				try {
+					URL url = new URL(urls+appversions.getQrcode());
+					httpURLConnection = (HttpURLConnection) url.openConnection();
+					// 设置网络连接超时时间
+					httpURLConnection.setConnectTimeout(3000);
+					// 设置应用程序要从网络连接读取数据
+					httpURLConnection.setDoInput(true);
+					httpURLConnection.setRequestMethod("GET");
+					int responseCode = httpURLConnection.getResponseCode();
+					if (responseCode == 200) {
+						// 从服务器返回一个输入流
+						inputStream = httpURLConnection.getInputStream();
+					}
+					String[] arr = appversions.getQrcode().split("/");
+					logger.info("arr[arr.length-1]="+arr[arr.length-1]);
+					String qrcodeName = System.currentTimeMillis()+arr[arr.length-1];
+					ossUtil.uploadFile2OSS(inputStream, Global.getAppData(), qrcodeName);
+
+					appversions.setQrcode(Global.getAliyunUrl()+"/"+Global.getAppData()+qrcodeName);
+				} catch (Exception e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				} finally {
+                    inputStream.close();
+                }
+			}
+		}catch (Exception e){
+			e.printStackTrace();
+		}
+	}
+	/**
+	 * 删除app版本信息
+	 */
+	@RequiresPermissions("appversion:appversions:del")
+	@RequestMapping(value = "delete")
+	public String delete(Appversions appversions, RedirectAttributes redirectAttributes) {
+		appversionsService.delete(appversions);
+		addMessage(redirectAttributes, "删除app版本信息成功");
+		return "redirect:"+Global.getAdminPath()+"/appversion/appversions/?repage";
+	}
+	
+	/**
+	 * 批量删除app版本信息
+	 */
+	@RequiresPermissions("appversion:appversions:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			appversionsService.delete(appversionsService.get(id));
+		}
+		addMessage(redirectAttributes, "删除app版本信息成功");
+		return "redirect:"+Global.getAdminPath()+"/appversion/appversions/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("appversion:appversions:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(Appversions appversions, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "app版本信息"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<Appversions> page = appversionsService.findPage(new Page<Appversions>(request, response, -1), appversions);
+    		new ExportExcel("app版本信息", Appversions.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出app版本信息记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/appversion/appversions/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequiresPermissions("appversion:appversions:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<Appversions> list = ei.getDataList(Appversions.class);
+			for (Appversions appversions : list){
+				try{
+					appversionsService.save(appversions);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条app版本信息记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条app版本信息记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入app版本信息失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/appversion/appversions/?repage";
+    }
+	
+	/**
+	 * 下载导入app版本信息数据模板
+	 */
+	@RequiresPermissions("appversion:appversions:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "app版本信息数据导入模板.xlsx";
+    		List<Appversions> list = Lists.newArrayList(); 
+    		new ExportExcel("app版本信息数据", Appversions.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/appversion/appversions/?repage";
+    }
+	
+	
+	
+
+}