Commit 52f8a8f8 by zhiwj

导购区号

parent 4905d711
......@@ -17,6 +17,8 @@ public interface Constants {
// 小程序默认图片
String DEFAULT_PHOTO = "https://pic01-10001430.image.myqcloud.com/a5a82c47-5892-4c1c-afaf-0f8d4d41e032";
String NATIONCODE = "086";
String NATIONCODE = "+86";
String NATION_CODE_DICT = "NATION_CODE";
}
package com.gic.store.dto;
import java.io.Serializable;
import java.util.Date;
/**
* @author zhiwj
* @Description:
* @date 2020-03-26 15:08
*/
public class GicDictDTO implements Serializable {
private static final long serialVersionUID = -573633208657720956L;
/**
*
*/
private String dictId;
/**
* 01:推送方式(IM,SMS,WEB,MOBILE,EMAIL)
02:消息编码
03:接口编码
*/
private String dictType;
/**
* 字典code
*/
private String dictCode;
/**
*
*/
private String dictValue;
/**
*
*/
private String dictName;
/**
* 1:开启,0:关闭
*/
private Integer dictStatus;
/**
*
*/
private Date createDate;
/**
*
*/
private Integer dictSort;
public String getDictId() {
return dictId;
}
public void setDictId(String dictId) {
this.dictId = dictId;
}
public String getDictType() {
return dictType;
}
public void setDictType(String dictType) {
this.dictType = dictType;
}
public String getDictCode() {
return dictCode;
}
public void setDictCode(String dictCode) {
this.dictCode = dictCode;
}
public String getDictValue() {
return dictValue;
}
public void setDictValue(String dictValue) {
this.dictValue = dictValue;
}
public String getDictName() {
return dictName;
}
public void setDictName(String dictName) {
this.dictName = dictName;
}
public Integer getDictStatus() {
return dictStatus;
}
public void setDictStatus(Integer dictStatus) {
this.dictStatus = dictStatus;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Integer getDictSort() {
return dictSort;
}
public void setDictSort(Integer dictSort) {
this.dictSort = dictSort;
}
}
package com.gic.store.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.store.dto.GicDictDTO;
/**
* @author zhiwj
* @Description:
* @date 2020-03-26 15:07
*/
public interface DictApiService {
/**
* @Title: getDictByCode
* @Description:
* @author zhiwj
* @return com.gic.store.entity.TabGicDict
* @throws
*/
ServiceResponse<GicDictDTO> getDictByCode(String dictType, String dictValue);
}
package com.gic.store.dao.mapper;
import com.gic.store.entity.TabGicDict;
import org.apache.ibatis.annotations.Param;
public interface DictMapper {
/**
* 根据主键删除
*
* @param dictId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(String dictId);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabGicDict record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabGicDict record);
/**
* 根据主键查询
*
* @param dictId 主键
* @return 实体对象
*/
TabGicDict selectByPrimaryKey(String dictId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabGicDict record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabGicDict record);
TabGicDict getDictByCode(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
}
\ No newline at end of file
package com.gic.store.entity;
import java.util.Date;
/**
* tab_gic_dict
*/
public class TabGicDict {
/**
*
*/
private String dictId;
/**
* 01:推送方式(IM,SMS,WEB,MOBILE,EMAIL) 02:消息编码 03:接口编码
*/
private String dictType;
/**
* 字典code
*/
private String dictCode;
/**
*
*/
private String dictValue;
/**
*
*/
private String dictName;
/**
* 1:开启,0:关闭
*/
private Integer dictStatus;
/**
*
*/
private Date createDate;
/**
*
*/
private Integer dictSort;
public String getDictId() {
return dictId;
}
public void setDictId(String dictId) {
this.dictId = dictId;
}
public String getDictType() {
return dictType;
}
public void setDictType(String dictType) {
this.dictType = dictType;
}
public String getDictCode() {
return dictCode;
}
public void setDictCode(String dictCode) {
this.dictCode = dictCode;
}
public String getDictValue() {
return dictValue;
}
public void setDictValue(String dictValue) {
this.dictValue = dictValue;
}
public String getDictName() {
return dictName;
}
public void setDictName(String dictName) {
this.dictName = dictName;
}
public Integer getDictStatus() {
return dictStatus;
}
public void setDictStatus(Integer dictStatus) {
this.dictStatus = dictStatus;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Integer getDictSort() {
return dictSort;
}
public void setDictSort(Integer dictSort) {
this.dictSort = dictSort;
}
}
\ No newline at end of file
package com.gic.store.service;
import com.gic.store.entity.TabGicDict;
/**
* @author zhiwj
* @Description:
* @date 2020-03-26 15:04
*/
public interface DictService {
/**
* @Title: getDictByCode
* @Description:
* @author zhiwj
* @return com.gic.store.entity.TabGicDict
* @throws
*/
TabGicDict getDictByCode(String dictType, String dictValue);
}
package com.gic.store.service.impl;
import com.gic.store.dao.mapper.DictMapper;
import com.gic.store.entity.TabGicDict;
import com.gic.store.service.DictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author zhiwj
* @Description:
* @date 2020-03-26 15:04
*/
@Service
public class DictServiceImpl implements DictService {
@Autowired
private DictMapper dictMapper;
@Override
public TabGicDict getDictByCode(String dictType, String dictValue) {
return dictMapper.getDictByCode(dictType, dictValue);
}
}
package com.gic.store.service.outer.impl;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.response.EnterpriseServiceResponse;
import com.gic.store.dto.GicDictDTO;
import com.gic.store.entity.TabGicDict;
import com.gic.store.service.DictApiService;
import com.gic.store.service.DictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author zhiwj
* @Description:
* @date 2020-03-26 15:11
*/
@Service("dictApiService")
public class DictApiServiceImpl implements DictApiService {
@Autowired
private DictService dictService;
@Override
public ServiceResponse<GicDictDTO> getDictByCode(String dictType, String dictValue) {
TabGicDict dict = dictService.getDictByCode(dictType, dictValue);
GicDictDTO gicDictDTO = EntityUtil.changeEntityByJSON(GicDictDTO.class, dict);
return EnterpriseServiceResponse.success(gicDictDTO);
}
}
......@@ -63,4 +63,5 @@
<dubbo:service interface="com.gic.store.service.StoreTagApiService" ref="storeTagApiService" timeout="6000" />
<dubbo:service interface="com.gic.store.service.StoreTagTmpApiService" ref="storeTagTmpApiService" timeout="6000" />
<dubbo:service interface="com.gic.store.service.StoreOpenApiService" ref="storeOpenApiService" timeout="6000" />
<dubbo:service interface="com.gic.store.service.DictApiService" ref="dictApiService" timeout="6000" />
</beans>
<?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.store.dao.mapper.DictMapper">
<resultMap id="BaseResultMap" type="com.gic.store.entity.TabGicDict">
<id column="DICT_ID" jdbcType="CHAR" property="dictId" />
<result column="DICT_TYPE" jdbcType="VARCHAR" property="dictType" />
<result column="DICT_CODE" jdbcType="VARCHAR" property="dictCode" />
<result column="DICT_VALUE" jdbcType="VARCHAR" property="dictValue" />
<result column="DICT_NAME" jdbcType="VARCHAR" property="dictName" />
<result column="DICT_STATUS" jdbcType="INTEGER" property="dictStatus" />
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
<result column="DICT_SORT" jdbcType="INTEGER" property="dictSort" />
</resultMap>
<sql id="Base_Column_List">
DICT_ID, DICT_TYPE, DICT_CODE, DICT_VALUE, DICT_NAME, DICT_STATUS, CREATE_DATE, DICT_SORT
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_gic_dict
where DICT_ID = #{dictId,jdbcType=CHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tab_gic_dict
where DICT_ID = #{dictId,jdbcType=CHAR}
</delete>
<insert id="insert" parameterType="com.gic.store.entity.TabGicDict">
insert into tab_gic_dict (DICT_ID, DICT_TYPE, DICT_CODE,
DICT_VALUE, DICT_NAME, DICT_STATUS,
CREATE_DATE, DICT_SORT)
values (#{dictId,jdbcType=CHAR}, #{dictType,jdbcType=VARCHAR}, #{dictCode,jdbcType=VARCHAR},
#{dictValue,jdbcType=VARCHAR}, #{dictName,jdbcType=VARCHAR}, #{dictStatus,jdbcType=INTEGER},
#{createDate,jdbcType=TIMESTAMP}, #{dictSort,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.store.entity.TabGicDict">
insert into tab_gic_dict
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dictId != null">
DICT_ID,
</if>
<if test="dictType != null">
DICT_TYPE,
</if>
<if test="dictCode != null">
DICT_CODE,
</if>
<if test="dictValue != null">
DICT_VALUE,
</if>
<if test="dictName != null">
DICT_NAME,
</if>
<if test="dictStatus != null">
DICT_STATUS,
</if>
<if test="createDate != null">
CREATE_DATE,
</if>
<if test="dictSort != null">
DICT_SORT,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dictId != null">
#{dictId,jdbcType=CHAR},
</if>
<if test="dictType != null">
#{dictType,jdbcType=VARCHAR},
</if>
<if test="dictCode != null">
#{dictCode,jdbcType=VARCHAR},
</if>
<if test="dictValue != null">
#{dictValue,jdbcType=VARCHAR},
</if>
<if test="dictName != null">
#{dictName,jdbcType=VARCHAR},
</if>
<if test="dictStatus != null">
#{dictStatus,jdbcType=INTEGER},
</if>
<if test="createDate != null">
#{createDate,jdbcType=TIMESTAMP},
</if>
<if test="dictSort != null">
#{dictSort,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.store.entity.TabGicDict">
update tab_gic_dict
<set>
<if test="dictType != null">
DICT_TYPE = #{dictType,jdbcType=VARCHAR},
</if>
<if test="dictCode != null">
DICT_CODE = #{dictCode,jdbcType=VARCHAR},
</if>
<if test="dictValue != null">
DICT_VALUE = #{dictValue,jdbcType=VARCHAR},
</if>
<if test="dictName != null">
DICT_NAME = #{dictName,jdbcType=VARCHAR},
</if>
<if test="dictStatus != null">
DICT_STATUS = #{dictStatus,jdbcType=INTEGER},
</if>
<if test="createDate != null">
CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
</if>
<if test="dictSort != null">
DICT_SORT = #{dictSort,jdbcType=INTEGER},
</if>
</set>
where DICT_ID = #{dictId,jdbcType=CHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.store.entity.TabGicDict">
update tab_gic_dict
set DICT_TYPE = #{dictType,jdbcType=VARCHAR},
DICT_CODE = #{dictCode,jdbcType=VARCHAR},
DICT_VALUE = #{dictValue,jdbcType=VARCHAR},
DICT_NAME = #{dictName,jdbcType=VARCHAR},
DICT_STATUS = #{dictStatus,jdbcType=INTEGER},
CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
DICT_SORT = #{dictSort,jdbcType=INTEGER}
where DICT_ID = #{dictId,jdbcType=CHAR}
</update>
<select id="getDictByCode" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_gic_dict
where
dict_type = #{dictType} and dict_value = #{dictValue}
</select>
</mapper>
\ No newline at end of file
......@@ -6,12 +6,15 @@ import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.download.utils.log.LogUtils;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.store.constant.Constants;
import com.gic.store.constant.GenderEnum;
import com.gic.store.constant.StoreImportEnum;
import com.gic.store.constant.StoreOwnTypeEnum;
import com.gic.store.dto.ClerkTmpDTO;
import com.gic.store.dto.GicDictDTO;
import com.gic.store.dto.StoreDTO;
import com.gic.store.service.ClerkImportApiService;
import com.gic.store.service.DictApiService;
import com.gic.store.service.StoreApiService;
import com.gic.store.web.qo.PageQO;
import com.gic.store.web.utils.ExcelUtils;
......@@ -47,6 +50,8 @@ public class ClerkImportController {
@Autowired
private StoreApiService storeApiService;
@Autowired
private DictApiService dictApiService;
/**
* 下载模板
......@@ -345,9 +350,12 @@ public class ClerkImportController {
// 验证区号
String nationcode = row.get(7);
if (StringUtils.isBlank(nationcode)) {
nationcode = "086";
nationcode = "+86";
}
nationcode = nationcode.trim();
if ('+' != nationcode.charAt(0)) {
nationcode = "+" + nationcode;
}
bean.setNationcode(nationcode);
if (validate) {
if (this.lengthValidate(nationcode, 10)) {
......@@ -355,6 +363,12 @@ public class ClerkImportController {
validate = false;
}
}
GicDictDTO dict = this.dictApiService.getDictByCode(Constants.NATION_CODE_DICT, nationcode).getResult();
if (dict != null) {
bean.setErrorMessage("区号错误");
validate = false;
}
// 验证手机号
String phoneNumber = row.get(8);
bean.setPhoneNumber(phoneNumber);
......
......@@ -59,4 +59,5 @@
<dubbo:reference interface="com.gic.member.api.service.StoreUpdateApiService" id="storeUpdateApiService" timeout="6000"/>
<dubbo:reference interface="com.gic.enterprise.service.AuditLogApiService" id="auditLogApiService" timeout="6000"/>
<dubbo:reference interface="com.gic.store.service.DictApiService" id="dictApiService" timeout="6000"/>
</beans>
\ No newline at end of file
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