Commit 16126772 by guojuxing

微盟店铺卡券配置接口

parent 8ce3fce3
......@@ -24,9 +24,9 @@ public class WmStoreCouponConfigDTO implements Serializable{
private Integer enterpriseId;
/**
* 微盟主账号(平台唯一),用于关联配置
* 店铺主键ID,用于关联配置
*/
private String wmMainAccount;
private Integer wmMallStoreId;
/**
* gic卡券id
......@@ -86,12 +86,12 @@ public class WmStoreCouponConfigDTO implements Serializable{
return this;
}
public String getWmMainAccount() {
return wmMainAccount;
public Integer getWmMallStoreId() {
return wmMallStoreId;
}
public WmStoreCouponConfigDTO setWmMainAccount(String wmMainAccount) {
this.wmMainAccount = wmMainAccount;
public WmStoreCouponConfigDTO setWmMallStoreId(Integer wmMallStoreId) {
this.wmMallStoreId = wmMallStoreId;
return this;
}
......
......@@ -14,9 +14,9 @@ public class CouponConfigQO extends PageQO implements Serializable{
private static final long serialVersionUID = 2703515379512499369L;
/**
* 微盟主账号
* 店铺主键ID,用于关联配置
*/
private String wmMainAccount;
private Integer wmMallStoreId;
/**
* gic卡券ID
......@@ -38,12 +38,17 @@ public class CouponConfigQO extends PageQO implements Serializable{
*/
private String couponName;
public String getWmMainAccount() {
return wmMainAccount;
/**
* 1:绑定时间正序 2:绑定时间倒叙
*/
private Integer orderByCode;
public Integer getWmMallStoreId() {
return wmMallStoreId;
}
public CouponConfigQO setWmMainAccount(String wmMainAccount) {
this.wmMainAccount = wmMainAccount;
public CouponConfigQO setWmMallStoreId(Integer wmMallStoreId) {
this.wmMallStoreId = wmMallStoreId;
return this;
}
......@@ -82,4 +87,13 @@ public class CouponConfigQO extends PageQO implements Serializable{
this.couponName = couponName;
return this;
}
public Integer getOrderByCode() {
return orderByCode;
}
public CouponConfigQO setOrderByCode(Integer orderByCode) {
this.orderByCode = orderByCode;
return this;
}
}
......@@ -17,9 +17,9 @@ public class TabWmStoreCouponConfig {
private Integer enterpriseId;
/**
* 微盟主账号(平台唯一),用于关联配置
* 店铺主键ID,用于关联配置
*/
private String wmMainAccount;
private Integer wmMallStoreId;
/**
* gic卡券id
......@@ -79,12 +79,12 @@ public class TabWmStoreCouponConfig {
return this;
}
public String getWmMainAccount() {
return wmMainAccount;
public Integer getWmMallStoreId() {
return wmMallStoreId;
}
public TabWmStoreCouponConfig setWmMainAccount(String wmMainAccount) {
this.wmMainAccount = wmMainAccount;
public TabWmStoreCouponConfig setWmMallStoreId(Integer wmMallStoreId) {
this.wmMallStoreId = wmMallStoreId;
return this;
}
......
......@@ -179,12 +179,12 @@ public class WmStoreApiServiceImpl implements WmStoreApiService {
if (dto.getEnterpriseId() == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "商户ID不能为空");
}
if (StringUtils.isBlank(dto.getWmMainAccount())) {
if (dto.getWmMallStoreId() == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "微盟主账号不能为空");
}
TabWmStore wmStore = wmStoreService.getByWmMainAccount(dto.getWmMainAccount());
TabWmStore wmStore = wmStoreService.getByWmMallStoreId(dto.getWmMallStoreId());
if (wmStore == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "微盟主账号错误,查无数据");
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "店铺不存在");
}
if (StringUtils.isBlank(dto.getGicCouponId())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "gic卡券为空");
......@@ -194,14 +194,14 @@ public class WmStoreApiServiceImpl implements WmStoreApiService {
}
List<TabWmStoreCouponConfig> gicRecord = wmStoreCouponConfigService
.getCouponConfig(new CouponConfigQO()
.setWmMainAccount(dto.getWmMainAccount())
.setWmMallStoreId(dto.getWmMallStoreId())
.setGicCouponId(dto.getGicCouponId()));
if (CollectionUtils.isNotEmpty(gicRecord)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "gic卡券重复绑定");
}
List<TabWmStoreCouponConfig> wmRecord = wmStoreCouponConfigService
.getCouponConfig(new CouponConfigQO()
.setWmMainAccount(dto.getWmMainAccount())
.setWmMallStoreId(dto.getWmMallStoreId())
.setWmCouponId(dto.getWmCouponId()));
if (CollectionUtils.isNotEmpty(wmRecord)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "微盟卡券重复绑定");
......@@ -221,7 +221,7 @@ public class WmStoreApiServiceImpl implements WmStoreApiService {
List<WmCouponDTO> list = gicRecord.stream().map(e -> {
WmCouponDTO temp = new WmCouponDTO();
temp.setWmCouponId(Long.valueOf(e.getWmCouponId()));
temp.setWmMallStoreId(wmStoreService.getByWmMainAccount(e.getWmMainAccount()).getWmMallStoreId());
temp.setWmMallStoreId(e.getWmMallStoreId());
return temp;
}).collect(Collectors.toList());
return ServiceResponse.success(list);
......
......@@ -4,7 +4,7 @@
<resultMap id="BaseResultMap" type="com.gic.enterprise.entity.TabWmStoreCouponConfig">
<id column="coupon_config_id" jdbcType="INTEGER" property="couponConfigId" />
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="wm_main_account" jdbcType="VARCHAR" property="wmMainAccount" />
<result column="wm_mall_store_id" jdbcType="INTEGER" property="wmMallStoreId" />
<result column="gic_coupon_id" jdbcType="VARCHAR" property="gicCouponId" />
<result column="gic_coupon_name" jdbcType="VARCHAR" property="gicCouponName" />
<result column="wm_coupon_id" jdbcType="VARCHAR" property="wmCouponId" />
......@@ -15,7 +15,7 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
coupon_config_id, enterprise_id, wm_main_account, gic_coupon_id, gic_coupon_name, wm_coupon_id, wm_coupon_name, gic_coupon_expire,
coupon_config_id, enterprise_id, wm_mall_store_id, gic_coupon_id, gic_coupon_name, wm_coupon_id, wm_coupon_name, gic_coupon_expire,
status, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
......@@ -29,11 +29,11 @@
where coupon_config_id = #{couponConfigId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.enterprise.entity.TabWmStoreCouponConfig">
insert into tab_wm_store_coupon_config (coupon_config_id, enterprise_id, wm_main_account,
insert into tab_wm_store_coupon_config (coupon_config_id, enterprise_id, wm_mall_store_id,
gic_coupon_id, gic_coupon_name, wm_coupon_id, wm_coupon_name, gic_coupon_expire,
status, create_time, update_time
)
values (#{couponConfigId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER}, #{wmMainAccount,jdbcType=VARCHAR},
values (#{couponConfigId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER}, #{wmMallStoreId,jdbcType=INTEGER},
#{gicCouponId,jdbcType=VARCHAR}, #{gicCouponName,jdbcType=VARCHAR}, #{wmCouponId,jdbcType=VARCHAR},
#{wmCouponName,jdbcType=VARCHAR}, #{gicCouponExpire,jdbcType=TIMESTAMP},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
......@@ -48,8 +48,8 @@
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="wmMainAccount != null">
wm_main_account,
<if test="wmMallStoreId != null">
wm_mall_store_id,
</if>
<if test="gicCouponId != null">
gic_coupon_id,
......@@ -83,8 +83,8 @@
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
</if>
<if test="wmMainAccount != null">
#{wmMainAccount,jdbcType=VARCHAR},
<if test="wmMallStoreId != null">
#{wmMallStoreId,jdbcType=INTEGER},
</if>
<if test="gicCouponId != null">
#{gicCouponId,jdbcType=VARCHAR},
......@@ -118,8 +118,8 @@
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if test="wmMainAccount != null">
wm_main_account = #{wmMainAccount,jdbcType=VARCHAR},
<if test="wmMallStoreId != null">
wm_mall_store_id = #{wmMallStoreId,jdbcType=INTEGER},
</if>
<if test="gicCouponId != null">
gic_coupon_id = #{gicCouponId,jdbcType=VARCHAR},
......@@ -151,7 +151,7 @@
<update id="updateByPrimaryKey" parameterType="com.gic.enterprise.entity.TabWmStoreCouponConfig">
update tab_wm_store_coupon_config
set enterprise_id = #{enterpriseId,jdbcType=INTEGER},
wm_main_account = #{wmMainAccount,jdbcType=VARCHAR},
wm_mall_store_id = #{wmMallStoreId,jdbcType=INTEGER},
gic_coupon_id = #{gicCouponId,jdbcType=VARCHAR},
gic_coupon_name = #{gicCouponName,jdbcType=VARCHAR},
wm_coupon_id = #{wmCouponId,jdbcType=VARCHAR},
......@@ -168,8 +168,8 @@
from tab_wm_store_coupon_config
where status = 1
<if test="wmMainAccount != null and wmMainAccount != '' ">
and wm_main_account = #{wmMainAccount}
<if test="wmMallStoreId != null and wmMallStoreId != '' ">
and wm_mall_store_id = #{wmMallStoreId}
</if>
<if test="gicCouponId != null and gicCouponId != '' ">
and gic_coupon_id = #{gicCouponId}
......@@ -183,5 +183,11 @@
<if test="couponName != null and couponName != '' ">
and (gic_coupon_name like concat('%', #{couponName}, '%') or wm_coupon_name like concat('%', #{couponName}, '%'))
</if>
<if test="orderByCode != null and orderByCode == 1">
order by create_time
</if>
<if test="orderByCode != null and orderByCode == 2">
order by create_time desc
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -8,9 +8,6 @@ import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.gic.enterprise.web.vo.wm.*;
import com.gic.marketing.api.dto.coupon.CouponDTO;
import com.gic.marketing.api.service.coupon.MemberCouponApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -28,11 +25,16 @@ import com.gic.enterprise.constant.MallModeEnum;
import com.gic.enterprise.constant.WmStoreConfigTypeEnum;
import com.gic.enterprise.dto.WmStoreDTO;
import com.gic.enterprise.dto.wm.WmStoreConfigDTO;
import com.gic.enterprise.dto.wm.WmStoreCouponConfigDTO;
import com.gic.enterprise.qo.wm.CouponConfigQO;
import com.gic.enterprise.service.WmStoreApiService;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.enterprise.web.utils.DomainUtils;
import com.gic.enterprise.web.vo.MemberCardVO;
import com.gic.enterprise.web.vo.wm.*;
import com.gic.marketing.api.dto.coupon.CouponDTO;
import com.gic.marketing.api.service.coupon.MemberCouponApiService;
import com.gic.member.config.api.service.MemberCardApiService;
import com.gic.weimob.api.service.WeimobMerchantService;
import com.gic.weimob.api.service.WeimobStoreSiteService;
......@@ -256,8 +258,13 @@ public class WmMallStoreController {

*/
@RequestMapping("/get-integral-config")
public RestResponse getIntegralConfig(Integer wmMallStoreId) {
//todo 查询已配置的会员卡ID
return ResultControllerUtils.commonResult(memberCardApiService.isGicCalculateIntegral(22L, UserDetailUtils.getUserDetail().getEnterpriseId()));
//获取已配置的卡券ID
ServiceResponse<Long> mcuIdResponse = weimobMerchantService.getMcuAreaId(wmMallStoreId);
if (!mcuIdResponse.isSuccess()) {
return RestResponse.failure(mcuIdResponse.getCode(), mcuIdResponse.getMessage());
}
return ResultControllerUtils.commonResult(memberCardApiService
.isGicCalculateIntegral(mcuIdResponse.getResult(), UserDetailUtils.getUserDetail().getEnterpriseId()));
}
/**
......@@ -271,8 +278,13 @@ public class WmMallStoreController {

*/
@RequestMapping("/edit-integral-config")
public RestResponse editIntegralConfig(Integer wmMallStoreId, String integralRule) {
//todo 查询已配置的会员卡ID
return ResultControllerUtils.commonResult(memberCardApiService.updateIntegralRule(22L, UserDetailUtils.getUserDetail().getEnterpriseId(), integralRule));
//获取已配置的卡券ID
ServiceResponse<Long> mcuIdResponse = weimobMerchantService.getMcuAreaId(wmMallStoreId);
if (!mcuIdResponse.isSuccess()) {
return RestResponse.failure(mcuIdResponse.getCode(), mcuIdResponse.getMessage());
}
return ResultControllerUtils.commonResult(memberCardApiService
.updateIntegralRule(mcuIdResponse.getResult(), UserDetailUtils.getUserDetail().getEnterpriseId(), integralRule));
}
@RequestMapping("/list-wm-store-config")
......@@ -301,4 +313,20 @@ public class WmMallStoreController {
return ResultControllerUtils
.commonResult(wmStoreApiService.getWmStoreConfigByWmMainAccount(wmMainAccount, wmStoreConfigType));
}
@RequestMapping("/bind-coupon")
public RestResponse bindCoupon(WmStoreCouponConfigDTO dto) {
dto.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
return OperationResultUtils
.operationResult(wmStoreApiService.saveCouponConfig(dto),
"绑定卡券"
+ dto.getGicCouponName() + ":" + dto.getWmCouponName(),
"微盟商城");
}
@RequestMapping("/page-coupon-config")
public RestResponse pageCouponConfig(CouponConfigQO params) {
return ResultControllerUtils
.commonResult(wmStoreApiService.pageCouponConfig(params));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment