58 changed files with 1587 additions and 51 deletions
@ -0,0 +1,34 @@ |
|||||
|
package com.epmet.dataaggre.dto.govorg.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 描述一下 |
||||
|
* |
||||
|
* @author yinzuomei@elink-cn.com |
||||
|
* @date 2021/4/12 15:55 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class NextAreaCodeFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = -1974456701949979946L; |
||||
|
public interface AddUserInternalGroup { |
||||
|
} |
||||
|
@NotBlank(message = "parentAgencyId不能为空",groups = AddUserInternalGroup.class) |
||||
|
private String parentAgencyId; |
||||
|
|
||||
|
private String areaCode; |
||||
|
|
||||
|
/** |
||||
|
* 社区级:community, |
||||
|
* 乡(镇、街道)级:street, |
||||
|
* 区县级: district, |
||||
|
* 市级: city |
||||
|
* 省级:province |
||||
|
*/ |
||||
|
@NotBlank(message = "level不能为空",groups = AddUserInternalGroup.class) |
||||
|
private String level; |
||||
|
|
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package com.epmet.dataaggre.dto.govorg.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 描述一下 |
||||
|
* |
||||
|
* @author yinzuomei@elink-cn.com |
||||
|
* @date 2021/4/12 15:56 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class NextAreaCodeResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 9188265480821079966L; |
||||
|
|
||||
|
private String areaCode; |
||||
|
private String areaName; |
||||
|
/** |
||||
|
* 社区级:community, |
||||
|
* 乡(镇、街道)级:street, |
||||
|
* 区县级: district, |
||||
|
* 市级: city |
||||
|
* 省级:province |
||||
|
*/ |
||||
|
private String level; |
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dataaggre.dao.commonservice; |
||||
|
|
||||
|
import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-01-07 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface AreaCodeDao { |
||||
|
|
||||
|
List<NextAreaCodeResultDTO> selectCityList(String areaCode); |
||||
|
|
||||
|
List<NextAreaCodeResultDTO> selectDistrictList(String areaCode); |
||||
|
|
||||
|
List<NextAreaCodeResultDTO> selectStreetList(String areaCode); |
||||
|
|
||||
|
List<NextAreaCodeResultDTO> selectCommunityList(String areaCode); |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.epmet.dataaggre.dao.opercrm; |
||||
|
|
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 描述一下 |
||||
|
* |
||||
|
* @author yinzuomei@elink-cn.com |
||||
|
* @date 2021/4/13 10:43 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CustomerRelationDao { |
||||
|
List<String> selectUsedAreaCodeList(String areaCode); |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package com.epmet.dataaggre.service.commonservice; |
||||
|
|
||||
|
import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; |
||||
|
import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 描述一下 |
||||
|
* |
||||
|
* @author yinzuomei@elink-cn.com |
||||
|
* @date 2021/4/12 15:45 |
||||
|
*/ |
||||
|
public interface AreaCodeService { |
||||
|
/** |
||||
|
* @return java.util.List<com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO> |
||||
|
* @param formDTO |
||||
|
* @author yinzuomei |
||||
|
* @description 新增组织-查询下一级可选的组织区划 |
||||
|
* @Date 2021/4/12 16:02 |
||||
|
**/ |
||||
|
List<NextAreaCodeResultDTO> queryNextLevelAreaCodeList(NextAreaCodeFormDTO formDTO); |
||||
|
} |
@ -0,0 +1,78 @@ |
|||||
|
package com.epmet.dataaggre.service.commonservice.impl; |
||||
|
|
||||
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
||||
|
import com.epmet.dataaggre.constant.DataSourceConstant; |
||||
|
import com.epmet.dataaggre.dao.commonservice.AreaCodeDao; |
||||
|
import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; |
||||
|
import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO; |
||||
|
import com.epmet.dataaggre.service.commonservice.AreaCodeService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 描述一下 |
||||
|
* |
||||
|
* @author yinzuomei@elink-cn.com |
||||
|
* @date 2021/4/12 15:46 |
||||
|
*/ |
||||
|
@DataSource(DataSourceConstant.EPMET_COMMON_SERVICE) |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class AreaCodeServiceImpl implements AreaCodeService { |
||||
|
|
||||
|
@Autowired |
||||
|
private AreaCodeDao areaCodeDao; |
||||
|
|
||||
|
/** |
||||
|
* @param formDTO |
||||
|
* @return java.util.List<com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO> |
||||
|
* @author yinzuomei |
||||
|
* @description 新增组织-查询下一级可选的组织区划 |
||||
|
* @Date 2021/4/12 16:02 |
||||
|
**/ |
||||
|
@Override |
||||
|
public List<NextAreaCodeResultDTO> queryNextLevelAreaCodeList(NextAreaCodeFormDTO formDTO) { |
||||
|
List<NextAreaCodeResultDTO> list = new ArrayList<>(); |
||||
|
NextAreaCodeResultDTO other = new NextAreaCodeResultDTO(); |
||||
|
other.setAreaCode("other"); |
||||
|
other.setAreaName("其它"); |
||||
|
switch (formDTO.getLevel()) { |
||||
|
/** |
||||
|
* 社区级:community, |
||||
|
* 乡(镇、街道)级:street, |
||||
|
* 区县级: district, |
||||
|
* 市级: city |
||||
|
* 省级:province |
||||
|
*/ |
||||
|
case "province": |
||||
|
list = areaCodeDao.selectCityList(formDTO.getAreaCode()); |
||||
|
other.setLevel("city"); |
||||
|
break; |
||||
|
case "city": |
||||
|
list = areaCodeDao.selectDistrictList(formDTO.getAreaCode()); |
||||
|
other.setLevel("district"); |
||||
|
break; |
||||
|
case "district": |
||||
|
list = areaCodeDao.selectStreetList(formDTO.getAreaCode()); |
||||
|
other.setLevel("street"); |
||||
|
break; |
||||
|
case "street": |
||||
|
list = areaCodeDao.selectCommunityList(formDTO.getAreaCode()); |
||||
|
other.setLevel("community"); |
||||
|
break; |
||||
|
default: |
||||
|
} |
||||
|
if (CollectionUtils.isEmpty(list)) { |
||||
|
list = new ArrayList<>(); |
||||
|
} |
||||
|
if(!"province".equals(formDTO.getLevel())){ |
||||
|
list.add(other); |
||||
|
} |
||||
|
return list; |
||||
|
} |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package com.epmet.dataaggre.service.opercrm; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 描述一下 |
||||
|
* |
||||
|
* @author yinzuomei@elink-cn.com |
||||
|
* @date 2021/4/13 10:38 |
||||
|
*/ |
||||
|
public interface CustomerRelation { |
||||
|
List<String> selectUsedAreaCodeList(String areaCode); |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.epmet.dataaggre.service.opercrm.impl; |
||||
|
|
||||
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
||||
|
import com.epmet.dataaggre.constant.DataSourceConstant; |
||||
|
import com.epmet.dataaggre.dao.opercrm.CustomerRelationDao; |
||||
|
import com.epmet.dataaggre.service.opercrm.CustomerRelation; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 描述一下 |
||||
|
* |
||||
|
* @author yinzuomei@elink-cn.com |
||||
|
* @date 2021/4/13 10:38 |
||||
|
*/ |
||||
|
@DataSource(DataSourceConstant.OPER_CRM) |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class CustomerRelationImpl implements CustomerRelation { |
||||
|
@Autowired |
||||
|
private CustomerRelationDao customerRelationDao; |
||||
|
|
||||
|
@Override |
||||
|
public List<String> selectUsedAreaCodeList(String areaCode) { |
||||
|
return customerRelationDao.selectUsedAreaCodeList(areaCode); |
||||
|
} |
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
<?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.epmet.dataaggre.dao.commonservice.AreaCodeDao"> |
||||
|
|
||||
|
<select id="selectCityList" parameterType="java.lang.String" resultType="com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO"> |
||||
|
SELECT DISTINCT |
||||
|
ac.CITY_CODE AS areaCode, |
||||
|
ac.CITY_NAME AS areaName, |
||||
|
'city' LEVEL |
||||
|
FROM |
||||
|
area_code ac |
||||
|
WHERE |
||||
|
ac.DEL_FLAG='0' |
||||
|
and ac.PROVINCE_CODE = #{areaCode} |
||||
|
ORDER BY |
||||
|
ac.CITY_CODE ASC |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectDistrictList" parameterType="java.lang.String" resultType="com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO"> |
||||
|
SELECT DISTINCT |
||||
|
ac.COUNTY_CODE AS areaCode, |
||||
|
ac.COUNTY_NAME AS areaName, |
||||
|
'district' LEVEL |
||||
|
FROM |
||||
|
area_code ac |
||||
|
WHERE ac.DEL_FLAG='0' |
||||
|
and ac.CITY_CODE = #{areaCode} |
||||
|
ORDER BY |
||||
|
ac.COUNTY_CODE ASC |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectStreetList" parameterType="java.lang.String" resultType="com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO"> |
||||
|
SELECT DISTINCT CODE AS areaCode, |
||||
|
NAME AS areaName, |
||||
|
'street' AS LEVEL |
||||
|
FROM |
||||
|
area_code_child acc |
||||
|
WHERE |
||||
|
acc.DEL_FLAG = '0' |
||||
|
AND acc.P_CODE = #{areaCode} |
||||
|
order by acc.CODE ASC |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectCommunityList" parameterType="java.lang.String" resultType="com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO"> |
||||
|
SELECT DISTINCT CODE AS areaCode, |
||||
|
NAME AS areaName, |
||||
|
'community' AS LEVEL |
||||
|
FROM |
||||
|
area_code_child acc |
||||
|
WHERE |
||||
|
acc.DEL_FLAG = '0' |
||||
|
AND acc.P_CODE = #{areaCode} |
||||
|
ORDER BY |
||||
|
acc.CODE ASC |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,17 @@ |
|||||
|
<?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.epmet.dataaggre.dao.opercrm.CustomerRelationDao"> |
||||
|
|
||||
|
<select id="selectUsedAreaCodeList" parameterType="java.lang.String" resultType="java.lang.String"> |
||||
|
SELECT |
||||
|
cr.AREA_CODE |
||||
|
FROM |
||||
|
customer_relation cr |
||||
|
WHERE |
||||
|
cr.DEL_FLAG = '0' |
||||
|
and cr.CUSTOMER_TYPE='external' |
||||
|
AND cr.AREA_CODE LIKE concat(#{areaCode}, '%') |
||||
|
AND cr.AREA_CODE != #{areaCode} |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,27 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 描述一下 |
||||
|
* |
||||
|
* @author yinzuomei@elink-cn.com |
||||
|
* @date 2021/4/13 14:36 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class AddAreaCodeFormDTO implements Serializable { |
||||
|
|
||||
|
@NotBlank(message = "currentAreaLevel不能为空") |
||||
|
private String currentAreaLevel; |
||||
|
@NotBlank(message = "parentAreaCode不能为空") |
||||
|
private String parentAreaCode; |
||||
|
|
||||
|
/** |
||||
|
* 新增的街道或者社区名称 |
||||
|
*/ |
||||
|
@NotBlank(message = "name不能为空") |
||||
|
private String name; |
||||
|
} |
@ -0,0 +1,96 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户组织相关参数表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-04-12 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerOrgParameterDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 参数键 eg:area_code_switch |
||||
|
*/ |
||||
|
private String parameterKey; |
||||
|
|
||||
|
/** |
||||
|
* 参数名 eg:是否开启区域编码 |
||||
|
*/ |
||||
|
private String parameterName; |
||||
|
|
||||
|
/** |
||||
|
* 参数值 eg:开启:open;关闭:closed |
||||
|
*/ |
||||
|
private String parameterValue; |
||||
|
|
||||
|
/** |
||||
|
* 参数说明 eg:open:当前客户新增组织需要选择areaCode;closed: 无需选择区域编码 |
||||
|
*/ |
||||
|
private String description; |
||||
|
|
||||
|
/** |
||||
|
* 删除标志 0:未删除,1:已删除 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,90 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
||||
|
import lombok.Data; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 添加组织V2 |
||||
|
* |
||||
|
* @author yinzuomei@elink-cn.com |
||||
|
* @date 2021/4/13 11:08 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class AddAgencyV2FormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = -8951334902226679043L; |
||||
|
|
||||
|
public interface AddUserInternalGroup { |
||||
|
} |
||||
|
|
||||
|
public interface DefaultUserShowGroup extends CustomerClientShowGroup { |
||||
|
} |
||||
|
|
||||
|
public interface AreaCodeGroup extends CustomerClientShowGroup { |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@NotBlank(message = "上级组织ID不能为空", groups = AddUserInternalGroup.class) |
||||
|
private String parentAgencyId; |
||||
|
|
||||
|
/** |
||||
|
* 机构组织名称 |
||||
|
*/ |
||||
|
@NotBlank(message = "组织名称不能为空", groups = DefaultUserShowGroup.class) |
||||
|
@Length(max = 50, message = "组织名称不能超过50个字", groups = DefaultUserShowGroup.class) |
||||
|
private String agencyName; |
||||
|
|
||||
|
/** |
||||
|
* 机关级别(社区级:community, |
||||
|
* 乡(镇、街道)级:street, |
||||
|
* 区县级: district, |
||||
|
* 市级: city |
||||
|
* 省级:province) |
||||
|
*/ |
||||
|
@NotBlank(message = "组织级别不能为空;社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province", groups = AddUserInternalGroup.class) |
||||
|
private String level; |
||||
|
|
||||
|
/** |
||||
|
* open: 选择地区编码必填;closed: 无需选择地区编码;0409新增返参 |
||||
|
*/ |
||||
|
@NotBlank(message = "areaCodeSwitch不能为空", groups = AddUserInternalGroup.class) |
||||
|
private String areaCodeSwitch; |
||||
|
|
||||
|
/** |
||||
|
* 地区编码 |
||||
|
*/ |
||||
|
@NotBlank(message = "请选择组织区划", groups = AreaCodeGroup.class) |
||||
|
private String areaCode; |
||||
|
|
||||
|
// /**
|
||||
|
// * 省份
|
||||
|
// */
|
||||
|
// private String province;
|
||||
|
//
|
||||
|
// /**
|
||||
|
// * 城市
|
||||
|
// */
|
||||
|
// private String city;
|
||||
|
//
|
||||
|
// /**
|
||||
|
// * 区县
|
||||
|
// */
|
||||
|
// private String district;
|
||||
|
//
|
||||
|
// /**
|
||||
|
// * 街道
|
||||
|
// */
|
||||
|
// private String street;
|
||||
|
//
|
||||
|
// /**
|
||||
|
// * 社区
|
||||
|
// */
|
||||
|
// private String community;
|
||||
|
|
||||
|
//区域编码名称
|
||||
|
@NotBlank(message = "", groups = AreaCodeGroup.class) |
||||
|
private String areaName; |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CustomerOrgParameterEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
/** |
||||
|
* 客户组织相关参数表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-04-12 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CustomerOrgParameterDao extends BaseDao<CustomerOrgParameterEntity> { |
||||
|
|
||||
|
/** |
||||
|
* @return com.epmet.entity.CustomerOrgParameterEntity |
||||
|
* @param customerId |
||||
|
* @param parameterKey |
||||
|
* @author yinzuomei |
||||
|
* @description 根据customerId查询参数(area_code_switch)值 |
||||
|
* @Date 2021/4/12 14:26 |
||||
|
**/ |
||||
|
CustomerOrgParameterEntity selectByCustomerId(@Param("customerId") String customerId, @Param("parameterKey") String parameterKey); |
||||
|
} |
@ -0,0 +1,66 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 客户组织相关参数表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-04-12 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("customer_org_parameter") |
||||
|
public class CustomerOrgParameterEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 参数键 eg:area_code_switch |
||||
|
*/ |
||||
|
private String parameterKey; |
||||
|
|
||||
|
/** |
||||
|
* 参数名 eg:是否开启区域编码 |
||||
|
*/ |
||||
|
private String parameterName; |
||||
|
|
||||
|
/** |
||||
|
* 参数值 eg:开启:open;关闭:closed |
||||
|
*/ |
||||
|
private String parameterValue; |
||||
|
|
||||
|
/** |
||||
|
* 参数说明 eg:open:当前客户新增组织需要选择areaCode;closed: 无需选择区域编码 |
||||
|
*/ |
||||
|
private String description; |
||||
|
|
||||
|
} |
@ -0,0 +1,104 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.dto.CustomerOrgParameterDTO; |
||||
|
import com.epmet.entity.CustomerOrgParameterEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 客户组织相关参数表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-04-12 |
||||
|
*/ |
||||
|
public interface CustomerOrgParameterService extends BaseService<CustomerOrgParameterEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<CustomerOrgParameterDTO> |
||||
|
* @author generator |
||||
|
* @date 2021-04-12 |
||||
|
*/ |
||||
|
PageData<CustomerOrgParameterDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<CustomerOrgParameterDTO> |
||||
|
* @author generator |
||||
|
* @date 2021-04-12 |
||||
|
*/ |
||||
|
List<CustomerOrgParameterDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return CustomerOrgParameterDTO |
||||
|
* @author generator |
||||
|
* @date 2021-04-12 |
||||
|
*/ |
||||
|
CustomerOrgParameterDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2021-04-12 |
||||
|
*/ |
||||
|
void save(CustomerOrgParameterDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2021-04-12 |
||||
|
*/ |
||||
|
void update(CustomerOrgParameterDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2021-04-12 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
/** |
||||
|
* @return java.lang.String |
||||
|
* @param customerId |
||||
|
* @author yinzuomei |
||||
|
* @description 根据customerId查询参数(area_code_switch)值open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参;没配置,返回closed |
||||
|
* @Date 2021/4/12 14:23 |
||||
|
**/ |
||||
|
String getAreaCodeSwitch(String customerId); |
||||
|
} |
@ -0,0 +1,116 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.FieldConstant; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.constant.CustomerAgencyConstant; |
||||
|
import com.epmet.dao.CustomerOrgParameterDao; |
||||
|
import com.epmet.dto.CustomerOrgParameterDTO; |
||||
|
import com.epmet.entity.CustomerOrgParameterEntity; |
||||
|
import com.epmet.service.CustomerOrgParameterService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 客户组织相关参数表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-04-12 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CustomerOrgParameterServiceImpl extends BaseServiceImpl<CustomerOrgParameterDao, CustomerOrgParameterEntity> implements CustomerOrgParameterService { |
||||
|
|
||||
|
@Override |
||||
|
public PageData<CustomerOrgParameterDTO> page(Map<String, Object> params) { |
||||
|
IPage<CustomerOrgParameterEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, CustomerOrgParameterDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<CustomerOrgParameterDTO> list(Map<String, Object> params) { |
||||
|
List<CustomerOrgParameterEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, CustomerOrgParameterDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<CustomerOrgParameterEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<CustomerOrgParameterEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public CustomerOrgParameterDTO get(String id) { |
||||
|
CustomerOrgParameterEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, CustomerOrgParameterDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(CustomerOrgParameterDTO dto) { |
||||
|
CustomerOrgParameterEntity entity = ConvertUtils.sourceToTarget(dto, CustomerOrgParameterEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(CustomerOrgParameterDTO dto) { |
||||
|
CustomerOrgParameterEntity entity = ConvertUtils.sourceToTarget(dto, CustomerOrgParameterEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param customerId |
||||
|
* @return java.lang.String |
||||
|
* @author yinzuomei |
||||
|
* @description 根据customerId查询参数(area_code_switch)值open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参;没配置,返回closed |
||||
|
* @Date 2021/4/12 14:23 |
||||
|
**/ |
||||
|
@Override |
||||
|
public String getAreaCodeSwitch(String customerId) { |
||||
|
CustomerOrgParameterEntity entity = baseDao.selectByCustomerId(customerId, CustomerAgencyConstant.AREA_CODE_SWITCH); |
||||
|
if (null == entity || StringUtils.isBlank(entity.getParameterValue())) { |
||||
|
return CustomerAgencyConstant.AREA_CODE_SWITCH_CLOSED; |
||||
|
} |
||||
|
return entity.getParameterValue(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
<?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.epmet.dao.CustomerOrgParameterDao"> |
||||
|
|
||||
|
<select id="selectByCustomerId" parameterType="map" resultType="com.epmet.entity.CustomerOrgParameterEntity"> |
||||
|
select * |
||||
|
from customer_org_parameter p |
||||
|
where p.DEL_FLAG='0' |
||||
|
and p.CUSTOMER_ID=#{customerId} |
||||
|
and p.PARAMETER_KEY=#{parameterKey} |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue