Conflicts: mallinkSchedule/src/main/java/com/iformall/schedule/CouponOrderExpiringSchedule.javarelease_toaliyun_real
| @@ -9,14 +9,20 @@ import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.po.AliBusinessCircleOrder; | import com.iformall.domain.po.AliBusinessCircleOrder; | ||||
| import com.iformall.domain.po.WxBusinessCircleOrder; | import com.iformall.domain.po.WxBusinessCircleOrder; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponChannel; | |||||
| import com.iformall.domain.po.WxPressBatch; | import com.iformall.domain.po.WxPressBatch; | ||||
| import com.iformall.domain.po.WxPressBatchItem; | import com.iformall.domain.po.WxPressBatchItem; | ||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.EnumCouponChannelStatus; | |||||
| import com.iformall.enums.EnumCouponChannelType; | |||||
| import com.iformall.enums.EnumCouponContentType; | import com.iformall.enums.EnumCouponContentType; | ||||
| import com.iformall.enums.EnumCouponSourceType; | import com.iformall.enums.EnumCouponSourceType; | ||||
| import com.iformall.enums.EnumCouponType; | |||||
| import com.iformall.enums.EnumRentContractAppStatus; | import com.iformall.enums.EnumRentContractAppStatus; | ||||
| import com.iformall.service.AliBusinessCircleOrderService; | import com.iformall.service.AliBusinessCircleOrderService; | ||||
| import com.iformall.service.WxCouponChannelService; | |||||
| import com.iformall.service.WxCouponService; | |||||
| import com.iformall.service.WxPressBatchService; | import com.iformall.service.WxPressBatchService; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| @@ -36,6 +42,8 @@ import org.springframework.web.bind.annotation.RestController; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.ArrayList; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -46,7 +54,13 @@ public class WxPressBatchController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | @Autowired | ||||
| private WxPressBatchService wxPressBatchService; | |||||
| WxPressBatchService wxPressBatchService; | |||||
| @Autowired | |||||
| WxCouponService wxCouponService; | |||||
| @Autowired | |||||
| WxCouponChannelService wxCouponChannelService; | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @@ -84,16 +98,41 @@ public class WxPressBatchController extends BaseController { | |||||
| return new ResultData(order); | return new ResultData(order); | ||||
| } | } | ||||
| @ApiOperation("详情接口") | |||||
| @ApiOperation("砍价券接口") | |||||
| @GetMapping("itemList") | @GetMapping("itemList") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)}) | |||||
| public ResultData itemList(Long id) { | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData itemList(Long id, Integer pageNum, Integer pageSize) { | |||||
| if (null == id) { | if (null == id) { | ||||
| return new ResultData(Result.ERROR,"参数错误"); | return new ResultData(Result.ERROR,"参数错误"); | ||||
| } | } | ||||
| List<WxPressBatchItem> list = wxPressBatchService.getItemList(id, getTenantInfo().getTenantId()); | |||||
| return new ResultData(list); | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| PageInfo<WxPressBatchItem> itemPage = wxPressBatchService.getItemPage(id, tenantEntity.getTenantId(),pageNum,pageSize); | |||||
| List<WxPressBatchItem> items = itemPage.getList(); | |||||
| if (null != items && items.size() > 0 ) { | |||||
| List<Long> couponIdList = wxPressBatchService.getItemCouponIdList(id, tenantEntity.getTenantId()); | |||||
| WxCoupon record = new WxCoupon(); | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| if (null != couponIdList && couponIdList.size() > 0 ) { | |||||
| record.setIds(couponIdList); | |||||
| }else { | |||||
| record.setId(0L); | |||||
| } | |||||
| List<WxCoupon> list = wxCouponService.list(record); | |||||
| Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>(); | |||||
| if (null != list && list.size() > 0 ) { | |||||
| for (WxCoupon c : list) { | |||||
| couponMap.put(c.getId(), c); | |||||
| } | |||||
| } | |||||
| for (WxPressBatchItem pbi : items) { | |||||
| WxCoupon coupon = couponMap.get(pbi.getCouponId()); | |||||
| pbi.setCoupon(coupon); | |||||
| } | |||||
| } | |||||
| return new ResultData(itemPage); | |||||
| } | } | ||||
| @ApiOperation("删除接口") | @ApiOperation("删除接口") | ||||
| @@ -105,6 +144,31 @@ public class WxPressBatchController extends BaseController { | |||||
| wxPressBatchService.deleteBatch(record.getId(), getTenantInfo().getTenantId()); | wxPressBatchService.deleteBatch(record.getId(), getTenantInfo().getTenantId()); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("已投放砍价券列表接口") | |||||
| @GetMapping("couponList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true),}) | |||||
| public ResultData couponList(@ModelAttribute WxCoupon record, Integer pageNum, Integer pageSize) { | |||||
| WxCouponChannel couponChannelQ = new WxCouponChannel(); | |||||
| couponChannelQ.updateTenantInfo(getTenantInfo()); | |||||
| couponChannelQ.setType(EnumCouponType.COUPON_PRESS.getCode()); | |||||
| couponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_PRESS.getCode()); | |||||
| couponChannelQ.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||||
| List<Long> couponIds = wxCouponChannelService.findCouponIdList(couponChannelQ); | |||||
| if (null == record) { | |||||
| record = new WxCoupon(); | |||||
| } | |||||
| record.updateTenantInfo(couponChannelQ); | |||||
| if (null != couponIds && couponIds.size() > 0 ) { | |||||
| record.setIds(couponIds); | |||||
| }else { | |||||
| record.setId(0L); | |||||
| } | |||||
| PageInfo<WxCoupon> page = wxCouponService.simplelistAsPage(record, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("新增items") | @ApiOperation("新增items") | ||||
| @@ -120,8 +184,58 @@ public class WxPressBatchController extends BaseController { | |||||
| return new ResultData(Result.ERROR,"参数错误"); | return new ResultData(Result.ERROR,"参数错误"); | ||||
| } | } | ||||
| String[] cids = cidstr.split(","); | String[] cids = cidstr.split(","); | ||||
| WxPressBatch order = wxPressBatchService.getById(record.getId(), tenantEntity.getTenantId()); | |||||
| wxPressBatchService.saveItems(order, cids); | |||||
| if (null == cids || cids.length <= 0 ) { | |||||
| return new ResultData(Result.ERROR,"请选择砍价券"); | |||||
| } | |||||
| List<Long> rcids = new ArrayList<Long>(); | |||||
| for (String cid: cids) { | |||||
| rcids.add(Long.parseLong(cid)); | |||||
| } | |||||
| //已经存在了的不能再加入 | |||||
| List<Long> arrayCouponIds = wxPressBatchService.getCouponIds(tenantEntity.getTenantId()); | |||||
| if (null != arrayCouponIds && arrayCouponIds.size() > 0 ) { | |||||
| if (arrayCouponIds.containsAll(rcids)) { | |||||
| return new ResultData(Result.ERROR,"所选择的券已经加入了一个批次,不能再加"); | |||||
| } | |||||
| List<Long> extraCouponIds = new ArrayList<Long>(); | |||||
| extraCouponIds.addAll(rcids); | |||||
| extraCouponIds.removeAll(arrayCouponIds); | |||||
| List<Long> sameCouponIds = new ArrayList<Long>(); | |||||
| sameCouponIds.addAll(rcids); | |||||
| sameCouponIds.removeAll(extraCouponIds); | |||||
| if (sameCouponIds.size() > 0) { | |||||
| WxCoupon couponQ = new WxCoupon(); | |||||
| couponQ.updateTenantInfo(tenantEntity); | |||||
| couponQ.setIds(sameCouponIds); | |||||
| List<WxCoupon> couponList = wxCouponService.list(couponQ); | |||||
| if (null == couponList || couponList.size() <= 0 ) { | |||||
| return new ResultData(Result.ERROR,"未查询到这些券"); | |||||
| } | |||||
| Map<Long,String> couponNameMap = new HashMap<Long,String>(); | |||||
| for (WxCoupon c: couponList) { | |||||
| couponNameMap.put(c.getId(),c.getTitle()); | |||||
| } | |||||
| StringBuffer sb = new StringBuffer("已经存在一个批次的券:"); | |||||
| for (Long _cid: sameCouponIds) { | |||||
| sb.append(couponNameMap.get(_cid)).append(","); | |||||
| } | |||||
| return new ResultData(Result.ERROR,sb.toString()); | |||||
| } | |||||
| } | |||||
| List<Long> batchCids = wxPressBatchService.getItemCouponIdList(record.getId(), tenantEntity.getTenantId()); | |||||
| if (null != cids && cids.length > 0 ) { | |||||
| if (null != batchCids && batchCids.size() > 0 ) { | |||||
| rcids.removeAll(batchCids); | |||||
| } | |||||
| WxPressBatch order = wxPressBatchService.getById(record.getId(), tenantEntity.getTenantId()); | |||||
| wxPressBatchService.saveItems(order, rcids); | |||||
| } | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -155,7 +269,7 @@ public class WxPressBatchController extends BaseController { | |||||
| WxPressBatch record1 = wxPressBatchService.getById(record.getId(), getTenantInfo().getTenantId()); | WxPressBatch record1 = wxPressBatchService.getById(record.getId(), getTenantInfo().getTenantId()); | ||||
| record1.setPromoterLimitRule(record.getPromoterLimitRule()); | record1.setPromoterLimitRule(record.getPromoterLimitRule()); | ||||
| record1.setPromoterAllowCount(record.getPromoterAllowCount()); | record1.setPromoterAllowCount(record.getPromoterAllowCount()); | ||||
| record1.setBargainerAllowCount(record1.getBargainerAllowCount()); | |||||
| record1.setBargainerAllowCount(record.getBargainerAllowCount()); | |||||
| record1.setBargainerAllowSame(record.getBargainerAllowSame()); | record1.setBargainerAllowSame(record.getBargainerAllowSame()); | ||||
| wxPressBatchService.saveOrUpdate(record1); | wxPressBatchService.saveOrUpdate(record1); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -24,3 +24,208 @@ CREATE TABLE `wx_press_batch_item` ( | |||||
| `update_date` datetime DEFAULT NULL, | `update_date` datetime DEFAULT NULL, | ||||
| PRIMARY KEY (`id`) | PRIMARY KEY (`id`) | ||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; | ||||
| create table wx_press_batch_0 like wx_press_batch; | |||||
| create table wx_press_batch_1 like wx_press_batch; | |||||
| create table wx_press_batch_2 like wx_press_batch; | |||||
| create table wx_press_batch_3 like wx_press_batch; | |||||
| create table wx_press_batch_4 like wx_press_batch; | |||||
| create table wx_press_batch_5 like wx_press_batch; | |||||
| create table wx_press_batch_6 like wx_press_batch; | |||||
| create table wx_press_batch_7 like wx_press_batch; | |||||
| create table wx_press_batch_8 like wx_press_batch; | |||||
| create table wx_press_batch_9 like wx_press_batch; | |||||
| create table wx_press_batch_10 like wx_press_batch; | |||||
| create table wx_press_batch_11 like wx_press_batch; | |||||
| create table wx_press_batch_12 like wx_press_batch; | |||||
| create table wx_press_batch_13 like wx_press_batch; | |||||
| create table wx_press_batch_14 like wx_press_batch; | |||||
| create table wx_press_batch_15 like wx_press_batch; | |||||
| create table wx_press_batch_16 like wx_press_batch; | |||||
| create table wx_press_batch_17 like wx_press_batch; | |||||
| create table wx_press_batch_18 like wx_press_batch; | |||||
| create table wx_press_batch_19 like wx_press_batch; | |||||
| create table wx_press_batch_20 like wx_press_batch; | |||||
| create table wx_press_batch_21 like wx_press_batch; | |||||
| create table wx_press_batch_22 like wx_press_batch; | |||||
| create table wx_press_batch_23 like wx_press_batch; | |||||
| create table wx_press_batch_24 like wx_press_batch; | |||||
| create table wx_press_batch_25 like wx_press_batch; | |||||
| create table wx_press_batch_26 like wx_press_batch; | |||||
| create table wx_press_batch_27 like wx_press_batch; | |||||
| create table wx_press_batch_28 like wx_press_batch; | |||||
| create table wx_press_batch_29 like wx_press_batch; | |||||
| create table wx_press_batch_30 like wx_press_batch; | |||||
| create table wx_press_batch_31 like wx_press_batch; | |||||
| create table wx_press_batch_32 like wx_press_batch; | |||||
| create table wx_press_batch_33 like wx_press_batch; | |||||
| create table wx_press_batch_34 like wx_press_batch; | |||||
| create table wx_press_batch_35 like wx_press_batch; | |||||
| create table wx_press_batch_36 like wx_press_batch; | |||||
| create table wx_press_batch_37 like wx_press_batch; | |||||
| create table wx_press_batch_38 like wx_press_batch; | |||||
| create table wx_press_batch_39 like wx_press_batch; | |||||
| create table wx_press_batch_40 like wx_press_batch; | |||||
| create table wx_press_batch_41 like wx_press_batch; | |||||
| create table wx_press_batch_42 like wx_press_batch; | |||||
| create table wx_press_batch_43 like wx_press_batch; | |||||
| create table wx_press_batch_44 like wx_press_batch; | |||||
| create table wx_press_batch_45 like wx_press_batch; | |||||
| create table wx_press_batch_46 like wx_press_batch; | |||||
| create table wx_press_batch_47 like wx_press_batch; | |||||
| create table wx_press_batch_48 like wx_press_batch; | |||||
| create table wx_press_batch_49 like wx_press_batch; | |||||
| create table wx_press_batch_50 like wx_press_batch; | |||||
| create table wx_press_batch_51 like wx_press_batch; | |||||
| create table wx_press_batch_52 like wx_press_batch; | |||||
| create table wx_press_batch_53 like wx_press_batch; | |||||
| create table wx_press_batch_54 like wx_press_batch; | |||||
| create table wx_press_batch_55 like wx_press_batch; | |||||
| create table wx_press_batch_56 like wx_press_batch; | |||||
| create table wx_press_batch_57 like wx_press_batch; | |||||
| create table wx_press_batch_58 like wx_press_batch; | |||||
| create table wx_press_batch_59 like wx_press_batch; | |||||
| create table wx_press_batch_60 like wx_press_batch; | |||||
| create table wx_press_batch_61 like wx_press_batch; | |||||
| create table wx_press_batch_62 like wx_press_batch; | |||||
| create table wx_press_batch_63 like wx_press_batch; | |||||
| create table wx_press_batch_64 like wx_press_batch; | |||||
| create table wx_press_batch_65 like wx_press_batch; | |||||
| create table wx_press_batch_66 like wx_press_batch; | |||||
| create table wx_press_batch_67 like wx_press_batch; | |||||
| create table wx_press_batch_68 like wx_press_batch; | |||||
| create table wx_press_batch_69 like wx_press_batch; | |||||
| create table wx_press_batch_70 like wx_press_batch; | |||||
| create table wx_press_batch_71 like wx_press_batch; | |||||
| create table wx_press_batch_72 like wx_press_batch; | |||||
| create table wx_press_batch_73 like wx_press_batch; | |||||
| create table wx_press_batch_74 like wx_press_batch; | |||||
| create table wx_press_batch_75 like wx_press_batch; | |||||
| create table wx_press_batch_76 like wx_press_batch; | |||||
| create table wx_press_batch_77 like wx_press_batch; | |||||
| create table wx_press_batch_78 like wx_press_batch; | |||||
| create table wx_press_batch_79 like wx_press_batch; | |||||
| create table wx_press_batch_80 like wx_press_batch; | |||||
| create table wx_press_batch_81 like wx_press_batch; | |||||
| create table wx_press_batch_82 like wx_press_batch; | |||||
| create table wx_press_batch_83 like wx_press_batch; | |||||
| create table wx_press_batch_84 like wx_press_batch; | |||||
| create table wx_press_batch_85 like wx_press_batch; | |||||
| create table wx_press_batch_86 like wx_press_batch; | |||||
| create table wx_press_batch_87 like wx_press_batch; | |||||
| create table wx_press_batch_88 like wx_press_batch; | |||||
| create table wx_press_batch_89 like wx_press_batch; | |||||
| create table wx_press_batch_90 like wx_press_batch; | |||||
| create table wx_press_batch_91 like wx_press_batch; | |||||
| create table wx_press_batch_92 like wx_press_batch; | |||||
| create table wx_press_batch_93 like wx_press_batch; | |||||
| create table wx_press_batch_94 like wx_press_batch; | |||||
| create table wx_press_batch_95 like wx_press_batch; | |||||
| create table wx_press_batch_96 like wx_press_batch; | |||||
| create table wx_press_batch_97 like wx_press_batch; | |||||
| create table wx_press_batch_98 like wx_press_batch; | |||||
| create table wx_press_batch_99 like wx_press_batch; | |||||
| create table wx_press_batch_item_0 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_1 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_2 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_3 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_4 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_5 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_6 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_7 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_8 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_9 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_10 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_11 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_12 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_13 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_14 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_15 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_16 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_17 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_18 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_19 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_20 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_21 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_22 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_23 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_24 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_25 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_26 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_27 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_28 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_29 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_30 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_31 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_32 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_33 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_34 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_35 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_36 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_37 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_38 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_39 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_40 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_41 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_42 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_43 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_44 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_45 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_46 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_47 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_48 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_49 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_50 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_51 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_52 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_53 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_54 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_55 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_56 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_57 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_58 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_59 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_60 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_61 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_62 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_63 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_64 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_65 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_66 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_67 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_68 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_69 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_70 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_71 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_72 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_73 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_74 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_75 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_76 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_77 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_78 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_79 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_80 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_81 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_82 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_83 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_84 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_85 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_86 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_87 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_88 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_89 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_90 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_91 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_92 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_93 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_94 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_95 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_96 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_97 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_98 like wx_press_batch_item; | |||||
| create table wx_press_batch_item_99 like wx_press_batch_item; | |||||
| drop table wx_press_batch; | |||||
| drop table wx_press_batch_item; | |||||
| @@ -175,6 +175,7 @@ public class WxPressOrderController extends BaseController { | |||||
| //验证砍价批次规则 | //验证砍价批次规则 | ||||
| ResultData result = wxPressBatchService.checkBargainerPressBatchRule(order, memberId); | ResultData result = wxPressBatchService.checkBargainerPressBatchRule(order, memberId); | ||||
| if (Result.SUCCESS != result.code) { | if (Result.SUCCESS != result.code) { | ||||
| redisLock.unlock(orderIdStr, timeStr); | |||||
| return result; | return result; | ||||
| } | } | ||||
| try { | try { | ||||
| @@ -302,6 +302,20 @@ public class BaseMyBatisConfiguration { | |||||
| wxComposeOrderSharding.setRule(EnumShardingRule.HASH.getCode()); | wxComposeOrderSharding.setRule(EnumShardingRule.HASH.getCode()); | ||||
| shardingList.add(wxComposeOrderSharding); | shardingList.add(wxComposeOrderSharding); | ||||
| ShardingSphere wxPressBatchSharding = new ShardingSphere(); | |||||
| wxPressBatchSharding.setColumn("tenant_id"); | |||||
| wxPressBatchSharding.setTableName("wx_press_batch"); | |||||
| wxPressBatchSharding.setCount(100); | |||||
| wxPressBatchSharding.setRule(EnumShardingRule.HASH.getCode()); | |||||
| shardingList.add(wxPressBatchSharding); | |||||
| ShardingSphere wxPressBatchItemSharding = new ShardingSphere(); | |||||
| wxPressBatchItemSharding.setColumn("tenant_id"); | |||||
| wxPressBatchItemSharding.setTableName("wx_press_batch_item"); | |||||
| wxPressBatchItemSharding.setCount(100); | |||||
| wxPressBatchItemSharding.setRule(EnumShardingRule.HASH.getCode()); | |||||
| shardingList.add(wxPressBatchItemSharding); | |||||
| //初始化 | //初始化 | ||||
| shardingSpherePlugin.setShardingSpheres(shardingList); | shardingSpherePlugin.setShardingSpheres(shardingList); | ||||
| Properties properties = new Properties(); | Properties properties = new Properties(); | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| @@ -27,4 +28,7 @@ public class WxPressBatchItem extends TenantEntity { | |||||
| private Date createDate; | private Date createDate; | ||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | ||||
| private Date updateDate; | private Date updateDate; | ||||
| @TableField(exist = false) | |||||
| private WxCoupon coupon; | |||||
| } | } | ||||
| @@ -13,6 +13,8 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str | |||||
| WxCouponChannel selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | WxCouponChannel selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | ||||
| List<WxCouponChannel> findList(WxCouponChannel wxCouponChannel); | List<WxCouponChannel> findList(WxCouponChannel wxCouponChannel); | ||||
| List<Long> findCouponIdList(WxCouponChannel wxCouponChannel); | |||||
| int countCoupon(WxCouponChannel wxCouponChannel); | int countCoupon(WxCouponChannel wxCouponChannel); | ||||
| @@ -13,5 +13,6 @@ public interface WxOrderPressMapper extends CommonMapper<WxOrderPress, Long> { | |||||
| WxOrderPress selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | WxOrderPress selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | ||||
| List<WxOrderPress> findList(WxOrderPress wxOrderPress); | List<WxOrderPress> findList(WxOrderPress wxOrderPress); | ||||
| List<WxOrderPress> findPressList(Map paramMap); | List<WxOrderPress> findPressList(Map paramMap); | ||||
| Integer findCount(WxOrderPress wxOrderPress); | |||||
| } | } | ||||
| @@ -26,6 +26,7 @@ public interface WxCouponChannelService { | |||||
| */ | */ | ||||
| PageInfo<WxCouponChannel> listAsPage(WxCouponChannel record, Integer pageIndex, Integer pageSize); | PageInfo<WxCouponChannel> listAsPage(WxCouponChannel record, Integer pageIndex, Integer pageSize); | ||||
| List<WxCouponChannel> findList(WxCouponChannel record); | List<WxCouponChannel> findList(WxCouponChannel record); | ||||
| List<Long> findCouponIdList(WxCouponChannel record); | |||||
| WxCouponCVo findDetailVo(Long id,String tenantId,boolean hasMerchant); | WxCouponCVo findDetailVo(Long id,String tenantId,boolean hasMerchant); | ||||
| @@ -31,6 +31,8 @@ public interface WxCouponService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize); | PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize); | ||||
| PageInfo<WxCoupon> simplelistAsPage(WxCoupon record, Integer pageIndex, Integer pageSize); | |||||
| /** | /** | ||||
| * 卡类列表,包括统计 | * 卡类列表,包括统计 | ||||
| @@ -39,9 +39,12 @@ public interface WxPressBatchService { | |||||
| WxPressBatch getById(Long id,String tenantId); | WxPressBatch getById(Long id,String tenantId); | ||||
| PageInfo<WxPressBatchItem> getItemPage(Long batchId,String tenantId, Integer pageIndex, Integer pageSize); | |||||
| List<WxPressBatchItem> getItemList(Long batchId,String tenantId); | List<WxPressBatchItem> getItemList(Long batchId,String tenantId); | ||||
| List<Long> getItemCouponIdList(Long batchId,String tenantId); | |||||
| List<Long> getCouponIds(String tenantId); | |||||
| void saveItems(WxPressBatch pressBatch,String[] couponIds); | |||||
| void saveItems(WxPressBatch pressBatch,List<Long> couponIds); | |||||
| void deleteBatch(Long id,String tenantId); | void deleteBatch(Long id,String tenantId); | ||||
| void deleteItemById(Long itemId,String tenantId); | void deleteItemById(Long itemId,String tenantId); | ||||
| @@ -61,6 +61,7 @@ public class WxBUserServiceAdapter extends BasicCUserService implements CUserSer | |||||
| if (null == appInfo) { | if (null == appInfo) { | ||||
| throw new MallinkException(ErrorCode.USER_APPINFO_NOT_EXIST.getCode(), "当前token查询不到APP"); | throw new MallinkException(ErrorCode.USER_APPINFO_NOT_EXIST.getCode(), "当前token查询不到APP"); | ||||
| } | } | ||||
| entity.setAppinfo(appInfo); | |||||
| entity.setRealUser(wxBuser); | entity.setRealUser(wxBuser); | ||||
| return entity; | return entity; | ||||
| } | } | ||||
| @@ -113,6 +113,11 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| return wxCouponChannelMapper.findList(record); | return wxCouponChannelMapper.findList(record); | ||||
| } | } | ||||
| @Override | |||||
| public List<Long> findCouponIdList(WxCouponChannel record) { | |||||
| return wxCouponChannelMapper.findCouponIdList(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public WxCouponChannel getById(Long id,String tenantId) { | public WxCouponChannel getById(Long id,String tenantId) { | ||||
| return wxCouponChannelMapper.selectById(id,tenantId); | return wxCouponChannelMapper.selectById(id,tenantId); | ||||
| @@ -210,6 +210,11 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| public List<WxCoupon> list(WxCoupon wxCoupon){ | public List<WxCoupon> list(WxCoupon wxCoupon){ | ||||
| return wxCouponMapper.findList(wxCoupon); | return wxCouponMapper.findList(wxCoupon); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxCoupon> simplelistAsPage(WxCoupon record, Integer pageNum, Integer pageSize) { | |||||
| return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.findList(record)); | |||||
| } | |||||
| @Override | @Override | ||||
| public PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -674,20 +679,24 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); | PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); | ||||
| List<Long> merchantIds = new ArrayList<>(); | |||||
| for (JSONObject o:merchantParamList) { | |||||
| merchantIds.add(o.getLong("id")); | |||||
| } | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.updateTenantInfo(record); | |||||
| merchantQ.setIds(merchantIds); | |||||
| Map<Long, String> idAndNamesMap = wxMerchantService.getIdAndNamesMap(merchantQ); | |||||
| if (EnumPayMchType.DIRECT.equals(payMchType)) { | if (EnumPayMchType.DIRECT.equals(payMchType)) { | ||||
| Long merchantId = null; | Long merchantId = null; | ||||
| if (merchantParamList.size() > 1) { | |||||
| List<Long> merchantIds = new ArrayList<>(); | |||||
| for (JSONObject o:merchantParamList) { | |||||
| merchantIds.add(o.getLong("id")); | |||||
| } | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.updateTenantInfo(record); | |||||
| merchantQ.setIds(merchantIds); | |||||
| merchantQ.setIsAdmin(EnumYesOrNo.YES.getCode()); | |||||
| merchantQ.setStatus(EnumMerchantStatus.VALID.getCode()); | |||||
| List<Long> list = wxMerchantMapper.findIdList(merchantQ); | |||||
| if (merchantIds.size() > 1) { | |||||
| WxMerchant merchantQ2 = new WxMerchant(); | |||||
| merchantQ2.updateTenantInfo(record); | |||||
| merchantQ2.setIds(merchantIds); | |||||
| merchantQ2.setIsAdmin(EnumYesOrNo.YES.getCode()); | |||||
| merchantQ2.setStatus(EnumMerchantStatus.VALID.getCode()); | |||||
| List<Long> list = wxMerchantMapper.findIdList(merchantQ2); | |||||
| if(list == null || list.isEmpty()){ | if(list == null || list.isEmpty()){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "直连模式多门店券需包含一个商管商户"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "直连模式多门店券需包含一个商管商户"); | ||||
| }else if(list.size() > 1){ | }else if(list.size() > 1){ | ||||
| @@ -697,28 +706,28 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| merchantId = list.get(0); | merchantId = list.get(0); | ||||
| }else{ | }else{ | ||||
| record.setMerchantType(EnumCouponMerchantType.ONE_MERCHANT.getCode()); | record.setMerchantType(EnumCouponMerchantType.ONE_MERCHANT.getCode()); | ||||
| merchantId = merchantParamList.get(0).getLong("id"); | |||||
| merchantId = merchantIds.get(0); | |||||
| } | } | ||||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchantId, null, payMchTypeEnum.getCode()); | WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchantId, null, payMchTypeEnum.getCode()); | ||||
| if (receiver == null) { | if (receiver == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "对应门店至少进件一种支付模式"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未配置收款账户"); | |||||
| } | } | ||||
| if (EnumAppPlat.TOUTIAO.equals(plat)) { | if (EnumAppPlat.TOUTIAO.equals(plat)) { | ||||
| if (!MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus()) | if (!MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus()) | ||||
| && !MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus()) | && !MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus()) | ||||
| && !MerchantImportStatus.improt_success.getCode().equals(receiver.getHzImportStatus())) { | && !MerchantImportStatus.improt_success.getCode().equals(receiver.getHzImportStatus())) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "对应门店至少进件一种支付模式"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未配置收款账户"); | |||||
| } | } | ||||
| } | } | ||||
| } else if (EnumPayShare.YES.equals(isShare)) { | } else if (EnumPayShare.YES.equals(isShare)) { | ||||
| for (int i = 0, size = merchantParamList.size(); i < size; i++) { | |||||
| JSONObject jsonObject = merchantParamList.get(i); | |||||
| Long merchantId = jsonObject.getLong("id"); | |||||
| List<String> merchantNames = new ArrayList(); | |||||
| for (Long merchantId:merchantIds) { | |||||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchantId, null, payMchTypeEnum.getCode()); | WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchantId, null, payMchTypeEnum.getCode()); | ||||
| int n = i + 1; | |||||
| if (receiver == null) { | if (receiver == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户还未配置分账账户或未进件"); | |||||
| merchantNames.add(idAndNamesMap.get(merchantId)); | |||||
| continue; | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户还未配置分账账户或未进件"); | |||||
| } | } | ||||
| if (EnumAppPlat.TOUTIAO.equals(plat)) { | if (EnumAppPlat.TOUTIAO.equals(plat)) { | ||||
| QueryMerchantResult openPayResult = payAccount.getOpenPayResult(); | QueryMerchantResult openPayResult = payAccount.getOpenPayResult(); | ||||
| @@ -729,18 +738,27 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| if(EnumYesOrNo.YES.getCode().equals(openPayResult.getAlipay()) | if(EnumYesOrNo.YES.getCode().equals(openPayResult.getAlipay()) | ||||
| && !MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus())){ | && !MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus())){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户未进件支付宝"); | |||||
| merchantNames.add(idAndNamesMap.get(merchantId)); | |||||
| continue; | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未进件支付宝"); | |||||
| } | } | ||||
| if(EnumYesOrNo.YES.getCode().equals(openPayResult.getWx()) | if(EnumYesOrNo.YES.getCode().equals(openPayResult.getWx()) | ||||
| && !MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus())){ | && !MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus())){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户未进件微信"); | |||||
| merchantNames.add(idAndNamesMap.get(merchantId)); | |||||
| continue; | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未进件微信"); | |||||
| } | } | ||||
| if(EnumYesOrNo.YES.getCode().equals(openPayResult.getHz()) | if(EnumYesOrNo.YES.getCode().equals(openPayResult.getHz()) | ||||
| && !MerchantImportStatus.improt_success.getCode().equals(receiver.getHzImportStatus())){ | && !MerchantImportStatus.improt_success.getCode().equals(receiver.getHzImportStatus())){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户未进件抖音"); | |||||
| merchantNames.add(idAndNamesMap.get(merchantId)); | |||||
| continue; | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未进件抖音"); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if(!merchantNames.isEmpty()){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), JSONArray.toJSONString(merchantNames)+"未配置分账账户"); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -778,15 +778,32 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| if (null != checkPressResult) { | if (null != checkPressResult) { | ||||
| WxPressBatch pressBatch = checkPressResult.getPressBatch(); | WxPressBatch pressBatch = checkPressResult.getPressBatch(); | ||||
| List<Long> cids = checkPressResult.getCouponIdList(); | List<Long> cids = checkPressResult.getCouponIdList(); | ||||
| couponOrderQ.setCouponIds(cids); | |||||
| if (pressBatch.getPromoterLimitRule().equals(EnumCouponUseLimitRule.TOBEUSED_USELIMIT.getCode())) { | |||||
| couponOrderQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | |||||
| } | |||||
| int _count = wxCouponOrderMapper.findProductCount(couponOrderQ)+couponNumber; | |||||
| if (_count > pressBatch.getPromoterAllowCount()) { | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"当前用户已达砍价["+counpon.getTitle()+"]所在批次活动发起次数上限."); | |||||
| if (null != cids && cids.size() > 0 ) { | |||||
| couponOrderQ.setCouponIds(cids); | |||||
| //判断这些券发起中+已完成的 | |||||
| WxOrder orderq = new WxOrder(); | |||||
| orderq.updateTenantInfo(counpon); | |||||
| orderq.setCouponIds(cids); | |||||
| orderq.setCUserId(user.getId()); | |||||
| //if (pressBatch.getPromoterLimitRule().equals(EnumCouponUseLimitRule.TOBEUSED_USELIMIT.getCode())) { | |||||
| List<Integer> statusS = new ArrayList<Integer>(); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PRESSING.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PRESS_COMPLETE.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_REFUND.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_REFUND_SUCCESS.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_REFUND_FAILD.getCode()); | |||||
| orderq.setStatusS(statusS); | |||||
| //} | |||||
| int _count = wxOrderMapper.countCouponConditionType1(orderq); | |||||
| if (_count >= pressBatch.getPromoterAllowCount()) { | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"当前用户发起砍价次数已超限.["+pressBatch.getName()+"]"); | |||||
| } | |||||
| return _count; | |||||
| }else { | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"砍价批次["+pressBatch.getName()+"]未设置券."); | |||||
| } | } | ||||
| return _count; | |||||
| }else { | }else { | ||||
| if (counpon.getUseLimitRule().equals(EnumCouponUseLimitRule.TOBEUSED_USELIMIT.getCode())) { | if (counpon.getUseLimitRule().equals(EnumCouponUseLimitRule.TOBEUSED_USELIMIT.getCode())) { | ||||
| couponOrderQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | couponOrderQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | ||||
| @@ -800,7 +817,9 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| couponOrderQ.setCouponId(counpon.getId()); | couponOrderQ.setCouponId(counpon.getId()); | ||||
| } | } | ||||
| return wxCouponOrderMapper.findProductCount(couponOrderQ)+couponNumber; | return wxCouponOrderMapper.findProductCount(couponOrderQ)+couponNumber; | ||||
| } catch (Exception e) { | |||||
| } catch(MallinkException e1) { | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),e1.getMessage()); | |||||
| }catch (Exception e) { | |||||
| logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage(),e); | logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage(),e); | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"["+counpon.getTitle()+"]查询待使用订单错误."+e.getMessage()); | throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"["+counpon.getTitle()+"]查询待使用订单错误."+e.getMessage()); | ||||
| } | } | ||||
| @@ -1004,7 +1023,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| try { | try { | ||||
| grouponCount = getUserOrderGroupCount(user, coupon); | grouponCount = getUserOrderGroupCount(user, coupon); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(),"["+coupon.getTitle()+"]查询拼团中订单错误."); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(),"["+coupon.getTitle()+"]"+e.getMessage()); | |||||
| } | } | ||||
| if (grouponCount >= coupon.getUseLimitQuantity()) { | if (grouponCount >= coupon.getUseLimitQuantity()) { | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_LIMITED.getCode(),"["+coupon.getTitle()+"]购买超限."); | throw new MallinkException(ErrorCode.ORDER_IS_LIMITED.getCode(),"["+coupon.getTitle()+"]购买超限."); | ||||
| @@ -1014,7 +1033,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| try { | try { | ||||
| paidCount = getUserCouponOrderCount(user, coupon,number,isPressOrder); | paidCount = getUserCouponOrderCount(user, coupon,number,isPressOrder); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(),"["+coupon.getTitle()+"]查询待使用订单错误."+e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(),e.getMessage()); | |||||
| } | } | ||||
| if (paidCount > coupon.getUseLimitQuantity()) { | if (paidCount > coupon.getUseLimitQuantity()) { | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_LIMITED.getCode(),"此券购买数量已超限["+coupon.getTitle()+"], couponId: " + coupon.getId() + ", count: " + paidCount); | throw new MallinkException(ErrorCode.ORDER_IS_LIMITED.getCode(),"此券购买数量已超限["+coupon.getTitle()+"], couponId: " + coupon.getId() + ", count: " + paidCount); | ||||
| @@ -86,6 +86,14 @@ public class WxPressBatchServiceImpl implements WxPressBatchService { | |||||
| return wxPressBatchMapper.getById(id, tenantId); | return wxPressBatchMapper.getById(id, tenantId); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxPressBatchItem> getItemPage(Long batchId,String tenantId, Integer pageIndex, Integer pageSize) { | |||||
| WxPressBatchItem iteq = new WxPressBatchItem(); | |||||
| iteq.setTenantId(tenantId); | |||||
| iteq.setPressBatchId(batchId); | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxPressBatchItemMapper.findList(iteq)); | |||||
| } | |||||
| @Override | @Override | ||||
| public List<WxPressBatchItem> getItemList(Long batchId, String tenantId) { | public List<WxPressBatchItem> getItemList(Long batchId, String tenantId) { | ||||
| WxPressBatchItem iteq = new WxPressBatchItem(); | WxPressBatchItem iteq = new WxPressBatchItem(); | ||||
| @@ -94,14 +102,29 @@ public class WxPressBatchServiceImpl implements WxPressBatchService { | |||||
| return wxPressBatchItemMapper.findList(iteq); | return wxPressBatchItemMapper.findList(iteq); | ||||
| } | } | ||||
| @Override | |||||
| public List<Long> getItemCouponIdList(Long batchId, String tenantId) { | |||||
| WxPressBatchItem iteq = new WxPressBatchItem(); | |||||
| iteq.setTenantId(tenantId); | |||||
| iteq.setPressBatchId(batchId); | |||||
| return wxPressBatchItemMapper.getCouponIds(batchId, tenantId, null); | |||||
| } | |||||
| @Override | |||||
| public List<Long> getCouponIds(String tenantId) { | |||||
| WxPressBatchItem iteq = new WxPressBatchItem(); | |||||
| iteq.setTenantId(tenantId); | |||||
| return wxPressBatchItemMapper.getCouponIds(null, tenantId, null); | |||||
| } | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public void saveItems(WxPressBatch pressBatch, String[] couponIds) { | |||||
| for (String cid : couponIds) { | |||||
| public void saveItems(WxPressBatch pressBatch, List<Long> couponIds) { | |||||
| for (Long cid : couponIds) { | |||||
| WxPressBatchItem iteq = new WxPressBatchItem(); | WxPressBatchItem iteq = new WxPressBatchItem(); | ||||
| iteq.updateTenantInfo(pressBatch); | iteq.updateTenantInfo(pressBatch); | ||||
| iteq.setPressBatchId(pressBatch.getId()); | iteq.setPressBatchId(pressBatch.getId()); | ||||
| iteq.setCouponId(Long.parseLong(cid)); | |||||
| iteq.setCouponId(cid); | |||||
| iteq.setPressBatchStatus(pressBatch.getStatus()); | iteq.setPressBatchStatus(pressBatch.getStatus()); | ||||
| iteq.setCreateDate(new Date()); | iteq.setCreateDate(new Date()); | ||||
| iteq.setUpdateDate(new Date()); | iteq.setUpdateDate(new Date()); | ||||
| @@ -170,7 +193,7 @@ public class WxPressBatchServiceImpl implements WxPressBatchService { | |||||
| orderPressQ1.setCouponId(order.getProductId()); | orderPressQ1.setCouponId(order.getProductId()); | ||||
| int count1 = wxOrderPressMapper.selectCount(new QueryWrapper<>(orderPressQ1)); | int count1 = wxOrderPressMapper.selectCount(new QueryWrapper<>(orderPressQ1)); | ||||
| if(count1 >= 1) { | if(count1 >= 1) { | ||||
| return new ResultData(Result.ERROR,"当前用户砍已砍过相同商品,"); | |||||
| return new ResultData(Result.ERROR,"当前用户已砍过相同商品"); | |||||
| } | } | ||||
| } | } | ||||
| //查询当前用户参与这些券的砍价次数 | //查询当前用户参与这些券的砍价次数 | ||||
| @@ -178,9 +201,9 @@ public class WxPressBatchServiceImpl implements WxPressBatchService { | |||||
| orderPressQ.setTenantId(order.getTenantId()); | orderPressQ.setTenantId(order.getTenantId()); | ||||
| orderPressQ.setUserId(cUserId); | orderPressQ.setUserId(cUserId); | ||||
| orderPressQ.setCouponIds(batchCouponIds); | orderPressQ.setCouponIds(batchCouponIds); | ||||
| int count = wxOrderPressMapper.selectCount(new QueryWrapper<>(orderPressQ)); | |||||
| int count = wxOrderPressMapper.findCount(orderPressQ); | |||||
| if(count >= pressBatch.getBargainerAllowCount().intValue()) { | if(count >= pressBatch.getBargainerAllowCount().intValue()) { | ||||
| return new ResultData(Result.ERROR,"当前用户砍价次数已达批次活动设定上限,"); | |||||
| return new ResultData(Result.ERROR,"当前用户帮砍次数已达批次活动设定上限["+pressBatch.getName()+"]"); | |||||
| } else { | } else { | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -143,6 +143,11 @@ | |||||
| select <include refid="allColumns" /> from wx_coupon_channel cc | select <include refid="allColumns" /> from wx_coupon_channel cc | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findCouponIdList" parameterType="com.iformall.domain.po.WxCouponChannel" resultType="Long"> | |||||
| select distinct coupon_id from wx_coupon_channel cc | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <update id="updateStatusByCouponId" parameterType="com.iformall.domain.po.WxCouponChannel"> | <update id="updateStatusByCouponId" parameterType="com.iformall.domain.po.WxCouponChannel"> | ||||
| update wx_coupon_channel | update wx_coupon_channel | ||||
| @@ -67,4 +67,9 @@ | |||||
| where op.`order_id` = #{orderId} and op.tenant_id = #{tenantId} | where op.`order_id` = #{orderId} and op.tenant_id = #{tenantId} | ||||
| order by op.`create_date` desc | order by op.`create_date` desc | ||||
| </select> | </select> | ||||
| <select id="findCount" parameterType="com.iformall.domain.po.WxOrderPress" resultType="Integer"> | |||||
| select count(1) from wx_order_press | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -83,7 +83,7 @@ | |||||
| </update> | </update> | ||||
| <delete id= "deleteItem" parameterType="com.iformall.domain.po.WxPressBatchItem" > | <delete id= "deleteItem" parameterType="com.iformall.domain.po.WxPressBatchItem" > | ||||
| delete from wx_press_batch_item where `id` = #{id} and tenant_id=#{tenantId} and `press_batch_id` = #{pressBatchId} | |||||
| delete from wx_press_batch_item where `id` = #{id} and tenant_id=#{tenantId} | |||||
| </delete> | </delete> | ||||
| <delete id= "deleteAllItem" parameterType="com.iformall.domain.po.WxPressBatchItem" > | <delete id= "deleteAllItem" parameterType="com.iformall.domain.po.WxPressBatchItem" > | ||||
| @@ -91,7 +91,10 @@ | |||||
| </delete> | </delete> | ||||
| <select id="getCouponIds" parameterType="java.util.HashMap" resultType="Long"> | <select id="getCouponIds" parameterType="java.util.HashMap" resultType="Long"> | ||||
| select coupon_id from wx_press_batch_item where `press_batch_id` = #{pressBatchId} and tenant_id=#{tenantId} | |||||
| select coupon_id from wx_press_batch_item where tenant_id=#{tenantId} | |||||
| <if test=" null != pressBatchId"> | |||||
| and `press_batch_id` = #{pressBatchId} | |||||
| </if> | |||||
| <if test=" null != pressBatchStatus"> | <if test=" null != pressBatchStatus"> | ||||
| and `press_batch_status` = #{pressBatchStatus} | and `press_batch_status` = #{pressBatchStatus} | ||||
| </if> | </if> | ||||
| @@ -35,6 +35,10 @@ | |||||
| and `status` = #{status} | and `status` = #{status} | ||||
| </if> | </if> | ||||
| <if test=" null != name and '' != name"> | |||||
| and `name` like concat('%', #{name},'%') | |||||
| </if> | |||||
| <if test=" null != promoterLimitRule"> | <if test=" null != promoterLimitRule"> | ||||
| and `promoter_limit_rule` = #{promoterLimitRule} | and `promoter_limit_rule` = #{promoterLimitRule} | ||||
| </if> | </if> | ||||