Browse Source

Merge remote-tracking branch 'origin/dev' into dev

master
zxc 5 years ago
parent
commit
642a160d05
  1. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 7
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerFootBarDTO.java
  3. 85
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java
  4. 14
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFootBarResultDTO.java
  5. 117
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java
  6. 51
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java
  7. 15
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java
  8. 20
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java
  9. 156
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java
  10. 2
      epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.6__footbar_add_column.sql
  11. 175
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -77,9 +77,6 @@ public enum EpmetErrorCode {
CANNOT_DISABLE_YOURSELF(8405,"您不能禁用自己"),
NO_SET_GRID_COUNT(8406,"您还未设置创建网格数量上限,请联系管理员设置"),
GRID_COUNT_UP(8407,"您的创建网格数量已到达上限,请联系管理员设置"),
EXIT_PEND_PROJECT(8408,"该工作人员有项目尚在处理,处理完毕方可操作"),
EXIT_PUBLISHED_ACTIVITY(8409,"该工作人员有活动尚在进行,等活动完成方可操作"),
CAN_NOT_SELF(8410,"无法对自己进行操作"),
ALREADY_EVALUATE(8501,"您已评价"),
ALREADY_VOTE(8502,"您已表态"),
@ -107,7 +104,9 @@ public enum EpmetErrorCode {
OPER_EXTERNAL_APP_AUTH_ERROR(8709, "外部应用认证失败"),
OPER_EXTERNAL_CUSTOMER_NOT_EXISTS(8710, "该客户不存在"),
OPER_EXTERNAL_APP_EXISTS(8711, "应用已存在"),
OPER_EXT_APP_SECRET_RESET_FAIL(8713, "秘钥更新失败"),
OPER_CUSTOMER_FOOTBAR_EXISTS(8712, "footbar已存在"),
OPER_CUSTOMER_FOOTBAR_NOT_FOUND(8713, "footbar不存在"),
OPER_EXT_APP_SECRET_RESET_FAIL(8713, "秘钥更新失败"),
// 党建声音 前端提示 88段
DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"),

7
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerFootBarDTO.java

@ -43,6 +43,11 @@ public class CustomerFootBarDTO implements Serializable {
*/
private String barName;
/**
* 默认的bar名称
*/
private String defaultBarName;
/**
* KEY
*/
@ -93,4 +98,6 @@ public class CustomerFootBarDTO implements Serializable {
*/
private Date updatedTime;
private Boolean display;
}

85
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java

@ -1,17 +1,98 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
public class CustomerFootBarFormDTO {
//@NotBlank(message = "客户ID不能为空")
// 创建footbar的分组
public interface CreateFootBarGroup extends CustomerClientShowGroup {}
// 查询footbar列表分组
public interface ListFootBarGroup extends CustomerClientShowGroup {}
// 运营端查询footbar列表分组
public interface ListFootBarGroup4Oper extends CustomerClientShowGroup {}
// 更新footbar
public interface UpdateFootBarGroup extends CustomerClientShowGroup {}
// 保存顺序
public interface SaveOrderGroup extends CustomerClientShowGroup {}
// 明细分组
public interface FootBarDetailGroup extends CustomerClientShowGroup {}
// 更新显示状态分组
public interface UpdateDisplayStatusGroup extends CustomerClientShowGroup {}
// 为客户添加默认footbar
public interface AddDefaultFootbars4Customer extends CustomerClientShowGroup {}
// 删除footbar
public interface DeleteFootbarsGroup extends CustomerClientShowGroup {}
@NotBlank(message = "FootBar的ID不能为空", groups = { UpdateFootBarGroup.class, FootBarDetailGroup.class, UpdateDisplayStatusGroup.class, DeleteFootbarsGroup.class })
private String id;
@NotBlank(message = "客户ID不能为空", groups = { CreateFootBarGroup.class, AddDefaultFootbars4Customer.class, ListFootBarGroup4Oper.class })
private String customerId;
// 哪一个端:gov,resi
@NotBlank(message = "app类型不能为空")
@NotBlank(message = "app类型不能为空", groups = { ListFootBarGroup.class, CreateFootBarGroup.class, AddDefaultFootbars4Customer.class, ListFootBarGroup4Oper.class })
private String appType;
@NotBlank(message = "名称不能为空", groups = { CreateFootBarGroup.class, UpdateFootBarGroup.class })
private String barName;
@NotBlank(message = "key不能为空", groups = { CreateFootBarGroup.class })
private String barKey;
@NotBlank(message = "页面标题不能为空", groups = { CreateFootBarGroup.class, UpdateFootBarGroup.class })
private String pageTitle;
//@NotBlank(message = "图标路径不能为空", groups = { UpdateFootBarGroup.class })
private String iconPath;
//@NotBlank(message = "选中的图标路径不能为空", groups = { UpdateFootBarGroup.class })
private String selectedIconPath;
@NotEmpty(message = "顺序不能为空", groups = { SaveOrderGroup.class })
private List<OrderIndexDTO> orderList;
@NotNull(message = "显示状态不能为空", groups = { UpdateDisplayStatusGroup.class })
private Boolean display;
/**
* 排序索引号dto
*/
public static class OrderIndexDTO {
private String id;
private Integer orderIndex;
public OrderIndexDTO() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getOrderIndex() {
return orderIndex;
}
public void setOrderIndex(Integer orderIndex) {
this.orderIndex = orderIndex;
}
}
}

14
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFootBarResultDTO.java

@ -39,6 +39,10 @@ public class CustomerFootBarResultDTO implements Serializable {
*/
private String id;
private String customerId;
private String appType;
/**
* bar名称
*/
@ -94,4 +98,14 @@ public class CustomerFootBarResultDTO implements Serializable {
*/
private Date updatedTime;
private Boolean display;
private String defaultBarName;
private String defaultIconPath;
private String defaultSelectedIconPath;
private String defaultPageTitle;
}

117
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java

@ -27,6 +27,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.CustomerFootBarDTO;
import com.epmet.dto.form.CustomerFootBarFormDTO;
import com.epmet.dto.result.CustomerFootBarResultDTO;
import com.epmet.entity.CustomerFootBarEntity;
import com.epmet.excel.CustomerFootBarExcel;
import com.epmet.service.CustomerFootBarService;
@ -35,7 +36,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@ -103,17 +103,130 @@ public class CustomerFootBarController {
*/
@PostMapping("customerfootbars")
public Result<List<CustomerFootBarDTO>> getCustomerfootbars(@RequestBody CustomerFootBarFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
ValidatorUtils.validateEntity(formDTO, CustomerFootBarFormDTO.ListFootBarGroup.class);
String customerId = formDTO.getCustomerId();
String appType = formDTO.getAppType();
List<CustomerFootBarEntity> footbars = customerFootBarService.listCustomerFootBars(customerId, appType);
List<CustomerFootBarDTO> barDTOS = new LinkedList<>();
footbars.forEach(barEntity -> {
CustomerFootBarEntity defaultFootBarEntity = customerFootBarService.getByAppTypeAndBarKeyOfCustomer("default", barEntity.getAppType(), barEntity.getBarKey());
CustomerFootBarDTO barDTO = new CustomerFootBarDTO();
BeanUtils.copyProperties(barEntity, barDTO);
barDTO.setDefaultBarName(defaultFootBarEntity.getBarName());
barDTOS.add(barDTO);
});
return new Result<List<CustomerFootBarDTO>>().ok(barDTOS);
}
/**
* 运营端查询footbar列表
* @param formDTO
* @return
*/
@PostMapping("customerfootbars4oper")
public Result<List<CustomerFootBarDTO>> getCustomerfootbars4Oper(@RequestBody CustomerFootBarFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, CustomerFootBarFormDTO.ListFootBarGroup4Oper.class);
String customerId = formDTO.getCustomerId();
String appType = formDTO.getAppType();
List<CustomerFootBarEntity> footbars = customerFootBarService.listAllCustomerFootBars(customerId, appType);
List<CustomerFootBarDTO> barDTOS = new LinkedList<>();
footbars.forEach(barEntity -> {
CustomerFootBarEntity defaultFootBarEntity = customerFootBarService.getByAppTypeAndBarKeyOfCustomer("default", barEntity.getAppType(), barEntity.getBarKey());
CustomerFootBarDTO barDTO = new CustomerFootBarDTO();
BeanUtils.copyProperties(barEntity, barDTO);
barDTO.setDefaultBarName(defaultFootBarEntity.getBarName());
barDTOS.add(barDTO);
});
return new Result<List<CustomerFootBarDTO>>().ok(barDTOS);
}
/**
* 创建footbar只能创建默认的不能直接为客户创建
* @param form
* @return
*/
@PostMapping("createfootbar")
public Result createFootBar(@RequestBody CustomerFootBarFormDTO form) {
ValidatorUtils.validateEntity(form, CustomerFootBarFormDTO.CreateFootBarGroup.class);
customerFootBarService.createFootBar(form);
return new Result();
}
/**
* 更新footbar
* @param form
* @return
*/
@PostMapping("updatefootbar")
public Result updateFootbar(@RequestBody CustomerFootBarFormDTO form) {
ValidatorUtils.validateEntity(form, CustomerFootBarFormDTO.UpdateFootBarGroup.class);
customerFootBarService.updateFootBar(form);
return new Result();
}
/**
*
* @param form
* @return
*/
@PostMapping("footbardetail")
public Result footbarDetail(@RequestBody CustomerFootBarFormDTO form) {
ValidatorUtils.validateEntity(form, CustomerFootBarFormDTO.FootBarDetailGroup.class);
CustomerFootBarResultDTO dto = customerFootBarService.getFootBarDetail(form.getId());
return new Result().ok(dto);
}
/**
* 保存排序
* @param form
* @return
*/
@PostMapping("saveorder")
public Result saveOrder(@RequestBody CustomerFootBarFormDTO form) {
ValidatorUtils.validateEntity(form, CustomerFootBarFormDTO.SaveOrderGroup.class);
customerFootBarService.saveOrder(form.getOrderList());
return new Result();
}
/**
* 更新显示状态
* @param form
* @return
*/
@PostMapping("updatedisplaystatus")
public Result updateDisplayStatus(@RequestBody CustomerFootBarFormDTO form) {
ValidatorUtils.validateEntity(form, CustomerFootBarFormDTO.UpdateDisplayStatusGroup.class);
customerFootBarService.updateDisplayStatus(form.getId(), form.getDisplay());
return new Result();
}
/**
* 为客户初始化默认的footbar
* @param form
* @return
*/
@PostMapping("initdefault4customer")
public Result initDefault4Customer(@RequestBody CustomerFootBarFormDTO form) {
ValidatorUtils.validateEntity(form, CustomerFootBarFormDTO.AddDefaultFootbars4Customer.class);
customerFootBarService.addDefault4Customer(form.getCustomerId(), form.getAppType());
return new Result();
}
/**
* 删除footbar
* @param form
* @return
*/
@PostMapping("deletefootbar")
public Result deleteFootBar(@RequestBody CustomerFootBarFormDTO form) {
ValidatorUtils.validateEntity(form, CustomerFootBarFormDTO.DeleteFootbarsGroup.class);
customerFootBarService.deleteFootBar(form.getId());
return new Result();
}
}

51
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java

@ -33,6 +33,55 @@ import java.util.List;
@Mapper
public interface CustomerFootBarDao extends BaseDao<CustomerFootBarEntity> {
List<CustomerFootBarEntity> listCustomerFootBars(@Param("customerId") String customerId,
List<CustomerFootBarEntity> listDisplayCustomerFootBars(@Param("customerId") String customerId,
@Param("appType") String appType);
List<CustomerFootBarEntity> listAllCustomerFootBars(@Param("customerId") String customerId,
@Param("appType") String appType);
/**
* 唯一性count
* @param appType
* @param barKey
* @return
*/
int count4Unique(@Param("customerId") String customerId,
@Param("appType") String appType,
@Param("barKey") String barKey,
@Param("barName") String barName);
/**
* 获取下一个顺序号
* @param customerId
* @param appType
* @return
*/
Integer fetchNextOrder(@Param("customerId") String customerId, @Param("appType") String appType);
/**
* 更新顺序号
* @param id
* @param orderIndex
* @return
*/
Integer updateOrder(@Param("id") String id, @Param("orderIndex") Integer orderIndex);
CustomerFootBarEntity getByAppTypeAndBarKeyOfCustomer(@Param("customerId") String customerId,
@Param("appType") String appType,
@Param("barKey") String barKey);
CustomerFootBarEntity getByAppTypeAndBarNameOfCustomer(@Param("customerId") String customerId,
@Param("appType") String appType,
@Param("barName") String barName);
List<CustomerFootBarEntity> listByAppTypeAndCustomerId(@Param("customerId") String customerId,
@Param("appType") String appType);
void updateDisplayStatus(@Param("id") String id, @Param("display") Boolean display);
List<String> listFootBarOwnerCustomerIds();
void physicsDeleteById(@Param("id") String id);
void physicsDeleteByAppTypeAndBarKey(@Param("appType") String appType, @Param("barKey") String barKey);
}

15
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java

@ -38,6 +38,11 @@ public class CustomerFootBarEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* bar名称
*/
@ -65,6 +70,14 @@ public class CustomerFootBarEntity extends BaseEpmetEntity {
*/
private String selectedIconPath;
private Integer order;
/**
* 顺序号
*/
private Integer orderIndex;
/**
* 是否显示
*/
private Boolean display;
}

20
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java

@ -20,6 +20,8 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.CustomerFootBarDTO;
import com.epmet.dto.form.CustomerFootBarFormDTO;
import com.epmet.dto.result.CustomerFootBarResultDTO;
import com.epmet.entity.CustomerFootBarEntity;
import java.util.List;
@ -94,4 +96,22 @@ public interface CustomerFootBarService extends BaseService<CustomerFootBarEntit
void delete(String[] ids);
List<CustomerFootBarEntity> listCustomerFootBars(String customerId, String appType);
List<CustomerFootBarEntity> listAllCustomerFootBars(String customerId, String appType);
void createFootBar(CustomerFootBarFormDTO form);
void updateFootBar(CustomerFootBarFormDTO form);
CustomerFootBarResultDTO getFootBarDetail(String id);
void saveOrder(List<CustomerFootBarFormDTO.OrderIndexDTO> orderList);
CustomerFootBarEntity getByAppTypeAndBarKeyOfCustomer(String customerId, String appType, String barKey);
void updateDisplayStatus(String id, Boolean display);
void addDefault4Customer(String customerId, String appType);
void deleteFootBar(String id);
}

156
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java

@ -20,11 +20,15 @@ package com.epmet.service.impl;
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.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.CustomerFootBarDao;
import com.epmet.dto.CustomerFootBarDTO;
import com.epmet.dto.form.CustomerFootBarFormDTO;
import com.epmet.dto.result.CustomerFootBarResultDTO;
import com.epmet.entity.CustomerFootBarEntity;
import com.epmet.redis.CustomerFootBarRedis;
import com.epmet.service.CustomerFootBarService;
@ -103,7 +107,157 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
@Override
public List<CustomerFootBarEntity> listCustomerFootBars(String customerId, String appType) {
return baseDao.listCustomerFootBars(customerId, appType);
return baseDao.listDisplayCustomerFootBars(customerId, appType);
}
@Override
public List<CustomerFootBarEntity> listAllCustomerFootBars(String customerId, String appType) {
return baseDao.listAllCustomerFootBars(customerId, appType);
}
@Override
public void createFootBar(CustomerFootBarFormDTO form) {
validateBeforeCreate(form);
CustomerFootBarEntity entity = new CustomerFootBarEntity();
entity.setAppType(form.getAppType());
entity.setCustomerId("default"); // 只能为默认客户创建
entity.setBarKey(form.getBarKey());
entity.setBarName(form.getBarName());
entity.setIconPath(form.getIconPath());
entity.setPageTitle(form.getPageTitle());
entity.setSelectedIconPath(form.getSelectedIconPath());
entity.setOrderIndex(baseDao.fetchNextOrder(form.getCustomerId(), form.getAppType()));
entity.setDisplay(true);
baseDao.insert(entity);
sync2Customers(entity);
}
/**
* 同步到客户
* @param entity
*/
private void sync2Customers(CustomerFootBarEntity entity) {
List<String> customerIds = baseDao.listFootBarOwnerCustomerIds();
for (String customerId : customerIds) {
CustomerFootBarEntity bar = baseDao.getByAppTypeAndBarKeyOfCustomer(customerId, entity.getAppType(), entity.getBarKey());
if (bar == null) {
// 该客户还没有该bar
CustomerFootBarEntity newBar = new CustomerFootBarEntity();
newBar.setCustomerId(customerId);
newBar.setIconPath(entity.getIconPath());
newBar.setPageTitle(entity.getPageTitle());
newBar.setBarKey(entity.getBarKey());
newBar.setBarName(entity.getBarName());
newBar.setSelectedIconPath(entity.getSelectedIconPath());
newBar.setOrderIndex(baseDao.fetchNextOrder(customerId, entity.getAppType()));
newBar.setAppType(entity.getAppType());
newBar.setDisplay(true);
baseDao.insert(newBar);
}
}
}
@Override
public void updateFootBar(CustomerFootBarFormDTO form) {
validateBeforeUpdate(form);
CustomerFootBarEntity entity = baseDao.selectById(form.getId());
if (entity == null) {
throw new RenException(EpmetErrorCode.OPER_CUSTOMER_FOOTBAR_NOT_FOUND.getCode(),
EpmetErrorCode.OPER_CUSTOMER_FOOTBAR_NOT_FOUND.getMsg());
}
entity.setSelectedIconPath(form.getSelectedIconPath());
entity.setBarName(form.getBarName());
entity.setPageTitle(form.getPageTitle());
entity.setIconPath(form.getIconPath());
baseDao.updateById(entity);
}
@Override
public CustomerFootBarResultDTO getFootBarDetail(String id) {
CustomerFootBarEntity entity = baseDao.selectById(id);
if (entity == null) {
return new CustomerFootBarResultDTO();
}
CustomerFootBarResultDTO dto = ConvertUtils.sourceToTarget(entity, CustomerFootBarResultDTO.class);
CustomerFootBarEntity defaultBar = baseDao.getByAppTypeAndBarKeyOfCustomer("default", entity.getAppType(), entity.getBarKey());
dto.setDefaultBarName(defaultBar.getBarName());
dto.setDefaultIconPath(defaultBar.getIconPath());
dto.setDefaultSelectedIconPath(defaultBar.getSelectedIconPath());
dto.setDefaultPageTitle(defaultBar.getPageTitle());
return dto;
}
@Transactional
@Override
public void saveOrder(List<CustomerFootBarFormDTO.OrderIndexDTO> orderList) {
for (CustomerFootBarFormDTO.OrderIndexDTO idx : orderList) {
baseDao.updateOrder(idx.getId(), idx.getOrderIndex());
}
}
@Override
public CustomerFootBarEntity getByAppTypeAndBarKeyOfCustomer(String customerId, String appType, String barKey) {
return baseDao.getByAppTypeAndBarKeyOfCustomer(customerId, appType, barKey);
}
@Override
public void updateDisplayStatus(String id, Boolean display) {
baseDao.updateDisplayStatus(id, display);
}
@Transactional
@Override
public void addDefault4Customer(String customerId, String appType) {
List<CustomerFootBarEntity> defaultBars = baseDao.listByAppTypeAndCustomerId("default", appType);
for (CustomerFootBarEntity defaultBar : defaultBars) {
CustomerFootBarEntity bar = baseDao.getByAppTypeAndBarKeyOfCustomer(customerId, appType, defaultBar.getBarKey());
if (bar != null) {
// 该客户已经有该bar了,不再添加
continue;
}
defaultBar.setCustomerId(customerId);
defaultBar.setId(null);
defaultBar.setCreatedTime(null);
defaultBar.setCreatedBy(null);
defaultBar.setUpdatedTime(null);
defaultBar.setUpdatedBy(null);
baseDao.insert(defaultBar);
}
}
@Override
public void deleteFootBar(String id) {
CustomerFootBarEntity defaultFootbar = baseDao.selectById(id);
baseDao.physicsDeleteByAppTypeAndBarKey(defaultFootbar.getAppType(), defaultFootbar.getBarKey());
}
/**
* 添加footbar之前的校验
* @param form
*/
private void validateBeforeCreate(CustomerFootBarFormDTO form) {
synchronized (this) {
int uniqueCount1 = baseDao.count4Unique(form.getCustomerId(), form.getAppType(), form.getBarKey(), null);
int uniqueCount2 = baseDao.count4Unique(form.getCustomerId(), form.getAppType(), null, form.getBarName());
if (uniqueCount1 > 0 || uniqueCount2 > 0) {
throw new RenException(EpmetErrorCode.OPER_CUSTOMER_FOOTBAR_EXISTS.getCode(),
EpmetErrorCode.OPER_CUSTOMER_FOOTBAR_EXISTS.getMsg());
}
}
}
private void validateBeforeUpdate(CustomerFootBarFormDTO form) {
synchronized (this) {
CustomerFootBarEntity entity = baseDao.getByAppTypeAndBarNameOfCustomer(form.getCustomerId(), form.getAppType(), form.getBarName());
if (entity != null && !entity.getId().equals(form.getId())) {
throw new RenException(EpmetErrorCode.OPER_CUSTOMER_FOOTBAR_EXISTS.getCode(),
EpmetErrorCode.OPER_CUSTOMER_FOOTBAR_EXISTS.getMsg());
}
}
}
}

2
epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.6__footbar_add_column.sql

@ -0,0 +1,2 @@
alter table customer_foot_bar add column DISPLAY tinyint(1) default 1;
alter table customer_foot_bar change `ORDER` ORDER_INDEX tinyint(1) default 1;

175
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml

@ -11,7 +11,8 @@
<result property="pageTitle" column="PAGE_TITLE"/>
<result property="iconPath" column="ICON_PATH"/>
<result property="selectedIconPath" column="SELECTED_ICON_PATH"/>
<result property="order" column="ORDER"/>
<result property="orderIndex" column="ORDER_INDEX"/>
<result property="display" column="DISPLAY"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
@ -20,34 +21,194 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!--更新顺序号-->
<update id="updateOrder">
update customer_foot_bar
set ORDER_INDEX = #{orderIndex}
where ID = #{id}
</update>
<update id="updateDisplayStatus">
update customer_foot_bar
set DISPLAY=#{display}
where ID = #{id}
</update>
<!--物理删除-->
<delete id="physicsDeleteById">
delete
from customer_foot_bar
where ID = #{id}
</delete>
<delete id="physicsDeleteByAppTypeAndBarKey">
delete
from customer_foot_bar
where app_type = #{appType}
and BAR_KEY = #{barKey}
</delete>
<!--查询客户的footbar列表-->
<select id="listCustomerFootBars" resultType="com.epmet.entity.CustomerFootBarEntity">
<select id="listDisplayCustomerFootBars" resultType="com.epmet.entity.CustomerFootBarEntity">
SELECT
id,
customer_id,
app_type,
bar_key,
bar_name,
app_type,
page_title,
icon_path,
selected_icon_path,
`order`,
display,
order_index,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
`order`
updated_time
FROM
customer_foot_bar
<where>
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND APP_TYPE = #{appType}
AND DISPLAY = 1
</where>
ORDER BY `ORDER_INDEX` ASC
</select>
<select id="listAllCustomerFootBars" resultType="com.epmet.entity.CustomerFootBarEntity">
SELECT
id,
customer_id,
app_type,
bar_key,
bar_name,
page_title,
icon_path,
selected_icon_path,
display,
order_index,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
FROM
customer_foot_bar
<where>
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND APP_TYPE = #{appType}
</where>
ORDER BY `ORDER_INDEX` ASC
</select>
<select id="count4Unique" resultType="java.lang.Integer">
select count(1)
from customer_foot_bar
<where>
<if test="appType != null and appType != ''">
app_type = #{appType}
</if>
<if test="barKey != null and barKey != ''">
and BAR_KEY = #{barKey}
</if>
<if test="customerId != null and customerId != ''">
and CUSTOMER_ID = #{customerId}
</if>
<if test="barName != null and barName != ''">
and BAR_NAME= #{barName}
</if>
and DEL_FLAG=0
</where>
</select>
<select id="fetchNextOrder" resultType="java.lang.Integer">
select ifnull(max(`ORDER_INDEX`),-1) + 1
from customer_foot_bar
<where>
app_type = #{appType}
and CUSTOMER_ID = #{customerId}
and DEL_FLAG=0
</where>
ORDER BY `order` ASC
</select>
<select id="getByAppTypeAndBarKeyOfCustomer" resultType="com.epmet.entity.CustomerFootBarEntity">
select id,
customer_id,
app_type,
bar_key,
bar_name,
page_title,
icon_path,
selected_icon_path,
display,
order_index,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from customer_foot_bar
where CUSTOMER_ID = #{customerId}
and APP_TYPE = #{appType}
and BAR_KEY = #{barKey}
</select>
<select id="listByAppTypeAndCustomerId" resultType="com.epmet.entity.CustomerFootBarEntity">
select id,
customer_id,
app_type,
bar_key,
bar_name,
page_title,
icon_path,
selected_icon_path,
display,
order_index,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from customer_foot_bar
where CUSTOMER_ID = #{customerId}
and app_type = #{appType}
and DEL_FLAG=0
</select>
<select id="listFootBarOwnerCustomerIds" resultType="java.lang.String">
select distinct CUSTOMER_ID
from customer_foot_bar fb
where CUSTOMER_ID != 'default'
</select>
<select id="getByAppTypeAndBarNameOfCustomer" resultType="com.epmet.entity.CustomerFootBarEntity">
select id,
customer_id,
app_type,
bar_key,
bar_name,
page_title,
icon_path,
selected_icon_path,
display,
order_index,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from customer_foot_bar
where CUSTOMER_ID = #{customerId}
and APP_TYPE = #{appType}
and BAR_NAME = #{barName}
</select>

Loading…
Cancel
Save