|
|
|
@ -11,17 +11,24 @@ import com.hxhq.business.form.study.StudyFormPreSearchForm; |
|
|
|
import com.hxhq.business.form.study.StudySearchForm; |
|
|
|
import com.hxhq.business.form.zcg.ZcgSearchForm; |
|
|
|
import com.hxhq.business.service.*; |
|
|
|
import com.hxhq.common.core.constant.CacheConstants; |
|
|
|
import com.hxhq.common.core.exception.ServiceException; |
|
|
|
import com.hxhq.common.core.utils.DateUtils; |
|
|
|
import com.hxhq.common.core.web.controller.BaseController; |
|
|
|
import com.hxhq.common.core.web.domain.AjaxResult; |
|
|
|
import com.hxhq.common.core.web.page.TableDataInfo; |
|
|
|
import com.hxhq.common.redis.service.RedisService; |
|
|
|
import com.hxhq.common.security.annotation.RequiresPermissions; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.aspectj.weaver.loadtime.Aj; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -32,8 +39,7 @@ import java.util.List; |
|
|
|
*/ |
|
|
|
@RestController |
|
|
|
@RequestMapping("/business/public") |
|
|
|
public class PublicController extends BaseController |
|
|
|
{ |
|
|
|
public class PublicController extends BaseController { |
|
|
|
@Autowired |
|
|
|
private ITemplateService templateService; |
|
|
|
@Autowired |
|
|
|
@ -46,14 +52,45 @@ public class PublicController extends BaseController |
|
|
|
private IAnimalSpeciesService animalSpeciesService; |
|
|
|
@Autowired |
|
|
|
private IZcgService zcgService; |
|
|
|
@Autowired |
|
|
|
private RedisService redisService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取编号 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@GetMapping("/getSn") |
|
|
|
public AjaxResult getSn(Integer count) { |
|
|
|
if (count == null || count.intValue() <= 0) { |
|
|
|
return AjaxResult.error("参数错误"); |
|
|
|
} |
|
|
|
Integer start = 1; |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd"); |
|
|
|
String today = sdf.format(new Date()); |
|
|
|
//获取当前最大编号 |
|
|
|
String maxNum = redisService.getCacheObject(today); |
|
|
|
if (StringUtils.isNoneBlank(maxNum)) { |
|
|
|
start = Integer.parseInt(maxNum)+1; |
|
|
|
} |
|
|
|
HashMap<String, Object> map = new HashMap<String, Object>(count); |
|
|
|
for (int i = 0; i < count;i++){ |
|
|
|
map.put("sn"+i,today+String.format("%04d", start)); |
|
|
|
start++; |
|
|
|
} |
|
|
|
//更新当前最大编号 |
|
|
|
redisService.setCacheObject(today,start,60*60*24L, TimeUnit.SECONDS); |
|
|
|
return AjaxResult.success(map); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 试验区域-饲养间列表 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@GetMapping("/roomList") |
|
|
|
public AjaxResult getRoomList(String syqy) { |
|
|
|
if(StringUtils.isNotEmpty(syqy)) { |
|
|
|
if (StringUtils.isNotEmpty(syqy)) { |
|
|
|
LambdaQueryWrapper<Room> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(Room::getSyqy, syqy); |
|
|
|
List<Room> list = roomService.list(queryWrapper); |
|
|
|
@ -66,11 +103,12 @@ public class PublicController extends BaseController |
|
|
|
|
|
|
|
/** |
|
|
|
* 动物种属-笼具列表 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@GetMapping("/animalSpeciesList") |
|
|
|
public AjaxResult getAnimalSpeciesList(String animalSpecies) { |
|
|
|
if(StringUtils.isNotEmpty(animalSpecies)) { |
|
|
|
if (StringUtils.isNotEmpty(animalSpecies)) { |
|
|
|
LambdaQueryWrapper<AnimalSpecies> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(AnimalSpecies::getAnimalSpecies, animalSpecies); |
|
|
|
List<AnimalSpecies> list = animalSpeciesService.list(queryWrapper); |
|
|
|
@ -86,8 +124,7 @@ public class PublicController extends BaseController |
|
|
|
* 查询模板列表 |
|
|
|
*/ |
|
|
|
@GetMapping("/templateList") |
|
|
|
public TableDataInfo list(Template template) |
|
|
|
{ |
|
|
|
public TableDataInfo list(Template template) { |
|
|
|
startPage(); |
|
|
|
List<Template> list = templateService.queryList(template); |
|
|
|
return getDataTable(list); |
|
|
|
@ -97,20 +134,19 @@ public class PublicController extends BaseController |
|
|
|
* 查询试验列表 |
|
|
|
*/ |
|
|
|
@GetMapping("/studyList") |
|
|
|
public TableDataInfo studyList(Study study) |
|
|
|
{ |
|
|
|
public TableDataInfo studyList(Study study) { |
|
|
|
startPage(); |
|
|
|
QueryWrapper<Study> queryWrapper = Wrappers.query(); |
|
|
|
if(study.getStatus()!=null&&study.getStatus().intValue()>0){ |
|
|
|
if (study.getStatus() != null && study.getStatus().intValue() > 0) { |
|
|
|
queryWrapper.eq("status", study.getStatus()); |
|
|
|
} |
|
|
|
if(com.hxhq.common.core.utils.StringUtils.isNoneBlank(study.getName())){ |
|
|
|
queryWrapper.like("s.name",study.getName()); |
|
|
|
if (com.hxhq.common.core.utils.StringUtils.isNoneBlank(study.getName())) { |
|
|
|
queryWrapper.like("s.name", study.getName()); |
|
|
|
} |
|
|
|
if(com.hxhq.common.core.utils.StringUtils.isNoneBlank(study.getSn())){ |
|
|
|
queryWrapper.like("s.sn",study.getSn()); |
|
|
|
if (com.hxhq.common.core.utils.StringUtils.isNoneBlank(study.getSn())) { |
|
|
|
queryWrapper.like("s.sn", study.getSn()); |
|
|
|
} |
|
|
|
if(study.getLeader()!=null&&study.getLeader().longValue()>0){ |
|
|
|
if (study.getLeader() != null && study.getLeader().longValue() > 0) { |
|
|
|
queryWrapper.eq("leader", study.getLeader()); |
|
|
|
} |
|
|
|
List<Study> list = studyService.list(queryWrapper); |
|
|
|
@ -122,10 +158,9 @@ public class PublicController extends BaseController |
|
|
|
* 查询试验预填表单列表 |
|
|
|
*/ |
|
|
|
@GetMapping("/studyFormPreList") |
|
|
|
public AjaxResult studyFormPreList(StudyFormPreSearchForm form) |
|
|
|
{ |
|
|
|
if(form.getStudyId()==null||form.getStudyId().longValue()<0){ |
|
|
|
throw new ServiceException("试验id不能为空"); |
|
|
|
public AjaxResult studyFormPreList(StudyFormPreSearchForm form) { |
|
|
|
if (form.getStudyId() == null || form.getStudyId().longValue() < 0) { |
|
|
|
throw new ServiceException("试验id不能为空"); |
|
|
|
} |
|
|
|
return AjaxResult.success(studyFormPreService.queryList(form)); |
|
|
|
} |
|
|
|
@ -134,8 +169,7 @@ public class PublicController extends BaseController |
|
|
|
* 查询暂存柜列表 |
|
|
|
*/ |
|
|
|
@GetMapping("/zcgList") |
|
|
|
public AjaxResult zcgList(ZcgSearchForm form) |
|
|
|
{ |
|
|
|
public AjaxResult zcgList(ZcgSearchForm form) { |
|
|
|
return AjaxResult.success(zcgService.queryList(form)); |
|
|
|
} |
|
|
|
} |