|
|
@@ -7,21 +7,21 @@ import com.yunfeiyun.agmp.common.constant.ErrorCode;
|
|
|
import com.yunfeiyun.agmp.common.exception.BizException;
|
|
|
import com.yunfeiyun.agmp.common.utils.DateUtils;
|
|
|
import com.yunfeiyun.agmp.common.utils.SecurityUtils;
|
|
|
-import com.yunfeiyun.agmp.common.utils.StringUtils;
|
|
|
import com.yunfeiyun.agmp.fms.domain.FmsBlock;
|
|
|
import com.yunfeiyun.agmp.fms.domain.FmsCrop;
|
|
|
import com.yunfeiyun.agmp.fms.domain.FmsPeriod;
|
|
|
import com.yunfeiyun.agmp.fms.domain.FmsPlan;
|
|
|
+import com.yunfeiyun.agmp.fms.domain.dto.FmsPlanByWarnSchedulerDto;
|
|
|
+import com.yunfeiyun.agmp.fms.domain.reqvo.FmsPlanReqVo;
|
|
|
import com.yunfeiyun.agmp.fms.domain.reqvo.FmsTaskrcdListReqVo;
|
|
|
import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanDocumentResVo;
|
|
|
+import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanListOfTaskStatusResVo;
|
|
|
+import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanResVo;
|
|
|
import com.yunfeiyun.agmp.fms.domain.vo.FmsTaskrcdVo;
|
|
|
import com.yunfeiyun.agmp.fms.mapper.FmsBlockMapper;
|
|
|
import com.yunfeiyun.agmp.fms.mapper.FmsCropMapper;
|
|
|
import com.yunfeiyun.agmp.fms.mapper.FmsPeriodMapper;
|
|
|
import com.yunfeiyun.agmp.fms.mapper.FmsPlanMapper;
|
|
|
-import com.yunfeiyun.agmp.fms.domain.reqvo.FmsPlanReqVo;
|
|
|
-import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanListOfTaskStatusResVo;
|
|
|
-import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanResVo;
|
|
|
import com.yunfeiyun.agmp.fms.service.IFmsPlanService;
|
|
|
import com.yunfeiyun.agmp.fms.service.IFmsTaskrcdService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -33,7 +33,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 种植计划Service业务层处理
|
|
|
@@ -72,6 +71,7 @@ public class FmsPlanServiceImpl implements IFmsPlanService {
|
|
|
|
|
|
@Override
|
|
|
public BigDecimal selectSumPlanArea(FmsPlanReqVo reqVo) {
|
|
|
+ reqVo.setTid(SecurityUtils.getTid());
|
|
|
return fmsPlanMapper.selectSumPlanArea(reqVo);
|
|
|
}
|
|
|
|
|
|
@@ -82,21 +82,25 @@ public class FmsPlanServiceImpl implements IFmsPlanService {
|
|
|
|
|
|
@Override
|
|
|
public int selectCountFmsPlan(FmsPlanReqVo reqVo) {
|
|
|
+ reqVo.setTid(SecurityUtils.getTid());
|
|
|
return fmsPlanMapper.selectCountFmsPlan(reqVo);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<FmsPlanResVo> selectPlanByCropName(FmsPlanReqVo reqVo) {
|
|
|
+ reqVo.setTid(SecurityUtils.getTid());
|
|
|
return fmsPlanMapper.selectPlanByCropName(reqVo);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<FmsPlanResVo> selectPlanByCropNameAndType(FmsPlanReqVo reqVo) {
|
|
|
+ reqVo.setTid(SecurityUtils.getTid());
|
|
|
return fmsPlanMapper.selectPlanByCropNameAndType(reqVo);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<FmsPlanResVo> selectPlanByLandId(FmsPlanReqVo reqVo) {
|
|
|
+ reqVo.setTid(SecurityUtils.getTid());
|
|
|
return fmsPlanMapper.selectPlanByLandId(reqVo);
|
|
|
}
|
|
|
|
|
|
@@ -113,21 +117,25 @@ public class FmsPlanServiceImpl implements IFmsPlanService {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<FmsPlan> selectFmsPlanList(FmsPlan fmsPlan) {
|
|
|
+ fmsPlan.setTid(SecurityUtils.getTid());
|
|
|
return fmsPlanMapper.selectFmsPlanList(fmsPlan);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<FmsPlan> selectFmsPlanNoList(FmsPlan fmsPlan) {
|
|
|
+ fmsPlan.setTid(SecurityUtils.getTid());
|
|
|
return fmsPlanMapper.selectFmsPlanNoList(fmsPlan);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<FmsPlanResVo> selectPlanList(FmsPlanReqVo reqVo) {
|
|
|
+ reqVo.setTid(SecurityUtils.getTid());
|
|
|
return fmsPlanMapper.selectPlanList(reqVo);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<FmsPlan> selectPlanListScheduler(FmsPlanReqVo reqVo) {
|
|
|
+ reqVo.setTid(SecurityUtils.getTid());
|
|
|
return fmsPlanMapper.selectPlanListScheduler(reqVo);
|
|
|
}
|
|
|
|
|
|
@@ -140,10 +148,7 @@ public class FmsPlanServiceImpl implements IFmsPlanService {
|
|
|
@Override
|
|
|
public int insertFmsPlan(FmsPlan fmsPlan) {
|
|
|
fmsPlan.setPlanId(fmsPlan.getId());
|
|
|
- fmsPlan.setTid(fmsPlan.getLandId());
|
|
|
- if(StringUtils.isEmpty(fmsPlan.getTid())){
|
|
|
- fmsPlan.setTid(SecurityUtils.getTid());
|
|
|
- }
|
|
|
+ fmsPlan.setTid(SecurityUtils.getTid());
|
|
|
return fmsPlanMapper.insertFmsPlan(fmsPlan);
|
|
|
}
|
|
|
|
|
|
@@ -153,11 +158,8 @@ public class FmsPlanServiceImpl implements IFmsPlanService {
|
|
|
fmsPlan.setPlanId(fmsPlan.getId());
|
|
|
fmsPlan.setPlanCreator(SecurityUtils.getUserId());
|
|
|
fmsPlan.setPlanCreateddate(DateUtils.dateTimeNow());
|
|
|
- fmsPlan.setTid(fmsPlan.getLandId());
|
|
|
- if(StringUtils.isEmpty(fmsPlan.getTid())){
|
|
|
- fmsPlan.setTid(SecurityUtils.getTid());
|
|
|
- }
|
|
|
- int i = fmsPlanMapper.insertFmsPlan(fmsPlan);
|
|
|
+
|
|
|
+ int i = insertFmsPlan(fmsPlan);
|
|
|
fmsBlockMapper.updateFmsBlock(fmsBlock);
|
|
|
|
|
|
return i;
|
|
|
@@ -173,12 +175,14 @@ public class FmsPlanServiceImpl implements IFmsPlanService {
|
|
|
public int updateFmsPlan(FmsPlan fmsPlan) {
|
|
|
fmsPlan.setPlanModifier(SecurityUtils.getUserId());
|
|
|
fmsPlan.setPlanModifieddate(DateUtils.dateTimeNow());
|
|
|
+ fmsPlan.setTid(SecurityUtils.getTid());
|
|
|
return fmsPlanMapper.updateFmsPlan(fmsPlan);
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public int updateFmsPlan(FmsPlan fmsPlan, FmsBlock fmsBlock) {
|
|
|
+ fmsPlan.setTid(SecurityUtils.getTid());
|
|
|
int i = fmsPlanMapper.updateFmsPlan(fmsPlan);
|
|
|
fmsBlockMapper.updateFmsBlock(fmsBlock);
|
|
|
return i;
|
|
|
@@ -186,13 +190,16 @@ public class FmsPlanServiceImpl implements IFmsPlanService {
|
|
|
|
|
|
@Override
|
|
|
public int updateFmsPlanBatch(List<FmsPlan> fmsPlans) {
|
|
|
+ for (FmsPlan fmsPlan : fmsPlans) {
|
|
|
+ fmsPlan.setTid(SecurityUtils.getTid());
|
|
|
+ }
|
|
|
return fmsPlanMapper.updateFmsPlanBatch(fmsPlans);
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public int updateFmsPlanBatch(List<FmsPlan> fmsPlans, List<FmsBlock> fmsBlocks) {
|
|
|
- int i = fmsPlanMapper.updateFmsPlanBatch(fmsPlans);
|
|
|
+ int i = updateFmsPlanBatch(fmsPlans);
|
|
|
fmsBlockMapper.updateFmsBlockBatch(fmsBlocks);
|
|
|
return i;
|
|
|
}
|
|
|
@@ -228,7 +235,7 @@ public class FmsPlanServiceImpl implements IFmsPlanService {
|
|
|
public FmsPlanDocumentResVo selectFmsPlanDocumentResVo(String planId) {
|
|
|
String tid = SecurityUtils.getTid();
|
|
|
FmsPlanDocumentResVo fmsPlanDocumentResVo = new FmsPlanDocumentResVo();
|
|
|
- FmsPlanResVo fmsPlan = fmsPlanMapper.selectFmsPlanByPlanId(planId,tid);
|
|
|
+ FmsPlanResVo fmsPlan = selectFmsPlanByPlanId(planId,tid);
|
|
|
|
|
|
BeanUtils.copyProperties(fmsPlan,fmsPlanDocumentResVo);
|
|
|
FmsCrop fmsCrop = fmsCropMapper.selectFmsCropByCropId(fmsPlan.getCropId(),tid);
|
|
|
@@ -283,6 +290,18 @@ public class FmsPlanServiceImpl implements IFmsPlanService {
|
|
|
return fmsPlanDocumentResVo;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 农事预警调度获取种植计划列表
|
|
|
+ *
|
|
|
+ * @param planEnddate
|
|
|
+ * @param tid
|
|
|
+ * @return 种植计划集合
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<FmsPlanByWarnSchedulerDto> selectPlanListByWarnScheduler(String planEnddate, String tid) {
|
|
|
+ return fmsPlanMapper.selectPlanListByWarnScheduler(planEnddate,tid);
|
|
|
+ }
|
|
|
+
|
|
|
private String dateStrAdd(String data,Integer days){
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
try {
|