|
|
@ -91,7 +91,8 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic |
|
|
|
public HighDiscountPackage getCallExclusive(Integer usingAttribution, Integer companyId) { |
|
|
|
public HighDiscountPackage getCallExclusive(Integer usingAttribution, Integer companyId) { |
|
|
|
HighDiscountPackageExample example = new HighDiscountPackageExample(); |
|
|
|
HighDiscountPackageExample example = new HighDiscountPackageExample(); |
|
|
|
HighDiscountPackageExample.Criteria criteria = example.createCriteria(); |
|
|
|
HighDiscountPackageExample.Criteria criteria = example.createCriteria(); |
|
|
|
criteria.andUsingAttributionEqualTo(usingAttribution).andStatusNotEqualTo(4).andCompanyIdEqualTo(companyId);; |
|
|
|
criteria.andUsingAttributionEqualTo(usingAttribution).andStatusNotEqualTo(4).andCompanyIdEqualTo(companyId); |
|
|
|
|
|
|
|
; |
|
|
|
return highDiscountPackageMapper.selectByExample(example).get(0); |
|
|
|
return highDiscountPackageMapper.selectByExample(example).get(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -139,7 +140,7 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Transactional(propagation= Propagation.REQUIRES_NEW,isolation= Isolation.SERIALIZABLE) |
|
|
|
@Transactional(propagation = Propagation.REQUIRES_NEW) |
|
|
|
public void addDiscountPackageStock(HighDiscountPackage highDiscountPackage, UserInfoModel userInfoModel, Integer num) { |
|
|
|
public void addDiscountPackageStock(HighDiscountPackage highDiscountPackage, UserInfoModel userInfoModel, Integer num) { |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> mapRule = new HashMap<>(); |
|
|
|
Map<String, Object> mapRule = new HashMap<>(); |
|
|
@ -158,14 +159,34 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic |
|
|
|
for (int i = 0; i < num; i++) { |
|
|
|
for (int i = 0; i < num; i++) { |
|
|
|
discountPackageActual.setCreatedTime(new Date()); |
|
|
|
discountPackageActual.setCreatedTime(new Date()); |
|
|
|
discountPackageActualMapper.insert(discountPackageActual); |
|
|
|
discountPackageActualMapper.insert(discountPackageActual); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 循环 优惠券包规则详情 列表
|
|
|
|
// 循环 优惠券包规则详情 列表
|
|
|
|
for (HighDiscountPackageDetails detailsList : discountPackageDetailsList) { |
|
|
|
for (HighDiscountPackageDetails detailsList : discountPackageDetailsList) { |
|
|
|
// 查询代理商与优惠券关系 列表
|
|
|
|
// 查询代理商与优惠券关系 列表
|
|
|
|
List<HighDiscountAgentRel> discountAgentRels = highDiscountAgentRelService.getRelByDiscountAgent(detailsList.getDiscountId().longValue() , detailsList.getAgentId()); |
|
|
|
HighDiscountAgentRel discountAgentRel = highDiscountAgentRelService.getRelByDiscountAgent(detailsList.getDiscountId().longValue(), detailsList.getAgentId()); |
|
|
|
|
|
|
|
List<HighDiscountAgentCode> discountAgentCodeList = highDiscountAgentCodeService.getDiscountCodeByStatus(discountAgentRel.getId() , 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 赠送优惠券
|
|
|
|
|
|
|
|
for (HighDiscountAgentCode discountAgentCode : discountAgentCodeList.subList(0, detailsList.getNum())) { |
|
|
|
|
|
|
|
HighDiscountPackageDiscountActual discountPackageDiscountActual = new HighDiscountPackageDiscountActual(); |
|
|
|
|
|
|
|
discountPackageDiscountActual.setDiscountPackageId(highDiscountPackage.getId()); |
|
|
|
|
|
|
|
discountPackageDiscountActual.setDiscountPackageActualId(discountPackageActual.getId()); |
|
|
|
|
|
|
|
discountPackageDiscountActual.setCreatedUserId(userInfoModel.getSecUser().getId().intValue()); |
|
|
|
|
|
|
|
discountPackageDiscountActual.setCreatedTime(new Date()); |
|
|
|
|
|
|
|
discountPackageDiscountActual.setAgentDiscountCodeId(discountAgentCode.getId()); |
|
|
|
|
|
|
|
discountPackageDiscountActual.setStatus(1); |
|
|
|
|
|
|
|
discountPackageDiscountActualMapper.insert(discountPackageDiscountActual); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 修改优惠券二维码状态
|
|
|
|
|
|
|
|
discountAgentCode.setStatus(5); |
|
|
|
|
|
|
|
highDiscountAgentCodeService.updateCode(discountAgentCode); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
highDiscountPackage.setTotalStock(num); |
|
|
|
|
|
|
|
highDiscountPackage.setSurplusStock(highDiscountPackage.getSurplusStock() + num); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|