From c1e80b36e1870cca4a05ff7cf9996e7775e76881 Mon Sep 17 00:00:00 2001 From: xhxu Date: Fri, 4 Sep 2020 23:11:46 +0800 Subject: [PATCH 1/4] update --- .../V202009041200__commercialPreferential.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql diff --git a/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql b/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql new file mode 100644 index 000000000..1cc44f56e --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql @@ -0,0 +1,12 @@ +INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (646, '商户建券  ', 602, 'Y', NULL, 1, NULL, NULL, 'commercialPreferential', NULL, 0, 646); + +update mall_sale_type set menus = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 201, 202, 203, 204, 205, 206, 211, 212, 221, 222, 251, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 686, 691, 692, 693, 694, 695, 701, 702, 703, 711, 712, 713, 901, 902, 903, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004]' where id=1; +update mall_sale_type set menus = '[1, 2, 4, 5, 6, 7, 8, 9, 10, 50, 101, 102, 103, 104, 105, 106, 107, 201, 202, 203, 204, 205, 211, 212, 221, 222, 251, 409, 410, 411, 416, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 686, 691, 692, 693, 694, 695, 701, 702, 703, 711, 712, 713, 901, 902, 903, 931, 932, 951, 961]' where id=2; +update mall_sale_type set menus = '[2, 4, 5, 6, 7, 10, 50, 201, 202, 205, 211, 212, 221, 222, 251, 409, 410, 411, 416, 501, 502, 503, 504, 505, 506, 507, 508, 511, 512, 513, 521, 522, 523, 531, 532, 533, 591, 592, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 621, 622, 623, 624, 625, 626, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 686, 691, 692, 693, 694, 695, 701, 702, 703, 711, 712, 713, 901, 902, 903, 931, 932]' where id=3; + + + + + +ALTER TABLE `wx_c_user_basic_info` +MODIFY COLUMN `tenant_id` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '租户ID' AFTER `id`; \ No newline at end of file From 9c9c55476d50d41e968e5ac3daa80b96c2642797 Mon Sep 17 00:00:00 2001 From: xhxu Date: Mon, 7 Sep 2020 12:26:43 +0800 Subject: [PATCH 2/4] update --- .../controller/market/WxCouponController.java | 14 +++++++ .../V202009041200__commercialPreferential.sql | 7 +++- .../java/com/iformall/domain/po/WxCoupon.java | 3 ++ .../iformall/enums/EnumCouponSourceType.java | 37 +++++++++++++++++++ .../main/resources/mapper/WxCouponMapper.xml | 14 ++++++- 5 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 mallinkService/src/main/java/com/iformall/enums/EnumCouponSourceType.java diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java index 7bab67d11..886abfbd2 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java @@ -65,6 +65,9 @@ public class WxCouponController extends BaseController { }else{ wxCoupon.updateTenantInfo(getTenantInfo()); } + if(null == wxCoupon.getSourceType()){ + wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode()); + } return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表 } @@ -99,6 +102,10 @@ public class WxCouponController extends BaseController { TenantEntity tenantEntity = getTenantInfo(); wxCoupon.updateTenantInfo(tenantEntity); + if(null == wxCoupon.getSourceType()){ + wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode()); + } + ResultData resultData = wxCouponService.saveOrUpdate(wxCoupon); if (resultData.code != 200) { return resultData; @@ -122,6 +129,9 @@ public class WxCouponController extends BaseController { if (wxCoupon.getId() == null) { return new ResultData(ResultData.ERROR, "缺少id"); } + if(null == wxCoupon.getSourceType()){ + wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode()); + } wxCoupon.updateTenantInfo(getTenantInfo()); if(EnumDelFlag.YES.getCode().equals(wxCoupon.getIsDel())){ WxCouponChannel query = new WxCouponChannel(); @@ -304,6 +314,7 @@ public class WxCouponController extends BaseController { if (wxCoupon.getEnddate() == null) { wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59")); } + wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode()); PageInfo pageInfo = wxCouponService.findCountData(wxCoupon, pageNum, pageSize); for (WxCouponStatisVo coupon : pageInfo.getList()) { if (coupon.getSaleAmount() == null) { @@ -336,6 +347,8 @@ public class WxCouponController extends BaseController { wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59")); } + wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode()); + PageInfo pageInfo = wxCouponService.findCouponData(wxCoupon, pageNum, pageSize); for (WxCouponStatisVo coupon : pageInfo.getList()) { if (coupon.getSumSubsidy() == null) { @@ -357,6 +370,7 @@ public class WxCouponController extends BaseController { public ResultData findPressCountList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { Map result = new HashedMap(); wxCoupon.updateTenantInfo(getTenantInfo()); + wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode()); PageInfo pages = wxCouponService.findPressData(wxCoupon,pageNum,pageSize); return new ResultData(pages); } diff --git a/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql b/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql index 1cc44f56e..3d37497e9 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql @@ -9,4 +9,9 @@ update mall_sale_type set menus = '[2, 4, 5, 6, 7, 10, 50, 201, 202, 205, 211, 2 ALTER TABLE `wx_c_user_basic_info` -MODIFY COLUMN `tenant_id` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '租户ID' AFTER `id`; \ No newline at end of file +MODIFY COLUMN `tenant_id` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '租户ID' AFTER `id`; + + + +ALTER TABLE `mallink`.`wx_coupon` +ADD COLUMN `source_type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1:A端发卷,2:B端发卷' AFTER `password_support`; \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java index 1a31085e4..28b2a9e49 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java @@ -140,6 +140,9 @@ public class WxCoupon extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="卡密是否支持(0:不支持,1支持)",name="passwordSupport") private Integer passwordSupport; + @io.swagger.annotations.ApiModelProperty(value="1:A端发卷,2:B端发卷",name="sourceType") + private Integer sourceType; + @TableField(exist = false) private String merchantParams; diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumCouponSourceType.java b/mallinkService/src/main/java/com/iformall/enums/EnumCouponSourceType.java new file mode 100644 index 000000000..92f23e28c --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumCouponSourceType.java @@ -0,0 +1,37 @@ +package com.iformall.enums; + +/** + * Created by Stormeye on 2018/08/09. + */ +public enum EnumCouponSourceType { + + // 1:A端发卷,2:B端发卷 + COUPONSource_Admin(1, "A端发卷"), + COUPONSource_Bapi(2, "B端发卷") + ; + + public static EnumCouponSourceType getEnum(Integer code) { + for (EnumCouponSourceType value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumCouponSourceType(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index efcfc6a9d..cc477f311 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -47,6 +47,7 @@ + @@ -93,6 +94,7 @@ + @@ -100,7 +102,7 @@ `valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`, `remark`,`status`,`create_date`,`update_date`,`business`,`sub_business`,`support_transfer`,`subsidy_num`,`subsidy_type`, `press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`,`put_apply_status`,`stock_apply_status`,`cancle_apply_status`, - `conditions`,approval_type,content_type + `conditions`,approval_type,content_type,source_type @@ -253,6 +255,10 @@ and `content_type` = #{contentType} + + and `source_type` = #{sourceType} + + and id in @@ -437,6 +443,10 @@ and c.`content_type` = #{contentType} + + and `source_type` = #{sourceType} + + @@ -560,6 +570,7 @@ + +