|
|
|
@@ -36,6 +36,7 @@ import com.iformall.utils.DateUtils; |
|
|
|
import com.iformall.utils.PayUtils; |
|
|
|
import com.iformall.utils.RedisLock; |
|
|
|
|
|
|
|
import org.apache.commons.beanutils.BeanUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
@@ -48,6 +49,8 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
@@ -264,14 +267,216 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
resultMap.put("amount", list.stream().mapToInt(p -> p.getCouponPrice()).sum()); |
|
|
|
resultMap.put("orderCount", list.size()); |
|
|
|
} else { |
|
|
|
if (isVerified) |
|
|
|
resultMap.put("list", PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfVerifiedByDateForBUser(dateMap))); |
|
|
|
else |
|
|
|
resultMap.put("list", PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfOrderedByDateForBUser(dateMap))); |
|
|
|
if (isVerified) { |
|
|
|
resultMap.put("list", findListOfVerifiedByDateForBUser(wxMerchant,wxMerchant.getId(),startDate,endDate,pageIndex,pageSize)); |
|
|
|
}else { |
|
|
|
resultMap.put("list", findListOfOrderedByDateForBUser(wxMerchant,wxMerchant.getId(),startDate,endDate,pageIndex,pageSize)); |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(resultMap); |
|
|
|
} |
|
|
|
|
|
|
|
private PageInfo<WxCouponOrderBVo> findListOfVerifiedByDateForBUser(TenantEntity tenantEntity,Long merchantId,Date startDate,Date endDate,Integer pageIndex,Integer pageSize) { |
|
|
|
Map dateMap = new HashMap(); |
|
|
|
dateMap.put("startDate", startDate); |
|
|
|
dateMap.put("endDate", endDate); |
|
|
|
|
|
|
|
WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); |
|
|
|
merchantBUserQ.updateTenantInfo(tenantEntity); |
|
|
|
merchantBUserQ.setMerchantId(merchantId); |
|
|
|
List<Long> bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); |
|
|
|
dateMap.put("bUserIds", bUserIds); |
|
|
|
|
|
|
|
PageInfo<WxCouponOrder> couponOrderPage = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() ->wxCouponOrderMapper.findListOfVerifiedByDateForBUser(dateMap)); |
|
|
|
PageInfo<WxCouponOrderBVo> pageInfo = new PageInfo<WxCouponOrderBVo>(); |
|
|
|
pageInfo.setList(handleToCouponOrderBVoList(tenantEntity,couponOrderPage.getList())); |
|
|
|
pageInfo.setPageNum(couponOrderPage.getPageNum()); |
|
|
|
pageInfo.setPageSize(couponOrderPage.getPageSize()); |
|
|
|
pageInfo.setPages(couponOrderPage.getPages()); |
|
|
|
return pageInfo; |
|
|
|
} |
|
|
|
|
|
|
|
private PageInfo<WxCouponOrderBVo> findListOfOrderedByDateForBUser(TenantEntity tenantEntity,Long merchantId,Date startDate,Date endDate,Integer pageIndex,Integer pageSize) { |
|
|
|
Map dateMap = new HashMap(); |
|
|
|
dateMap.put("startDateTimes", startDate.getTime()); |
|
|
|
dateMap.put("endDateTimes", endDate.getTime()); |
|
|
|
List<Long> merchantIdList = new ArrayList<Long>(); |
|
|
|
merchantIdList.add(merchantId); |
|
|
|
List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), merchantIdList); |
|
|
|
if (null != merchantProductVos) { |
|
|
|
List<Long> couponIds = new ArrayList<Long>(); |
|
|
|
for (int i = 0 ; i < merchantProductVos.size(); i ++) { |
|
|
|
WxMerchantProductVo mp = merchantProductVos.get(i); |
|
|
|
if (mp.getMc() == 1) { |
|
|
|
if (!couponIds.contains(mp.getProductId())) { |
|
|
|
couponIds.add(mp.getProductId()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (couponIds.size() > 0 ) { |
|
|
|
dateMap.put("couponIds", couponIds); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
PageInfo<WxCouponOrder> couponOrderPage = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() ->wxCouponOrderMapper.findListOfOrderedByDateForBUser(dateMap)); |
|
|
|
PageInfo<WxCouponOrderBVo> pageInfo = new PageInfo<WxCouponOrderBVo>(); |
|
|
|
pageInfo.setList(handleToCouponOrderBVoList(tenantEntity,couponOrderPage.getList())); |
|
|
|
pageInfo.setPageNum(couponOrderPage.getPageNum()); |
|
|
|
pageInfo.setPageSize(couponOrderPage.getPageSize()); |
|
|
|
pageInfo.setPages(couponOrderPage.getPages()); |
|
|
|
return pageInfo; |
|
|
|
} |
|
|
|
|
|
|
|
private List<WxCouponOrderBVo> handleToCouponOrderBVoList(TenantEntity tenantEntity,List<WxCouponOrder> couponOrderList) { |
|
|
|
List<WxCouponOrderBVo> retList = null; |
|
|
|
if (null != couponOrderList && couponOrderList.size() > 0 ) { |
|
|
|
retList = new ArrayList<WxCouponOrderBVo>(); |
|
|
|
|
|
|
|
List<Long> bUserIdList = new ArrayList<Long>(); |
|
|
|
List<Long> cUserIdList = new ArrayList<Long>(); |
|
|
|
List<Long> couponIdList = new ArrayList<Long>(); |
|
|
|
for (int j = 0 ; j < couponOrderList.size(); j ++) { |
|
|
|
WxCouponOrder co = couponOrderList.get(j); |
|
|
|
Long bUserId = co.getBUserId(); |
|
|
|
if (null != bUserId && (!bUserIdList.contains(bUserId))) { |
|
|
|
bUserIdList.add(bUserId); |
|
|
|
} |
|
|
|
|
|
|
|
Long cUserId = co.getcUserId(); |
|
|
|
if (null != cUserId && (!cUserIdList.contains(cUserId))) { |
|
|
|
cUserIdList.add(cUserId); |
|
|
|
} |
|
|
|
|
|
|
|
Long couponId = co.getCouponId(); |
|
|
|
if (null != couponId && (!couponIdList.contains(couponId))) { |
|
|
|
couponIdList.add(couponId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//获取到buserId |
|
|
|
Map<Long,WxMerchantBUser> bUserMap = new HashMap<Long,WxMerchantBUser>(); |
|
|
|
List<Long> merchantIdList = null; |
|
|
|
if (bUserIdList.size() > 0 ) { |
|
|
|
merchantIdList = new ArrayList<Long>(); |
|
|
|
WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); |
|
|
|
merchantBUserQ.updateTenantInfo(tenantEntity); |
|
|
|
merchantBUserQ.setIds(bUserIdList); |
|
|
|
List<WxMerchantBUser> bUserList = wxMerchantBUserMapper.findSimpleList(merchantBUserQ); |
|
|
|
if (null != bUserList) { |
|
|
|
for (int k = 0 ; k < bUserList.size() ; k++) { |
|
|
|
WxMerchantBUser b = bUserList.get(k); |
|
|
|
bUserMap.put(b.getId(), b); |
|
|
|
if (!merchantIdList.contains(b.getMerchantId())) { |
|
|
|
merchantIdList.add(b.getMerchantId()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//merchant |
|
|
|
Map<Long,WxMerchant> merchantSimpleMap = new HashMap<Long,WxMerchant>(); |
|
|
|
if (null != merchantIdList) { |
|
|
|
WxMerchant merchantQ = new WxMerchant(); |
|
|
|
merchantQ.updateTenantInfo(tenantEntity); |
|
|
|
merchantQ.setIds(merchantIdList); |
|
|
|
List<WxMerchant> merchantList = wxMerchantMapper.findIdNameList(merchantQ); |
|
|
|
if (null != merchantList) { |
|
|
|
for (int k = 0 ; k < merchantList.size() ; k++) { |
|
|
|
WxMerchant m = merchantList.get(k); |
|
|
|
merchantSimpleMap.put(m.getId(), m); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//获取到cUserId |
|
|
|
Map<Long,WxCUserBasicInfo> cUserSimpleMap = new HashMap<Long,WxCUserBasicInfo>(); |
|
|
|
if (cUserIdList.size() > 0 ) { |
|
|
|
WxCUserBasicInfo cBasicInfoQ = new WxCUserBasicInfo(); |
|
|
|
cBasicInfoQ.setFinalTenantId(tenantEntity.getFinalTenantId()); |
|
|
|
cBasicInfoQ.setIds(cUserIdList); |
|
|
|
List<WxCUserBasicInfo> cUserBasicInfoList = wxCUserBasicInfoMapper.findListPhoneAndNameByIds(cBasicInfoQ); |
|
|
|
if (null != cUserBasicInfoList) { |
|
|
|
for (int k = 0 ; k < cUserBasicInfoList.size() ; k++) { |
|
|
|
WxCUserBasicInfo cbi = cUserBasicInfoList.get(k); |
|
|
|
cUserSimpleMap.put(cbi.getId(), cbi); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//获取coupon |
|
|
|
Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>(); |
|
|
|
if (couponIdList.size() > 0 ) { |
|
|
|
WxCoupon couponQ = new WxCoupon(); |
|
|
|
couponQ.updateTenantInfo(tenantEntity); |
|
|
|
couponQ.setIds(couponIdList); |
|
|
|
List<WxCoupon> couponList = wxCouponMapper.findTenantSimpleList(couponQ); |
|
|
|
if (null != couponList) { |
|
|
|
for (int k = 0 ; k < couponList.size() ; k++) { |
|
|
|
WxCoupon c = couponList.get(k); |
|
|
|
couponMap.put(c.getId(), c); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (int i = 0 ; i < couponOrderList.size() ; i ++) { |
|
|
|
WxCouponOrder couponOrder = couponOrderList.get(i); |
|
|
|
WxCouponOrderBVo bvo = couponOrdertoBVo(couponOrder,bUserMap,merchantSimpleMap,cUserSimpleMap,couponMap); |
|
|
|
if (null != bvo ) { |
|
|
|
retList.add(bvo); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return retList; |
|
|
|
} |
|
|
|
|
|
|
|
private WxCouponOrderBVo couponOrdertoBVo(WxCouponOrder couponOrder,Map<Long,WxMerchantBUser> bUserMap,Map<Long,WxMerchant> merchantSimpleMap,Map<Long,WxCUserBasicInfo> cUserSimpleMap,Map<Long,WxCoupon> couponMap) { |
|
|
|
WxCouponOrderBVo bvo = new WxCouponOrderBVo(); |
|
|
|
try { |
|
|
|
BeanUtils.copyProperties(bvo, couponOrder); |
|
|
|
if (null != bvo.getBUserId()) { |
|
|
|
WxMerchantBUser b = bUserMap.get(bvo.getBUserId()); |
|
|
|
if (null != b) { |
|
|
|
bvo.setbUserName(b.getName()); |
|
|
|
bvo.setBUserPhone(b.getPhone()); |
|
|
|
WxMerchant merchant = merchantSimpleMap.get(b.getMerchantId()); |
|
|
|
if (null != merchant) { |
|
|
|
bvo.setMerchantName(merchant.getName()); |
|
|
|
bvo.setMerchantId(merchant.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (null != bvo.getCUserId()) { |
|
|
|
WxCUserBasicInfo cbi = cUserSimpleMap.get(bvo.getCUserId()); |
|
|
|
if (null != cbi) { |
|
|
|
bvo.setcUserPhone(cbi.getPhone()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (null != bvo.getCouponId()) { |
|
|
|
WxCoupon coupon = couponMap.get(bvo.getCouponId()); |
|
|
|
if (null != coupon) { |
|
|
|
bvo.setType(coupon.getType()); |
|
|
|
bvo.setTitle(coupon.getTitle()); |
|
|
|
bvo.setSalePrice(coupon.getSalePrice()); |
|
|
|
bvo.setUsePrice(coupon.getUsePrice()); |
|
|
|
bvo.setPrice(coupon.getPrice()); |
|
|
|
bvo.setAutoRefund(coupon.getAutoRefund()); |
|
|
|
bvo.setBusiness(coupon.getBusiness()); |
|
|
|
bvo.setSubsidyType(coupon.getSubsidyType()); |
|
|
|
|
|
|
|
//c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bvo.setSubsidyNum(bvo.getSubsidy()); |
|
|
|
return bvo; |
|
|
|
} catch (IllegalAccessException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} catch (InvocationTargetException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
//@Override |
|
|
|
//public PageInfo<WxCouponOrderCVo> listCUserVoAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize) { |
|
|
|
// |
|
|
|
@@ -339,14 +544,20 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
@Override |
|
|
|
public ResultData listAdminAsPage(WxCouponOrderBVo wxCouponOrderBVo, Integer pageIndex, Integer pageSize) { |
|
|
|
handleWxCouponOrderBVoQueryParam(wxCouponOrderBVo); |
|
|
|
PageInfo<WxCouponOrderBVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfAdmin(wxCouponOrderBVo)); |
|
|
|
|
|
|
|
PageInfo<WxCouponOrder> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfAdmin(wxCouponOrderBVo)); |
|
|
|
PageInfo<WxCouponOrderBVo> retPageInfo = new PageInfo<WxCouponOrderBVo>(); |
|
|
|
retPageInfo.setPageNum(pageIndex); |
|
|
|
retPageInfo.setPageSize(pageSize); |
|
|
|
retPageInfo.setPages(pageInfo.getPages()); |
|
|
|
if (null != pageInfo && null != pageInfo.getList()){ |
|
|
|
handleQueryResult(pageInfo.getList(), wxCouponOrderBVo); |
|
|
|
List<WxCouponOrderBVo> volist = handleQueryResult(pageInfo.getList(), wxCouponOrderBVo); |
|
|
|
retPageInfo.setList(volist); |
|
|
|
} |
|
|
|
return new ResultData(pageInfo); |
|
|
|
return new ResultData(retPageInfo); |
|
|
|
} |
|
|
|
|
|
|
|
private void handleQueryResult(List<WxCouponOrderBVo> list,TenantEntity tenantEntity) { |
|
|
|
private List<WxCouponOrderBVo> handleQueryResult(List<WxCouponOrder> list,TenantEntity tenantEntity) { |
|
|
|
if (null != list ) { |
|
|
|
|
|
|
|
WxMerchant merchantQ = new WxMerchant(); |
|
|
|
@@ -389,7 +600,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
List<Long> cUserIdList = new ArrayList<Long>(); |
|
|
|
List<Long> bUserIdList = new ArrayList<Long>(); |
|
|
|
for (int i = 0 ; i < list.size() ; i ++ ) { |
|
|
|
WxCouponOrderBVo bo = list.get(i); |
|
|
|
WxCouponOrder bo = list.get(i); |
|
|
|
Long cusrid = bo.getcUserId(); |
|
|
|
if (null != cusrid && (!cUserIdList.contains(cusrid))) { |
|
|
|
cUserIdList.add(cusrid); |
|
|
|
@@ -427,65 +638,69 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
List<WxCouponOrderBVo> retList = new ArrayList<WxCouponOrderBVo>(); |
|
|
|
|
|
|
|
for (int i = 0 ; i < list.size() ; i ++) { |
|
|
|
WxCouponOrderBVo co = list.get(i); |
|
|
|
if (co.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode())) { |
|
|
|
co.setUpdateDate(null); |
|
|
|
} |
|
|
|
if (null != co.getSendMerchantId()) { |
|
|
|
co.setSendMerchantName(merchantNameMap.get(co.getSendMerchantId())); |
|
|
|
} |
|
|
|
WxCoupon coupon = couponMap.get(co.getCouponId()); |
|
|
|
if (null != coupon) { |
|
|
|
co.setTitle(coupon.getTitle()); |
|
|
|
co.setSalePrice(coupon.getSalePrice()); |
|
|
|
co.setUsePrice(coupon.getUsePrice()); |
|
|
|
co.setPrice(coupon.getPrice()); |
|
|
|
co.setAutoRefund(coupon.getAutoRefund()); |
|
|
|
co.setBusiness(coupon.getBusiness()); |
|
|
|
co.setSubsidyType(coupon.getSubsidyType()); |
|
|
|
co.setSourceType(coupon.getSourceType()); |
|
|
|
} |
|
|
|
|
|
|
|
// WxMerchantSubsidy merchantSubsidyQ = new WxMerchantSubsidy(); |
|
|
|
// merchantSubsidyQ.setCouponOrderId(co.getId()); |
|
|
|
// merchantSubsidyQ.setCouponType(co.getCouponType()); |
|
|
|
// merchantSubsidyQ.setType(EnumMerchantSubsidyType.MANUAL.getCode()); |
|
|
|
// merchantSubsidyQ.updateTenantInfo(co); |
|
|
|
// List<WxMerchantSubsidy> msList = wxMerchantSubsidyMapper.selectList(new QueryWrapper<WxMerchantSubsidy>(merchantSubsidyQ)); |
|
|
|
// if (msList.size() > 0) { |
|
|
|
// co.setSubsidyNum(msList.get(0).getSubsidy()); |
|
|
|
// } |
|
|
|
co.setSubsidyNum(co.getSubsidy()); |
|
|
|
|
|
|
|
Long merchanId = merchantProductIdMap.get(co.getCouponId()); |
|
|
|
if (null != merchanId) { |
|
|
|
if (merchanId == -999L) { |
|
|
|
co.setMerchantName("多商户通用"); |
|
|
|
co.setMerchantId(0L); |
|
|
|
}else { |
|
|
|
co.setMerchantName(merchantNameMap.get(merchanId)); |
|
|
|
co.setMerchantId(merchanId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(co.getCUserId(), co.getFinalTenantId()); |
|
|
|
WxCUserBasicInfo basicInfo = cUserMap.get(co.getCUserId()); |
|
|
|
if (null != basicInfo) { |
|
|
|
co.setcuserPhone(basicInfo.getPhone()); |
|
|
|
co.setUserNickName(basicInfo.getNickName()); |
|
|
|
} |
|
|
|
|
|
|
|
//WxMerchantBUser buser = wxMerchantBUserService.getById(co.getBUserId()); |
|
|
|
Long buserMechantId = buserMerchantIdMap.get(co.getBUserId()); |
|
|
|
if (null != buserMechantId) { |
|
|
|
co.setVerifyMerchantName(merchantNameMap.get(buserMechantId)); |
|
|
|
} |
|
|
|
//co.setChannelType();) |
|
|
|
|
|
|
|
|
|
|
|
WxCouponOrder coo = list.get(i); |
|
|
|
WxCouponOrderBVo co = new WxCouponOrderBVo(); |
|
|
|
|
|
|
|
try { |
|
|
|
BeanUtils.copyProperties(co, coo); |
|
|
|
|
|
|
|
if (co.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode())) { |
|
|
|
co.setUpdateDate(null); |
|
|
|
} |
|
|
|
if (null != co.getSendMerchantId()) { |
|
|
|
co.setSendMerchantName(merchantNameMap.get(co.getSendMerchantId())); |
|
|
|
} |
|
|
|
WxCoupon coupon = couponMap.get(co.getCouponId()); |
|
|
|
if (null != coupon) { |
|
|
|
co.setTitle(coupon.getTitle()); |
|
|
|
co.setSalePrice(coupon.getSalePrice()); |
|
|
|
co.setUsePrice(coupon.getUsePrice()); |
|
|
|
co.setPrice(coupon.getPrice()); |
|
|
|
co.setAutoRefund(coupon.getAutoRefund()); |
|
|
|
co.setBusiness(coupon.getBusiness()); |
|
|
|
co.setSubsidyType(coupon.getSubsidyType()); |
|
|
|
co.setSourceType(coupon.getSourceType()); |
|
|
|
} |
|
|
|
|
|
|
|
co.setSubsidyNum(co.getSubsidy()); |
|
|
|
|
|
|
|
Long merchanId = merchantProductIdMap.get(co.getCouponId()); |
|
|
|
if (null != merchanId) { |
|
|
|
if (merchanId == -999L) { |
|
|
|
co.setMerchantName("多商户通用"); |
|
|
|
co.setMerchantId(0L); |
|
|
|
}else { |
|
|
|
co.setMerchantName(merchantNameMap.get(merchanId)); |
|
|
|
co.setMerchantId(merchanId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
WxCUserBasicInfo basicInfo = cUserMap.get(co.getCUserId()); |
|
|
|
if (null != basicInfo) { |
|
|
|
co.setcuserPhone(basicInfo.getPhone()); |
|
|
|
co.setUserNickName(basicInfo.getNickName()); |
|
|
|
} |
|
|
|
|
|
|
|
Long buserMechantId = buserMerchantIdMap.get(co.getBUserId()); |
|
|
|
if (null != buserMechantId) { |
|
|
|
co.setVerifyMerchantName(merchantNameMap.get(buserMechantId)); |
|
|
|
} |
|
|
|
//co.setChannelType();) |
|
|
|
|
|
|
|
retList.add(co); |
|
|
|
} catch (IllegalAccessException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} catch (InvocationTargetException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
return retList; |
|
|
|
} |
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@@ -576,7 +791,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
wxCouponOrder.setCUserId(basicInfo.getId()); |
|
|
|
}else { |
|
|
|
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"手机号查询不到会员信息。"); |
|
|
|
wxCouponOrder.setCUserId(-999L); |
|
|
|
wxCouponOrder.setId(-999L); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -588,9 +803,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
merchantProductIds = wxCouponMerchantMapper.findMerchantProductIds(wxCouponOrder.getTenantId(), merchantIdListQueryParam); |
|
|
|
if (null == merchantProductIds || merchantProductIds.size() <= 0) { |
|
|
|
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"商户下查询不到券信息。"); |
|
|
|
List<Long> tempCouponIds = new ArrayList<Long>(); |
|
|
|
tempCouponIds.add(-999L); |
|
|
|
wxCouponOrder.setCouponIds(tempCouponIds); |
|
|
|
wxCouponOrder.setId(-999L); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -608,9 +821,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
couponIds = wxCouponMapper.findIdList(wxCouponQuery); |
|
|
|
if (null == couponIds || couponIds.size() <= 0) { |
|
|
|
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"根据券条件搜索不到券信息。"); |
|
|
|
List<Long> tempCouponIds = new ArrayList<Long>(); |
|
|
|
tempCouponIds.add(-999L); |
|
|
|
wxCouponOrder.setCouponIds(tempCouponIds); |
|
|
|
wxCouponOrder.setId(-999L); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -637,9 +848,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
List<Long> merchantIds = wxMerchantMapper.findIdList(merchantQ2); |
|
|
|
if (null == merchantIds || merchantIds.size() <= 0 ){ |
|
|
|
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"核销商户名称查询不到商户记录."); |
|
|
|
List<Long> tempBUserIds = new ArrayList<Long>(); |
|
|
|
tempBUserIds.add(-999L); |
|
|
|
wxCouponOrder.setBUserIdList(tempBUserIds); |
|
|
|
wxCouponOrder.setId(-999L); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -648,9 +857,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
List<Long> bUserIdList = wxMerchantBUserMapper.findIdList(merchantBUserQ); |
|
|
|
if (null == bUserIdList || bUserIdList.size() <= 0 ){ |
|
|
|
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"核销商户下查询不到员工信息."); |
|
|
|
List<Long> tempBUserIds = new ArrayList<Long>(); |
|
|
|
tempBUserIds.add(-999L); |
|
|
|
wxCouponOrder.setBUserIdList(tempBUserIds); |
|
|
|
wxCouponOrder.setId(-999L); |
|
|
|
return; |
|
|
|
} |
|
|
|
wxCouponOrder.setBUserIdList(bUserIdList); |
|
|
|
@@ -662,10 +869,16 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
@Override |
|
|
|
public ResultData detailAdminVo(Long couponOrderId,TenantEntity tenantinfo) { |
|
|
|
|
|
|
|
WxCouponOrderBVo wxCouponOrderBVo = wxCouponOrderMapper.findDetailOfAdmin(couponOrderId,tenantinfo.getTenantId(),tenantinfo.getFinalTenantId()); |
|
|
|
if (wxCouponOrderBVo == null) |
|
|
|
WxCouponOrder couponOrder = wxCouponOrderMapper.findDetailOfAdmin(couponOrderId,tenantinfo.getTenantId(),tenantinfo.getFinalTenantId()); |
|
|
|
if (null == couponOrder) { |
|
|
|
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); |
|
|
|
} |
|
|
|
List<WxCouponOrder> couponOrderList = new ArrayList<WxCouponOrder>(); |
|
|
|
couponOrderList.add(couponOrder); |
|
|
|
List<WxCouponOrderBVo> wxCouponOrderBVoList = handleToCouponOrderBVoList(tenantinfo,couponOrderList); |
|
|
|
if (wxCouponOrderBVoList == null || wxCouponOrderBVoList.size() <= 0 ) |
|
|
|
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); |
|
|
|
return new ResultData(wxCouponOrderBVo); |
|
|
|
return new ResultData(wxCouponOrderBVoList.get(0)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@@ -675,9 +888,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
filename = "商品订单"; |
|
|
|
} |
|
|
|
handleWxCouponOrderBVoQueryParam(wxCouponOrder); |
|
|
|
List<WxCouponOrderBVo> list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder); |
|
|
|
handleQueryResult(list,wxCouponOrder); |
|
|
|
excelService.exportCsv(list, null, filename, WxCouponOrderBVo.class, filename + ".csv", response, false); |
|
|
|
List<WxCouponOrder> list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder); |
|
|
|
List<WxCouponOrderBVo> bolist = handleQueryResult(list,wxCouponOrder); |
|
|
|
excelService.exportCsv(bolist, null, filename, WxCouponOrderBVo.class, filename + ".csv", response, false); |
|
|
|
} |
|
|
|
|
|
|
|
private WxAppinfo getAppinfo(TenantEntity tenantEntity,Integer payWay) { |
|
|
|
|