dev-discount
袁野 4 years ago
commit 657342ba07
  1. 44
      hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java
  2. 23
      hai-service/src/main/java/com/hai/dao/HighCouponAgentRelMapper.java
  3. 18
      hai-service/src/main/java/com/hai/dao/HighCouponAgentRelMapperExt.java
  4. 14
      hai-service/src/main/java/com/hai/dao/HighCouponAgentRelSqlProvider.java
  5. 16
      hai-service/src/main/java/com/hai/entity/HighCouponAgentRel.java
  6. 60
      hai-service/src/main/java/com/hai/entity/HighCouponAgentRelExample.java
  7. 31
      hai-service/src/main/java/com/hai/model/AgentSalesModel.java
  8. 10
      hai-service/src/main/java/com/hai/model/HighCouponAgentCodeModel.java
  9. 10
      hai-service/src/main/java/com/hai/model/HighCouponAgentRelModel.java
  10. 7
      hai-service/src/main/java/com/hai/service/HighCouponAgentService.java
  11. 69
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java

@ -11,12 +11,10 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.*;
import com.hai.model.HighAgentModel;
import com.hai.model.HighMerchantModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighAgentService;
import com.hai.service.HighCouponAgentService;
import com.hai.service.HighCouponCodeService;
import com.hai.service.HighCouponService;
import com.hai.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -54,6 +52,9 @@ public class HighCouponAgentController {
@Resource
private HighCouponCodeService highCouponCodeService;
@Resource
private HighMerchantService highMerchantService;
@Autowired
private UserCenter userCenter;
@ -69,10 +70,12 @@ public class HighCouponAgentController {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
Map<String,Object> map = new HashMap<>();
map.put("", "");
if (userInfoModel.getHighAgent() == null) {
log.error("HighCouponAgentController -> assignCouponAgent() error!","该主角色没有权限");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, "");
}
return ResponseMsgUtil.success(map);
return ResponseMsgUtil.success(highCouponAgentService.getSalesCountByAgent(userInfoModel.getHighAgent().getId()));
} catch (Exception e) {
log.error("HighCouponAgentController --> getCodeById() error!", e);
@ -122,6 +125,7 @@ public class HighCouponAgentController {
highCouponAgentRel.setCouponName(coupon.getCouponName());
highCouponAgentRel.setSalesPrice(coupon.getSalesPrice());
highCouponAgentRel.setStatus(1); // 状态 0:删除 1:正常
highCouponAgentRel.setSalesCount(0);
highCouponAgentRel.setCreateTime(new Date());
highCouponAgentRel.setOperatorId(userInfoModel.getSecUser().getId());
highCouponAgentRel.setOperatorName(userInfoModel.getSecUser().getUserName());
@ -139,20 +143,13 @@ public class HighCouponAgentController {
@RequestMapping(value = "/getCouponByAgent", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据代理商 查询卡券")
public ResponseData getCouponByAgent(@RequestParam(name = "pageNum", required = true) Integer pageNum,
public ResponseData getCouponByAgent(@RequestParam(name = "agentId", required = true) Long agentId,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
try {
//发布人员
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getHighAgent() == null) {
log.error("HighCouponAgentController -> getCouponByAgent() error!","该角色没有权限");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "该角色没有权限");
}
Map<String,Object> map = new HashMap<>();
map.put("agentId", userInfoModel.getHighAgent().getId());
map.put("agentId", agentId);
PageHelper.startPage(pageNum,pageSize);
PageInfo<HighCouponAgentRel> pageInfo = new PageInfo<>(highCouponAgentService.getCouponAgentList(map));
@ -201,7 +198,7 @@ public class HighCouponAgentController {
@ResponseBody
@ApiOperation(value = "根据代理商和卡券 查询分配的销售码")
public ResponseData getCodeListByAgentCoupon(@RequestParam(name = "couponId", required = true) Long couponId,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "status", required = false) String status,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
@ -222,10 +219,15 @@ public class HighCouponAgentController {
PageHelper.startPage(pageNum,pageSize);
PageInfo<HighCouponAgentCode> pageInfo = new PageInfo<>(highCouponAgentService.getCouponCodeList(map));
if (pageInfo.getList().size() > 0) {
HighCoupon coupon = highCouponService.getCouponDetail(couponId);
HighMerchant merchant = new HighMerchant();
HighCoupon highCoupon = highCouponService.getCouponById(couponId);
if (highCoupon != null) {
merchant = highMerchantService.getMerchantById(highCoupon.getMerchantId());
}
for (HighCouponAgentCode code : pageInfo.getList()) {
code.setMerchantName(coupon.getMerchantName());
code.setHighCoupon(coupon);
code.setMerchantLogo(merchant.getMerchantLogo());
code.setMerchantName(merchant.getMerchantName());
code.setHighCoupon(highCoupon);
code.setHighCouponCode(highCouponCodeService.getCouponCodeById(code.getCouponCodeId()));
}
}

@ -41,16 +41,16 @@ public interface HighCouponAgentRelMapper extends HighCouponAgentRelMapperExt {
@Insert({
"insert into high_coupon_agent_rel (coupon_name, sales_price, ",
"coupon_id, agent_id, ",
"stock_count, create_time, ",
"`status`, operator_id, ",
"operator_name, ext_1, ",
"ext_2, ext_3)",
"stock_count, sales_count, ",
"create_time, `status`, ",
"operator_id, operator_name, ",
"ext_1, ext_2, ext_3)",
"values (#{couponName,jdbcType=VARCHAR}, #{salesPrice,jdbcType=DECIMAL}, ",
"#{couponId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ",
"#{stockCount,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{operatorId,jdbcType=BIGINT}, ",
"#{operatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"#{stockCount,jdbcType=INTEGER}, #{salesCount,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighCouponAgentRel record);
@ -67,6 +67,7 @@ public interface HighCouponAgentRelMapper extends HighCouponAgentRelMapperExt {
@Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="stock_count", property="stockCount", jdbcType=JdbcType.INTEGER),
@Result(column="sales_count", property="salesCount", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
@ -79,8 +80,8 @@ public interface HighCouponAgentRelMapper extends HighCouponAgentRelMapperExt {
@Select({
"select",
"id, coupon_name, sales_price, coupon_id, agent_id, stock_count, create_time, ",
"`status`, operator_id, operator_name, ext_1, ext_2, ext_3",
"id, coupon_name, sales_price, coupon_id, agent_id, stock_count, sales_count, ",
"create_time, `status`, operator_id, operator_name, ext_1, ext_2, ext_3",
"from high_coupon_agent_rel",
"where id = #{id,jdbcType=BIGINT}"
})
@ -91,6 +92,7 @@ public interface HighCouponAgentRelMapper extends HighCouponAgentRelMapperExt {
@Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="stock_count", property="stockCount", jdbcType=JdbcType.INTEGER),
@Result(column="sales_count", property="salesCount", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
@ -117,6 +119,7 @@ public interface HighCouponAgentRelMapper extends HighCouponAgentRelMapperExt {
"coupon_id = #{couponId,jdbcType=BIGINT},",
"agent_id = #{agentId,jdbcType=BIGINT},",
"stock_count = #{stockCount,jdbcType=INTEGER},",
"sales_count = #{salesCount,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"`status` = #{status,jdbcType=INTEGER},",
"operator_id = #{operatorId,jdbcType=BIGINT},",

@ -1,7 +1,23 @@
package com.hai.dao;
import com.hai.model.AgentSalesModel;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* mapper扩展类
*/
public interface HighCouponAgentRelMapperExt {
}
@Select(" select case when sum(1) is not null then sum(1) else 0 end count," +
" case when sum(c.sales_price) is not null then sum(c.sales_price) else 0 end salesCountPrice " +
" from high_coupon_agent_code a,high_coupon_code b,high_coupon_agent_rel c" +
" where c.id = a.coupon_agent_id and c.agent_id = #{agentId}" +
" and a.status = 2 and a.coupon_code_id = b.id and b.consume_time >= #{consumeTimeS} and b.consume_time <= #{consumeTimeE}")
AgentSalesModel getAgentSales(@Param("agentId") Long agentId, @Param("consumeTimeS")String consumeTimeS, @Param("consumeTimeE")String consumeTimeE);
@Select(" select count(1) from high_coupon_agent_code a where a.agent_id = #{agentId} and a.`status` in (#{status}) ")
Integer getAgentCodeCount(@Param("agentId") Long agentId,@Param("status") String status);
}

@ -48,6 +48,10 @@ public class HighCouponAgentRelSqlProvider {
sql.VALUES("stock_count", "#{stockCount,jdbcType=INTEGER}");
}
if (record.getSalesCount() != null) {
sql.VALUES("sales_count", "#{salesCount,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
@ -91,6 +95,7 @@ public class HighCouponAgentRelSqlProvider {
sql.SELECT("coupon_id");
sql.SELECT("agent_id");
sql.SELECT("stock_count");
sql.SELECT("sales_count");
sql.SELECT("create_time");
sql.SELECT("`status`");
sql.SELECT("operator_id");
@ -139,6 +144,10 @@ public class HighCouponAgentRelSqlProvider {
sql.SET("stock_count = #{record.stockCount,jdbcType=INTEGER}");
}
if (record.getSalesCount() != null) {
sql.SET("sales_count = #{record.salesCount,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
@ -181,6 +190,7 @@ public class HighCouponAgentRelSqlProvider {
sql.SET("coupon_id = #{record.couponId,jdbcType=BIGINT}");
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
sql.SET("stock_count = #{record.stockCount,jdbcType=INTEGER}");
sql.SET("sales_count = #{record.salesCount,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("operator_id = #{record.operatorId,jdbcType=BIGINT}");
@ -218,6 +228,10 @@ public class HighCouponAgentRelSqlProvider {
sql.SET("stock_count = #{stockCount,jdbcType=INTEGER}");
}
if (record.getSalesCount() != null) {
sql.SET("sales_count = #{salesCount,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}

@ -46,6 +46,11 @@ public class HighCouponAgentRel extends HighCouponAgentRelModel implements Seria
*/
private Integer stockCount;
/**
* 销售数量
*/
private Integer salesCount;
/**
* 创建时间
*/
@ -122,6 +127,14 @@ public class HighCouponAgentRel extends HighCouponAgentRelModel implements Seria
this.stockCount = stockCount;
}
public Integer getSalesCount() {
return salesCount;
}
public void setSalesCount(Integer salesCount) {
this.salesCount = salesCount;
}
public Date getCreateTime() {
return createTime;
}
@ -196,6 +209,7 @@ public class HighCouponAgentRel extends HighCouponAgentRelModel implements Seria
&& (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId()))
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId()))
&& (this.getStockCount() == null ? other.getStockCount() == null : this.getStockCount().equals(other.getStockCount()))
&& (this.getSalesCount() == null ? other.getSalesCount() == null : this.getSalesCount().equals(other.getSalesCount()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getOperatorId() == null ? other.getOperatorId() == null : this.getOperatorId().equals(other.getOperatorId()))
@ -215,6 +229,7 @@ public class HighCouponAgentRel extends HighCouponAgentRelModel implements Seria
result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode());
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode());
result = prime * result + ((getStockCount() == null) ? 0 : getStockCount().hashCode());
result = prime * result + ((getSalesCount() == null) ? 0 : getSalesCount().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getOperatorId() == null) ? 0 : getOperatorId().hashCode());
@ -237,6 +252,7 @@ public class HighCouponAgentRel extends HighCouponAgentRelModel implements Seria
sb.append(", couponId=").append(couponId);
sb.append(", agentId=").append(agentId);
sb.append(", stockCount=").append(stockCount);
sb.append(", salesCount=").append(salesCount);
sb.append(", createTime=").append(createTime);
sb.append(", status=").append(status);
sb.append(", operatorId=").append(operatorId);

@ -496,6 +496,66 @@ public class HighCouponAgentRelExample {
return (Criteria) this;
}
public Criteria andSalesCountIsNull() {
addCriterion("sales_count is null");
return (Criteria) this;
}
public Criteria andSalesCountIsNotNull() {
addCriterion("sales_count is not null");
return (Criteria) this;
}
public Criteria andSalesCountEqualTo(Integer value) {
addCriterion("sales_count =", value, "salesCount");
return (Criteria) this;
}
public Criteria andSalesCountNotEqualTo(Integer value) {
addCriterion("sales_count <>", value, "salesCount");
return (Criteria) this;
}
public Criteria andSalesCountGreaterThan(Integer value) {
addCriterion("sales_count >", value, "salesCount");
return (Criteria) this;
}
public Criteria andSalesCountGreaterThanOrEqualTo(Integer value) {
addCriterion("sales_count >=", value, "salesCount");
return (Criteria) this;
}
public Criteria andSalesCountLessThan(Integer value) {
addCriterion("sales_count <", value, "salesCount");
return (Criteria) this;
}
public Criteria andSalesCountLessThanOrEqualTo(Integer value) {
addCriterion("sales_count <=", value, "salesCount");
return (Criteria) this;
}
public Criteria andSalesCountIn(List<Integer> values) {
addCriterion("sales_count in", values, "salesCount");
return (Criteria) this;
}
public Criteria andSalesCountNotIn(List<Integer> values) {
addCriterion("sales_count not in", values, "salesCount");
return (Criteria) this;
}
public Criteria andSalesCountBetween(Integer value1, Integer value2) {
addCriterion("sales_count between", value1, value2, "salesCount");
return (Criteria) this;
}
public Criteria andSalesCountNotBetween(Integer value1, Integer value2) {
addCriterion("sales_count not between", value1, value2, "salesCount");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;

@ -0,0 +1,31 @@
package com.hai.model;
import java.math.BigDecimal;
/**
* @Auther: 胡锐
* @Description:
* @Date: 2021/4/22 23:44
*/
public class AgentSalesModel {
private Integer count;
private BigDecimal salesCountPrice;
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public BigDecimal getSalesCountPrice() {
return salesCountPrice;
}
public void setSalesCountPrice(BigDecimal salesCountPrice) {
this.salesCountPrice = salesCountPrice;
}
}

@ -16,6 +16,8 @@ public class HighCouponAgentCodeModel {
// 商户名称
private String merchantName;
private String merchantLogo;
// 卡券
private HighCoupon highCoupon;
@ -30,6 +32,14 @@ public class HighCouponAgentCodeModel {
this.merchantName = merchantName;
}
public String getMerchantLogo() {
return merchantLogo;
}
public void setMerchantLogo(String merchantLogo) {
this.merchantLogo = merchantLogo;
}
public HighCoupon getHighCoupon() {
return highCoupon;
}

@ -10,12 +10,22 @@ import com.hai.entity.HighCoupon;
*/
public class HighCouponAgentRelModel {
private String merchantLogo;
// 卡券信息
private HighCoupon highCoupon;
//代理商信息
private HighAgent highAgent;
public String getMerchantLogo() {
return merchantLogo;
}
public void setMerchantLogo(String merchantLogo) {
this.merchantLogo = merchantLogo;
}
public HighCoupon getHighCoupon() {
return highCoupon;
}

@ -55,4 +55,11 @@ public interface HighCouponAgentService {
* @Date 2021/4/21 22:35
**/
Map<String, Object> generateCode(Long couponAgentCodeId);
/**
* @Author 胡锐
* @Description 根据代理商 查询销售统计
* @Date 2021/4/22 22:26
**/
Map<String, Object> getSalesCountByAgent(Long agentId) throws Exception;
}

@ -4,23 +4,24 @@ import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.dao.HighCouponAgentCodeMapper;
import com.hai.dao.HighCouponAgentRelMapper;
import com.hai.entity.*;
import com.hai.model.AgentSalesModel;
import com.hai.service.HighCouponAgentService;
import com.hai.service.HighCouponCodeService;
import com.hai.service.HighCouponService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -62,7 +63,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
highCouponAgentRelMapper.insert(highCouponAgentRel);
List<HighCouponCode> assignCouponCodeList = codeList.stream().limit(highCouponAgentRel.getStatus()).collect(Collectors.toList());
List<HighCouponCode> assignCouponCodeList = codeList.stream().limit(highCouponAgentRel.getStockCount()).collect(Collectors.toList());
HighCouponAgentCode highCouponAgentCode;
for (HighCouponCode code : assignCouponCodeList) {
code.setAgentId(highCouponAgentRel.getAgentId());
@ -130,8 +131,13 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
criteria.andAgentIdEqualTo(MapUtils.getLong(map, "agentId"));
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
if (StringUtils.isNotBlank(MapUtils.getString(map, "status"))) {
String[] strings = MapUtils.getString(map, "status").split(",");
List<Integer> statusList = new ArrayList<>();
for (String i : strings) {
statusList.add(Integer.parseInt(i));
}
criteria.andStatusIn(statusList);
}
example.setOrderByClause("create_time desc");
@ -157,6 +163,11 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
couponAgentCode.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用
highCouponAgentCodeMapper.updateByPrimaryKey(couponAgentCode);
HighCouponAgentRel couponAgent = getRelByCouponAgent(couponAgentCode.getCouponId(), couponAgentCode.getAgentId());
couponAgent.setStockCount(couponAgent.getStockCount() - 1);
couponAgent.setSalesCount(couponAgent.getSalesCount() + 1);
highCouponAgentRelMapper.updateByPrimaryKey(couponAgent);
HighCouponCode couponCode = highCouponCodeService.getCouponCodeById(couponAgentCode.getCouponCodeId());
couponCode.setStatus(2);
couponCode.setReceiveTime(new Date());
@ -168,4 +179,48 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
map.put("couponAgentCode", couponAgentCode);
return map;
}
@Override
public Map<String, Object> getSalesCountByAgent(Long agentId) throws Exception {
BigDecimal surplusCountPrice = new BigDecimal("0");
BigDecimal salesCountPrice = new BigDecimal("0");
Map<String,Object> listMap = new HashMap<>();
listMap.put("agentId", agentId);
List<HighCouponAgentRel> list = getCouponAgentList(listMap);
for (HighCouponAgentRel highCouponAgentRel : list) {
BigDecimal surplusPrice = new BigDecimal(highCouponAgentRel.getStockCount()).multiply((highCouponAgentRel.getSalesPrice()));
surplusCountPrice = surplusCountPrice.add(surplusPrice);
BigDecimal salesPrice = new BigDecimal(highCouponAgentRel.getSalesCount()).multiply((highCouponAgentRel.getSalesPrice()));
salesCountPrice = salesCountPrice.add(salesPrice);
}
// 计算使用有效期
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();
consumeTimeS.setTime(new Date());
consumeTimeS.set(Calendar.HOUR_OF_DAY, 23);
consumeTimeS.set(Calendar.MINUTE, 59);
consumeTimeS.set(Calendar.SECOND, 59);
AgentSalesModel agentSales = highCouponAgentRelMapper.getAgentSales(agentId, DateUtil.date2String(consumeTimeS.getTime(), "yyyy-MM-dd HH:mm:ss"), DateUtil.date2String(consumeTimeE.getTime(), "yyyy-MM-dd HH:mm:ss"));
Map<String, Object> returnMap = new HashMap<>();
returnMap.put("orderCount", agentSales.getCount());
returnMap.put("turnoverPrice", agentSales.getSalesCountPrice());
returnMap.put("laveStockCount", highCouponAgentRelMapper.getAgentCodeCount(agentId, "1")); // 库存数量
returnMap.put("soldCount", highCouponAgentRelMapper.getAgentCodeCount(agentId, "2,3")); // 销售数量
returnMap.put("surplusCountPrice", surplusCountPrice); // 剩余总额
returnMap.put("salesCountPrice", salesCountPrice); // 销售总额
returnMap.put("list", list);
return returnMap;
}
}

Loading…
Cancel
Save