diff --git a/survey-common/src/main/java/com/xiaojusurvey/engine/common/constants/RespErrorCode.java b/survey-common/src/main/java/com/xiaojusurvey/engine/common/constants/RespErrorCode.java index 836d0b1b..cd4420d7 100644 --- a/survey-common/src/main/java/com/xiaojusurvey/engine/common/constants/RespErrorCode.java +++ b/survey-common/src/main/java/com/xiaojusurvey/engine/common/constants/RespErrorCode.java @@ -16,6 +16,8 @@ public enum RespErrorCode { SURVEY_TYPE_ERROR(3003, "问卷类型错误"), SURVEY_NOT_FOUND(3004, "问卷不存在"), SURVEY_CONTENT_NOT_ALLOW(3005, "存在禁用内容"), + UPDATE_SURVEY_META_ERROR(3006, "修改问卷失败"), + DELETE_SURVEY_ERROR(3007, "删除问卷失败"), CAPTCHA_INCORRECT(4001, "验证码不正确"), RESPONSE_SIGN_ERROR(9001, "签名不正确"), RESPONSE_CURRENT_TIME_NOT_ALLOW(9002, "当前时间不允许提交"), @@ -24,6 +26,9 @@ public enum RespErrorCode { RESPONSE_DATA_DECRYPT_ERROR(9005, "问卷已删除"), UPLOAD_FILE_ERROR(5001, "上传文件错误"); + + + private final int code; private final String message; diff --git a/survey-common/src/main/java/com/xiaojusurvey/engine/common/entity/Status.java b/survey-common/src/main/java/com/xiaojusurvey/engine/common/entity/Status.java index 30b850c4..aa5c332e 100644 --- a/survey-common/src/main/java/com/xiaojusurvey/engine/common/entity/Status.java +++ b/survey-common/src/main/java/com/xiaojusurvey/engine/common/entity/Status.java @@ -11,4 +11,21 @@ public class Status implements Serializable { private Long date; private String status; + + + public Long getDate() { + return date; + } + + public void setDate(Long date) { + this.date = date; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } } diff --git a/survey-common/src/main/java/com/xiaojusurvey/engine/common/entity/survey/SurveyMeta.java b/survey-common/src/main/java/com/xiaojusurvey/engine/common/entity/survey/SurveyMeta.java index d12765f1..d6cd749c 100644 --- a/survey-common/src/main/java/com/xiaojusurvey/engine/common/entity/survey/SurveyMeta.java +++ b/survey-common/src/main/java/com/xiaojusurvey/engine/common/entity/survey/SurveyMeta.java @@ -26,6 +26,11 @@ public class SurveyMeta extends BaseEntity { @NotBlank(message = "问卷类型不能为空") @NotNull(message = "问卷类型不能为空") private String surveyType; + + /** + * 问卷短链 + */ + private String surveyPath; /** * 问卷标题 */ @@ -43,5 +48,14 @@ public class SurveyMeta extends BaseEntity { */ private String createFrom; + /** + * 创建人 + */ + private String creator; + /** + * 所有者 + */ + private String owner; + } diff --git a/survey-common/src/main/java/com/xiaojusurvey/engine/common/entity/survey/SurveyPublish.java b/survey-common/src/main/java/com/xiaojusurvey/engine/common/entity/survey/SurveyPublish.java new file mode 100644 index 00000000..910fd550 --- /dev/null +++ b/survey-common/src/main/java/com/xiaojusurvey/engine/common/entity/survey/SurveyPublish.java @@ -0,0 +1,51 @@ +package com.xiaojusurvey.engine.common.entity.survey; + +import com.xiaojusurvey.engine.common.entity.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.data.mongodb.core.mapping.Document; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 问卷发布后的配置表 + * + * @author likui63@163.com + * @date: 2024/7/27 13:59 + */ +@Document("surveySubmit") +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Data +public class SurveyPublish extends BaseEntity { + + /** + * 问卷配置ID + */ + @NotBlank(message = "问卷配置ID不能为空") + @NotNull(message = "问卷配置ID不能为空") + private String pageId; + + /** + * 问卷标题 + */ + @NotBlank(message = "问卷标题不能为空") + @NotNull(message = "问卷标题不能为空") + private String title; + /** + * 问卷短链 + */ + @NotBlank(message = "问卷短链不能为空") + @NotNull(message = "问卷短链不能为空") + private String surveyPath; + /** + * 问卷schema + */ + @NotBlank(message = "问卷schema不能为空") + @NotNull(message = "问卷schema不能为空") + private String code; + + +} diff --git a/survey-common/src/main/java/com/xiaojusurvey/engine/common/enums/SurveyStatusEnum.java b/survey-common/src/main/java/com/xiaojusurvey/engine/common/enums/SurveyStatusEnum.java new file mode 100644 index 00000000..6f80a2e5 --- /dev/null +++ b/survey-common/src/main/java/com/xiaojusurvey/engine/common/enums/SurveyStatusEnum.java @@ -0,0 +1,37 @@ +package com.xiaojusurvey.engine.common.enums; + +import com.xiaojusurvey.engine.common.entity.Status; + +/** + * Survey状态 + * + * @author likui63@163.com + * @Date 2024/7/26 23:32 + */ +public enum SurveyStatusEnum { + NEW("new"), + EDITING("editing"), + PAUSING("pausing"), + PUBLISHED("published"), + REMOVED("removed"), + FORCE_REMOVED("FORCE_REMOVED"); + + private String status; + + SurveyStatusEnum(String status) { + this.status = status; + } + + public String getStatus() { + return this.status; + } + + + public static Status getSpecStatus(SurveyStatusEnum statusEnum) { + Status newStatus = new Status(); + newStatus.setStatus(statusEnum.getStatus()); + newStatus.setDate(System.currentTimeMillis()); + return newStatus; + } + +} diff --git a/survey-core/pom.xml b/survey-core/pom.xml index 5aa4dbd9..c37d2d48 100644 --- a/survey-core/pom.xml +++ b/survey-core/pom.xml @@ -33,6 +33,16 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + diff --git a/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/SurveyPublishService.java b/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/SurveyPublishService.java new file mode 100644 index 00000000..b7b5a186 --- /dev/null +++ b/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/SurveyPublishService.java @@ -0,0 +1,15 @@ +package com.xiaojusurvey.engine.core.survey; + +import com.xiaojusurvey.engine.common.entity.survey.SurveyMeta; + +/** + * 问卷发布配置服务 + * + * @author likui63@163.com + * @date: 2024/7/27 13:54 + */ +public interface SurveyPublishService { + + + boolean delete(SurveyMeta param); +} diff --git a/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/SurveyService.java b/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/SurveyService.java index 18cf6501..2688d7f6 100644 --- a/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/SurveyService.java +++ b/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/SurveyService.java @@ -2,6 +2,7 @@ package com.xiaojusurvey.engine.core.survey; import com.xiaojusurvey.engine.common.entity.survey.SurveyMeta; import com.xiaojusurvey.engine.core.reslut.IdResult; +import com.xiaojusurvey.engine.core.survey.param.SurveyMetaUpdateParam; /** * @Author: LYF @@ -12,4 +13,8 @@ public interface SurveyService { IdResult createSurvey(SurveyMeta surveyMeta); SurveyMeta getSurveyMeta(String surveyId); + + boolean updateMeta(SurveyMetaUpdateParam param); + + boolean deleteSurvey(String surveyId); } diff --git a/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/impl/SurveyPublishServiceImpl.java b/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/impl/SurveyPublishServiceImpl.java new file mode 100644 index 00000000..da6f8835 --- /dev/null +++ b/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/impl/SurveyPublishServiceImpl.java @@ -0,0 +1,58 @@ +package com.xiaojusurvey.engine.core.survey.impl; + +import com.xiaojusurvey.engine.common.entity.Status; +import com.xiaojusurvey.engine.common.entity.survey.SurveyMeta; +import com.xiaojusurvey.engine.common.entity.survey.SurveyPublish; +import com.xiaojusurvey.engine.common.enums.SurveyStatusEnum; +import com.xiaojusurvey.engine.core.survey.SurveyPublishService; +import com.xiaojusurvey.engine.repository.MongoRepository; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; + +/** + * 问卷发布配置服务实现 + * + * @author likui63@163.com + * @Date 2024/7/27 14:02 + */ +@Service +public class SurveyPublishServiceImpl implements SurveyPublishService { + @Resource + private MongoRepository mongoRepository; + + public MongoRepository getMongoRepository() { + return mongoRepository; + } + + public void setMongoRepository(MongoRepository mongoRepository) { + this.mongoRepository = mongoRepository; + } + + + @Override + public boolean delete(SurveyMeta param) { + if (StringUtils.hasLength(param.getSurveyPath())) { + SurveyPublish surveyPublish = getBysurveyPath(param.getSurveyPath()); + if (surveyPublish != null) { + Status st = SurveyStatusEnum.getSpecStatus(SurveyStatusEnum.PUBLISHED); + surveyPublish.setCurStatus(st); + surveyPublish.getStatusList().add(st); + mongoRepository.save(surveyPublish); + } + } + return true; + } + + public SurveyPublish getBysurveyPath(String surveyPath) { + Query query = new Query(); + query.addCriteria(Criteria.where("surveyPath").is(surveyPath)); + SurveyPublish surveyPublish = mongoRepository.findOne(query, SurveyPublish.class); + return surveyPublish; + } + + +} diff --git a/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/impl/SurveyServiceImpl.java b/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/impl/SurveyServiceImpl.java index 8c9ac985..47c204c5 100644 --- a/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/impl/SurveyServiceImpl.java +++ b/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/impl/SurveyServiceImpl.java @@ -1,32 +1,58 @@ package com.xiaojusurvey.engine.core.survey.impl; +import com.xiaojusurvey.engine.common.constants.RespErrorCode; +import com.xiaojusurvey.engine.common.entity.Status; import com.xiaojusurvey.engine.common.entity.survey.SurveyMeta; +import com.xiaojusurvey.engine.common.enums.SurveyStatusEnum; +import com.xiaojusurvey.engine.common.exception.ServiceException; import com.xiaojusurvey.engine.core.reslut.IdResult; +import com.xiaojusurvey.engine.core.survey.SurveyPublishService; import com.xiaojusurvey.engine.core.survey.SurveyService; +import com.xiaojusurvey.engine.core.survey.param.SurveyMetaUpdateParam; import com.xiaojusurvey.engine.repository.MongoRepository; +import lombok.extern.slf4j.Slf4j; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Arrays; +import java.util.List; /** * @Author: LYF * @CreateTime: 2024-06-05 * @Description: 问卷ServiceImpl */ -@Service("surveyService") +@Service +@Slf4j public class SurveyServiceImpl implements SurveyService { @Resource private MongoRepository mongoRepository; + @Resource + private SurveyPublishService surveyPublishService; + + public MongoRepository getMongoRepository() { + return mongoRepository; + } + + public void setMongoRepository(MongoRepository mongoRepository) { + this.mongoRepository = mongoRepository; + } + /** * 创建问卷 */ @Override public IdResult createSurvey(SurveyMeta surveyMeta) { IdResult idResult = new IdResult(); + Status newStatus = SurveyStatusEnum.getSpecStatus(SurveyStatusEnum.NEW); + surveyMeta.setCurStatus(newStatus); + List statusList = Arrays.asList(newStatus); + surveyMeta.setStatusList(statusList); idResult.setId(mongoRepository.save(surveyMeta).getId()); return idResult; } @@ -37,4 +63,46 @@ public class SurveyServiceImpl implements SurveyService { query.addCriteria(Criteria.where("_id").is(surveyId)); return mongoRepository.findOne(query, SurveyMeta.class); } + + @Override + public boolean updateMeta(SurveyMetaUpdateParam param) { + SurveyMeta temp = getSurveyMeta(param.getSurveyId()); + Status st = temp.getCurStatus(); + if (!st.getStatus().equals(SurveyStatusEnum.NEW.getStatus()) && !st.getStatus().equals(SurveyStatusEnum.EDITING.getStatus())) { + Status newStatus = SurveyStatusEnum.getSpecStatus(SurveyStatusEnum.EDITING); + temp.setCurStatus(newStatus); + temp.setTitle(param.getTitle()); + temp.setRemark(param.getRemark()); + temp.getStatusList().add(newStatus); + } + Query query = new Query(); + query.addCriteria(Criteria.where("_id").is(param.getSurveyId())); + Update update = new Update(); + update.set("title", param.getTitle()).set("remark", param.getRemark()); + update.set("curStatus", temp.getCurStatus()); + update.set("statusList", temp.getStatusList()); + mongoRepository.updateFirst(query, update, SurveyMeta.class); + return true; + } + + @Override + public boolean deleteSurvey(String surveyId) { + Query query = new Query(); + query.addCriteria(Criteria.where("_id").is(surveyId)); + SurveyMeta meta = mongoRepository.findOne(query, SurveyMeta.class); + if (meta.getCurStatus().getStatus().equals(SurveyStatusEnum.REMOVED.getStatus())) { + log.error("[deleteSurvey] 问卷已删除,不能重复删除,surveyId={}", surveyId); + throw new ServiceException(RespErrorCode.SURVEY_STATUS_TRANSFORM_ERROR.getMessage(), RespErrorCode.SURVEY_STATUS_TRANSFORM_ERROR.getCode()); // 问卷状态转换报错 + } + Status newStatus = SurveyStatusEnum.getSpecStatus(SurveyStatusEnum.REMOVED); + meta.setCurStatus(newStatus); + meta.getStatusList().add(newStatus); + mongoRepository.save(meta); + + //删除问卷回收表 + surveyPublishService.delete(meta); + return true; + } + + } diff --git a/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/param/SurveyMetaUpdateParam.java b/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/param/SurveyMetaUpdateParam.java new file mode 100644 index 00000000..4412b404 --- /dev/null +++ b/survey-core/src/main/java/com/xiaojusurvey/engine/core/survey/param/SurveyMetaUpdateParam.java @@ -0,0 +1,28 @@ +package com.xiaojusurvey.engine.core.survey.param; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 修改问卷实体 + * + * @author likui63@163.com + * @Date 2024/7/24 21:46 + */ +@Data +public class SurveyMetaUpdateParam implements Serializable { + @NotBlank(message = "问卷id不能为空", groups = {Update.class, Delete.class}) + private String surveyId; + @NotBlank(message = "问卷标题不能为空", groups = {Update.class}) + private String title; + @NotBlank(message = "问卷描述不能为空", groups = {Update.class}) + private String remark; + + public interface Update { + } + + public interface Delete { + } +} diff --git a/survey-core/src/test/java/com/xiaojusurvey/engine/core/survey/impl/SurveyServiceImplTest.java b/survey-core/src/test/java/com/xiaojusurvey/engine/core/survey/impl/SurveyServiceImplTest.java new file mode 100644 index 00000000..2f747557 --- /dev/null +++ b/survey-core/src/test/java/com/xiaojusurvey/engine/core/survey/impl/SurveyServiceImplTest.java @@ -0,0 +1,87 @@ +package com.xiaojusurvey.engine.core.survey.impl; + + +import com.xiaojusurvey.engine.common.entity.Status; +import com.xiaojusurvey.engine.common.entity.survey.SurveyMeta; +import com.xiaojusurvey.engine.common.enums.SurveyStatusEnum; +import com.xiaojusurvey.engine.core.survey.SurveyPublishService; +import com.xiaojusurvey.engine.core.survey.param.SurveyMetaUpdateParam; +import com.xiaojusurvey.engine.repository.MongoRepository; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import java.util.ArrayList; +import java.util.List; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +/** + * 问卷service单元测试 + * + * @author likui63@163.com + * @Date 2024/7/27 14:27 + */ +@RunWith(SpringJUnit4ClassRunner.class) +public class SurveyServiceImplTest { + + @InjectMocks + private SurveyServiceImpl surveyService; + + @Mock + SurveyPublishService surveyPublishService; + + @Mock + MongoRepository mongoRepository; + + SurveyMetaUpdateParam updateParam; + + SurveyMeta surveyMeta; + String surveyid = "111111111111111111"; + + @Before + public void before(){ + surveyMeta = new SurveyMeta(); + surveyMeta.setId(surveyid); + surveyMeta.setTitle("title"); + surveyMeta.setRemark("remark"); + surveyMeta.setSurveyType("type1"); + surveyMeta.setCreator("likui"); + surveyMeta.setOwner("likui"); + surveyMeta.setCurStatus(SurveyStatusEnum.getSpecStatus(SurveyStatusEnum.PUBLISHED)); + List list = new ArrayList(); + list.add(SurveyStatusEnum.getSpecStatus(SurveyStatusEnum.NEW)); + list.add(SurveyStatusEnum.getSpecStatus(SurveyStatusEnum.PUBLISHED)); + surveyMeta.setStatusList(list); + } + + @Test + public void updateMetaTest() { + updateParam = new SurveyMetaUpdateParam(); + updateParam.setSurveyId(surveyid); + updateParam.setTitle("新时代"); + updateParam.setRemark("这是一个测试"); + + when(mongoRepository.findOne(any(),any())).thenReturn(surveyMeta); + + boolean flag = surveyService.updateMeta(updateParam); + Assert.assertEquals(true,flag); + + } + + + @Test + public void deleteSurveyTest() { + when(mongoRepository.findOne(any(),any())).thenReturn(surveyMeta); + when(surveyPublishService.delete(any())).thenReturn(true); + boolean flag = surveyService.deleteSurvey(surveyid); + Assert.assertEquals(true,flag); + + } + +} \ No newline at end of file diff --git a/survey-server/src/main/java/com/xiaojusurvey/engine/controller/SurveyController.java b/survey-server/src/main/java/com/xiaojusurvey/engine/controller/SurveyController.java index 72490929..7bb9ad88 100644 --- a/survey-server/src/main/java/com/xiaojusurvey/engine/controller/SurveyController.java +++ b/survey-server/src/main/java/com/xiaojusurvey/engine/controller/SurveyController.java @@ -13,6 +13,7 @@ import com.xiaojusurvey.engine.core.reslut.IdResult; import com.xiaojusurvey.engine.core.survey.SurveyConfService; import com.xiaojusurvey.engine.core.survey.SurveyHistoryService; import com.xiaojusurvey.engine.core.survey.SurveyService; +import com.xiaojusurvey.engine.core.survey.param.SurveyMetaUpdateParam; import com.xiaojusurvey.engine.core.survey.vo.SurveyInfoInVO; import com.xiaojusurvey.engine.core.survey.vo.SurveyInfoOutVO; import org.springframework.validation.annotation.Validated; @@ -66,7 +67,7 @@ public class SurveyController { @PostMapping("/updateConf") public RpcResult updateConf(HttpServletRequest request, @RequestBody @Validated(SurveyInfoInVO.UpdateConf.class) SurveyInfoInVO infoInVO) { - SurveyConf surveyConf = new SurveyConf(); + SurveyConf surveyConf = new SurveyConf(); surveyConf.setCode(infoInVO.getConfigData()); surveyConf.setPageId(infoInVO.getSurveyId()); surveyConfService.saveSurveyConfig(surveyConf); @@ -98,4 +99,31 @@ public class SurveyController { SurveyConf surveyConf = surveyConfService.getSurveyConfBySurveyId(surveyId); return RpcResultUtil.createSuccessResult(new SurveyInfoOutVO(surveyMeta, surveyConf)); } + + /** + * 修改问卷 + */ + @PostMapping("/updateMeta") + public RpcResult updateMeta(@RequestBody @Validated(SurveyMetaUpdateParam.Update.class) SurveyMetaUpdateParam param) { + boolean flag = surveyService.updateMeta(param); + if (flag) { + return RpcResultUtil.createSuccessResult(null); + } + return RpcResultUtil.createFailedResult(RespErrorCode.UPDATE_SURVEY_META_ERROR.getCode(), RespErrorCode.UPDATE_SURVEY_META_ERROR.getMessage()); + } + + /** + * 删除问卷 + * + * @param param + * @return + */ + @PostMapping("/deleteSurvey") + public RpcResult deleteSurvey(@RequestBody @Validated(SurveyMetaUpdateParam.Delete.class) SurveyMetaUpdateParam param) { + boolean flag = surveyService.deleteSurvey(param.getSurveyId()); + if (flag) { + return RpcResultUtil.createSuccessResult(null); + } + return RpcResultUtil.createFailedResult(RespErrorCode.DELETE_SURVEY_ERROR.getCode(), RespErrorCode.DELETE_SURVEY_ERROR.getMessage()); + } } diff --git a/survey-server/src/test/java/com/xiaojusurvey/engine/controller/SurveyMetaControllerTest.java b/survey-server/src/test/java/com/xiaojusurvey/engine/controller/SurveyMetaControllerTest.java new file mode 100644 index 00000000..3f32130f --- /dev/null +++ b/survey-server/src/test/java/com/xiaojusurvey/engine/controller/SurveyMetaControllerTest.java @@ -0,0 +1,83 @@ +package com.xiaojusurvey.engine.controller; + +import com.xiaojusurvey.engine.common.rpc.RpcResult; +import com.xiaojusurvey.engine.config.BannerDataConfig; +import com.xiaojusurvey.engine.core.survey.SurveyConfService; +import com.xiaojusurvey.engine.core.survey.SurveyHistoryService; +import com.xiaojusurvey.engine.core.survey.SurveyService; +import com.xiaojusurvey.engine.core.survey.param.SurveyMetaUpdateParam; +import com.xiaojusurvey.engine.repository.MongoRepository; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import javax.servlet.http.HttpServletRequest; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + + + +/** + * @Author: maple + * @CreateTime: 2024/6/15 20:40 + * @Description: + */ +@RunWith(SpringJUnit4ClassRunner.class) +public class SurveyMetaControllerTest { + + @InjectMocks + SurveyController surveyController; + + @Mock + private SurveyService surveyService; + + @Mock + private SurveyConfService surveyConfService; + + @Mock + private SurveyHistoryService surveyHistoryService; + + @Mock + private BannerDataConfig bannerDataConfig; + + @Mock + MongoRepository mongoRepository; + + private HttpServletRequest httpServletRequest; + + + + @Test + public void updateMetaTest() { + when(surveyService.updateMeta(any())).thenReturn(true); + + SurveyMetaUpdateParam param = new SurveyMetaUpdateParam(); + param.setSurveyId(null); + param.setTitle(null); + param.setRemark(null); + + RpcResult surveyResult = surveyController.updateMeta(param); + Assert.assertTrue(surveyResult.getSuccess()); + } + + + @Test + public void deleteSurveyTest() { + + when(surveyService.deleteSurvey(any())).thenReturn(true); + + SurveyMetaUpdateParam param = new SurveyMetaUpdateParam(); + param.setSurveyId(null); + param.setTitle(null); + param.setRemark(null); + RpcResult surveyResult = surveyController.deleteSurvey(param); + Assert.assertTrue(surveyResult.getSuccess()); + + } + + +}