'提交代码'

dev-discount
199901012 4 years ago
parent fb9de099ac
commit 378f2579de
  1. 4
      hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java
  2. 4
      hai-service/src/main/java/com/hai/dao/HighCouponAgentRelMapperExt.java
  3. 10
      hai-service/src/main/java/com/hai/model/HighCouponAgentCodeModel.java
  4. 10
      hai-service/src/main/java/com/hai/model/HighCouponAgentRelModel.java
  5. 23
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java

@ -124,6 +124,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());
@ -203,7 +204,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) {
@ -226,6 +227,7 @@ public class HighCouponAgentController {
if (pageInfo.getList().size() > 0) {
HighCoupon coupon = highCouponService.getCouponDetail(couponId);
for (HighCouponAgentCode code : pageInfo.getList()) {
code.setMerchantLogo(code.getMerchantLogo());
code.setMerchantName(coupon.getMerchantName());
code.setHighCoupon(coupon);
code.setHighCouponCode(highCouponCodeService.getCouponCodeById(code.getCouponCodeId()));

@ -4,7 +4,6 @@ import com.hai.model.AgentSalesModel;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.Map;
/**
* mapper扩展类
@ -18,4 +17,7 @@ public interface HighCouponAgentRelMapperExt {
" 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);
}

@ -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;
}

@ -14,6 +14,7 @@ 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;
@ -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());
@ -181,8 +192,8 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
BigDecimal surplusPrice = new BigDecimal(highCouponAgentRel.getStockCount()).multiply((highCouponAgentRel.getSalesPrice()));
surplusCountPrice = surplusCountPrice.add(surplusPrice);
BigDecimal salesPrice = new BigDecimal(highCouponAgentRel.getStockCount()).multiply((highCouponAgentRel.getSalesPrice()));
surplusCountPrice = surplusCountPrice.add(salesPrice);
BigDecimal salesPrice = new BigDecimal(highCouponAgentRel.getSalesCount()).multiply((highCouponAgentRel.getSalesPrice()));
salesCountPrice = salesCountPrice.add(salesPrice);
}
// 计算使用有效期
@ -203,6 +214,10 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
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);

Loading…
Cancel
Save