From d372c147320e8875a54b5f156ca1922c1c7ac8b6 Mon Sep 17 00:00:00 2001 From: yangshaoping <123456> Date: Mon, 16 Mar 2020 14:51:29 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E9=85=8D=E7=BD=AE=E7=9A=84=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E7=A8=BF-=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/HomeDesignByCustomerFormDTO.java | 28 ++++++++++ .../CommonComponentDesignResultDTO.java | 50 +++++++++++++++++ .../result/HomeDesignByCustomerResultDTO.java | 37 ++++++++++++ .../com/epmet/controller/HomeController.java | 15 +++++ .../java/com/epmet/dao/CustomerHomeDao.java | 5 +- .../com/epmet/dao/CustomerHomeDetailDao.java | 2 +- .../epmet/dao/CustomerHomeTemplateDao.java | 2 +- .../java/com/epmet/service/HomeService.java | 11 ++++ .../epmet/service/impl/HomeServiceImpl.java | 56 ++++++++++++++++--- .../mapper/CustomerHomeDetailDao.xml | 32 +++++++++++ 10 files changed, 226 insertions(+), 12 deletions(-) create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignByCustomerFormDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CommonComponentDesignResultDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/HomeDesignByCustomerResultDTO.java diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignByCustomerFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignByCustomerFormDTO.java new file mode 100644 index 0000000000..fddbedad98 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignByCustomerFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 运营端-客户定制化服务-获取客户首页配置的设计稿-入参 + * @Author yangshaoping + * @Date 2020/3/16 11:27 + */ +@Data +public class HomeDesignByCustomerFormDTO implements Serializable { + private static final long serialVersionUID = 5272251336837515372L; + /** + * 客户ID + */ + @NotBlank(message = "客户ID不能为空") + private String customerId; + + /** + * 所属端类型0.居民端,1.政府端 + */ + @NotBlank(message = "所属端类型不能为空(0居民端1政府端)") + private String clientType; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CommonComponentDesignResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CommonComponentDesignResultDTO.java new file mode 100644 index 0000000000..bd65f9fe44 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CommonComponentDesignResultDTO.java @@ -0,0 +1,50 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 运营端-客户定制化服务-获取客户可用组件列表-返参[commonList(通用组件列表)属性对应DTO] + * @Author yang + * @Date 2020/3/16 12:59 + */ +@Data +public class CommonComponentDesignResultDTO implements Serializable { + private static final long serialVersionUID = 2971689193155710437L; + + /** + * 组件id + */ + private String componentId; + + /** + * 组件名称 + */ + private String componentName; + /** + * 所属区域 + */ + private String region; + + /** + * 组件前端标识 + */ + private String componentFrontId; + + /** + * 高级设置 + */ + private String configuration; + + /** + * 默认数据 + */ + private String demoData; + + /** + * 显示顺序 + */ + private int displayOrder; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/HomeDesignByCustomerResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/HomeDesignByCustomerResultDTO.java new file mode 100644 index 0000000000..2ccebf420c --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/HomeDesignByCustomerResultDTO.java @@ -0,0 +1,37 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Set; + +/** + * @Description 运营端-客户定制化服务-获取客户首页配置的设计稿返参 + * @Author yang + * @Date 2020/3/16 12:57 + */ +@Data +public class HomeDesignByCustomerResultDTO implements Serializable { + private static final long serialVersionUID = 1496786567582303921L; + /** + * 标题区 + */ + private CommonComponentDesignResultDTO titleList; + /** + * 置顶区 + */ + private CommonComponentDesignResultDTO topList; + /** + * 功能区 + */ + private List functionList; + /** + * 悬浮区 + */ + private CommonComponentDesignResultDTO floatingList; + /** + *用于标识已使用的功能组件id列表(不含通用组件) + */ + private List usedComponentIdList; +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/HomeController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/HomeController.java index e8000ab20d..3e5fb04a85 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/HomeController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/HomeController.java @@ -3,7 +3,9 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.ComponentListByCustomerFormDTO; +import com.epmet.dto.form.HomeDesignByCustomerFormDTO; import com.epmet.dto.result.ComponentListByCustomerResultDTO; +import com.epmet.dto.result.HomeDesignByCustomerResultDTO; import com.epmet.service.HomeService; import net.bytebuddy.asm.Advice; import org.springframework.beans.factory.annotation.Autowired; @@ -33,4 +35,17 @@ public class HomeController { ValidatorUtils.validateEntity(formDTO); return homeService.getComponentListByCustomer(formDTO); } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yang + * @Description 获取客户首页配置的设计稿 + * @Date 2020/3/16 13:21 + **/ + @PostMapping("gethomedesignbycustomer") + public Result getHomeDesignByCustomer(@RequestBody HomeDesignByCustomerFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return homeService.getHomeDesignByCustomer(formDTO); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java index 6bffb6e6a6..ac9a99cf51 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomerHomeDTO; +import com.epmet.dto.form.HomeDesignByCustomerFormDTO; import com.epmet.entity.CustomerHomeEntity; import org.apache.ibatis.annotations.Mapper; @@ -29,5 +31,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerHomeDao extends BaseDao { - + //根据客户id,所属端口,查询客户是否有发版模板信息 + CustomerHomeDTO getCustomerHomeDetailByCustomerAndClientType(HomeDesignByCustomerFormDTO form); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java index 5c792c3394..bfe188fa7c 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java @@ -29,5 +29,5 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerHomeDetailDao extends BaseDao { - + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeTemplateDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeTemplateDao.java index 21bf5f55ae..5e60376eb5 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeTemplateDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeTemplateDao.java @@ -29,5 +29,5 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerHomeTemplateDao extends BaseDao { - + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/HomeService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/HomeService.java index 50156cef76..f58966ac3b 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/HomeService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/HomeService.java @@ -2,7 +2,9 @@ package com.epmet.service; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.ComponentListByCustomerFormDTO; +import com.epmet.dto.form.HomeDesignByCustomerFormDTO; import com.epmet.dto.result.ComponentListByCustomerResultDTO; +import com.epmet.dto.result.HomeDesignByCustomerResultDTO; /** * @Description 客户定制化服务-首页 @@ -18,4 +20,13 @@ public interface HomeService { * @Date 2020/3/11 13:22 **/ Result getComponentListByCustomer(ComponentListByCustomerFormDTO formDTO); + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yang + * @Description 获取客户首页配置的设计稿 + * @Date 2020/3/16 13:21 + **/ + Result getHomeDesignByCustomer(HomeDesignByCustomerFormDTO formDTO); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java index 18671698af..b84eef3ae9 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java @@ -1,13 +1,25 @@ package com.epmet.service.impl; import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.CustomerHomeDao; +import com.epmet.dao.CustomerHomeDetailDao; +import com.epmet.dao.CustomerHomeTemplateDao; import com.epmet.dao.HomeComponentDao; +import com.epmet.dto.CustomerHomeDTO; import com.epmet.dto.form.ComponentListByCustomerFormDTO; +import com.epmet.dto.form.HomeDesignByCustomerFormDTO; +import com.epmet.dto.result.CommonComponentDesignResultDTO; import com.epmet.dto.result.ComponentListByCustomerResultDTO; +import com.epmet.dto.result.HomeDesignByCustomerResultDTO; import com.epmet.service.HomeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + /** * @Description 客户定制化服务-首页 * @Author yinzuomei @@ -15,14 +27,40 @@ import org.springframework.stereotype.Service; */ @Service public class HomeServiceImpl implements HomeService { - @Autowired - private HomeComponentDao homeComponentDao; + @Autowired + private HomeComponentDao homeComponentDao; + @Autowired + private CustomerHomeDetailDao customerHomeDetailDao; + + @Override + public Result getComponentListByCustomer(ComponentListByCustomerFormDTO formDTO) { + ComponentListByCustomerResultDTO resultDTO = new ComponentListByCustomerResultDTO(); + resultDTO.setCommonList(homeComponentDao.selectListCommonComponentResultDTO(formDTO)); + resultDTO.setFunctionList(homeComponentDao.selectListFunctionComponentResultDTO(formDTO)); + return new Result().ok(resultDTO); + } - @Override - public Result getComponentListByCustomer(ComponentListByCustomerFormDTO formDTO) { - ComponentListByCustomerResultDTO resultDTO = new ComponentListByCustomerResultDTO(); - resultDTO.setCommonList(homeComponentDao.selectListCommonComponentResultDTO(formDTO)); - resultDTO.setFunctionList(homeComponentDao.selectListFunctionComponentResultDTO(formDTO)); - return new Result().ok(resultDTO); - } + @Override + public Result getHomeDesignByCustomer(HomeDesignByCustomerFormDTO formDTO) { + HomeDesignByCustomerResultDTO resultDTO = new HomeDesignByCustomerResultDTO(); + List list = customerHomeDetailDao.getCustomerHomeDetailComponent(formDTO); + List flist=new ArrayList();//功能组件 + List usedComponent=new ArrayList<>();//使用的组件集合 + for(CommonComponentDesignResultDTO c:list){ + usedComponent.add(c.getComponentId()); + //所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区 + if("0".equals(c.getRegion())){ + resultDTO.setTitleList(c); + }else if("1".equals(c.getRegion())){ + resultDTO.setTopList(c); + }else if("2".equals(c.getRegion())){ + flist.add(c); + }else if("3".equals(c.getRegion())){ + resultDTO.setFloatingList(c); + } + } + resultDTO.setFunctionList(flist); + resultDTO.setUsedComponentIdList(usedComponent); + return new Result().ok(resultDTO); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml index b3c5917560..ef5dfa9cd7 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml @@ -19,4 +19,36 @@ + + \ No newline at end of file From 9a7af6ea3c8a70540986ec3e02b206fd7c87db5d Mon Sep 17 00:00:00 2001 From: yangshaoping <123456> Date: Mon, 16 Mar 2020 15:49:01 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E9=85=8D=E7=BD=AE=E7=9A=84=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E7=A8=BF-=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A42?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dao/CustomerHomeDetailDao.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java index bfe188fa7c..dd46814c64 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java @@ -18,9 +18,13 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.HomeDesignByCustomerFormDTO; +import com.epmet.dto.result.CommonComponentDesignResultDTO; import com.epmet.entity.CustomerHomeDetailEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 客户首页详情表 * @@ -29,5 +33,5 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerHomeDetailDao extends BaseDao { - + List getCustomerHomeDetailComponent(HomeDesignByCustomerFormDTO form); } \ No newline at end of file From 4060895be1474435852ca80451fb97bec7c69c6a Mon Sep 17 00:00:00 2001 From: yangshaoping <123456> Date: Mon, 16 Mar 2020 15:57:36 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E9=85=8D=E7=BD=AE=E7=9A=84=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E7=A8=BF-=E4=BB=A3=E7=A0=81=E6=B5=8B=E8=AF=95=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/CustomerHomeDetailDao.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml index ef5dfa9cd7..673153b3e1 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml @@ -47,8 +47,5 @@ LEFT JOIN home_component c ON b.COMPONENT_ID = c.id WHERE a.DEL_FLAG = 0 - ORDER BY - a.CREATED_TIME DESC - LIMIT 1 \ No newline at end of file From 958b1fb8a4d6d984d4fd90e13a868048aa5e97ee Mon Sep 17 00:00:00 2001 From: hosinokamui Date: Mon, 16 Mar 2020 18:28:45 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E7=A8=BF=E4=BF=9D=E5=AD=98=EF=BC=8C=E9=A6=96=E9=A1=B5=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E7=A8=BF=E5=8F=91=E7=89=88api=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/HomeComponentFormDTO.java | 42 ++++++++++++++++ .../com/epmet/dto/form/HomeDesignFormDTO.java | 33 ++++++++++++ .../com/epmet/controller/HomeController.java | 30 ++++++++++- .../java/com/epmet/dao/CustomerHomeDao.java | 18 +++++-- .../com/epmet/dao/CustomerHomeDetailDao.java | 10 ++++ .../java/com/epmet/service/HomeService.java | 19 +++++++ .../epmet/service/impl/HomeServiceImpl.java | 50 +++++++++++++++++-- .../main/resources/mapper/CustomerHomeDao.xml | 13 +++++ .../mapper/CustomerHomeDetailDao.xml | 7 +++ 9 files changed, 213 insertions(+), 9 deletions(-) create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeComponentFormDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignFormDTO.java diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeComponentFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeComponentFormDTO.java new file mode 100644 index 0000000000..a7833e17a9 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeComponentFormDTO.java @@ -0,0 +1,42 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 运营端-客户定制化服务-首页设计稿组件上传数据-入参 + * @author zhaoqifeng + * @date 2020/3/16 11:27 + */ +@Data +public class HomeComponentFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 组件id + */ + private String componentId; + + /** + * 所属区域 + */ + private Integer region; + + /** + * 高级配置项 + */ + private String configuration; + + /** + * 默认数据 + */ + private String demoData; + + /** + * 显示顺序 + */ + private Integer displayOrder; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignFormDTO.java new file mode 100644 index 0000000000..c51b897775 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.form; +/** + * 运营端-客户定制化服务-首页设计稿组件上传数据-入参 + * @author zhaoqifeng + * @date 2020/3/16 11:27 + */ + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class HomeDesignFormDTO implements Serializable { + + + private static final long serialVersionUID = -246434129998560246L; + + /** + * 客户id + */ + private String customerId; + + /** + * 所属端类型 0:居民端 1:政府端 + */ + private String clientType; + + /** + * 组件集合 + */ + private List componentList; +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/HomeController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/HomeController.java index 3e5fb04a85..2ee5686c71 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/HomeController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/HomeController.java @@ -4,10 +4,10 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.ComponentListByCustomerFormDTO; import com.epmet.dto.form.HomeDesignByCustomerFormDTO; +import com.epmet.dto.form.HomeDesignFormDTO; import com.epmet.dto.result.ComponentListByCustomerResultDTO; import com.epmet.dto.result.HomeDesignByCustomerResultDTO; import com.epmet.service.HomeService; -import net.bytebuddy.asm.Advice; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -48,4 +48,32 @@ public class HomeController { ValidatorUtils.validateEntity(formDTO); return homeService.getHomeDesignByCustomer(formDTO); } + + /** + * 首页设计稿组件上传数据 + * @param formDTO 参数 + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * Date 2020/3/16 13:21 + **/ + @PostMapping("savehomedesign") + public Result saveHomeDesign(@RequestBody HomeDesignFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + homeService.saveHomeDesign(formDTO); + return new Result(); + } + + /** + * 首页设计稿发版 + * @param formDTO 参数 + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * Date 2020/3/16 13:21 + **/ + @PostMapping("distributehomedesign") + public Result distributeHomeDesign(@RequestBody HomeDesignFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + homeService.distributeHomeDesign(formDTO); + return new Result(); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java index ac9a99cf51..42bc2824b4 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java @@ -18,11 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.CustomerHomeDTO; -import com.epmet.dto.form.HomeDesignByCustomerFormDTO; +import com.epmet.dto.form.HomeDesignFormDTO; import com.epmet.entity.CustomerHomeEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 客户首页表 * @@ -31,6 +32,15 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerHomeDao extends BaseDao { - //根据客户id,所属端口,查询客户是否有发版模板信息 - CustomerHomeDTO getCustomerHomeDetailByCustomerAndClientType(HomeDesignByCustomerFormDTO form); + + /** + * + * 客户首页列表查询 + * + * @param formDTO + * @return java.util.List + * @author zhaoqifeng + * @date 2020/3/16 14:02 + **/ + List selectCustomerHomeList(HomeDesignFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java index dd46814c64..9a3d2e4343 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java @@ -33,5 +33,15 @@ import java.util.List; */ @Mapper public interface CustomerHomeDetailDao extends BaseDao { + /** + * + * 根据界面id清除数据 + * + * @param homeId 界面ID + * @author zhaoqifeng + * @date 2020/3/16 14:02 + */ + void deleteCustomerHomeDetailByHomeId(String homeId); + List getCustomerHomeDetailComponent(HomeDesignByCustomerFormDTO form); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/HomeService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/HomeService.java index f58966ac3b..cb43d8c0c3 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/HomeService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/HomeService.java @@ -3,6 +3,7 @@ package com.epmet.service; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.ComponentListByCustomerFormDTO; import com.epmet.dto.form.HomeDesignByCustomerFormDTO; +import com.epmet.dto.form.HomeDesignFormDTO; import com.epmet.dto.result.ComponentListByCustomerResultDTO; import com.epmet.dto.result.HomeDesignByCustomerResultDTO; @@ -29,4 +30,22 @@ public interface HomeService { * @Date 2020/3/16 13:21 **/ Result getHomeDesignByCustomer(HomeDesignByCustomerFormDTO formDTO); + + /** + * + * 首页设计稿组件上传数据 + * @param: formDTO + * @author: zhaoqifeng + * @date: 2020/03/16 13:49:41 + */ + void saveHomeDesign(HomeDesignFormDTO formDTO); + + /** + * + * 首页设计稿发版 + * @param: formDTO + * @author: zhaoqifeng + * @date: 2020/03/16 13:49:41 + */ + void distributeHomeDesign(HomeDesignFormDTO formDTO); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java index b84eef3ae9..d68282628e 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java @@ -3,22 +3,22 @@ package com.epmet.service.impl; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.CustomerHomeDao; import com.epmet.dao.CustomerHomeDetailDao; -import com.epmet.dao.CustomerHomeTemplateDao; import com.epmet.dao.HomeComponentDao; -import com.epmet.dto.CustomerHomeDTO; import com.epmet.dto.form.ComponentListByCustomerFormDTO; +import com.epmet.dto.form.HomeComponentFormDTO; import com.epmet.dto.form.HomeDesignByCustomerFormDTO; +import com.epmet.dto.form.HomeDesignFormDTO; import com.epmet.dto.result.CommonComponentDesignResultDTO; import com.epmet.dto.result.ComponentListByCustomerResultDTO; import com.epmet.dto.result.HomeDesignByCustomerResultDTO; +import com.epmet.entity.CustomerHomeDetailEntity; +import com.epmet.entity.CustomerHomeEntity; import com.epmet.service.HomeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; /** * @Description 客户定制化服务-首页 @@ -31,6 +31,8 @@ public class HomeServiceImpl implements HomeService { private HomeComponentDao homeComponentDao; @Autowired private CustomerHomeDetailDao customerHomeDetailDao; + @Autowired + private CustomerHomeDao customerHomeDao; @Override public Result getComponentListByCustomer(ComponentListByCustomerFormDTO formDTO) { @@ -63,4 +65,44 @@ public class HomeServiceImpl implements HomeService { resultDTO.setUsedComponentIdList(usedComponent); return new Result().ok(resultDTO); } + + @Override + public void saveHomeDesign(HomeDesignFormDTO formDTO) { + + List customerHomeList = customerHomeDao.selectCustomerHomeList(formDTO); + + for(CustomerHomeEntity entity : customerHomeList) { + if (entity.getStatus() == 1) { + saveCustomerHomeDetail(formDTO, entity); + } + } + } + + @Override + public void distributeHomeDesign(HomeDesignFormDTO formDTO) { + + List customerHomeList = customerHomeDao.selectCustomerHomeList(formDTO); + + for(CustomerHomeEntity entity : customerHomeList) { + saveCustomerHomeDetail(formDTO, entity); + } + } + + private void saveCustomerHomeDetail(HomeDesignFormDTO formDTO, CustomerHomeEntity entity) { + //根据homeID清空客户首页详情表中的数据 + customerHomeDetailDao.deleteCustomerHomeDetailByHomeId(entity.getId()); + + //将数据存入客户首页详情表 + for (HomeComponentFormDTO homeComponentForm : formDTO.getComponentList()) { + CustomerHomeDetailEntity customerHomeDetailEntity = new CustomerHomeDetailEntity(); + customerHomeDetailEntity.setHomeId(entity.getId()); + customerHomeDetailEntity.setComponentId(homeComponentForm.getComponentId()); + customerHomeDetailEntity.setRegion(homeComponentForm.getRegion()); + customerHomeDetailEntity.setConfiguration(homeComponentForm.getConfiguration()); + customerHomeDetailEntity.setDemoData(homeComponentForm.getDemoData()); + customerHomeDetailEntity.setDisplayOrder(homeComponentForm.getDisplayOrder()); + customerHomeDetailDao.insert(customerHomeDetailEntity); + + } + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml index 1ae417cdc0..3bc7dfdb23 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml @@ -16,5 +16,18 @@ + + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml index 673153b3e1..57a4efe220 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml @@ -18,6 +18,13 @@ + + DELETE + FROM + CUSTOMER_HOME_DETAIL + WHERE + HOME_ID = #{homeId} +