use of com.bc.pmpheep.back.po.Sensitive in project pmph by BCSquad.
the class SensitiveServiceTest method listTest.
@Test
public void listTest() {
Sensitive sen = sensitiveService.add(sensitive);
PageParameter<Sensitive> pageParameter = new PageParameter<>(1, 5);
Sensitive sensitive = new Sensitive();
pageParameter.setParameter(sensitive);
PageResult<Sensitive> pageResult = sensitiveService.list(pageParameter);
Assert.assertNotNull("获取失败", pageResult.getRows());
}
use of com.bc.pmpheep.back.po.Sensitive in project pmph by BCSquad.
the class MigrationPlus method sensitive.
protected void sensitive() {
Sensitive sensitive = new Sensitive("妈的", 1, "不文明用语", false, false, null, null);
sensitiveService.add(sensitive);
Sensitive sensitive1 = new Sensitive("闭嘴", 2, "不礼貌", false, false, null, null);
sensitiveService.add(sensitive1);
Sensitive sensitive2 = new Sensitive("死人", 3, null, false, false, null, null);
sensitiveService.add(sensitive2);
Sensitive sensitive3 = new Sensitive("王八蛋", 4, "不文明用语", false, false, null, null);
sensitiveService.add(sensitive3);
Sensitive sensitive4 = new Sensitive("傻逼", 5, null, false, false, null, null);
sensitiveService.add(sensitive4);
Sensitive sensitive5 = new Sensitive("垃圾", 6, "不合适用语", false, false, null, null);
sensitiveService.add(sensitive5);
Sensitive sensitive6 = new Sensitive("渣渣", 7, "网络用语", false, true, null, null);
sensitiveService.add(sensitive6);
Sensitive sensitive7 = new Sensitive("二", 8, "网络用语", true, false, null, null);
sensitiveService.add(sensitive7);
Sensitive sensitive8 = new Sensitive("放屁", 9, "口头用语", true, true, null, null);
sensitiveService.add(sensitive8);
}
use of com.bc.pmpheep.back.po.Sensitive in project pmph by BCSquad.
the class SensitiveController method list.
/**
* 功能描述:分页查询敏感词
*
* @param word
* @param pageSize
* @param pageNumber
* @return
*/
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "分页查询敏感词")
@RequestMapping(value = "/list", method = RequestMethod.GET)
public ResponseBean list(String word, Integer pageSize, Integer pageNumber) {
PageParameter<Sensitive> pageParameter = new PageParameter<>(pageNumber, pageSize);
Sensitive sensitive = new Sensitive();
sensitive.setWord(word);
pageParameter.setParameter(sensitive);
return new ResponseBean(sensitiveService.list(pageParameter));
}
use of com.bc.pmpheep.back.po.Sensitive in project pmph by BCSquad.
the class SensitiveServiceImpl method update.
@Override
public String update(Sensitive sensitive) throws CheckedServiceException {
if (ObjectUtil.isNull(sensitive.getId())) {
throw new CheckedServiceException(CheckedExceptionBusiness.SENSITIVE, CheckedExceptionResult.NULL_PARAM, "需要修改的敏感词id为空");
}
if (StringUtil.notEmpty(sensitive.getNote())) {
if (sensitive.getNote().length() > 100) {
throw new CheckedServiceException(CheckedExceptionBusiness.SENSITIVE, CheckedExceptionResult.ILLEGAL_PARAM, "备注太长了,请控制在100个字以内");
}
} else {
sensitive.setNote("-");
}
String result = "FAIL";
if (StringUtil.notEmpty(sensitive.getWord())) {
if (sensitive.getWord().length() > 10) {
throw new CheckedServiceException(CheckedExceptionBusiness.SENSITIVE, CheckedExceptionResult.ILLEGAL_PARAM, "敏感词太长了,请控制在10个字以内");
}
Sensitive sen = sensitiveDao.getSensitiveId(sensitive.getWord());
if (ObjectUtil.notNull(sen)) {
Long id = sen.getId();
if (null != id && !sensitive.getId().equals(id)) {
throw new CheckedServiceException(CheckedExceptionBusiness.SENSITIVE, CheckedExceptionResult.ILLEGAL_PARAM, "修改的敏感词重复了");
}
}
}
Integer total = sensitiveDao.update(sensitive);
if (total > 0) {
result = "SUCCESS";
}
return result;
}
use of com.bc.pmpheep.back.po.Sensitive in project pmph by BCSquad.
the class SensitiveServiceTest method updateTest.
@Test
public void updateTest() {
Sensitive sen = sensitiveService.add(sensitive);
sen.setWord("jkgh");
String result = sensitiveService.update(sen);
Assert.assertTrue("修改失败", result.equals("SUCCESS"));
}
Aggregations