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 a6065f9ee..de7a173d8 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java @@ -188,7 +188,7 @@ public class WxCouponController extends BaseController { if(wxCoupon.getValidEndDate()!=null && wxCoupon.getValidEndDate().before(coupon.getValidEndDate())){ return new ResultData(ErrorCode.COUPON_STOCK_ENDTIME_ERR); } - if(wxCoupon.getInventory()!=null && wxCoupon.getInventory().intValue() <= coupon.getInventory().intValue() ){ + if(wxCoupon.getInventory()!=null && wxCoupon.getInventory().intValue() < coupon.getInventory().intValue() ){ return new ResultData(ErrorCode.COUPON_STOCK_INV_ERR); } diff --git a/mallinkAdmin/src/main/resources/db/migration/V201907091441__L_ADD_FLOW_DATA.sql b/mallinkAdmin/src/main/resources/db/migration/V201907091441__L_ADD_FLOW_DATA.sql new file mode 100644 index 000000000..2ef0867b4 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201907091441__L_ADD_FLOW_DATA.sql @@ -0,0 +1,115 @@ +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '456', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '456', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '456', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '456', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '789', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '789', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '789', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '789', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1001', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1001', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1001', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1001', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + + +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1002', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1002', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1002', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1002', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + + +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1003', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1003', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1003', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1003', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + + +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1004', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1004', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1004', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1004', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + + +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1005', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1005', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1005', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1005', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + + +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1006', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1006', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1006', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1006', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + + +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1007', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1007', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1007', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1007', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + + + +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1008', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1008', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1008', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1008', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + + + +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1009', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1009', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1009', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1009', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + + + +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1010', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1010', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1010', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1010', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + + + +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1011', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1011', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1011', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1011', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + + + +INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`) +VALUES + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1012', 19, '代办通知', '富茂', '{userName}提交了一个营销申请待您审批,电脑登陆{page} 查看您的待办。', '2019-04-24 12:42:33', 1, 0, 226, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1012', 20, '审批通知', '富茂', '{userName}同意[{type}][{name}]的审批,已呈送至{toUserName},登录{page}查看审批进度。', '2019-05-21 13:41:33', 1, 0, 500, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1012', 21, '通过审批通知', '富茂', '您申请的[{type}],[{name}]已通过审批,请登录{page} 跟进后续工作。', '2019-04-24 12:42:33', 1, 0, 228, NULL), + ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '1012', 22, '驳回通知', '富茂', '您申请的[{type}],[{name}]被驳回,请登录{page} 查看审批明细。', '2019-05-21 13:41:33', 1, 0, 500, NULL); + + diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java index 85f43d823..50295db22 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java @@ -47,10 +47,9 @@ public class WxCouponChannelController extends BaseController { if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); wxCouponChannel.setTenantId(getTenantId()); wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); - wxCouponChannel.setSortColumns(WxCouponChannel.Field.UpdateDate_DESC, WxCouponChannel.Field.Id_DESC); - //过滤已作废 - wxCouponChannel.setStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); + wxCouponChannel.setCouponStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); + wxCouponChannel.setSortColumns(WxCouponChannel.Field.UpdateDate_DESC, WxCouponChannel.Field.Id_DESC); PageInfo page = wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize); filterTimed(wxCouponChannel, page); return new ResultData(page); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java index c3f5d5a3a..0572938e0 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java @@ -74,6 +74,10 @@ public class WxCouponChannel extends BaseEntity { @io.swagger.annotations.ApiModelProperty(value="二维码",name="qrCode") private String qrCode; + @Transient + @io.swagger.annotations.ApiModelProperty(value="卷状态 0:可投放 1:作废",name="couponStatus") + private Integer couponStatus; + @Transient @io.swagger.annotations.ApiModelProperty(value="积分售价(适用于类型10,11)",name="creditPrice") private Integer creditPrice; diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumMsgModel.java b/mallinkService/src/main/java/com/iformall/enums/EnumMsgModel.java index ae421dc72..65f7f97ca 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumMsgModel.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumMsgModel.java @@ -24,6 +24,12 @@ public enum EnumMsgModel { DELETE_SHARING_ACCOUNT_NOTIFY_MERCHANT(16, "商户分账账户删除提醒"), TIME_LIMIT_CAMPAIGN_JOIN_SUCCESS(17, "限时活动报名成功"), TIME_LIMIT_CAMPAIGN_NOTIFY(18, "限时活动参与提醒"), + + //卷 + FLOW_C_ASSIGNEE_NODIFY(19, "待办通知"), + FLOW_C_APPLY_NODIFY(20, "审批通知"), + FLOW_C_PASS_NODIFY(21, "通过审批通知"), + FLOW_C_REJECT_NODIFY(22, "驳回通知"), ; public static EnumMsgModel getEnum(Integer code) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index a22a32763..8f9686793 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -629,6 +629,7 @@ public class WxCouponServiceImpl implements WxCouponService { public WxCoupon findById(WxCoupon wxCoupon) { WxCoupon query = new WxCoupon(); query.setId(wxCoupon.getId()); + query.setType(wxCoupon.getType()); List list = wxCouponMapper.findCouponList(query); if(CollectionUtils.isNotEmpty(list)){ return list.get(0); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java index 9c6c18c05..00b5301f6 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -18,6 +18,7 @@ import com.iformall.mapper.*; import com.iformall.mq.MqBaseProducer; import com.iformall.service.*; import com.iformall.utils.Constant; +import com.iformall.utils.DateUtils; import com.iformall.utils.JsonUtil; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.map.HashedMap; @@ -116,6 +117,7 @@ public class WxFlowServiceImpl implements WxFlowService { Integer contractType = 0; String str = (String)getVariableByKey(variables,"contractType"); Integer operateType = (Integer)getVariableByKey(variables,"approvalType"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); if(StringUtils.isNotBlank(str)){ contractType = Integer.parseInt(str); } @@ -206,28 +208,33 @@ public class WxFlowServiceImpl implements WxFlowService { wxCoupon.setStockApplyStatus(applyStatus); if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { //减库存 - if(EnumFlowKey.NEW_COUPON_UPLINE.getCode().equals(flowType) || EnumFlowKey.NEW_CARD_UPLINE.getCode().equals(flowType)) { - Integer inventory = getIngeter(getVariableByKey(variables, "inventory")); - Integer remainInventory = getIngeter(getVariableByKey(variables, "remainInventory")); - Integer type = getIngeter(getVariableByKey(variables, "type")); - Integer validDays = getIngeter(getVariableByKey(variables, "validDays")); - Integer validType = getIngeter(getVariableByKey(variables, "validType")); - - wxCoupon.setInventory(inventory); - wxCoupon.setRemainInventory(remainInventory); - wxCoupon.setType(type); + Integer inventory = getIngeter(getVariableByKey(variables, "inventory")); + Integer remainInventory = getIngeter(getVariableByKey(variables, "remainInventory")); + Integer type = getIngeter(getVariableByKey(variables, "type")); + Integer validDays = getIngeter(getVariableByKey(variables, "validDays")); + Integer validType = getIngeter(getVariableByKey(variables, "validType")); + + String validStartDate = (String) getVariableByKey(variables, "validStartDate"); + String validEndDate = (String) getVariableByKey(variables, "validEndDate"); + try { + if(validStartDate != null) { + wxCoupon.setValidStartDate(sdf.parse(validStartDate)); + } + if(validEndDate != null){ + wxCoupon.setValidEndDate(sdf.parse(validEndDate)); + } + }catch (Exception e){ + e.printStackTrace(); + } + + if(validDays != null){ wxCoupon.setValidDays(validDays); - wxCoupon.setValidType(validType); - wxCouponService.updateCouponStockAndEndTime(wxCoupon); - }else if(EnumFlowKey.NEW_GROUP_UPLINE.getCode().equals(flowType)){ - Integer remainInventory = getIngeter(getVariableByKey(variables, "remainInventory")); - wxCoupon.setRemainInventory(remainInventory); - wxCouponMapper.updateByPrimaryKeySelective(wxCoupon); - }else if(EnumFlowKey.NEW_PRESS_UPLINE.getCode().equals(flowType)){ - Integer inventory = getIngeter(getVariableByKey(variables, "inventory")); - wxCoupon.setInventory(inventory); - wxCouponMapper.updateByPrimaryKeySelective(wxCoupon); } + wxCoupon.setInventory(inventory); + wxCoupon.setRemainInventory(remainInventory); + wxCoupon.setType(type); + wxCoupon.setValidType(validType); + wxCouponService.updateCouponStockAndEndTime(wxCoupon); } }else if(EnumCouponAppType.CANCLE.getCode().equals(operateType)){ wxCoupon.setCancleApplyStatus(applyStatus); @@ -359,8 +366,7 @@ public class WxFlowServiceImpl implements WxFlowService { dynamicContentMap.put("bustype","账单"); dynamicContentMap.put("contract", businessId.toString()); }else if(isCoupon(flowType)){ - dynamicContentMap.put("bustype","有价券"); - dynamicContentMap.put("contract",businessId.toString()); + wxMsgRecord.setModelType(EnumMsgModel.FLOW_C_ASSIGNEE_NODIFY.getCode()); } wxMsgRecord.setDynamicContentMap(dynamicContentMap); mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); @@ -863,8 +869,10 @@ public class WxFlowServiceImpl implements WxFlowService { msgReplaceMap.put("bustype","账单"); msgReplaceMap.put("contract", businessId.toString()); }else if(isCoupon(flowType)){ - msgReplaceMap.put("bustype","有价券"); - msgReplaceMap.put("contract",businessId.toString()); + wxMsgRecord.setModelType(EnumMsgModel.FLOW_C_APPLY_NODIFY.getCode()); + WxCoupon wxCoupon = this.wxCouponMapper.selectByPrimaryKey(businessId); + msgReplaceMap.put("type",EnumCouponType.getEnum(wxCoupon.getType()).getMessage()); + msgReplaceMap.put("name",wxCoupon.getTitle()); } wxMsgRecord.setDynamicContentMap(msgReplaceMap); mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); @@ -917,8 +925,10 @@ public class WxFlowServiceImpl implements WxFlowService { msgReplaceMap.put("bustype","账单"); msgReplaceMap.put("contract", businessId.toString()); }else if(isCoupon(flowType)){ - msgReplaceMap.put("bustype","有价券"); - msgReplaceMap.put("contract",businessId.toString()); + wxMsgRecord.setModelType(EnumMsgModel.FLOW_C_PASS_NODIFY.getCode()); + WxCoupon wxCoupon = this.wxCouponMapper.selectByPrimaryKey(businessId); + msgReplaceMap.put("type",EnumCouponType.getEnum(wxCoupon.getType()).getMessage()); + msgReplaceMap.put("name",wxCoupon.getTitle()); } wxMsgRecord.setDynamicContentMap(msgReplaceMap); mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); diff --git a/mallinkService/src/main/resources/mapper/WxBusinessMapper.xml b/mallinkService/src/main/resources/mapper/WxBusinessMapper.xml index 5ef85a00e..88f5ecca6 100644 --- a/mallinkService/src/main/resources/mapper/WxBusinessMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBusinessMapper.xml @@ -84,17 +84,17 @@ select b.id,b.title, round( - (select sum(mtd.trade_amt) + (select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt)) from wx_merchant m left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1) /100,2) volume, round( - (select sum(mtd.trade_amt) + (select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt)) from wx_merchant m left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1) / - (select sum(ws.operation_area) + (select if(sum(ws.operation_area) is null,0,sum(ws.operation_area)) from wx_merchant m left join wx_merchant_shop mtd on mtd.merchant_id = m.id left join wx_shop ws on(mtd.shop_id = ws.id) @@ -103,13 +103,13 @@ round( (select - (select sum(br.receive_pay) receive_pay from wx_merchant m + (select if(sum(br.receive_pay) is null,0,sum(br.receive_pay)) receive_pay from wx_merchant m left join wx_bill_rent br on(br.merchant_id=m.id) where m.business_id = b.id and m.tenant_id=#{tenantId} and br.receive_date between #{startdate} and #{enddate} and m.status = 1) + - (select sum(br.receive_pay) receive_pay from wx_merchant m + (select if(sum(br.receive_pay) is null,0,sum(br.receive_pay)) receive_pay from wx_merchant m left join wx_bill_property br on(br.merchant_id=m.id) where m.business_id = b.id and m.tenant_id=#{tenantId} and br.receive_date between #{startdate} and #{enddate} and m.status = 1) from dual) / - (select sum(ws.operation_area) + (select if(sum(ws.operation_area) is null,0,sum(ws.operation_area)) from wx_merchant m left join wx_merchant_shop mtd on mtd.merchant_id = m.id left join wx_shop ws on(mtd.shop_id = ws.id) @@ -118,11 +118,11 @@ round( round( - (select sum(mtd.trade_amt) + (select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt)) from wx_merchant m left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1) / - (select sum(ws.operation_area) + (select if(sum(ws.operation_area) is null,0,sum(ws.operation_area)) from wx_merchant m left join wx_merchant_shop mtd on mtd.merchant_id = m.id left join wx_shop ws on(mtd.shop_id = ws.id) @@ -131,13 +131,13 @@ / round( (select - (select sum(br.receive_pay) receive_pay from wx_merchant m + (select if(sum(br.receive_pay) is null,0,sum(br.receive_pay)) receive_pay from wx_merchant m left join wx_bill_rent br on(br.merchant_id=m.id) where m.business_id = b.id and m.tenant_id=#{tenantId} and br.receive_date between #{startdate} and #{enddate} and m.status = 1) + - (select sum(br.receive_pay) receive_pay from wx_merchant m + (select if(sum(br.receive_pay) is null,0,sum(br.receive_pay)) receive_pay from wx_merchant m left join wx_bill_property br on(br.merchant_id=m.id) where m.business_id = b.id and m.tenant_id=#{tenantId} and br.receive_date between #{startdate} and #{enddate} and m.status = 1) from dual) / - (select sum(ws.operation_area) + (select if(sum(ws.operation_area) is null,0,sum(ws.operation_area)) from wx_merchant m left join wx_merchant_shop mtd on mtd.merchant_id = m.id left join wx_shop ws on(mtd.shop_id = ws.id) @@ -147,7 +147,7 @@ rentSaleRate, round( - (select sum(mtd.trade_amt) + (select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt)) from wx_merchant m left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1) / (select count(mtd.id) @@ -159,13 +159,13 @@