diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java index a7cd3704..5a349f27 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java @@ -87,6 +87,8 @@ public class HighCouponAgentController { @ResponseBody @ApiOperation(value = "查询今天 代理商已销售的卡券") public ResponseData getAgentSalesCodeList(HttpServletRequest request, + @RequestParam(name = "consumeTimeS", required = false) Long consumeTimeS, + @RequestParam(name = "consumeTimeE", required = false) Long consumeTimeE, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize) { try { @@ -97,21 +99,29 @@ public class HighCouponAgentController { log.error("HighCouponAgentController -> assignCouponAgent() error!","该主角色没有权限"); throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); } - // 计算使用有效期 - Calendar consumeTimeS = Calendar.getInstance(); - consumeTimeS.setTime(new Date()); - consumeTimeS.set(Calendar.HOUR_OF_DAY, 00); - consumeTimeS.set(Calendar.MINUTE, 00); - consumeTimeS.set(Calendar.SECOND, 00); - - Calendar consumeTimeE = Calendar.getInstance(); - consumeTimeE.setTime(new Date()); - consumeTimeE.set(Calendar.HOUR_OF_DAY, 23); - consumeTimeE.set(Calendar.MINUTE, 59); - consumeTimeE.set(Calendar.SECOND, 59); + // 如果为空查当前时间 + Calendar timeS = Calendar.getInstance(); + if (consumeTimeS != null) { + timeS.setTime(new Date(consumeTimeS)); + } else { + timeS.setTime(new Date()); + } + timeS.set(Calendar.HOUR_OF_DAY, 00); + timeS.set(Calendar.MINUTE, 00); + timeS.set(Calendar.SECOND, 00); + + Calendar timeE = Calendar.getInstance(); + if (consumeTimeE != null) { + timeE.setTime(new Date(consumeTimeE)); + } else { + timeE.setTime(new Date()); + } + timeE.set(Calendar.HOUR_OF_DAY, 23); + timeE.set(Calendar.MINUTE, 59); + timeE.set(Calendar.SECOND, 59); PageHelper.startPage(pageNum, pageSize); - return ResponseMsgUtil.success(new PageInfo<>(highCouponAgentService.getAgentSalesCodeList(userInfoModel.getHighAgent().getId(), DateUtil.date2String(consumeTimeS.getTime(), "yyyy-MM-dd HH:mm:ss"), DateUtil.date2String(consumeTimeE.getTime(), "yyyy-MM-dd HH:mm:ss")))); + return ResponseMsgUtil.success(new PageInfo<>(highCouponAgentService.getAgentSalesCodeList(userInfoModel.getHighAgent().getId(), DateUtil.date2String(timeS.getTime(), "yyyy-MM-dd HH:mm:ss"), DateUtil.date2String(timeE.getTime(), "yyyy-MM-dd HH:mm:ss")))); } catch (Exception e) { log.error("HighCouponAgentController --> getAgentSalesCodeList() error!", e); diff --git a/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java b/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java index 98c6c651..4a02ac7a 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java @@ -61,36 +61,25 @@ public class SecUserController { JSONObject jsonObject = JSONObject.parseObject(reqBody); Long userId = jsonObject.getLong("userId"); //用户Id + String oldPassword = jsonObject.getString("oldPassword"); //旧密码 String password = jsonObject.getString("password"); //密码 - String nonceStr = jsonObject.getString("nonceStr"); //随机字符串 - String sign = jsonObject.getString("sign"); //签名 - if(userId == null || StringUtils.isBlank(password) || StringUtils.isBlank(nonceStr) || StringUtils.isBlank(sign)) { + if(userId == null || StringUtils.isBlank(oldPassword) || StringUtils.isBlank(password)) { log.error("BaseMemberController --> sendUserPass() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } - //MD5加密字符串 - String md5String = "userId="+userId+ - "&password="+password+ - "&nonceStr="+nonceStr; - - //校验签名 - if(!MD5Util.encode(md5String.getBytes()).equals(sign)) { - log.error("BaseMemberController --> sendUserPass() error!","签名错误"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SING_ERROR, ""); - } - //查询用户 SecUser secUser = secUserService.findById(userId); - if(secUser == null){ log.error("BaseMemberController --> sendUserPass() error!","未找到用户"); throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, ""); } - + if(!secUser.getPassword().equals(MD5Util.encode(oldPassword.getBytes()))) { + log.error("BaseMemberController --> sendUserPass() error!","旧密码不一致"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "旧密码不一致"); + } secUser.setPassword(MD5Util.encode(password.getBytes())); - //修改 secUserService.updateUser(secUser); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java index 6eceb63a..885d53b0 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java @@ -305,13 +305,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { List list = highCouponAgentRelMapper.getAgentSalesCodeList(agentId, consumeTimeS, consumeTimeE); if (list != null && list.size() > 0) { for (HighCouponAgentCode code : list) { - HighCoupon highCoupon = highCouponService.getCouponById(code.getCouponId()); - if (highCoupon != null) { - HighMerchant merchant = highMerchantService.getMerchantById(highCoupon.getMerchantId()); - code.setMerchantLogo(merchant.getMerchantLogo()); - code.setMerchantName(merchant.getMerchantName()); - } - code.setHighCoupon(highCoupon); + code.setHighCoupon(highCouponService.getCouponDetail(code.getCouponId())); code.setHighCouponCode(highCouponCodeService.getCouponCodeById(code.getCouponCodeId())); } return list;