|
@ -1,13 +1,25 @@ |
|
|
package com.epmet.service.impl; |
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
|
|
import com.epmet.dao.CustomerHomeDao; |
|
|
|
|
|
import com.epmet.dao.CustomerHomeDetailDao; |
|
|
import com.epmet.dao.HomeComponentDao; |
|
|
import com.epmet.dao.HomeComponentDao; |
|
|
import com.epmet.dto.form.ComponentListByCustomerFormDTO; |
|
|
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.ComponentListByCustomerResultDTO; |
|
|
|
|
|
import com.epmet.dto.result.HomeDesignByCustomerResultDTO; |
|
|
|
|
|
import com.epmet.entity.CustomerHomeDetailEntity; |
|
|
|
|
|
import com.epmet.entity.CustomerHomeEntity; |
|
|
import com.epmet.service.HomeService; |
|
|
import com.epmet.service.HomeService; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 客户定制化服务-首页 |
|
|
* @Description 客户定制化服务-首页 |
|
|
* @Author yinzuomei |
|
|
* @Author yinzuomei |
|
@ -17,6 +29,10 @@ import org.springframework.stereotype.Service; |
|
|
public class HomeServiceImpl implements HomeService { |
|
|
public class HomeServiceImpl implements HomeService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private HomeComponentDao homeComponentDao; |
|
|
private HomeComponentDao homeComponentDao; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private CustomerHomeDetailDao customerHomeDetailDao; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private CustomerHomeDao customerHomeDao; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Result<ComponentListByCustomerResultDTO> getComponentListByCustomer(ComponentListByCustomerFormDTO formDTO) { |
|
|
public Result<ComponentListByCustomerResultDTO> getComponentListByCustomer(ComponentListByCustomerFormDTO formDTO) { |
|
@ -25,4 +41,70 @@ public class HomeServiceImpl implements HomeService { |
|
|
resultDTO.setFunctionList(homeComponentDao.selectListFunctionComponentResultDTO(formDTO)); |
|
|
resultDTO.setFunctionList(homeComponentDao.selectListFunctionComponentResultDTO(formDTO)); |
|
|
return new Result<ComponentListByCustomerResultDTO>().ok(resultDTO); |
|
|
return new Result<ComponentListByCustomerResultDTO>().ok(resultDTO); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<HomeDesignByCustomerResultDTO> getHomeDesignByCustomer(HomeDesignByCustomerFormDTO formDTO) { |
|
|
|
|
|
HomeDesignByCustomerResultDTO resultDTO = new HomeDesignByCustomerResultDTO(); |
|
|
|
|
|
List<CommonComponentDesignResultDTO> list = customerHomeDetailDao.getCustomerHomeDetailComponent(formDTO); |
|
|
|
|
|
List<CommonComponentDesignResultDTO> flist=new ArrayList<CommonComponentDesignResultDTO>();//功能组件
|
|
|
|
|
|
List<String> 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<HomeDesignByCustomerResultDTO>().ok(resultDTO); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void saveHomeDesign(HomeDesignFormDTO formDTO) { |
|
|
|
|
|
//根据客户ID和所属端类型从客户首页表找到对应的已发布和草稿
|
|
|
|
|
|
List<CustomerHomeEntity> customerHomeList = customerHomeDao.selectCustomerHomeList(formDTO); |
|
|
|
|
|
|
|
|
|
|
|
//只处理草稿的数据
|
|
|
|
|
|
for(CustomerHomeEntity entity : customerHomeList) { |
|
|
|
|
|
if (entity.getStatus() == 1) { |
|
|
|
|
|
saveCustomerHomeDetail(formDTO, entity); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void distributeHomeDesign(HomeDesignFormDTO formDTO) { |
|
|
|
|
|
//根据客户ID和所属端类型从客户首页表找到对应的已发布和草稿
|
|
|
|
|
|
List<CustomerHomeEntity> customerHomeList = customerHomeDao.selectCustomerHomeList(formDTO); |
|
|
|
|
|
|
|
|
|
|
|
//草稿和模板数据都要处理
|
|
|
|
|
|
for(CustomerHomeEntity entity : customerHomeList) { |
|
|
|
|
|
saveCustomerHomeDetail(formDTO, entity); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void saveCustomerHomeDetail(HomeDesignFormDTO formDTO, CustomerHomeEntity entity) { |
|
|
|
|
|
//根据homeID清空客户首页详情表中的数据
|
|
|
|
|
|
customerHomeDetailDao.updateCustomerHomeDetailByHomeId(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); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|