diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java index bfd440f5c0..29a7dcda6b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java @@ -156,5 +156,8 @@ public interface Constant { * gov_footbar_pattern * 后缀 */ - String FOOTBAR_PATTERN_KEY_SUFFIX="footbar_pattern"; + String FOOTBAR_PATTERN_KEY_SUFFIX="_footbar_pattern"; + // resi_footbar_highlight_num + // gov_footbar_highlight_num + String FOOTBAR_HIGHLIGHT_NUM="_footbar_highlight_num"; } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java index ce186bfffc..d9eea40501 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java @@ -30,4 +30,6 @@ public interface DataSourceConstant { String DATA_STATISTICAL="datastatistical"; String EVALUATION_INDEX = "evaluationIndex"; + + String OPERCUSTOMIZE="opercustomize"; } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/app/form/AppFootBarFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/app/form/AppFootBarFormDTO.java new file mode 100644 index 0000000000..922b136d2d --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/app/form/AppFootBarFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dataaggre.dto.app.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 查询底部footBar信息(两端通用) + * + * @author yinzuomei@elink-cn.com + * @date 2021/7/27 18:54 + */ +@Data +public class AppFootBarFormDTO implements Serializable { + public interface AddUserInternalGroup {} + /** + * 产品配置:default; 客户定制化里面就传客户id + */ + @NotBlank(message = "customerId不能为空",groups = AddUserInternalGroup.class) + private String customerId; + /** + * 工作端:gov;居民端resi + */ + @NotBlank(message = "appType不能为空",groups = AddUserInternalGroup.class) + private String appType; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/app/result/AppFootBarResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/app/result/AppFootBarResultDTO.java new file mode 100644 index 0000000000..a516aa1bf8 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/app/result/AppFootBarResultDTO.java @@ -0,0 +1,39 @@ +package com.epmet.dataaggre.dto.app.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 查询底部footBar信息(两端通用) + * + * @author yinzuomei@elink-cn.com + * @date 2021/7/27 19:00 + */ +@Data +public class AppFootBarResultDTO implements Serializable { + private static final long serialVersionUID = -2219461245919203814L; + + /** + * 水平:flat;浮起:float + */ + private String pattern; + /** + * 默认返回0,如果是浮起模式且是奇数,返回是footBarList的索引 + */ + private Integer highLightNum; + + + private List footBarList; + + /** + * 是否是奇数,true:是奇数 + */ + private Boolean isOddNum; + + /** + * 是否都上传了图标,true:都上传了 + */ + private Boolean bothUploaded; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/app/result/CustomerFootBarDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/app/result/CustomerFootBarDTO.java new file mode 100644 index 0000000000..b324bb755e --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/app/result/CustomerFootBarDTO.java @@ -0,0 +1,49 @@ +package com.epmet.dataaggre.dto.app.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 查询底部footBar信息(两端通用) + * + * @author yinzuomei@elink-cn.com + * @date 2021/7/27 19:01 + */ +@Data +public class CustomerFootBarDTO implements Serializable { + /** + * KEY + */ + private String barKey; + + /** + * bar名称 + */ + private String barName; + + /** + * 页面标题 + */ + private String pageTitle; + + /** + * 图标路径 + */ + private String iconPath; + + /** + * 选中页面图标路径 + */ + private String selectedIconPath; + + /** + * 凸起时图标路径 + */ + private String floatIconPath; + + /** + * 客户id + */ + private String customerId; +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/pom.xml b/epmet-module/data-aggregator/data-aggregator-server/pom.xml index f075b3c427..6c2a9d38c6 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/pom.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/pom.xml @@ -171,6 +171,11 @@ epmet_evaluation_index_user EpmEt-db-UsEr + + + + epmet_oper_customize_user + EpmEt-db-UsEr 0 192.168.1.140 @@ -266,6 +271,12 @@ epmet_evaluation_index_user EpmEt-db-UsEr + + + + epmet_oper_customize_user + EpmEt-db-UsEr + 0 192.168.1.140 @@ -361,6 +372,12 @@ epmet elink@833066 + + + + epmet + elink@833066 + 0 r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com @@ -456,6 +473,12 @@ epmet_evaluation_index_user EpmEt-db-UsEr + + + + epmet_oper_customize_user + EpmEt-db-UsEr + 0 r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/AppController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/AppController.java new file mode 100644 index 0000000000..b5606a747e --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/AppController.java @@ -0,0 +1,40 @@ +package com.epmet.dataaggre.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dataaggre.dto.app.form.AppFootBarFormDTO; +import com.epmet.dataaggre.dto.app.result.AppFootBarResultDTO; +import com.epmet.dataaggre.service.opercustomize.CustomerFootBarService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 小程序相关配置,可以放在这,目前只放了footbar + * + * @author yinzuomei@elink-cn.com + * @date 2021/7/27 18:36 + */ +@RestController +@RequestMapping("app") +public class AppController { + @Autowired + private CustomerFootBarService customerFootBarService; + + /** + * 查询底部footBar信息(两端通用) + * + * @param footBarFormDTO + * @return com.epmet.dataaggre.dto.app.result.AppFootBarResultDTO + * @author yinzuomei + * @date 2021/7/27 18:59 + */ + @PostMapping("footbars") + public Result queryAppFootBars(@RequestBody AppFootBarFormDTO footBarFormDTO){ + ValidatorUtils.validateEntity(footBarFormDTO,AppFootBarFormDTO.AddUserInternalGroup.class); + AppFootBarResultDTO resultDTO=customerFootBarService.queryAppFootBars(footBarFormDTO); + return new Result().ok(resultDTO); + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercrm/CustomerParameterDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercrm/CustomerParameterDao.java new file mode 100644 index 0000000000..c18293dfce --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercrm/CustomerParameterDao.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.dao.opercrm; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.entity.opercrm.CustomerParameterEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 客户配置表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-27 + */ +@Mapper +public interface CustomerParameterDao extends BaseDao { + /** + * 根据参数key查询 + * + * @param parameterKey + * @param customerId + * @return java.lang.String + * @author yinzuomei + * @date 2021/7/27 17:07 + */ + CustomerParameterEntity selectByParameterKey(@Param("parameterKey")String parameterKey, @Param("customerId")String customerId); +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercustomize/CustomerFootBarDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercustomize/CustomerFootBarDao.java new file mode 100644 index 0000000000..523d6596dd --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercustomize/CustomerFootBarDao.java @@ -0,0 +1,38 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.dao.opercustomize; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.app.result.CustomerFootBarDTO; +import com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * APP底部菜单栏信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-27 + */ +@Mapper +public interface CustomerFootBarDao extends BaseDao { + + List selectAppFootBars(@Param("customerId") String customerId, @Param("appType") String appType); +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/opercrm/CustomerParameterEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/opercrm/CustomerParameterEntity.java new file mode 100644 index 0000000000..3ab50da4eb --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/opercrm/CustomerParameterEntity.java @@ -0,0 +1,68 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.entity.opercrm; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 客户配置表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_parameter") +public class CustomerParameterEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 参数KEY值(发短信:send_msg;) + */ + private String parameterKey; + + /** + * 参数名称(短信) + */ + private String parameterName; + + /** + * 参数开关:开启:on,关闭:off + */ + private String parameterSwitch; + + /** + * 参数VALUE值 + */ + private String parameterValue; + + /** + * 说明 + */ + private String description; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/opercustomize/CustomerFootBarEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/opercustomize/CustomerFootBarEntity.java new file mode 100644 index 0000000000..ba743511e9 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/opercustomize/CustomerFootBarEntity.java @@ -0,0 +1,88 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.entity.opercustomize; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * APP底部菜单栏信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_foot_bar") +public class CustomerFootBarEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 工作端:gov居民端:resi + */ + private String appType; + + /** + * KEY + */ + private String barKey; + + /** + * bar名称 + */ + private String barName; + + /** + * 页面标题 + */ + private String pageTitle; + + /** + * 图标路径 + */ + private String iconPath; + + /** + * 选中页面图标路径 + */ + private String selectedIconPath; + + /** + * 凸起时图标路径 + */ + private String floatIconPath; + + /** + * 是否显示。1:显示,0:隐藏 + */ + private Integer display; + + /** + * 排序 + */ + private Integer orderIndex; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerParameterService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerParameterService.java new file mode 100644 index 0000000000..2ed5791a12 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerParameterService.java @@ -0,0 +1,34 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.service.opercrm; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dataaggre.entity.opercrm.CustomerParameterEntity; + +/** + * 客户配置表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-27 + */ +public interface CustomerParameterService extends BaseService { + + CustomerParameterEntity queryFootBarPattern(String customerId, String appType); + + CustomerParameterEntity queryFootBarHighLightNum(String customerId, String appType); +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerParameterServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerParameterServiceImpl.java new file mode 100644 index 0000000000..4a9a3f342d --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerParameterServiceImpl.java @@ -0,0 +1,60 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.service.opercrm.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.Constant; +import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.dao.opercrm.CustomerParameterDao; +import com.epmet.dataaggre.entity.opercrm.CustomerParameterEntity; +import com.epmet.dataaggre.service.opercrm.CustomerParameterService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * 客户配置表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-27 + */ +@DataSource(DataSourceConstant.OPER_CRM) +@Slf4j +@Service +public class CustomerParameterServiceImpl extends BaseServiceImpl implements CustomerParameterService { + + @Override + public CustomerParameterEntity queryFootBarPattern(String customerId, String appType) { + String parameterKey=appType.concat(Constant.FOOTBAR_PATTERN_KEY_SUFFIX); + CustomerParameterEntity pattern=baseDao.selectByParameterKey(parameterKey,customerId); + if(null ==pattern){ + pattern=baseDao.selectByParameterKey(parameterKey, Constant.DEFAULT_CUSTOMER); + } + return pattern; + } + + @Override + public CustomerParameterEntity queryFootBarHighLightNum(String customerId, String appType) { + String parameterKey=appType.concat(Constant.FOOTBAR_HIGHLIGHT_NUM); + CustomerParameterEntity entity=baseDao.selectByParameterKey(parameterKey,customerId); + if(null ==entity){ + entity=baseDao.selectByParameterKey(parameterKey, Constant.DEFAULT_CUSTOMER); + } + return entity; + } +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/CustomerFootBarService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/CustomerFootBarService.java new file mode 100644 index 0000000000..b185b9746a --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/CustomerFootBarService.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.service.opercustomize; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dataaggre.dto.app.form.AppFootBarFormDTO; +import com.epmet.dataaggre.dto.app.result.AppFootBarResultDTO; +import com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity; + +/** + * APP底部菜单栏信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-27 + */ +public interface CustomerFootBarService extends BaseService { + + /** + * 查询底部footBar信息(两端通用) + * + * @param footBarFormDTO + * @return com.epmet.dataaggre.dto.app.result.AppFootBarResultDTO + * @author yinzuomei + * @date 2021/7/27 18:59 + */ + AppFootBarResultDTO queryAppFootBars(AppFootBarFormDTO footBarFormDTO); +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/impl/CustomerFootBarServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/impl/CustomerFootBarServiceImpl.java new file mode 100644 index 0000000000..efe1325d5a --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/impl/CustomerFootBarServiceImpl.java @@ -0,0 +1,107 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.service.opercustomize.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.dao.opercustomize.CustomerFootBarDao; +import com.epmet.dataaggre.dto.app.form.AppFootBarFormDTO; +import com.epmet.dataaggre.dto.app.result.AppFootBarResultDTO; +import com.epmet.dataaggre.dto.app.result.CustomerFootBarDTO; +import com.epmet.dataaggre.entity.opercrm.CustomerParameterEntity; +import com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity; +import com.epmet.dataaggre.service.opercrm.CustomerParameterService; +import com.epmet.dataaggre.service.opercustomize.CustomerFootBarService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.List; + + +/** + * APP底部菜单栏信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-27 + */ +@DataSource(DataSourceConstant.OPERCUSTOMIZE) +@Slf4j +@Service +public class CustomerFootBarServiceImpl extends BaseServiceImpl implements CustomerFootBarService { + + @Autowired + private CustomerParameterService customerParameterService; + + /** + * 查询底部footBar信息(两端通用) + * + * @param footBarFormDTO + * @return com.epmet.dataaggre.dto.app.result.AppFootBarResultDTO + * @author yinzuomei + * @date 2021/7/27 18:59 + */ + @Override + public AppFootBarResultDTO queryAppFootBars(AppFootBarFormDTO footBarFormDTO) { + AppFootBarResultDTO resultDTO = new AppFootBarResultDTO(); + resultDTO.setPattern(Constant.FOOT_BAR_FLAT); + resultDTO.setHighLightNum(NumConstant.ZERO); + // 1、查询客户的模式,没有返回产品默认的;*水平:flat;浮起:float + CustomerParameterEntity patternEntity = customerParameterService.queryFootBarPattern(footBarFormDTO.getCustomerId(), footBarFormDTO.getAppType()); + // 2、查询客户设置的第几个,没有默认返回0, + CustomerParameterEntity highLightNumEntity = customerParameterService.queryFootBarHighLightNum(footBarFormDTO.getCustomerId(), footBarFormDTO.getAppType()); + // todo 这个sql需要修改 + List footBarList = baseDao.selectAppFootBars(footBarFormDTO.getCustomerId(), footBarFormDTO.getAppType()); + if (CollectionUtils.isEmpty(footBarList)) { + footBarList = baseDao.selectAppFootBars(Constant.DEFAULT_CUSTOMER, footBarFormDTO.getAppType()); + } + if (footBarList.size() % NumConstant.TWO == 0) { + resultDTO.setIsOddNum(false); + } else { + resultDTO.setIsOddNum(true); + } + //避免产品默认的没有上传全图标 + resultDTO.setBothUploaded(true); + for (CustomerFootBarDTO entity : footBarList) { + if (StringUtils.isBlank(entity.getIconPath()) + || StringUtils.isBlank(entity.getSelectedIconPath()) + || StringUtils.isBlank(entity.getFloatIconPath())) { + resultDTO.setBothUploaded(false); + break; + } + } + //只有客户选择的浮起+奇数+全部上传了图标才返回pattern=flat + if (resultDTO.getIsOddNum() && resultDTO.getBothUploaded() && Constant.FOOT_BAR_FLOAT.equals(patternEntity.getParameterValue())) { + resultDTO.setPattern(Constant.FOOT_BAR_FLOAT); + //返回 + resultDTO.setHighLightNum(footBarList.size() / NumConstant.TWO); + } else { + resultDTO.setPattern(Constant.FOOT_BAR_FLAT); + resultDTO.setHighLightNum(Integer.valueOf(highLightNumEntity.getParameterValue())); + } + //如果是浮起模式且是奇数,返回是footBarList的索引 + resultDTO.setFootBarList(footBarList); + return resultDTO; + } + +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml index ab888fc91c..98ff885e99 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml @@ -139,6 +139,11 @@ dynamic: url: @datasource.druid.evaluationIndex.url@ username: @datasource.druid.evaluationIndex.username@ password: @datasource.druid.evaluationIndex.password@ + opercustomize: + driver-class-name: com.mysql.cj.jdbc.Driver + url: @datasource.druid.opercustomize.url@ + username: @datasource.druid.opercustomize.username@ + password: @datasource.druid.opercustomize.password@ feign: hystrix: enabled: true diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerParameterDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerParameterDao.xml new file mode 100644 index 0000000000..63decd801e --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerParameterDao.xml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercustomize/CustomerFootBarDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercustomize/CustomerFootBarDao.xml new file mode 100644 index 0000000000..7cedd54a32 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercustomize/CustomerFootBarDao.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerParameterServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerParameterServiceImpl.java index ee33bb7457..714dbcbf79 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerParameterServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerParameterServiceImpl.java @@ -1,7 +1,6 @@ package com.epmet.service.impl; import com.epmet.commons.tools.constant.Constant; -import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.CustomerParameterDao; @@ -21,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.List; @@ -82,10 +80,10 @@ public class CustomerParameterServiceImpl implements CustomerParameterService { */ @Override public FootBarPatternQueryResultDTO queryFootBarPattern(FootBarPatternQueryFormDTO formDTO) { - String parameterKey=formDTO.getAppType().concat(StrConstant.UNDER_LINE).concat(Constant.FOOTBAR_PATTERN_KEY_SUFFIX); + String parameterKey=formDTO.getAppType().concat(Constant.FOOTBAR_PATTERN_KEY_SUFFIX); CustomerParameterEntity pattern=parameterDao.selectAppFootBarPattern(parameterKey,formDTO.getCustomerId()); - if(StringUtils.isEmpty(pattern)){ - pattern=parameterDao.selectAppFootBarPattern(parameterKey, Constant.DEFAULT_CUSTOMER); + if (null == pattern){ + pattern = parameterDao.selectAppFootBarPattern(parameterKey, Constant.DEFAULT_CUSTOMER); } FootBarPatternQueryResultDTO resultDTO=new FootBarPatternQueryResultDTO(); resultDTO.setPattern(pattern.getParameterValue()); @@ -125,7 +123,7 @@ public class CustomerParameterServiceImpl implements CustomerParameterService { } } //3、符合条件,更新或者插入 - String parameterKey = formDTO.getAppType().concat(StrConstant.UNDER_LINE).concat(Constant.FOOTBAR_PATTERN_KEY_SUFFIX); + String parameterKey = formDTO.getAppType().concat(Constant.FOOTBAR_PATTERN_KEY_SUFFIX); CustomerParameterEntity original = parameterDao.selectAppFootBarPattern(parameterKey, formDTO.getCustomerId()); if (null != original) { original.setParameterValue(formDTO.getPattern()); diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java index a3ff316f4a..1f74cc1ec1 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java @@ -14,6 +14,9 @@ public class CustomerFootBarFormDTO { // 创建footbar的分组 public interface CreateFootBarGroup extends CustomerClientShowGroup {} + //产品配置-添加footbar时,3个icon必填 + public interface DefaultCustomerCreateFootBarGroup extends CustomerClientShowGroup {} + // 查询footbar列表分组 public interface ListFootBarGroup extends CustomerClientShowGroup {} @@ -57,11 +60,13 @@ public class CustomerFootBarFormDTO { @NotBlank(message = "页面标题不能为空", groups = { CreateFootBarGroup.class, UpdateFootBarGroup.class }) private String pageTitle; - //@NotBlank(message = "图标路径不能为空", groups = { UpdateFootBarGroup.class }) + @NotBlank(message = "图标路径不能为空", groups = {DefaultCustomerCreateFootBarGroup.class}) private String iconPath; - //@NotBlank(message = "选中的图标路径不能为空", groups = { UpdateFootBarGroup.class }) + @NotBlank(message = "选中的图标路径不能为空", groups = {DefaultCustomerCreateFootBarGroup.class}) private String selectedIconPath; + @NotBlank(message = "浮起时图标不能为空", groups = {DefaultCustomerCreateFootBarGroup.class}) + private String floatIconPath; @NotEmpty(message = "顺序不能为空", groups = { SaveOrderGroup.class }) private List orderList; @@ -69,8 +74,6 @@ public class CustomerFootBarFormDTO { @NotNull(message = "显示状态不能为空", groups = { UpdateDisplayStatusGroup.class }) private Boolean display; - @NotBlank(message = "浮起时图标不能为空", groups = { CreateFootBarGroup.class, UpdateFootBarGroup.class }) - private String floatIconPath; /** * 排序索引号dto */ diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/NotOnlineFootBarFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/NotOnlineFootBarFormDTO.java new file mode 100644 index 0000000000..df703b403e --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/NotOnlineFootBarFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/7/28 9:39 + */ +@Data +public class NotOnlineFootBarFormDTO implements Serializable { + private static final long serialVersionUID = -4103181048360051521L; + @NotBlank(message = "客户id不能为空") + private String customerId; + @NotBlank(message = "appType不能为空") + private String appType; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFootBarResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFootBarResultDTO.java index 2341a3d5a1..373d5df5fa 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFootBarResultDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFootBarResultDTO.java @@ -68,6 +68,11 @@ public class CustomerFootBarResultDTO implements Serializable { */ private String selectedIconPath; + /** + * 浮起时图标 + */ + private String floatIconPath; + /** * 删除标识:0.未删除 1.已删除 */ @@ -105,11 +110,11 @@ public class CustomerFootBarResultDTO implements Serializable { private String defaultIconPath; private String defaultSelectedIconPath; + /** + * 浮起时图标-产品默认 + */ + private String defaultFloatIconPath; private String defaultPageTitle; - /** - * 浮起时图标 - */ - private String floatIconPath; } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java index 332d41aa99..a670f37aea 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java @@ -32,6 +32,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerFootBarDTO; import com.epmet.dto.form.CheckFloatFootBarFormDTO; import com.epmet.dto.form.CustomerFootBarFormDTO; +import com.epmet.dto.form.NotOnlineFootBarFormDTO; import com.epmet.dto.result.CheckFloatFootBarResultDTO; import com.epmet.dto.result.CustomerFootBarResultDTO; import com.epmet.entity.CustomerFootBarEntity; @@ -180,7 +181,7 @@ public class CustomerFootBarController { */ @PostMapping("createfootbar") public Result createFootBar(@RequestBody CustomerFootBarFormDTO form) { - ValidatorUtils.validateEntity(form, CustomerFootBarFormDTO.CreateFootBarGroup.class); + ValidatorUtils.validateEntity(form, CustomerFootBarFormDTO.CreateFootBarGroup.class, CustomerFootBarFormDTO.DefaultCustomerCreateFootBarGroup.class); customerFootBarService.createFootBar(form); return new Result(); } @@ -271,5 +272,35 @@ public class CustomerFootBarController { ValidatorUtils.validateEntity(formDTO); return new Result().ok(customerFootBarService.checkFloatFootBar(formDTO)); } + + /** + * 客户定制化-采集产品配置中,我没有的添加到当前客户 + * + * @param form + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/7/28 10:01 + */ + @PostMapping("createfootbar-customer") + public Result createFootBarCustomer(@RequestBody CustomerFootBarFormDTO form) { + ValidatorUtils.validateEntity(form, CustomerFootBarFormDTO.CreateFootBarGroup.class); + customerFootBarService.createFootBarCustomer(form); + return new Result(); + } + + /** + * 客户定制化-FootBar配置,获取当前客户未上线的 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @date 2021/7/28 9:47 + */ + @PostMapping("getNotOnlineFootBars") + public Result> getNotOnlineFootBars(@RequestBody NotOnlineFootBarFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return customerFootBarService.getNotOnlineFootBars(formDTO); + } + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java index 30fac6164c..b7d32e8a90 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java @@ -84,4 +84,15 @@ public interface CustomerFootBarDao extends BaseDao { void physicsDeleteById(@Param("id") String id); void physicsDeleteByAppTypeAndBarKey(@Param("appType") String appType, @Param("barKey") String barKey); + + /** + * 客户定制化-FootBar配置,获取当前客户未上线的 + * + * @param customerId + * @param appType + * @return java.util.List + * @author yinzuomei + * @date 2021/7/28 9:49 + */ + List selectNotOnlineFootBars(@Param("customerId") String customerId, @Param("appType")String appType); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java index fc690139a0..20cc992a37 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java @@ -19,9 +19,11 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerFootBarDTO; import com.epmet.dto.form.CheckFloatFootBarFormDTO; import com.epmet.dto.form.CustomerFootBarFormDTO; +import com.epmet.dto.form.NotOnlineFootBarFormDTO; import com.epmet.dto.result.CheckFloatFootBarResultDTO; import com.epmet.dto.result.CustomerFootBarResultDTO; import com.epmet.entity.CustomerFootBarEntity; @@ -127,4 +129,24 @@ public interface CustomerFootBarService extends BaseService> getNotOnlineFootBars(NotOnlineFootBarFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java index 70c3811466..25ff79c553 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java @@ -27,25 +27,25 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.CustomerFootBarDao; import com.epmet.dto.CustomerFootBarDTO; import com.epmet.dto.form.CheckFloatFootBarFormDTO; import com.epmet.dto.form.CustomerFootBarFormDTO; +import com.epmet.dto.form.NotOnlineFootBarFormDTO; import com.epmet.dto.result.CheckFloatFootBarResultDTO; import com.epmet.dto.result.CustomerFootBarResultDTO; import com.epmet.entity.CustomerFootBarEntity; import com.epmet.redis.CustomerFootBarRedis; import com.epmet.service.CustomerFootBarService; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import java.util.*; /** * APP底部菜单栏信息 @@ -139,9 +139,10 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl> getNotOnlineFootBars(NotOnlineFootBarFormDTO formDTO) { + String customerId = formDTO.getCustomerId(); + String appType = formDTO.getAppType(); + List footbars = baseDao.selectNotOnlineFootBars(customerId, appType); + List barDTOS=new ArrayList<>(); + footbars.forEach(defaultBar -> { + CustomerFootBarResultDTO barDTO = new CustomerFootBarResultDTO(); + BeanUtils.copyProperties(defaultBar, barDTO); + barDTO.setDefaultBarName(defaultBar.getBarName()); + barDTO.setDefaultIconPath(defaultBar.getIconPath()); + barDTO.setDefaultSelectedIconPath(defaultBar.getSelectedIconPath()); + barDTO.setDefaultFloatIconPath(defaultBar.getFloatIconPath()); + barDTO.setDefaultPageTitle(defaultBar.getPageTitle()); + barDTOS.add(barDTO); + }); + return new Result>().ok(barDTOS); + } } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml index 8ee7cedac8..7948081241 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml @@ -213,5 +213,25 @@ and BAR_NAME = #{barName} - + \ No newline at end of file