Browse Source

heart工作端-获取自定义配置、保存修改自定义配置

master
yinzuomei 5 years ago
parent
commit
15a15c8855
  1. 23
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActCustomizedFormDTO.java
  2. 62
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/SaveActCustomizedFormDTO.java
  3. 51
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActCustomizedResultDTO.java
  4. 40
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActCustomizedConstant.java
  5. 34
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ActCustomizedController.java
  6. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActCustomizedDao.java
  7. 21
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActCustomizedService.java
  8. 61
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActCustomizedServiceImpl.java
  9. 17
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActCustomizedDao.xml

23
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActCustomizedFormDTO.java

@ -0,0 +1,23 @@
package com.epmet.dto.form.work;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 获取自定义配置项-入参
*
* @author yinzuomei@elink-cn.com
* @date 2020/7/20 15:17
*/
@Data
public class ActCustomizedFormDTO implements Serializable {
private static final long serialVersionUID = 7089647420851532829L;
public interface AddUserInternalGroup {}
/**
* 客户id
*/
@NotBlank(message = "客户id不能为空", groups = { AddUserInternalGroup.class })
private String customerId;
}

62
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/SaveActCustomizedFormDTO.java

@ -0,0 +1,62 @@
package com.epmet.dto.form.work;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 保存自定义配置-入参
*
* @author yinzuomei@elink-cn.com
* @date 2020/7/20 17:22
*/
@Data
public class SaveActCustomizedFormDTO implements Serializable {
private static final long serialVersionUID = 5571356065160809543L;
public interface AddUserInternalGroup {}
public interface AddUserShowGroup extends CustomerClientShowGroup {}
/**
* act_customized主键
*/
@NotBlank(message = "主键不能为空", groups = { AddUserInternalGroup.class })
private String actCustomizedId;
/**
* 标题志愿者去哪儿
*/
@NotBlank(message = "标题不能为空", groups = { AddUserShowGroup.class })
private String titleName;
/**
* 咨询热线
*/
@NotBlank(message = "咨询热线不能为空", groups = { AddUserShowGroup.class })
private String hotLine;
/**
* 活动列表
*/
@NotBlank(message = "活动列表名称不能为空", groups = { AddUserShowGroup.class })
private String actListName;
/**
* 爱心榜
*/
@NotBlank(message = "爱心榜列表名称不能为空", groups = { AddUserShowGroup.class })
private String heartRankName;
/**
* 活动回顾
*/
@NotBlank(message = "活动回顾列表名称不能为空", groups = { AddUserShowGroup.class })
private String actReviewName;
/**
* 我的活动
*/
@NotBlank(message = "我的回顾列表名称不能为空", groups = { AddUserShowGroup.class })
private String myActName;
}

51
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActCustomizedResultDTO.java

@ -0,0 +1,51 @@
package com.epmet.dto.result.work;
import lombok.Data;
import java.io.Serializable;
/**
* 获取自定义配置项-返参
*
* @author yinzuomei@elink-cn.com
* @date 2020/7/20 15:03
*/
@Data
public class ActCustomizedResultDTO implements Serializable {
private static final long serialVersionUID = 5784819474548493258L;
/**
* act_customized主键
*/
private String actCustomizedId;
/**
* 标题志愿者去哪儿
*/
private String titleName;
/**
* 咨询热线
*/
private String hotLine;
/**
* 活动列表
*/
private String actListName;
/**
* 爱心榜
*/
private String heartRankName;
/**
* 活动回顾
*/
private String actReviewName;
/**
* 我的活动
*/
private String myActName;
}

40
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActCustomizedConstant.java

@ -0,0 +1,40 @@
package com.epmet.constant;
/**
* 爱心互助自定义配置项
*
* @author yinzuomei@elink-cn.com
* @date 2020/7/20 16:54
*/
public interface ActCustomizedConstant {
/**
* 标题志愿者去哪儿
*/
String TITLE_NAME = "志愿者去哪儿";
/**
* 咨询热线
*/
String HOT_LINE = "";
/**
* 活动列表
*/
String ACT_LIST_NAME = "活动列表";
/**
* 爱心榜
*/
String HEART_RANK_NAME = "爱心榜";
/**
* 活动回顾
*/
String ACT_REVIEW_NAME = "活动回顾";
/**
* 我的活动
*/
String MY_ACT_NAME = "我的活动";
}

