Browse Source

sql修改

dev_shibei_match
yinzuomei 4 years ago
parent
commit
0b4cc482bf
  1. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/app/result/AppFootBarResultDTO.java
  2. 21
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercustomize/CustomerFootBarDao.java
  3. 32
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/impl/CustomerFootBarServiceImpl.java
  4. 16
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercustomize/CustomerFootBarDao.xml

2
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/app/result/AppFootBarResultDTO.java

@ -35,5 +35,5 @@ public class AppFootBarResultDTO implements Serializable {
/**
* 是否都上传了图标true:都上传了
*/
private Boolean bothUploaded;
// private Boolean bothUploaded;
}

21
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercustomize/CustomerFootBarDao.java

@ -34,5 +34,26 @@ import java.util.List;
@Mapper
public interface CustomerFootBarDao extends BaseDao<CustomerFootBarEntity> {
/**
* 查询客户工作端或者居民端footbar列表
*
* @param customerId
* @param appType
* @return java.util.List<com.epmet.dataaggre.dto.app.result.CustomerFootBarDTO>
* @author yinzuomei
* @date 2021/7/28 10:56
*/
List<CustomerFootBarDTO> selectAppFootBars(@Param("customerId") String customerId, @Param("appType") String appType);
/**
* 查询某个footbar信息
*
* @param customerId
* @param appType
* @param barKey
* @return com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity
* @author yinzuomei
* @date 2021/7/28 10:56
*/
CustomerFootBarEntity selectDefaultIcon(@Param("customerId") String customerId, @Param("appType")String appType, @Param("barKey")String barKey);
}

32
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/impl/CustomerFootBarServiceImpl.java

@ -21,6 +21,7 @@ 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.commons.tools.constant.StrConstant;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.opercustomize.CustomerFootBarDao;
import com.epmet.dataaggre.dto.app.form.AppFootBarFormDTO;
@ -70,28 +71,35 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
CustomerParameterEntity patternEntity = customerParameterService.queryFootBarPattern(footBarFormDTO.getCustomerId(), footBarFormDTO.getAppType());
// 2、查询客户设置的第几个,没有默认返回0,
CustomerParameterEntity highLightNumEntity = customerParameterService.queryFootBarHighLightNum(footBarFormDTO.getCustomerId(), footBarFormDTO.getAppType());
// todo 这个sql需要修改
List<CustomerFootBarDTO> footBarList = baseDao.selectAppFootBars(footBarFormDTO.getCustomerId(), footBarFormDTO.getAppType());
if (CollectionUtils.isEmpty(footBarList)) {
footBarList = baseDao.selectAppFootBars(Constant.DEFAULT_CUSTOMER, footBarFormDTO.getAppType());
}else{
//如果客户没有上传图标,返回产品默认的图标
for (CustomerFootBarDTO dto : footBarList) {
if (StringUtils.isBlank(dto.getIconPath())
|| StringUtils.isBlank(dto.getSelectedIconPath())
|| StringUtils.isBlank(dto.getFloatIconPath())) {
CustomerFootBarEntity defaultEntity = baseDao.selectDefaultIcon(Constant.DEFAULT_CUSTOMER, footBarFormDTO.getAppType(), dto.getBarKey());
if (StringUtils.isBlank(dto.getIconPath())) {
dto.setIconPath(null == defaultEntity ? StrConstant.EPMETY_STR : defaultEntity.getIconPath());
}
if (StringUtils.isBlank(dto.getSelectedIconPath())) {
dto.setSelectedIconPath(null == defaultEntity ? StrConstant.EPMETY_STR : defaultEntity.getSelectedIconPath());
}
if (StringUtils.isBlank(dto.getFloatIconPath())) {
dto.setFloatIconPath(null == defaultEntity ? StrConstant.EPMETY_STR : defaultEntity.getFloatIconPath());
}
}
}
}
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())) {
if (resultDTO.getIsOddNum() && Constant.FOOT_BAR_FLOAT.equals(patternEntity.getParameterValue())) {
resultDTO.setPattern(Constant.FOOT_BAR_FLOAT);
//返回
resultDTO.setHighLightNum(footBarList.size() / NumConstant.TWO);

16
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercustomize/CustomerFootBarDao.xml

@ -3,6 +3,7 @@
<mapper namespace="com.epmet.dataaggre.dao.opercustomize.CustomerFootBarDao">
<!-- 查询客户工作端或者居民端,footbar列表 -->
<select id="selectAppFootBars" parameterType="map" resultType="com.epmet.dataaggre.dto.app.result.CustomerFootBarDTO">
SELECT
c.BAR_KEY as barKey,
@ -22,4 +23,19 @@
order by c.ORDER_INDEX asc
</select>
<!-- 查询某个footbar信息 -->
<select id="selectDefaultIcon" parameterType="map" resultType="com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity">
SELECT
IFNULL(c.ICON_PATH,'') as iconPath,
IFNULL(c.SELECTED_ICON_PATH,'') as selectedIconPath,
IFNULL(c.FLOAT_ICON_PATH,'') as floatIconPath
FROM
customer_foot_bar c
WHERE
c.del_flag = '0'
AND c.customer_id = #{customerId}
AND c.app_type = #{appType}
and c.BAR_KEY=#{barKey}
AND C.DISPLAY='1'
</select>
</mapper>
Loading…
Cancel
Save