diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java index bdff667e81..1df41d92ae 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java @@ -84,7 +84,7 @@ public abstract class BaseRequestLogAspect { return result; } catch (ValidateException e) { result = handleValidateException(e); - resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getMsg(), ExceptionUtils.getErrorStackTrace(e)); + resultWarnLog(transactionSerial, getExecPeriod(startTime), result, e.getMsg(), ExceptionUtils.getErrorStackTrace(e)); } catch (DuplicateKeyException e) { result = handlerDuplicateKeyException(e); resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getMessage(), ExceptionUtils.getErrorStackTrace(e)); diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ThirdPlatformDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ThirdPlatformDTO.java new file mode 100644 index 0000000000..7a8efc43cd --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ThirdPlatformDTO.java @@ -0,0 +1,57 @@ +package com.epmet.dto; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @auther: zhangyong + * @date: 2021-04-08 17:27 + */ +@Data +public class ThirdPlatformDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 平台名称 + */ + @NotBlank(message = "平台名称 不能为空") + private String platformName; + + /** + * 平台唯一KEY + */ + @NotBlank(message = "平台唯一KEY 不能为空") + private String platformKey; + + /** + * 平台秘钥 + */ + @NotBlank(message = "平台秘钥 不能为空") + private String platformSecret; + + /** + * apiservice + */ + @NotBlank(message = "apiservice 不能为空") + private String apiService; + + /** + * 基础url + */ + @NotBlank(message = "基础url 不能为空") + private String baseUrl; + + /** + * icon + */ + @NotBlank(message = "icon 不能为空") + private String icon; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java new file mode 100644 index 0000000000..d2defb259d --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 客户 共用入参 + **/ +@Data +public class CustomerFormDTO { + + /** + * 客户id + **/ + @NotBlank(message = "客户id 不能为空") + private String customerId; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformNameFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformNameFormDTO.java new file mode 100644 index 0000000000..2fe4f8ed45 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformNameFormDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class PlatformNameFormDTO { + + /** + * 平台名称,用于模糊搜索 + **/ + @NotBlank(message = "平台名称 不能为空") + private String platformName; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformRegisterFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformRegisterFormDTO.java new file mode 100644 index 0000000000..9f7afda3ae --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformRegisterFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * 第三方平台-新增客户接入的第三方平台 + * + * @auther: zhangyong + * @date: 2021-04-08 17:27 + */ +@Data +public class PlatformRegisterFormDTO { + + /** + * 客户id + */ + @NotBlank(message = "客户id 不能为空") + private String customerId; + + /** + * 平台id列表 + */ + @NotNull(message = "平台id列表 不能为空") + private List platformIdList; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformUnregisterFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformUnregisterFormDTO.java new file mode 100644 index 0000000000..04cc64ae77 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformUnregisterFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 解除客户接入的平台 + * + * @auther: zhangyong + * @date: 2021-04-08 17:27 + */ +@Data +public class PlatformUnregisterFormDTO { + + /** + * 客户id + */ + @NotBlank(message = "客户id 不能为空") + private String customerId; + + /** + * 平台ID + */ + @NotBlank(message = "平台ID 不能为空") + private String platformId; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java index de315e253e..54c7cc7ca3 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java @@ -1,11 +1,14 @@ package com.epmet.controller; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.SaveOrUpdateCustSelPlatformFormDTO; -import com.epmet.dto.form.ThirdPlatformFormDTO; +import com.epmet.dto.ThirdPlatformDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.service.ThirdPlatformService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -89,4 +92,115 @@ public class ThirdPlatformController { thirdPlatformService.saveOrUpdateSelectedPlatformInfo(input.getCustomerId(), input.getActionKey(), input.getPlatforms()); return new Result(); } + + /** + * 第三方平台-平台列表模糊查询 + * + * @param formsDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 17:13 2021-04-08 + **/ + @PostMapping("list-platforms") + public Result> listPlatforms(@RequestBody PlatformNameFormDTO formsDTO) { + ValidatorUtils.validateEntity(formsDTO); + return new Result>().ok(thirdPlatformService.listPlatforms(formsDTO.getPlatformName())); + } + + /** + * 第三方平台-修改平台 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 17:31 2021-04-08 + **/ + @PostMapping("update-platform") + public Result updatePlatform(@RequestBody ThirdPlatformDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + if (StringUtils.isBlank(formDTO.getId())) { + throw new RenException("主键不能为空"); + } + thirdPlatformService.updatePlatform(formDTO); + return new Result(); + } + + /** + * 第三方平台-新增平台 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 17:31 2021-04-08 + **/ + @PostMapping("add-platform") + public Result addPlatform(@RequestBody ThirdPlatformDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(thirdPlatformService.addPlatform(formDTO)); + } + + /** + * 第三方平台-客户可接入的平台列表 + * 注:该客户还没有注册的平台列表。从thirdplatform表中找该客户没注册的(不在thirdplatform_customer_register中,或者在其中,但是del_flag为1的)返回 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 09:46 2021-04-09 + **/ + @PostMapping("customer/registrable-platform-list") + public Result> registrablePlatformList(@RequestBody CustomerFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(thirdPlatformService.listRegistrablePlatform(formDTO)); + } + + /** + * 第三方平台-客户已经接入的平台列表 + * 注:在thirdplatform_customer_register中的记录 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 09:46 2021-04-09 + **/ + @PostMapping("customer/registered-platform-list") + public Result> registeredPlatformList(@RequestBody CustomerFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(thirdPlatformService.listRegisteredPlatform(formDTO)); + } + + /** + * 第三方平台-解除客户接入的平台 + * 注:单个解除thirdplatform_customer_register表del_flag状态置为1 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 09:46 2021-04-09 + **/ + @PostMapping("customer/unregister-platform") + public Result unregisterPlatform(@RequestBody PlatformUnregisterFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + thirdPlatformService.unregisterPlatformCustomer(formDTO); + return new Result(); + } + + /** + * 第三方平台-新增客户接入的第三方平台 + * 注:新增该客户要接入的第三方平台。thirdplatform_customer_register表新增数据。customized_xxx默认从thirdplatform表取过来 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:34 2021-04-09 + **/ + @PostMapping("customer/register-platform") + public Result registerPlatform(@RequestBody PlatformRegisterFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + if (formDTO.getPlatformIdList().size() == NumConstant.ZERO) { + throw new RenException("formDTO.getPlatformIdList().size() == 0;平台id列表不能为空"); + } + thirdPlatformService.registerThirdPlatformCustomer(formDTO); + return new Result(); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java index cbae094292..3dc3001baf 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java @@ -18,7 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.result.ThirdplatformResultDTO; +import com.epmet.dto.form.PlatformUnregisterFormDTO; import com.epmet.entity.ThirdplatformCustomerRegisterEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -26,7 +26,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * + * * * @author generator generator@elink-cn.com * @since v1.0.0 2021-03-15 @@ -35,4 +35,24 @@ import java.util.List; public interface ThirdplatformCustomerRegisterDao extends BaseDao { ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId); -} \ No newline at end of file + + /** + * 批量新增 + * @param list + * @return int + * @Author zhangyong + * @Date 11:05 2021-04-09 + **/ + int batchInsertThirdplatformCustomerRegister(@Param("list") List list); + + /** + * 第三方平台-解除客户接入的平台 + * 注:单个解除.thirdplatform_customer_register表del_flag状态置为1 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 10:15 2021-04-09 + **/ + void unregisterPlatformCustomer(PlatformUnregisterFormDTO formDTO); +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java index 8b5e7840cc..74b53823b3 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ThirdPlatformDTO; import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.entity.ThirdplatformEntity; import org.apache.ibatis.annotations.Mapper; @@ -26,7 +27,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * + * * * @author generator generator@elink-cn.com * @since v1.0.0 2021-03-15 @@ -43,4 +44,46 @@ public interface ThirdplatformDao extends BaseDao { List listAvailablePlatformsByCustomerAndAction(@Param("customerId") String customerId, @Param("actionKey") String actionKey); List listSelectableByCustomerAndActionGroup(@Param("customerId") String customerId, @Param("actionKey") String actionKey); -} \ No newline at end of file + + /** + * 第三方平台-平台列表模糊查询 + * + * @param platformName 平台名称,用于模糊搜索 + * @return java.util.List + * @Author zhangyong + * @Date 17:14 2021-04-08 + **/ + List selectListPlatforms(@Param("platformName") String platformName); + + /** + * 第三方平台-客户可接入的平台列表 + * 注:该客户还没有注册的平台列表。从thirdplatform表中找该客户没注册的(不在thirdplatform_customer_register中,或者在其中,但是del_flag为1的)返回 + * + * @param customerId + * @return java.util.List + * @Author zhangyong + * @Date 09:47 2021-04-09 + **/ + List selectListRegistrablePlatform(@Param("customerId") String customerId); + + /** + * 第三方平台-客户已经接入的平台列表 + * 注:在thirdplatform_customer_register中的记录 + * + * @param customerId + * @return java.util.List + * @Author zhangyong + * @Date 09:47 2021-04-09 + **/ + List selectListRegisteredPlatform(@Param("customerId") String customerId); + + /** + * 查询第三方平台 + * + * @param platformIds + * @return java.util.List + * @Author zhangyong + * @Date 10:51 2021-04-09 + **/ + List selectListThirdPlatform(@Param("platformIds") List platformIds); +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java index 9a0042f6e7..570ce04d49 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java @@ -1,6 +1,10 @@ package com.epmet.service; +import com.epmet.dto.ThirdPlatformDTO; +import com.epmet.dto.form.CustomerFormDTO; import com.epmet.dto.form.ThirdPlatformFormDTO; +import com.epmet.dto.form.PlatformRegisterFormDTO; +import com.epmet.dto.form.PlatformUnregisterFormDTO; import com.epmet.dto.result.ThirdplatformResultDTO; import java.util.List; @@ -22,4 +26,78 @@ public interface ThirdPlatformService { void updateCustomizePlatformInfo(ThirdPlatformFormDTO input); void saveOrUpdateSelectedPlatformInfo(String customerId, String actionKey, List platforms); -} \ No newline at end of file + + /** + * 第三方平台-平台列表模糊查询 + * + * @param platformName 平台名称,用于模糊搜索 + * @return java.util.List + * @Author zhangyong + * @Date 17:14 2021-04-08 + **/ + List listPlatforms(String platformName); + + /** + * 第三方平台-修改平台 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 17:43 2021-04-08 + **/ + void updatePlatform(ThirdPlatformDTO formDTO); + + /** + * 第三方平台-新增平台 + * + * @param formDTO + * @return com.epmet.dto.ThirdPlatformDTO + * @Author zhangyong + * @Date 17:43 2021-04-08 + **/ + ThirdPlatformDTO addPlatform(ThirdPlatformDTO formDTO); + + /** + * 第三方平台-客户可接入的平台列表 + * 注:该客户还没有注册的平台列表。从thirdplatform表中找该客户没注册的(不在thirdplatform_customer_register中,或者在其中,但是del_flag为1的)返回 + * + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 09:47 2021-04-09 + **/ + List listRegistrablePlatform(CustomerFormDTO formDTO); + + /** + * 第三方平台-客户已经接入的平台列表 + * 注:在thirdplatform_customer_register中的记录 + * + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 09:47 2021-04-09 + **/ + List listRegisteredPlatform(CustomerFormDTO formDTO); + + /** + * 第三方平台-解除客户接入的平台 + * 注:单个解除.thirdplatform_customer_register表del_flag状态置为1 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 10:15 2021-04-09 + **/ + void unregisterPlatformCustomer(PlatformUnregisterFormDTO formDTO); + + /** + * 第三方平台-新增客户接入的第三方平台 + * 注:新增该客户要接入的第三方平台。thirdplatform_customer_register表新增数据。customized_xxx默认从thirdplatform表取过来 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 10:15 2021-04-09 + **/ + void registerThirdPlatformCustomer(PlatformRegisterFormDTO formDTO); +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java index 7e92c34223..3d6393e17e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java @@ -2,24 +2,27 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.ThirdplatformCustomerActionDao; import com.epmet.dao.ThirdplatformCustomerRegisterDao; import com.epmet.dao.ThirdplatformDao; +import com.epmet.dto.ThirdPlatformDTO; +import com.epmet.dto.form.CustomerFormDTO; import com.epmet.dto.form.ThirdPlatformFormDTO; +import com.epmet.dto.form.PlatformRegisterFormDTO; +import com.epmet.dto.form.PlatformUnregisterFormDTO; import com.epmet.dto.result.ThirdplatformResultDTO; -import com.epmet.entity.ThirdplatformActionEntity; import com.epmet.entity.ThirdplatformCustomerActionEntity; import com.epmet.entity.ThirdplatformCustomerRegisterEntity; +import com.epmet.entity.ThirdplatformEntity; import com.epmet.service.ThirdPlatformService; -import jodd.util.CollectionUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; -import javax.validation.constraints.NotBlank; +import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; @Service public class ThirdPlatformServiceImpl implements ThirdPlatformService { @@ -105,4 +108,56 @@ public class ThirdPlatformServiceImpl implements ThirdPlatformService { entity.setCustomizedPlatformIcon(platformFormDTO.getIcon()); thirdplatformCustomerRegisterDao.update(entity, conditions); } + + @Override + public List listPlatforms(String platformName) { + return thirdplatformDao.selectListPlatforms(platformName); + } + + @Override + public void updatePlatform(ThirdPlatformDTO formDTO) { + ThirdplatformEntity entity = ConvertUtils.sourceToTarget(formDTO, ThirdplatformEntity.class); + thirdplatformDao.updateById(entity); + } + + @Override + public ThirdPlatformDTO addPlatform(ThirdPlatformDTO formDTO) { + ThirdplatformEntity entity = ConvertUtils.sourceToTarget(formDTO, ThirdplatformEntity.class); + thirdplatformDao.insert(entity); + formDTO.setId(entity.getId()); + return formDTO; + } + + @Override + public List listRegistrablePlatform(CustomerFormDTO formDTO) { + return thirdplatformDao.selectListRegistrablePlatform(formDTO.getCustomerId()); + } + + @Override + public List listRegisteredPlatform(CustomerFormDTO formDTO) { + return thirdplatformDao.selectListRegisteredPlatform(formDTO.getCustomerId()); + } + + @Override + public void unregisterPlatformCustomer(PlatformUnregisterFormDTO formDTO) { + thirdplatformCustomerRegisterDao.unregisterPlatformCustomer(formDTO); + } + + @Override + public void registerThirdPlatformCustomer(PlatformRegisterFormDTO formDTO) { + List entityList = new ArrayList<>(); + + List thirdPlatforms = thirdplatformDao.selectListThirdPlatform(formDTO.getPlatformIdList()); + for (ThirdPlatformDTO dto : thirdPlatforms) { + ThirdplatformCustomerRegisterEntity entity = new ThirdplatformCustomerRegisterEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setPlatformId(dto.getId()); + entity.setCustomizedPlatformName(dto.getPlatformName()); + entity.setCustomizedPlatformIcon(dto.getIcon()); + entityList.add(entity); + } + if (entityList.size() > NumConstant.ZERO) { + thirdplatformCustomerRegisterDao.batchInsertThirdplatformCustomerRegister(entityList); + } + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml index e4cdddc98d..9ab368a8bc 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml @@ -35,4 +35,44 @@ and PLATFORM_ID = #{platformId} and DEL_FLAG = 0 - \ No newline at end of file + + + insert into thirdplatform_customer_register + ( + ID, + CUSTOMER_ID, + PLATFORM_ID, + CUSTOMIZED_PLATFORM_NAME, + CUSTOMIZED_PLATFORM_ICON, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.platformId}, + #{item.customizedPlatformName}, + #{item.customizedPlatformIcon}, + '0', + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + + + + UPDATE thirdplatform_customer_register + SET DEL_FLAG = '1' + WHERE + DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} AND PLATFORM_ID = #{platformId} + + diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml index beec9ed36d..e27f550f11 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml @@ -87,4 +87,69 @@ and ta.ACTION_KEY = #{actionKey} and tcr.DEL_FLAG = 0 - \ No newline at end of file + + + + + + + + + diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomizedDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomizedDTO.java index aa54ed57bf..e9c924f24c 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomizedDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomizedDTO.java @@ -64,4 +64,9 @@ public class CustomizedDTO implements Serializable { * 来源app(政府端:gov、居民端:resi) */ private String fromApp; + + /** + * 业务域名是否必填标识:0 [业务域名]字段 非必填; 1 [业务域名]字段 必填. + */ + private String isDomainName; } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/SaveFunctionCustomizedFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/SaveFunctionCustomizedFormDTO.java index 20d3fd5298..e9fbe3c0ed 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/SaveFunctionCustomizedFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/SaveFunctionCustomizedFormDTO.java @@ -61,7 +61,6 @@ public class SaveFunctionCustomizedFormDTO implements Serializable { /** * 业务域名(https;//... 无端口号) */ - @NotBlank(message = "业务域名(https;//... 无端口号)不能为空") private String domainName; /** @@ -69,4 +68,10 @@ public class SaveFunctionCustomizedFormDTO implements Serializable { */ @NotBlank(message = "来源app(工作端:gov、居民端:resi)不能为空") private String fromApp; + + /** + * 业务域名是否必填标识:0 [业务域名]字段 非必填; 1 [业务域名]字段 必填. + */ + @NotBlank(message = "业务域名是否必填标识不能为空") + private String isDomainName; } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomizedFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomizedFormDTO.java index ec690c3a49..1af9144c50 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomizedFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomizedFormDTO.java @@ -61,7 +61,6 @@ public class UpdateCustomizedFormDTO implements Serializable { /** * 业务域名 */ - @NotBlank(message = "业务域名不能为空") private String domainName; /** @@ -69,4 +68,10 @@ public class UpdateCustomizedFormDTO implements Serializable { */ @NotBlank(message = "来源app(工作端:gov、居民端:resi)不能为空") private String fromApp; + + /** + * 业务域名是否必填标识:0 [业务域名]字段 非必填; 1 [业务域名]字段 必填. + */ + @NotBlank(message = "业务域名是否必填标识不能为空") + private String isDomainName; } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerResultDTO.java index 3c993374b3..162ce43cd0 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerResultDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerResultDTO.java @@ -71,4 +71,8 @@ public class CustomerResultDTO implements Serializable { */ private String functionExplain; + /** + * 业务域名是否必填标识:0 [业务域名]字段 非必填; 1 [业务域名]字段 必填. + */ + private String isDomainName; } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionCustomizedDetailResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionCustomizedDetailResultDTO.java index e232ce5f2f..8595c2e20c 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionCustomizedDetailResultDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionCustomizedDetailResultDTO.java @@ -63,4 +63,9 @@ public class FunctionCustomizedDetailResultDTO implements Serializable { * 是否有客户在使用(0:否 1:是) */ private Integer isApply; + + /** + * 业务域名是否必填标识:0 [业务域名]字段 非必填; 1 [业务域名]字段 必填. + */ + private String isDomainName; } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionCustomizedController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionCustomizedController.java index 8326a0a528..f217afd16c 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionCustomizedController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionCustomizedController.java @@ -17,6 +17,8 @@ package com.epmet.controller; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; @@ -31,6 +33,7 @@ import com.epmet.dto.result.FunctionCustomizedDetailResultDTO; import com.epmet.dto.result.FunctionCustomizedListResultDTO; import com.epmet.excel.FunctionCustomizedExcel; import com.epmet.service.FunctionCustomizedService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -105,6 +108,9 @@ public class FunctionCustomizedController { @PostMapping("savefunctioncustomized") public Result saveFunctionCustomized(@RequestBody SaveFunctionCustomizedFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO); + if (NumConstant.ONE_STR.equals(formDTO.getIsDomainName()) && StringUtils.isBlank(formDTO.getDomainName())) { + throw new RenException("业务域名为空!"); + } functionCustomizedService.saveFunctionCustomized(formDTO); return new Result(); } @@ -142,7 +148,7 @@ public class FunctionCustomizedController { /** * 定制功能修改 - * 有客户在使用该功能时则不允许修改上下架状态、业务域名和外链地址、所属端app, + * 有客户在使用该功能时则不允许修改上下架状态、业务域名、业务域名是否必填标识(2021-04-12日追加)和外链地址、所属端app, * 只能修改功能名称和大小图标、功能说明 * 修改的要判断是否有客户在使用,有用的要批量更新已使用客户数据 * @@ -154,6 +160,9 @@ public class FunctionCustomizedController { @PostMapping("updatecustomized") public Result updateCustomized(@RequestBody UpdateCustomizedFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO); + if (NumConstant.ONE_STR.equals(formDTO.getIsDomainName()) && StringUtils.isBlank(formDTO.getDomainName())) { + throw new RenException("业务域名为空!"); + } return functionCustomizedService.updateCustomized(formDTO); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionCustomizedEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionCustomizedEntity.java index 45983b12b0..23aace2a98 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionCustomizedEntity.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionCustomizedEntity.java @@ -73,4 +73,9 @@ public class FunctionCustomizedEntity extends BaseEpmetEntity { */ private String fromApp; + /** + * 业务域名是否必填标识:0 [业务域名]字段 非必填; 1 [业务域名]字段 必填. + */ + private String isDomainName; + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedServiceImpl.java index 9a7a1dc122..4134eed6ac 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedServiceImpl.java @@ -139,6 +139,7 @@ public class FunctionCustomizedServiceImpl extends BaseServiceImpl FROM_APP = #{fromApp}, + + IS_DOMAIN_NAME = #{isDomainName}, + UPDATED_TIME = now() WHERE DEL_FLAG = '0'