'提交代码'

dev-discount
= 4 years ago
parent 5f9a305eb9
commit e700cf359e
  1. 51
      hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java

@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@ -85,7 +86,7 @@ public class HighCouponAgentController {
@RequestMapping(value = "/getAgentSalesCodeList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询今天 代理商已销售的卡券")
@ApiOperation(value = "查询代理商已销售的卡券")
public ResponseData getAgentSalesCodeList(HttpServletRequest request,
@RequestParam(name = "consumeTimeS", required = false) Long consumeTimeS,
@RequestParam(name = "consumeTimeE", required = false) Long consumeTimeE,
@ -129,6 +130,54 @@ public class HighCouponAgentController {
}
}
@RequestMapping(value = "/getAgentSalesPriceCount", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询代理商销售总价格")
public ResponseData getAgentSalesPriceCount(HttpServletRequest request,
@RequestParam(name = "consumeTimeS", required = false) Long consumeTimeS,
@RequestParam(name = "consumeTimeE", required = false) Long consumeTimeE) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getHighAgent() == null) {
log.error("HighCouponAgentController -> assignCouponAgent() error!","该主角色没有权限");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, "");
}
// 如果为空查当前时间
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);
BigDecimal totalPrice = new BigDecimal("0.00");
List<HighCouponAgentCode> list = 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"));
for (HighCouponAgentCode code: list) {
totalPrice = totalPrice.add(code.getHighCoupon().getSalesPrice());
}
return ResponseMsgUtil.success(totalPrice);
} catch (Exception e) {
log.error("HighCouponAgentController --> getAgentSalesCodeList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/assignCouponAgent", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "分配卡券给代理商")

Loading…
Cancel
Save