34
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ActCustomizedController.java

@ -17,8 +17,15 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.work.ActCustomizedFormDTO;
import com.epmet.dto.form.work.SaveActCustomizedFormDTO;
import com.epmet.dto.result.work.ActCustomizedResultDTO;
import com.epmet.service.ActCustomizedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -36,6 +43,31 @@ public class ActCustomizedController {
@Autowired
private ActCustomizedService actCustomizedService;
/**
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.work.ActCustomizedResultDTO>
* @param formDTO
* @author yinzuomei
* @description 获取当前客户下爱心互助模块自定义配置项如果没有配置返回系统默认
* @Date 2020/7/20 15:42
**/
@PostMapping("getconfigs")
public Result<ActCustomizedResultDTO> getConfigs(@RequestBody ActCustomizedFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, ActCustomizedFormDTO.AddUserInternalGroup.class);
ActCustomizedResultDTO resultDTO=actCustomizedService.getConfigs(formDTO);
return new Result<ActCustomizedResultDTO>().ok(resultDTO);
}
/**
* @return com.epmet.commons.tools.utils.Result
* @param formDTO
* @author yinzuomei
* @description 保存自定义配置
* @Date 2020/7/20 17:25
**/
@PostMapping("save")
public Result saveConfigs(@RequestBody SaveActCustomizedFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, SaveActCustomizedFormDTO.AddUserShowGroup.class,SaveActCustomizedFormDTO.AddUserInternalGroup.class);
actCustomizedService.saveConfigs(formDTO);
return new Result();
}
}

11
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActCustomizedDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.work.ActCustomizedResultDTO;
import com.epmet.entity.ActCustomizedEntity;
import org.apache.ibatis.annotations.Mapper;
@ -29,5 +30,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ActCustomizedDao extends BaseDao<ActCustomizedEntity> {
/**
* @param customerId
* @return com.epmet.dto.result.work.ActCustomizedResultDTO
* @author yinzuomei
* @description 获取当前客户下爱心互助模块自定义配置项如果没有配置返回系统默认
* @Date 2020/7/20 17:04
**/
ActCustomizedResultDTO selectConfigsByCustomerId(String customerId);
}

21
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActCustomizedService.java

@ -20,6 +20,9 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.ActCustomizedDTO;
import com.epmet.dto.form.work.ActCustomizedFormDTO;
import com.epmet.dto.form.work.SaveActCustomizedFormDTO;
import com.epmet.dto.result.work.ActCustomizedResultDTO;
import com.epmet.entity.ActCustomizedEntity;
import java.util.List;
@ -92,4 +95,22 @@ public interface ActCustomizedService extends BaseService<ActCustomizedEntity> {
* @date 2020-07-19
*/
void delete(String[] ids);
/**
* @return com.epmet.dto.result.work.ActCustomizedResultDTO
* @param formDTO
* @author yinzuomei
* @description 获取当前客户下爱心互助模块自定义配置项如果没有配置返回系统默认
* @Date 2020/7/20 15:42
**/
ActCustomizedResultDTO getConfigs(ActCustomizedFormDTO formDTO);
/**
* @return void
* @param formDTO
* @author yinzuomei
* @description 保存自定义配置
* @Date 2020/7/20 17:26
**/
void saveConfigs(SaveActCustomizedFormDTO formDTO);
}

61
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActCustomizedServiceImpl.java

