|
|
@ -21,10 +21,20 @@ 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.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.OperCustomizeConstant; |
|
|
|
import com.epmet.constant.ReginConstant; |
|
|
|
import com.epmet.controller.CustomerHomeTemplateFormDTO; |
|
|
|
import com.epmet.dao.CustomerHomeTemplateDao; |
|
|
|
import com.epmet.dto.CustomerHomeTemplateDTO; |
|
|
|
import com.epmet.dto.form.HomeComponentFormDTO; |
|
|
|
import com.epmet.dto.result.CommonComponentDesignResultDTO; |
|
|
|
import com.epmet.dto.result.ComponentListByCustomerResultDTO; |
|
|
|
import com.epmet.dto.result.FunctionComponentResultDTO; |
|
|
|
import com.epmet.dto.result.HomeDesignByCustomerResultDTO; |
|
|
|
import com.epmet.entity.CustomerHomeTemplateEntity; |
|
|
|
import com.epmet.redis.CustomerHomeTemplateRedis; |
|
|
|
import com.epmet.service.CustomerHomeTemplateService; |
|
|
@ -33,6 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
@ -48,7 +59,8 @@ public class CustomerHomeTemplateServiceImpl extends BaseServiceImpl<CustomerHom |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private CustomerHomeTemplateRedis customerHomeTemplateRedis; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private LoginUserUtil loginUserUtil; |
|
|
|
@Override |
|
|
|
public PageData<CustomerHomeTemplateDTO> page(Map<String, Object> params) { |
|
|
|
IPage<CustomerHomeTemplateEntity> page = baseDao.selectPage( |
|
|
@ -108,4 +120,84 @@ public class CustomerHomeTemplateServiceImpl extends BaseServiceImpl<CustomerHom |
|
|
|
return ConvertUtils.sourceToTarget(baseDao.selectList(wrapper), CustomerHomeTemplateDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param clientType |
|
|
|
* @return com.epmet.dto.result.ComponentListByCustomerResultDTO |
|
|
|
* @author yinzuomei |
|
|
|
* @description 获取可用组件列表 |
|
|
|
* @Date 2020/8/24 21:16 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public ComponentListByCustomerResultDTO getComponentListByCustomer(String clientType) { |
|
|
|
ComponentListByCustomerResultDTO resultDTO = new ComponentListByCustomerResultDTO(); |
|
|
|
resultDTO.setCommonList(baseDao.selectListCommonComponent(clientType)); |
|
|
|
List<FunctionComponentResultDTO> functionList = baseDao.selectListFunction(); |
|
|
|
for (FunctionComponentResultDTO function : functionList) { |
|
|
|
function.setComponentList(baseDao.selectListFunctionComponent(function.getFunctionId(), clientType)); |
|
|
|
} |
|
|
|
resultDTO.setFunctionList(functionList); |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param clientType 所属端:0.居民端,1.领导端 |
|
|
|
* @return com.epmet.dto.result.HomeDesignByCustomerResultDTO |
|
|
|
* @author yinzuomei |
|
|
|
* @description |
|
|
|
* @Date 2020/8/24 22:06 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public HomeDesignByCustomerResultDTO getHomeTemplate(String clientType) { |
|
|
|
HomeDesignByCustomerResultDTO resultDTO = new HomeDesignByCustomerResultDTO(); |
|
|
|
//根据客户id,所属端获取客户首页配置的设计稿
|
|
|
|
List<CommonComponentDesignResultDTO> list = baseDao.selectCustomerTemplate(clientType); |
|
|
|
List<CommonComponentDesignResultDTO> titleList = new ArrayList<>(); |
|
|
|
List<CommonComponentDesignResultDTO> topList = new ArrayList<>(); |
|
|
|
List<CommonComponentDesignResultDTO> functionList = new ArrayList<>(); |
|
|
|
List<CommonComponentDesignResultDTO> floatingList = new ArrayList<>(); |
|
|
|
//使用过的组件集合
|
|
|
|
List<String> usedComponent = new ArrayList<>(); |
|
|
|
for (CommonComponentDesignResultDTO c : list) { |
|
|
|
usedComponent.add(c.getComponentId()); |
|
|
|
//所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区
|
|
|
|
if (ReginConstant.TITLE_LIST.equals(c.getRegion())) { |
|
|
|
titleList.add(c); |
|
|
|
} else if (ReginConstant.TOP_LIST.equals(c.getRegion())) { |
|
|
|
topList.add(c); |
|
|
|
} else if (ReginConstant.FUNCTION_LIST.equals(c.getRegion())) { |
|
|
|
functionList.add(c); |
|
|
|
} else if (ReginConstant.FLOATING_LIST.equals(c.getRegion())) { |
|
|
|
floatingList.add(c); |
|
|
|
} |
|
|
|
} |
|
|
|
resultDTO.setTitleList(titleList); |
|
|
|
resultDTO.setTopList(topList); |
|
|
|
resultDTO.setFloatingList(floatingList); |
|
|
|
resultDTO.setFunctionList(functionList); |
|
|
|
resultDTO.setUsedComponentIdList(usedComponent); |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return void |
|
|
|
* @author yinzuomei |
|
|
|
* @description 保存小程序首页配置 |
|
|
|
* @Date 2020/8/24 22:20 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void saveCustomerHomeTemplate(CustomerHomeTemplateFormDTO formDTO) { |
|
|
|
int deletedNum = baseDao.deleteByClientType(formDTO.getClientType(), loginUserUtil.getLoginUserId()); |
|
|
|
for (HomeComponentFormDTO homeComponentFormDTO : formDTO.getComponentList()) { |
|
|
|
CustomerHomeTemplateDTO customerHomeTemplateDTO = new CustomerHomeTemplateDTO(); |
|
|
|
customerHomeTemplateDTO.setComponentId(homeComponentFormDTO.getComponentId()); |
|
|
|
customerHomeTemplateDTO.setClientType(Integer.valueOf(formDTO.getClientType())); |
|
|
|
customerHomeTemplateDTO.setRegion(homeComponentFormDTO.getRegion()); |
|
|
|
customerHomeTemplateDTO.setConfiguration(homeComponentFormDTO.getConfiguration()); |
|
|
|
customerHomeTemplateDTO.setDemoData(homeComponentFormDTO.getDemoData()); |
|
|
|
customerHomeTemplateDTO.setDisplayOrder(homeComponentFormDTO.getDisplayOrder()); |
|
|
|
save(customerHomeTemplateDTO); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |