| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.factory.AuthenticationFactory; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.user.dao.IUserV1ServiceDao; |
| | | import com.java110.intf.user.IUserV1InnerServiceSMO; |
| | | import com.java110.dto.user.UserDto; |
| | |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.dto.PageDto; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | |
| | | @Override |
| | | public String getUserIdByQrCode(@RequestBody String qrCode) { |
| | | qrCode = CommonCache.getValue(qrCode); |
| | | if(StringUtil.isEmpty(qrCode)){ |
| | | throw new IllegalArgumentException("二维码失效"); |
| | | } |
| | | qrCode = AuthenticationFactory.AesDecrypt(qrCode, AuthenticationFactory.AES_KEY); |
| | | JSONObject qrCodeJson = JSONObject.parseObject(qrCode); |
| | | if (qrCodeJson == null || !qrCodeJson.containsKey("time")) { |
| | | throw new IllegalArgumentException("二维码非法"); |
| | | } |
| | | long time = qrCodeJson.getLongValue("time"); |
| | | if (DateUtil.getCurrentDate().getTime() - time > 5 * 60 * 1000) { |
| | | throw new IllegalArgumentException("二维码失效"); |
| | |
| | | qrCodeJson.put("userId", userId); |
| | | qrCodeJson.put("time", DateUtil.getCurrentDate().getTime()); |
| | | String qrCode = AuthenticationFactory.AesEncrypt(qrCodeJson.toJSONString(), AuthenticationFactory.AES_KEY); |
| | | return qrCode; |
| | | String key = GenerateCodeFactory.getUUID(); |
| | | CommonCache.setValue(key, qrCode, CommonCache.defaultExpireTime); |
| | | return key; |
| | | } |
| | | |
| | | @Override |
| | | public int getSystemUserCount(@RequestBody UserDto userDto) { |
| | | return userV1ServiceDaoImpl.getSystemUserCount(BeanConvertUtil.beanCovertMap(userDto)); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<UserDto> getSystemUsers(@RequestBody UserDto userDto) { |
| | | //校验是否传了 分页信息 |
| | | |
| | | int page = userDto.getPage(); |
| | | |
| | | if (page != PageDto.DEFAULT_PAGE) { |
| | | userDto.setPage((page - 1) * userDto.getRow()); |
| | | } |
| | | |
| | | List<UserDto> users = BeanConvertUtil.covertBeanList(userV1ServiceDaoImpl.getSystemUsers(BeanConvertUtil.beanCovertMap(userDto)), UserDto.class); |
| | | |
| | | return users; |
| | | } |
| | | |
| | | } |