| @@ -1,8 +1,8 @@ | |||||
| /hjkjg-web/war/ | |||||
| /hjkjg-web/target/hjkjg-web-2.0.6.RELEASE/ | |||||
| target/ | |||||
| /hjkjg-web/logs/*.log | /hjkjg-web/logs/*.log | ||||
| /hjkjg-web/face_img/ | |||||
| /hjkjg-web/ThinkFaceBackup/ | |||||
| face_img/ | |||||
| ThinkFaceBackup/ | |||||
| ### STS ### | ### STS ### | ||||
| .apt_generated | .apt_generated | ||||
| @@ -12,9 +12,7 @@ | |||||
| <version>2.0.6.RELEASE</version> | <version>2.0.6.RELEASE</version> | ||||
| </parent> | </parent> | ||||
| <name>黄江科技馆票务系统</name> | |||||
| <name>数字人后台管理系统</name> | |||||
| <inceptionYear>2022-Now</inceptionYear> | <inceptionYear>2022-Now</inceptionYear> | ||||
| @@ -151,6 +151,7 @@ public class Application extends SpringBootServletInitializer implements Command | |||||
| @Override | @Override | ||||
| public void run(String... args) throws Exception { | public void run(String... args) throws Exception { | ||||
| deviceServiceSupport.putRedisData(); | deviceServiceSupport.putRedisData(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -17,11 +17,18 @@ public class SendMmsProperties { | |||||
| private String accessKeySecrect; | private String accessKeySecrect; | ||||
| private String endpoint; | private String endpoint; | ||||
| private String signName; | private String signName; | ||||
| private String signNameFront; | |||||
| private String signNameVisitor; | private String signNameVisitor; | ||||
| private String template; | private String template; | ||||
| private String carTemplate; | private String carTemplate; | ||||
| private String fixedTemplate; | private String fixedTemplate; | ||||
| private String codeTemplate; | private String codeTemplate; | ||||
| private String meetingOrderTemplate; | |||||
| private String meetingQuitTemplate; | |||||
| private String meetingRemindTemplate; | |||||
| private String defaultRemindTemplate; | |||||
| private String robotName; | |||||
| private String receptionPhones; | |||||
| public String getAccessKeyId() { | public String getAccessKeyId() { | ||||
| return accessKeyId; | return accessKeyId; | ||||
| @@ -87,6 +94,46 @@ public class SendMmsProperties { | |||||
| this.codeTemplate = codeTemplate; | this.codeTemplate = codeTemplate; | ||||
| } | } | ||||
| public String getSignNameFront() { | |||||
| return signNameFront; | |||||
| } | |||||
| public void setSignNameFront(String signNameFront) { | |||||
| this.signNameFront = signNameFront; | |||||
| } | |||||
| public String getMeetingOrderTemplate() { | |||||
| return meetingOrderTemplate; | |||||
| } | |||||
| public void setMeetingOrderTemplate(String meetingOrderTemplate) { | |||||
| this.meetingOrderTemplate = meetingOrderTemplate; | |||||
| } | |||||
| public String getMeetingQuitTemplate() { | |||||
| return meetingQuitTemplate; | |||||
| } | |||||
| public void setMeetingQuitTemplate(String meetingQuitTemplate) { | |||||
| this.meetingQuitTemplate = meetingQuitTemplate; | |||||
| } | |||||
| public String getMeetingRemindTemplate() { | |||||
| return meetingRemindTemplate; | |||||
| } | |||||
| public void setMeetingRemindTemplate(String meetingRemindTemplate) { | |||||
| this.meetingRemindTemplate = meetingRemindTemplate; | |||||
| } | |||||
| public String getRobotName() { | |||||
| return robotName; | |||||
| } | |||||
| public void setRobotName(String robotName) { | |||||
| this.robotName = robotName; | |||||
| } | |||||
| public String getSignNameVisitor() { | public String getSignNameVisitor() { | ||||
| return signNameVisitor; | return signNameVisitor; | ||||
| } | } | ||||
| @@ -88,6 +88,8 @@ public class WxMpProperties { | |||||
| private String regAuditTemplateId; | private String regAuditTemplateId; | ||||
| private String url; | private String url; | ||||
| private String meetingTemplateId; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -37,6 +37,7 @@ public class AuditController extends WxBaseController { | |||||
| userJson = redisUtils.getUserObject(decodeOpenid); | userJson = redisUtils.getUserObject(decodeOpenid); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| model.addAttribute("msg", e.getMessage()); | model.addAttribute("msg", e.getMessage()); | ||||
| model.addAttribute("type", 1); | |||||
| return "wx/error"; | return "wx/error"; | ||||
| } | } | ||||
| @@ -50,7 +51,7 @@ public class AuditController extends WxBaseController { | |||||
| Date startDate = DateUtils.getPushForwardDate(d, 15); | Date startDate = DateUtils.getPushForwardDate(d, 15); | ||||
| Date endDate = DateUtils.getPushForwardDate(d, -15); | Date endDate = DateUtils.getPushForwardDate(d, -15); | ||||
| if ("employee".equals(userType)) { | |||||
| if ("mgr".equals(userType)) { | |||||
| list= this.auditRecordsService.findListByEmp(startDate, endDate, empCode); | list= this.auditRecordsService.findListByEmp(startDate, endDate, empCode); | ||||
| regList = this.auditRecordsService.findRegListByEmp(startDate, endDate, empCode); | regList = this.auditRecordsService.findRegListByEmp(startDate, endDate, empCode); | ||||
| } else { | } else { | ||||
| @@ -565,6 +565,10 @@ public class VisitApiController extends WxBaseController { | |||||
| String secretKey = Global.getConfig("shiro.loginSubmit.secretKey"); | String secretKey = Global.getConfig("shiro.loginSubmit.secretKey"); | ||||
| userCode = DesUtils.decode(userCode, secretKey); | userCode = DesUtils.decode(userCode, secretKey); | ||||
| User user = UserUtils.get(userCode); | User user = UserUtils.get(userCode); | ||||
| if (null == user) { | |||||
| return outputError(1, "绑定失败,未找到对应账户!"); | |||||
| } | |||||
| if (StringUtils.isNotEmpty(user.getWxOpenid())) { | if (StringUtils.isNotEmpty(user.getWxOpenid())) { | ||||
| return outputError(1, "绑定失败,该账号已绑定别的微信号!"); | return outputError(1, "绑定失败,该账号已绑定别的微信号!"); | ||||
| } else { | } else { | ||||
| @@ -579,9 +583,6 @@ public class VisitApiController extends WxBaseController { | |||||
| u.setWxOpenid(null); | u.setWxOpenid(null); | ||||
| this.userService.update(u); | this.userService.update(u); | ||||
| } | } | ||||
| System.err.println("openid====start"); | |||||
| System.err.println(openid); | |||||
| System.err.println("openid====end"); | |||||
| user.setWxOpenid(openid); | user.setWxOpenid(openid); | ||||
| this.userService.update(user); | this.userService.update(user); | ||||
| // RedisUtils.setUserVariables(user.getWxOpenid(), user.getUserType().equals("estate")?"1":"0"); | // RedisUtils.setUserVariables(user.getWxOpenid(), user.getUserType().equals("estate")?"1":"0"); | ||||
| @@ -204,7 +204,6 @@ public class VisitController extends WxBaseController { | |||||
| String errorMsg = ""; | String errorMsg = ""; | ||||
| //TODO 通知公司管理审核 | |||||
| User mgr = OfficeEmpUtils.getOfficeMgrUser(emp); | User mgr = OfficeEmpUtils.getOfficeMgrUser(emp); | ||||
| if (mgr.getLoginCode().equals(loginCode)) {//管理员自己邀请 | if (mgr.getLoginCode().equals(loginCode)) {//管理员自己邀请 | ||||
| errorMsg = mgrUpdVisitRecord(vr, emp, loginCode); | errorMsg = mgrUpdVisitRecord(vr, emp, loginCode); | ||||
| @@ -283,7 +282,6 @@ public class VisitController extends WxBaseController { | |||||
| VisitRecords vr = this.visitRecordsService.get(visitRecords); | VisitRecords vr = this.visitRecordsService.get(visitRecords); | ||||
| String errorMsg = ""; | String errorMsg = ""; | ||||
| //TODO 通知公司管理审核 | |||||
| User mgr = OfficeEmpUtils.getOfficeMgrUser(emp); | User mgr = OfficeEmpUtils.getOfficeMgrUser(emp); | ||||
| if (mgr.getLoginCode().equals(loginCode)) {//管理账户本身修改 | if (mgr.getLoginCode().equals(loginCode)) {//管理账户本身修改 | ||||
| errorMsg = mgrUpdVisitRecord(vr, emp, loginCode); | errorMsg = mgrUpdVisitRecord(vr, emp, loginCode); | ||||
| @@ -382,6 +380,7 @@ public class VisitController extends WxBaseController { | |||||
| userJson = redisUtils.getUserObject(decodeOpenid); | userJson = redisUtils.getUserObject(decodeOpenid); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| model.addAttribute("msg", e.getMessage()); | model.addAttribute("msg", e.getMessage()); | ||||
| model.addAttribute("type", 1); | |||||
| return "wx/error"; | return "wx/error"; | ||||
| } | } | ||||
| @@ -448,6 +447,7 @@ public class VisitController extends WxBaseController { | |||||
| userJson = redisUtils.getUserObject(decodeOpenid); | userJson = redisUtils.getUserObject(decodeOpenid); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| model.addAttribute("msg", e.getMessage()); | model.addAttribute("msg", e.getMessage()); | ||||
| model.addAttribute("type", 1); | |||||
| return "wx/error"; | return "wx/error"; | ||||
| } | } | ||||
| @@ -570,13 +570,7 @@ public class VisitController extends WxBaseController { | |||||
| System.err.println(officeCodeList); | System.err.println(officeCodeList); | ||||
| System.err.println(officeCodeList.size()); | System.err.println(officeCodeList.size()); | ||||
| //Sec-admin filter | //Sec-admin filter | ||||
| String loginCode = UserUtils.getUser().getLoginCode(); | |||||
| if (BusinessUtils.isSecAdmin(loginCode) ) { | |||||
| if (!ObjectUtils.anyNotNull(officeCodeList)) | |||||
| officeCodeList = userDataScopeService.getOfficeCodeByUserCode(UserUtils.getUser().getUserCode()); | |||||
| if (officeCodeList == null || officeCodeList.size() <= 0) { | |||||
| return page; | |||||
| } | |||||
| if (officeCodeList.size()>0) { | |||||
| findEmp.setOfficeCode_in(officeCodeList.toArray(new String[officeCodeList.size()])); | findEmp.setOfficeCode_in(officeCodeList.toArray(new String[officeCodeList.size()])); | ||||
| } | } | ||||
| /*if (!"0".equals(emp.getEmpType())) { | /*if (!"0".equals(emp.getEmpType())) { | ||||
| @@ -4,6 +4,7 @@ import com.jeesite.common.codec.DesUtils; | |||||
| import com.jeesite.common.config.Global; | import com.jeesite.common.config.Global; | ||||
| import com.jeesite.common.lang.ObjectUtils; | import com.jeesite.common.lang.ObjectUtils; | ||||
| import com.jeesite.common.lang.StringUtils; | import com.jeesite.common.lang.StringUtils; | ||||
| import com.jeesite.common.shiro.authc.FormToken; | |||||
| import com.jeesite.common.web.http.ServletUtils; | import com.jeesite.common.web.http.ServletUtils; | ||||
| import com.jeesite.modules.sys.entity.User; | import com.jeesite.modules.sys.entity.User; | ||||
| import com.jeesite.modules.sys.service.OfficeService; | import com.jeesite.modules.sys.service.OfficeService; | ||||
| @@ -60,57 +61,48 @@ public class WxFrontController extends WxBaseController { | |||||
| @RequestMapping(value = "/access-token", method = RequestMethod.GET) | @RequestMapping(value = "/access-token", method = RequestMethod.GET) | ||||
| public void accessToken(@RequestParam("code") String code, @RequestParam(value = "redirect", required = false) String redirect, HttpServletRequest request, HttpServletResponse response) { | public void accessToken(@RequestParam("code") String code, @RequestParam(value = "redirect", required = false) String redirect, HttpServletRequest request, HttpServletResponse response) { | ||||
| try { | try { | ||||
| String baseUrl = Global.getConfig("sys.baseUrl"); | |||||
| WxOAuth2AccessToken wot = this.wxService.getOAuth2Service().getAccessToken(code); | WxOAuth2AccessToken wot = this.wxService.getOAuth2Service().getAccessToken(code); | ||||
| String openid = wot.getOpenId(); | String openid = wot.getOpenId(); | ||||
| String secretKey = Global.getConfig("shiro.loginSubmit.secretKey"); | String secretKey = Global.getConfig("shiro.loginSubmit.secretKey"); | ||||
| String encodeStr = DesUtils.encode(openid, secretKey); | |||||
| if (StringUtils.isNotEmpty(redirect) && !("null".equals(redirect))) { | |||||
| String userType = "0"; | |||||
| /*if (StringUtils.isNotEmpty(redirect) && !("null".equals(redirect))) { | |||||
| response.sendRedirect(redirect+"/"+encodeStr); | response.sendRedirect(redirect+"/"+encodeStr); | ||||
| } else { | } else { | ||||
| response.sendRedirect(Global.getFrontPath()+"/ticket/topIndex/"+encodeStr); | response.sendRedirect(Global.getFrontPath()+"/ticket/topIndex/"+encodeStr); | ||||
| } | |||||
| }*/ | |||||
| // userCode = DesUtils.decode(userCode, secretKey); | // userCode = DesUtils.decode(userCode, secretKey); | ||||
| /*User user = this.userDao.findByWxOpenid(openid, userType); | |||||
| UserUtils.getSubject().logout(); | |||||
| // userCode = DesUtils.decode(userCode, secretKey); | |||||
| User user = this.userDao.findByWxOpenid(openid, userType); | |||||
| // UserUtils.getSubject().logout(); | |||||
| if (ObjectUtils.anyNotNull(user)) {//如果有对应员工 | if (ObjectUtils.anyNotNull(user)) {//如果有对应员工 | ||||
| // Sess | |||||
| *//*String username = user.getLoginCode(); | |||||
| FormToken formToken = new FormToken(); | |||||
| formToken.setUsername(username); | |||||
| formToken.setSsoToken(UserUtils.getSsoToken(username)); | |||||
| //formToken.setParams(ServletUtils.getExtParams(request)); | |||||
| UserUtils.getSubject().login(formToken); | |||||
| String sid = UserUtils.getSession().getId().toString(); | |||||
| System.out.println("登录成功,__sid=" + sid);*//* | |||||
| String encodeStr = DesUtils.encode(userType+openid, secretKey); | |||||
| request.getSession().setAttribute("openId", userType+openid); | |||||
| if (StringUtils.isNotEmpty(redirect)) { | if (StringUtils.isNotEmpty(redirect)) { | ||||
| response.sendRedirect(redirect+"/"+encodeStr); | |||||
| response.sendRedirect(redirect); | |||||
| // ServletUtils.redirectUrl(request, response, redirect); | |||||
| } else { | } else { | ||||
| response.sendRedirect(baseUrl+"/account2/info/"+encodeStr); | |||||
| String openidStr = DesUtils.encode(userType+openid,secretKey); | |||||
| response.sendRedirect(baseUrl+"/account2/info/"+openidStr); | |||||
| // ServletUtils.redirectUrl(request, response, baseUrl+"/account2/info"); | |||||
| } | } | ||||
| } else { | } else { | ||||
| *//*Cookie cookie = new Cookie("type", type); | |||||
| Cookie cookie2 = new Cookie("openid", wot.getOpenId()); | |||||
| cookie.setPath("/"); | |||||
| cookie.setMaxAge(3600); | |||||
| response.addCookie(cookie); | |||||
| response.addCookie(cookie2);*//* | |||||
| openid = DesUtils.encode(openid, secretKey);; | openid = DesUtils.encode(openid, secretKey);; | ||||
| if ("0".equals(userType)) { | |||||
| ServletUtils.redirectUrl(request, response, baseUrl+"/account2/regUser?type="+type+"&openid=" + openid); | |||||
| } else { | |||||
| ServletUtils.redirectUrl(request, response, baseUrl + "/account2/login?type="+type+"&openid=" + openid); | |||||
| } | |||||
| ServletUtils.redirectUrl(request, response, baseUrl+"/account2/regUser?type="+userType+"&openid=" + openid); | |||||
| } | } | ||||
| */ | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| } | } | ||||
| @@ -0,0 +1,375 @@ | |||||
| package com.lecoo.kjg.web.meeting.api; | |||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.jeesite.common.collect.ListUtils; | |||||
| import com.jeesite.common.lang.StringUtils; | |||||
| import com.jeesite.modules.sys.entity.Office; | |||||
| import com.jeesite.modules.sys.entity.User; | |||||
| import com.jeesite.modules.sys.service.OfficeService; | |||||
| import com.jeesite.modules.sys.utils.UserUtils; | |||||
| import com.lecoo.kjg.http.MyResponse; | |||||
| import com.lecoo.kjg.web.meeting.dao.MeetingRoomDao; | |||||
| import com.lecoo.kjg.web.meeting.dao.MeetingRoomOrderDao; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoom; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoomOrder; | |||||
| import com.lecoo.kjg.web.meeting.service.MeetingRoomOrderService; | |||||
| import com.lecoo.kjg.web.meeting.service.MeetingRoomService; | |||||
| import com.lecoo.kjg.web.sys.constant.ResponseCode; | |||||
| import com.lecoo.kjg.web.sys.entity.Emp; | |||||
| import com.lecoo.kjg.web.sys.service.EmpService; | |||||
| import com.lecoo.kjg.web.sys.utils.DateUtils; | |||||
| import com.lecoo.kjg.web.sys.utils.JasyptUtil; | |||||
| import com.lecoo.kjg.web.sys.utils.SendUtil; | |||||
| import com.lecoo.kjg.web.sys.web.BaseController; | |||||
| import me.chanjar.weixin.common.error.WxErrorException; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.http.MediaType; | |||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.validation.Valid; | |||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.Arrays; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @RestController | |||||
| @RequestMapping(value = "/api/meeting", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) | |||||
| public class MeetingApiController extends BaseController { | |||||
| @Autowired | |||||
| private MeetingRoomOrderDao meetingRoomOrderDao; | |||||
| @Autowired | |||||
| private MeetingRoomDao meetingRoomDao; | |||||
| @Autowired | |||||
| private MeetingRoomService meetingRoomService; | |||||
| @Autowired | |||||
| private SendUtil sendUtil; | |||||
| @Autowired | |||||
| private EmpService empService; | |||||
| @ResponseBody | |||||
| @RequestMapping(value = "/new-order", method = RequestMethod.POST) | |||||
| @Transactional | |||||
| public Object upload(@Valid MeetingRoomOrder order, HttpServletRequest request) { | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); | |||||
| SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| String dateStr = sdf2.format(order.getOrderDate()); | |||||
| String timeStr = sdf.format(order.getOrderDate()); | |||||
| if (order.getOrderDate().before(new Date())) { | |||||
| return output(ResponseCode.MEETING_ORDER_TIME_ERROR); | |||||
| } | |||||
| order.setOrderTime(order.getOrderDate()); | |||||
| order.setIsNewRecord(true); | |||||
| Date endDate = DateUtils.addMinutes(order.getOrderTime(), order.getMeetingDuration()); | |||||
| order.setEndTime(endDate); | |||||
| String endTimeStr = sdf.format(order.getEndTime()); | |||||
| List<MeetingRoomOrder> list = meetingRoomOrderDao.queryByOrder(order.getRoomId(), dateStr, timeStr, endTimeStr); | |||||
| if (list.size() > 0) { | |||||
| return output(ResponseCode.MEETING_ORDER_CONFLICT); | |||||
| } else { | |||||
| String userCode = empService.get(order.getOrderBy()).getJobNumber(); | |||||
| User u = UserUtils.get(userCode); | |||||
| order.setOrderByEmp(u.getUserName()); | |||||
| meetingRoomOrderDao.insert(order); | |||||
| MeetingRoomOrder newMro = meetingRoomOrderDao.findLastByEmpId(order.getOrderBy()); | |||||
| MeetingRoom meetingRoom = meetingRoomService.get(order.getRoomId().toString()); | |||||
| SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| SimpleDateFormat dateFormat2 = new SimpleDateFormat("HH:mm"); | |||||
| newMro.setMeetingRoom(meetingRoom); | |||||
| String mms = dateFormat1.format(newMro.getOrderDate())+" "+dateFormat2.format( newMro.getOrderTime())+"于"+newMro.getMeetingRoom().getName(); | |||||
| newMro.setOrderData(mms); | |||||
| try { | |||||
| if (null != u && StringUtils.isNotEmpty(u.getWxOpenid())) { | |||||
| // sendUtil.sendToUser(u.getWxOpenid(), "恭喜您,预订会议室成功", newMro, 1); | |||||
| sendUtil.sendTempMmsMeeting(u.getMobile(), newMro, 1); | |||||
| } | |||||
| } catch (WxErrorException e) { | |||||
| e.printStackTrace(); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return outputSuccess(); | |||||
| } | |||||
| } | |||||
| @ResponseBody | |||||
| @RequestMapping(value = "/quit-order", method = RequestMethod.POST) | |||||
| @Transactional | |||||
| public Object quit(@Valid MeetingRoomOrder order, HttpServletRequest request) { | |||||
| MeetingRoomOrder mro = meetingRoomOrderDao.get(order); | |||||
| SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| SimpleDateFormat dateFormat2 = new SimpleDateFormat("HH:mm"); | |||||
| MeetingRoom meetingRoom = meetingRoomService.get(mro.getRoomId().toString()); | |||||
| mro.setMeetingRoom(meetingRoom); | |||||
| String mms = dateFormat1.format(mro.getOrderDate())+" "+dateFormat2.format( mro.getOrderTime())+"于"+mro.getMeetingRoom().getName(); | |||||
| mro.setOrderData(mms); | |||||
| if (null == mro) { | |||||
| return output(ResponseCode.MEETING_RECORD_NOT_FOUND); | |||||
| } else { | |||||
| String userCode = empService.get(mro.getOrderBy()).getJobNumber(); | |||||
| User u = UserUtils.get(userCode); | |||||
| try { | |||||
| if (null != u && StringUtils.isNotEmpty(u.getWxOpenid())) { | |||||
| // sendUtil.sendToUser(u.getWxOpenid(), "您好,您取消会议室成功", mro, 2); | |||||
| sendUtil.sendTempMmsMeeting(u.getMobile(), mro, 2); | |||||
| } | |||||
| } catch (WxErrorException e) { | |||||
| e.printStackTrace(); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| meetingRoomOrderDao.phyDelete(mro); | |||||
| return outputSuccess(); | |||||
| } | |||||
| } | |||||
| @ResponseBody | |||||
| @RequestMapping(value = "/lists", method = RequestMethod.POST) | |||||
| @Transactional | |||||
| public MyResponse list(String dateStr, Integer roomId) { | |||||
| return outputData(0, meetingRoomOrderDao.findListByDate(dateStr, roomId)); | |||||
| } | |||||
| @ResponseBody | |||||
| @RequestMapping(value = "/listsByDate", method = RequestMethod.POST) | |||||
| @Transactional | |||||
| public MyResponse listByDate(String dateStr, String officeCode) { | |||||
| return outputData(0, meetingRoomOrderDao.findListByDateStr(dateStr, officeCode)); | |||||
| } | |||||
| @Autowired | |||||
| private OfficeService officeService; | |||||
| @ResponseBody | |||||
| @RequestMapping(value = "/person-lists", method = RequestMethod.POST) | |||||
| @Transactional | |||||
| public MyResponse personList(String orderBy) { | |||||
| return outputData(0, meetingRoomOrderDao.findListByPerson(orderBy)); | |||||
| } | |||||
| @ResponseBody | |||||
| @RequestMapping(value = "/room-lists", method = RequestMethod.POST) | |||||
| @Transactional | |||||
| public MyResponse roomList(@RequestParam(required = false) String officeCode) { | |||||
| Office o = null; | |||||
| if (StringUtils.isNotEmpty(officeCode)) { | |||||
| o = officeService.get(officeCode); | |||||
| if (o == null){ | |||||
| outputData(-1, "传入的officeCode非法"); | |||||
| } | |||||
| } else { | |||||
| o = officeService.get("6123731313956274818");//默认恒昌 | |||||
| } | |||||
| String offices = o.getParentCodes(); | |||||
| System.err.println(offices); | |||||
| List<String> list = ListUtils.newArrayList(offices.split(",")); | |||||
| list.add(o.getOfficeCode()); | |||||
| MeetingRoom mr = new MeetingRoom(); | |||||
| mr.setOffice_in(list); | |||||
| System.err.println(list); | |||||
| return outputData(0, meetingRoomDao.findList(mr)); | |||||
| } | |||||
| @ResponseBody | |||||
| @RequestMapping(value = "/test") | |||||
| public MyResponse test() { | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); | |||||
| SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| Date d1 = DateUtils.parseStrToDate("2023-01-29 14:11", "yyyy-MM-dd HH:mm"); | |||||
| String s1 = sdf.format(d1); | |||||
| String s2 = sdf2.format(d1); | |||||
| System.err.println(s1); | |||||
| System.err.println(s2); | |||||
| return outputData(0, s1); | |||||
| } | |||||
| @ResponseBody | |||||
| @RequestMapping(value = "/new-order2", method = RequestMethod.POST) | |||||
| @Transactional | |||||
| public Object upload2(@Valid MeetingRoomOrder order, HttpServletRequest request) { | |||||
| String orderData = order.getOrderData(); | |||||
| JSONArray jsonArray = JSONArray.parseArray(orderData); | |||||
| System.err.println(orderData); | |||||
| System.err.println(jsonArray); | |||||
| if (!(jsonArray.size()>0)) { | |||||
| return output(ResponseCode.CHECK_PARAMS_ERROR, "orderData"); | |||||
| } | |||||
| List<MeetingRoomOrder> list = ListUtils.newArrayList(); | |||||
| String userCode = empService.get(order.getOrderBy()).getJobNumber(); | |||||
| User u = UserUtils.get(userCode); | |||||
| String mms = ""; | |||||
| SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| SimpleDateFormat dateFormat2 = new SimpleDateFormat("HH:mm"); | |||||
| for (Object js : jsonArray) { | |||||
| JSONObject temp = (JSONObject) js; | |||||
| String date = temp.getString("date"); | |||||
| JSONArray timeList = temp.getJSONArray("timeList"); | |||||
| for (Object timeStr: timeList) { | |||||
| String times = (String)timeStr; | |||||
| String[] timeAry = times.split("-"); | |||||
| Date orderDate = DateUtils.parseStrToDate(date+" "+timeAry[0], "yyyy-MM-dd HH:mm"); | |||||
| Date endDate = DateUtils.parseStrToDate(date+" "+timeAry[1], "yyyy-MM-dd HH:mm"); | |||||
| Integer duration = DateUtils.dateDiffMin(orderDate, endDate); | |||||
| if (orderDate.before(new Date())) { | |||||
| return output(ResponseCode.MEETING_ORDER_TIME_ERROR); | |||||
| } | |||||
| List<MeetingRoomOrder> lists = meetingRoomOrderDao.queryByOrder(order.getRoomId(), date, timeAry[0], timeAry[1]); | |||||
| if (lists.size() > 0) { | |||||
| return output(ResponseCode.MEETING_ORDER_CONFLICT); | |||||
| } | |||||
| MeetingRoomOrder mm = new MeetingRoomOrder(); | |||||
| mm.setOrderBy(order.getOrderBy()); | |||||
| mm.setRoomId(order.getRoomId()); | |||||
| mm.setMeetingTitle(order.getMeetingTitle()); | |||||
| mm.setMeetingDuration(duration); | |||||
| mm.setOrderDate(orderDate); | |||||
| mm.setOrderTime(orderDate); | |||||
| mm.setEndTime(endDate); | |||||
| mm.setIsNewRecord(true); | |||||
| mm.setOrderByEmp(u.getUserName()); | |||||
| list.add(mm); | |||||
| mms += dateFormat1.format(mm.getOrderDate())+" "+dateFormat2.format( mm.getOrderTime())+","; | |||||
| } | |||||
| } | |||||
| meetingRoomOrderDao.insertBatch(list); | |||||
| MeetingRoomOrder newMro = meetingRoomOrderDao.findLastByEmpId(order.getOrderBy()); | |||||
| MeetingRoom meetingRoom = meetingRoomService.get(order.getRoomId().toString()); | |||||
| mms = mms.substring(0, mms.length()-1)+"于"+meetingRoom.getName(); | |||||
| newMro.setOrderData(mms); | |||||
| try { | |||||
| if (null != u && StringUtils.isNotEmpty(u.getWxOpenid())) { | |||||
| // sendUtil.sendToUser(u.getWxOpenid(), "恭喜您,预订会议室成功", newMro, 1); | |||||
| sendUtil.sendTempMmsMeeting(u.getMobile(), newMro, 1); | |||||
| } | |||||
| } catch (WxErrorException e) { | |||||
| e.printStackTrace(); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return outputSuccess(); | |||||
| } | |||||
| @ResponseBody | |||||
| @RequestMapping(value = "/quit-order2", method = RequestMethod.POST) | |||||
| @Transactional | |||||
| public Object quit2(@RequestParam(required = true) String ids) { | |||||
| String mms = ""; | |||||
| JSONArray idList = JSONArray.parseArray(ids); | |||||
| List<MeetingRoomOrder> list = ListUtils.newArrayList(); | |||||
| for (Object id : idList) { | |||||
| String idStr = String.valueOf(id); | |||||
| MeetingRoomOrder mro = meetingRoomOrderService.get(idStr); | |||||
| SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| SimpleDateFormat dateFormat2 = new SimpleDateFormat("HH:mm"); | |||||
| if (null == mro) { | |||||
| return output(ResponseCode.MEETING_RECORD_NOT_FOUND); | |||||
| } else { | |||||
| list.add(mro); | |||||
| } | |||||
| mms += dateFormat1.format(mro.getOrderDate())+" "+dateFormat2.format( mro.getOrderTime())+","; | |||||
| } | |||||
| MeetingRoomOrder mmrroo = list.get(0); | |||||
| String userCode = empService.get(mmrroo.getOrderBy()).getJobNumber(); | |||||
| User u = UserUtils.get(userCode); | |||||
| MeetingRoom meetingRoom = meetingRoomService.get(mmrroo.getRoomId().toString()); | |||||
| mms = mms.substring(0, mms.length()-1)+"于"+meetingRoom.getName(); | |||||
| mmrroo.setOrderData(mms); | |||||
| try { | |||||
| if (null != u && StringUtils.isNotEmpty(u.getWxOpenid())) { | |||||
| // sendUtil.sendToUser(u.getWxOpenid(), "您好,您取消会议室成功", mro, 2); | |||||
| sendUtil.sendTempMmsMeeting(u.getMobile(), mmrroo, 2); | |||||
| } | |||||
| } catch (WxErrorException e) { | |||||
| e.printStackTrace(); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| for(MeetingRoomOrder mr : list) { | |||||
| meetingRoomOrderDao.phyDelete(mr); | |||||
| } | |||||
| return outputSuccess(); | |||||
| } | |||||
| @Autowired | |||||
| private MeetingRoomOrderService meetingRoomOrderService; | |||||
| @ResponseBody | |||||
| @RequestMapping(value = "/test2") | |||||
| public MyResponse test2(String orderDate, String orderTime, String endTime) { | |||||
| // List<Long> ls = meetingRoomOrderService.getAbleOrderList(orderDate,orderTime,endTime); | |||||
| int[] height = {0,1,0,2,1,0,1,3,2,1,2,3}; | |||||
| int count = trap(height); | |||||
| return outputData(0, count); | |||||
| } | |||||
| public int trap(int[] height) { | |||||
| int len = height.length; | |||||
| if (len < 3) { | |||||
| return 0; | |||||
| } | |||||
| int max = height[0], maxInd = 0; | |||||
| for (int ind = 1; ind < len; ind++) { | |||||
| if (height[ind] > max) { | |||||
| max = height[ind]; | |||||
| maxInd = ind; | |||||
| } | |||||
| } | |||||
| int i = 0, j = height.length - 1; | |||||
| int count = 0, l = 0, r = height.length - 1; | |||||
| while (l < r) { | |||||
| if (l < maxInd) { | |||||
| i++; | |||||
| if (height[i] < height[l]) { | |||||
| count += height[l] - height[i]; | |||||
| } else { | |||||
| l = i; | |||||
| } | |||||
| } | |||||
| if (r > maxInd) { | |||||
| j--; | |||||
| if (height[j] < height[r]) { | |||||
| count += height[r] - height[j]; | |||||
| } else { | |||||
| r = j; | |||||
| } | |||||
| } | |||||
| } | |||||
| return count; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,88 @@ | |||||
| package com.lecoo.kjg.web.meeting.controller; | |||||
| import com.jeesite.common.entity.Page; | |||||
| import com.jeesite.common.lang.StringUtils; | |||||
| import com.jeesite.common.mybatis.mapper.query.QueryType; | |||||
| import com.jeesite.common.web.s.M; | |||||
| import com.lecoo.kjg.web.meeting.dao.MeetingRoomDao; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoom; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoomOrder; | |||||
| import com.lecoo.kjg.web.meeting.service.MeetingRoomOrderService; | |||||
| import com.lecoo.kjg.web.sys.dao.TouristDao; | |||||
| import com.lecoo.kjg.web.sys.entity.Emp; | |||||
| import com.lecoo.kjg.web.sys.service.BlackRoleService; | |||||
| import com.lecoo.kjg.web.sys.service.EmpService; | |||||
| import com.lecoo.kjg.web.sys.web.BaseController; | |||||
| 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.ResponseBody; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.util.List; | |||||
| import java.util.stream.Collectors; | |||||
| @Controller | |||||
| @RequestMapping(value = "${adminPath}/sys/meeting") | |||||
| public class MeetingController extends BaseController { | |||||
| @Autowired | |||||
| private TouristDao touristDao; | |||||
| @Autowired | |||||
| private BlackRoleService blackRoleService; | |||||
| @Autowired | |||||
| private MeetingRoomOrderService meetingRoomOrderService; | |||||
| /** | |||||
| * 根据条件查询会议室预订 | |||||
| * | |||||
| * @param request | |||||
| * @param response | |||||
| * @return | |||||
| */ | |||||
| @RequiresPermissions("user") | |||||
| @RequestMapping(value = "/listData") | |||||
| @ResponseBody | |||||
| public Page<MeetingRoomOrder> listData(MeetingRoomOrder meetingRoomOrder, HttpServletRequest request, HttpServletResponse response) { | |||||
| String timePart = meetingRoomOrder.getTimePart(); | |||||
| if (StringUtils.isNotEmpty(timePart)) { | |||||
| String[] times = timePart.split(" ~ "); | |||||
| meetingRoomOrder.getSqlMap().getWhere().andBracket("order_date", QueryType.LTE, times[1]+" 23:59:59",1).and("order_date", QueryType.GTE, times[0],2).endBracket(1); | |||||
| } | |||||
| String optionName = meetingRoomOrder.getOptionName(); | |||||
| if (!StringUtils.isEmpty(optionName)) { | |||||
| meetingRoomOrder.getSqlMap().getWhere().andBracket("order_by_emp",QueryType.LIKE, optionName,2).or("meeting_title", QueryType.LIKE, optionName).endBracket(2); | |||||
| } | |||||
| System.err.println(meetingRoomOrder.getSqlMap().getWhere().toSql()); | |||||
| Page<MeetingRoomOrder> pages = meetingRoomOrderService.findPage(new Page<>(request, response), meetingRoomOrder); | |||||
| return pages; | |||||
| } | |||||
| @Autowired | |||||
| private MeetingRoomDao meetingRoomDao; | |||||
| @Autowired | |||||
| private EmpService empService; | |||||
| @RequiresPermissions("user") | |||||
| @RequestMapping(value = "/list") | |||||
| public String list(Model model, HttpServletRequest request, HttpServletResponse response) { | |||||
| // public Page<VisitRecords> list(HttpServletRequest request, HttpServletResponse response) { | |||||
| List<MeetingRoom> list = meetingRoomDao.findList(new MeetingRoom()); | |||||
| model.addAttribute("roomList", list); | |||||
| return "modules/sys/meeting/list"; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,141 @@ | |||||
| package com.lecoo.kjg.web.meeting.controller; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.jeesite.common.codec.DesUtils; | |||||
| import com.jeesite.common.config.Global; | |||||
| import com.jeesite.common.lang.ObjectUtils; | |||||
| import com.jeesite.common.lang.StringUtils; | |||||
| import com.jeesite.common.web.http.ServletUtils; | |||||
| import com.jeesite.modules.sys.entity.User; | |||||
| import com.jeesite.modules.sys.entity.UserDataScope; | |||||
| import com.jeesite.modules.sys.service.OfficeService; | |||||
| import com.jeesite.modules.sys.utils.UserUtils; | |||||
| import com.lecoo.kjg.web.config.RecordStatus; | |||||
| import com.lecoo.kjg.web.config.WxMpProperties; | |||||
| import com.lecoo.kjg.web.controller.WxBaseController; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoom; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoomOrder; | |||||
| import com.lecoo.kjg.web.meeting.service.MeetingRoomOrderService; | |||||
| import com.lecoo.kjg.web.meeting.service.MeetingRoomService; | |||||
| import com.lecoo.kjg.web.sys.dao.EmpDao; | |||||
| import com.lecoo.kjg.web.sys.dao.UserExtraDao; | |||||
| import com.lecoo.kjg.web.sys.dao.VisitRecordsDao; | |||||
| import com.lecoo.kjg.web.sys.entity.AuditRecords; | |||||
| import com.lecoo.kjg.web.sys.entity.Emp; | |||||
| import com.lecoo.kjg.web.sys.entity.VisitRecords; | |||||
| import com.lecoo.kjg.web.sys.service.EmpService; | |||||
| import com.lecoo.kjg.web.sys.utils.DateUtils; | |||||
| import com.lecoo.kjg.web.sys.utils.RedisUtils; | |||||
| import lombok.AllArgsConstructor; | |||||
| import me.chanjar.weixin.common.api.WxConsts; | |||||
| import me.chanjar.weixin.common.bean.WxJsapiSignature; | |||||
| import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken; | |||||
| import me.chanjar.weixin.common.error.WxErrorException; | |||||
| import me.chanjar.weixin.mp.api.WxMpService; | |||||
| import org.apache.http.HttpResponse; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Controller; | |||||
| import org.springframework.ui.Model; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.io.IOException; | |||||
| import java.security.NoSuchAlgorithmException; | |||||
| import java.util.ArrayList; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import java.util.stream.Collectors; | |||||
| @AllArgsConstructor | |||||
| @Controller | |||||
| @RequestMapping("${frontPath}/wx/meeting") | |||||
| public class MeetingFrontController extends WxBaseController { | |||||
| @Autowired | |||||
| private MeetingRoomOrderService meetingRoomOrderService; | |||||
| @Autowired | |||||
| private RedisUtils redisUtils; | |||||
| @Autowired | |||||
| private EmpService empService; | |||||
| @Autowired | |||||
| private EmpDao empDao; | |||||
| @Autowired | |||||
| private MeetingRoomService meetingRoomService; | |||||
| @RequestMapping(value = "/info/{id}") | |||||
| public String photo(Model model, @PathVariable(required = true) String id) { | |||||
| try { | |||||
| MeetingRoomOrder mro = meetingRoomOrderService.get(id); | |||||
| if (null != mro) { | |||||
| model.addAttribute("meetingRoomOrder", mro); | |||||
| Emp emp = mro.getEmp(); | |||||
| User user = UserUtils.get(emp.getJobNumber()); | |||||
| JSONObject userJson = redisUtils.getUserObject("0"+user.getWxOpenid()); | |||||
| model.addAttribute("userJson", userJson); | |||||
| return "modules/sys/meeting/meetingInfo"; | |||||
| } else { | |||||
| model.addAttribute("msg", "无指定的预约记录"); | |||||
| model.addAttribute("type", 1); | |||||
| return "wx/error"; | |||||
| } | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| model.addAttribute("msg", e.getMessage()); | |||||
| model.addAttribute("type", 1); | |||||
| return "wx/error"; | |||||
| } | |||||
| } | |||||
| @RequestMapping(value = "/my-meeting/{openid}") | |||||
| public String myMeeting(Model model, @PathVariable(required = true) Object openid){ | |||||
| String secretKey = Global.getConfig("shiro.loginSubmit.secretKey"); | |||||
| String decodeOpenid = DesUtils.decode((String) openid, secretKey); | |||||
| JSONObject userJson = null; | |||||
| try { | |||||
| userJson = redisUtils.getUserObject(decodeOpenid); | |||||
| } catch (Exception e) { | |||||
| model.addAttribute("msg", e.getMessage()); | |||||
| model.addAttribute("type", 1); | |||||
| return "wx/error"; | |||||
| } | |||||
| // String userType = UserUtils.getUser().getUserType(); | |||||
| String userType = userJson.getString("userType"); | |||||
| String empCode = userJson.getString("loginCode"); | |||||
| String officeCode = userJson.getString("officeCode"); | |||||
| List<MeetingRoomOrder> list; | |||||
| Date d = new Date(); | |||||
| Date startDate = DateUtils.getPushForwardDate(d, 15); | |||||
| Date endDate = DateUtils.getPushForwardDate(d, -15); | |||||
| if ("mgr".equals(userType)) { | |||||
| List<Emp> emps = empService.findEmployeesByOfficeCode(officeCode); | |||||
| List<String> empIds = emps.stream().map(Emp::getId).collect(Collectors.toList()); | |||||
| list= this.meetingRoomOrderService.findListByEmps(startDate, endDate, empIds); | |||||
| } else { | |||||
| // list= this.auditRecordsService.findListByEmp(startDate, endDate, null); | |||||
| // regList= this.auditRecordsService.findRegListByEmp(startDate, endDate, null); | |||||
| list= this.meetingRoomOrderService.findListByEmp(startDate, endDate, empCode); | |||||
| } | |||||
| Emp emp = empService.get(list.get(0).getOrderBy()); | |||||
| for (int i=0;i<list.size();i++) { | |||||
| MeetingRoom mr = meetingRoomService.get(list.get(i).getRoomId().toString()); | |||||
| list.get(i).setMeetingRoom(mr); | |||||
| list.get(i).setEmp(emp); | |||||
| } | |||||
| model.addAttribute("meetingList", list); | |||||
| model.addAttribute("userJson", userJson); | |||||
| return "modules/sys/meeting/myMeetingOrder"; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,52 @@ | |||||
| package com.lecoo.kjg.web.meeting.controller; | |||||
| import com.jeesite.common.entity.Page; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoom; | |||||
| import com.lecoo.kjg.web.meeting.service.MeetingRoomService; | |||||
| import com.lecoo.kjg.web.sys.web.BaseController; | |||||
| import org.apache.shiro.authz.annotation.RequiresPermissions; | |||||
| 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.ResponseBody; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| @Controller | |||||
| @RequestMapping(value = "${adminPath}/sys/meeting-room") | |||||
| public class MeetingRoomController extends BaseController { | |||||
| @Autowired | |||||
| private MeetingRoomService meetingRoomService; | |||||
| /** | |||||
| * 根据条件查询会议室预订 | |||||
| * | |||||
| * @param request | |||||
| * @param response | |||||
| * @return | |||||
| */ | |||||
| @RequiresPermissions("user") | |||||
| @RequestMapping(value = "/listData") | |||||
| @ResponseBody | |||||
| public Page<MeetingRoom> listData(MeetingRoom meetingRoom, HttpServletRequest request, HttpServletResponse response) { | |||||
| Page<MeetingRoom> pages = meetingRoomService.findPage(new Page<>(request, response), meetingRoom); | |||||
| return pages; | |||||
| } | |||||
| @RequiresPermissions("user") | |||||
| @RequestMapping(value = "/list") | |||||
| public String list(HttpServletRequest request, HttpServletResponse response) { | |||||
| // public Page<VisitRecords> list(HttpServletRequest request, HttpServletResponse response) { | |||||
| return "modules/sys/meeting/roomList"; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,18 @@ | |||||
| /** | |||||
| * Copyright (c) 2013-Now http://jeesite.com All rights reserved. | |||||
| */ | |||||
| package com.lecoo.kjg.web.meeting.dao; | |||||
| import com.jeesite.common.dao.CrudDao; | |||||
| import com.jeesite.common.mybatis.annotation.MyBatisDao; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoom; | |||||
| /** | |||||
| * meeting_roomDAO接口 | |||||
| * @author yk | |||||
| * @version 2022-11-25 | |||||
| */ | |||||
| @MyBatisDao | |||||
| public interface MeetingRoomDao extends CrudDao<MeetingRoom> { | |||||
| } | |||||
| @@ -0,0 +1,32 @@ | |||||
| /** | |||||
| * Copyright (c) 2013-Now http://jeesite.com All rights reserved. | |||||
| */ | |||||
| package com.lecoo.kjg.web.meeting.dao; | |||||
| import com.jeesite.common.dao.CrudDao; | |||||
| import com.jeesite.common.mybatis.annotation.MyBatisDao; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoomOrder; | |||||
| import java.util.List; | |||||
| /** | |||||
| * meeting_room_orderDAO接口 | |||||
| * @author yk | |||||
| * @version 2022-11-25 | |||||
| */ | |||||
| @MyBatisDao | |||||
| public interface MeetingRoomOrderDao extends CrudDao<MeetingRoomOrder> { | |||||
| public List<MeetingRoomOrder> queryByOrder(Long roomId, String orderDate, String orderTime, String endTime); | |||||
| public List<MeetingRoomOrder> findListByDateStr(String orderDate, String officeCode); | |||||
| public List<MeetingRoomOrder> findListByDate(String orderDate, Integer roomId); | |||||
| public List<MeetingRoomOrder> findListByPerson(String orderBy); | |||||
| public List<MeetingRoomOrder> findListTodayHour(); | |||||
| public List<MeetingRoomOrder> findListByEmps(String startDate, String endDate, List<String> empIds); | |||||
| public List<MeetingRoomOrder> findListByEmp(String startDate, String endDate, String empId); | |||||
| public List<MeetingRoomOrder> findListByEmpId(String empId); | |||||
| public MeetingRoomOrder findLastByEmpId(String empId); | |||||
| public List<MeetingRoomOrder> ableOrder(Long roomId, String orderDate, String orderTime, String endTime); | |||||
| } | |||||
| @@ -0,0 +1,97 @@ | |||||
| /** | |||||
| * Copyright (c) 2013-Now http://jeesite.com All rights reserved. | |||||
| */ | |||||
| package com.lecoo.kjg.web.meeting.entity; | |||||
| import com.jeesite.common.entity.DataEntity; | |||||
| import com.jeesite.common.lang.ObjectUtils; | |||||
| import com.jeesite.common.mybatis.annotation.Column; | |||||
| import com.jeesite.common.mybatis.annotation.Table; | |||||
| import com.jeesite.common.mybatis.mapper.query.QueryType; | |||||
| import org.hibernate.validator.constraints.Length; | |||||
| import java.util.List; | |||||
| /** | |||||
| * meeting_roomEntity | |||||
| * @author yk | |||||
| * @version 2022-11-25 | |||||
| */ | |||||
| @Table(name="meeting_room", alias="a", columns={ | |||||
| @Column(name="id", attrName="id", label="id", isPK=true), | |||||
| @Column(name="name", attrName="name", label="name", queryType=QueryType.LIKE), | |||||
| @Column(name="office_code", attrName="officeCode", label="officeCode"), | |||||
| @Column(name="address", attrName="address", label="address"), | |||||
| @Column(name="nick_name", attrName="nickName", label="nick_name", queryType=QueryType.LIKE), | |||||
| }, orderBy="a.id ASC" | |||||
| ) | |||||
| public class MeetingRoom extends DataEntity<MeetingRoom> { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private String name; // name | |||||
| private String address; // address | |||||
| private String nickName; // nick_name | |||||
| private String officeCode; | |||||
| public MeetingRoom() { | |||||
| this(null); | |||||
| } | |||||
| public MeetingRoom(String id){ | |||||
| super(id); | |||||
| } | |||||
| @Length(min=0, max=128, message="name长度不能超过 128 个字符") | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| @Length(min=0, max=128, message="address长度不能超过 128 个字符") | |||||
| public String getAddress() { | |||||
| return address; | |||||
| } | |||||
| public void setAddress(String address) { | |||||
| this.address = address; | |||||
| } | |||||
| @Length(min=0, max=64, message="nick_name长度不能超过 64 个字符") | |||||
| public String getNickName() { | |||||
| return nickName; | |||||
| } | |||||
| public void setNickName(String nickName) { | |||||
| this.nickName = nickName; | |||||
| } | |||||
| @Override | |||||
| public void setId(String id) { | |||||
| if (ObjectUtils.anyNotNull(id) && id.length()>15) { | |||||
| this.id = null; | |||||
| } else { | |||||
| this.id = id; | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public String getId (){ | |||||
| return this.id; | |||||
| } | |||||
| public String getOfficeCode() { | |||||
| return officeCode; | |||||
| } | |||||
| public void setOfficeCode(String officeCode) { | |||||
| this.officeCode = officeCode; | |||||
| } | |||||
| public MeetingRoom setOffice_in(List<String> offices) { | |||||
| this.getSqlMap().getWhere().and("office_code", QueryType.IN, offices); | |||||
| return this; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,225 @@ | |||||
| /** | |||||
| * Copyright (c) 2013-Now http://jeesite.com All rights reserved. | |||||
| */ | |||||
| package com.lecoo.kjg.web.meeting.entity; | |||||
| import com.jeesite.common.lang.ObjectUtils; | |||||
| import com.jeesite.modules.sys.entity.Office; | |||||
| import com.lecoo.kjg.web.sys.entity.Emp; | |||||
| import com.lecoo.kjg.web.sys.entity.EmpFaceFeature; | |||||
| import lombok.ToString; | |||||
| import org.hibernate.validator.constraints.Length; | |||||
| import java.util.Date; | |||||
| import com.jeesite.common.mybatis.annotation.JoinTable; | |||||
| import com.jeesite.common.mybatis.annotation.JoinTable.Type; | |||||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||||
| import com.jeesite.common.entity.DataEntity; | |||||
| import com.jeesite.common.mybatis.annotation.Column; | |||||
| import com.jeesite.common.mybatis.annotation.Table; | |||||
| import com.jeesite.common.mybatis.mapper.query.QueryType; | |||||
| import org.springframework.format.annotation.DateTimeFormat; | |||||
| import org.springframework.stereotype.Component; | |||||
| /** | |||||
| * meeting_room_orderEntity | |||||
| * @author yk | |||||
| * @version 2022-11-25 | |||||
| */ | |||||
| @Table(name="meeting_room_order", alias="a", columns={ | |||||
| @Column(name="id", attrName="id", label="id", isPK=true), | |||||
| @Column(name="room_id", attrName="roomId", label="room_id"), | |||||
| @Column(name="meeting_title", attrName="meetingTitle", label="meeting_title", queryType=QueryType.LIKE), | |||||
| @Column(name="meeting_duration", attrName="meetingDuration", label="meeting_duration"), | |||||
| @Column(name="order_date", attrName="orderDate", label="order_date"), | |||||
| @Column(name="order_time", attrName="orderTime", label="order_time"), | |||||
| @Column(name="end_time", attrName="endTime", label="end_time"), | |||||
| @Column(name="order_by", attrName="orderBy", label="order_by"), | |||||
| @Column(name="order_by_emp", attrName="orderByEmp", label="order_by_emp"), | |||||
| @Column(name="created_at", attrName="createdAt", label="created_at"), | |||||
| @Column(name="updated_at", attrName="updatedAt", label="updated_at"), | |||||
| }, joinTable = { | |||||
| @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = MeetingRoom.class, alias = "o", | |||||
| on = "o.id = a.room_id", | |||||
| columns = {@Column(includeEntity = MeetingRoom.class)}), | |||||
| @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Emp.class, alias = "e", | |||||
| on = "e.id = a.order_by", | |||||
| columns = {@Column(includeEntity = Emp.class)}) | |||||
| },orderBy="a.id DESC" | |||||
| ) | |||||
| @ToString | |||||
| @Component | |||||
| public class MeetingRoomOrder extends DataEntity<MeetingRoomOrder> { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long roomId; // room_id | |||||
| private String meetingTitle; // meeting_title | |||||
| private Integer meetingDuration; // meeting_duration | |||||
| @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") | |||||
| @DateTimeFormat(pattern="yyyy-MM-dd") | |||||
| private Date orderDate; // order_date | |||||
| @DateTimeFormat(pattern = "HH:mm") | |||||
| @JsonFormat(timezone = "GMT+8", pattern = "HH:mm") | |||||
| private Date orderTime; // order_time | |||||
| @DateTimeFormat(pattern = "HH:mm") | |||||
| @JsonFormat(timezone = "GMT+8", pattern = "HH:mm") | |||||
| private Date endTime; // order_time | |||||
| private String orderBy; // order_by | |||||
| private String orderByEmp; // order_by | |||||
| private Date createdAt; // created_at | |||||
| private Date updatedAt; // updated_at | |||||
| private String timePart; | |||||
| private String optionName; | |||||
| private MeetingRoom meetingRoom; | |||||
| private Emp emp; | |||||
| private String orderData; | |||||
| public MeetingRoom getMeetingRoom() { | |||||
| return meetingRoom; | |||||
| } | |||||
| public void setMeetingRoom(MeetingRoom meetingRoom) { | |||||
| this.meetingRoom = meetingRoom; | |||||
| } | |||||
| public Emp getEmp() { | |||||
| return emp; | |||||
| } | |||||
| public void setEmp(Emp emp) { | |||||
| this.emp = emp; | |||||
| } | |||||
| public MeetingRoomOrder() { | |||||
| this(null); | |||||
| } | |||||
| public MeetingRoomOrder(String id){ | |||||
| super(id); | |||||
| } | |||||
| public Long getRoomId() { | |||||
| return roomId; | |||||
| } | |||||
| public void setRoomId(Long roomId) { | |||||
| this.roomId = roomId; | |||||
| } | |||||
| @Length(min=0, max=128, message="meeting_title长度不能超过 128 个字符") | |||||
| public String getMeetingTitle() { | |||||
| return meetingTitle; | |||||
| } | |||||
| public void setMeetingTitle(String meetingTitle) { | |||||
| this.meetingTitle = meetingTitle; | |||||
| } | |||||
| public Integer getMeetingDuration() { | |||||
| return meetingDuration; | |||||
| } | |||||
| public void setMeetingDuration(Integer meetingDuration) { | |||||
| this.meetingDuration = meetingDuration; | |||||
| } | |||||
| @JsonFormat(pattern = "yyyy-MM-dd") | |||||
| public Date getOrderDate() { | |||||
| return orderDate; | |||||
| } | |||||
| public void setOrderDate(Date orderDate) { | |||||
| this.orderDate = orderDate; | |||||
| } | |||||
| @JsonFormat(pattern = "HH:mm") | |||||
| public Date getOrderTime() { | |||||
| return orderTime; | |||||
| } | |||||
| public void setOrderTime(Date orderTime) { | |||||
| this.orderTime = orderTime; | |||||
| } | |||||
| @Length(min=0, max=128, message="order_by长度不能超过 128 个字符") | |||||
| public String getOrderBy() { | |||||
| return orderBy; | |||||
| } | |||||
| public void setOrderBy(String orderBy) { | |||||
| this.orderBy = orderBy; | |||||
| } | |||||
| @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
| public Date getCreatedAt() { | |||||
| return createdAt; | |||||
| } | |||||
| public void setCreatedAt(Date createdAt) { | |||||
| this.createdAt = createdAt; | |||||
| } | |||||
| @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
| public Date getUpdatedAt() { | |||||
| return updatedAt; | |||||
| } | |||||
| public void setUpdatedAt(Date updatedAt) { | |||||
| this.updatedAt = updatedAt; | |||||
| } | |||||
| public Date getEndTime() { | |||||
| return endTime; | |||||
| } | |||||
| public void setEndTime(Date endTime) { | |||||
| this.endTime = endTime; | |||||
| } | |||||
| @Override | |||||
| public void setId(String id) { | |||||
| if (ObjectUtils.anyNotNull(id) && id.length()>15) { | |||||
| this.id = null; | |||||
| } else { | |||||
| this.id = id; | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public String getId (){ | |||||
| return this.id; | |||||
| } | |||||
| public String getOrderByEmp() { | |||||
| return orderByEmp; | |||||
| } | |||||
| public void setOrderByEmp(String orderByEmp) { | |||||
| this.orderByEmp = orderByEmp; | |||||
| } | |||||
| public String getTimePart() { | |||||
| return timePart; | |||||
| } | |||||
| public void setTimePart(String timePart) { | |||||
| this.timePart = timePart; | |||||
| } | |||||
| public String getOptionName() { | |||||
| return optionName; | |||||
| } | |||||
| public void setOptionName(String optionName) { | |||||
| this.optionName = optionName; | |||||
| } | |||||
| public String getOrderData() { | |||||
| return orderData; | |||||
| } | |||||
| public void setOrderData(String orderData) { | |||||
| this.orderData = orderData; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,295 @@ | |||||
| /** | |||||
| * Copyright (c) 2013-Now http://jeesite.com All rights reserved. | |||||
| */ | |||||
| package com.lecoo.kjg.web.meeting.service; | |||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.Collection; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import java.util.stream.Collectors; | |||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.jeesite.common.collect.ListUtils; | |||||
| import com.lecoo.kjg.web.meeting.dao.MeetingRoomDao; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoom; | |||||
| import com.lecoo.kjg.web.sys.utils.DateUtils; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import com.jeesite.common.entity.Page; | |||||
| import com.jeesite.common.service.CrudService; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoomOrder; | |||||
| import com.lecoo.kjg.web.meeting.dao.MeetingRoomOrderDao; | |||||
| /** | |||||
| * meeting_room_orderService | |||||
| * | |||||
| * @author yk | |||||
| * @version 2022-11-25 | |||||
| */ | |||||
| @Service | |||||
| @Transactional(readOnly = true) | |||||
| public class MeetingRoomOrderService extends CrudService<MeetingRoomOrderDao, MeetingRoomOrder> { | |||||
| @Autowired | |||||
| private MeetingRoomOrderDao meetingRoomOrderDao; | |||||
| @Autowired | |||||
| private MeetingRoomDao meetingRoomDao; | |||||
| /** | |||||
| * 获取单条数据 | |||||
| * | |||||
| * @param meetingRoomOrder | |||||
| * @return | |||||
| */ | |||||
| @Override | |||||
| public MeetingRoomOrder get(MeetingRoomOrder meetingRoomOrder) { | |||||
| return super.get(meetingRoomOrder); | |||||
| } | |||||
| /** | |||||
| * 查询分页数据 | |||||
| * | |||||
| * @param meetingRoomOrder 查询条件 | |||||
| * @return | |||||
| */ | |||||
| @Override | |||||
| public Page<MeetingRoomOrder> findPage(MeetingRoomOrder meetingRoomOrder) { | |||||
| return super.findPage(meetingRoomOrder); | |||||
| } | |||||
| /** | |||||
| * 保存数据(插入或更新) | |||||
| * | |||||
| * @param meetingRoomOrder | |||||
| */ | |||||
| @Override | |||||
| @Transactional(readOnly = false) | |||||
| public void save(MeetingRoomOrder meetingRoomOrder) { | |||||
| super.save(meetingRoomOrder); | |||||
| } | |||||
| /** | |||||
| * 更新状态 | |||||
| * | |||||
| * @param meetingRoomOrder | |||||
| */ | |||||
| @Override | |||||
| @Transactional(readOnly = false) | |||||
| public void updateStatus(MeetingRoomOrder meetingRoomOrder) { | |||||
| super.updateStatus(meetingRoomOrder); | |||||
| } | |||||
| /** | |||||
| * 删除数据 | |||||
| * | |||||
| * @param meetingRoomOrder | |||||
| */ | |||||
| @Override | |||||
| @Transactional(readOnly = false) | |||||
| public void delete(MeetingRoomOrder meetingRoomOrder) { | |||||
| super.delete(meetingRoomOrder); | |||||
| } | |||||
| public List<MeetingRoomOrder> findListByEmps(Date startDate, Date endDate, List<String> empIds) { | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| return meetingRoomOrderDao.findListByEmps(sdf.format(startDate), sdf.format(endDate), empIds); | |||||
| } | |||||
| public List<MeetingRoomOrder> findListByEmp(Date startDate, Date endDate, String empId) { | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| return meetingRoomOrderDao.findListByEmp(sdf.format(startDate), sdf.format(endDate), empId); | |||||
| } | |||||
| public boolean ableOrder(String orderDate) { | |||||
| Date orderD = DateUtils.parseStrToDate(orderDate, "yyyy-MM-dd"); | |||||
| if (orderD.before(new Date())) { | |||||
| return false; | |||||
| } | |||||
| if (orderD.after(DateUtils.addDays(new Date(), 5))) { | |||||
| return false; | |||||
| } | |||||
| List<MeetingRoomOrder> ls = meetingRoomOrderDao.ableOrder(null, orderDate, null, null); | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); | |||||
| if (ls.size()>0 && sdf.format(ls.get(0).getOrderTime()).compareTo("08:00") > 0) {//第一个会议晚于早8点 | |||||
| return true; | |||||
| } | |||||
| if (ls.size() > 1) | |||||
| for (int i = 0; i < ls.size() - 1; i++) { | |||||
| if (ls.get(i).getRoomId() == ls.get(i + 1).getRoomId()) { | |||||
| if (sdf.format(ls.get(i).getOrderTime()).equals(sdf.format(ls.get(i + 1).getEndTime()))) { | |||||
| } else { | |||||
| return true; | |||||
| } | |||||
| } else { | |||||
| if (sdf.format(ls.get(i + 1).getOrderTime()).compareTo("08:00") > 0) {//第一个会议晚于早8点 | |||||
| return true; | |||||
| } | |||||
| } | |||||
| } | |||||
| else | |||||
| return true; | |||||
| if (sdf.format(ls.get(ls.size() - 1).getEndTime()).compareTo("20:00") > 0) {//超过晚8点 | |||||
| return false; | |||||
| } | |||||
| return false; | |||||
| } | |||||
| public boolean ableOrder(String orderDate, String orderTime) { | |||||
| return ableOrder(orderDate, orderTime, orderTime); | |||||
| } | |||||
| public boolean ableOrder(String orderDate, String orderTime, String endTime) { | |||||
| List<MeetingRoomOrder> ls = meetingRoomOrderDao.ableOrder(null, orderDate, orderTime, endTime); | |||||
| List<MeetingRoom> list = meetingRoomDao.findList(new MeetingRoom()); | |||||
| if (list.size() == ls.size()) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| public JSONArray getAbleOrderList(String orderDate, String orderTime, String endTime) { | |||||
| if (!(ableOrder(orderDate) && ableOrder(orderDate, orderTime, endTime))) { | |||||
| return null; | |||||
| } | |||||
| List<MeetingRoomOrder> ls = meetingRoomOrderDao.ableOrder(null, orderDate, orderTime, endTime); | |||||
| List<Long> originList = ls.stream().map(MeetingRoomOrder::getRoomId).collect(Collectors.toList()); | |||||
| List<MeetingRoom> list = meetingRoomDao.findList(new MeetingRoom()); | |||||
| List<String> roomIdList = list.stream().map(MeetingRoom::getId).collect(Collectors.toList()); | |||||
| List<String> cdids = originList.stream().map(s -> s.toString()).collect(Collectors.toList()); | |||||
| System.err.println((Collection<String>) roomIdList); | |||||
| List<String> lss = ListUtils.subtract((Collection<String>) roomIdList, cdids); | |||||
| JSONArray ja = new JSONArray(); | |||||
| Date d = DateUtils.parseStrToDate(orderDate + " " + orderTime, "yyyy-MM-dd HH:mm"); | |||||
| Date endD = DateUtils.parseStrToDate(orderDate + " " + endTime, "yyyy-MM-dd HH:mm"); | |||||
| Integer diff = DateUtils.dateDiffMin(d, endD); | |||||
| for (String ii : lss) { | |||||
| JSONObject jo = new JSONObject(); | |||||
| jo.put("orderDate", orderDate+" "+orderTime); | |||||
| jo.put("meetingDuration", diff); | |||||
| jo.put("roomId", Long.parseLong(ii)); | |||||
| ja.add(jo); | |||||
| } | |||||
| return ja; | |||||
| } | |||||
| public boolean ableOrder(String orderDate, String orderTime, String endTime, Long roomId) { | |||||
| List<MeetingRoomOrder> ls = meetingRoomOrderDao.ableOrder(roomId, orderDate, orderTime, endTime); | |||||
| if (ls.size() > 0) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| public Object queryAble(Long roomId, String orderDate, String orderTime, String endTime) { | |||||
| JSONObject js = new JSONObject(); | |||||
| js.put("ableOrder", 1); | |||||
| js.put("bestSuggestion", new JSONArray()); | |||||
| if (null != orderDate && "" == orderTime) {//只有日期 | |||||
| if (!ableOrder(orderDate)) { | |||||
| js.put("ableOrder", 0); | |||||
| js.put("err", "预订日期错误"); | |||||
| } else { | |||||
| js.put("ableOrder", 1); | |||||
| } | |||||
| } | |||||
| JSONObject jsonObject = new JSONObject(); | |||||
| if ("" != orderTime && orderTime.equals(endTime)) {//有日期和时间 | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); | |||||
| if (!ableOrder(orderDate, orderTime)) { | |||||
| Date d = DateUtils.parseStrToDate(orderDate + " " + orderTime, "yyyy-MM-dd HH:mm"); | |||||
| Date end = DateUtils.parseStrToDate(orderDate + " 19:31", "yyyy-MM-dd HH:mm"); | |||||
| int i = 1; | |||||
| while (true) { | |||||
| Date temp = DateUtils.addMinutes(d, 30 * i); | |||||
| String tempStr = sdf.format(temp); | |||||
| if (ableOrder(orderDate, tempStr) && end.after(temp)) { | |||||
| jsonObject.put("orderDate", orderDate + " " + tempStr); | |||||
| js.put("ableOrder", 0); | |||||
| js.put("bestSuggestion", jsonObject); | |||||
| return js; | |||||
| } | |||||
| if (end.after(temp)) { | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| if (!orderTime.equals(endTime) && null == roomId) {//有日期和时间,时长 | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); | |||||
| if (!ableOrder(orderDate, orderTime)) { | |||||
| Date d = DateUtils.parseStrToDate(orderDate + " " + orderTime, "yyyy-MM-dd HH:mm"); | |||||
| Date endD = DateUtils.parseStrToDate(orderDate + " " + endTime, "yyyy-MM-dd HH:mm"); | |||||
| Date end = DateUtils.parseStrToDate(orderDate + " 19:31", "yyyy-MM-dd HH:mm"); | |||||
| int i = 1; | |||||
| while (true) { | |||||
| Date temp = DateUtils.addMinutes(d, 30 * i); | |||||
| Date endTemp = DateUtils.addMinutes(endD, 30 * i++); | |||||
| String tempStr = sdf.format(temp); | |||||
| String endTempStr = sdf.format(endTemp); | |||||
| if (ableOrder(orderDate, tempStr, endTempStr) && end.after(temp)) { | |||||
| JSONArray ja = getAbleOrderList(orderDate, tempStr, endTempStr); | |||||
| js.put("ableOrder", 0); | |||||
| js.put("bestSuggestion", ja); | |||||
| return js; | |||||
| } | |||||
| System.err.println("========="+sdf.format(end)+"-------"+sdf.format(temp)); | |||||
| if (end.before(temp)) { | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| if (null != roomId) {//有日期和时间,时长,指定会议室 | |||||
| if (!ableOrder(orderDate, orderTime, endTime, roomId)) { | |||||
| List<MeetingRoom> list = meetingRoomDao.findList(new MeetingRoom()); | |||||
| Date d = DateUtils.parseStrToDate(orderDate + " " + orderTime, "yyyy-MM-dd HH:mm"); | |||||
| Date endD = DateUtils.parseStrToDate(orderDate + " " + endTime, "yyyy-MM-dd HH:mm"); | |||||
| for (MeetingRoom mr : list) { | |||||
| if (mr.getId().equals(roomId.toString())) { | |||||
| continue; | |||||
| } | |||||
| if (ableOrder(orderDate, orderTime, endTime, Long.valueOf(mr.getId()))) { | |||||
| JSONArray ja = getAbleOrderList(orderDate, orderTime, endTime); | |||||
| js.put("ableOrder", 0); | |||||
| js.put("bestSuggestion", ja); | |||||
| return js; | |||||
| } | |||||
| } | |||||
| int i = 1; | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); | |||||
| Date end = DateUtils.parseStrToDate(orderDate + " 19:31", "yyyy-MM-dd HH:mm"); | |||||
| while (true) { | |||||
| Date temp = DateUtils.addMinutes(d, 30 * i); | |||||
| Date endTemp = DateUtils.addMinutes(endD, 30 * i++); | |||||
| String tempStr = sdf.format(temp); | |||||
| String endTempStr = sdf.format(endTemp); | |||||
| if (ableOrder(orderDate, tempStr, endTempStr) && end.after(temp)) { | |||||
| JSONArray ja = getAbleOrderList(orderDate, tempStr, endTempStr); | |||||
| js.put("ableOrder", 0); | |||||
| js.put("bestSuggestion", ja); | |||||
| return js; | |||||
| } | |||||
| if (end.before(temp)) { | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| return js; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,76 @@ | |||||
| /** | |||||
| * Copyright (c) 2013-Now http://jeesite.com All rights reserved. | |||||
| */ | |||||
| package com.lecoo.kjg.web.meeting.service; | |||||
| import java.util.List; | |||||
| import org.springframework.stereotype.Service; | |||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import com.jeesite.common.entity.Page; | |||||
| import com.jeesite.common.service.CrudService; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoom; | |||||
| import com.lecoo.kjg.web.meeting.dao.MeetingRoomDao; | |||||
| /** | |||||
| * meeting_roomService | |||||
| * @author yk | |||||
| * @version 2022-11-25 | |||||
| */ | |||||
| @Service | |||||
| @Transactional(readOnly=true) | |||||
| public class MeetingRoomService extends CrudService<MeetingRoomDao, MeetingRoom> { | |||||
| /** | |||||
| * 获取单条数据 | |||||
| * @param meetingRoom | |||||
| * @return | |||||
| */ | |||||
| @Override | |||||
| public MeetingRoom get(MeetingRoom meetingRoom) { | |||||
| return super.get(meetingRoom); | |||||
| } | |||||
| /** | |||||
| * 查询分页数据 | |||||
| * @param meetingRoom 查询条件 | |||||
| * @param meetingRoom.page 分页对象 | |||||
| * @return | |||||
| */ | |||||
| @Override | |||||
| public Page<MeetingRoom> findPage(MeetingRoom meetingRoom) { | |||||
| return super.findPage(meetingRoom); | |||||
| } | |||||
| /** | |||||
| * 保存数据(插入或更新) | |||||
| * @param meetingRoom | |||||
| */ | |||||
| @Override | |||||
| @Transactional(readOnly=false) | |||||
| public void save(MeetingRoom meetingRoom) { | |||||
| super.save(meetingRoom); | |||||
| } | |||||
| /** | |||||
| * 更新状态 | |||||
| * @param meetingRoom | |||||
| */ | |||||
| @Override | |||||
| @Transactional(readOnly=false) | |||||
| public void updateStatus(MeetingRoom meetingRoom) { | |||||
| super.updateStatus(meetingRoom); | |||||
| } | |||||
| /** | |||||
| * 删除数据 | |||||
| * @param meetingRoom | |||||
| */ | |||||
| @Override | |||||
| @Transactional(readOnly=false) | |||||
| public void delete(MeetingRoom meetingRoom) { | |||||
| super.delete(meetingRoom); | |||||
| } | |||||
| } | |||||
| @@ -10,6 +10,7 @@ public class ResponseCode extends com.lenovo.nowgo.common.constant.ResponseCode | |||||
| msg = {"人脸下发成功"} | msg = {"人脸下发成功"} | ||||
| ) | ) | ||||
| public static final Integer FACE_PUBLISH_SUCCESS = 1000; | public static final Integer FACE_PUBLISH_SUCCESS = 1000; | ||||
| @ResponseMessage( | @ResponseMessage( | ||||
| msg = {"人脸下发失败(#p0#),请稍后重试!"} | msg = {"人脸下发失败(#p0#),请稍后重试!"} | ||||
| ) | ) | ||||
| @@ -19,10 +20,12 @@ public class ResponseCode extends com.lenovo.nowgo.common.constant.ResponseCode | |||||
| msg = {"人脸获取失败(#p0#)"} | msg = {"人脸获取失败(#p0#)"} | ||||
| ) | ) | ||||
| public static final Integer FACE_FETCH_FAIL = 1004; | public static final Integer FACE_FETCH_FAIL = 1004; | ||||
| @ResponseMessage( | @ResponseMessage( | ||||
| msg = {"IC卡下发成功"} | msg = {"IC卡下发成功"} | ||||
| ) | ) | ||||
| public static final Integer CARD_PUBLISH_SUCCESS = 2000; | public static final Integer CARD_PUBLISH_SUCCESS = 2000; | ||||
| @ResponseMessage( | @ResponseMessage( | ||||
| msg = {"IC卡下发失败(#p0#)"} | msg = {"IC卡下发失败(#p0#)"} | ||||
| ) | ) | ||||
| @@ -177,8 +180,38 @@ public class ResponseCode extends com.lenovo.nowgo.common.constant.ResponseCode | |||||
| ) | ) | ||||
| public static final Integer QRCODE_USED_TIME_PAST = 5014; | public static final Integer QRCODE_USED_TIME_PAST = 5014; | ||||
| @ResponseMessage( | |||||
| msg = {"请求时间已过或错误"} | |||||
| ) | |||||
| public static final Integer REQUEST_TIME_PAST = 5015; | |||||
| @ResponseMessage( | @ResponseMessage( | ||||
| msg = {"场馆当日闭馆"} | msg = {"场馆当日闭馆"} | ||||
| ) | ) | ||||
| public static final Integer MUSEUM_CLOSE_DAY = 6001; | public static final Integer MUSEUM_CLOSE_DAY = 6001; | ||||
| @ResponseMessage( | |||||
| msg = {"未匹配到访客"} | |||||
| ) | |||||
| public static final Integer NOT_FOUND_VISITOR = 5404; | |||||
| @ResponseMessage( | |||||
| msg = {"预订失败,会议室预订时间点有冲突"} | |||||
| ) | |||||
| public static final Integer MEETING_ORDER_CONFLICT = 5501; | |||||
| @ResponseMessage( | |||||
| msg = {"预订失败,会议室预订时间错误"} | |||||
| ) | |||||
| public static final Integer MEETING_ORDER_TIME_ERROR = 5502; | |||||
| @ResponseMessage( | |||||
| msg = {"未匹配到指定的会议记录"} | |||||
| ) | |||||
| public static final Integer MEETING_RECORD_NOT_FOUND = 5503; | |||||
| @ResponseMessage( | |||||
| msg = {"请求参数不能全空"} | |||||
| ) | |||||
| public static final Integer MEETING_PARAMS_NOT_EXISTED = 5504; | |||||
| } | } | ||||
| @@ -5,6 +5,7 @@ package com.lecoo.kjg.web.sys.dao; | |||||
| import com.jeesite.common.dao.CrudDao; | import com.jeesite.common.dao.CrudDao; | ||||
| import com.jeesite.common.mybatis.annotation.MyBatisDao; | import com.jeesite.common.mybatis.annotation.MyBatisDao; | ||||
| import com.lecoo.kjg.web.sys.entity.AccessControl; | |||||
| import com.lecoo.kjg.web.sys.entity.AccessControlGroup; | import com.lecoo.kjg.web.sys.entity.AccessControlGroup; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| @@ -14,4 +15,6 @@ import java.util.List; | |||||
| @MyBatisDao | @MyBatisDao | ||||
| public interface AccessControlGroupDao extends CrudDao<AccessControlGroup> { | public interface AccessControlGroupDao extends CrudDao<AccessControlGroup> { | ||||
| public List<HashMap> findAcTreeList(String userCode); | public List<HashMap> findAcTreeList(String userCode); | ||||
| public List<AccessControlGroup> findByUserCode(String userCode); | |||||
| } | } | ||||
| @@ -0,0 +1,13 @@ | |||||
| /** | |||||
| * Copyright (c) 2013-Now http://jeesite.com All rights reserved. | |||||
| */ | |||||
| package com.lecoo.kjg.web.sys.dao; | |||||
| import com.jeesite.common.dao.CrudDao; | |||||
| import com.jeesite.common.mybatis.annotation.MyBatisDao; | |||||
| import com.lecoo.kjg.web.sys.entity.AdditionPerson; | |||||
| @MyBatisDao | |||||
| public interface AdditionPersonDao extends CrudDao<AdditionPerson> { | |||||
| } | |||||
| @@ -28,4 +28,6 @@ public interface CheckRecordsDao extends CrudDao<CheckRecords> { | |||||
| List<Map<String,Object>> findPushForwardGuestCount(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deviceIds") List<String> deviceIds); | List<Map<String,Object>> findPushForwardGuestCount(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deviceIds") List<String> deviceIds); | ||||
| List<CheckRecords> findTodayList(@Param("id") String id); | |||||
| } | } | ||||
| @@ -12,5 +12,7 @@ import com.lecoo.kjg.web.sys.entity.DeviceExt; | |||||
| public interface DeviceExtDao extends CrudDao<DeviceExt> { | public interface DeviceExtDao extends CrudDao<DeviceExt> { | ||||
| public DeviceExt findByDevId(String devId); | public DeviceExt findByDevId(String devId); | ||||
| public DeviceExt findByRelationId(String devId); | |||||
| public void deleteByDevId(String devId); | public void deleteByDevId(String devId); | ||||
| } | } | ||||
| @@ -11,7 +11,7 @@ import com.lecoo.kjg.web.sys.entity.DeviceExtGate; | |||||
| @MyBatisDao | @MyBatisDao | ||||
| public interface DeviceExtGateDao extends CrudDao<DeviceExtGate> { | public interface DeviceExtGateDao extends CrudDao<DeviceExtGate> { | ||||
| public DeviceExt findByDevId(String devId); | |||||
| public DeviceExtGate findByDevId(String devId); | |||||
| public void deleteByDevId(String devId); | public void deleteByDevId(String devId); | ||||
| } | } | ||||
| @@ -100,4 +100,8 @@ public interface EmpDao extends CrudDao<Emp> { | |||||
| long deleteByOffice(String officeCode); | long deleteByOffice(String officeCode); | ||||
| long realDeleteByOffice(String officeCode); | long realDeleteByOffice(String officeCode); | ||||
| List<Emp> findByName(@Param("officeCode") String officeCode, @Param("name") String name); | |||||
| List<Emp> findByName2(@Param("name") String name); | |||||
| } | } | ||||
| @@ -34,5 +34,8 @@ public interface MyOfficeDao { | |||||
| */ | */ | ||||
| Office getOfficeByUserCode(@Param("userCode") String userCode); | Office getOfficeByUserCode(@Param("userCode") String userCode); | ||||
| List<Office> getOfficeListByUserCode(@Param("userCode") String userCode); | |||||
| List<Office> getOfficeListByOffice(@Param("officeCode") String officeCode); | |||||
| long deleteByOffice(String officeCode); | long deleteByOffice(String officeCode); | ||||
| } | } | ||||
| @@ -6,6 +6,7 @@ package com.lecoo.kjg.web.sys.dao; | |||||
| import com.jeesite.common.dao.CrudDao; | import com.jeesite.common.dao.CrudDao; | ||||
| import com.jeesite.common.mybatis.annotation.MyBatisDao; | import com.jeesite.common.mybatis.annotation.MyBatisDao; | ||||
| import com.lecoo.kjg.web.sys.entity.OfficeAccessControl; | import com.lecoo.kjg.web.sys.entity.OfficeAccessControl; | ||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | import java.util.List; | ||||
| @@ -39,4 +40,6 @@ public interface OfficeAccessControlDao extends CrudDao<OfficeAccessControl> { | |||||
| List<OfficeAccessControl> findAccessControlByOfficeCode(String officeCode); | List<OfficeAccessControl> findAccessControlByOfficeCode(String officeCode); | ||||
| List<OfficeAccessControl> findAccessControlByOfficeCodes(@Param("officeCodes") List<String> officeCodes); | |||||
| } | } | ||||
| @@ -31,4 +31,5 @@ public interface UserExtraDao extends CrudDao<User> { | |||||
| void clearWxOpenidByLoginCode(@Param("loginCode") String loginCode); | void clearWxOpenidByLoginCode(@Param("loginCode") String loginCode); | ||||
| void updateUserCode(@Param("userCode") String userCode, @Param("newCode") String newCode); | |||||
| } | } | ||||
| @@ -0,0 +1,61 @@ | |||||
| /** | |||||
| * Copyright (c) 2013-Now http://jeesite.com All rights reserved. | |||||
| */ | |||||
| package com.lecoo.kjg.web.sys.entity; | |||||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||||
| import com.jeesite.common.entity.DataEntity; | |||||
| import com.jeesite.common.lang.ObjectUtils; | |||||
| import com.jeesite.common.mybatis.annotation.Column; | |||||
| import com.jeesite.common.mybatis.annotation.Table; | |||||
| import lombok.Data; | |||||
| import lombok.ToString; | |||||
| import org.springframework.format.annotation.DateTimeFormat; | |||||
| import org.springframework.stereotype.Component; | |||||
| import java.util.Date; | |||||
| @Table(name = "tf_project_addition_person", alias = "a", columns = { | |||||
| @Column(name = "id", attrName = "id", label = "id", isPK = true), | |||||
| @Column(name = "name", attrName = "name", label = "name"), | |||||
| @Column(name = "gender", attrName = "gender", label = "gender"), | |||||
| @Column(name = "tag", attrName = "tag", label = "tag"), | |||||
| @Column(name = "face_feature", attrName = "faceFeature", label = "faceFeature"), | |||||
| @Column(name = "created_at", attrName = "createdAt", label = "createdAt"), | |||||
| @Column(name = "updated_at", attrName = "updatedAt", label = "updatedAt"), | |||||
| }, | |||||
| orderBy = "a.updated_at DESC" | |||||
| ) | |||||
| @ToString | |||||
| @Component | |||||
| @Data | |||||
| public class AdditionPerson extends DataEntity<AdditionPerson> { | |||||
| private String name; | |||||
| private Integer gender; | |||||
| private Integer tag; | |||||
| private String faceFeature; | |||||
| public AdditionPerson() { | |||||
| } | |||||
| public AdditionPerson(String id){ | |||||
| super(id); | |||||
| } | |||||
| @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||||
| @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||||
| private Date createdAt; | |||||
| private String updatedAt; | |||||
| @Override | |||||
| public void setId(String id) { | |||||
| if (ObjectUtils.anyNotNull(id) && id.length()>15) { | |||||
| this.id = null; | |||||
| } else { | |||||
| this.id = id; | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -82,6 +82,8 @@ public class DeviceExt extends DataEntity<DeviceExt> implements DeviceExtInter { | |||||
| private Date createdAt; | private Date createdAt; | ||||
| private Date updatedAt; | private Date updatedAt; | ||||
| private String relationId; | |||||
| public String getDeviceId() { | public String getDeviceId() { | ||||
| return deviceId; | return deviceId; | ||||
| } | } | ||||
| @@ -330,6 +332,14 @@ public class DeviceExt extends DataEntity<DeviceExt> implements DeviceExtInter { | |||||
| this.gpuVer = gpuVer; | this.gpuVer = gpuVer; | ||||
| } | } | ||||
| public String getRelationId() { | |||||
| return relationId; | |||||
| } | |||||
| public void setRelationId(String relationId) { | |||||
| this.relationId = relationId; | |||||
| } | |||||
| @Override | @Override | ||||
| public String getJsonString() { | public String getJsonString() { | ||||
| return null; | return null; | ||||
| @@ -145,6 +145,7 @@ public class Emp extends DataEntity<Emp> { | |||||
| private String empTypeCn; | private String empTypeCn; | ||||
| public static final String STATUS_AVATAR_AUDIT = "10"; | public static final String STATUS_AVATAR_AUDIT = "10"; | ||||
| public static final String STATUS_AVATAR_AUDIT_BACK = "11"; | public static final String STATUS_AVATAR_AUDIT_BACK = "11"; | ||||
| @@ -532,4 +533,5 @@ public class Emp extends DataEntity<Emp> { | |||||
| public void setEmpTypeCn(String empTypeCn) { | public void setEmpTypeCn(String empTypeCn) { | ||||
| this.empTypeCn = empTypeCn; | this.empTypeCn = empTypeCn; | ||||
| } | } | ||||
| } | } | ||||
| @@ -66,6 +66,7 @@ public class EmpAttendance extends DataEntity<EmpAttendance> { | |||||
| private Date updatedAt; // updated_at | private Date updatedAt; // updated_at | ||||
| private String timePart; | private String timePart; | ||||
| private String officeCode; | |||||
| private String empName; | private String empName; | ||||
| @ExcelField(title = "日期", attrName = "dateStr", sort = 10, width = 25 * 256, type = ExcelField.Type.EXPORT,dataFormat = "yyyy-MM-dd", align = ExcelField.Align.CENTER) | @ExcelField(title = "日期", attrName = "dateStr", sort = 10, width = 25 * 256, type = ExcelField.Type.EXPORT,dataFormat = "yyyy-MM-dd", align = ExcelField.Align.CENTER) | ||||
| @@ -0,0 +1,68 @@ | |||||
| package com.lecoo.kjg.web.sys.scheduler; | |||||
| import com.jeesite.common.lang.StringUtils; | |||||
| import com.jeesite.modules.sys.entity.User; | |||||
| import com.jeesite.modules.sys.utils.UserUtils; | |||||
| import com.lecoo.kjg.web.meeting.dao.MeetingRoomOrderDao; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoom; | |||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoomOrder; | |||||
| import com.lecoo.kjg.web.meeting.service.MeetingRoomService; | |||||
| import com.lecoo.kjg.web.sys.service.EmpService; | |||||
| import com.lecoo.kjg.web.sys.utils.SendUtil; | |||||
| import me.chanjar.weixin.common.error.WxErrorException; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.scheduling.annotation.Scheduled; | |||||
| import org.springframework.stereotype.Component; | |||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.Calendar; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Component | |||||
| public class MeetingScheduler { | |||||
| @Autowired | |||||
| private MeetingRoomOrderDao meetingRoomOrderDao; | |||||
| @Autowired | |||||
| private SendUtil sendUtil; | |||||
| @Autowired | |||||
| private EmpService empService; | |||||
| @Autowired | |||||
| private MeetingRoomService meetingRoomService; | |||||
| @Scheduled(cron = "0 15 * * * ?") | |||||
| @Scheduled(cron = "0 45 * * * ?") | |||||
| public void execute(){ | |||||
| List<MeetingRoomOrder> list = meetingRoomOrderDao.findListTodayHour(); | |||||
| for(MeetingRoomOrder mro : list) { | |||||
| String userCode = empService.get(mro.getOrderBy()).getJobNumber(); | |||||
| User u = UserUtils.get(userCode); | |||||
| MeetingRoom meetingRoom = meetingRoomService.get(mro.getRoomId().toString()); | |||||
| mro.setMeetingRoom(meetingRoom); | |||||
| SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| SimpleDateFormat dateFormat2 = new SimpleDateFormat("HH:mm"); | |||||
| mro.setMeetingRoom(meetingRoom); | |||||
| String mms = dateFormat1.format(mro.getOrderDate())+" "+dateFormat2.format( mro.getOrderTime())+"于"+mro.getMeetingRoom().getName(); | |||||
| mro.setOrderData(mms); | |||||
| try { | |||||
| System.err.println("send wx meeting........hour"); | |||||
| if (null != u && StringUtils.isNotEmpty(u.getWxOpenid())) { | |||||
| // sendUtil.sendToUser(u.getWxOpenid(), "您好,您预订的会议室将要开始了,请准备!", mro, 3); | |||||
| sendUtil.sendTempMmsMeeting(u.getMobile(), mro, 3); | |||||
| } | |||||
| } catch (WxErrorException e) { | |||||
| e.printStackTrace(); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| System.err.println("exec meeting........hour"); | |||||
| } | |||||
| } | |||||
| @@ -1,11 +1,14 @@ | |||||
| package com.lecoo.kjg.web.sys.service; | package com.lecoo.kjg.web.sys.service; | ||||
| import com.jeesite.common.service.api.CrudServiceApi; | import com.jeesite.common.service.api.CrudServiceApi; | ||||
| import com.lecoo.kjg.web.sys.entity.AccessControl; | |||||
| import com.lecoo.kjg.web.sys.entity.AccessControlGroup; | import com.lecoo.kjg.web.sys.entity.AccessControlGroup; | ||||
| import java.util.List; | |||||
| public interface AccessControlGroupService extends CrudServiceApi<AccessControlGroup> { | public interface AccessControlGroupService extends CrudServiceApi<AccessControlGroup> { | ||||
| String getNewId(); | String getNewId(); | ||||
| public List<AccessControlGroup> findByUserCode(String userCode); | |||||
| } | } | ||||
| @@ -19,4 +19,6 @@ public interface AccessControlService extends CrudServiceApi<AccessControl> { | |||||
| List<AccessControl> getAccessControlsByOfficeCodes(String[] officeCodes); | List<AccessControl> getAccessControlsByOfficeCodes(String[] officeCodes); | ||||
| List<AccessControl> getAccessControlsByOfficeCode(String officeCode); | List<AccessControl> getAccessControlsByOfficeCode(String officeCode); | ||||
| List<AccessControl> getAccessControlsByOfficeCodes(List<String> officeCodes); | |||||
| } | } | ||||
| @@ -32,6 +32,9 @@ public class AccessControlGroupServiceSupport | |||||
| @Autowired | @Autowired | ||||
| private AccessControlServiceSupport accessControlServiceSupport; | private AccessControlServiceSupport accessControlServiceSupport; | ||||
| @Autowired | |||||
| private AccessControlGroupDao accessControlGroupDao; | |||||
| @Override | @Override | ||||
| public String getNewId() { | public String getNewId() { | ||||
| List<AccessControlGroup> accessControlGroups = findList(new AccessControlGroup()); | List<AccessControlGroup> accessControlGroups = findList(new AccessControlGroup()); | ||||
| @@ -54,6 +57,11 @@ public class AccessControlGroupServiceSupport | |||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public List<AccessControlGroup> findByUserCode(String userCode) { | |||||
| return accessControlGroupDao.findByUserCode(userCode); | |||||
| } | |||||
| public void updateOfficeAndAc(AccessControlGroup accessControlGroup){ | public void updateOfficeAndAc(AccessControlGroup accessControlGroup){ | ||||
| officeAccessControlGroupDao.deleteByGroupId(accessControlGroup.getGroupCode()); | officeAccessControlGroupDao.deleteByGroupId(accessControlGroup.getGroupCode()); | ||||
| @@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional; | |||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.stream.Collectors; | |||||
| @Service | @Service | ||||
| @@ -148,16 +149,17 @@ public class AccessControlServiceSupport | |||||
| empAccessControlService.deleteByAccessControlId(accessControlId);//待修改 | empAccessControlService.deleteByAccessControlId(accessControlId);//待修改 | ||||
| //添加OfficeDevice和EmpAccessControl关联 | //添加OfficeDevice和EmpAccessControl关联 | ||||
| if (ObjectUtils.anyNotNull(officeIds)) { | if (ObjectUtils.anyNotNull(officeIds)) { | ||||
| List<String> originList = Lists.newArrayList(); | |||||
| // List<String> originList = Lists.newArrayList(); | |||||
| // AccessControl ac = accessControlService.get(accessControl.getAccessControlId()); | // AccessControl ac = accessControlService.get(accessControl.getAccessControlId()); | ||||
| OfficeAccessControl oac = new OfficeAccessControl(); | OfficeAccessControl oac = new OfficeAccessControl(); | ||||
| oac.setAccessControlId(accessControlId); | oac.setAccessControlId(accessControlId); | ||||
| List<OfficeAccessControl> oacList = officeAccessControlService.findList(oac); | List<OfficeAccessControl> oacList = officeAccessControlService.findList(oac); | ||||
| List<String> originList = oacList.stream().map(OfficeAccessControl::getOfficeId).collect(Collectors.toList()); | |||||
| oacList.forEach(officeAccessControl -> { | |||||
| /*oacList.forEach(officeAccessControl -> { | |||||
| originList.add(officeAccessControl.getOfficeId()); | originList.add(officeAccessControl.getOfficeId()); | ||||
| }); | |||||
| });*/ | |||||
| List<String> delIds = ListUtils.subtract(originList, officeIds); | List<String> delIds = ListUtils.subtract(originList, officeIds); | ||||
| List<String> addIds = ListUtils.subtract(officeIds, originList); | List<String> addIds = ListUtils.subtract(officeIds, originList); | ||||
| @@ -208,17 +210,14 @@ public class AccessControlServiceSupport | |||||
| empAccessControlService.deleteByAccessControlId(accessControlId);//待修改 | empAccessControlService.deleteByAccessControlId(accessControlId);//待修改 | ||||
| //添加OfficeDevice和EmpAccessControl关联 | //添加OfficeDevice和EmpAccessControl关联 | ||||
| if (ObjectUtils.anyNotNull(officeIds)) { | if (ObjectUtils.anyNotNull(officeIds)) { | ||||
| List<String> originList = Lists.newArrayList(); | |||||
| // List<String> originList = Lists.newArrayList(); | |||||
| // AccessControl ac = accessControlService.get(accessControl.getAccessControlId()); | // AccessControl ac = accessControlService.get(accessControl.getAccessControlId()); | ||||
| OfficeAccessControl oac = new OfficeAccessControl(); | OfficeAccessControl oac = new OfficeAccessControl(); | ||||
| oac.setAccessControlId(accessControlId); | oac.setAccessControlId(accessControlId); | ||||
| List<OfficeAccessControl> oacList = officeAccessControlService.findList(oac); | List<OfficeAccessControl> oacList = officeAccessControlService.findList(oac); | ||||
| oacList.forEach(officeAccessControl -> { | |||||
| originList.add(officeAccessControl.getOfficeId()); | |||||
| }); | |||||
| List<String> originList = oacList.stream().map(OfficeAccessControl::getOfficeId).collect(Collectors.toList()); | |||||
| List<String> delIds = ListUtils.subtract(originList, officeIds); | List<String> delIds = ListUtils.subtract(originList, officeIds); | ||||
| List<String> addIds = ListUtils.subtract(officeIds, originList); | List<String> addIds = ListUtils.subtract(officeIds, originList); | ||||
| @@ -274,6 +273,8 @@ public class AccessControlServiceSupport | |||||
| @Override | @Override | ||||
| public List<AccessControl> getAccessControlsByOfficeCode(String officeCode) { | public List<AccessControl> getAccessControlsByOfficeCode(String officeCode) { | ||||
| List<OfficeAccessControl> list = officeAccessControlDao.findAccessControlByOfficeCode(officeCode); | List<OfficeAccessControl> list = officeAccessControlDao.findAccessControlByOfficeCode(officeCode); | ||||
| List<AccessControl> accessControls = Lists.newArrayList(); | List<AccessControl> accessControls = Lists.newArrayList(); | ||||
| @@ -288,4 +289,22 @@ public class AccessControlServiceSupport | |||||
| return accessControls; | return accessControls; | ||||
| } | } | ||||
| @Override | |||||
| public List<AccessControl> getAccessControlsByOfficeCodes(List<String> officeCodes) { | |||||
| List<OfficeAccessControl> list = officeAccessControlDao.findAccessControlByOfficeCodes(officeCodes); | |||||
| List<AccessControl> accessControls = Lists.newArrayList(); | |||||
| for (OfficeAccessControl oac : list) { | |||||
| AccessControl temp = accessControlService.get(oac.getAccessControlId()); | |||||
| if (ObjectUtils.anyNotNull(temp)) { | |||||
| accessControls.add(temp); | |||||
| } | |||||
| } | |||||
| return accessControls; | |||||
| } | |||||
| } | } | ||||
| @@ -115,11 +115,12 @@ public class AdminServiceSupport implements AdminService { | |||||
| userDataScopes.add(userDataScope); | userDataScopes.add(userDataScope); | ||||
| Office office = officeService.get(id); | Office office = officeService.get(id); | ||||
| if(RoleUtils.hasUserRole(userCode, "corpAdmin")) { | |||||
| userDao.updateUserCorp(office.getOfficeName(), id, userCode); | |||||
| /*if(RoleUtils.hasUserRole(userCode, "corpAdmin")) { | |||||
| userDao.updateUserCorp("全部", "0", userCode); | userDao.updateUserCorp("全部", "0", userCode); | ||||
| } else { | } else { | ||||
| userDao.updateUserCorp(office.getOfficeName(), id, userCode); | userDao.updateUserCorp(office.getOfficeName(), id, userCode); | ||||
| } | |||||
| }*/ | |||||
| } | } | ||||
| userDataScope = new UserDataScope(); | userDataScope = new UserDataScope(); | ||||
| userDataScope.setUserCode(userCode); | userDataScope.setUserCode(userCode); | ||||
| @@ -193,7 +193,7 @@ public class DeviceServiceSupport | |||||
| // ac.setOffice(officeService.get()); | // ac.setOffice(officeService.get()); | ||||
| String userOfficeCode = ""; | String userOfficeCode = ""; | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode)|| BusinessUtils.isCorpAdmin(userCode)) { | |||||
| UserDataScope uds = new UserDataScope(); | UserDataScope uds = new UserDataScope(); | ||||
| uds.setUserCode(userCode); | uds.setUserCode(userCode); | ||||
| uds.setCtrlType("Office"); | uds.setCtrlType("Office"); | ||||
| @@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.beust.jcommander.internal.Lists; | import com.beust.jcommander.internal.Lists; | ||||
| import com.jeesite.common.cache.CacheUtils; | |||||
| import com.jeesite.common.codec.DesUtils; | import com.jeesite.common.codec.DesUtils; | ||||
| import com.jeesite.common.collect.ListUtils; | |||||
| import com.jeesite.common.config.Global; | import com.jeesite.common.config.Global; | ||||
| import com.jeesite.common.entity.Extend; | import com.jeesite.common.entity.Extend; | ||||
| import com.jeesite.common.lang.ObjectUtils; | import com.jeesite.common.lang.ObjectUtils; | ||||
| @@ -158,6 +160,9 @@ public class EmpServiceSupport | |||||
| @Autowired | @Autowired | ||||
| OfficeDeviceService officeDeviceService; | OfficeDeviceService officeDeviceService; | ||||
| @Autowired | |||||
| OfficeAccessControlService officeAccessControlService; | |||||
| @Autowired | @Autowired | ||||
| EmpAccessControlService empAccessControlService; | EmpAccessControlService empAccessControlService; | ||||
| @@ -205,31 +210,35 @@ public class EmpServiceSupport | |||||
| empAccessControlDao.batchInsertEmpAccessControlInfo(empDevicieList); | empAccessControlDao.batchInsertEmpAccessControlInfo(empDevicieList); | ||||
| } | } | ||||
| User u = new User(); | |||||
| String uuid = UUID.randomUUID().toString().replaceAll("-", ""); | |||||
| if(emp.getIsNewRecord()) { | if(emp.getIsNewRecord()) { | ||||
| User u = new User(); | |||||
| String uuid = UUID.randomUUID().toString().replaceAll("-", ""); | |||||
| emp.setJobNumber(emp.getJobNumber()+"_"+uuid.substring(0, 5)); | emp.setJobNumber(emp.getJobNumber()+"_"+uuid.substring(0, 5)); | ||||
| } | |||||
| u.setMobile(emp.getPhoneNumber()); | |||||
| u.setUserCode(emp.getJobNumber()); | |||||
| u.setLoginCode(emp.getJobNumber()); | |||||
| u.setAvatar(emp.getFaceImageName()); | |||||
| u.setUserType(User.USER_TYPE_PERSION); | |||||
| String secretKey = Global.getConfig("shiro.loginSubmit.secretKey"); | |||||
| u.setPassword(DesUtils.encode(emp.getPhoneNumber(), secretKey)); | |||||
| u.setUserName(emp.getRealName()); | |||||
| u.setMgrType(User.MGR_TYPE_NOT_ADMIN); | |||||
| if (emp.getIsNewRecord()) { | |||||
| u.setMobile(emp.getPhoneNumber()); | |||||
| u.setUserCode(emp.getJobNumber()); | |||||
| u.setLoginCode(emp.getJobNumber()); | |||||
| u.setAvatar(emp.getFaceImageName()); | |||||
| u.setUserType(User.USER_TYPE_PERSION); | |||||
| String secretKey = Global.getConfig("shiro.loginSubmit.secretKey"); | |||||
| u.setPassword(DesUtils.encode(emp.getPhoneNumber(), secretKey)); | |||||
| u.setUserName(emp.getRealName()); | |||||
| u.setMgrType(User.MGR_TYPE_NOT_ADMIN); | |||||
| userExtraDao.insert(u); | userExtraDao.insert(u); | ||||
| } else { | } else { | ||||
| User user = UserUtils.get(emp.getJobNumber()); | |||||
| Emp originEmp = empService.get(emp.getId()); | |||||
| System.err.println(originEmp.getJobNumber()); | |||||
| User user = UserUtils.get(originEmp.getJobNumber()); | |||||
| System.err.println(user); | |||||
| if (ObjectUtils.anyNotNull(user)) { | if (ObjectUtils.anyNotNull(user)) { | ||||
| UserUtils.clearCache(user); | |||||
| user.setAvatar(emp.getFaceImageName()); | user.setAvatar(emp.getFaceImageName()); | ||||
| user.setUserName(emp.getRealName()); | user.setUserName(emp.getRealName()); | ||||
| user.setMobile(emp.getPhoneNumber()); | |||||
| // user.setUserCode(emp.getJobNumber()); | |||||
| user.setLoginCode(emp.getJobNumber()); | |||||
| userService.update(user); | userService.update(user); | ||||
| } else { | |||||
| userExtraDao.insert(u); | |||||
| userExtraDao.updateUserCode(originEmp.getJobNumber(), emp.getJobNumber()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -298,8 +307,8 @@ public class EmpServiceSupport | |||||
| if (ObjectUtils.anyNotNull(parent) && StringUtils.isNotEmpty(parent.getOfficeCode())) { | if (ObjectUtils.anyNotNull(parent) && StringUtils.isNotEmpty(parent.getOfficeCode())) { | ||||
| po = officeDao.get(parent); | po = officeDao.get(parent); | ||||
| office.setParentCode(po.getOfficeCode()); | office.setParentCode(po.getOfficeCode()); | ||||
| office.setParentCodes(StringUtils.isNotEmpty(po.getParentCodes())?(po.getParentCodes()+","+po.getOfficeCode()) : po.getOfficeCode()); | |||||
| office.setTreeNames(parent.getTreeNames() +"/"+ office.getFullName()); | |||||
| office.setParentCodes((StringUtils.isNotEmpty(po.getParentCodes())?(po.getParentCodes()+po.getOfficeCode()) : po.getOfficeCode())+","); | |||||
| office.setTreeNames(po.getTreeNames() +"/"+ office.getFullName()); | |||||
| } else { | } else { | ||||
| office.setTreeNames(office.getFullName()); | office.setTreeNames(office.getFullName()); | ||||
| } | } | ||||
| @@ -348,7 +357,7 @@ public class EmpServiceSupport | |||||
| //对管理员进行操作 获取到登录的用户进行判断 | //对管理员进行操作 获取到登录的用户进行判断 | ||||
| String loginCode = UserUtils.getUser().getLoginCode(); | String loginCode = UserUtils.getUser().getLoginCode(); | ||||
| if (!BusinessUtils.isSecAdmin(loginCode)) { | |||||
| if (!BusinessUtils.isSecAdmin(loginCode)|| BusinessUtils.isCorpAdmin(loginCode)) { | |||||
| if (!StringUtils.isEmpty(adminIds)) { | if (!StringUtils.isEmpty(adminIds)) { | ||||
| String[] adminList = adminIds.split(","); | String[] adminList = adminIds.split(","); | ||||
| List<UserDataScope> userDataScopes = new ArrayList<>(); | List<UserDataScope> userDataScopes = new ArrayList<>(); | ||||
| @@ -380,17 +389,55 @@ public class EmpServiceSupport | |||||
| @Transactional(readOnly = false) | @Transactional(readOnly = false) | ||||
| public void executeUpdateInfo(Office office, String empIds, String adminIds, Boolean flag) { | public void executeUpdateInfo(Office office, String empIds, String adminIds, Boolean flag) { | ||||
| String oldOfficeCode = office.getOfficeCode(); | |||||
| /*String oldOfficeCode = office.getOfficeCode(); | |||||
| //批量修改操作 | //批量修改操作 | ||||
| updateToDefaultOffice(defaultOffice, oldOfficeCode); | updateToDefaultOffice(defaultOffice, oldOfficeCode); | ||||
| //移除掉第一次添加的管理员 | //移除掉第一次添加的管理员 | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| if (!BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (!BusinessUtils.isSecAdmin(userCode)|| BusinessUtils.isCorpAdmin(userCode)) { | |||||
| userDataScopeService.deleteByOfficeCode(office.getOfficeCode()); | userDataScopeService.deleteByOfficeCode(office.getOfficeCode()); | ||||
| } | } | ||||
| //调用新增 | //调用新增 | ||||
| executeAddInfo(office, empIds, adminIds, flag); | |||||
| executeAddInfo(office, empIds, adminIds, flag);*/ | |||||
| List<Office> findList = officeService.findList(new Office()); | |||||
| Integer maxSort = 0; | |||||
| if (null != findList && findList.size() > 0) { | |||||
| List<Integer> treeSorts = Lists.newArrayList(); | |||||
| for (Office findOffice : findList) { | |||||
| Integer treeSort = findOffice.getTreeSort(); | |||||
| treeSorts.add(treeSort); | |||||
| } | |||||
| maxSort = Collections.max(treeSorts); | |||||
| } | |||||
| Office parent = office.getParent(); | |||||
| Office po = null; | |||||
| if (ObjectUtils.anyNotNull(parent) && StringUtils.isNotEmpty(parent.getOfficeCode())) { | |||||
| po = officeDao.get(parent); | |||||
| office.setParentCode(po.getOfficeCode()); | |||||
| office.setParentCodes((StringUtils.isNotEmpty(po.getParentCodes())?(po.getParentCodes()+po.getOfficeCode()) : po.getOfficeCode())+","); | |||||
| office.setTreeNames(po.getTreeNames() +"/"+ office.getFullName()); | |||||
| } else { | |||||
| office.setTreeNames(office.getFullName()); | |||||
| } | |||||
| if (true == flag) { | |||||
| //保存对应公司 | |||||
| office.setTreeSort(maxSort + 30); | |||||
| Extend extend = new Extend(); | |||||
| extend.setExtendS1("1"); | |||||
| office.setExtend(extend); | |||||
| officeService.save(office); | |||||
| //新增公司的时候,添加公司对应的默认班次信息` | |||||
| // Shift defaultShift = shiftService.getDefaultShift(office.getOfficeCode()); | |||||
| // shiftService.insert(defaultShift); | |||||
| } else { | |||||
| officeService.update(office); | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -694,7 +741,13 @@ public class EmpServiceSupport | |||||
| } | } | ||||
| } else if (direction == CheckRecords.TYPE_DIRECTION_OUT) { | } else if (direction == CheckRecords.TYPE_DIRECTION_OUT) { | ||||
| empAttendance.setCheckOutTime(checkTime); | empAttendance.setCheckOutTime(checkTime); | ||||
| } else {} | |||||
| } else { | |||||
| if (null == empAttendance.getCheckInTime()) { | |||||
| empAttendance.setCheckInTime(checkTime); | |||||
| } else { | |||||
| empAttendance.setCheckOutTime(checkTime); | |||||
| } | |||||
| } | |||||
| if (null!=empAttendance.getCheckInTime() && null != empAttendance.getCheckOutTime()) { | if (null!=empAttendance.getCheckInTime() && null != empAttendance.getCheckOutTime()) { | ||||
| Date cin = empAttendance.getCheckInTime(); | Date cin = empAttendance.getCheckInTime(); | ||||
| @@ -711,7 +764,9 @@ public class EmpServiceSupport | |||||
| ea.setCheckInTime(checkDate); | ea.setCheckInTime(checkDate); | ||||
| } else if (direction == CheckRecords.TYPE_DIRECTION_OUT) { | } else if (direction == CheckRecords.TYPE_DIRECTION_OUT) { | ||||
| ea.setCheckOutTime(checkDate); | ea.setCheckOutTime(checkDate); | ||||
| } else {} | |||||
| } else { | |||||
| ea.setCheckInTime(checkDate); | |||||
| } | |||||
| ea.setIsNewRecord(true); | ea.setIsNewRecord(true); | ||||
| ea.setEmpName(emp.getRealName()); | ea.setEmpName(emp.getRealName()); | ||||
| ea.setDateStr(DateUtils.formatDate(new Date(), "yyyy-MM-dd")); | ea.setDateStr(DateUtils.formatDate(new Date(), "yyyy-MM-dd")); | ||||
| @@ -772,6 +827,8 @@ public class EmpServiceSupport | |||||
| updMappingTs(deviceIds, emp); | updMappingTs(deviceIds, emp); | ||||
| updAuthMapping(emp); | |||||
| } | } | ||||
| @@ -895,17 +952,21 @@ public class EmpServiceSupport | |||||
| return ; | return ; | ||||
| } | } | ||||
| OfficeDevice officeDevice = new OfficeDevice(); | |||||
| officeDevice.setOfficeId(officeCode); | |||||
| OfficeAccessControl ods = new OfficeAccessControl(); | |||||
| ods.setOfficeId(officeCode); | |||||
| Office o = officeDao.get(emp.getOffice()); | |||||
| List<String> ids = Arrays.asList(StringUtils.split(o.getParentCodes(), ",")); | |||||
| List<OfficeDevice> list = officeDeviceService.findList(officeDevice); | |||||
| List<AccessControl> list = accessControlService.getAccessControlsByOfficeCodes(ids); | |||||
| if (list.size()>0) { | if (list.size()>0) { | ||||
| for (OfficeDevice od : list) { | |||||
| for (AccessControl od : list) { | |||||
| AuthMapping authMapping = new AuthMapping(); | AuthMapping authMapping = new AuthMapping(); | ||||
| String empId = emp.getId(); | String empId = emp.getId(); | ||||
| authMapping.setEmpId(empId); | authMapping.setEmpId(empId); | ||||
| authMapping.setIsUpdFace(1);//新增记录默认脸已被改 | authMapping.setIsUpdFace(1);//新增记录默认脸已被改 | ||||
| authMapping.setDevId(od.getDeviceId()); | |||||
| authMapping.setDevId(od.getAccessControlId()); | |||||
| authMapping.setHasAuth(0); | authMapping.setHasAuth(0); | ||||
| authMapping.setIsNewRecord(true); | authMapping.setIsNewRecord(true); | ||||
| authMapping.setUpdatedAt("0");//新增记录设置update_at为0 | authMapping.setUpdatedAt("0");//新增记录设置update_at为0 | ||||
| @@ -142,7 +142,7 @@ public class ShiftServiceSupport | |||||
| List<String> officeCodes = Lists.newArrayList(); | List<String> officeCodes = Lists.newArrayList(); | ||||
| List<Office> officesLists =null; | List<Office> officesLists =null; | ||||
| //获取到登陆用户下的所有公司 | //获取到登陆用户下的所有公司 | ||||
| if(BusinessUtils.isSecAdmin(userCode)){ | |||||
| if(BusinessUtils.isSecAdmin(userCode)|| BusinessUtils.isCorpAdmin(userCode)){ | |||||
| officesLists = myOfficeService.getOfficesByUserCode(userCode); | officesLists = myOfficeService.getOfficesByUserCode(userCode); | ||||
| }else { | }else { | ||||
| officesLists = myOfficeService.findList(new Office()); | officesLists = myOfficeService.findList(new Office()); | ||||
| @@ -18,12 +18,19 @@ import org.springframework.util.DigestUtils; | |||||
| public class ApiSignUtil { | public class ApiSignUtil { | ||||
| private static String KeySecrect; | private static String KeySecrect; | ||||
| public static String apiKey2; | |||||
| @Value("${sys.api.KeySecrect}") | @Value("${sys.api.KeySecrect}") | ||||
| public void setKeySecrect(String keySecrect){ | public void setKeySecrect(String keySecrect){ | ||||
| ApiSignUtil.KeySecrect = keySecrect; | ApiSignUtil.KeySecrect = keySecrect; | ||||
| } | } | ||||
| @Value("${sys.api.apiKey2}") | |||||
| public void setApiKey2(String apiKey2){ | |||||
| ApiSignUtil.apiKey2 = apiKey2; | |||||
| } | |||||
| public static String apiSign(String string){ | public static String apiSign(String string){ | ||||
| String str = string+KeySecrect; | String str = string+KeySecrect; | ||||
| System.err.println(str); | System.err.println(str); | ||||
| @@ -34,6 +34,10 @@ public class BusinessUtils { | |||||
| return !(BusinessConsts.LOGIN_CODE_ADMIN.getCode().equals(userCode) || BusinessConsts.lOGIN_CODE_SYSTEM.getCode().equals(userCode)) && RoleUtils.hasUserRole(userCode, "secAdmin"); | return !(BusinessConsts.LOGIN_CODE_ADMIN.getCode().equals(userCode) || BusinessConsts.lOGIN_CODE_SYSTEM.getCode().equals(userCode)) && RoleUtils.hasUserRole(userCode, "secAdmin"); | ||||
| } | } | ||||
| public static Boolean isCorpAdmin(String userCode){ | |||||
| return !(BusinessConsts.LOGIN_CODE_ADMIN.getCode().equals(userCode) || BusinessConsts.lOGIN_CODE_SYSTEM.getCode().equals(userCode)) && RoleUtils.hasUserRole(userCode, "corpAdmin"); | |||||
| } | |||||
| public static String getMmsJsonString(VisitRecords vr){ | public static String getMmsJsonString(VisitRecords vr){ | ||||
| JSONObject json = new JSONObject(); | JSONObject json = new JSONObject(); | ||||
| json.put("name", vr.getVisitors().getName()); | json.put("name", vr.getVisitors().getName()); | ||||
| @@ -63,4 +67,6 @@ public class BusinessUtils { | |||||
| } | } | ||||
| } | } | ||||
| @@ -263,4 +263,19 @@ public class ImageUtil { | |||||
| } | } | ||||
| } | } | ||||
| public static void fileToOutputStream(String filePath, OutputStream outputStream) { | |||||
| try { | |||||
| System.err.println(filePath); | |||||
| BufferedImage bufferedImage = ImageIO.read(new File(filePath)); | |||||
| /* | |||||
| * 区别就是以一句,输出到输出流中,如果第三个参数是 File,则输出到文件中 | |||||
| */ | |||||
| ImageIO.write(bufferedImage, "png", outputStream); | |||||
| System.err.println("图片生成到输出流成功..."); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| System.err.println("发生错误: {}!"+e.getMessage()); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -16,6 +16,7 @@ import com.jeesite.modules.sys.utils.UserUtils; | |||||
| import com.lecoo.kjg.web.sys.dao.EmpDao; | import com.lecoo.kjg.web.sys.dao.EmpDao; | ||||
| import com.lecoo.kjg.web.sys.dao.MyOfficeDao; | import com.lecoo.kjg.web.sys.dao.MyOfficeDao; | ||||
| import com.lecoo.kjg.web.sys.dao.UserExtraDao; | import com.lecoo.kjg.web.sys.dao.UserExtraDao; | ||||
| import com.lecoo.kjg.web.sys.entity.Device; | |||||
| import com.lecoo.kjg.web.sys.entity.Emp; | import com.lecoo.kjg.web.sys.entity.Emp; | ||||
| import com.lecoo.kjg.web.sys.service.UserDataScopeService; | import com.lecoo.kjg.web.sys.service.UserDataScopeService; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -24,6 +25,7 @@ import org.springframework.stereotype.Component; | |||||
| import javax.annotation.PostConstruct; | import javax.annotation.PostConstruct; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.stream.Collectors; | |||||
| @Component | @Component | ||||
| public class OfficeEmpUtils { | public class OfficeEmpUtils { | ||||
| @@ -51,10 +53,8 @@ public class OfficeEmpUtils { | |||||
| @Autowired | @Autowired | ||||
| private static UserExtraDao userDao2; | private static UserExtraDao userDao2; | ||||
| private static String topOffices; | private static String topOffices; | ||||
| private static MyOfficeDao myOfficeDaoIn; | private static MyOfficeDao myOfficeDaoIn; | ||||
| private static OfficeService myOfficeService; | private static OfficeService myOfficeService; | ||||
| @@ -79,15 +79,9 @@ public class OfficeEmpUtils { | |||||
| userDataScopeService = userDataScopeService2; | userDataScopeService = userDataScopeService2; | ||||
| } | } | ||||
| public OfficeEmpUtils() { | public OfficeEmpUtils() { | ||||
| } | } | ||||
| public static Office getOfficeByUserCode() { | public static Office getOfficeByUserCode() { | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| @@ -111,6 +105,20 @@ public class OfficeEmpUtils { | |||||
| return myOffice; | return myOffice; | ||||
| } | } | ||||
| public static List<Office> getOfficesByUserCode() { | |||||
| String userCode = UserUtils.getUser().getUserCode(); | |||||
| String userType = UserUtils.getUser().getUserType(); | |||||
| List<Office> officeList = null; | |||||
| if ("none".equals(userType)) { | |||||
| officeList = myOfficeDaoIn.getOfficeListByUserCode(userCode); | |||||
| } | |||||
| return officeList; | |||||
| } | |||||
| public static Office getOfficeByUserCode(String userCode) { | public static Office getOfficeByUserCode(String userCode) { | ||||
| User user = UserUtils.get(userCode); | User user = UserUtils.get(userCode); | ||||
| @@ -119,7 +127,7 @@ public class OfficeEmpUtils { | |||||
| Office myOffice = null; | Office myOffice = null; | ||||
| if ("persion".equals(userType)) { | if ("persion".equals(userType)) { | ||||
| myOffice = myOfficeDaoIn.getOfficeByUserCode(userCode); | myOffice = myOfficeDaoIn.getOfficeByUserCode(userCode); | ||||
| } else if(("employee".equals(userType)) ){ | |||||
| } else if(("mgr".equals(userType)) || ("employee".equals(userType))){ | |||||
| officeList = myOfficeDaoIn.getOfficesByUserCode(userCode, topOffices); | officeList = myOfficeDaoIn.getOfficesByUserCode(userCode, topOffices); | ||||
| if (ObjectUtils.anyNotNull(officeList) && officeList.size()>0) { | if (ObjectUtils.anyNotNull(officeList) && officeList.size()>0) { | ||||
| myOffice = officeList.get(0); | myOffice = officeList.get(0); | ||||
| @@ -193,6 +201,11 @@ public class OfficeEmpUtils { | |||||
| } | } | ||||
| public static List<Office> getOfficesByOffice(String officeCode) { | |||||
| List<Office> officeList = myOfficeDaoIn.getOfficeListByOffice(officeCode); | |||||
| return officeList; | |||||
| } | |||||
| /** | /** | ||||
| * 获得分配了管理员的公司 | * 获得分配了管理员的公司 | ||||
| * @return | * @return | ||||
| @@ -7,7 +7,6 @@ | |||||
| package com.lecoo.kjg.web.sys.utils; | package com.lecoo.kjg.web.sys.utils; | ||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.aliyun.dysmsapi20170525.models.SendSmsRequest; | import com.aliyun.dysmsapi20170525.models.SendSmsRequest; | ||||
| import com.aliyun.dysmsapi20170525.models.SendSmsResponse; | import com.aliyun.dysmsapi20170525.models.SendSmsResponse; | ||||
| @@ -19,8 +18,8 @@ import com.jeesite.common.lang.StringUtils; | |||||
| import com.jeesite.modules.sys.entity.User; | import com.jeesite.modules.sys.entity.User; | ||||
| import com.lecoo.kjg.web.config.SendMmsProperties; | import com.lecoo.kjg.web.config.SendMmsProperties; | ||||
| import com.lecoo.kjg.web.config.WxMpProperties; | import com.lecoo.kjg.web.config.WxMpProperties; | ||||
| import com.lecoo.kjg.web.meeting.entity.MeetingRoomOrder; | |||||
| import com.lecoo.kjg.web.sys.entity.*; | import com.lecoo.kjg.web.sys.entity.*; | ||||
| import com.lecoo.kjg.web.sys.service.TicketCountService; | |||||
| import com.lecoo.kjg.web.sys.service.TicketSessionService; | import com.lecoo.kjg.web.sys.service.TicketSessionService; | ||||
| import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
| import me.chanjar.weixin.common.error.WxErrorException; | import me.chanjar.weixin.common.error.WxErrorException; | ||||
| @@ -63,7 +62,9 @@ public class SendUtil { | |||||
| public final static int TYPE_CONFIRMED = 3; | public final static int TYPE_CONFIRMED = 3; | ||||
| public String getReceptionPhones(){ | |||||
| return sendMmsProperties.getReceptionPhones(); | |||||
| } | |||||
| public SendSmsResponse sendTempMms(String phone, String paramStr, boolean hasCar) throws Exception { | public SendSmsResponse sendTempMms(String phone, String paramStr, boolean hasCar) throws Exception { | ||||
| @@ -136,6 +137,65 @@ public class SendUtil { | |||||
| return res; | return res; | ||||
| } | } | ||||
| public SendSmsResponse sendTempMmsMeeting(String phone, MeetingRoomOrder meetingRoomOrder, Integer type) throws Exception { | |||||
| Config config = new Config() | |||||
| // 您的AccessKey ID | |||||
| .setAccessKeyId(sendMmsProperties.getAccessKeyId()) | |||||
| // 您的AccessKey Secret | |||||
| .setAccessKeySecret(sendMmsProperties.getAccessKeySecrect()); | |||||
| // 访问的域名 | |||||
| config.endpoint = sendMmsProperties.getEndpoint(); | |||||
| com.aliyun.dysmsapi20170525.Client client = new com.aliyun.dysmsapi20170525.Client(config); | |||||
| String template = ""; | |||||
| if (type == 1) { | |||||
| template = sendMmsProperties.getMeetingOrderTemplate(); | |||||
| } else if (type == 2) { | |||||
| template = sendMmsProperties.getMeetingQuitTemplate(); | |||||
| } else { | |||||
| template = sendMmsProperties.getMeetingRemindTemplate(); | |||||
| } | |||||
| JSONObject json = new JSONObject(); | |||||
| json.put("name", meetingRoomOrder.getOrderByEmp()); | |||||
| json.put("dateStr", meetingRoomOrder.getOrderData()); | |||||
| json.put("rebotName", sendMmsProperties.getRobotName()); | |||||
| SendSmsRequest sendSmsRequest = new SendSmsRequest() | |||||
| .setPhoneNumbers(phone) | |||||
| .setSignName(sendMmsProperties.getSignName()) | |||||
| .setTemplateCode(template) | |||||
| .setTemplateParam(json.toJSONString()); | |||||
| // 复制代码运行请自行打印 API 的返回值 | |||||
| SendSmsResponse res = client.sendSms(sendSmsRequest); | |||||
| return res; | |||||
| } | |||||
| public SendSmsResponse sendMmsToDefault(String phone) throws Exception{ | |||||
| Config config = new Config() | |||||
| // 您的AccessKey ID | |||||
| .setAccessKeyId(sendMmsProperties.getAccessKeyId()) | |||||
| // 您的AccessKey Secret | |||||
| .setAccessKeySecret(sendMmsProperties.getAccessKeySecrect()); | |||||
| // 访问的域名 | |||||
| config.endpoint = sendMmsProperties.getEndpoint(); | |||||
| com.aliyun.dysmsapi20170525.Client client = new com.aliyun.dysmsapi20170525.Client(config); | |||||
| String template = sendMmsProperties.getDefaultRemindTemplate(); | |||||
| JSONObject json = new JSONObject(); | |||||
| SendSmsRequest sendSmsRequest = new SendSmsRequest() | |||||
| .setPhoneNumbers(phone) | |||||
| .setSignName(sendMmsProperties.getSignName()) | |||||
| .setTemplateCode(template) | |||||
| .setTemplateParam(json.toJSONString()); | |||||
| // 复制代码运行请自行打印 API 的返回值 | |||||
| SendSmsResponse res = client.sendSms(sendSmsRequest); | |||||
| return res; | |||||
| } | |||||
| public String sendWxTemplateAudit(Map map) throws WxErrorException { | public String sendWxTemplateAudit(Map map) throws WxErrorException { | ||||
| SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||||
| @@ -416,5 +476,48 @@ public class SendUtil { | |||||
| } | } | ||||
| public void sendToUser(String openId, String title, MeetingRoomOrder meetingRoomOrder, int type) throws WxErrorException { | |||||
| String tmpOpenid = openId; | |||||
| if (StringUtils.isNotEmpty(tmpOpenid)) { | |||||
| String url = Global.getFrontPath()+"/wx/meeting/info/"+meetingRoomOrder.getId(); | |||||
| this.sendToUser(title, tmpOpenid, url, meetingRoomOrder, type); | |||||
| } else { | |||||
| String str = "预订人("+meetingRoomOrder.getOrderByEmp()+")未绑定微信号,发送通知消息失败"; | |||||
| throw new WxErrorException(str); | |||||
| } | |||||
| } | |||||
| public String sendToUser(String title, String openid, String url, MeetingRoomOrder meetingRoomOrder, int type) throws WxErrorException { | |||||
| SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| SimpleDateFormat dateFormat2 = new SimpleDateFormat("HH:mm"); | |||||
| // WxMpProperties.MpConfig mpConfig = WxMpProperties.MpConfig(); | |||||
| WxMpProperties.MpConfig mpConfig = wxMpProperties.getConfigs().get(0); | |||||
| WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder() | |||||
| .toUser(openid) | |||||
| .templateId(mpConfig.getMeetingTemplateId()) | |||||
| .url(mpConfig.getUrl()+"?redirect="+url) | |||||
| .build(); | |||||
| String remark = ""; | |||||
| if (type == 2) { | |||||
| remark = "期待您再次预订!"; | |||||
| } else { | |||||
| remark = "会议预计耗时"+meetingRoomOrder.getMeetingDuration()+"分钟,请您准时参加"; | |||||
| } | |||||
| templateMessage.addData(new WxMpTemplateData("first", title, "#FF00FF")) | |||||
| .addData(new WxMpTemplateData("keyword1", dateFormat1.format(meetingRoomOrder.getOrderDate())+" "+dateFormat2.format( meetingRoomOrder.getOrderTime()), "#000")) | |||||
| .addData(new WxMpTemplateData("keyword2", meetingRoomOrder.getMeetingRoom().getName(), "#000")) | |||||
| .addData(new WxMpTemplateData("remark", remark, "#000"));; | |||||
| String msgId = this.wxService.getTemplateMsgService().sendTemplateMsg(templateMessage); | |||||
| return msgId; | |||||
| } | |||||
| } | } | ||||
| @@ -104,7 +104,7 @@ public class AccessControlController extends BaseController { | |||||
| office.setParentCode(topOffice); | office.setParentCode(topOffice); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| UserDataScope uds = new UserDataScope(); | UserDataScope uds = new UserDataScope(); | ||||
| uds.setUserCode(userCode); | uds.setUserCode(userCode); | ||||
| uds.setCtrlType("Office"); | uds.setCtrlType("Office"); | ||||
| @@ -148,7 +148,7 @@ public class AccessControlController extends BaseController { | |||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| Page<AccessControl> page = new Page<AccessControl>(request, response); | Page<AccessControl> page = new Page<AccessControl>(request, response); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| List<String> deviceIds = accessControlService.findByUserCode(userCode) | List<String> deviceIds = accessControlService.findByUserCode(userCode) | ||||
| .stream().map(AccessControl::getDeviceId).collect(Collectors.toList()); | .stream().map(AccessControl::getDeviceId).collect(Collectors.toList()); | ||||
| if (deviceIds.size() > 0) { | if (deviceIds.size() > 0) { | ||||
| @@ -222,9 +222,10 @@ public class AccessControlController extends BaseController { | |||||
| public List<AccessControl> treeData(){ | public List<AccessControl> treeData(){ | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| if (!BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (!BusinessUtils.isSecAdmin(userCode) && !BusinessUtils.isCorpAdmin(userCode)) { | |||||
| userCode = null; | userCode = null; | ||||
| } | } | ||||
| return accessControlDao.findAcTreeList(userCode); | return accessControlDao.findAcTreeList(userCode); | ||||
| } | } | ||||
| @@ -17,10 +17,7 @@ import com.lecoo.kjg.web.sys.dao.AccessControlGroupDao; | |||||
| import com.lecoo.kjg.web.sys.dao.AccessControlGroupDetailDao; | import com.lecoo.kjg.web.sys.dao.AccessControlGroupDetailDao; | ||||
| import com.lecoo.kjg.web.sys.dao.DeviceDao; | import com.lecoo.kjg.web.sys.dao.DeviceDao; | ||||
| import com.lecoo.kjg.web.sys.dao.OfficeAccessControlGroupDao; | import com.lecoo.kjg.web.sys.dao.OfficeAccessControlGroupDao; | ||||
| import com.lecoo.kjg.web.sys.entity.AccessControlGroup; | |||||
| import com.lecoo.kjg.web.sys.entity.AccessControlGroupDetail; | |||||
| import com.lecoo.kjg.web.sys.entity.Device; | |||||
| import com.lecoo.kjg.web.sys.entity.OfficeAccessControlGroup; | |||||
| import com.lecoo.kjg.web.sys.entity.*; | |||||
| import com.lecoo.kjg.web.sys.service.AccessControlGroupService; | import com.lecoo.kjg.web.sys.service.AccessControlGroupService; | ||||
| import com.lecoo.kjg.web.sys.service.support.AccessControlGroupServiceSupport; | import com.lecoo.kjg.web.sys.service.support.AccessControlGroupServiceSupport; | ||||
| import com.lecoo.kjg.web.sys.utils.BusinessUtils; | import com.lecoo.kjg.web.sys.utils.BusinessUtils; | ||||
| @@ -115,7 +112,7 @@ public class AccessControlGroupController extends BaseController { | |||||
| office.setParentCode("2000"); | office.setParentCode("2000"); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| UserDataScope uds = new UserDataScope(); | UserDataScope uds = new UserDataScope(); | ||||
| uds.setUserCode(userCode); | uds.setUserCode(userCode); | ||||
| uds.setCtrlType("Office"); | uds.setCtrlType("Office"); | ||||
| @@ -155,6 +152,18 @@ public class AccessControlGroupController extends BaseController { | |||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| Page<AccessControlGroup> page = new Page<AccessControlGroup>(request, response); | Page<AccessControlGroup> page = new Page<AccessControlGroup>(request, response); | ||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| List<String> acgIds = accessControlGroupService.findByUserCode(userCode) | |||||
| .stream().map(AccessControlGroup::getGroupCode).collect(Collectors.toList()); | |||||
| if (acgIds.size() > 0) { | |||||
| String[] ids = new String[acgIds.size()]; | |||||
| acgIds.toArray(ids); | |||||
| accessControlGroup.getSqlMap().getWhere().and("group_code", QueryType.IN, ids); | |||||
| } else { | |||||
| return page; | |||||
| } | |||||
| } | |||||
| return accessControlGroupServiceSupport.findPage(new Page<>(request, response), accessControlGroup); | return accessControlGroupServiceSupport.findPage(new Page<>(request, response), accessControlGroup); | ||||
| } | } | ||||
| @@ -203,9 +212,10 @@ public class AccessControlGroupController extends BaseController { | |||||
| @RequestMapping(value = "/treeData") | @RequestMapping(value = "/treeData") | ||||
| @ResponseBody | @ResponseBody | ||||
| public List<HashMap> treeData(){ | public List<HashMap> treeData(){ | ||||
| // String userCode = UserUtils.getUser().getUserCode(); | |||||
| String userCode = UserUtils.getUser().getUserCode(); | |||||
| List<HashMap> acgs = accessControlGroupDao.findAcTreeList(null); | |||||
| List<HashMap> acgs = accessControlGroupDao.findAcTreeList(userCode); | |||||
| // List<HashMap> acgs = accessControlGroupDao.findAcTreeList(null); | |||||
| List<DictData> dlist = DictUtils.getDictList("sys_citys"); | List<DictData> dlist = DictUtils.getDictList("sys_citys"); | ||||
| @@ -7,6 +7,7 @@ package com.lecoo.kjg.web.sys.web; | |||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.beust.jcommander.internal.Lists; | |||||
| import com.jeesite.common.codec.DesUtils; | import com.jeesite.common.codec.DesUtils; | ||||
| import com.jeesite.common.config.Global; | import com.jeesite.common.config.Global; | ||||
| import com.jeesite.common.entity.Extend; | import com.jeesite.common.entity.Extend; | ||||
| @@ -37,6 +38,7 @@ import com.lecoo.kjg.web.sys.service.UserDataScopeService; | |||||
| import com.lecoo.kjg.web.sys.service.support.EmpServiceSupport; | import com.lecoo.kjg.web.sys.service.support.EmpServiceSupport; | ||||
| import com.lecoo.kjg.web.sys.service.support.FaceServiceSupport; | import com.lecoo.kjg.web.sys.service.support.FaceServiceSupport; | ||||
| import com.lecoo.kjg.web.sys.utils.*; | import com.lecoo.kjg.web.sys.utils.*; | ||||
| import com.lenovo.nowgo.common.http.response.MyResponse; | |||||
| import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
| import me.chanjar.weixin.common.error.WxErrorException; | import me.chanjar.weixin.common.error.WxErrorException; | ||||
| import org.apache.shiro.SecurityUtils; | import org.apache.shiro.SecurityUtils; | ||||
| @@ -441,15 +443,25 @@ public class Account2Controller extends WxBaseController { | |||||
| public String reg(@RequestParam Map map, Model model, HttpServletResponse response){ | public String reg(@RequestParam Map map, Model model, HttpServletResponse response){ | ||||
| String openid = (String)map.get("openid"); | String openid = (String)map.get("openid"); | ||||
| String type = (String)map.get("type"); | String type = (String)map.get("type"); | ||||
| Office office = new Office(); | |||||
| String officeCode = (String)map.get("officeCode"); | |||||
| List<Office> list = Lists.newArrayList(); | |||||
| if (StringUtils.isNotEmpty(officeCode)) { | |||||
| Office o = officeService.get(officeCode); | |||||
| if (null != o) { | |||||
| list.add(o); | |||||
| } | |||||
| } else { | |||||
| Office office = new Office(); | |||||
| // office.setParentCode("2000"); | // office.setParentCode("2000"); | ||||
| Extend extend = new Extend(); | |||||
| extend.setExtendS1("1"); | |||||
| office.setExtend(extend); | |||||
| List<String> officeCodes = userDataScopeService.getOffices(); | |||||
| Extend extend = new Extend(); | |||||
| extend.setExtendS1("1"); | |||||
| office.setExtend(extend); | |||||
| List<String> officeCodes = userDataScopeService.getOffices(); | |||||
| office.getSqlMap().getWhere().andBracket("office_code", QueryType.IN, officeCodes).or("parent_code", QueryType.IN, officeCodes).endBracket(); | |||||
| list = this.officeService.findList(office); | |||||
| } | |||||
| office.getSqlMap().getWhere().and("office_code", QueryType.IN, officeCodes); | |||||
| List<Office> list = this.officeService.findList(office); | |||||
| model.addAttribute("offices", list); | model.addAttribute("offices", list); | ||||
| model.addAttribute("openid", openid); | model.addAttribute("openid", openid); | ||||
| @@ -462,7 +474,7 @@ public class Account2Controller extends WxBaseController { | |||||
| response.addCookie(cookie); | response.addCookie(cookie); | ||||
| return "themes/default/modules/sys/account/registerUser"; | |||||
| return "themes/default/modules/sys/account/registerEmp"; | |||||
| } | } | ||||
| @@ -728,9 +740,9 @@ public class Account2Controller extends WxBaseController { | |||||
| extend.setExtendS1(User.STATUS_NORMAL); | extend.setExtendS1(User.STATUS_NORMAL); | ||||
| user.setExtend(extend); | user.setExtend(extend); | ||||
| user.setUserName(emp.getRealName()); | user.setUserName(emp.getRealName()); | ||||
| user.setUserType(User.USER_TYPE_EMPLOYEE); | |||||
| user.setUserType("mgr"); | |||||
| userService.update(user); | userService.update(user); | ||||
| userDao.updateUserType(User.USER_TYPE_EMPLOYEE, userCode); | |||||
| userDao.updateUserType("mgr", userCode); | |||||
| AuditRecords auditRecords = new AuditRecords(1,1,emp2.getId(), loginCode, new Date(), user.getAvatar(), ""); | AuditRecords auditRecords = new AuditRecords(1,1,emp2.getId(), loginCode, new Date(), user.getAvatar(), ""); | ||||
| @@ -886,8 +898,6 @@ public class Account2Controller extends WxBaseController { | |||||
| String secretKey = Global.getConfig("shiro.loginSubmit.secretKey"); | String secretKey = Global.getConfig("shiro.loginSubmit.secretKey"); | ||||
| String wxOpenid = (String) openid; | String wxOpenid = (String) openid; | ||||
| wxOpenid = DesUtils.decode(wxOpenid, secretKey); | wxOpenid = DesUtils.decode(wxOpenid, secretKey); | ||||
| System.err.println("======req...info.......start........====="); | |||||
| System.err.println(DateUtils.getMillsSecondsDouble()); | |||||
| JSONObject userJson; | JSONObject userJson; | ||||
| try { | try { | ||||
| redisUtils.setUserVariables(wxOpenid.substring(1),wxOpenid.substring(0,1)); | redisUtils.setUserVariables(wxOpenid.substring(1),wxOpenid.substring(0,1)); | ||||
| @@ -898,9 +908,6 @@ public class Account2Controller extends WxBaseController { | |||||
| model.addAttribute("type", wxOpenid.substring(0,1)); | model.addAttribute("type", wxOpenid.substring(0,1)); | ||||
| return "wx/error"; | return "wx/error"; | ||||
| } | } | ||||
| System.err.println(userJson.toJSONString()); | |||||
| System.err.println("======req...info.......end........====="); | |||||
| System.err.println(DateUtils.getMillsSecondsDouble()); | |||||
| model.addAttribute("userJson", userJson); | model.addAttribute("userJson", userJson); | ||||
| return "wx/sysIndex"; | return "wx/sysIndex"; | ||||
| } | } | ||||
| @@ -925,4 +932,61 @@ public class Account2Controller extends WxBaseController { | |||||
| subject.logout(); | subject.logout(); | ||||
| return "modules/sys/sysAdminLogin"; | return "modules/sys/sysAdminLogin"; | ||||
| } | } | ||||
| @Autowired | |||||
| private UserExtraDao userExtraDao; | |||||
| @RequestMapping(value = "/account2/updateEmp") | |||||
| @ResponseBody | |||||
| @Transactional | |||||
| public MyResponse upd(@RequestParam Map map) throws Exception{ | |||||
| String secretKey = Global.getConfig("shiro.loginSubmit.secretKey"); | |||||
| String userCode = (String)map.get("userCode"); | |||||
| String openid = (String)map.get("openid"); | |||||
| String phone = (String)map.get("phone"); | |||||
| String base64 = (String)map.get("base64"); | |||||
| userCode = DesUtils.decode(userCode, secretKey); | |||||
| User user = UserUtils.get(userCode); | |||||
| if (null == user) { | |||||
| return outputError(1, "绑定失败,未找到对应账户!"); | |||||
| } | |||||
| Emp emp = empDao.findByJobNum(userCode); | |||||
| emp.setBase64(base64); | |||||
| String msg = empService.faceReg(emp); | |||||
| if (StringUtils.isNotEmpty(msg)) { | |||||
| return output(-1, msg); | |||||
| } | |||||
| user.setAvatar(emp.getFaceImageName()); | |||||
| if (StringUtils.isNotEmpty(user.getWxOpenid())) { | |||||
| user.setMobile(phone); | |||||
| emp.setPhoneNumber(phone); | |||||
| empService.update(emp); | |||||
| userService.update(user); | |||||
| return outputError(1, "绑定失败,该账号已绑定别的微信号!"); | |||||
| } else { | |||||
| System.err.println(openid); | |||||
| openid = DesUtils.decode(openid, secretKey); | |||||
| String userType = "0"; | |||||
| if ("estate".equals(user.getUserType())) { | |||||
| userType = "1"; | |||||
| } | |||||
| User u = userExtraDao.findByWxOpenid(openid, userType); | |||||
| if (ObjectUtils.anyNotNull(u)) { | |||||
| u.setWxOpenid(null); | |||||
| userService.update(u); | |||||
| } | |||||
| user.setWxOpenid(openid); | |||||
| user.setMobile(phone); | |||||
| emp.setPhoneNumber(phone); | |||||
| empService.update(emp); | |||||
| userService.update(user); | |||||
| // RedisUtils.setUserVariables(user.getWxOpenid(), user.getUserType().equals("estate")?"1":"0"); | |||||
| return outputSuccess(user); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -37,6 +37,7 @@ import javax.servlet.http.HttpServletResponse; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Arrays; | import java.util.Arrays; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.stream.Collectors; | |||||
| /** | /** | ||||
| * Admin Controller | * Admin Controller | ||||
| @@ -117,7 +118,33 @@ public class AdminController extends BaseController { | |||||
| * 公司管理园,如奥北,需要登陆到公众号页面 | * 公司管理园,如奥北,需要登陆到公众号页面 | ||||
| */ | */ | ||||
| // user.setUserType("none"); | // user.setUserType("none"); | ||||
| user.getSqlMap().getWhere().and("user_code", QueryType.NE, "admin", 1).and("user_code", QueryType.NE, "system", 2).andBracket("user_type", QueryType.EQ, "none",1).or("user_type", QueryType.EQ, "employee",2).endBracket(); | |||||
| String userCode = UserUtils.getUser().getUserCode(); | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| UserDataScope uds = new UserDataScope(); | |||||
| uds.setUserCode(userCode); | |||||
| uds.setCtrlType("Office"); | |||||
| List<UserDataScope> userDataScopes = userDataScopeDao.findList(uds); | |||||
| List<String> officeIds = userDataScopes.stream().map(UserDataScope::getCtrlData).collect(Collectors.toList()); | |||||
| List<String> iids = com.beust.jcommander.internal.Lists.newArrayList(); | |||||
| if (officeIds.size()>0) { | |||||
| for (String str : officeIds) { | |||||
| if (!topOffice.equals(str)) { | |||||
| iids.add(str); | |||||
| } | |||||
| } | |||||
| if(iids.size()>0) { | |||||
| user.getSqlMap().getWhere().and("corp_code", QueryType.IN, iids); | |||||
| } | |||||
| } | |||||
| } else { | |||||
| user.getSqlMap().getWhere().and("user_code", QueryType.NE, "admin", 1).and("user_code", QueryType.NE, "system", 2).andBracket("user_type", QueryType.EQ, "none",1).or("user_type", QueryType.EQ, "employee",2).endBracket(); | |||||
| } | |||||
| String loginCode = user.getLoginCode(); | String loginCode = user.getLoginCode(); | ||||
| if ("_".equals(loginCode)) { | if ("_".equals(loginCode)) { | ||||
| user.setLoginCode("\\_"); | user.setLoginCode("\\_"); | ||||
| @@ -155,6 +182,29 @@ public class AdminController extends BaseController { | |||||
| office.setParentCode(topOffice); | office.setParentCode(topOffice); | ||||
| // List<String> hasMgrs = OfficeEmpUtils.getHasMgrOffices(); | // List<String> hasMgrs = OfficeEmpUtils.getHasMgrOffices(); | ||||
| // office.getSqlMap().getWhere().and("office_code", QueryType.NOT_IN, hasMgrs); | // office.getSqlMap().getWhere().and("office_code", QueryType.NOT_IN, hasMgrs); | ||||
| String userCode = UserUtils.getUser().getUserCode(); | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| UserDataScope uds = new UserDataScope(); | |||||
| uds.setUserCode(userCode); | |||||
| uds.setCtrlType("Office"); | |||||
| List<UserDataScope> userDataScopes = userDataScopeDao.findList(uds); | |||||
| List<String> officeIds = userDataScopes.stream().map(UserDataScope::getCtrlData).collect(Collectors.toList()); | |||||
| List<String> iids = com.beust.jcommander.internal.Lists.newArrayList(); | |||||
| if (officeIds.size()>0) { | |||||
| for (String str : officeIds) { | |||||
| if (!topOffice.equals(str)) { | |||||
| iids.add(str); | |||||
| } | |||||
| } | |||||
| if(iids.size()>0) { | |||||
| office.getSqlMap().getWhere().and("office_code", QueryType.IN, iids); | |||||
| } | |||||
| } | |||||
| } | |||||
| List<Office> officeList = officeService.findList(office); | List<Office> officeList = officeService.findList(office); | ||||
| List<String> officeIdIn = new ArrayList<>(); | List<String> officeIdIn = new ArrayList<>(); | ||||
| @@ -261,6 +311,29 @@ public class AdminController extends BaseController { | |||||
| emp.setEmpType("1"); | emp.setEmpType("1"); | ||||
| emp.setRegisterTime(new Date()); | emp.setRegisterTime(new Date()); | ||||
| empDao.insert(emp);*/ | empDao.insert(emp);*/ | ||||
| String userCode = UserUtils.getUser().getUserCode(); | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| UserDataScope uds = new UserDataScope(); | |||||
| uds.setUserCode(userCode); | |||||
| uds.setCtrlType("Office"); | |||||
| List<UserDataScope> userDataScopes = userDataScopeDao.findList(uds); | |||||
| List<String> officeIds = userDataScopes.stream().map(UserDataScope::getCtrlData).collect(Collectors.toList()); | |||||
| List<String> iids = com.beust.jcommander.internal.Lists.newArrayList(); | |||||
| if (officeIds.size()>0) { | |||||
| for (String str : officeIds) { | |||||
| if (!topOffice.equals(str)) { | |||||
| iids.add(str); | |||||
| } | |||||
| } | |||||
| if(iids.size()>0) { | |||||
| officeCode = iids.get(0); | |||||
| } | |||||
| } | |||||
| } | |||||
| User user = adminService.createAdminAccount(loginCode, password, userType); | User user = adminService.createAdminAccount(loginCode, password, userType); | ||||
| @@ -285,17 +358,20 @@ public class AdminController extends BaseController { | |||||
| userDataScopes.add(userDataScope2); | userDataScopes.add(userDataScope2); | ||||
| if(RoleUtils.hasUserRole(user.getUserCode(), "corpAdmin")) { | |||||
| userDao.updateUserCorp("全部", "0", user.getUserCode()); | |||||
| } else { | |||||
| if(BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| userDao.updateUserCorp(office.getOfficeName(), officeCode, user.getUserCode()); | userDao.updateUserCorp(office.getOfficeName(), officeCode, user.getUserCode()); | ||||
| } else { | |||||
| userDao.updateUserCorp("全部", "0", user.getUserCode()); | |||||
| } | } | ||||
| List<String> listId = new ArrayList<>(); | |||||
| listId.add(officeCode); | |||||
| adminService.updateOfficeAuth(user.getUserCode(), listId); | |||||
| userDataScopeDao.insertBatch(userDataScopes); | userDataScopeDao.insertBatch(userDataScopes); | ||||
| } else { | } else { | ||||
| userDataScopeDao.insert(userDataScope2); | userDataScopeDao.insert(userDataScope2); | ||||
| } | } | ||||
| userDao.updateUserType(User.USER_TYPE_NONE, loginCode); | userDao.updateUserType(User.USER_TYPE_NONE, loginCode); | ||||
| return renderResult(Global.TRUE, "添加管理员成功"); | return renderResult(Global.TRUE, "添加管理员成功"); | ||||
| } | } | ||||
| @@ -83,7 +83,7 @@ public class AdminLogController extends BaseController { | |||||
| adminLog.getSqlMap().getWhere().and("create_date", QueryType.GTE, startDateStr).and("create_date", QueryType.LTE, endDateStr).and("log_title", QueryType.NOT_IN, logArr); | adminLog.getSqlMap().getWhere().and("create_date", QueryType.GTE, startDateStr).and("create_date", QueryType.LTE, endDateStr).and("log_title", QueryType.NOT_IN, logArr); | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| String loginCode = UserUtils.getUser().getLoginCode(); | String loginCode = UserUtils.getUser().getLoginCode(); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| adminLog.setCreateBy(loginCode); | adminLog.setCreateBy(loginCode); | ||||
| } | } | ||||
| return adminLogService.findPage(new Page<>(request, response), adminLog); | return adminLogService.findPage(new Page<>(request, response), adminLog); | ||||
| @@ -1,8 +1,10 @@ | |||||
| package com.lecoo.kjg.web.sys.web; | package com.lecoo.kjg.web.sys.web; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.google.common.collect.Lists; | |||||
| import com.jeesite.common.config.Global; | import com.jeesite.common.config.Global; | ||||
| import com.jeesite.common.idgen.IdGen; | import com.jeesite.common.idgen.IdGen; | ||||
| import com.jeesite.common.lang.ObjectUtils; | |||||
| import com.jeesite.common.lang.StringUtils; | import com.jeesite.common.lang.StringUtils; | ||||
| import com.jeesite.common.shiro.session.SessionManager; | import com.jeesite.common.shiro.session.SessionManager; | ||||
| import com.jeesite.modules.sys.service.OfficeService; | import com.jeesite.modules.sys.service.OfficeService; | ||||
| @@ -216,6 +218,7 @@ public class ApiController extends BaseController { | |||||
| @GetMapping("/jasypt") | @GetMapping("/jasypt") | ||||
| @ResponseBody | @ResponseBody | ||||
| public MyResponse jasypt2(@RequestParam(required = true) String pwd){ | public MyResponse jasypt2(@RequestParam(required = true) String pwd){ | ||||
| System.err.println(pwd); | |||||
| String cryptStr = JasyptUtil.encrypt(pwd); | String cryptStr = JasyptUtil.encrypt(pwd); | ||||
| System.err.println(cryptStr); | System.err.println(cryptStr); | ||||
| String pwdStr = JasyptUtil.decrypt(cryptStr); | String pwdStr = JasyptUtil.decrypt(cryptStr); | ||||
| @@ -230,4 +233,7 @@ public class ApiController extends BaseController { | |||||
| String pwdStr = JasyptUtil.decrypt(cryptStr); | String pwdStr = JasyptUtil.decrypt(cryptStr); | ||||
| return outputData(0, pwdStr); | return outputData(0, pwdStr); | ||||
| } | } | ||||
| } | } | ||||
| @@ -7,8 +7,11 @@ import com.jeesite.common.entity.Page; | |||||
| import com.jeesite.common.lang.StringUtils; | import com.jeesite.common.lang.StringUtils; | ||||
| import com.jeesite.common.mybatis.mapper.query.QueryType; | import com.jeesite.common.mybatis.mapper.query.QueryType; | ||||
| import com.jeesite.modules.sys.dao.UserDao; | import com.jeesite.modules.sys.dao.UserDao; | ||||
| import com.jeesite.modules.sys.dao.UserDataScopeDao; | |||||
| import com.jeesite.modules.sys.entity.Office; | import com.jeesite.modules.sys.entity.Office; | ||||
| import com.jeesite.modules.sys.entity.UserDataScope; | |||||
| import com.jeesite.modules.sys.service.OfficeService; | import com.jeesite.modules.sys.service.OfficeService; | ||||
| import com.jeesite.modules.sys.utils.UserUtils; | |||||
| import com.lecoo.kjg.web.sys.dao.EmpDao; | import com.lecoo.kjg.web.sys.dao.EmpDao; | ||||
| import com.lecoo.kjg.web.sys.dao.UserExtraDao; | import com.lecoo.kjg.web.sys.dao.UserExtraDao; | ||||
| import com.lecoo.kjg.web.sys.entity.*; | import com.lecoo.kjg.web.sys.entity.*; | ||||
| @@ -16,6 +19,8 @@ import com.lecoo.kjg.web.sys.service.DeviceService; | |||||
| import com.lecoo.kjg.web.sys.service.EmpAttendanceService; | import com.lecoo.kjg.web.sys.service.EmpAttendanceService; | ||||
| import com.lecoo.kjg.web.sys.service.OfficeDeviceService; | import com.lecoo.kjg.web.sys.service.OfficeDeviceService; | ||||
| import com.lecoo.kjg.web.sys.utils.BackupUtils; | import com.lecoo.kjg.web.sys.utils.BackupUtils; | ||||
| import com.lecoo.kjg.web.sys.utils.BusinessUtils; | |||||
| import com.lecoo.kjg.web.sys.utils.OfficeEmpUtils; | |||||
| import org.apache.shiro.authz.annotation.RequiresPermissions; | import org.apache.shiro.authz.annotation.RequiresPermissions; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.beans.factory.annotation.Value; | import org.springframework.beans.factory.annotation.Value; | ||||
| @@ -30,6 +35,7 @@ import javax.servlet.http.HttpServletResponse; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import java.util.stream.Collectors; | |||||
| /** | /** | ||||
| * 签到推送控制器 | * 签到推送控制器 | ||||
| @@ -54,15 +60,30 @@ public class AttendanceController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private BackupUtils backupUtils; | private BackupUtils backupUtils; | ||||
| @Autowired | |||||
| private OfficeService officeService; | |||||
| @RequiresPermissions("sys:attendance:view") | @RequiresPermissions("sys:attendance:view") | ||||
| @GetMapping(value = "/list") | @GetMapping(value = "/list") | ||||
| public String list(Model model) { | public String list(Model model) { | ||||
| String userCode = UserUtils.getUser().getUserCode(); | |||||
| List<Office> officeList = Lists.newArrayList(); | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| officeList = OfficeEmpUtils.getOfficesByUserCode(); | |||||
| } else { | |||||
| officeList = officeService.findList(new Office()); | |||||
| } | |||||
| model.addAttribute("offices", officeList); | |||||
| return "modules/sys/empAttendance/list"; | return "modules/sys/empAttendance/list"; | ||||
| /*model.addAttribute("device", device); | /*model.addAttribute("device", device); | ||||
| return "modules/sys/attendance/setup-list";*/ | return "modules/sys/attendance/setup-list";*/ | ||||
| } | } | ||||
| /** | /** | ||||
| * 考勤列表 | * 考勤列表 | ||||
| * | * | ||||
| @@ -81,6 +102,22 @@ public class AttendanceController extends BaseController { | |||||
| List<String> empIds = Lists.newArrayList(); | List<String> empIds = Lists.newArrayList(); | ||||
| Emp t = new Emp(); | Emp t = new Emp(); | ||||
| boolean flag = false; | boolean flag = false; | ||||
| String userCode = UserUtils.getUser().getUserCode(); | |||||
| if (null!=empAttendance.getOfficeCode() && empAttendance.getOfficeCode().length()<3) { | |||||
| if ((BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode))) { | |||||
| List<Office> officeList = OfficeEmpUtils.getOfficesByUserCode(); | |||||
| List<String> officeIds = officeList.stream().map(Office::getOfficeCode).collect(Collectors.toList()); | |||||
| t.getSqlMap().getWhere().and("office_code", QueryType.IN, officeIds); | |||||
| flag = true; | |||||
| } | |||||
| } else { | |||||
| List<Office> officeList = OfficeEmpUtils.getOfficesByOffice(empAttendance.getOfficeCode()); | |||||
| List<String> officeIds = officeList.stream().map(Office::getOfficeCode).collect(Collectors.toList()); | |||||
| t.getSqlMap().getWhere().and("office_code", QueryType.IN, officeIds); | |||||
| flag = true; | |||||
| } | |||||
| if (null != empType && empType>-1) { | if (null != empType && empType>-1) { | ||||
| t.getSqlMap().getWhere().and("emp_type", QueryType.EQ, empType); | t.getSqlMap().getWhere().and("emp_type", QueryType.EQ, empType); | ||||
| @@ -122,10 +159,27 @@ public class AttendanceController extends BaseController { | |||||
| public String exportData(EmpAttendance empAttendance, HttpServletRequest request, HttpServletResponse response) { | public String exportData(EmpAttendance empAttendance, HttpServletRequest request, HttpServletResponse response) { | ||||
| String timePart = empAttendance.getTimePart(); | String timePart = empAttendance.getTimePart(); | ||||
| String empName = empAttendance.getEmpName(); | String empName = empAttendance.getEmpName(); | ||||
| String officeCode = empAttendance.getOfficeCode(); | |||||
| Integer empType = empAttendance.getEmpType(); | Integer empType = empAttendance.getEmpType(); | ||||
| List<String> empIds = Lists.newArrayList(); | List<String> empIds = Lists.newArrayList(); | ||||
| Emp t = new Emp(); | Emp t = new Emp(); | ||||
| boolean flag = false; | boolean flag = false; | ||||
| String userCode = UserUtils.getUser().getUserCode(); | |||||
| if (null!=officeCode && officeCode.length()<3) { | |||||
| if ((BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode))) { | |||||
| List<Office> officeList = OfficeEmpUtils.getOfficesByUserCode(); | |||||
| List<String> officeIds = officeList.stream().map(Office::getOfficeCode).collect(Collectors.toList()); | |||||
| t.getSqlMap().getWhere().and("office_code", QueryType.IN, officeIds); | |||||
| flag = true; | |||||
| } | |||||
| } else { | |||||
| List<Office> officeList = OfficeEmpUtils.getOfficesByOffice(empAttendance.getOfficeCode()); | |||||
| List<String> officeIds = officeList.stream().map(Office::getOfficeCode).collect(Collectors.toList()); | |||||
| t.getSqlMap().getWhere().and("office_code", QueryType.IN, officeIds); | |||||
| flag = true; | |||||
| } | |||||
| if (null != empType && empType>-1) { | if (null != empType && empType>-1) { | ||||
| t.getSqlMap().getWhere().and("emp_type", QueryType.EQ, empType); | t.getSqlMap().getWhere().and("emp_type", QueryType.EQ, empType); | ||||
| @@ -84,6 +84,8 @@ public class CheckRecorderController extends BaseController { | |||||
| @ResponseBody | @ResponseBody | ||||
| public Page<CheckRecords> listData(@RequestParam(required = false, defaultValue = "1") String btnType, HttpServletRequest request, HttpServletResponse response) { | public Page<CheckRecords> listData(@RequestParam(required = false, defaultValue = "1") String btnType, HttpServletRequest request, HttpServletResponse response) { | ||||
| Map<String, String[]> map = request.getParameterMap(); | Map<String, String[]> map = request.getParameterMap(); | ||||
| String[] authMode = map.get("authMode"); | String[] authMode = map.get("authMode"); | ||||
| String[] authOk = map.get("authOk"); | String[] authOk = map.get("authOk"); | ||||
| @@ -24,6 +24,7 @@ import com.lecoo.kjg.web.sys.utils.DateUtils; | |||||
| import com.lecoo.kjg.web.sys.utils.RedisUtils; | import com.lecoo.kjg.web.sys.utils.RedisUtils; | ||||
| import kong.unirest.HttpResponse; | import kong.unirest.HttpResponse; | ||||
| import kong.unirest.Unirest; | import kong.unirest.Unirest; | ||||
| import org.apache.shiro.authz.annotation.RequiresAuthentication; | |||||
| import org.apache.shiro.authz.annotation.RequiresPermissions; | import org.apache.shiro.authz.annotation.RequiresPermissions; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.beans.factory.annotation.Value; | import org.springframework.beans.factory.annotation.Value; | ||||
| @@ -148,7 +149,7 @@ public class DeviceController extends BaseController { | |||||
| List<String> devIds = Lists.newArrayList(); | List<String> devIds = Lists.newArrayList(); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| UserDataScope uds = new UserDataScope(); | UserDataScope uds = new UserDataScope(); | ||||
| uds.setUserCode(userCode); | uds.setUserCode(userCode); | ||||
| uds.setCtrlType("Office"); | uds.setCtrlType("Office"); | ||||
| @@ -408,7 +409,7 @@ public class DeviceController extends BaseController { | |||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| Page<Device> page = new Page<Device>(request, response); | Page<Device> page = new Page<Device>(request, response); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| List<String> deviceIds = deviceService.getGateListByUserCode(userCode) | List<String> deviceIds = deviceService.getGateListByUserCode(userCode) | ||||
| .stream().map(Device::getId).collect(Collectors.toList()); | .stream().map(Device::getId).collect(Collectors.toList()); | ||||
| if (deviceIds.size() > 0) { | if (deviceIds.size() > 0) { | ||||
| @@ -87,7 +87,7 @@ public class DeviceExtGateEventController extends BaseController { | |||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| List<Device> list = deviceDao.findGatesByUserCode(userCode); | List<Device> list = deviceDao.findGatesByUserCode(userCode); | ||||
| List<String> ids = Lists.newArrayList(); | List<String> ids = Lists.newArrayList(); | ||||
| for (Device d : list) { | for (Device d : list) { | ||||
| @@ -64,7 +64,7 @@ public class DeviceLogController extends BaseController { | |||||
| String[] logArr = new String[]{LOG_OPERATE_INFO}; | String[] logArr = new String[]{LOG_OPERATE_INFO}; | ||||
| adminLog.getSqlMap().getWhere().and("log_title", QueryType.NOT_IN, logArr); | adminLog.getSqlMap().getWhere().and("log_title", QueryType.NOT_IN, logArr); | ||||
| String loginCode = UserUtils.getUser().getLoginCode(); | String loginCode = UserUtils.getUser().getLoginCode(); | ||||
| if (BusinessUtils.isSecAdmin(loginCode)) { | |||||
| if (BusinessUtils.isSecAdmin(loginCode) || BusinessUtils.isCorpAdmin(loginCode)) { | |||||
| adminLog.setCreateBy(loginCode); | adminLog.setCreateBy(loginCode); | ||||
| } | } | ||||
| return adminLogService.findPage(new Page<>(request, response), adminLog); | return adminLogService.findPage(new Page<>(request, response), adminLog); | ||||
| @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
| import com.google.common.collect.Maps; | import com.google.common.collect.Maps; | ||||
| import com.jeesite.common.collect.ListUtils; | |||||
| import com.jeesite.common.config.Global; | import com.jeesite.common.config.Global; | ||||
| import com.jeesite.common.entity.DataEntity; | import com.jeesite.common.entity.DataEntity; | ||||
| import com.jeesite.common.entity.Page; | import com.jeesite.common.entity.Page; | ||||
| @@ -14,6 +15,7 @@ import com.jeesite.common.mybatis.mapper.query.QueryType; | |||||
| import com.jeesite.modules.sys.dao.UserDataScopeDao; | import com.jeesite.modules.sys.dao.UserDataScopeDao; | ||||
| import com.jeesite.modules.sys.entity.Office; | import com.jeesite.modules.sys.entity.Office; | ||||
| import com.jeesite.modules.sys.entity.User; | import com.jeesite.modules.sys.entity.User; | ||||
| import com.jeesite.modules.sys.entity.UserDataScope; | |||||
| import com.jeesite.modules.sys.utils.UserUtils; | import com.jeesite.modules.sys.utils.UserUtils; | ||||
| import com.lecoo.kjg.web.sys.constant.CommonConsts; | import com.lecoo.kjg.web.sys.constant.CommonConsts; | ||||
| import com.lecoo.kjg.web.sys.dao.AuthHandleDao; | import com.lecoo.kjg.web.sys.dao.AuthHandleDao; | ||||
| @@ -222,6 +224,7 @@ public class EmployeeController extends BaseController { | |||||
| } | } | ||||
| if (!DataEntity.STATUS_NORMAL.equals(emp.getStatus())) {//状态值不正常会被真删除 | if (!DataEntity.STATUS_NORMAL.equals(emp.getStatus())) {//状态值不正常会被真删除 | ||||
| userExtraDao.delByLoginCode(emp.getJobNumber()); | |||||
| empService.delByJobNumber(emp.getJobNumber()); | empService.delByJobNumber(emp.getJobNumber()); | ||||
| } else { | } else { | ||||
| @@ -264,7 +267,7 @@ public class EmployeeController extends BaseController { | |||||
| .or("department", QueryType.LIKE, emp.getRealName()).endBracket(); | .or("department", QueryType.LIKE, emp.getRealName()).endBracket(); | ||||
| emp.setRealName(null); | emp.setRealName(null); | ||||
| } | } | ||||
| if(BusinessUtils.isSecAdmin(userCode)) { | |||||
| if(BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| List<String> officeCodes = userDataScopeService.getOfficeCodeByUserCode(userCode); | List<String> officeCodes = userDataScopeService.getOfficeCodeByUserCode(userCode); | ||||
| if(officeCodes != null && officeCodes.size() > 0){ | if(officeCodes != null && officeCodes.size() > 0){ | ||||
| emp.getSqlMap().getWhere().and("office_code", QueryType.IN, officeCodes); | emp.getSqlMap().getWhere().and("office_code", QueryType.IN, officeCodes); | ||||
| @@ -357,15 +360,14 @@ public class EmployeeController extends BaseController { | |||||
| office.setParentCode(topOffice); | office.setParentCode(topOffice); | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| List<AccessControl> accessControlList = Lists.newLinkedList(); | List<AccessControl> accessControlList = Lists.newLinkedList(); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| List<String> officeCodes = userDataScopeService.getOfficeCodeByUserCode(UserUtils.getUser().getUserCode()); | List<String> officeCodes = userDataScopeService.getOfficeCodeByUserCode(UserUtils.getUser().getUserCode()); | ||||
| office.getSqlMap().getWhere().and("office_code", QueryType.IN, officeCodes); | office.getSqlMap().getWhere().and("office_code", QueryType.IN, officeCodes); | ||||
| accessControlList = accessControlService.getAccessControlsByOfficeCodes(officeCodes.toArray(new String[0])); | |||||
| accessControlList = accessControlService.getAccessControlsByOfficeCodes(officeCodes); | |||||
| } else { | } else { | ||||
| accessControlList = accessControlService.findList(new AccessControl()); | accessControlList = accessControlService.findList(new AccessControl()); | ||||
| } | } | ||||
| accessControlList = accessControlService.findList(new AccessControl()); | |||||
| List<Office> officeList = officeService.findList(office); | List<Office> officeList = officeService.findList(office); | ||||
| model.addAttribute("officeList", officeList); | model.addAttribute("officeList", officeList); | ||||
| @@ -458,7 +460,7 @@ public class EmployeeController extends BaseController { | |||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| List<Office> offices; | List<Office> offices; | ||||
| //Sec-admin filter | //Sec-admin filter | ||||
| if(BusinessUtils.isSecAdmin(userCode)) { | |||||
| if(BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| offices = officeService.getOfficesByUserCode(userCode); | offices = officeService.getOfficesByUserCode(userCode); | ||||
| } else { | } else { | ||||
| Office office = new Office(); | Office office = new Office(); | ||||
| @@ -481,7 +483,6 @@ public class EmployeeController extends BaseController { | |||||
| @RequestMapping(value = "/listData") | @RequestMapping(value = "/listData") | ||||
| @ResponseBody | @ResponseBody | ||||
| public Page<Emp> listData(Emp emp, @RequestParam(required = false, defaultValue = "1") String btnType,@RequestParam(required = false, defaultValue = "") String officeCodes, HttpServletRequest request, HttpServletResponse response) { | public Page<Emp> listData(Emp emp, @RequestParam(required = false, defaultValue = "1") String btnType,@RequestParam(required = false, defaultValue = "") String officeCodes, HttpServletRequest request, HttpServletResponse response) { | ||||
| redisUtils.setDefaultString("hjjh", "hkkejj"); | |||||
| Emp findEmp = new Emp(); | Emp findEmp = new Emp(); | ||||
| Page<Emp> page = new Page<Emp>(request, response); | Page<Emp> page = new Page<Emp>(request, response); | ||||
| @@ -501,8 +502,7 @@ public class EmployeeController extends BaseController { | |||||
| List<Office> offices = officeService.findList(findOffice); | List<Office> offices = officeService.findList(findOffice); | ||||
| officeCodeList = offices.stream().map(Office::getOfficeCode).collect(Collectors.toList()); | officeCodeList = offices.stream().map(Office::getOfficeCode).collect(Collectors.toList()); | ||||
| } | } | ||||
| System.err.println(officeCodeList); | |||||
| System.err.println(officeCodeList.size()); | |||||
| //Sec-admin filter | //Sec-admin filter | ||||
| // String loginCode = UserUtils.getUser().getLoginCode(); | // String loginCode = UserUtils.getUser().getLoginCode(); | ||||
| // if (BusinessUtils.isSecAdmin(loginCode) ) { | // if (BusinessUtils.isSecAdmin(loginCode) ) { | ||||
| @@ -529,20 +529,33 @@ public class EmployeeController extends BaseController { | |||||
| findEmp.setStatus_in(Emp.STATUS_ABLE_SHOW); | findEmp.setStatus_in(Emp.STATUS_ABLE_SHOW); | ||||
| } | } | ||||
| if (StringUtils.isNotEmpty(emp.getEmpType()) && Integer.valueOf(emp.getEmpType())>=0) { | |||||
| findEmp.setEmpType(emp.getEmpType()); | |||||
| } | |||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| /*if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (StringUtils.isEmpty(officeCodes) && (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode))) { | |||||
| UserDataScope uds = new UserDataScope(); | UserDataScope uds = new UserDataScope(); | ||||
| uds.setUserCode(userCode); | uds.setUserCode(userCode); | ||||
| uds.setCtrlType("Office"); | uds.setCtrlType("Office"); | ||||
| List<UserDataScope> userDataScopes = userDataScopeDao.findList(uds); | List<UserDataScope> userDataScopes = userDataScopeDao.findList(uds); | ||||
| List<String> offices = userDataScopes.stream().map(UserDataScope::getCtrlData).collect(Collectors.toList()); | List<String> offices = userDataScopes.stream().map(UserDataScope::getCtrlData).collect(Collectors.toList()); | ||||
| List<String> offices2 = ListUtils.newArrayList(); | |||||
| offices2.addAll(offices); | |||||
| for (String s : offices2) { | |||||
| if (topOffice.equals(s)) { | |||||
| continue; | |||||
| } | |||||
| Office find = new Office(); | |||||
| find.setParentCode(s); | |||||
| List<String> temp = officeService.findList(find).stream().map(Office::getOfficeCode).collect(Collectors.toList()); | |||||
| offices.addAll(temp); | |||||
| } | |||||
| if (offices.size()>0) { | if (offices.size()>0) { | ||||
| findEmp.getSqlMap().getWhere().and("office_code", QueryType.IN, offices); | findEmp.getSqlMap().getWhere().and("office_code", QueryType.IN, offices); | ||||
| } | } | ||||
| }*/ | |||||
| } | |||||
| page = empService.findPage(page, findEmp); | page = empService.findPage(page, findEmp); | ||||
| List<Emp> empList = page.getList(); | List<Emp> empList = page.getList(); | ||||
| @@ -568,7 +581,6 @@ public class EmployeeController extends BaseController { | |||||
| @Transactional(readOnly = false) | @Transactional(readOnly = false) | ||||
| public String save(@Validated Emp emp, Model model, @RequestParam(value = "accessControlIds", required = true) List<String> accessControlIds, @RequestParam(value = "delAccessControlIds", required = true) List<String> delAccessControlIds,@RequestParam(value = "addAccessControlIds", required = true) List<String> addAccessControlIds, String extendVals ,String empAccessControlAttendanceAndOpenDoorInfo) { | public String save(@Validated Emp emp, Model model, @RequestParam(value = "accessControlIds", required = true) List<String> accessControlIds, @RequestParam(value = "delAccessControlIds", required = true) List<String> delAccessControlIds,@RequestParam(value = "addAccessControlIds", required = true) List<String> addAccessControlIds, String extendVals ,String empAccessControlAttendanceAndOpenDoorInfo) { | ||||
| List<Map<String,String>> requestData = (List<Map<String,String>>)JSONArray.parse(empAccessControlAttendanceAndOpenDoorInfo); | |||||
| if (null != accessControlIds && accessControlIds.size() > 0){ | if (null != accessControlIds && accessControlIds.size() > 0){ | ||||
| emp.setAccessControls(accessControlIds); | emp.setAccessControls(accessControlIds); | ||||
| } | } | ||||
| @@ -580,37 +592,35 @@ public class EmployeeController extends BaseController { | |||||
| if ("0".equals(emp.getNextShiftType())){ | if ("0".equals(emp.getNextShiftType())){ | ||||
| emp.setNextShiftType(""); | emp.setNextShiftType(""); | ||||
| } | } | ||||
| Date date = new Date(); | |||||
| Emp originEmp = empService.get(emp.getId()); | |||||
| if(null != originEmp && !Objects.equals(originEmp.getShiftType(), emp.getShiftType())) { | |||||
| Calendar cal = Calendar.getInstance(); | |||||
| cal.setTime(date); | |||||
| cal.set(Calendar.HOUR_OF_DAY, 0); | |||||
| cal.set(Calendar.MINUTE, 0); | |||||
| cal.set(Calendar.SECOND, 0); | |||||
| cal.set(Calendar.MILLISECOND, 0); | |||||
| if(emp.getShiftValidTime().before(cal.getTime())) { | |||||
| return renderResult(Global.FALSE, "换班时间不能早于当前时间"); | |||||
| } | |||||
| } | |||||
| emp.setUpdateTime(new Date()); | emp.setUpdateTime(new Date()); | ||||
| Date date = new Date(); | |||||
| if (null == emp.getId()) { | if (null == emp.getId()) { | ||||
| emp.setRegisterTime(new Date()); | |||||
| emp.setRegisterTime(date); | |||||
| emp.setFaceImageName(""); | emp.setFaceImageName(""); | ||||
| if (StringUtils.isEmpty(emp.getJobNumber())) { | if (StringUtils.isEmpty(emp.getJobNumber())) { | ||||
| emp.setJobNumber(emp.getRealName()); | emp.setJobNumber(emp.getRealName()); | ||||
| } | } | ||||
| emp.setNickName(emp.getRealName()); | emp.setNickName(emp.getRealName()); | ||||
| emp.setId(UUID.randomUUID().toString().replaceAll("-", "")); | emp.setId(UUID.randomUUID().toString().replaceAll("-", "")); | ||||
| emp.setIsNewRecord(true); | emp.setIsNewRecord(true); | ||||
| String userCode = UserUtils.getUser().getUserCode(); | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| List<String> acIds = accessControlService.findByUserCode(userCode) | |||||
| .stream().map(AccessControl::getAccessControlId).collect(Collectors.toList()); | |||||
| addAccessControlIds.addAll(acIds); | |||||
| } | |||||
| addAccessControlIds = accessControlIds; | addAccessControlIds = accessControlIds; | ||||
| } | } | ||||
| emp.setStatus(Emp.STATUS_NORMAL); | |||||
| empService.handleAuth(delAccessControlIds, addAccessControlIds, accessControlIds, emp); | empService.handleAuth(delAccessControlIds, addAccessControlIds, accessControlIds, emp); | ||||
| empService.save(emp, accessControlIds); | empService.save(emp, accessControlIds); | ||||
| if (StringUtils.isNotEmpty(emp.getBase64())) { | if (StringUtils.isNotEmpty(emp.getBase64())) { | ||||
| emp = empService.faceReg2(emp); | emp = empService.faceReg2(emp); | ||||
| } | } | ||||
| @@ -84,7 +84,7 @@ public class ExtendsPropertyController extends BaseController { | |||||
| } | } | ||||
| //Sec-admin filter | //Sec-admin filter | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| if(BusinessUtils.isSecAdmin(userCode)) { | |||||
| if(BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| UserDataScope userDataScope = new UserDataScope(); | UserDataScope userDataScope = new UserDataScope(); | ||||
| userDataScope.setUserCode(UserUtils.getUser().getUserCode()); | userDataScope.setUserCode(UserUtils.getUser().getUserCode()); | ||||
| userDataScope.setCtrlType("Office"); | userDataScope.setCtrlType("Office"); | ||||
| @@ -108,7 +108,7 @@ public class ExtendsPropertyController extends BaseController { | |||||
| office.setParentCode(TOP_OFFICE); | office.setParentCode(TOP_OFFICE); | ||||
| office.setOfficeCode(extendRela.getRelaId()); | office.setOfficeCode(extendRela.getRelaId()); | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| if(BusinessUtils.isSecAdmin(userCode)) { | |||||
| if(BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| UserDataScope userDataScope = new UserDataScope(); | UserDataScope userDataScope = new UserDataScope(); | ||||
| userDataScope.setUserCode(UserUtils.getUser().getUserCode()); | userDataScope.setUserCode(UserUtils.getUser().getUserCode()); | ||||
| userDataScope.setCtrlType("Office"); | userDataScope.setCtrlType("Office"); | ||||
| @@ -95,7 +95,7 @@ public class FaceController extends BaseController { | |||||
| //添加所有公司下拉选 / 对不同登录用户做公司限定 | //添加所有公司下拉选 / 对不同登录用户做公司限定 | ||||
| List<Office> officeList = null; | List<Office> officeList = null; | ||||
| List<Device> devices = null; | List<Device> devices = null; | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| officeList = officeService.getOfficesByUserCode(userCode); | officeList = officeService.getOfficesByUserCode(userCode); | ||||
| devices = deviceService.getGateListByUserCode(userCode); | devices = deviceService.getGateListByUserCode(userCode); | ||||
| } else { | } else { | ||||
| @@ -182,7 +182,7 @@ public class FaceController extends BaseController { | |||||
| faceHistory.setFaceId_ne(); | faceHistory.setFaceId_ne(); | ||||
| //Sec-admin filter | //Sec-admin filter | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| List<String> deviceIds = deviceService.getGateListByUserCode(userCode) | List<String> deviceIds = deviceService.getGateListByUserCode(userCode) | ||||
| .stream().map(Device::getId).collect(Collectors.toList()); | .stream().map(Device::getId).collect(Collectors.toList()); | ||||
| if (null == deviceIds || deviceIds.size() <= 0) { | if (null == deviceIds || deviceIds.size() <= 0) { | ||||
| @@ -208,7 +208,7 @@ public class FaceController extends BaseController { | |||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| //由于前端是下拉选择框,默认显示"所有",所以这里加了一个不存在的设备表示所有 | //由于前端是下拉选择框,默认显示"所有",所以这里加了一个不存在的设备表示所有 | ||||
| List<Device> devices = null; | List<Device> devices = null; | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| devices = deviceService.getDeviceListByUserCode(userCode); | devices = deviceService.getDeviceListByUserCode(userCode); | ||||
| } else { | } else { | ||||
| devices = deviceService.findList(new Device()); | devices = deviceService.findList(new Device()); | ||||
| @@ -244,7 +244,7 @@ public class FaceController extends BaseController { | |||||
| } | } | ||||
| //Sec-admin filter | //Sec-admin filter | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| List<String> deviceIds = deviceService.getDeviceListByUserCode(userCode) | List<String> deviceIds = deviceService.getDeviceListByUserCode(userCode) | ||||
| .stream().map(Device::getId).collect(Collectors.toList()); | .stream().map(Device::getId).collect(Collectors.toList()); | ||||
| if (deviceIds == null || deviceIds.size() <= 0) { | if (deviceIds == null || deviceIds.size() <= 0) { | ||||
| @@ -323,7 +323,7 @@ public class FaceController extends BaseController { | |||||
| //Sec-admin filter | //Sec-admin filter | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| List<FaceHistory> list = new ArrayList<>(); | List<FaceHistory> list = new ArrayList<>(); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| List<String> deviceIds = deviceService.getDeviceListByUserCode(userCode) | List<String> deviceIds = deviceService.getDeviceListByUserCode(userCode) | ||||
| .stream().map(Device::getId).collect(Collectors.toList()); | .stream().map(Device::getId).collect(Collectors.toList()); | ||||
| if (deviceIds != null && deviceIds.size() > 0) { | if (deviceIds != null && deviceIds.size() > 0) { | ||||
| @@ -147,7 +147,7 @@ public class IndexController extends BaseController { | |||||
| List<Device> devices = null; | List<Device> devices = null; | ||||
| if (BusinessUtils.isSecAdmin(userCode)){ | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)){ | |||||
| devices = deviceDao.findByUserCode(userCode); | devices = deviceDao.findByUserCode(userCode); | ||||
| } else { | } else { | ||||
| Device d = new Device(); | Device d = new Device(); | ||||
| @@ -439,7 +439,7 @@ public class IndexController extends BaseController { | |||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| Long empCount = 0L; | Long empCount = 0L; | ||||
| List<Device> devices = null; | List<Device> devices = null; | ||||
| if (BusinessUtils.isSecAdmin(userCode)){ | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)){ | |||||
| devices = deviceDao.findByUserCode(userCode); | devices = deviceDao.findByUserCode(userCode); | ||||
| } else { | } else { | ||||
| Device d = new Device(); | Device d = new Device(); | ||||
| @@ -571,7 +571,7 @@ public class IndexController extends BaseController { | |||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| Long count = 0L; | Long count = 0L; | ||||
| List<Device> devices = null; | List<Device> devices = null; | ||||
| if (BusinessUtils.isSecAdmin(userCode)){ | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)){ | |||||
| devices = deviceDao.findByUserCode(userCode); | devices = deviceDao.findByUserCode(userCode); | ||||
| } else { | } else { | ||||
| Device d = new Device(); | Device d = new Device(); | ||||
| @@ -124,7 +124,7 @@ public class MonthlyAttendanceController extends BaseController { | |||||
| } | } | ||||
| //Sec-admin filter | //Sec-admin filter | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| if(BusinessUtils.isSecAdmin(userCode)) { | |||||
| if(BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| List<String> officeCodes = userDataScopeService.getOfficeCodeByUserCode(userCode); | List<String> officeCodes = userDataScopeService.getOfficeCodeByUserCode(userCode); | ||||
| if(officeCodes != null && officeCodes.size() > 0){ | if(officeCodes != null && officeCodes.size() > 0){ | ||||
| emp.setOfficeCode_in(officeCodes.toArray(new String[officeCodes.size()])); | emp.setOfficeCode_in(officeCodes.toArray(new String[officeCodes.size()])); | ||||
| @@ -197,7 +197,7 @@ public class MonthlyAttendanceController extends BaseController { | |||||
| Emp emp = setEmpInfo(monthlyAttendance); | Emp emp = setEmpInfo(monthlyAttendance); | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| List<MonthlyAttendance> list = new ArrayList<>(); | List<MonthlyAttendance> list = new ArrayList<>(); | ||||
| if(BusinessUtils.isSecAdmin(userCode)) { | |||||
| if(BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| List<String> officeCodes = userDataScopeService.getOfficeCodeByUserCode(userCode); | List<String> officeCodes = userDataScopeService.getOfficeCodeByUserCode(userCode); | ||||
| if(officeCodes != null && officeCodes.size() > 0){ | if(officeCodes != null && officeCodes.size() > 0){ | ||||
| emp.getSqlMap().getWhere().and("office_code", QueryType.IN, officeCodes); | emp.getSqlMap().getWhere().and("office_code", QueryType.IN, officeCodes); | ||||
| @@ -63,6 +63,9 @@ public class MyOfficeController extends BaseController { | |||||
| private static final int OFFICE_ID_LENGTH = 19; | private static final int OFFICE_ID_LENGTH = 19; | ||||
| @Value("${office.topOffice}") | |||||
| private String topOffice; | |||||
| @Value("${office.defaultOffice}") | @Value("${office.defaultOffice}") | ||||
| private String defaultOffice; | private String defaultOffice; | ||||
| @@ -231,19 +234,19 @@ public class MyOfficeController extends BaseController { | |||||
| public Page<Office> listData(Office office, String ctrlPermi, HttpServletRequest request, HttpServletResponse response) { | public Page<Office> listData(Office office, String ctrlPermi, HttpServletRequest request, HttpServletResponse response) { | ||||
| Page<Office> page = new Page<>(request, response); | Page<Office> page = new Page<>(request, response); | ||||
| if (StringUtils.isBlank(office.getParentCode())) { | if (StringUtils.isBlank(office.getParentCode())) { | ||||
| office.setParentCode("0"); | |||||
| // office.setParentCode("0"); | |||||
| } | } | ||||
| if (StringUtils.isNotBlank(office.getViewCode()) || StringUtils.isNotBlank(office.getOfficeName()) || StringUtils.isNotBlank(office.getFullName())) { | if (StringUtils.isNotBlank(office.getViewCode()) || StringUtils.isNotBlank(office.getOfficeName()) || StringUtils.isNotBlank(office.getFullName())) { | ||||
| office.setParentCode(null); | office.setParentCode(null); | ||||
| } | } | ||||
| this.officeService.addDataScopeFilter(office, ctrlPermi); | |||||
| // this.officeService.addDataScopeFilter(office, ctrlPermi); | |||||
| office.setStatus(""); | office.setStatus(""); | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (office.getOfficeCode()==null && (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode))) { | |||||
| UserDataScope uds = new UserDataScope(); | UserDataScope uds = new UserDataScope(); | ||||
| uds.setUserCode(userCode); | uds.setUserCode(userCode); | ||||
| uds.setCtrlType("Office"); | uds.setCtrlType("Office"); | ||||
| @@ -251,8 +254,20 @@ public class MyOfficeController extends BaseController { | |||||
| List<UserDataScope> userDataScopes = userDataScopeDao.findList(uds); | List<UserDataScope> userDataScopes = userDataScopeDao.findList(uds); | ||||
| List<String> officeIds = userDataScopes.stream().map(UserDataScope::getCtrlData).collect(Collectors.toList()); | List<String> officeIds = userDataScopes.stream().map(UserDataScope::getCtrlData).collect(Collectors.toList()); | ||||
| List<String> iids = Lists.newArrayList(); | |||||
| if (officeIds.size()>0) { | if (officeIds.size()>0) { | ||||
| office.getSqlMap().getWhere().and("office_code", QueryType.IN, officeIds); | |||||
| for (String str : officeIds) { | |||||
| if (!topOffice.equals(str)) { | |||||
| iids.add(str); | |||||
| } | |||||
| } | |||||
| office.getSqlMap().getWhere().andBracket("office_code", QueryType.IN, officeIds); | |||||
| if(iids.size()>0) { | |||||
| office.getSqlMap().getWhere().or("parent_code", QueryType.IN, iids); | |||||
| } | |||||
| office.getSqlMap().getWhere().endBracket(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -356,15 +371,10 @@ public class MyOfficeController extends BaseController { | |||||
| // true表示新增 false表示修改 | // true表示新增 false表示修改 | ||||
| boolean isNewRecord = office.getIsNewRecord(); | boolean isNewRecord = office.getIsNewRecord(); | ||||
| List<String> sstr = Lists.newArrayList(); | |||||
| if (!(ObjectUtils.anyNotNull(empIds))) { | if (!(ObjectUtils.anyNotNull(empIds))) { | ||||
| List<Emp> empList = empService.findEmployeesByOfficeCode(office.getOfficeCode()); | List<Emp> empList = empService.findEmployeesByOfficeCode(office.getOfficeCode()); | ||||
| if (empList.size()>0) { | |||||
| empList.forEach(emp -> { | |||||
| System.err.println(emp.getId()); | |||||
| sstr.add(emp.getId()); | |||||
| }); | |||||
| } | |||||
| List<String> sstr = empList.stream().map(Emp::getId).collect(Collectors.toList()); | |||||
| if (ObjectUtils.anyNotNull(sstr)) | if (ObjectUtils.anyNotNull(sstr)) | ||||
| empIds = StringUtils.join(sstr, ","); | empIds = StringUtils.join(sstr, ","); | ||||
| } | } | ||||
| @@ -465,13 +475,13 @@ public class MyOfficeController extends BaseController { | |||||
| where.setCompanyCode(companyCode); | where.setCompanyCode(companyCode); | ||||
| where.getSqlMap().getWhere().disableAutoAddStatusWhere(); | where.getSqlMap().getWhere().disableAutoAddStatusWhere(); | ||||
| if (isAll == null || !isAll) { | if (isAll == null || !isAll) { | ||||
| this.officeService.addDataScopeFilter(where, ctrlPermi); | |||||
| // this.officeService.addDataScopeFilter(where, ctrlPermi); | |||||
| } | } | ||||
| where.setStatus_in(Emp.STATUS_ABLE_SHOW); | where.setStatus_in(Emp.STATUS_ABLE_SHOW); | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| UserDataScope uds = new UserDataScope(); | UserDataScope uds = new UserDataScope(); | ||||
| uds.setUserCode(userCode); | uds.setUserCode(userCode); | ||||
| uds.setCtrlType("Office"); | uds.setCtrlType("Office"); | ||||
| @@ -479,8 +489,20 @@ public class MyOfficeController extends BaseController { | |||||
| List<UserDataScope> userDataScopes = userDataScopeDao.findList(uds); | List<UserDataScope> userDataScopes = userDataScopeDao.findList(uds); | ||||
| List<String> officeIds = userDataScopes.stream().map(UserDataScope::getCtrlData).collect(Collectors.toList()); | List<String> officeIds = userDataScopes.stream().map(UserDataScope::getCtrlData).collect(Collectors.toList()); | ||||
| List<String> iids = Lists.newArrayList(); | |||||
| if (officeIds.size()>0) { | if (officeIds.size()>0) { | ||||
| where.getSqlMap().getWhere().and("office_code", QueryType.IN, officeIds); | |||||
| for (String str : officeIds) { | |||||
| if (!topOffice.equals(str)) { | |||||
| iids.add(str); | |||||
| } | |||||
| } | |||||
| where.getSqlMap().getWhere().andBracket("office_code", QueryType.IN, officeIds); | |||||
| if(iids.size()>0) { | |||||
| where.getSqlMap().getWhere().or("parent_code", QueryType.IN, iids); | |||||
| } | |||||
| where.getSqlMap().getWhere().endBracket(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -63,7 +63,7 @@ public class PasswordLogController extends BaseController { | |||||
| PasswordLog passwordLog = new PasswordLog(); | PasswordLog passwordLog = new PasswordLog(); | ||||
| String userCode = UserUtils.getUser().getUserCode(); | String userCode = UserUtils.getUser().getUserCode(); | ||||
| Device device = new Device(); | Device device = new Device(); | ||||
| if (BusinessUtils.isSecAdmin(userCode)) { | |||||
| if (BusinessUtils.isSecAdmin(userCode) || BusinessUtils.isCorpAdmin(userCode)) { | |||||
| List<String> deviceIds = deviceService.getDeviceListByUserCode(userCode).stream().map(Device::getId).collect(Collectors.toList()); | List<String> deviceIds = deviceService.getDeviceListByUserCode(userCode).stream().map(Device::getId).collect(Collectors.toList()); | ||||
| if (null != deviceIds && deviceIds.size() > 0) { | if (null != deviceIds && deviceIds.size() > 0) { | ||||
| device.setId_in(deviceIds.toArray(new String[deviceIds.size()])); | device.setId_in(deviceIds.toArray(new String[deviceIds.size()])); | ||||
| @@ -1,7 +1,6 @@ | |||||
| package com.lecoo.kjg.web.sys.web; | package com.lecoo.kjg.web.sys.web; | ||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.jeesite.common.codec.DesUtils; | import com.jeesite.common.codec.DesUtils; | ||||
| import com.jeesite.common.config.Global; | import com.jeesite.common.config.Global; | ||||
| @@ -0,0 +1,55 @@ | |||||
| package com.lecoo.kjg.web.sys.web.api; | |||||
| import com.jeesite.common.lang.StringUtils; | |||||
| import com.lecoo.kjg.web.sys.constant.ResponseCode; | |||||
| import com.lecoo.kjg.web.sys.dao.DeviceExtDao; | |||||
| import com.lecoo.kjg.web.sys.entity.DeviceExt; | |||||
| import com.lecoo.kjg.web.sys.web.BaseController; | |||||
| import com.lenovo.nowgo.common.http.response.MyResponse; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.http.MediaType; | |||||
| import org.springframework.validation.annotation.Validated; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| @RestController | |||||
| @RequestMapping(value = "/api/device") | |||||
| public class DeviceApiController extends BaseController { | |||||
| @Autowired | |||||
| private DeviceExtDao deviceExtDao; | |||||
| /** | |||||
| * 上传pad参数 | |||||
| * @return | |||||
| */ | |||||
| @RequestMapping(value = "/uploadPadExt", method = {RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) | |||||
| @ResponseBody | |||||
| public MyResponse upload(@Validated @RequestBody DeviceExt deviceExt){ | |||||
| if (StringUtils.isEmpty(deviceExt.getDeviceId())) { | |||||
| return output(ResponseCode.DEVICE_NOT_FOUND); | |||||
| } | |||||
| deviceExtDao.update(deviceExt); | |||||
| return outputSuccess(); | |||||
| } | |||||
| @RequestMapping(value = "/getPadExt", method = {RequestMethod.GET}) | |||||
| @ResponseBody | |||||
| public MyResponse getPadExt(String deviceId){ | |||||
| if (StringUtils.isEmpty(deviceId)) { | |||||
| return output(ResponseCode.PARAMS_TYPE_ERROR); | |||||
| } | |||||
| DeviceExt de = new DeviceExt(); | |||||
| de.setId(deviceId); | |||||
| DeviceExt det = deviceExtDao.get(de); | |||||
| if (null == det) { | |||||
| det = deviceExtDao.findByRelationId(deviceId); | |||||
| } | |||||
| return outputSuccess(det); | |||||
| } | |||||
| } | |||||
| @@ -2,7 +2,10 @@ package com.lecoo.kjg.web.sys.web.api; | |||||
| import com.google.common.collect.Sets; | import com.google.common.collect.Sets; | ||||
| import com.jeesite.common.lang.DateUtils; | import com.jeesite.common.lang.DateUtils; | ||||
| import com.jeesite.common.lang.StringUtils; | |||||
| import com.lecoo.kjg.web.sys.dao.EmpDao; | |||||
| import com.lecoo.kjg.web.sys.dto.EmpDTO; | import com.lecoo.kjg.web.sys.dto.EmpDTO; | ||||
| import com.lecoo.kjg.web.sys.entity.Emp; | |||||
| import com.lecoo.kjg.web.sys.web.BaseController; | import com.lecoo.kjg.web.sys.web.BaseController; | ||||
| import com.lecoo.kjg.web.sys.entity.FaceHistory; | import com.lecoo.kjg.web.sys.entity.FaceHistory; | ||||
| import com.lecoo.kjg.web.sys.service.DeviceService; | import com.lecoo.kjg.web.sys.service.DeviceService; | ||||
| @@ -48,6 +51,9 @@ public class EmpApiController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private FaceHistoryService faceHistoryService; | private FaceHistoryService faceHistoryService; | ||||
| @Autowired | |||||
| private EmpDao empDao; | |||||
| /** | /** | ||||
| * H5注册人脸 | * H5注册人脸 | ||||
| @@ -154,4 +160,15 @@ public class EmpApiController extends BaseController { | |||||
| } | } | ||||
| return outputSuccess(faceMapList); | return outputSuccess(faceMapList); | ||||
| } | } | ||||
| @GetMapping("/getByName") | |||||
| @ResponseBody | |||||
| public MyResponse getEmpList(String name, String officeCode) { | |||||
| List<Emp> emps = null; | |||||
| if (StringUtils.isNotEmpty(name)) { | |||||
| emps = this.empDao.findByName(officeCode, name); | |||||
| } | |||||
| return outputData(0, emps); | |||||
| } | |||||
| } | } | ||||
| @@ -15,13 +15,13 @@ server: | |||||
| session: | session: | ||||
| timeout: 1800 | timeout: 1800 | ||||
| redis: | |||||
| timeout: 600000 | |||||
| password: ENC(5pXr3t6cME1jduXpYq+8IA==) | |||||
| group: leface:pad | |||||
| cluster: | |||||
| max-redirects: 3 # 获取失败 最大重定向次数 | |||||
| nodes: 39.105.85.176:6371,39.105.85.176:6372,39.105.85.176:6373,39.105.85.176:6374,39.105.85.176:6375,39.105.85.176:6376 | |||||
| #redis: | |||||
| # timeout: 600000 | |||||
| # password: ENC(5pXr3t6cME1jduXpYq+8IA==) | |||||
| # group: leface:pad | |||||
| # cluster: | |||||
| # max-redirects: 3 # 获取失败 最大重定向次数 | |||||
| # nodes: 39.105.85.176:6371,39.105.85.176:6372,39.105.85.176:6373,39.105.85.176:6374,39.105.85.176:6375,39.105.85.176:6376 | |||||
| # 数据库连接配置 | # 数据库连接配置 | ||||
| mysql: | mysql: | ||||
| @@ -31,9 +31,11 @@ mysql: | |||||
| # username: root | # username: root | ||||
| # password: Lecoo@hj | # password: Lecoo@hj | ||||
| # host: ${DB_HOST:8.131.78.156} | |||||
| # port: ${DB_PORT:23306} | |||||
| host: ${DB_HOST:39.105.85.176} | host: ${DB_HOST:39.105.85.176} | ||||
| port: ${DB_PORT:3306} | port: ${DB_PORT:3306} | ||||
| database: ${DB_NAME:hj2} | |||||
| database: ${DB_NAME:lecoo-hj} | |||||
| username: ${DB_USER:root} | username: ${DB_USER:root} | ||||
| password: ${DB_PASSWORD:Lecooai@2021} | password: ${DB_PASSWORD:Lecooai@2021} | ||||
| @@ -46,11 +46,13 @@ spring: | |||||
| # # Redis 连接参数 (RedisProperties) | # # Redis 连接参数 (RedisProperties) | ||||
| redis: | redis: | ||||
| host: 39.105.85.176 | |||||
| #host: 39.105.85.176 | |||||
| host: 127.0.0.1 | |||||
| port: 6379 | port: 6379 | ||||
| ssl: false | ssl: false | ||||
| database: 0 | database: 0 | ||||
| password: lecooai-redis | |||||
| #password: lecooai-redis | |||||
| password: | |||||
| group: leface:pad | group: leface:pad | ||||
| timeout: 10000 | timeout: 10000 | ||||
| # lettuce: | # lettuce: | ||||
| @@ -89,7 +91,7 @@ copyrightYear: 2022 | |||||
| # 软件提供商公司或个人名称 | # 软件提供商公司或个人名称 | ||||
| companyName: Lecoo | companyName: Lecoo | ||||
| productName: 黄江科技馆票务系统 | |||||
| productName: 数字人后台管理系统 | |||||
| #是否演示模式 | #是否演示模式 | ||||
| @@ -167,7 +169,7 @@ user: | |||||
| # # JSON格式说明:{"用户类型":{"dao":"Dao的Bean名称","loginView":"登录视图","indexView":"主页框架面视图"}} | # # JSON格式说明:{"用户类型":{"dao":"Dao的Bean名称","loginView":"登录视图","indexView":"主页框架面视图"}} | ||||
| userTypeMap: > | userTypeMap: > | ||||
| { | { | ||||
| "employee":{"dao":"employeeDao","loginView":"wx/sysLogin","indexView":"wx/sysIndex"}, | |||||
| "employee":{"dao":"employeeDao","loginView":"wx/sysLogin","indexView":"wx/sysIndex2"}, | |||||
| "member":{"dao":"memberDao","loginView":"","indexView":"modules/sys/sysIndexMember"}, | "member":{"dao":"memberDao","loginView":"","indexView":"modules/sys/sysIndexMember"}, | ||||
| "btype":{"dao":"btypeInfoDao","loginView":"","indexView":"modules/sys/sysIndexBtype"}, | "btype":{"dao":"btypeInfoDao","loginView":"","indexView":"modules/sys/sysIndexBtype"}, | ||||
| "persion":{"dao":"persionDao","loginView":"wx/sysLogin","indexView":"wx/sysIndex"}, | "persion":{"dao":"persionDao","loginView":"wx/sysLogin","indexView":"wx/sysIndex"}, | ||||
| @@ -199,8 +201,10 @@ shiro: | |||||
| /backup/** = anon | /backup/** = anon | ||||
| /visitor/** = anon | /visitor/** = anon | ||||
| /f/** = anon | /f/** = anon | ||||
| #/ReportServer/** = user | #/ReportServer/** = user | ||||
| #${adminPath}/** = user | #${adminPath}/** = user | ||||
| #${adminPath}/sys/device/remoteConfig = anon | |||||
| ## Session 相关 | ## Session 相关 | ||||
| #session: | #session: | ||||
| @@ -390,36 +394,45 @@ wx: | |||||
| port: 6379 | port: 6379 | ||||
| configs: | configs: | ||||
| # - appId: wx80dc26b645077e97 # 第一个公众号的appid | # - appId: wx80dc26b645077e97 # 第一个公众号的appid | ||||
| - appId: ENC(eZxOTsJO31L8EmjECBVsUWbv0DUa9hGU0l3LqPUrLDQ=) # 第一个公众号的appid | |||||
| # - appId: wxcea6b4840efb906e # 第一个公众号的appid | |||||
| - appId: ENC(5ZzYjATZAQK3mSkZKTPuHEqgIQRv8ADix8SsVZdfeAg=) # 第一个公众号的appid | |||||
| # secret: 5fea919f2cb1b320cebdb9896f697361 # 公众号的appsecret | # secret: 5fea919f2cb1b320cebdb9896f697361 # 公众号的appsecret | ||||
| secret: ENC(XHPy8rxb7MlPaeBbmPjHZGu9bqRGWY8IKWCmG3NSwygAMXqcqcFNUksMKukd5eHH) # 公众号的appsecret | secret: ENC(XHPy8rxb7MlPaeBbmPjHZGu9bqRGWY8IKWCmG3NSwygAMXqcqcFNUksMKukd5eHH) # 公众号的appsecret | ||||
| token: 83u4h # 接口配置里的Token值 | token: 83u4h # 接口配置里的Token值 | ||||
| templateSendUrl: http://www.hjkjg.top:49180/sendMsg | templateSendUrl: http://www.hjkjg.top:49180/sendMsg | ||||
| pushMsgTemplateId: jJhwX7j8DXM_aWME5aLcVfasNAuV5a0EEA4qJCAMJdg #成功预约 | |||||
| refundMsgTemplateId: jJhwX7j8DXM_aWME5aLcVfasNAuV5a0EEA4qJCAMJdg #退票预约 | |||||
| confirmMsgTemplateId: jJhwX7j8DXM_aWME5aLcVfasNAuV5a0EEA4qJCAMJdg #确认预约 | |||||
| auditTemplateId: Y1qGJ7SjY4GFky9V101dV8rYQzDR1uZ8g3e6d16M1Ts | auditTemplateId: Y1qGJ7SjY4GFky9V101dV8rYQzDR1uZ8g3e6d16M1Ts | ||||
| meetingTemplateId: XvooIa-05NHGWGyD6Cf4mE1-LaruFFGJMjxaXyLC73M | |||||
| regAuditTemplateId: RYDfkUjIRHnCWSy_O1XfDaFT9uE-jYqDAtrpkp49350 | regAuditTemplateId: RYDfkUjIRHnCWSy_O1XfDaFT9uE-jYqDAtrpkp49350 | ||||
| url: ${sys.baseUrl}/f/wx/oauth2 | url: ${sys.baseUrl}/f/wx/oauth2 | ||||
| sys: | sys: | ||||
| baseUrl: https://dev.hjkjg.top | |||||
| baseUrl: http://ai.lecooai.com | |||||
| # baseUrl: http://127.0.0.1:${server.port} | # baseUrl: http://127.0.0.1:${server.port} | ||||
| error: | error: | ||||
| returnButton: 返回登陆页面 | returnButton: 返回登陆页面 | ||||
| api: | api: | ||||
| apiKey: sys_ticket_hj | apiKey: sys_ticket_hj | ||||
| apiKey2: sys_digimeta_ai | |||||
| KeySecrect: 68c62ff7-d9e2-414b-aba9-2aadf8adca20 | KeySecrect: 68c62ff7-d9e2-414b-aba9-2aadf8adca20 | ||||
| mms: | mms: | ||||
| accessKeyId: LTAI5tQr5ydtSqnzcXMRxR1G | |||||
| accessKeySecrect: 86wHdKw1kMR3apCMnWES5NuJk28iM2 | |||||
| receptionPhones: 18910801519 | |||||
| accessKeyId: LTAI5tR67Z2jD21XdjZppe2E | |||||
| accessKeySecrect: 1q8QkQEzc8UZ3JmH8nt73tP1etO5Px | |||||
| endpoint: dysmsapi.aliyuncs.com | endpoint: dysmsapi.aliyuncs.com | ||||
| signName: 国泰 | |||||
| signName: 来酷智能 | |||||
| signNameVisitor: 国泰访客 | signNameVisitor: 国泰访客 | ||||
| template: SMS_228835440 | template: SMS_228835440 | ||||
| carTemplate: SMS_228850376 | carTemplate: SMS_228850376 | ||||
| fixedTemplate: SMS_228835443 | fixedTemplate: SMS_228835443 | ||||
| codeTemplate: SMS_229300003 | codeTemplate: SMS_229300003 | ||||
| meetingOrderTemplate: SMS_269450061 | |||||
| meetingQuitTemplate: SMS_269585065 | |||||
| meetingRemindTemplate: SMS_269405069 | |||||
| defaultRemindTemplate: SMS_269580409 | |||||
| robotName: 小酷 | |||||
| record: | record: | ||||
| status: | status: | ||||
| @@ -476,6 +489,10 @@ jasypt: | |||||
| algorithm: PBEWithMD5AndDES | algorithm: PBEWithMD5AndDES | ||||
| iv-generator-classname: org.jasypt.iv.NoIvGenerator | iv-generator-classname: org.jasypt.iv.NoIvGenerator | ||||
| proxy-property-sources: true | proxy-property-sources: true | ||||
| password: lecooHjkjg | |||||
| # property: | # property: | ||||
| # prefix: "ENC@[" | # prefix: "ENC@[" | ||||
| # suffix: "]" | |||||
| # suffix: "]" | |||||
| @@ -15,4 +15,8 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="findByUserCode" parameterType="String" resultType="com.lecoo.kjg.web.sys.entity.AccessControlGroup"> | |||||
| select * from tf_project_access_control_group acg where acg.office_code in (select ctrl_data from tf_sys_user_data_scope where user_code=#{userCode}) | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -79,5 +79,14 @@ | |||||
| GROUP BY date | GROUP BY date | ||||
| </select> | </select> | ||||
| <select id="findTodayList" parameterType="String" resultType="com.lecoo.kjg.web.sys.entity.CheckRecords"> | |||||
| SELECT cr.* FROM an_check_records cr | |||||
| <where> | |||||
| <if test="id != null and id != ''">AND cr.user_id = #{id}</if> | |||||
| AND check_time <![CDATA[>=]]> current_date | |||||
| </where> | |||||
| order by check_time desc limit 2 | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -10,6 +10,12 @@ | |||||
| </select> | </select> | ||||
| <select id="findByRelationId" parameterType="String" resultType="DeviceExt"> | |||||
| SELECT * FROM tf_project_device_ext WHERE relation_id = #{devId} limit 1; | |||||
| </select> | |||||
| <delete id="deleteByDevId" parameterType="String"> | <delete id="deleteByDevId" parameterType="String"> | ||||
| delete from tf_project_device_ext where device_id = #{devId} | delete from tf_project_device_ext where device_id = #{devId} | ||||
| </delete> | </delete> | ||||
| @@ -38,6 +38,10 @@ | |||||
| select * from tf_project_emp e where e.office_code in (select s.ctrl_data from tf_sys_user_data_scope s where s.user_code = #{userCode} and s.ctrl_type='Office'); | select * from tf_project_emp e where e.office_code in (select s.ctrl_data from tf_sys_user_data_scope s where s.user_code = #{userCode} and s.ctrl_type='Office'); | ||||
| </select> | </select> | ||||
| <select id="findByName" parameterType="java.lang.String" resultType="com.lecoo.kjg.web.sys.entity.Emp"> | |||||
| select * from tf_project_emp e where e.office_code = #{officeCode} AND e.real_name = #{name}; | |||||
| </select> | |||||
| <select id="findEmployeeCountByOfficeCode" parameterType="String" resultType="java.lang.Long"> | <select id="findEmployeeCountByOfficeCode" parameterType="String" resultType="java.lang.Long"> | ||||
| SELECT count(id) FROM tf_project_emp WHERE office_code = #{officeCode} AND status in ("0", "4", "10", "11") | SELECT count(id) FROM tf_project_emp WHERE office_code = #{officeCode} AND status in ("0", "4", "10", "11") | ||||
| </select> | </select> | ||||
| @@ -91,4 +95,7 @@ | |||||
| where office_code in (SELECT DISTINCT office_code FROM tf_sys_office o where parent_codes like concat(#{officeCode}, ',%') or parent_codes like concat('%,', #{officeCode}, ',%') or office_code = #{officeCode}) | where office_code in (SELECT DISTINCT office_code FROM tf_sys_office o where parent_codes like concat(#{officeCode}, ',%') or parent_codes like concat('%,', #{officeCode}, ',%') or office_code = #{officeCode}) | ||||
| </delete> | </delete> | ||||
| <select id="findByName2" parameterType="java.lang.String" resultType="com.lecoo.kjg.web.sys.entity.Emp"> | |||||
| select * from tf_project_emp e where e.real_name like concat('%', #{name}, '%') or e.nick_name like concat('%', #{name}, '%'); | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -22,5 +22,15 @@ | |||||
| </delete> | </delete> | ||||
| <select id="getOfficeListByUserCode" parameterType="String" resultType="com.jeesite.modules.sys.entity.Office"> | |||||
| SELECT * FROM tf_sys_office o join tf_sys_user e on (o.office_code=e.corp_code or o.parent_codes like concat('%,',e.corp_code,',%')) and e.user_code=#{userCode}; | |||||
| </select> | |||||
| <select id="getOfficeListByOffice" parameterType="String" resultType="com.jeesite.modules.sys.entity.Office"> | |||||
| SELECT * FROM tf_sys_office o where o.office_code=#{officeCode} or o.parent_codes like concat('%,',#{officeCode},',%'); | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -23,4 +23,12 @@ | |||||
| </select> | </select> | ||||
| <select id="findAccessControlByOfficeCodes" parameterType="Object" resultType="com.lecoo.kjg.web.sys.entity.OfficeAccessControl"> | |||||
| SELECT * FROM tf_project_office_access_control WHERE office_id in | |||||
| <foreach item="item" collection="officeCodes" index="index" open="(" separator="," close=")"> | |||||
| #{item} | |||||
| </foreach> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -55,4 +55,8 @@ | |||||
| update tf_sys_user set corp_code = #{corpCode}, corp_name = #{corpName} where user_code = #{userCode} | update tf_sys_user set corp_code = #{corpCode}, corp_name = #{corpName} where user_code = #{userCode} | ||||
| </update> | </update> | ||||
| <update id="updateUserCode" parameterType="String" flushCache="true" > | |||||
| update tf_sys_user set user_code = #{newCode}, login_code = #{newCode} where user_code = #{userCode} | |||||
| </update> | |||||
| </mapper> | </mapper> | ||||
| @@ -1,9 +1,9 @@ | |||||
| <?xml version="1.0" encoding="UTF-8" ?> | <?xml version="1.0" encoding="UTF-8" ?> | ||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.lecoo.kjg.web.sys.dao.MuseumDao"> | |||||
| <mapper namespace="com.lecoo.kjg.web.meeting.dao.MeetingRoomDao"> | |||||
| <!-- 查询数据 | <!-- 查询数据 | ||||
| <select id="findList" resultType="Museum"> | |||||
| <select id="findList" resultType="MeetingRoom"> | |||||
| SELECT ${sqlMap.column.toSql()} | SELECT ${sqlMap.column.toSql()} | ||||
| FROM ${sqlMap.table.toSql()} | FROM ${sqlMap.table.toSql()} | ||||
| <where> | <where> | ||||
| @@ -0,0 +1,65 @@ | |||||
| <?xml version="1.0" encoding="UTF-8" ?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.lecoo.kjg.web.meeting.dao.MeetingRoomOrderDao"> | |||||
| <!-- 查询数据 | |||||
| <select id="findList" resultType="MeetingRoomOrder"> | |||||
| SELECT ${sqlMap.column.toSql()} | |||||
| FROM ${sqlMap.table.toSql()} | |||||
| <where> | |||||
| ${sqlMap.where.toSql()} | |||||
| </where> | |||||
| ORDER BY ${sqlMap.order.toSql()} | |||||
| </select> --> | |||||
| <select id="queryByOrder" parameterType="Object" resultType="MeetingRoomOrder"> | |||||
| SELECT * FROM meeting_room_order WHERE room_id=#{roomId} AND order_date = #{orderDate} AND ((order_time <![CDATA[<=]]> #{orderTime} AND end_time<![CDATA[>]]> #{orderTime}) or (order_time <![CDATA[<]]> #{endTime} AND end_time <![CDATA[>=]]> #{endTime})) | |||||
| </select> | |||||
| <select id="findListByDate" parameterType="Object" resultType="MeetingRoomOrder"> | |||||
| SELECT * FROM meeting_room_order WHERE order_date = #{orderDate} AND room_id = #{roomId} | |||||
| </select> | |||||
| <select id="findListByDateStr" parameterType="Object" resultType="MeetingRoomOrder"> | |||||
| SELECT * FROM meeting_room_order WHERE order_date = #{orderDate} AND room_id in (select id from meeting_room where office_code = #{officeCode}) | |||||
| </select> | |||||
| <select id="findListByPerson" parameterType="Object" resultType="MeetingRoomOrder"> | |||||
| SELECT * FROM meeting_room_order where order_date <![CDATA[>=]]> CURRENT_DATE AND order_by = #{orderBy} | |||||
| </select> | |||||
| <select id="findListByEmps" parameterType="Object" resultType="MeetingRoomOrder"> | |||||
| SELECT * FROM meeting_room_order where order_date <![CDATA[>=]]> #{startDate} AND order_date <![CDATA[<]]> #{endDate} AND order_by in | |||||
| <foreach item="item" collection="empIds" index="index" open="(" separator="," close=")"> | |||||
| #{item} | |||||
| </foreach> | |||||
| </select> | |||||
| <select id="findListByEmp" parameterType="Object" resultType="MeetingRoomOrder"> | |||||
| SELECT * FROM meeting_room_order where order_date <![CDATA[>=]]> #{startDate} AND order_date <![CDATA[<]]> #{endDate} AND order_by = #{empId} | |||||
| </select> | |||||
| <select id="findListByEmpId" parameterType="Object" resultType="MeetingRoomOrder"> | |||||
| SELECT * FROM meeting_room_order where order_date <![CDATA[>=]]> CURRENT_DATE AND order_by = #{empId} | |||||
| </select> | |||||
| <select id="findLastByEmpId" parameterType="Object" resultType="MeetingRoomOrder"> | |||||
| SELECT * FROM meeting_room_order where order_by = #{empId} order By id desc LIMIT 1 | |||||
| </select> | |||||
| <select id="findListTodayHour" resultType="MeetingRoomOrder"> | |||||
| select * from meeting_room_order where order_date = CURRENT_DATE AND DATE_FORMAT(CURRENT_TIME,"%H:%i:00") = date_add(order_time,interval -15 minute) | |||||
| </select> | |||||
| <select id="ableOrder" parameterType="Object" resultType="MeetingRoomOrder"> | |||||
| SELECT * FROM meeting_room_order | |||||
| <where> | |||||
| <if test="roomId != null and roomId != ''">AND room_id=#{roomId} </if> | |||||
| <if test="orderDate != null and orderDate != ''">AND order_date=#{orderDate} </if> | |||||
| <if test="orderTime != null and orderTime != ''">AND ((order_time <![CDATA[<=]]> #{orderTime} AND end_time<![CDATA[>]]> #{orderTime}) or (order_time <![CDATA[<]]> #{endTime} AND end_time <![CDATA[>=]]> #{endTime})) </if> | |||||
| </where> | |||||
| order by room_id, order_time | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -1,8 +1,8 @@ | |||||
| @font-face { | @font-face { | ||||
| font-family: "iconfont"; /* Project id 3294465 */ | font-family: "iconfont"; /* Project id 3294465 */ | ||||
| src: url('../font/iconfont2.woff2?t=1656085665505') format('woff2'), | |||||
| url('../font/iconfont2.woff?t=1656085665505') format('woff'), | |||||
| url('../font/iconfont2.ttf?t=1656085665505') format('truetype'); | |||||
| src: url('../font/iconfont2.woff2?t=1669647660511') format('woff2'), | |||||
| url('../font/iconfont2.woff?t=1669647660511') format('woff'), | |||||
| url('../font/iconfont2.ttf?t=1669647660511') format('truetype'); | |||||
| } | } | ||||
| .iconfont { | .iconfont { | ||||
| @@ -13,6 +13,15 @@ | |||||
| -moz-osx-font-smoothing: grayscale; | -moz-osx-font-smoothing: grayscale; | ||||
| } | } | ||||
| .icon-huiyishi:before { | |||||
| content: "\e6dc"; | |||||
| } | |||||
| .icon-huiyishi1:before { | |||||
| content: "\e690"; | |||||
| } | |||||
| .icon-vcard-o:before { | .icon-vcard-o:before { | ||||
| content: "\e731"; | content: "\e731"; | ||||
| } | } | ||||
| @@ -512,7 +512,7 @@ body { | |||||
| } | } | ||||
| /* 表格搜索框样式 */ | /* 表格搜索框样式 */ | ||||
| .table-search .form-group .control-inline{ | .table-search .form-group .control-inline{ | ||||
| width: 204px !important; | |||||
| width: 204px; | |||||
| } | } | ||||
| /*layui下拉框样式*/ | /*layui下拉框样式*/ | ||||
| .layui-form-select dl dd.layui-this{ | .layui-form-select dl dd.layui-this{ | ||||
| @@ -1 +1 @@ | |||||
| .login-page{background:#e3e7ec}.login-page .login-box{width:auto}.login-page .login-logo a{color:#666}.login-page .login-logo small{font-size:16px}.login-page .login-box-body{width:360px;margin:auto;padding:28px;background:#fff;box-shadow:0 2px 6px #999;border-radius:5px}.login-page .login-box-body .form-control-feedback{cursor:pointer;pointer-events:auto}.login-page .form-group{margin-top:5px;margin-bottom:23px}.login-page .has-feedback .form-control{height:34px;padding:4px 10px}.login-page .input-group-btn .btn{height:34px}.login-page .btn{padding:5px 10px 4px 10px;font-size:15px}.login-page .select2-container .select2-selection--single{padding:6px 12px;height:34px}.login-page .select2-container--default.select2-container--focus .select2-selection--single{border-color:#3c8dbc}.login-page .select2-container .select2-selection--single .select2-selection__rendered{margin-top:-4px}.login-page .select2-container .select2-selection--single .select2-selection__arrow{top:1px}.login-page .select2-search--dropdown .select2-search__field{padding:4px}.login-page .select2-results__option{padding:6px 12px}.login-page .login-copyright{text-align:center;margin-top:20px}.login-page .login-copyright,.login-page .login-copyright a{color:#666} | |||||
| .login-page{background:#e3e7ec}.login-page .login-box{width:auto}.login-page .login-logo a{color:#666}.login-page .login-logo small{font-size:16px}.login-page .login-box-body{width:360px;margin:auto;padding:28px;background:#fff;box-shadow:0 2px 6px #999;border-radius:5px}.login-page .login-box-body .form-control-feedback{cursor:pointer;pointer-events:auto}.login-page .form-group{margin-top:5px;margin-bottom:23px}.login-page .has-feedback .form-control{height:34px;padding:4px 10px}.login-page .input-group-btn .btn{height:34px}.login-page .btn{padding:0px 10px 0px 10px;font-size:15px}.login-page .select2-container .select2-selection--single{padding:6px 12px;height:34px}.login-page .select2-container--default.select2-container--focus .select2-selection--single{border-color:#3c8dbc}.login-page .select2-container .select2-selection--single .select2-selection__rendered{margin-top:-4px}.login-page .select2-container .select2-selection--single .select2-selection__arrow{top:1px}.login-page .select2-search--dropdown .select2-search__field{padding:4px}.login-page .select2-results__option{padding:6px 12px}.login-page .login-copyright{text-align:center;margin-top:20px}.login-page .login-copyright,.login-page .login-copyright a{color:#666} | |||||
| @@ -337,6 +337,9 @@ $(function(){ | |||||
| }, | }, | ||||
| loadTree2 = function(){ | loadTree2 = function(){ | ||||
| js.ajaxSubmit("${ctx}/sys/ac/treeData?___t=" + new Date().getTime(), {ctrlPermi:'2'/*1拥有的权限 2管理的权限*/}, function(data){ | js.ajaxSubmit("${ctx}/sys/ac/treeData?___t=" + new Date().getTime(), {ctrlPermi:'2'/*1拥有的权限 2管理的权限*/}, function(data){ | ||||
| if (data.length == 1) { | |||||
| data = []; | |||||
| } | |||||
| tree2 = $.fn.zTree.init($("#treeDemo2"), genSetting(1,"treeDemo2"), data);//.expandAll(true); | tree2 = $.fn.zTree.init($("#treeDemo2"), genSetting(1,"treeDemo2"), data);//.expandAll(true); | ||||
| tree2.expandAll(true);//展开所有 | tree2.expandAll(true);//展开所有 | ||||
| // 展开第一级节点 | // 展开第一级节点 | ||||
| @@ -78,11 +78,11 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <% if (@RoleUtils.hasUserRole(admin.userCode,"secAdmin")) { %> | |||||
| <% if (@RoleUtils.hasUserRole(admin.userCode,"secAdmin") || @RoleUtils.hasUserRole(admin.userCode,"corpAdmin")) { %> | |||||
| <div class="row"> | <div class="row"> | ||||
| <div class="col-xs-12"> | <div class="col-xs-12"> | ||||
| <div class="form-group" style="margin-bottom: 37px;"> | <div class="form-group" style="margin-bottom: 37px;"> | ||||
| <p style="margin-bottom:30px">管辖公司</p> | |||||
| <p style="margin-bottom:30px">管辖公司(二级)</p> | |||||
| <div> | <div> | ||||
| <!--<#form:checkbox id="offices" name="officeIds" items="${officeList}" itemLabel="officeName" itemValue="officeCode" class="form-control"/>--> | <!--<#form:checkbox id="offices" name="officeIds" items="${officeList}" itemLabel="officeName" itemValue="officeCode" class="form-control"/>--> | ||||
| <select name="officeIds" id="sel-office"> | <select name="officeIds" id="sel-office"> | ||||
| @@ -397,7 +397,7 @@ | |||||
| </div> | </div> | ||||
| </div>--> | </div>--> | ||||
| <!--<div class="my-select col-sm-3 pl0" style="line-height: 25px;"> | |||||
| <div class="my-select col-sm-3 pl0" style="line-height: 25px;"> | |||||
| <div class="col-sm-4 pr0 pl0">进门禁行:</div> | <div class="col-sm-4 pr0 pl0">进门禁行:</div> | ||||
| <div CLASS="col-sm-6 pl0"> | <div CLASS="col-sm-6 pl0"> | ||||
| <select name="inDirClose" id="in-dir-close" lay-verify="required" lay-filter="in-dir-close"> | <select name="inDirClose" id="in-dir-close" lay-verify="required" lay-filter="in-dir-close"> | ||||
| @@ -417,7 +417,7 @@ | |||||
| </select> | </select> | ||||
| </div> | </div> | ||||
| </div>--> | |||||
| </div> | |||||
| <div class="my-select col-sm-3 pl0 " style="line-height: 25px;"> | <div class="my-select col-sm-3 pl0 " style="line-height: 25px;"> | ||||
| <div class="col-sm-4 pr0 pl0">触发通行:</div> | <div class="col-sm-4 pr0 pl0">触发通行:</div> | ||||
| @@ -652,10 +652,10 @@ | |||||
| $(document).ready(function () { | $(document).ready(function () { | ||||
| // select下拉框选中触发事件 | // select下拉框选中触发事件 | ||||
| form.on("select", function (data) { | form.on("select", function (data) { | ||||
| if("${device.devStatus}" == 2 || !(${device.pads[0].isOnline})) { | |||||
| /*if("${device.devStatus}" == 2 || !(${device.pads[0].isOnline})) { | |||||
| layer.alert("闸机PAD处于离线状态,暂时不可进行此操作!"); | layer.alert("闸机PAD处于离线状态,暂时不可进行此操作!"); | ||||
| return; | return; | ||||
| } | |||||
| }*/ | |||||
| var actStatus = ""; | var actStatus = ""; | ||||
| var actValue = ""; | var actValue = ""; | ||||
| @@ -1,4 +1,4 @@ | |||||
| <% layout('/layouts/default.html', {title: '编辑员工信息', libs: ['validate','layout','zTree']}){ %> | |||||
| <% layout('/layouts/default.html', {title: '编辑人员信息', libs: ['validate','layout','zTree']}){ %> | |||||
| <style> | <style> | ||||
| .box-body{ | .box-body{ | ||||
| padding: 42px 0 20px !important; | padding: 42px 0 20px !important; | ||||
| @@ -150,9 +150,9 @@ p{ | |||||
| <div class="col-xs-6"> | <div class="col-xs-6"> | ||||
| <div class="form-group"> | <div class="form-group"> | ||||
| <div class="col-sm-7 add-delete-btn"> | <div class="col-sm-7 add-delete-btn"> | ||||
| <p>员工编号</p> | |||||
| <p>昵称</p> | |||||
| <i class="layui-icon reset_input"></i> | <i class="layui-icon reset_input"></i> | ||||
| <#form:input path="jobNumber" maxlength="100" class="form-control"/> | |||||
| <#form:input path="nickName" maxlength="100" class="form-control"/> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -161,8 +161,8 @@ p{ | |||||
| <div class="col-xs-6"> | <div class="col-xs-6"> | ||||
| <div class="form-group"> | <div class="form-group"> | ||||
| <div class="col-sm-8"> | <div class="col-sm-8"> | ||||
| <p><span class="required" style="color:#e02222">*</span>手机号</p> | |||||
| <#form:input path="phoneNumber" maxlength="100" class="form-control required phone isExsitPhone"/> | |||||
| <p>手机号</p> | |||||
| <#form:input path="phoneNumber" maxlength="100" class="form-control phone isExsitPhone"/> | |||||
| <!--<div class="text_content" >${emp.realName}</div>--> | <!--<div class="text_content" >${emp.realName}</div>--> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -195,13 +195,34 @@ p{ | |||||
| <div class="col-xs-6"> | <div class="col-xs-6"> | ||||
| <div class="form-group"> | <div class="form-group"> | ||||
| <div class="col-sm-7"> | <div class="col-sm-7"> | ||||
| <p>员工类型</p> | |||||
| <p>人员类型</p> | |||||
| <#form:select path="empType" dictType="sys_emp_type" class="form-control"/> | <#form:select path="empType" dictType="sys_emp_type" class="form-control"/> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="row"> | |||||
| <div class="col-xs-6"> | |||||
| <div class="form-group"> | |||||
| <div class="col-sm-7"> | |||||
| <p>性别</p> | |||||
| <#form:select path="gender" dictType="sys_user_sex" class="form-control"/> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| <div class="col-xs-6"> | |||||
| <div class="form-group"> | |||||
| <div class="col-sm-7 add-delete-btn"> | |||||
| <p>人员编号</p> | |||||
| <i class="layui-icon reset_input"></i> | |||||
| <#form:input path="jobNumber" maxlength="100" class="form-control"/> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| <div class="row" style="margin-right: 20px;padding-left:15px;display: none;"> | <div class="row" style="margin-right: 20px;padding-left:15px;display: none;"> | ||||
| <div class="line"></div> | <div class="line"></div> | ||||
| </div> | </div> | ||||
| @@ -252,7 +273,7 @@ p{ | |||||
| if(!("${emp.id}")) { | if(!("${emp.id}")) { | ||||
| str = "新增"; | str = "新增"; | ||||
| } | } | ||||
| childAddNav(str+"员工","sys/emp/form",2); | |||||
| childAddNav(str+"人员","sys/emp/form",2); | |||||
| function photoCompress(file, w, objDiv) { | function photoCompress(file, w, objDiv) { | ||||
| @@ -493,7 +514,7 @@ p{ | |||||
| var dateStr = year + "-" + month + "-" + date; | var dateStr = year + "-" + month + "-" + date; | ||||
| var timesDate = new Date(dateStr.replace("-", "/").replace("-", "/"));//获取当前时间戳 | var timesDate = new Date(dateStr.replace("-", "/").replace("-", "/"));//获取当前时间戳 | ||||
| if( timesVal < timesDate ){ | if( timesVal < timesDate ){ | ||||
| js.showMessage("门禁有效期小于当前时间,会导致员工无所有门禁权限!"); | |||||
| js.showMessage("门禁有效期小于当前时间,会导致人员无所有门禁权限!"); | |||||
| } | } | ||||
| }; | }; | ||||
| $("#inputForm").validate({ | $("#inputForm").validate({ | ||||
| @@ -1,4 +1,4 @@ | |||||
| <% layout('/layouts/default.html', {title: '员工列表', libs: | |||||
| <% layout('/layouts/default.html', {title: '人员列表', libs: | |||||
| ['dataGrid','fileupload'], bodyClass: ''}){ %> | ['dataGrid','fileupload'], bodyClass: ''}){ %> | ||||
| <style> | <style> | ||||
| .avatar{ | .avatar{ | ||||
| @@ -38,8 +38,8 @@ | |||||
| <div class="box-body"> | <div class="box-body"> | ||||
| <div class="box-tools pull-left" style="padding: 0 10px;"> | <div class="box-tools pull-left" style="padding: 0 10px;"> | ||||
| <% if(hasPermi("sys:emp:import")) { %> | <% if(hasPermi("sys:emp:import")) { %> | ||||
| <!--<button id="importEmp" class="button black center" title="导入员工信息" style="width: 110px;">导入员工信息</button>--> | |||||
| <a onclick=openPage("新增员工","${ctx}/sys/emp/form","2")><button id="addEmp" class="button black center" title="新增员工" style="width: 110px;">新增员工</button></a> | |||||
| <!--<button id="importEmp" class="button black center" title="导入人员信息" style="width: 110px;">导入人员信息</button>--> | |||||
| <a onclick=openPage("新增人员","${ctx}/sys/emp/form","2")><button id="addEmp" class="button black center" title="新增人员" style="width: 110px;">新增人员</button></a> | |||||
| <% } %> | <% } %> | ||||
| </div> | </div> | ||||
| <#form:form id="searchForm" model="${emp}" style="float: right;margin-top:10px;padding-right: 10px;" | <#form:form id="searchForm" model="${emp}" style="float: right;margin-top:10px;padding-right: 10px;" | ||||
| @@ -51,15 +51,15 @@ | |||||
| <input id="containPhoto" name="containPhoto" type="hidden" value="0"> | <input id="containPhoto" name="containPhoto" type="hidden" value="0"> | ||||
| <input id="btnType" name="btnType" type="hidden" value="1"> | <input id="btnType" name="btnType" type="hidden" value="1"> | ||||
| <!-- <div class="form-group"> | <!-- <div class="form-group"> | ||||
| <label class="control-label">员工类型:</label> | |||||
| <label class="control-label">人员类型:</label> | |||||
| <div class="control-inline emp_type" style="width: 80px !important;"> | <div class="control-inline emp_type" style="width: 80px !important;"> | ||||
| <#form:select path="empType" dictType="sys_emp_type" blankOption="true" blankOptionLabel="所有" class="form-control emp_type" /> | <#form:select path="empType" dictType="sys_emp_type" blankOption="true" blankOptionLabel="所有" class="form-control emp_type" /> | ||||
| </div> | </div> | ||||
| </div>--> | </div>--> | ||||
| <div class="form-group"> | <div class="form-group"> | ||||
| <label class="control-label">员工状态:</label> | |||||
| <label class="control-label">人员类型:</label> | |||||
| <div class="control-inline" style="width: 80px !important;"> | <div class="control-inline" style="width: 80px !important;"> | ||||
| <#form:select path="status" id="status" dictType="sys_status" blankOption="true" blankOptionLabel="所有" blankOptionValue="-1" class="form-control auth_mode" /> | |||||
| <#form:select path="empType" id="emp_type" dictType="sys_emp_type" blankOption="true" blankOptionLabel="所有" blankOptionValue="-1" class="form-control auth_mode" /> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="form-group" style="width: 204px;"> | <div class="form-group" style="width: 204px;"> | ||||
| @@ -82,7 +82,7 @@ | |||||
| <!-- 选择时间 --> | <!-- 选择时间 --> | ||||
| <div id="choose_office_dialog" class="layui_pop" style="display: none;"> | <div id="choose_office_dialog" class="layui_pop" style="display: none;"> | ||||
| <div class="layui-form-item layui_pop_header"> | <div class="layui-form-item layui_pop_header"> | ||||
| <div class="layui_header_title">添加员工所属组织</div> | |||||
| <div class="layui_header_title">添加人员所属组织</div> | |||||
| <div class="layui_header_close" id="layui_header_close1"></div> | <div class="layui_header_close" id="layui_header_close1"></div> | ||||
| </div> | </div> | ||||
| <div class="layui-form"> | <div class="layui-form"> | ||||
| @@ -135,8 +135,8 @@ | |||||
| </h4> | </h4> | ||||
| </div> | </div> | ||||
| <div class="modal-body"> | <div class="modal-body"> | ||||
| 员工信息删除后,如需添加此员工,<br/> | |||||
| 请员工重新从公众号自行注册,确认删除? | |||||
| 人员信息删除后,如需添加此人员,<br/> | |||||
| 请人员重新从公众号自行注册,确认删除? | |||||
| </div> | </div> | ||||
| <div class="modal-footer" style="border: none;"> | <div class="modal-footer" style="border: none;"> | ||||
| <button type="button" id="confirm-delete" class="button red center" style="margin-left:10px"> | <button type="button" id="confirm-delete" class="button red center" style="margin-left:10px"> | ||||
| @@ -238,14 +238,14 @@ var allowImageType = ['.gif','.bmp','.jpeg','.jpg','.ico','.png','.tif','.tiff'] | |||||
| var deleteUrl = ""; | var deleteUrl = ""; | ||||
| var imgUrl = '${@Global.getConfig("faceFile.imgServer.url")}'; | var imgUrl = '${@Global.getConfig("faceFile.imgServer.url")}'; | ||||
| var tableHeader; | var tableHeader; | ||||
| //员工列表 | |||||
| //人员列表 | |||||
| var pageSize = 0; | var pageSize = 0; | ||||
| $("button[type='submit']").click(function(){ | $("button[type='submit']").click(function(){ | ||||
| $('#btnType').val("1"); | $('#btnType').val("1"); | ||||
| }) | }) | ||||
| tableRender(); | tableRender(); | ||||
| //上传人脸照片注册员工 | |||||
| //上传人脸照片注册人员 | |||||
| var chooseFileNum = 0; | var chooseFileNum = 0; | ||||
| var registeSuccessNum = 0; | var registeSuccessNum = 0; | ||||
| var resultText = []; | var resultText = []; | ||||
| @@ -355,7 +355,7 @@ upload.render({ | |||||
| layer.closeAll(); | layer.closeAll(); | ||||
| },3000); | },3000); | ||||
| } | } | ||||
| //刷新员工列表 | |||||
| //刷新人员列表 | |||||
| $('#dataGrid').dataGrid("reloadGrid"); | $('#dataGrid').dataGrid("reloadGrid"); | ||||
| $('#failedList').val(JSON.stringify(failedFiles)); | $('#failedList').val(JSON.stringify(failedFiles)); | ||||
| failedFiles = []; | failedFiles = []; | ||||
| @@ -378,7 +378,7 @@ upload.render({ | |||||
| chooseFileNum = 0; | chooseFileNum = 0; | ||||
| registeSuccessNum = 0; | registeSuccessNum = 0; | ||||
| resultText = []; | resultText = []; | ||||
| openPage("员工管理", "/console/sys/emp/list", 1); | |||||
| openPage("人员管理", "/console/sys/emp/list", 1); | |||||
| }); | }); | ||||
| $("#layui_header_close2").click(function(){ | $("#layui_header_close2").click(function(){ | ||||
| $("#add_remind").hide(); | $("#add_remind").hide(); | ||||
| @@ -397,7 +397,7 @@ upload.render({ | |||||
| return officeCode; | return officeCode; | ||||
| } | } | ||||
| //导出员工数据 | |||||
| //导出人员数据 | |||||
| $('#btnExport').click(function(){ | $('#btnExport').click(function(){ | ||||
| layer.open({ | layer.open({ | ||||
| content: '导出的信息中是否包含照片信息?' | content: '导出的信息中是否包含照片信息?' | ||||
| @@ -442,7 +442,7 @@ upload.render({ | |||||
| }); | }); | ||||
| //删除员工信息 | |||||
| //删除人员信息 | |||||
| function deleteRow( urlStr ){ | function deleteRow( urlStr ){ | ||||
| $("#deleteModal").modal({show:true}); | $("#deleteModal").modal({show:true}); | ||||
| deleteUrl = urlStr; | deleteUrl = urlStr; | ||||
| @@ -499,7 +499,7 @@ function resetTableHeader(){ | |||||
| sortable : false | sortable : false | ||||
| }, | }, | ||||
| { | { | ||||
| header : '员工类型', | |||||
| header : '人员类型', | |||||
| name : 'empType', | name : 'empType', | ||||
| index : 'a.emp_type', | index : 'a.emp_type', | ||||
| width : 100, | width : 100, | ||||
| @@ -509,7 +509,7 @@ function resetTableHeader(){ | |||||
| return js.getDictLabel(${@DictUtils.getDictListJson('sys_emp_type')}, val, '-', true); | return js.getDictLabel(${@DictUtils.getDictListJson('sys_emp_type')}, val, '-', true); | ||||
| } | } | ||||
| },{ | },{ | ||||
| header : '员工状态', | |||||
| header : '人员状态', | |||||
| name : 'status', | name : 'status', | ||||
| index : 'a.status', | index : 'a.status', | ||||
| width : 100, | width : 100, | ||||
| @@ -559,7 +559,7 @@ function resetTableHeader(){ | |||||
| formatter : function(val, obj, row, act) { | formatter : function(val, obj, row, act) { | ||||
| var actions = []; | var actions = []; | ||||
| actions.push('<a onclick=openPage("编辑员工","${ctx}/sys/emp/form?id=' + row.id + '","2")>编辑</a> '); | |||||
| actions.push('<a onclick=openPage("编辑人员","${ctx}/sys/emp/form?id=' + row.id + '","2")>编辑</a> '); | |||||
| actions.push('<a onclick=deleteRow("${ctx}/sys/emp/delete?id='+ row.id +'") >删除</a> '); | actions.push('<a onclick=deleteRow("${ctx}/sys/emp/delete?id='+ row.id +'") >删除</a> '); | ||||
| @@ -567,7 +567,7 @@ function resetTableHeader(){ | |||||
| // if ("dev" == "${@Global.getConfig("spring.profiles.active")}"){ | // if ("dev" == "${@Global.getConfig("spring.profiles.active")}"){ | ||||
| // actions.push('<a onclick=openPage("员工记录","${ctx}/sys/face/emp-face-list?emp.id=' + row.id + '&emp.realName=' + encodeURI(row.realName) + '","2")>记录</a> '); | |||||
| // actions.push('<a onclick=openPage("人员记录","${ctx}/sys/face/emp-face-list?emp.id=' + row.id + '&emp.realName=' + encodeURI(row.realName) + '","2")>记录</a> '); | |||||
| actions.push('<a id="updateFace' + obj.irow + '" data-click-binded="false"><span class="btnList lastbtn" style="margin-left:10px;"></span>更换底图</a>'); | actions.push('<a id="updateFace' + obj.irow + '" data-click-binded="false"><span class="btnList lastbtn" style="margin-left:10px;"></span>更换底图</a>'); | ||||
| @@ -654,7 +654,7 @@ function tableRender(){ | |||||
| if(list.length == 0){ | if(list.length == 0){ | ||||
| return false; | return false; | ||||
| } | } | ||||
| //上传人脸照片注册员工 | |||||
| //上传人脸照片注册人员 | |||||
| list.forEach(function(val,idx){ | list.forEach(function(val,idx){ | ||||
| layui.use('upload', function() { | layui.use('upload', function() { | ||||
| var dialog = null; | var dialog = null; | ||||
| @@ -43,6 +43,10 @@ | |||||
| line-height: normal; | line-height: normal; | ||||
| } | } | ||||
| .table-search .form-group .control-inline { | |||||
| width: 110px !important; | |||||
| } | |||||
| </style> | </style> | ||||
| <div class="main-content"> | <div class="main-content"> | ||||
| @@ -62,9 +66,17 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="form-group" style="display: inline-flex;"> | |||||
| <label class="control-label">公司:</label> | |||||
| <div class="control-inline width-60"> | |||||
| <#form:select path="officeCode" id="officeCode" items="${offices}" itemLabel="officeName" itemValue="officeCode" class="form-control required"/> | |||||
| </div> | |||||
| </div> | |||||
| <div class="form-group" style="display: inline-flex;"> | <div class="form-group" style="display: inline-flex;"> | ||||
| <label class="control-label">员工类别:</label> | <label class="control-label">员工类别:</label> | ||||
| <div class="control-inline width-90"> | |||||
| <div class="control-inline width-60"> | |||||
| <#form:select path="empType" id="empType" dictType="sys_emp_type" blankOption="true" blankOptionLabel="全部" blankOptionValue="-1" class="form-control"/> | <#form:select path="empType" id="empType" dictType="sys_emp_type" blankOption="true" blankOptionLabel="全部" blankOptionValue="-1" class="form-control"/> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -104,13 +116,13 @@ function getWeekDate(date) { | |||||
| return week; | return week; | ||||
| } | } | ||||
| function renderTable(timePart, userType, name){ | |||||
| function renderTable(timePart, userType, name, officeCode){ | |||||
| var width = $(".box-body").width() - 40; | var width = $(".box-body").width() - 40; | ||||
| layui.use('table', function(){ | layui.use('table', function(){ | ||||
| var table = layui.table; | var table = layui.table; | ||||
| table.render({ | table.render({ | ||||
| elem: '#dataGrid', | elem: '#dataGrid', | ||||
| url:"${ctx}/sys/attendance/listData?timePart="+timePart+"&empName="+name+"&empType="+userType, //获取数据的接口 | |||||
| url:"${ctx}/sys/attendance/listData?timePart="+timePart+"&empName="+name+"&empType="+userType+"&officeCode="+officeCode, //获取数据的接口 | |||||
| width:width, | width:width, | ||||
| height:650, | height:650, | ||||
| cellMinWidth: 'auto', | cellMinWidth: 'auto', | ||||
| @@ -228,7 +240,7 @@ layui.use('laydate', function () { | |||||
| , btns: ['clear', 'confirm'] | , btns: ['clear', 'confirm'] | ||||
| }); | }); | ||||
| renderTable(pdate.format("YYYY-mm-dd")+" ~ "+currentDate.format("YYYY-mm-dd"), -1, ""); | |||||
| renderTable(pdate.format("YYYY-mm-dd")+" ~ "+currentDate.format("YYYY-mm-dd"), -1, "", ""); | |||||
| }); | }); | ||||
| function exportExcel(){ | function exportExcel(){ | ||||
| @@ -236,10 +248,11 @@ function exportExcel(){ | |||||
| var timePart = $("#ipt-start-time2").val(); | var timePart = $("#ipt-start-time2").val(); | ||||
| var name = $("#touristName").val(); | var name = $("#touristName").val(); | ||||
| var empType = $("#empType").val(); | var empType = $("#empType").val(); | ||||
| var officeCode = $("#officeCode").val(); | |||||
| $.ajax({ | $.ajax({ | ||||
| url:'${ctx}/sys/attendance/exportData', | url:'${ctx}/sys/attendance/exportData', | ||||
| data:{timePart:timePart, empName:name, empType: empType}, | |||||
| data:{timePart:timePart, empName:name, empType: empType, officeCode:officeCode}, | |||||
| success: function(data){ | success: function(data){ | ||||
| console.log(data); | console.log(data); | ||||
| layer.open({ | layer.open({ | ||||
| @@ -259,7 +272,8 @@ $(function() { | |||||
| var timePart = $("#ipt-start-time2").val(); | var timePart = $("#ipt-start-time2").val(); | ||||
| var name = $("#touristName").val(); | var name = $("#touristName").val(); | ||||
| var empType = $("#empType").val(); | var empType = $("#empType").val(); | ||||
| renderTable(timePart, empType, name); | |||||
| var officeCode = $("#officeCode").val(); | |||||
| renderTable(timePart, empType,name, officeCode); | |||||
| }) | }) | ||||
| }) | }) | ||||
| </script> | </script> | ||||
| @@ -1,4 +1,4 @@ | |||||
| <% layout('/layouts/default.html', {title: '黑名单管理', libs: ['dataGrid']}){ %> | |||||
| <% layout('/layouts/default.html', {title: '会议室预订管理', libs: ['dataGrid']}){ %> | |||||
| <style> | <style> | ||||
| #ipt-start-time, #ipt-start-time2{ | #ipt-start-time, #ipt-start-time2{ | ||||
| height: 28px !important; | height: 28px !important; | ||||
| @@ -43,16 +43,29 @@ | |||||
| <div class="box box-main"> | <div class="box box-main"> | ||||
| <div class="box-body" style="margin: 20px;padding: 10px 0 20px 38px;border-top: 4px solid rgb(76, 159, 237);box-shadow: 0px 0px 7px -1px;"> | <div class="box-body" style="margin: 20px;padding: 10px 0 20px 38px;border-top: 4px solid rgb(76, 159, 237);box-shadow: 0px 0px 7px -1px;"> | ||||
| <#form:form id="searchForm2" model="" style="margin:20px 0 !important;" | <#form:form id="searchForm2" model="" style="margin:20px 0 !important;" | ||||
| action="${ctx}/sys/blackRole/listData" method="post" class="form-inline table-search" | |||||
| action="${ctx}/sys/meeting/listData" method="post" class="form-inline table-search" | |||||
| data-page-no="${parameter.pageNo}" | data-page-no="${parameter.pageNo}" | ||||
| data-page-size="${parameter.pageSize}" | data-page-size="${parameter.pageSize}" | ||||
| data-order-by="${parameter.orderBy}"> | data-order-by="${parameter.orderBy}"> | ||||
| <div class="form-group" style="display: inline-flex;"> | |||||
| <label class="control-label">预约日期:</label> | |||||
| <div class="control-inline add-delete-btn" style="width:218px !important;display: flex;line-height: 28px;"> | |||||
| <i class="fa fa-calendar" style="left: 20px;position: relative;color: aliceblue;line-height: 28px;"></i><#form:input path="startDate" readonly="true" name='startDate' id='ipt-start-time2' maxlength="280" class="form-control layui-input" placeholder="" style="padding-left:26px !important;"/> | |||||
| </div> | |||||
| </div> | |||||
| <div class="form-group" style="display: inline-flex;"> | |||||
| <label class="control-label">会议室:</label> | |||||
| <div class="control-inline width-90"> | |||||
| <#form:select path="roomId" items="${roomList}" itemLabel="name" itemValue="id" blankOption="true" blankOptionLabel="全部" class="form-control"/> | |||||
| </div> | |||||
| </div> | |||||
| <div class="form-group"> | <div class="form-group"> | ||||
| <div class="control-inline" style="width: 168px !important;"> | <div class="control-inline" style="width: 168px !important;"> | ||||
| <#form:input path="touristName" id="touristName" placeholder="输入姓名或电话号搜索" class="form-control required " /> | |||||
| <#form:input path="empName" id="touristName" placeholder="输入姓名或会议主题" class="form-control required " /> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -72,23 +85,62 @@ function err(err, time){ | |||||
| layer.msg('<p class="text-red">'+err+'</p>', {icon: 5, time: time}); | layer.msg('<p class="text-red">'+err+'</p>', {icon: 5, time: time}); | ||||
| } | } | ||||
| Date.prototype.format = function (fmt) { | |||||
| var date = this; | |||||
| var ret; | |||||
| var opt = { | |||||
| "Y+": date.getFullYear().toString(), // 年 | |||||
| "m+": (date.getMonth() + 1).toString(), // 月 | |||||
| "d+": date.getDate().toString(), // 日 | |||||
| "H+": date.getHours().toString(), // 时 | |||||
| "M+": date.getMinutes().toString(), // 分 | |||||
| "S+": date.getSeconds().toString() // 秒 | |||||
| // 有其他格式化字符需求可以继续添加,必须转化成字符串 | |||||
| }; | |||||
| for (var k in opt) { | |||||
| ret = new RegExp("(" + k + ")").exec(fmt); | |||||
| if (ret) { | |||||
| fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0"))) | |||||
| }; | |||||
| }; | |||||
| return fmt; | |||||
| } | |||||
| layui.use('laydate', function () { | |||||
| var laydate = layui.laydate; | |||||
| var currentDate = new Date(); | |||||
| currentDate.setDate(currentDate.getDate()); | |||||
| var pdate = new Date(); | |||||
| pdate.setDate(1); | |||||
| laydate.render({ | |||||
| elem: '#ipt-start-time2' | |||||
| , format: 'yyyy-MM-dd' | |||||
| , range: "~" | |||||
| , type: 'date' | |||||
| , value: pdate.format("YYYY-mm-dd")+" ~ "+currentDate.format("YYYY-mm-dd") | |||||
| , btns: ['clear', 'confirm'] | |||||
| }); | |||||
| renderTable(pdate.format("YYYY-mm-dd")+" ~ "+currentDate.format("YYYY-mm-dd"), "", ""); | |||||
| }); | |||||
| function confirm(id){ | function confirm(id){ | ||||
| layerIndex = layer.open({ | layerIndex = layer.open({ | ||||
| type: 1 | type: 1 | ||||
| ,title: '解封黑名单' | |||||
| ,title: '取消会议室' | |||||
| ,area: ['35%', '25%'] | ,area: ['35%', '25%'] | ||||
| ,shade: 0.5 | ,shade: 0.5 | ||||
| ,maxmin: false | ,maxmin: false | ||||
| ,scrollbar: false | ,scrollbar: false | ||||
| ,closeBtn: 0 | ,closeBtn: 0 | ||||
| ,btn: ["解封", "取消"] | ,btn: ["解封", "取消"] | ||||
| ,content: '<div style="margin: 20px;font-size: larger;"><p>确定要解封该游客?</p></div>' | |||||
| ,content: '<div style="margin: 20px;font-size: larger;"><p>确定要取消会议室?</p></div>' | |||||
| ,yes:function (index){ | ,yes:function (index){ | ||||
| layer.close(index); | layer.close(index); | ||||
| $("#refund-ticket").submit(); | $("#refund-ticket").submit(); | ||||
| $.ajax({ | $.ajax({ | ||||
| url:"/api/ticket/blackRoleRelease",data: {id:id}, dataType:"json",method:"post", | |||||
| url:"/api/meeting/quit-order",data: {id:id}, dataType:"json",method:"post", | |||||
| success:function (data){ | success:function (data){ | ||||
| if(data.result == Global.TRUE){ | if(data.result == Global.TRUE){ | ||||
| js.showMessage(data.message); | js.showMessage(data.message); | ||||
| @@ -114,13 +166,13 @@ function confirm(id){ | |||||
| }) | }) | ||||
| } | } | ||||
| function renderTable(name){ | |||||
| function renderTable(pDate, roomId, name){ | |||||
| var width = $(".box-body").width() - 40; | var width = $(".box-body").width() - 40; | ||||
| layui.use('table', function(){ | layui.use('table', function(){ | ||||
| var table = layui.table; | var table = layui.table; | ||||
| table.render({ | table.render({ | ||||
| elem: '#dataGrid', | elem: '#dataGrid', | ||||
| url:"${ctx}/sys/blackRole/listData?touristName="+name, //获取数据的接口 | |||||
| url:"${ctx}/sys/meeting/listData?optionName="+name+"&timePart="+pDate+"&roomId="+roomId, //获取数据的接口 | |||||
| width:width, | width:width, | ||||
| height:650, | height:650, | ||||
| cellMinWidth: 'auto', | cellMinWidth: 'auto', | ||||
| @@ -134,12 +186,12 @@ function renderTable(name){ | |||||
| sort:true, | sort:true, | ||||
| cols: [[ | cols: [[ | ||||
| {type: 'numbers', title: '',fixed: 'left',width: '4%'}, | {type: 'numbers', title: '',fixed: 'left',width: '4%'}, | ||||
| {field: 'touristName', title: '姓名', fixed: 'left',width: '11%'}, | |||||
| {field: 'touristPersonId', title: '证件号', fixed: 'left',width: '17%'}, | |||||
| {field: 'touristPhone', title: '手机号', fixed: 'left',width: '13%'}, | |||||
| {field: 'workStartTime', title: '封禁开始时间', fixed: 'left',width: '16%'}, | |||||
| {field: 'workEndTime', title: '封禁结束时间', fixed: 'left',width: '16%'}, | |||||
| {field: 'status', title: '状态', fixed: 'left',width: '8%'}, | |||||
| {field: 'roomName', title: '会议室', fixed: 'left',width: '17%'}, | |||||
| {field: 'meetingTitle', title: '会议主题', fixed: 'left',width: '13%'}, | |||||
| {field: 'orderDate', title: '预订日期', fixed: 'left',width: '16%'}, | |||||
| {field: 'orderTime', title: '预订时间', fixed: 'left',width: '16%'}, | |||||
| {field: 'meetingDuration', title: '会议时长', fixed: 'left',width: '11%'}, | |||||
| {field: 'empName', title: '预订人', fixed: 'left',width: '8%'}, | |||||
| {field: 'handles', title: '操作', fixed: 'left',width: '15%'}, | {field: 'handles', title: '操作', fixed: 'left',width: '15%'}, | ||||
| ]], | ]], | ||||
| page: { | page: { | ||||
| @@ -150,28 +202,17 @@ function renderTable(name){ | |||||
| }, | }, | ||||
| loading:true //分页加上动画效果 | loading:true //分页加上动画效果 | ||||
| ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据 | ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据 | ||||
| console.log(res); | |||||
| for (var i=0;i<res.list.length;i++) { | for (var i=0;i<res.list.length;i++) { | ||||
| res.list[i].handles = ""; | |||||
| res.list[i].touristName = ""; | |||||
| res.list[i].touristPersonId = ""; | |||||
| res.list[i].handles = ""; | |||||
| res.list[i].status = ""; | |||||
| if (res.list[i].tourist && res.list[i].tourist.touristName) { | |||||
| res.list[i].touristName = res.list[i].tourist.touristName; | |||||
| } | |||||
| if (res.list[i].workStatus || res.list[i].workStatus==0) { | |||||
| res.list[i].status = res.list[i].workStatus==1?"<span style='color: red'>生效</span>":"<span style='color: #0BB20C'>失效</span>"; | |||||
| } | |||||
| if (res.list[i].tourist && res.list[i].tourist.touristPersonId) { | |||||
| res.list[i].touristPersonId = res.list[i].tourist.touristPersonId; | |||||
| res.list[i].roomName = ""; | |||||
| res.list[i].empName = ""; | |||||
| if (res.list[i].meetingRoom && res.list[i].meetingRoom.name) { | |||||
| res.list[i].roomName = res.list[i].meetingRoom.name; | |||||
| } | } | ||||
| if (res.list[i].tourist && res.list[i].tourist.touristPhone) { | |||||
| res.list[i].touristPhone = res.list[i].tourist.touristPhone; | |||||
| if (res.list[i].emp && res.list[i].emp.realName) { | |||||
| res.list[i].empName = res.list[i].emp.realName; | |||||
| } | } | ||||
| res.list[i].handles += "<a class='handle-btn' onclick=confirm("+res.list[i].id+")>解封</a>"; | |||||
| //res.list[i].handles += "<a class='handle-btn' onclick=javascript:alert('待完善')>违约详情</a>"; | |||||
| } | } | ||||
| return { | return { | ||||
| "code": 0, //解析接口状态 | "code": 0, //解析接口状态 | ||||
| @@ -225,11 +266,13 @@ Date.prototype.format = function (fmt) { | |||||
| $(function() { | $(function() { | ||||
| renderTable(""); | |||||
| // renderTable("","",""); | |||||
| $(document).on("click", "#queryBtn", function(){ | $(document).on("click", "#queryBtn", function(){ | ||||
| var timePart = $("#ipt-start-time2").val(); | |||||
| var roomId = $("#roomId").val(); | |||||
| var name = $("#touristName").val(); | var name = $("#touristName").val(); | ||||
| renderTable(name); | |||||
| renderTable(timePart, roomId, name); | |||||
| }) | }) | ||||
| }) | }) | ||||
| </script> | </script> | ||||
| @@ -0,0 +1,94 @@ | |||||
| <% layout('/layouts/wx.html', {title: '我的会议预约', libs: ['validate']}){ %> | |||||
| <link rel="stylesheet" href="${ctxStatic}/css/weui.css"/> | |||||
| <link rel="stylesheet" href="${ctxStatic}/css/weuix.css"/> | |||||
| <body style="padding: 30px 0"> | |||||
| <div class="layui-tab layui-tab-brief" lay-filter="table_box" style="overflow-x:hidden;overflow-y: auto;"> | |||||
| <ul class="layui-tab-title text-center" lay-id="0" style="position: fixed; | |||||
| width: 100%; | |||||
| z-index: 98; | |||||
| background-color: #eeeeee; | |||||
| margin-top: -45px; | |||||
| height: 80px; | |||||
| padding-top: 30px;"> | |||||
| <li class="layui-this">会议预约</li> | |||||
| <!--<li class="layui-this" lay-id="1">拜访审批</li>--> | |||||
| </ul> | |||||
| <div class="layui-tab-content" style="margin-top: 60px;position: relative;"> | |||||
| <div class="layui-tab-item layui-show"> | |||||
| <div class="row"> | |||||
| <% | |||||
| if(!isEmpty(meetingRoomOrder)) { | |||||
| %> | |||||
| <div class="weui-form-preview col-xs-8 col-sm-8 col-xs-offset-2 col-sm-offset-2 " style=" | |||||
| height: 14px; | |||||
| background-color: #7cfc00; | |||||
| position: relative; | |||||
| top: 2px; | |||||
| border-bottom: 0px !important; | |||||
| "></div> | |||||
| <div class="weui-form-preview col-xs-8 col-sm-8 col-xs-offset-2 col-sm-offset-2 layui-border-blue border-radius mb10"> | |||||
| <div class="weui-form-preview__hd"> | |||||
| <label class="weui-form-preview__label">会议时间</label> | |||||
| <em class="weui-form-preview__value">${@DateUtils.formatDate(meetingRoomOrder.orderDate, "yyyy-MM-dd")+" "+@DateUtils.formatDate(meetingRoomOrder.orderTime, "HH:mm")}</em> | |||||
| </div> | |||||
| <div class="weui-form-preview__bd" style="line-height: 1.2em;"> | |||||
| <div class="weui-form-preview__item"> | |||||
| <label class="weui-form-preview__label">会议时长</label> | |||||
| <span class="weui-form-preview__value">${meetingRoomOrder.meetingDuration}分钟</span> | |||||
| </div> | |||||
| <div class="weui-form-preview__item"> | |||||
| <label class="weui-form-preview__label">会议室</label> | |||||
| <span class="weui-form-preview__value">${meetingRoomOrder.meetingRoom.name}</span> | |||||
| </div> | |||||
| <div class="weui-form-preview__item"> | |||||
| <label class="weui-form-preview__label">会议主题</label> | |||||
| <span class="weui-form-preview__value">${meetingRoomOrder.meetingTitle}</span> | |||||
| </div> | |||||
| <div class="weui-form-preview__item"> | |||||
| <label class="weui-form-preview__label">预订人</label> | |||||
| <span class="weui-form-preview__value">${meetingRoomOrder.orderByEmp}</span> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| <% | |||||
| } else { %> | |||||
| <div class="col-xs-8 col-sm-8 col-xs-offset-2 col-sm-offset-2 text-center"> | |||||
| <p>暂无记录</p> | |||||
| </div> | |||||
| <% } %> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| </body> | |||||
| <% } %> | |||||
| <script src="${ctxStatic}/js/jweixin-1.4.0.js?${_version}"></script> | |||||
| <script> | |||||
| </script> | |||||
| @@ -0,0 +1,86 @@ | |||||
| <% layout('/layouts/wx.html', {title: '我的会议预约', libs: ['validate']}){ %> | |||||
| <link rel="stylesheet" href="${ctxStatic}/css/weui.css"/> | |||||
| <link rel="stylesheet" href="${ctxStatic}/css/weuix.css"/> | |||||
| <body style="padding: 30px 0"> | |||||
| <div class="layui-tab layui-tab-brief" lay-filter="table_box" style="overflow-x:hidden;overflow-y: auto;"> | |||||
| <ul class="layui-tab-title text-center" lay-id="0" style="position: fixed; | |||||
| width: 100%; | |||||
| z-index: 98; | |||||
| background-color: #eeeeee; | |||||
| margin-top: -45px; | |||||
| height: 80px; | |||||
| padding-top: 30px;"> | |||||
| <li class="layui-this">会议预约历史</li> | |||||
| <!--<li class="layui-this" lay-id="1">拜访审批</li>--> | |||||
| </ul> | |||||
| <div class="layui-tab-content" style="margin-top: 60px;position: relative;"> | |||||
| <div class="layui-tab-item layui-show"> | |||||
| <div class="row"> | |||||
| <% | |||||
| if(!isEmpty(meetingList)) { | |||||
| for(meeting in meetingList){ | |||||
| %> | |||||
| <div class="weui-form-preview col-xs-8 col-sm-8 col-xs-offset-2 col-sm-offset-2 " style=" | |||||
| height: 14px; | |||||
| background-color: #7cfc00; | |||||
| position: relative; | |||||
| top: 2px; | |||||
| border-bottom: 0px !important; | |||||
| "></div> | |||||
| <div class="weui-form-preview col-xs-8 col-sm-8 col-xs-offset-2 col-sm-offset-2 layui-border-blue border-radius mb10"> | |||||
| <div class="weui-form-preview__hd"> | |||||
| <label class="weui-form-preview__label">预订人</label> | |||||
| <em class="weui-form-preview__value">${meeting.orderByEmp}</em> | |||||
| </div> | |||||
| <div class="weui-form-preview__bd" style="line-height: 1.2em;"> | |||||
| <div class="weui-form-preview__item"> | |||||
| <label class="weui-form-preview__label">预订时间</label> | |||||
| <span class="weui-form-preview__value">${@DateUtils.formatDate(meeting.orderDate, "yyyy-MM-dd")+" "+@DateUtils.formatDate(meeting.orderTime, "HH:mm")}</span> | |||||
| </div> | |||||
| <div class="weui-form-preview__item"> | |||||
| <label class="weui-form-preview__label">会议时长</label> | |||||
| <span class="weui-form-preview__value">${meeting.meetingDuration}分钟</span> | |||||
| </div> | |||||
| <div class="weui-form-preview__item"> | |||||
| <label class="weui-form-preview__label">会议室</label> | |||||
| <span class="weui-form-preview__value">${meeting.meetingRoom.name}</span> | |||||
| </div> | |||||
| <div class="weui-form-preview__item"> | |||||
| <label class="weui-form-preview__label">会议主题</label> | |||||
| <span class="weui-form-preview__value">${meeting.meetingTitle}</span> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| <% } %> | |||||
| <%} else { %> | |||||
| <div class="col-xs-8 col-sm-8 col-xs-offset-2 col-sm-offset-2 text-center"> | |||||
| <p>暂无记录</p> | |||||
| </div> | |||||
| <% } %> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| </body> | |||||
| <% } %> | |||||
| <script src="${ctxStatic}/js/jweixin-1.4.0.js?${_version}"></script> | |||||
| @@ -1,4 +1,4 @@ | |||||
| <% layout('/layouts/default.html', {title: '黑名单管理', libs: ['dataGrid']}){ %> | |||||
| <% layout('/layouts/default.html', {title: '会议室管理', libs: ['dataGrid']}){ %> | |||||
| <style> | <style> | ||||
| #ipt-start-time, #ipt-start-time2{ | #ipt-start-time, #ipt-start-time2{ | ||||
| height: 28px !important; | height: 28px !important; | ||||
| @@ -43,22 +43,11 @@ | |||||
| <div class="box box-main"> | <div class="box box-main"> | ||||
| <div class="box-body" style="margin: 20px;padding: 10px 0 20px 38px;border-top: 4px solid rgb(76, 159, 237);box-shadow: 0px 0px 7px -1px;"> | <div class="box-body" style="margin: 20px;padding: 10px 0 20px 38px;border-top: 4px solid rgb(76, 159, 237);box-shadow: 0px 0px 7px -1px;"> | ||||
| <#form:form id="searchForm2" model="" style="margin:20px 0 !important;" | <#form:form id="searchForm2" model="" style="margin:20px 0 !important;" | ||||
| action="${ctx}/sys/blackRole/listData" method="post" class="form-inline table-search" | |||||
| action="${ctx}/sys/meeting-room/listData" method="post" class="form-inline table-search" | |||||
| data-page-no="${parameter.pageNo}" | data-page-no="${parameter.pageNo}" | ||||
| data-page-size="${parameter.pageSize}" | data-page-size="${parameter.pageSize}" | ||||
| data-order-by="${parameter.orderBy}"> | data-order-by="${parameter.orderBy}"> | ||||
| <div class="form-group"> | |||||
| <div class="control-inline" style="width: 168px !important;"> | |||||
| <#form:input path="touristName" id="touristName" placeholder="输入姓名或电话号搜索" class="form-control required " /> | |||||
| </div> | |||||
| </div> | |||||
| <div class="form-group last-form-group"> | |||||
| <button id="queryBtn" type="button" class="button bg-black center" style=" margin-right: 8px;padding: 4px 23px;font-size: 14px;">查询</button> | |||||
| </div> | |||||
| </#form:form> | </#form:form> | ||||
| <table id="dataGrid"></table> | <table id="dataGrid"></table> | ||||
| </div> | </div> | ||||
| @@ -72,55 +61,14 @@ function err(err, time){ | |||||
| layer.msg('<p class="text-red">'+err+'</p>', {icon: 5, time: time}); | layer.msg('<p class="text-red">'+err+'</p>', {icon: 5, time: time}); | ||||
| } | } | ||||
| function confirm(id){ | |||||
| layerIndex = layer.open({ | |||||
| type: 1 | |||||
| ,title: '解封黑名单' | |||||
| ,area: ['35%', '25%'] | |||||
| ,shade: 0.5 | |||||
| ,maxmin: false | |||||
| ,scrollbar: false | |||||
| ,closeBtn: 0 | |||||
| ,btn: ["解封", "取消"] | |||||
| ,content: '<div style="margin: 20px;font-size: larger;"><p>确定要解封该游客?</p></div>' | |||||
| ,yes:function (index){ | |||||
| layer.close(index); | |||||
| $("#refund-ticket").submit(); | |||||
| $.ajax({ | |||||
| url:"/api/ticket/blackRoleRelease",data: {id:id}, dataType:"json",method:"post", | |||||
| success:function (data){ | |||||
| if(data.result == Global.TRUE){ | |||||
| js.showMessage(data.message); | |||||
| setTimeout(function (){ | |||||
| window.location.reload(); | |||||
| }, 2500) | |||||
| } else { | |||||
| if (data.errMsg) { | |||||
| err(data.errMsg, 5000); | |||||
| } else if(data.message) { | |||||
| err(data.message, 5000); | |||||
| } | |||||
| } | |||||
| } | |||||
| }) | |||||
| }, | |||||
| success:function () { | |||||
| $(".layui-layer-shade").eq(1).css("background-color","transparent") | |||||
| } | |||||
| }) | |||||
| } | |||||
| function renderTable(name){ | |||||
| function renderTable(){ | |||||
| var width = $(".box-body").width() - 40; | var width = $(".box-body").width() - 40; | ||||
| layui.use('table', function(){ | layui.use('table', function(){ | ||||
| var table = layui.table; | var table = layui.table; | ||||
| table.render({ | table.render({ | ||||
| elem: '#dataGrid', | elem: '#dataGrid', | ||||
| url:"${ctx}/sys/blackRole/listData?touristName="+name, //获取数据的接口 | |||||
| url:"${ctx}/sys/meeting-room/listData", //获取数据的接口 | |||||
| width:width, | width:width, | ||||
| height:650, | height:650, | ||||
| cellMinWidth: 'auto', | cellMinWidth: 'auto', | ||||
| @@ -134,12 +82,9 @@ function renderTable(name){ | |||||
| sort:true, | sort:true, | ||||
| cols: [[ | cols: [[ | ||||
| {type: 'numbers', title: '',fixed: 'left',width: '4%'}, | {type: 'numbers', title: '',fixed: 'left',width: '4%'}, | ||||
| {field: 'touristName', title: '姓名', fixed: 'left',width: '11%'}, | |||||
| {field: 'touristPersonId', title: '证件号', fixed: 'left',width: '17%'}, | |||||
| {field: 'touristPhone', title: '手机号', fixed: 'left',width: '13%'}, | |||||
| {field: 'workStartTime', title: '封禁开始时间', fixed: 'left',width: '16%'}, | |||||
| {field: 'workEndTime', title: '封禁结束时间', fixed: 'left',width: '16%'}, | |||||
| {field: 'status', title: '状态', fixed: 'left',width: '8%'}, | |||||
| {field: 'name', title: '会议室名', fixed: 'left',width: '20%'}, | |||||
| {field: 'address', title: '地址', fixed: 'left',width: '30%'}, | |||||
| {field: 'nickName', title: '别称', fixed: 'left',width: '15%'}, | |||||
| {field: 'handles', title: '操作', fixed: 'left',width: '15%'}, | {field: 'handles', title: '操作', fixed: 'left',width: '15%'}, | ||||
| ]], | ]], | ||||
| page: { | page: { | ||||
| @@ -151,7 +96,7 @@ function renderTable(name){ | |||||
| loading:true //分页加上动画效果 | loading:true //分页加上动画效果 | ||||
| ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据 | ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据 | ||||
| console.log(res); | console.log(res); | ||||
| for (var i=0;i<res.list.length;i++) { | |||||
| /*for (var i=0;i<res.list.length;i++) { | |||||
| res.list[i].handles = ""; | res.list[i].handles = ""; | ||||
| res.list[i].touristName = ""; | res.list[i].touristName = ""; | ||||
| @@ -172,7 +117,7 @@ function renderTable(name){ | |||||
| } | } | ||||
| res.list[i].handles += "<a class='handle-btn' onclick=confirm("+res.list[i].id+")>解封</a>"; | res.list[i].handles += "<a class='handle-btn' onclick=confirm("+res.list[i].id+")>解封</a>"; | ||||
| //res.list[i].handles += "<a class='handle-btn' onclick=javascript:alert('待完善')>违约详情</a>"; | //res.list[i].handles += "<a class='handle-btn' onclick=javascript:alert('待完善')>违约详情</a>"; | ||||
| } | |||||
| }*/ | |||||
| return { | return { | ||||
| "code": 0, //解析接口状态 | "code": 0, //解析接口状态 | ||||
| "msg": res.msg, //解析提示文本 | "msg": res.msg, //解析提示文本 | ||||
| @@ -225,11 +170,7 @@ Date.prototype.format = function (fmt) { | |||||
| $(function() { | $(function() { | ||||
| renderTable(""); | |||||
| renderTable(); | |||||
| $(document).on("click", "#queryBtn", function(){ | |||||
| var name = $("#touristName").val(); | |||||
| renderTable(name); | |||||
| }) | |||||
| }) | }) | ||||
| </script> | </script> | ||||
| @@ -0,0 +1,361 @@ | |||||
| <% layout('/layouts/default.html', {title: '账号注册', libs: ['validate'], bodyClass: 'login-page'}){ %> | |||||
| <% include('/include/upgrade.html'){} // 如果客户浏览器版本过低,则显示浏览器升级提示。 %> | |||||
| <link rel="stylesheet" href="${ctxStatic}/icheck/1.0/square/blue.css?${_version}"> | |||||
| <link rel="stylesheet" href="${ctxStatic}/jquery-toastr/2.0/toastr.min.css?${_version}"> | |||||
| <link rel="stylesheet" href="${ctxStatic}/jquery-plugins/jquery.strength.css?${_version}"> | |||||
| <link rel="stylesheet" href="${ctxStatic}/modules/sys/sysLogin.css?${_version}"> | |||||
| <style> | |||||
| .fa-check{ | |||||
| color: #0BB20C !important; | |||||
| } | |||||
| body .demo-class .layui-layer-btn0{ | |||||
| border-color: #E6E3E6; | |||||
| background-color: #FFF; | |||||
| color: black; | |||||
| } | |||||
| body .demo-class .layui-layer-btn1{ | |||||
| border-color: #4898d5; | |||||
| background-color: #2e8ded; | |||||
| color: #fff; | |||||
| } | |||||
| img { | |||||
| object-fit: cover !important; | |||||
| } | |||||
| </style> | |||||
| <div class="login-box"> | |||||
| <div class="login-logo" style="font-size: 28px;"> | |||||
| <b>${@Global.getConfig('productName')}</b> | |||||
| </div> | |||||
| <div class="login-box-body"> | |||||
| <form id="registerForm" class="layui-form" action="${ctxPath}/account2/reg" method="post" > | |||||
| <input type="hidden" id="ipt-openid" name="wxOpenid" value="${openid}"/> | |||||
| <input type="hidden" id="avatarImg" name="base64" value=""/> | |||||
| <div class="text-center" style="padding-top: 10px;"> | |||||
| <a id="upload-img" style="text-decoration: none;display: inline-grid;"> | |||||
| <img id="imgObj" src=${isNotEmpty(emp.faceImageName)?"/face01/compress/"+emp.faceImageName:"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAZABkAAD/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4RERAOEA8SFBoWEhMYEw8QFh8XGBsbHR0dERYgIh8cIhocHRz/2wBDAQUFBQcGBw0HBw0cEhASHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBz/wAARCAClAHEDASIAAhEBAxEB/8QAGwABAAMBAQEBAAAAAAAAAAAAAAECAwQFBgj/xAA6EAABAwIBBwsDAwMFAAAAAAABAAIDBBESBRMUIVJxsSIjMTIzQVFikqHRYYHBBkJyFTRTQ5Gi4fH/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8A/dNPTxyxY34i4k3OI+J+q00OHZd6z8qtJ2I3u4ldKDDQ4dl3rd8pocOy71u+VuiDDQ4dl3rd8pocOy71u+VuiDDQ4dl3rd8pocOy71u+Vuougx0OHZd63fKaHDsu9Z+VuiDDQ4dl3rd8pocOy71u+VtdSgw0OHZd6z8qktNEyJ7g11wCRyj4b103WdR/by/wPBBx43bTkVEQdlL2Dd54lbLnpuxG88StsSCyKqILIqogsiriRBN1KriTEgsiqmJBN1nUdhL/AAPBXxLOfsJf4Hgg40REHTTdi3eeJWl1jTnmvueJWl0FrqVS6XQXUXWU0rYmXP2HiVjgc8Y6g4WbAdYDeUHQ+oiZ15IxvcEFRE/qyxnc4LASsZqhgcQO8NsFV87HapqdwHiWg8EHZdLrjAMYzlM/E3YLrj7FbwytlZcfceBQbKLqt0ugtdUnPMS/wPBTdUmPNS/wPBBzoiINoOz+54lXusYDzf3PErS6C+JRdVul0GLSJZXyv6kdw38lIwai0snU/Y36eJWJ/soh/kwg/c610vkbEy73WCDRZvnDThYMUmyPz4Kl5J9qOP8A5H4VwGQM1YWtGslBEURYS84bu6QzUFV/NTiQdSTkv39xTOPl7Pkt2j0ncPlYknRqgHWYybHdrCDvxJiVLpdBa6zlPNP3HgrXVJTzT9xQZoiIJiPI+54q+JZxnkfc8Ve6CcSYlF0ug5Qxz6ZrWdeMga/oVsyINONxxSbR/Hgs3nMS4v8ATf1vofFJ3lpF3OEXeR0/+INXz68EYxO7/AbygixHHIcTh0eA3BIyzCBHhw91lJeGi5dYIL4lx3xUzz/mfq3E2HsrkmoFhqi/c7x+gRhz8jSOyj6v1KDpxJiUXS6CcSiQ82/cUus5Dzb9xQSiIghnR9zxS6qzoO88VKCbpdQiAbOFjrCzDHxdnymbJ7txWiIOYiJxuYZGn6NP4VgIm6xFI4/Vp/K3RBmWPl7Tks2R37ytBZosNQCIgm6XUIgm6iQ827cUUP6h3ILoiIMh+7eeKtdZ36288Uug8I/qSb+o5hlHJm28lzcTcZedYAOK3QtJMvzaRNDHTwRviIDjUVAZ0gHosvn8o0DP6gGPfEZmvxzCKkc6wOu56Qdy0p4o31dNng01EtViIkhc1uANsGi7UH2zHh7A4FpBFwQ641/VeRV5Zq6IMMuTbNkkDGnPN1k9HcvSew5gxxFsRtZhDQQzw1L5nLMVZn6CldX52SSTOgZlosGC+LUg96nq62WVrJaDNRm9355rravAK+VMotyXRvqXsc8NIGEdOs2XmZIOUa+ip6p2UbZzWWZlvcbdKv8AqqN8+RpmxsdI8ltmsbc9YeCCZMuzAVgFFaSjwmRr5gBYtJ1EA+CtRZcnqqumhloWwipjMrHZ3EcNvDCvmq2ItOUZRJOaYywC9Q1wEwsQcVwCQCvQyZOXfqFhNVTVGcicBmr2jA/a0E6kH0uUKl1HRT1DGtcYmFwB6DZcdblWSlyRHWtY3OODDhNyOVa/FT+oJBHkatJ/xkf76vyvBFNRsomPqcm5SLGxhz3Y+TqFybYkH2d1V55Dty8zJFNSsgZVU2dAnYDaR5cbHX3leg/qu3IOhERBz31u3nimJVLtZ3nioug8SryPUVGVKipDoBE5jWtx4ydXT0OCzGQ6iOto5sUBZDJidgxg2t9XFe/dLoInMuafmc3nbcjHfDf62XnUGSnxSSVVXNnq2VmEuGprG7IC9K6XQeFHkStZRw0Qr2tp4yDeNha+wN+tiXo5VgqqqjdDSStikcQHPxEENvrtbvXZdLoPOkoKl1TU2qXGmlhDGAuJLJBqDgsafJ9bFJk6QzRl8LCyoGI4XjuI1dZevdLoPNy3QT5Thp6eMtFOZAZru1lo12C7K+J1RQVMMfXkic1o6BctIC2ul0HNkyB9Lk+mhk7SOMNdbxAXWTqcq3R3Qg60REHI7rneVW6P6795VboLXS6jEiCbpdVupxIJul1GJRdBdRdVupQTdLqt0ugtdRiTEqoPQREQcMnaP3lVSTrv3lEBERBF1KIgKbqEQRdSiICIiAiIg9BERBjJSc4/l9/h/wBqmief2REDRPP7Jonn9kRA0Tz+yaJ5/ZEQNE8/smief2REDRPP7Jonn9kRA0Tz+yaJ5/ZEQNE8/smief2REHoZjzeyIiD/2Q=="} style="width:120px;height:120px;border-radius: 120px;" onclick="" > | |||||
| <% if (isEmpty(emp.faceImageName)) {%> | |||||
| <div style="position:relative;display:inline-block;width: 120px;background-color: rgb(0 0 0 / 20%);color: #ff0000;top: -69px;">点击添加人脸照片</div> | |||||
| <% } %> | |||||
| </a> | |||||
| </div> | |||||
| <div class="form-group has-feedback"> | |||||
| <select name="officeCode" id="officeCode" class="required"> | |||||
| <option selected="selected" value="" style="display: none;">-----请选择所属公司-----</option> | |||||
| <% | |||||
| for(office in offices){ | |||||
| print('<option value="' + office.officeCode + '">' + office.officeName + '</option>'); | |||||
| } | |||||
| %> | |||||
| </select> | |||||
| </div> | |||||
| <div class="layui-form-item has-feedback"> | |||||
| <span class="fa fa-user form-control-feedback"></span> | |||||
| <input type="text" id="reg_loginCode" name="loginCode" class="layui-input form-control required" lay-verify="" data-msg-required="请填写姓名." placeholder="姓名" /> | |||||
| <span class="text-red" style="font-size: 12px;">* 姓名提交后不可修改,请谨慎填写,以免无法过审</span> | |||||
| </div> | |||||
| <div class="layui-form-item has-feedback"> | |||||
| <span class="fa fa-phone-square form-control-feedback"></span> | |||||
| <input type="text" id="mobile" name="mobile" class="layui-input form-control required isMobile isExsitPhone" lay-verify="" data-msg-required="请填写手机号." placeholder="手机号" /> | |||||
| </div> | |||||
| <div class="layui-form-item" style="border: 1px solid #e8e8e8;"> | |||||
| <label class="layui-form-label" style="text-align: left;padding-left: 9px;color: #a1a1a1;">性别</label> | |||||
| <div class="layui-input-block" style="text-align: right;"> | |||||
| <input type="radio" name="gender" checked=true id="gender" value="1" title="男" > | |||||
| <input type="radio" name="gender" id="gender" value="2" title="女"> | |||||
| </div> | |||||
| </div> | |||||
| <!--<div class="form-group has-feedback"> | |||||
| <span class="fa fa-lock form-control-feedback"></span> | |||||
| <input type="password" autocomplete="off" id="reg_password" name="password" | |||||
| class="form-control required" data-msg-required="请填写登录密码." | |||||
| rangelength="1,50" data-msg-rangelength="登录密码长度不能小于1并大于50个字符." | |||||
| placeholder="登录密码" /> | |||||
| </div> | |||||
| <div class="form-group has-feedback"> | |||||
| <span class="fa fa-lock form-control-feedback"></span> | |||||
| <input type="password" autocomplete="off" id="reg_confirmPassword" name="confirmPassword" | |||||
| class="form-control required" data-msg-required="请再填一次登录密码." | |||||
| rangelength="3,50" data-msg-rangelength="登录密码长度不能小于3并大于50个字符." | |||||
| equalTo="#reg_password" data-msg-equalTo="填写的密码与登录密码不同." | |||||
| placeholder="再填一次登录密码" /> | |||||
| </div>--> | |||||
| <div class="row"> | |||||
| <div class="col-xs-12"> | |||||
| <button type="button" class="btn btn-primary btn-block btn-flat layui-btn" lay-submit="" id="btnSubmit" onclick="checkOk();">${text('提交')}</button> | |||||
| </div> | |||||
| </div> | |||||
| <div class="clearfix"></div> | |||||
| </form> | |||||
| </div> | |||||
| <!--<iframe id="myFrame" name="myFrame" scrolling="yes" frameborder="0" style="width:100%;height:6.6rem;"></iframe>--> | |||||
| </div> | |||||
| <div id="new_person_layer" class="layui_pop" style="display: none;" > | |||||
| <div class="layui-form-item layui_pop_header" style="margin-bottom: 10px !important;"> | |||||
| <div class="layui_header_title">确认账户</div> | |||||
| <div class="layui_header_close"></div> | |||||
| </div> | |||||
| <form class="layui-form" action="" style="padding: 0 15px 0px 15px;"> | |||||
| <div class="layui-form-item text-center"><p>系统检测到您注册的部门中存在同名账户,这是您吗?</p></div> | |||||
| <div class="layui-form-item text-center"><img id="avtar-img" src=${isNotEmpty(emp.faceImageName)?"/face01/compress/"+emp.faceImageName:"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAZABkAAD/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4RERAOEA8SFBoWEhMYEw8QFh8XGBsbHR0dERYgIh8cIhocHRz/2wBDAQUFBQcGBw0HBw0cEhASHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBz/wAARCAClAHEDASIAAhEBAxEB/8QAGwABAAMBAQEBAAAAAAAAAAAAAAECAwQFBgj/xAA6EAABAwIBBwsDAwMFAAAAAAABAAIDBBESBRMUIVJxsSIjMTIzQVFikqHRYYHBBkJyFTRTQ5Gi4fH/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8A/dNPTxyxY34i4k3OI+J+q00OHZd6z8qtJ2I3u4ldKDDQ4dl3rd8pocOy71u+VuiDDQ4dl3rd8pocOy71u+VuiDDQ4dl3rd8pocOy71u+Vuougx0OHZd63fKaHDsu9Z+VuiDDQ4dl3rd8pocOy71u+VtdSgw0OHZd6z8qktNEyJ7g11wCRyj4b103WdR/by/wPBBx43bTkVEQdlL2Dd54lbLnpuxG88StsSCyKqILIqogsiriRBN1KriTEgsiqmJBN1nUdhL/AAPBXxLOfsJf4Hgg40REHTTdi3eeJWl1jTnmvueJWl0FrqVS6XQXUXWU0rYmXP2HiVjgc8Y6g4WbAdYDeUHQ+oiZ15IxvcEFRE/qyxnc4LASsZqhgcQO8NsFV87HapqdwHiWg8EHZdLrjAMYzlM/E3YLrj7FbwytlZcfceBQbKLqt0ugtdUnPMS/wPBTdUmPNS/wPBBzoiINoOz+54lXusYDzf3PErS6C+JRdVul0GLSJZXyv6kdw38lIwai0snU/Y36eJWJ/soh/kwg/c610vkbEy73WCDRZvnDThYMUmyPz4Kl5J9qOP8A5H4VwGQM1YWtGslBEURYS84bu6QzUFV/NTiQdSTkv39xTOPl7Pkt2j0ncPlYknRqgHWYybHdrCDvxJiVLpdBa6zlPNP3HgrXVJTzT9xQZoiIJiPI+54q+JZxnkfc8Ve6CcSYlF0ug5Qxz6ZrWdeMga/oVsyINONxxSbR/Hgs3nMS4v8ATf1vofFJ3lpF3OEXeR0/+INXz68EYxO7/AbygixHHIcTh0eA3BIyzCBHhw91lJeGi5dYIL4lx3xUzz/mfq3E2HsrkmoFhqi/c7x+gRhz8jSOyj6v1KDpxJiUXS6CcSiQ82/cUus5Dzb9xQSiIghnR9zxS6qzoO88VKCbpdQiAbOFjrCzDHxdnymbJ7txWiIOYiJxuYZGn6NP4VgIm6xFI4/Vp/K3RBmWPl7Tks2R37ytBZosNQCIgm6XUIgm6iQ827cUUP6h3ILoiIMh+7eeKtdZ36288Uug8I/qSb+o5hlHJm28lzcTcZedYAOK3QtJMvzaRNDHTwRviIDjUVAZ0gHosvn8o0DP6gGPfEZmvxzCKkc6wOu56Qdy0p4o31dNng01EtViIkhc1uANsGi7UH2zHh7A4FpBFwQ641/VeRV5Zq6IMMuTbNkkDGnPN1k9HcvSew5gxxFsRtZhDQQzw1L5nLMVZn6CldX52SSTOgZlosGC+LUg96nq62WVrJaDNRm9355rravAK+VMotyXRvqXsc8NIGEdOs2XmZIOUa+ip6p2UbZzWWZlvcbdKv8AqqN8+RpmxsdI8ltmsbc9YeCCZMuzAVgFFaSjwmRr5gBYtJ1EA+CtRZcnqqumhloWwipjMrHZ3EcNvDCvmq2ItOUZRJOaYywC9Q1wEwsQcVwCQCvQyZOXfqFhNVTVGcicBmr2jA/a0E6kH0uUKl1HRT1DGtcYmFwB6DZcdblWSlyRHWtY3OODDhNyOVa/FT+oJBHkatJ/xkf76vyvBFNRsomPqcm5SLGxhz3Y+TqFybYkH2d1V55Dty8zJFNSsgZVU2dAnYDaR5cbHX3leg/qu3IOhERBz31u3nimJVLtZ3nioug8SryPUVGVKipDoBE5jWtx4ydXT0OCzGQ6iOto5sUBZDJidgxg2t9XFe/dLoInMuafmc3nbcjHfDf62XnUGSnxSSVVXNnq2VmEuGprG7IC9K6XQeFHkStZRw0Qr2tp4yDeNha+wN+tiXo5VgqqqjdDSStikcQHPxEENvrtbvXZdLoPOkoKl1TU2qXGmlhDGAuJLJBqDgsafJ9bFJk6QzRl8LCyoGI4XjuI1dZevdLoPNy3QT5Thp6eMtFOZAZru1lo12C7K+J1RQVMMfXkic1o6BctIC2ul0HNkyB9Lk+mhk7SOMNdbxAXWTqcq3R3Qg60REHI7rneVW6P6795VboLXS6jEiCbpdVupxIJul1GJRdBdRdVupQTdLqt0ugtdRiTEqoPQREQcMnaP3lVSTrv3lEBERBF1KIgKbqEQRdSiICIiAiIg9BERBjJSc4/l9/h/wBqmief2REDRPP7Jonn9kRA0Tz+yaJ5/ZEQNE8/smief2REDRPP7Jonn9kRA0Tz+yaJ5/ZEQNE8/smief2REHoZjzeyIiD/2Q=="} style="width:120px;height:120px;border-radius: 120px;" onclick="" ></div> | |||||
| </form> | |||||
| </div> | |||||
| <style> | |||||
| .layui_pop_header { | |||||
| margin-bottom: 10px !important; | |||||
| } | |||||
| .layui_pop .layui-form { | |||||
| padding: 0 15px 0px 15px; | |||||
| } | |||||
| </style> | |||||
| <% } %> | |||||
| <script>var secretKey = '${@Global.getConfig("shiro.loginSubmit.secretKey")}';</script> | |||||
| <script src="${ctxStatic}/js/jweixin-1.4.0.js?${_version}"></script> | |||||
| <script src="${ctxStatic}/common/des.js?${_version}"></script> | |||||
| <script src="${ctxStatic}/jquery-toastr/2.0/toastr.min.js?${_version}"></script> | |||||
| <script src="${ctxStatic}/jquery-plugins/jquery.strength.js?${_version}"></script> | |||||
| <script src="${ctxStatic}/modules/sys/registerUser.js?${_version}"></script> | |||||
| <script> | |||||
| function checkOk(){ | |||||
| var name = $("#reg_loginCode").val(); | |||||
| var base64 = $("#avatarImg").val(); | |||||
| var phone = $("#mobile").val(); | |||||
| var officeCode = $("#officeCode option:selected").val(); | |||||
| console.log(officeCode==""); | |||||
| if ($("#registerForm").valid() && name && officeCode && phone) { | |||||
| $.ajax('/api/v1/emp/getByName',{ | |||||
| method: "get", dataType: "json", | |||||
| data: { | |||||
| "name": name, | |||||
| "officeCode": officeCode, | |||||
| }, | |||||
| async:false, | |||||
| success: function (res) { | |||||
| if(res.data.length<1) { | |||||
| $("#registerForm").submit(); | |||||
| } else { | |||||
| layerIndex = layer.open({ | |||||
| type: 1 | |||||
| ,title: false | |||||
| ,area: ['90%', '40%'] | |||||
| ,shade: 0.5 | |||||
| ,maxmin: false | |||||
| ,scrollbar: false | |||||
| ,closeBtn: 0 | |||||
| ,content: $('#new_person_layer') | |||||
| ,btn: ["是我", "不是我,继续注册"] | |||||
| ,yes: function (index) { | |||||
| // if ("${openid}" != null && "${openid}" != "") { | |||||
| $.ajax("/account2/updateEmp",{method: "post", dataType: "json", data: {"userCode":DesUtils.encode(res.data[0].jobNumber, secretKey), "openid":"${openid}", "phone":phone,"base64":base64}, success:function (data){ | |||||
| layer.closeAll(); | |||||
| parent.layer.closeAll(); | |||||
| if (data.status == 0) { | |||||
| layer.msg("更新成功", {icon: 6, time: 2000}); | |||||
| setTimeout(function (){ | |||||
| window.location.reload(); | |||||
| }, 2000) | |||||
| } else { | |||||
| layer.msg(data.errMsg, {icon: 5, time: 2000}); | |||||
| } | |||||
| },error:function (err){ | |||||
| console.log(err); | |||||
| }}, | |||||
| ) | |||||
| /*} else { | |||||
| layer.closeAll(); | |||||
| parent.layer.closeAll(); | |||||
| }*/ | |||||
| }, | |||||
| btn2: function (index){ | |||||
| parent.$("#registerForm").submit(); | |||||
| }, | |||||
| success:function () { | |||||
| console.log(res.data); | |||||
| $("#avtar-img").attr("src","/face01/compress/"+res.data[0].faceImageName) | |||||
| } | |||||
| }); | |||||
| } | |||||
| }, | |||||
| error:function (){ | |||||
| } | |||||
| }) | |||||
| } else { | |||||
| layer.msg("信息填写不全或有误,请检查", {icon: 5, time: 2000}); | |||||
| } | |||||
| // $("#registerForm").submit(); | |||||
| return (false); | |||||
| } | |||||
| function openDiv(){ | |||||
| var secretKey = "${@Global.getConfig('shiro.loginSubmit.secretKey')}"; | |||||
| var openid = DesUtils.encode($("#ipt-openid").val(), secretKey); | |||||
| layer.open({ | |||||
| type: 2 | |||||
| , skin: 'demo-class' | |||||
| , title: "新增人脸底库" | |||||
| , area: ['100%', '100%'] | |||||
| , shade: 0.8 | |||||
| , skin: 'layui-layer-lan' | |||||
| , id: 'LAY_layuipro' //设定一个id,防止重复弹出 | |||||
| // , btn: ['提交', '取消'] | |||||
| // , btnAlign: 'c' | |||||
| , close : 0 | |||||
| , moveType: 1 //拖拽模式,0或者1 | |||||
| , content: "${ctxPath}/account2/photo/0/"+openid | |||||
| /*, yes: function () { | |||||
| }*/ | |||||
| }); | |||||
| } | |||||
| function photoCompress(file, w, objDiv) { | |||||
| var ready = new FileReader(); | |||||
| /*开始读取指定的Blob对象或File对象中的内容. 当读取操作完成时,readyState属性的值会成为DONE,如果设置了onloadend事件处理程序,则调用之.同时,result属性中将包含一个data: URL格式的字符串以表示所读取文件的内容.*/ | |||||
| ready.readAsDataURL(file); | |||||
| ready.onload = function() { | |||||
| var re = this.result; | |||||
| canvasDataURL(re, w, objDiv); | |||||
| } | |||||
| }; | |||||
| function canvasDataURL(path, obj, callback) { | |||||
| var img = new Image(); | |||||
| img.src = path; | |||||
| img.onload = function() { | |||||
| var that = this; | |||||
| // 默认按比例压缩 | |||||
| var w = that.width, | |||||
| h = that.height, | |||||
| scale = w / h; | |||||
| w = obj.width || w; | |||||
| h = obj.height || (w / scale); | |||||
| var quality = 0.5; // 默认图片质量为0.7 | |||||
| //生成canvas | |||||
| var canvas = document.createElement('canvas'); | |||||
| var ctx = canvas.getContext('2d'); | |||||
| // 创建属性节点 | |||||
| var anw = document.createAttribute("width"); | |||||
| anw.nodeValue = w; | |||||
| var anh = document.createAttribute("height"); | |||||
| anh.nodeValue = h; | |||||
| canvas.setAttributeNode(anw); | |||||
| canvas.setAttributeNode(anh); | |||||
| ctx.drawImage(that, 0, 0, w, h); | |||||
| // 图像质量 | |||||
| if(obj.quality && obj.quality <= 1 && obj.quality > 0) { | |||||
| quality = obj.quality; | |||||
| } | |||||
| // quality值越小,所绘制出的图像越模糊 | |||||
| var base64 = canvas.toDataURL('image/jpeg', quality); | |||||
| // 回调函数返回base64的值 | |||||
| callback(base64); | |||||
| } | |||||
| } | |||||
| function convertBase64UrlToBlob(urlData) { | |||||
| var arr = urlData.split(','), | |||||
| mime = arr[0].match(/:(.*?);/)[1], | |||||
| bstr = atob(arr[1]), | |||||
| n = bstr.length, | |||||
| u8arr = new Uint8Array(n); | |||||
| while(n--) { | |||||
| u8arr[n] = bstr.charCodeAt(n); | |||||
| } | |||||
| return new Blob([u8arr], { | |||||
| type: mime | |||||
| }); | |||||
| } | |||||
| layui.use('upload', function() { | |||||
| var dialog = null; | |||||
| var upload = layui.upload; | |||||
| //执行实例 | |||||
| upload.render({ | |||||
| elem : '#upload-img', | |||||
| // url : '${ctx}/sys/emp/update-face', | |||||
| url : '', | |||||
| data:{}, | |||||
| accept: 'images', | |||||
| acceptMime: 'image/*', | |||||
| field : 'face', | |||||
| number : 1, | |||||
| size: 5100, | |||||
| auto: false , | |||||
| multiple : false, | |||||
| choose: function(obj){ | |||||
| dialog = layer.msg('正在上传', | |||||
| { | |||||
| icon: 16 | |||||
| ,shade: 0.01 | |||||
| }); | |||||
| obj.preview(function (index, file, result) { | |||||
| photoCompress(file, { | |||||
| quality: 0.5, | |||||
| }, function(base64Codes) { | |||||
| $.ajax('/api/reg-check-face',{ | |||||
| method: "post", dataType: "json", | |||||
| data: { | |||||
| "faceImage": base64Codes, | |||||
| }, | |||||
| async:false, | |||||
| success: function (res) { | |||||
| layer.close(dialog); | |||||
| if ( 0 != res.status ) { | |||||
| layer.msg('<p class="text-red">'+res.errMsg+'</p>', {icon: 5, time: 5000}); | |||||
| } else { | |||||
| console.log(base64Codes); | |||||
| $("#avatarImg").val(base64Codes); | |||||
| $("#imgObj").attr("src", base64Codes); | |||||
| $("#imgObj").next("div").css("display", "none"); | |||||
| } | |||||
| },error:function (e){ | |||||
| layer.close(dialog); | |||||
| layer.msg('<p class="text-red">'+e.message+'</p>', {icon: 5, time: 5000}); | |||||
| } | |||||
| } | |||||
| ); | |||||
| }); | |||||
| }); | |||||
| return; | |||||
| } | |||||
| }); | |||||
| }); | |||||
| $(function(){ | |||||
| if(2 == ${type}){ | |||||
| location.href = "/account2/login?type="+${type}; | |||||
| } | |||||
| $(".layui_header_close").on('click',function(){ | |||||
| layer.close(layerIndex); | |||||
| }); | |||||
| }) | |||||
| </script> | |||||
| @@ -23,7 +23,7 @@ | |||||
| <div class="layui-header" style="background-color: rgb(52 65 83) !important;"> | <div class="layui-header" style="background-color: rgb(52 65 83) !important;"> | ||||
| <div class="layui-logo" style="background-color: #344154;height:60px;"> | <div class="layui-logo" style="background-color: #344154;height:60px;"> | ||||
| <div class="logo_text" style="letter-spacing: 2px !important;font-size: 16px !important;font-family: system-ui !important;">黄江科技馆票务</div> | |||||
| <div class="logo_text" style="letter-spacing: 2px !important;font-size: 16px !important;font-family: system-ui !important;">${(isNotBlank(title!) ? title! + ' - ' : '') + @Global.getConfig('productName')}</div> | |||||
| </div> | </div> | ||||
| <div class="top_title" style="background-color: rgb(52 65 83);padding-left: 214px;line-height: 55px;"> | <div class="top_title" style="background-color: rgb(52 65 83);padding-left: 214px;line-height: 55px;"> | ||||
| <i class="iconfont leftIcon icon-mianbaoxie" style="color: #f8f8f8;margin-right: 0 !important;"></i> | <i class="iconfont leftIcon icon-mianbaoxie" style="color: #f8f8f8;margin-right: 0 !important;"></i> | ||||
| @@ -23,7 +23,7 @@ | |||||
| <div class="layui-header" style="background-color: rgb(52 65 83) !important;"> | <div class="layui-header" style="background-color: rgb(52 65 83) !important;"> | ||||
| <div class="layui-logo" style="background-color: #344154;height:60px;"> | <div class="layui-logo" style="background-color: #344154;height:60px;"> | ||||
| <div class="logo_text" style="letter-spacing: 2px !important;font-size: 16px !important;font-family: system-ui !important;">黄江科技馆票务</div> | |||||
| <div class="logo_text" style="letter-spacing: 2px !important;font-size: 16px !important;font-family: system-ui !important;">${(isNotBlank(title!) ? title! + ' - ' : '') + @Global.getConfig('productName')}</div> | |||||
| </div> | </div> | ||||
| <div class="top_title" style="background-color: rgb(52 65 83);padding-left: 214px;line-height: 55px;"> | <div class="top_title" style="background-color: rgb(52 65 83);padding-left: 214px;line-height: 55px;"> | ||||
| <i class="iconfont leftIcon icon-mianbaoxie" style="color: #f8f8f8;margin-right: 0 !important;"></i> | <i class="iconfont leftIcon icon-mianbaoxie" style="color: #f8f8f8;margin-right: 0 !important;"></i> | ||||