You need to sign in or sign up before continuing.
Commit a64bad1c by 陶光胜

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-platform-enterprise into developer
parents 0b0e91c8 31fbe977
package com.gic.enterprise.constant;
/**
* 商城模式
* @ClassName: MallModeEnum

* @Description: 

* @author guojuxing

* @date 2020/4/13 1:45 PM

*/
public enum MallModeEnum {
MICRO_MALL(1, "微商城模式"),
SMART_RETAIL(1, "智慧零售模式"),
;
private int code;
private String msg;
MallModeEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public static boolean isContain(Integer code) {
if (code == null) {
return false;
}
for (MallModeEnum modeEnum : values()) {
if (code.intValue() == modeEnum.getCode()) {
return true;
}
}
return false;
}
public int getCode() {
return code;
}
public MallModeEnum setCode(int code) {
this.code = code;
return this;
}
public String getMsg() {
return msg;
}
public MallModeEnum setMsg(String msg) {
this.msg = msg;
return this;
}
}
package com.gic.enterprise.dto;
import java.io.Serializable;
import java.util.Date;
/**
* 微盟商城店铺
* @ClassName: WmStoreDTO

* @Description: 

* @author guojuxing

* @date 2020/4/13 10:44 AM

*/
public class WmStoreDTO implements Serializable{
private static final long serialVersionUID = 7199830254908520238L;
/**
*
*/
private Integer wmMallStoreId;
/**
*
*/
private Integer enterpriseId;
/**
* 微盟主账号
*/
private String wmMainAccount;
/**
* 微盟pid
*/
private String wmPid;
/**
* 微盟store_id
*/
private String wmStoreId;
/**
* 店铺名称
*/
private String wmPidName;
/**
* 商城模式 1:微商城模式 2:智慧零售模式
*/
private Integer mallMode;
/**
* 店招品牌
*/
private Integer storeBrandId;
/**
* 授权状态 0:未授权 1:已授权
*/
private Integer authStatus;
/**
* 1:有效
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
public Integer getWmMallStoreId() {
return wmMallStoreId;
}
public WmStoreDTO setWmMallStoreId(Integer wmMallStoreId) {
this.wmMallStoreId = wmMallStoreId;
return this;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public WmStoreDTO setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
return this;
}
public String getWmMainAccount() {
return wmMainAccount;
}
public WmStoreDTO setWmMainAccount(String wmMainAccount) {
this.wmMainAccount = wmMainAccount;
return this;
}
public String getWmPid() {
return wmPid;
}
public WmStoreDTO setWmPid(String wmPid) {
this.wmPid = wmPid;
return this;
}
public String getWmStoreId() {
return wmStoreId;
}
public WmStoreDTO setWmStoreId(String wmStoreId) {
this.wmStoreId = wmStoreId;
return this;
}
public String getWmPidName() {
return wmPidName;
}
public WmStoreDTO setWmPidName(String wmPidName) {
this.wmPidName = wmPidName;
return this;
}
public Integer getMallMode() {
return mallMode;
}
public WmStoreDTO setMallMode(Integer mallMode) {
this.mallMode = mallMode;
return this;
}
public Integer getStoreBrandId() {
return storeBrandId;
}
public WmStoreDTO setStoreBrandId(Integer storeBrandId) {
this.storeBrandId = storeBrandId;
return this;
}
public Integer getAuthStatus() {
return authStatus;
}
public WmStoreDTO setAuthStatus(Integer authStatus) {
this.authStatus = authStatus;
return this;
}
public Integer getStatus() {
return status;
}
public WmStoreDTO setStatus(Integer status) {
this.status = status;
return this;
}
public Date getCreateTime() {
return createTime;
}
public WmStoreDTO setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public WmStoreDTO setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
}
package com.gic.enterprise.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.WmStoreDTO;
import java.util.List;
/**
* 微盟商城店铺
* @ClassName: WmStoreApiService

* @Description: 

* @author guojuxing

* @date 2020/4/13 10:47 AM

*/
public interface WmStoreApiService {
/**
* 新增
* @Title: saveWmStore

* @Description:

* @author guojuxing
* @param wmStoreDTO

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>


*/
ServiceResponse<Integer> saveWmStore(WmStoreDTO wmStoreDTO);
/**
* 修改
* @Title: modifyWmStore

* @Description:

* @author guojuxing
* @param wmStoreDTO

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


*/
ServiceResponse<Void> modifyWmStore(WmStoreDTO wmStoreDTO);
/**
* 微盟商城店铺授权
* @Title: authWmStore

* @Description:

* @author guojuxing
* @param wmMallStoreId

* @return com.gic.api.base.commons.ServiceResponse<java.lang.String>
店铺名称

*/
ServiceResponse<String> authWmStore(Integer wmMallStoreId);
ServiceResponse<List<WmStoreDTO>> listWmStore(Integer enterpriseId);
ServiceResponse<WmStoreDTO> getWmStoreByWmMallStoreId(Integer wmMallStoreId);
}
package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.entity.TabWmStore;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TabWmStoreMapper {
/**
* 根据主键删除
*
* @param wmMallStoreId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer wmMallStoreId);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabWmStore record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabWmStore record);
/**
* 根据主键查询
*
* @param wmMallStoreId 主键
* @return 实体对象
*/
TabWmStore selectByPrimaryKey(Integer wmMallStoreId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabWmStore record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabWmStore record);
/**
* 验证是否重复(平台级)
* @Title: countByParam

* @Description:

* @author guojuxing
* @param data
* @param wmMallStoreId 店铺ID
* @param dataType
1:主账号 2:wm_store_id 3:pid
* @return int


*/
int countByParam(@Param("data") String data, @Param("wmMallStoreId") Integer wmMallStoreId, @Param("dataType") Integer dataType);
int countByStoreName(@Param("storeName") String storeName, @Param("wmMallStoreId") Integer wmMallStoreId, @Param("enterpriseId") Integer enterpriseId);
List<TabWmStore> listWmStore(Integer enterpriseId);
}
\ No newline at end of file
package com.gic.enterprise.entity;
import java.util.Date;
/**
* tab_wm_store
*/
public class TabWmStore {
/**
*
*/
private Integer wmMallStoreId;
/**
*
*/
private Integer enterpriseId;
/**
* 微盟主账号
*/
private String wmMainAccount;
/**
* 微盟pid
*/
private String wmPid;
/**
* 微盟store_id
*/
private String wmStoreId;
/**
* 店铺名称
*/
private String wmPidName;
/**
* 商城模式 1:微商城模式 2:智慧零售模式
*/
private Integer mallMode;
/**
* 店招品牌
*/
private Integer storeBrandId;
/**
* 授权状态 0:未授权 1:已授权
*/
private Integer authStatus;
/**
* 1:有效
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
public Integer getWmMallStoreId() {
return wmMallStoreId;
}
public TabWmStore setWmMallStoreId(Integer wmMallStoreId) {
this.wmMallStoreId = wmMallStoreId;
return this;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public TabWmStore setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
return this;
}
public String getWmMainAccount() {
return wmMainAccount;
}
public TabWmStore setWmMainAccount(String wmMainAccount) {
this.wmMainAccount = wmMainAccount;
return this;
}
public String getWmPid() {
return wmPid;
}
public TabWmStore setWmPid(String wmPid) {
this.wmPid = wmPid;
return this;
}
public String getWmStoreId() {
return wmStoreId;
}
public TabWmStore setWmStoreId(String wmStoreId) {
this.wmStoreId = wmStoreId;
return this;
}
public String getWmPidName() {
return wmPidName;
}
public TabWmStore setWmPidName(String wmPidName) {
this.wmPidName = wmPidName;
return this;
}
public Integer getMallMode() {
return mallMode;
}
public TabWmStore setMallMode(Integer mallMode) {
this.mallMode = mallMode;
return this;
}
public Integer getStoreBrandId() {
return storeBrandId;
}
public TabWmStore setStoreBrandId(Integer storeBrandId) {
this.storeBrandId = storeBrandId;
return this;
}
public Integer getAuthStatus() {
return authStatus;
}
public TabWmStore setAuthStatus(Integer authStatus) {
this.authStatus = authStatus;
return this;
}
public Integer getStatus() {
return status;
}
public TabWmStore setStatus(Integer status) {
this.status = status;
return this;
}
public Date getCreateTime() {
return createTime;
}
public TabWmStore setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public TabWmStore setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
}
\ No newline at end of file
package com.gic.enterprise.service;
import com.gic.enterprise.dto.WmStoreDTO;
import com.gic.enterprise.entity.TabWmStore;
import java.util.List;
/**
* 微盟商城店铺
* @ClassName: WmStoreService

* @Description: 

* @author guojuxing

* @date 2020/4/13 10:47 AM

*/
public interface WmStoreService {
/**
* 新增
* @Title: saveWmStore

* @Description:

* @author guojuxing
* @param wmStoreDTO

* @return java.lang.Integer


*/
Integer saveWmStore(WmStoreDTO wmStoreDTO);
void modifyWmStore(WmStoreDTO wmStoreDTO);
/**
* 验证是否重复(平台级)
* @Title: validRepeat

* @Description:

* @author guojuxing
* @param data
* @param wmMallStoreId 店铺ID
* @param dataType
1:主账号 2:wm_store_id 3:pid
* @return boolean


*/
boolean validRepeat(String data, Integer wmMallStoreId, Integer dataType);
/**
* 店铺名称商户级验证重复
* @Title: validRepeatStoreName

* @Description:

* @author guojuxing
* @param storeName
* @param wmMallStoreId 店铺ID
* @param enterpriseId
商户ID
* @return boolean


*/
boolean validRepeatStoreName(String storeName, Integer wmMallStoreId, Integer enterpriseId);
TabWmStore getByWmMallStoreId(Integer wmMallStoreId);
List<TabWmStore> listWmStore(Integer enterpriseId);
}
package com.gic.enterprise.service.impl;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.dao.mapper.TabWmStoreMapper;
import com.gic.enterprise.dto.WmStoreDTO;
import com.gic.enterprise.entity.TabWmStore;
import com.gic.enterprise.service.WmStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service("wmStoreService")
public class WmStoreServiceImpl implements WmStoreService{
@Autowired
private TabWmStoreMapper tabWmStoreMapper;
@Override
public Integer saveWmStore(WmStoreDTO wmStoreDTO) {
Date now = new Date();
wmStoreDTO.setCreateTime(now);
wmStoreDTO.setUpdateTime(now);
wmStoreDTO.setStatus(1);
wmStoreDTO.setAuthStatus(0);
TabWmStore record = EntityUtil.changeEntityNew(TabWmStore.class, wmStoreDTO);
tabWmStoreMapper.insert(record);
return record.getWmMallStoreId();
}
@Override
public void modifyWmStore(WmStoreDTO wmStoreDTO) {
wmStoreDTO.setUpdateTime(new Date());
TabWmStore record = EntityUtil.changeEntityNew(TabWmStore.class, wmStoreDTO);
tabWmStoreMapper.updateByPrimaryKeySelective(record);
}
@Override
public boolean validRepeat(String data, Integer wmMallStoreId, Integer dataType) {
int count = tabWmStoreMapper.countByParam(data, wmMallStoreId, dataType);
if (count > 0) {
return true;
}
return false;
}
@Override
public boolean validRepeatStoreName(String storeName, Integer wmMallStoreId, Integer enterpriseId) {
int count = tabWmStoreMapper.countByStoreName(storeName, wmMallStoreId, enterpriseId);
if (count > 0) {
return true;
}
return false;
}
@Override
public TabWmStore getByWmMallStoreId(Integer wmMallStoreId) {
return tabWmStoreMapper.selectByPrimaryKey(wmMallStoreId);
}
@Override
public List<TabWmStore> listWmStore(Integer enterpriseId) {
return tabWmStoreMapper.listWmStore(enterpriseId);
}
}
package com.gic.enterprise.service.outer.impl;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.constant.MallModeEnum;
import com.gic.enterprise.dto.WmStoreDTO;
import com.gic.enterprise.entity.TabWmStore;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.WmStoreApiService;
import com.gic.enterprise.service.WmStoreService;
@Service("wmStoreApiService")
public class WmStoreApiServiceImpl implements WmStoreApiService {
@Autowired
private WmStoreService wmStoreService;
@Override
public ServiceResponse<Integer> saveWmStore(WmStoreDTO wmStoreDTO) {
ServiceResponse validParam = validParam(wmStoreDTO);
if (!validParam.isSuccess()) {
return ServiceResponse.failure(validParam.getCode(), validParam.getMessage());
}
return ServiceResponse.success(wmStoreService.saveWmStore(wmStoreDTO));
}
@Override
public ServiceResponse<Void> modifyWmStore(WmStoreDTO wmStoreDTO) {
ServiceResponse validParam = validParam(wmStoreDTO);
if (!validParam.isSuccess()) {
return ServiceResponse.failure(validParam.getCode(), validParam.getMessage());
}
wmStoreService.modifyWmStore(wmStoreDTO);
return ServiceResponse.success();
}
@Override
public ServiceResponse<String> authWmStore(Integer wmMallStoreId) {
TabWmStore record = wmStoreService.getByWmMallStoreId(wmMallStoreId);
if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "微盟商城店铺ID错误,查无数据");
}
wmStoreService.modifyWmStore(new WmStoreDTO().setWmMallStoreId(wmMallStoreId).setAuthStatus(1));
return ServiceResponse.success(record.getWmPidName());
}
@Override
public ServiceResponse<List<WmStoreDTO>> listWmStore(Integer enterpriseId) {
List<TabWmStore> list = wmStoreService.listWmStore(enterpriseId);
return ServiceResponse.success(
EntityUtil.changeEntityListNew(WmStoreDTO.class, list));
}
@Override
public ServiceResponse<WmStoreDTO> getWmStoreByWmMallStoreId(Integer wmMallStoreId) {
TabWmStore record = wmStoreService.getByWmMallStoreId(wmMallStoreId);
if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "微盟商城店铺ID错误,查无数据");
}
return ServiceResponse.success(EntityUtil.changeEntityNew(WmStoreDTO.class, record));
}
private ServiceResponse<Void> validParam(WmStoreDTO wmStoreDTO) {
Integer wmMallStoreId = wmStoreDTO.getWmMallStoreId();
boolean isEdit = wmMallStoreId != null;
TabWmStore record = null;
if (wmMallStoreId != null) {
record = wmStoreService.getByWmMallStoreId(wmMallStoreId);
if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "微盟商城店铺ID错误,查无数据");
}
wmStoreDTO.setEnterpriseId(record.getEnterpriseId());
}
//已授权
boolean isCanEdit = isEdit && record.getAuthStatus().intValue() == 1;
if (StringUtils.isBlank(wmStoreDTO.getWmMainAccount())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "微盟主账号不能为空");
}
if (wmStoreService.validRepeat(wmStoreDTO.getWmMainAccount(), wmMallStoreId, 1)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "微盟主账号已存在");
}
if (isCanEdit && !record.getWmMainAccount().equals(wmStoreDTO.getWmMainAccount())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已授权,微盟主账号不能修改");
}
if (StringUtils.isBlank(wmStoreDTO.getWmPid())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "PID不能为空");
}
if (isCanEdit && !record.getWmPid().equals(wmStoreDTO.getWmPid())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已授权,PID不能修改");
}
if (wmStoreService.validRepeat(wmStoreDTO.getWmPid(), wmMallStoreId, 3)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "PID已存在");
}
if (StringUtils.isBlank(wmStoreDTO.getWmStoreId())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "storeID不能为空");
}
if (isCanEdit && !record.getWmStoreId().equals(wmStoreDTO.getWmStoreId())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已授权,storeID不能修改");
}
if (wmStoreService.validRepeat(wmStoreDTO.getWmStoreId(), wmMallStoreId, 2)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "storeID已存在");
}
if (StringUtils.isBlank(wmStoreDTO.getWmPidName())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "店铺名称不能为空");
}
if (isCanEdit && !record.getWmPidName().equals(wmStoreDTO.getWmPidName())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已授权,店铺名称不能修改");
}
if (wmStoreService.validRepeatStoreName(wmStoreDTO.getWmPidName(), wmMallStoreId,
wmStoreDTO.getEnterpriseId())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "店铺名称已存在");
}
if (!MallModeEnum.isContain(wmStoreDTO.getMallMode())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "商城模式值非法");
}
//选择智慧零售模式保存后或者有进行过门店同步则不允许切换回微商城模式
if (isEdit && (record.getMallMode().intValue() == MallModeEnum.SMART_RETAIL.getCode())
&& wmStoreDTO.getMallMode().intValue() != MallModeEnum.SMART_RETAIL.getCode()) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已进行过智慧零售模式保存,不允许切换回微商城模式");
}
Integer storeBrandId = wmStoreDTO.getStoreBrandId();
if (storeBrandId == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "店招品牌不能为空");
}
if (isCanEdit && record.getStoreBrandId().intValue() != storeBrandId.intValue()) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已授权,店招品牌不能修改");
}
return ServiceResponse.success();
}
}
......@@ -124,6 +124,8 @@
<dubbo:service interface="com.gic.enterprise.service.ConfigRuleApiService" ref="configRuleApiService" timeout="6000" />
<dubbo:service interface="com.gic.enterprise.service.ConfigRuleEnterpriseApiService" ref="configRuleEnterpriseApiService" timeout="6000" />
<dubbo:service interface="com.gic.enterprise.service.WmStoreApiService" ref="wmStoreApiService" timeout="6000" />
<dubbo:reference interface="com.gic.mall.share.api.service.ShopApiService" id="shopApiService" timeout="6000" />
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.enterprise.dao.mapper.TabWmStoreMapper">
<resultMap id="BaseResultMap" type="com.gic.enterprise.entity.TabWmStore">
<id column="wm_mall_store_id" jdbcType="INTEGER" property="wmMallStoreId" />
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="wm_main_account" jdbcType="VARCHAR" property="wmMainAccount" />
<result column="wm_pid" jdbcType="VARCHAR" property="wmPid" />
<result column="wm_store_id" jdbcType="VARCHAR" property="wmStoreId" />
<result column="wm_pid_name" jdbcType="VARCHAR" property="wmPidName" />
<result column="mall_mode" jdbcType="INTEGER" property="mallMode" />
<result column="store_brand_id" jdbcType="INTEGER" property="storeBrandId" />
<result column="auth_status" jdbcType="INTEGER" property="authStatus" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
wm_mall_store_id, enterprise_id, wm_main_account, wm_pid, wm_store_id, wm_pid_name,
mall_mode, store_brand_id, auth_status, status, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_wm_store
where wm_mall_store_id = #{wmMallStoreId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_wm_store
where wm_mall_store_id = #{wmMallStoreId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.enterprise.entity.TabWmStore" useGeneratedKeys="true" keyProperty="wmMallStoreId">
insert into tab_wm_store (wm_mall_store_id, enterprise_id, wm_main_account,
wm_pid, wm_store_id, wm_pid_name,
mall_mode, store_brand_id, auth_status,
status, create_time, update_time
)
values (#{wmMallStoreId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER}, #{wmMainAccount,jdbcType=VARCHAR},
#{wmPid,jdbcType=VARCHAR}, #{wmStoreId,jdbcType=VARCHAR}, #{wmPidName,jdbcType=VARCHAR},
#{mallMode,jdbcType=INTEGER}, #{storeBrandId,jdbcType=INTEGER}, #{authStatus,jdbcType=INTEGER},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabWmStore" useGeneratedKeys="true" keyProperty="wmMallStoreId">
insert into tab_wm_store
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="wmMallStoreId != null">
wm_mall_store_id,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="wmMainAccount != null">
wm_main_account,
</if>
<if test="wmPid != null">
wm_pid,
</if>
<if test="wmStoreId != null">
wm_store_id,
</if>
<if test="wmPidName != null">
wm_pid_name,
</if>
<if test="mallMode != null">
mall_mode,
</if>
<if test="storeBrandId != null">
store_brand_id,
</if>
<if test="authStatus != null">
auth_status,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="wmMallStoreId != null">
#{wmMallStoreId,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
</if>
<if test="wmMainAccount != null">
#{wmMainAccount,jdbcType=VARCHAR},
</if>
<if test="wmPid != null">
#{wmPid,jdbcType=VARCHAR},
</if>
<if test="wmStoreId != null">
#{wmStoreId,jdbcType=VARCHAR},
</if>
<if test="wmPidName != null">
#{wmPidName,jdbcType=VARCHAR},
</if>
<if test="mallMode != null">
#{mallMode,jdbcType=INTEGER},
</if>
<if test="storeBrandId != null">
#{storeBrandId,jdbcType=INTEGER},
</if>
<if test="authStatus != null">
#{authStatus,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.enterprise.entity.TabWmStore">
update tab_wm_store
<set>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if test="wmMainAccount != null">
wm_main_account = #{wmMainAccount,jdbcType=VARCHAR},
</if>
<if test="wmPid != null">
wm_pid = #{wmPid,jdbcType=VARCHAR},
</if>
<if test="wmStoreId != null">
wm_store_id = #{wmStoreId,jdbcType=VARCHAR},
</if>
<if test="wmPidName != null">
wm_pid_name = #{wmPidName,jdbcType=VARCHAR},
</if>
<if test="mallMode != null">
mall_mode = #{mallMode,jdbcType=INTEGER},
</if>
<if test="storeBrandId != null">
store_brand_id = #{storeBrandId,jdbcType=INTEGER},
</if>
<if test="authStatus != null">
auth_status = #{authStatus,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where wm_mall_store_id = #{wmMallStoreId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.enterprise.entity.TabWmStore">
update tab_wm_store
set enterprise_id = #{enterpriseId,jdbcType=INTEGER},
wm_main_account = #{wmMainAccount,jdbcType=VARCHAR},
wm_pid = #{wmPid,jdbcType=VARCHAR},
wm_store_id = #{wmStoreId,jdbcType=VARCHAR},
wm_pid_name = #{wmPidName,jdbcType=VARCHAR},
mall_mode = #{mallMode,jdbcType=INTEGER},
store_brand_id = #{storeBrandId,jdbcType=INTEGER},
auth_status = #{authStatus,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where wm_mall_store_id = #{wmMallStoreId,jdbcType=INTEGER}
</update>
<select id="countByParam" resultType="int">
select count(1)
from tab_wm_store
where status = 1
<if test="dataType == 1">
and wm_main_account = #{data}
</if>
<if test="dataType == 2">
and wm_store_id = #{data}
</if>
<if test="dataType == 1">
and wm_main_account = #{data}
</if>
<if test="wmMallStoreId != null">
and wm_mall_store_id &lt;&gt; #{wmMallStoreId}
</if>
</select>
<select id="countByStoreName" resultType="int">
select count(1)
from tab_wm_store
where status = 1
<if test="enterpriseId != null">
and enterprise_id = #{enterpriseId}
</if>
and wm_pid_name = #{storeName}
<if test="wmMallStoreId != null">
and wm_mall_store_id &lt;&gt; #{wmMallStoreId}
</if>
</select>
<select id="listWmStore" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"></include>
from tab_wm_store
where enterprise_id = #{enterpriseId}
and status = 1
</select>
</mapper>
\ No newline at end of file
package com.gic.enterprise.web.controller.wm;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.constant.MallModeEnum;
import com.gic.enterprise.utils.ResultControllerUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.download.utils.OperationResultUtils;
import com.gic.enterprise.dto.WmStoreDTO;
import com.gic.enterprise.service.WmStoreApiService;
import com.gic.enterprise.utils.UserDetailUtils;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/wm-mall-store")
public class WmMallStoreController {
private final static Logger LOGGER = LogManager.getLogger(WmMallStoreController.class);
@Autowired
private WmStoreApiService wmStoreApiService;
@RequestMapping("/save-wm-store")
public RestResponse save(WmStoreDTO dto) {
dto.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
return OperationResultUtils.operationResult(wmStoreApiService.saveWmStore(dto),
OperationResultUtils.LOG_NEW + "微盟商城店铺", dto.getWmPidName());
}
@RequestMapping("/edit-wm-store")
public RestResponse edit(WmStoreDTO dto) {
return OperationResultUtils.operationResult(wmStoreApiService.modifyWmStore(dto),
OperationResultUtils.LOG_EDIT + "微盟商城店铺", dto.getWmPidName());
}
@RequestMapping("/get-wm-store-detail")
public RestResponse getDetail(Integer wmMallStoreId) {
return ResultControllerUtils.commonResult(wmStoreApiService.getWmStoreByWmMallStoreId(wmMallStoreId));
}
@RequestMapping("/list-wm-store")
public RestResponse listWmStore() {
return ResultControllerUtils
.commonResult(wmStoreApiService.listWmStore(UserDetailUtils.getUserDetail().getEnterpriseId()));
}
/**
* 授权
* @Title: authWmStore

* @Description:

* @author guojuxing
* @param wmMallStoreId

* @return com.gic.commons.webapi.reponse.RestResponse


*/
@RequestMapping("/auth-wm-store")
public RestResponse authWmStore(Integer wmMallStoreId) {
ServiceResponse<String> result = wmStoreApiService.authWmStore(wmMallStoreId);
return OperationResultUtils.operationResult(result, "授权微盟商城店铺",
OperationResultUtils.getOperationObject(result));
}
@RequestMapping("/list-mall-mode")
public RestResponse listMallMode() {
Map<String, String> result = new HashMap<>(16);
for (MallModeEnum modeEnum : MallModeEnum.values()) {
result.put(String.valueOf(modeEnum.getCode()), modeEnum.getMsg());
}
return RestResponse.success(result);
}
}
......@@ -111,6 +111,7 @@
<dubbo:reference interface="com.gic.open.api.service.market.MarketUserApiService" id="marketUserApiService" timeout="6000" />
<dubbo:reference interface="com.gic.enterprise.service.ProjectItemApiService" id="projectItemApiService" timeout="6000"/>
<dubbo:reference interface="com.gic.enterprise.service.WmStoreApiService" id="wmStoreApiService" timeout="6000"/>
<dubbo:reference interface="com.gic.marketing.api.service.coupon.CouponShelfApiService" id="couponShelfApiService" timeout="6000"/>
......
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