diff --git a/src/main/java/com/lecoo/kjg/web/meeting/api/MeetingApiController.java b/src/main/java/com/lecoo/kjg/web/meeting/api/MeetingApiController.java index adef666..9ba854c 100644 --- a/src/main/java/com/lecoo/kjg/web/meeting/api/MeetingApiController.java +++ b/src/main/java/com/lecoo/kjg/web/meeting/api/MeetingApiController.java @@ -16,10 +16,8 @@ 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; @@ -31,7 +29,6 @@ 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; @@ -153,6 +150,13 @@ public class MeetingApiController extends BaseController { return outputData(0, meetingRoomOrderDao.findListByDateStr(dateStr, officeCode)); } + @ResponseBody + @RequestMapping(value = "/listsByDateAndRoom", method = RequestMethod.POST) + @Transactional + public MyResponse listByDateAndRoom(String dateStr, String roomId) { + return outputData(0, meetingRoomOrderDao.findListByDateAndRoom(dateStr, roomId)); + } + @Autowired private OfficeService officeService; @@ -191,6 +195,7 @@ public class MeetingApiController extends BaseController { } + @ResponseBody @RequestMapping(value = "/test") public MyResponse test() { diff --git a/src/main/java/com/lecoo/kjg/web/meeting/dao/MeetingRoomOrderDao.java b/src/main/java/com/lecoo/kjg/web/meeting/dao/MeetingRoomOrderDao.java index 8f0c697..57947e3 100644 --- a/src/main/java/com/lecoo/kjg/web/meeting/dao/MeetingRoomOrderDao.java +++ b/src/main/java/com/lecoo/kjg/web/meeting/dao/MeetingRoomOrderDao.java @@ -18,6 +18,7 @@ import java.util.List; public interface MeetingRoomOrderDao extends CrudDao { public List queryByOrder(Long roomId, String orderDate, String orderTime, String endTime); public List findListByDateStr(String orderDate, String officeCode); + public List findListByDateAndRoom(String orderDate, String roomId); public List findListByDate(String orderDate, Integer roomId); public List findListByPerson(String orderBy); diff --git a/src/main/java/com/lecoo/kjg/web/sys/bean/BodyReaderRequestWrapper.java b/src/main/java/com/lecoo/kjg/web/sys/bean/BodyReaderRequestWrapper.java index 95423ab..b499deb 100644 --- a/src/main/java/com/lecoo/kjg/web/sys/bean/BodyReaderRequestWrapper.java +++ b/src/main/java/com/lecoo/kjg/web/sys/bean/BodyReaderRequestWrapper.java @@ -72,4 +72,30 @@ public class BodyReaderRequestWrapper extends HttpServletRequestWrapper { }; return servletIns; } + + + /** + * 全角字符串转换半角字符串 + * + * @param fullWidthStr + * 非空的全角字符串 + * @return 半角字符串 + */ + private static String fullWidth2halfWidth(String fullWidthStr) { + if (null == fullWidthStr || fullWidthStr.length() <= 0) { + return ""; + } + char[] charArray = fullWidthStr.toCharArray(); + //对全角字符转换的char数组遍历 + for (int i = 0; i < charArray.length; ++i) { + int charIntValue = (int) charArray[i]; + //如果符合转换关系,将对应下标之间减掉偏移量65248;如果是空格的话,直接做转换 + if (charIntValue >= 65281 && charIntValue <= 65374) { + charArray[i] = (char) (charIntValue - 65248); + } else if (charIntValue == 12288) { + charArray[i] = (char) 32; + } + } + return new String(charArray); + } } \ No newline at end of file diff --git a/src/main/java/com/lecoo/kjg/web/sys/bean/req/SavePassReq.java b/src/main/java/com/lecoo/kjg/web/sys/bean/req/SavePassReq.java index 562d4dc..1d2c2c8 100644 --- a/src/main/java/com/lecoo/kjg/web/sys/bean/req/SavePassReq.java +++ b/src/main/java/com/lecoo/kjg/web/sys/bean/req/SavePassReq.java @@ -1,10 +1,8 @@ package com.lecoo.kjg.web.sys.bean.req; -import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import javax.validation.constraints.NotBlank; -import java.util.Date; @Data public class SavePassReq { diff --git a/src/main/java/com/lecoo/kjg/web/sys/utils/JasyptUtil.java b/src/main/java/com/lecoo/kjg/web/sys/utils/JasyptUtil.java index 10c9fee..1f453ac 100644 --- a/src/main/java/com/lecoo/kjg/web/sys/utils/JasyptUtil.java +++ b/src/main/java/com/lecoo/kjg/web/sys/utils/JasyptUtil.java @@ -12,9 +12,7 @@ package com.lecoo.kjg.web.sys.utils; import com.jeesite.common.config.Global; import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import org.springframework.util.DigestUtils; @Component @@ -43,10 +41,8 @@ public class JasyptUtil { public static String decrypt(String cryptStr){ PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); - SimpleStringPBEConfig config = new SimpleStringPBEConfig(); String jasyptPwd = System.getProperty("jasypt.encryptor.password"); - jasyptPwd = (null==jasyptPwd ? Global.getConfig("jasypt.encryptor.password"):jasyptPwd); config.setPassword(jasyptPwd); config.setAlgorithm("PBEWithMD5AndDES"); diff --git a/src/main/java/com/lecoo/kjg/web/sys/web/ApiController.java b/src/main/java/com/lecoo/kjg/web/sys/web/ApiController.java index 5cbcdf3..ec01539 100644 --- a/src/main/java/com/lecoo/kjg/web/sys/web/ApiController.java +++ b/src/main/java/com/lecoo/kjg/web/sys/web/ApiController.java @@ -1,11 +1,7 @@ package com.lecoo.kjg.web.sys.web; import com.alibaba.fastjson.JSONObject; -import com.google.common.collect.Lists; -import com.jeesite.common.config.Global; import com.jeesite.common.idgen.IdGen; -import com.jeesite.common.lang.ObjectUtils; -import com.jeesite.common.lang.StringUtils; import com.jeesite.common.shiro.session.SessionManager; import com.jeesite.modules.sys.service.OfficeService; import com.lecoo.kjg.web.sys.dto.HistoryRecord; @@ -18,16 +14,17 @@ import com.lecoo.kjg.web.sys.service.EmpService; import com.lecoo.kjg.web.sys.service.FaceHistoryService; import com.lecoo.kjg.web.sys.service.PasswordLogService; import com.lecoo.kjg.web.sys.utils.JasyptUtil; +import com.lecoo.kjg.web.sys.utils.StringUtils; import com.lenovo.nowgo.common.constant.ResponseCode; import com.lenovo.nowgo.common.http.response.MyResponse; -import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; -import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.util.DigestUtils; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; +import java.io.UnsupportedEncodingException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -227,6 +224,29 @@ public class ApiController extends BaseController { return outputData(0, cryptStr); } + @PostMapping("/jasypt2") + @ResponseBody + public String jasypt22(@RequestParam("pwd") String pwd){ + System.err.println("原密文:"+pwd); + pwd = StringUtils.fullWidth2halfWidth(pwd);//解决#等特殊字符传过来变成全角的问题 + System.err.println("原密文:"+pwd); + String cryptStr = JasyptUtil.encrypt(pwd); + System.err.println("加密文:"+cryptStr); + return cryptStr; + } + + + @PostMapping("/jasyptDecrypt2") + @ResponseBody + public String jasyptDecrypt2(@RequestParam("str") String str){ + System.err.println("加密文1:"+str); + str = StringUtils.fullWidth2halfWidth(str); + System.err.println("加密文2:"+str); + String pwdStr = JasyptUtil.decrypt(str); + System.err.println("解密文:"+pwdStr); + return pwdStr; + } + @GetMapping("/jasyptDecrypt") @ResponseBody public MyResponse jasyptDecrypt(@RequestParam(required = true) String cryptStr){ @@ -236,4 +256,5 @@ public class ApiController extends BaseController { + } diff --git a/src/main/resources/mappings/web/meeting/MeetingRoomOrderDao.xml b/src/main/resources/mappings/web/meeting/MeetingRoomOrderDao.xml index 84c2a6a..7e50696 100644 --- a/src/main/resources/mappings/web/meeting/MeetingRoomOrderDao.xml +++ b/src/main/resources/mappings/web/meeting/MeetingRoomOrderDao.xml @@ -24,6 +24,10 @@ SELECT * FROM meeting_room_order WHERE order_date = #{orderDate} AND room_id in (select id from meeting_room where office_code = #{officeCode}) + +