'提交代码'

dev-discount
= 4 years ago
parent e148cbb10f
commit 08420c07b8
  1. 36
      hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java
  2. 23
      hai-bweb/src/main/java/com/bweb/controller/SecUserController.java
  3. 8
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java

@ -87,6 +87,8 @@ public class HighCouponAgentController {
@ResponseBody @ResponseBody
@ApiOperation(value = "查询今天 代理商已销售的卡券") @ApiOperation(value = "查询今天 代理商已销售的卡券")
public ResponseData getAgentSalesCodeList(HttpServletRequest request, 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 = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) { @RequestParam(name = "pageSize", required = true) Integer pageSize) {
try { try {
@ -97,21 +99,29 @@ public class HighCouponAgentController {
log.error("HighCouponAgentController -> assignCouponAgent() error!","该主角色没有权限"); log.error("HighCouponAgentController -> assignCouponAgent() error!","该主角色没有权限");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, "");
} }
// 计算使用有效期 // 如果为空查当前时间
Calendar consumeTimeS = Calendar.getInstance(); Calendar timeS = Calendar.getInstance();
consumeTimeS.setTime(new Date()); if (consumeTimeS != null) {
consumeTimeS.set(Calendar.HOUR_OF_DAY, 00); timeS.setTime(new Date(consumeTimeS));
consumeTimeS.set(Calendar.MINUTE, 00); } else {
consumeTimeS.set(Calendar.SECOND, 00); timeS.setTime(new Date());
}
Calendar consumeTimeE = Calendar.getInstance(); timeS.set(Calendar.HOUR_OF_DAY, 00);
consumeTimeE.setTime(new Date()); timeS.set(Calendar.MINUTE, 00);
consumeTimeE.set(Calendar.HOUR_OF_DAY, 23); timeS.set(Calendar.SECOND, 00);
consumeTimeE.set(Calendar.MINUTE, 59);
consumeTimeE.set(Calendar.SECOND, 59); 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); 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) { } catch (Exception e) {
log.error("HighCouponAgentController --> getAgentSalesCodeList() error!", e); log.error("HighCouponAgentController --> getAgentSalesCodeList() error!", e);

@ -61,36 +61,25 @@ public class SecUserController {
JSONObject jsonObject = JSONObject.parseObject(reqBody); JSONObject jsonObject = JSONObject.parseObject(reqBody);
Long userId = jsonObject.getLong("userId"); //用户Id Long userId = jsonObject.getLong("userId"); //用户Id
String oldPassword = jsonObject.getString("oldPassword"); //旧密码
String password = jsonObject.getString("password"); //密码 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!","参数错误"); log.error("BaseMemberController --> sendUserPass() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_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); SecUser secUser = secUserService.findById(userId);
if(secUser == null){ if(secUser == null){
log.error("BaseMemberController --> sendUserPass() error!","未找到用户"); log.error("BaseMemberController --> sendUserPass() error!","未找到用户");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_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())); secUser.setPassword(MD5Util.encode(password.getBytes()));
//修改 //修改
secUserService.updateUser(secUser); secUserService.updateUser(secUser);

@ -305,13 +305,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
List<HighCouponAgentCode> list = highCouponAgentRelMapper.getAgentSalesCodeList(agentId, consumeTimeS, consumeTimeE); List<HighCouponAgentCode> list = highCouponAgentRelMapper.getAgentSalesCodeList(agentId, consumeTimeS, consumeTimeE);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
for (HighCouponAgentCode code : list) { for (HighCouponAgentCode code : list) {
HighCoupon highCoupon = highCouponService.getCouponById(code.getCouponId()); code.setHighCoupon(highCouponService.getCouponDetail(code.getCouponId()));
if (highCoupon != null) {
HighMerchant merchant = highMerchantService.getMerchantById(highCoupon.getMerchantId());
code.setMerchantLogo(merchant.getMerchantLogo());
code.setMerchantName(merchant.getMerchantName());
}
code.setHighCoupon(highCoupon);
code.setHighCouponCode(highCouponCodeService.getCouponCodeById(code.getCouponCodeId())); code.setHighCouponCode(highCouponCodeService.getCouponCodeById(code.getCouponCodeId()));
} }
return list; return list;

Loading…
Cancel
Save