Browse Source

Merge branch 'dev_oper_role' into develop

dev_shibei_match
sunyuchao 4 years ago
parent
commit
f7074a03b9
  1. 14
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerStartPageController.java
  2. 2
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerStartPageDao.java
  3. 4
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerStartPageService.java
  4. 15
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerStartPageServiceImpl.java
  5. 18
      epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.11__customer_start_page.sql
  6. 1
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerStartPageDao.xml

14
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerStartPageController.java

@ -110,19 +110,17 @@ public class CustomerStartPageController {
}
/**
* @param listDTO
* @param formDTO
* @Author sun
* @Description 运营端-启动页保存
**/
@PostMapping("savestartpage")
public Result saveStartPage(@RequestBody List<SaveStartPageFromDTO> listDTO) {
if (null == listDTO || listDTO.size() < NumConstant.ONE) {
throw new RenException("参数错误,集合元素不能为空");
public Result saveStartPage(@RequestBody SaveStartPageFromDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SaveStartPageFromDTO.Save.class);
if (!"resi".equals(formDTO.getClientType()) && !"work".equals(formDTO.getClientType())) {
throw new RenException("参数错误,所属端类型值错误");
}
for (SaveStartPageFromDTO formDTO : listDTO) {
ValidatorUtils.validateEntity(formDTO, SaveStartPageFromDTO.Save.class);
}
customerStartPageService.saveStartPage(listDTO);
customerStartPageService.saveStartPage(formDTO);
return new Result();
}

2
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerStartPageDao.java

@ -44,5 +44,5 @@ public interface CustomerStartPageDao extends BaseDao<CustomerStartPageEntity> {
* @Author sun
* @Description 根据客户Id删除可能存在的配置数据
**/
int delByCustomerId(@Param("customerId") String customerId);
int delByCustomerId(@Param("customerId") String customerId, @Param("clientType") String clientType);
}

4
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerStartPageService.java

@ -106,11 +106,11 @@ public interface CustomerStartPageService extends BaseService<CustomerStartPageE
List<StartPageResultDTO> startPage(StartPageFromDTO fromDTO);
/**
* @param listDTO
* @param formDTO
* @Author sun
* @Description 运营端-启动页保存
**/
void saveStartPage(List<SaveStartPageFromDTO> listDTO);
void saveStartPage(SaveStartPageFromDTO formDTO);
/**
* @param fromDTO

15
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerStartPageServiceImpl.java

@ -154,24 +154,19 @@ public class CustomerStartPageServiceImpl extends BaseServiceImpl<CustomerStartP
}
/**
* @param listDTO
* @param formDTO
* @Author sun
* @Description 运营端-启动页保存
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void saveStartPage(List<SaveStartPageFromDTO> listDTO) {
public void saveStartPage(SaveStartPageFromDTO formDTO) {
//1.按客户Id删除可能存在的历史数据
baseDao.delByCustomerId(listDTO.get(0).getCustomerId());
baseDao.delByCustomerId(formDTO.getCustomerId(), formDTO.getClientType());
//2.新增客户设置数据
List<CustomerStartPageEntity> list = new ArrayList<>();
listDTO.forEach(l -> {
CustomerStartPageEntity entity = ConvertUtils.sourceToTarget(l, CustomerStartPageEntity.class);
list.add(entity);
});
insertBatch(list);
CustomerStartPageEntity entity = ConvertUtils.sourceToTarget(formDTO, CustomerStartPageEntity.class);
insert(entity);
}
/**

18
epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.11__customer_start_page.sql

@ -0,0 +1,18 @@
CREATE TABLE `customer_start_page` (
`ID` varchar(64) NOT NULL COMMENT '唯一标识',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
`CLIENT_TYPE` varchar(32) NOT NULL COMMENT '小程序所属端类型【居民端: resi 工作端: work】',
`URL` varchar(256) NOT NULL COMMENT '启动页文件url路径',
`TIME` int(11) NOT NULL DEFAULT '0' COMMENT '启动页展示时间,单位秒',
`TYPE` varchar(32) NOT NULL COMMENT '启动页文件类型(图片 - image、 视频 - video)',
`DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识:0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='客户小程序启动页配置';
INSERT INTO `customer_start_page` VALUES ('3c3a2860d22d11ebbc490050568f8cf7', 'default', 'resi', 'https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/internal/20210621/a6e19dd7a39646b58ba29700d7d7dd64.jpg', '5', 'image', '0', '0', 'APP_USER', '2021-06-21 09:07:31', 'APP_USER', '2021-06-21 09:07:31');
INSERT INTO `customer_start_page` VALUES ('45fb43a2d22d11ebbc490050568f8cf7', 'default', 'work', 'https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/internal/20210621/a6e19dd7a39646b58ba29700d7d7dd64.jpg', '5', 'image', '0', '0', 'APP_USER', '2021-06-21 09:07:31', 'APP_USER', '2021-06-21 09:07:31');

1
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerStartPageDao.xml

@ -22,6 +22,7 @@
customer_start_page
WHERE
customer_id = #{customerId}
AND client_type = #{clientType}
</delete>
</mapper>
Loading…
Cancel
Save