Browse Source

Merge remote-tracking branch 'origin/develop' into release_temp

dev_shibei_match
yinzuomei 4 years ago
parent
commit
512c27be39
  1. 21
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/HealthCheckController.java
  2. 2
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java
  3. 5
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java
  4. 15
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java
  5. 6
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java
  6. 6
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java
  7. 24
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java
  8. 16
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml

21
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/HealthCheckController.java

@ -0,0 +1,21 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("healthcheck")
public class HealthCheckController {
/**
* http健康检查
* @return
*/
@PostMapping("http")
public Result httpHealthCheck() {
return new Result();
}
}

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

@ -74,6 +74,8 @@ public class CustomerFootBarFormDTO {
@NotNull(message = "显示状态不能为空", groups = { UpdateDisplayStatusGroup.class })
private Boolean display;
@NotBlank(message = "操作人id不能为空", groups = {DeleteFootbarsGroup.class, SaveOrderGroup.class, UpdateDisplayStatusGroup.class})
private String userId;
/**
* 排序索引号dto
*/

5
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java

@ -5,6 +5,11 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerFootBarDTO;
import com.epmet.dto.form.CheckFloatFootBarFormDTO;
import com.epmet.dto.form.CustomerFootBarFormDTO;
import com.epmet.feign.fallback.OperCustomizeOpenFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.CustomerFunctionListFormDTO;
import com.epmet.dto.result.CheckFloatFootBarResultDTO;
import com.epmet.dto.result.DefaultFunctionListResultDTO;

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

@ -220,9 +220,10 @@ public class CustomerFootBarController {
* @return
*/
@PostMapping("saveorder")
public Result saveOrder(@RequestBody CustomerFootBarFormDTO form) {
public Result saveOrder(@LoginUser TokenDto tokenDto, @RequestBody CustomerFootBarFormDTO form) {
form.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(form, CustomerFootBarFormDTO.SaveOrderGroup.class);
customerFootBarService.saveOrder(form.getOrderList());
customerFootBarService.saveOrder(form.getUserId(),form.getOrderList());
return new Result();
}
@ -232,9 +233,10 @@ public class CustomerFootBarController {
* @return
*/
@PostMapping("updatedisplaystatus")
public Result updateDisplayStatus(@RequestBody CustomerFootBarFormDTO form) {
public Result updateDisplayStatus(@LoginUser TokenDto tokenDto,@RequestBody CustomerFootBarFormDTO form) {
form.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(form, CustomerFootBarFormDTO.UpdateDisplayStatusGroup.class);
customerFootBarService.updateDisplayStatus(form.getId(), form.getDisplay());
customerFootBarService.updateDisplayStatus(form.getId(), form.getDisplay(),form.getUserId());
return new Result();
}
@ -256,9 +258,10 @@ public class CustomerFootBarController {
* @return
*/
@PostMapping("deletefootbar")
public Result deleteFootBar(@RequestBody CustomerFootBarFormDTO form) {
public Result deleteFootBar(@LoginUser TokenDto tokenDto, @RequestBody CustomerFootBarFormDTO form) {
form.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(form, CustomerFootBarFormDTO.DeleteFootbarsGroup.class);
customerFootBarService.deleteFootBar(form.getId());
customerFootBarService.deleteFootBar(form.getId(),form.getUserId());
return new Result();
}

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

@ -64,7 +64,7 @@ public interface CustomerFootBarDao extends BaseDao<CustomerFootBarEntity> {
* @param orderIndex
* @return
*/
Integer updateOrder(@Param("id") String id, @Param("orderIndex") Integer orderIndex);
Integer updateOrder(@Param("id") String id, @Param("orderIndex") Integer orderIndex,@Param("userId") String userId);
CustomerFootBarEntity getByAppTypeAndBarKeyOfCustomer(@Param("customerId") String customerId,
@Param("appType") String appType,
@ -77,7 +77,7 @@ public interface CustomerFootBarDao extends BaseDao<CustomerFootBarEntity> {
List<CustomerFootBarEntity> listByAppTypeAndCustomerId(@Param("customerId") String customerId,
@Param("appType") String appType);
void updateDisplayStatus(@Param("id") String id, @Param("display") Boolean display);
void updateDisplayStatus(@Param("id") String id, @Param("display") Boolean display,@Param("userId")String userId);
List<String> listFootBarOwnerCustomerIds();
@ -119,4 +119,6 @@ public interface CustomerFootBarDao extends BaseDao<CustomerFootBarEntity> {
@Param("iconPath")String iconPath,
@Param("selectedIconPath")String selectedIconPath,
@Param("floatIconPath")String floatIconPath);
int updateFootBarDel(@Param("id") String id, @Param("userId")String userId);
}

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

@ -110,15 +110,15 @@ public interface CustomerFootBarService extends BaseService<CustomerFootBarEntit
CustomerFootBarResultDTO getFootBarDetail(String id);
void saveOrder(List<CustomerFootBarFormDTO.OrderIndexDTO> orderList);
void saveOrder(String userId,List<CustomerFootBarFormDTO.OrderIndexDTO> orderList);
CustomerFootBarEntity getByAppTypeAndBarKeyOfCustomer(String customerId, String appType, String barKey);
void updateDisplayStatus(String id, Boolean display);
void updateDisplayStatus(String id, Boolean display,String userId);
void addDefault4Customer(String customerId, String appType);
void deleteFootBar(String id);
void deleteFootBar(String id,String userId);
/**
* 校验当前客户是否可以选择浮起footbar模式

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

@ -134,7 +134,7 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
CustomerFootBarEntity entity = new CustomerFootBarEntity();
entity.setAppType(form.getAppType());
entity.setCustomerId("default"); // 只能为默认客户创建
entity.setBarKey(form.getBarKey());
entity.setBarKey(form.getBarKey().trim());
entity.setBarName(form.getBarName());
entity.setIconPath(form.getIconPath());
entity.setPageTitle(form.getPageTitle());
@ -212,9 +212,9 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
@Transactional
@Override
public void saveOrder(List<CustomerFootBarFormDTO.OrderIndexDTO> orderList) {
public void saveOrder(String userId,List<CustomerFootBarFormDTO.OrderIndexDTO> orderList) {
for (CustomerFootBarFormDTO.OrderIndexDTO idx : orderList) {
baseDao.updateOrder(idx.getId(), idx.getOrderIndex());
baseDao.updateOrder(idx.getId(), idx.getOrderIndex(),userId);
}
if (!CollectionUtils.isEmpty(orderList)) {
@ -237,8 +237,8 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
@Transactional
@Override
public void updateDisplayStatus(String id, Boolean display) {
baseDao.updateDisplayStatus(id, display);
public void updateDisplayStatus(String id, Boolean display,String userId) {
baseDao.updateDisplayStatus(id, display,userId);
CustomerFootBarEntity footBarEntity = baseDao.selectById(id);
@ -271,11 +271,12 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
@Transactional
@Override
public void deleteFootBar(String id) {
public void deleteFootBar(String id,String userId) {
CustomerFootBarEntity defaultFootbar = baseDao.selectById(id);
// 注释07.28
baseDao.physicsDeleteByAppTypeAndBarKey(defaultFootbar.getAppType(), defaultFootbar.getBarKey(),id);
// 注释07.28,暂时不要物理删除
// baseDao.physicsDeleteByAppTypeAndBarKey(defaultFootbar.getAppType(), defaultFootbar.getBarKey(),id);
defaultFootbar.setDelFlag("1");
baseDao.updateFootBarDel(id,userId);
// 删除缓存中的footbar。若缓存删除失败,则事务回滚,db中的不应该成功
redisUtils.delete(RedisKeys.getCustomerFootbarKey(defaultFootbar.getCustomerId(), defaultFootbar.getAppType()));
}
@ -286,7 +287,7 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
*/
private void validateBeforeCreate(CustomerFootBarFormDTO form) {
synchronized (this) {
int uniqueCount1 = baseDao.count4Unique(form.getCustomerId(), form.getAppType(), form.getBarKey(), null);
int uniqueCount1 = baseDao.count4Unique(form.getCustomerId(), form.getAppType(), form.getBarKey().trim(), 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(),
@ -352,6 +353,7 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
@Override
public void createFootBarCustomer(SyncFootBar4CustomerFormDTO form) {
if (!CollectionUtils.isEmpty(form.getSyncBarKeyList())) {
// 根据key, 查找产品配置中该footbar信息
List<CustomerFootBarEntity> syncList = baseDao.selectListByKey(Constant.DEFAULT_CUSTOMER, form.getAppType(), form.getSyncBarKeyList());
syncList.forEach(syncEntity -> {
baseDao.updateCustomerFootBarByKey(form.getCustomerId(),
@ -366,6 +368,7 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
);
});
}
// 产品配置有,当前客户未上线的,直接增加
if (!CollectionUtils.isEmpty(form.getAddBarKeyList())) {
List<CustomerFootBarEntity> addList = baseDao.selectListByKey(Constant.DEFAULT_CUSTOMER, form.getAppType(), form.getAddBarKeyList());
addList.forEach(addEntity -> {
@ -374,6 +377,7 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
footBarFormDTO.setAppType(form.getAppType());
footBarFormDTO.setBarKey(addEntity.getBarKey());
footBarFormDTO.setBarName(addEntity.getBarName());
// 校验一下是否存在
validateBeforeCreate(footBarFormDTO);
CustomerFootBarEntity entity = ConvertUtils.sourceToTarget(addEntity, CustomerFootBarEntity.class);

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

@ -24,14 +24,16 @@
<!--更新顺序号-->
<update id="updateOrder">
update customer_foot_bar
set ORDER_INDEX = #{orderIndex}
set ORDER_INDEX = #{orderIndex},UPDATED_BY=#{userId},UPDATED_TIME=NOW()
where ID = #{id}
and DEL_FLAG='0'
</update>
<update id="updateDisplayStatus">
update customer_foot_bar
set DISPLAY=#{display}
set DISPLAY=#{display},UPDATED_BY=#{userId},UPDATED_TIME=NOW()
where ID = #{id}
and DEL_FLAG='0'
</update>
<!--物理删除-->
@ -161,6 +163,7 @@
where CUSTOMER_ID = #{customerId}
and APP_TYPE = #{appType}
and BAR_KEY = #{barKey}
and DEL_FLAG='0'
</select>
<select id="listByAppTypeAndCustomerId" resultType="com.epmet.entity.CustomerFootBarEntity">
@ -191,6 +194,7 @@
select distinct CUSTOMER_ID
from customer_foot_bar fb
where CUSTOMER_ID != 'default'
and DEL_FLAG='0'
</select>
<select id="getByAppTypeAndBarNameOfCustomer" resultType="com.epmet.entity.CustomerFootBarEntity">
@ -215,6 +219,7 @@
where CUSTOMER_ID = #{customerId}
and APP_TYPE = #{appType}
and BAR_NAME = #{barName}
and DEL_FLAG='0'
</select>
<select id="selectNotOnlineFootBars" parameterType="map" resultType="com.epmet.entity.CustomerFootBarEntity">
@ -254,7 +259,6 @@
where m.DEL_FLAG='0'
and m.CUSTOMER_ID=#{customerId}
and m.app_type=#{appType}
and m.DISPLAY='1'
and m.BAR_KEY in
<foreach collection="barKeyList" item="barKey" open="( " separator=" , " index="index" close=")">
#{barKey}
@ -276,4 +280,10 @@
AND BAR_KEY = #{barKey}
AND DEL_FLAG = '0'
</update>
<update id="updateFootBarDel" parameterType="map">
UPDATE customer_foot_bar
set DEL_FLAG='1',UPDATED_BY = #{userId}, UPDATED_TIME = NOW()
where id=#{id}
</update>
</mapper>
Loading…
Cancel
Save