Merge remote-tracking branch 'origin/dev' into dev
| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 自定义Realm,处理认证和权限 |
| | |
| | | * @date 2022/03/15 09:54 |
| | | */ |
| | | @Override |
| | | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException{ |
| | | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { |
| | | // 获取用户名 |
| | | String username = authenticationToken.getPrincipal().toString(); |
| | | // 根据用户名查询用户对象 |
| | |
| | | if(user == null){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,账号或密码不正确!"); |
| | | } |
| | | if(Objects.equals(user.getStatus(),Constants.ONE)){ |
| | | throw new AuthenticationException("用户已被禁用,请联系管理员"); |
| | | } |
| | | // 获取登录用户信息 |
| | | List<SystemRole> roles = systemRoleService.findByUserId(user.getId()); |
| | | List<SystemPermission> permissions = systemPermissionService.findByUserId(user.getId()); |
| | |
| | | import com.doumee.service.system.SystemPositionUserService; |
| | | import com.doumee.service.system.SystemUserRoleService; |
| | | import com.doumee.service.system.SystemUserService; |
| | | import com.google.common.base.Objects; |
| | | import org.apache.commons.lang3.RandomStringUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | |
| | | } |
| | | if (Constants.formatIntegerNum(user.getFixed())==Constants.ONE ) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "请勿删除" + user.getUsername() + ",因为这是固定用户"); |
| | | } |
| | | if ("admin".equals(user.getUsername())){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "超级管理员账号不允许删除"); |
| | | } |
| | | systemUserService.deleteById(id); |
| | | } |
| | |
| | | queryUserDto.setUsername(systemUser.getMobile()); |
| | | SystemUser user = systemUserService.findOne(queryUserDto); |
| | | if (user != null) { |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "用户名已存在"); |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "手机号码已存在"); |
| | | } |
| | | // 验证工号 |
| | | if (StringUtils.isNotBlank(systemUser.getEmpNo())) { |
| | |
| | | public void updateById(CreateSystemUserDTO systemUser) { |
| | | // 验证用户名 |
| | | SystemUser queryUserDto = new SystemUser(); |
| | | queryUserDto.setId(systemUser.getId()); |
| | | queryUserDto.setUsername(systemUser.getUsername()); |
| | | queryUserDto.setDeleted(Constants.ZERO); |
| | | SystemUser user = systemUserService.findOne(queryUserDto); |
| | |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "工号已存在"); |
| | | } |
| | | } |
| | | if ("admin".equals(user.getUsername()) && Objects.equal(systemUser.getStatus(),1)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "超级管理员账号不允许禁用"); |
| | | } |
| | | // 修改用户 |
| | | systemUserService.updateById(systemUser); |
| | | // 设置部门 |
| | |
| | | @ApiModelProperty(value = "手机号码") |
| | | private String mobile; |
| | | |
| | | @ApiModelProperty(value = "用户状态") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "用户角色") |
| | | private Integer roleId; |
| | | } |
| | |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | @Override |
| | | public void closeGoodsorder( Goodsorder goodsorder ,int type ) { |
| | | |
| | | LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | List<MemberRides> memberRides = getMemberRidesForClose(goodsorder.getId()); |
| | | //默认结算为押金金额 |
| | | BigDecimal closeMoney = new BigDecimal(0.00); |
| | |
| | | refundDTO.setTotalAmount(goodsorder.getMoney()); |
| | | refundDTO.setMemberId(goodsorder.getMemberId()); |
| | | refundDTO.setReason(Constants.REFUND_TYPE.get(type).getName()); |
| | | refundDTO.setCreator(principal.getId()); |
| | | refundDTO.setType(type); |
| | | Refund refund = wxMiniUtilService.wxRefund(refundDTO); |
| | | update.setCloseId(refund.getId()); |
| | |
| | | BigDecimal refundMoney = total == null?new BigDecimal(0):Constants.formatDecimalNum(total.getMoney()); |
| | | //可退剩余 单位元 |
| | | BigDecimal canBalance =Constants.translateMoney(Constants.formatDecimalNum(goodsorder.getMoney()).subtract(refundMoney)); |
| | | if(canBalance.compareTo(money) > Constants.ZERO){ |
| | | if(canBalance.compareTo(money) >= Constants.ZERO){ |
| | | RefundDTO refundDTO = new RefundDTO(); |
| | | refundDTO.setOrderId(orderId); |
| | | refundDTO.setCanBalance(canBalance); |
| | |
| | | BigDecimal reduce = total!=null?Constants.formatDecimalNum(total.getMoney()):new BigDecimal(0); |
| | | goodsorderCanBanlanceDTO.setHasRefundMoney(Constants.translateMoney(reduce)); |
| | | |
| | | BigDecimal subtract = Constants.translateMoney(goodsorder.getMoney()).subtract(goodsorderCanBanlanceDTO.getCloseMoney()).subtract(goodsorderCanBanlanceDTO.getHasRefundMoney()); |
| | | BigDecimal subtract = Constants.translateMoney(goodsorder.getMoney()).subtract(goodsorderCanBanlanceDTO.getHasRefundMoney()); |
| | | goodsorderCanBanlanceDTO.setCanBanlanceMoney(subtract.compareTo(new BigDecimal("0")) > 0 ? subtract : new BigDecimal("0")); |
| | | return goodsorderCanBanlanceDTO; |
| | | } |
| | |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"该定价方案下没有配置价格"); |
| | | } |
| | | List<String> collect = pricingDetails.stream().map(s -> s.getBikeTypeId()).collect(Collectors.toList()); |
| | | boolean b = baseParams.stream().map(s -> s.getId()).anyMatch(s -> collect.contains(s)); |
| | | boolean b = baseParams.stream().map(s -> s.getId()).allMatch(s -> collect.contains(s)); |
| | | |
| | | if (b){ |
| | | if (!b){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"该定价方案下没有配置完整"); |
| | | } |
| | | PricingParam pricingParam1 = new PricingParam(); |
| | |
| | | String jasonStr = MiniProgrammeDTO.toUnderlineJSONString(miniProgrammeDTO); |
| | | JSONObject parse = (JSONObject) JSONObject.parse(jasonStr); |
| | | parse.entrySet().forEach(s->{ |
| | | if (StringUtils.isNotBlank((String)s.getValue())){ |
| | | // if (StringUtils.isNotBlank((String)s.getValue())){ |
| | | UpdateWrapper<SystemDictData> wrapper = new UpdateWrapper<>(); |
| | | wrapper.lambda() |
| | | .eq(SystemDictData::getLabel,s.getKey().toUpperCase()) |
| | | .set(SystemDictData::getCode,s.getValue()); |
| | | systemDictDataMapper.update(null,wrapper); |
| | | } |
| | | // } |
| | | }); |
| | | } catch (JsonProcessingException e) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"字典值解析有误"); |
| | |
| | | loginLog.setReason(e.getMessage().length() > 200 ? (e.getMessage().substring(0, 190) + "...") : e.getMessage()); |
| | | loginLog.setSuccess(Constants.ONE); |
| | | systemLoginLogService.create(loginLog); |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT.getCode(),e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | select |
| | | distinct |
| | | usr.id, usr.birthday, usr.email, usr.emp_no, usr.mobile, usr.avatar, usr.username, usr.realname, usr.sex, usr.fixed, usr.create_time, usr.update_time, |
| | | usr.nickname, |
| | | usr.nickname,usr.status, |
| | | create_user.id create_user_id, create_user.username create_user_name, |
| | | update_user.id updete_user_id, update_user.username update_user_name |
| | | from "system_user" usr |
| | | left join "system_user" create_user on create_user.id = usr.create_user |
| | | left join "system_user" update_user on update_user.id = usr.update_user |
| | | left join "system_user_role" sur on sur.user_id = usr.id |
| | | <where> |
| | | usr.deleted = 0 |
| | | <if test="dto.username != null and dto.username != ''"> |
| | |
| | | <if test="dto.mobile != null and dto.mobile != ''"> |
| | | AND usr.mobile LIKE '%'||#{dto.mobile}||'%' |
| | | </if> |
| | | <if test="dto.status != null "> |
| | | AND usr.status = #{dto.status} |
| | | </if> |
| | | <if test="dto.roleId != null and dto.roleId != ''"> |
| | | AND sur.role_id = #{dto.roleId} |
| | | </if> |
| | | |
| | | </where> |
| | | </select> |