@ -20,15 +20,21 @@ 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.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.constant.ActCustomizedConstant;
import com.epmet.dao.ActCustomizedDao;
import com.epmet.dto.ActCustomizedDTO;
import com.epmet.dto.form.work.ActCustomizedFormDTO;
import com.epmet.dto.form.work.SaveActCustomizedFormDTO;
import com.epmet.dto.result.work.ActCustomizedResultDTO;
import com.epmet.entity.ActCustomizedEntity;
import com.epmet.redis.ActCustomizedRedis;
import com.epmet.service.ActCustomizedService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -45,7 +51,7 @@ import java.util.Map;
*/
@Service
public class ActCustomizedServiceImpl extends BaseServiceImpl<ActCustomizedDao, ActCustomizedEntity> implements ActCustomizedService {
private Logger logger = LogManager.getLogger(ActCustomizedServiceImpl.class);
@Autowired
private ActCustomizedRedis actCustomizedRedis;
@ -101,4 +107,55 @@ public class ActCustomizedServiceImpl extends BaseServiceImpl<ActCustomizedDao,
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @return com.epmet.dto.result.work.ActCustomizedResultDTO
* @param formDTO
* @author yinzuomei
* @description 获取当前客户下爱心互助模块自定义配置项如果没有配置返回系统默认
* @Date 2020/7/20 17:27
**/
@Override
public ActCustomizedResultDTO getConfigs(ActCustomizedFormDTO formDTO) {
ActCustomizedResultDTO actCustomizedResultDTO = baseDao.selectConfigsByCustomerId(formDTO.getCustomerId());
if (null == actCustomizedResultDTO) {
logger.info(String.format("客户id%s没有自定义爱心互助相关图标名称,初始化默认值插入数据库", formDTO.getCustomerId()));
ActCustomizedEntity actCustomizedEntity = new ActCustomizedEntity();
actCustomizedEntity.setCustomerId(formDTO.getCustomerId());
actCustomizedEntity.setTitleName(ActCustomizedConstant.TITLE_NAME);
actCustomizedEntity.setHotline(ActCustomizedConstant.HOT_LINE);
actCustomizedEntity.setActListName(ActCustomizedConstant.ACT_LIST_NAME);
actCustomizedEntity.setHeartRankName(ActCustomizedConstant.HEART_RANK_NAME);
actCustomizedEntity.setActReviewName(ActCustomizedConstant.ACT_REVIEW_NAME);
actCustomizedEntity.setMyActName(ActCustomizedConstant.MY_ACT_NAME);
insert(actCustomizedEntity);
actCustomizedResultDTO = ConvertUtils.sourceToTarget(actCustomizedEntity, ActCustomizedResultDTO.class);
actCustomizedResultDTO.setActCustomizedId(actCustomizedEntity.getId());
}
return actCustomizedResultDTO;
}
/**
* @return void
* @param formDTO
* @author yinzuomei
* @description 保存自定义配置
* @Date 2020/7/20 17:27
**/
@Override
public void saveConfigs(SaveActCustomizedFormDTO formDTO) {
ActCustomizedDTO actCustomizedDTO=this.get(formDTO.getActCustomizedId());
if(null!=actCustomizedDTO){
actCustomizedDTO.setTitleName(formDTO.getTitleName());
actCustomizedDTO.setHotline(formDTO.getHotLine());
actCustomizedDTO.setActListName(formDTO.getActListName());
actCustomizedDTO.setHeartRankName(formDTO.getHeartRankName());
actCustomizedDTO.setActReviewName(formDTO.getActReviewName());
actCustomizedDTO.setMyActName(formDTO.getMyActName());
this.update(actCustomizedDTO);
return;
}else{
logger.error("根据主键",formDTO.getActCustomizedId(),"查询act_customized表为空,保存自定义配置失败");
}
}
}

17
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActCustomizedDao.xml

@ -20,5 +20,20 @@
<result property="delFlag" column="DEL_FLAG"/>
</resultMap>
<!-- 获取当前客户下,爱心互助模块自定义配置项 -->
<select id="selectConfigsByCustomerId" parameterType="java.lang.String" resultType="com.epmet.dto.result.work.ActCustomizedResultDTO">
SELECT
ac.id as actCustomizedId,
ac.TITLE_NAME as titleName,
ac.HOTLINE as hotLine,
ac.ACT_LIST_NAME as actListName,
ac.HEART_RANK_NAME as heartRankName,
ac.ACT_REVIEW_NAME as actReviewName,
ac.MY_ACT_NAME as myActName
FROM
act_customized ac
WHERE
ac.DEL_FLAG = '0'
AND ac.CUSTOMER_ID = #{customerId}
</select>
</mapper>
Loading…
Cancel
Save