Commit 8a4adc9a authored by 赵啸非's avatar 赵啸非

添加更新默认用户角色

parent da5af0eb
...@@ -11,6 +11,9 @@ import com.mortals.xhx.module.company.model.CompanyEntity; ...@@ -11,6 +11,9 @@ import com.mortals.xhx.module.company.model.CompanyEntity;
import com.mortals.xhx.module.company.service.CompanyService; import com.mortals.xhx.module.company.service.CompanyService;
import com.mortals.xhx.module.declare.model.*; import com.mortals.xhx.module.declare.model.*;
import com.mortals.xhx.module.declare.service.DeclareFinImagesService; import com.mortals.xhx.module.declare.service.DeclareFinImagesService;
import com.mortals.xhx.module.evaluation.model.EvaluationInfoEntity;
import com.mortals.xhx.module.evaluation.model.EvaluationInfoQuery;
import com.mortals.xhx.module.evaluation.service.EvaluationInfoService;
import com.mortals.xhx.module.park.model.ParkEntity; import com.mortals.xhx.module.park.model.ParkEntity;
import com.mortals.xhx.module.park.service.ParkService; import com.mortals.xhx.module.park.service.ParkService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -47,9 +50,11 @@ import lombok.extern.slf4j.Slf4j; ...@@ -47,9 +50,11 @@ import lombok.extern.slf4j.Slf4j;
public class DeclareServiceImpl extends AbstractCRUDServiceImpl<DeclareDao, DeclareEntity, Long> implements DeclareService { public class DeclareServiceImpl extends AbstractCRUDServiceImpl<DeclareDao, DeclareEntity, Long> implements DeclareService {
@Autowired @Autowired
private DeclareImagesService declareImagesService; private DeclareImagesService declareImagesService;
@Autowired @Autowired
private DeclareFinImagesService declareFinImagesService; private DeclareFinImagesService declareFinImagesService;
@Autowired
private EvaluationInfoService evaluationInfoService;
@Autowired @Autowired
private CategoryService categoryService; private CategoryService categoryService;
@Autowired @Autowired
...@@ -83,23 +88,30 @@ public class DeclareServiceImpl extends AbstractCRUDServiceImpl<DeclareDao, Decl ...@@ -83,23 +88,30 @@ public class DeclareServiceImpl extends AbstractCRUDServiceImpl<DeclareDao, Decl
.find(new DeclareFinImagesQuery().declareIdList(idList)).parallelStream() .find(new DeclareFinImagesQuery().declareIdList(idList)).parallelStream()
.collect(Collectors.groupingBy(DeclareFinImagesEntity::getDeclareId)); .collect(Collectors.groupingBy(DeclareFinImagesEntity::getDeclareId));
list.forEach(item -> item.setDeclareFinImagesList(declareFinImagesListMap.get(item.getId()))); list.forEach(item -> item.setDeclareFinImagesList(declareFinImagesListMap.get(item.getId())));
Map<Long, List<EvaluationInfoEntity>> evaluationListMap = evaluationInfoService
.find(new EvaluationInfoQuery().declareIdList(idList)).parallelStream()
.collect(Collectors.groupingBy(EvaluationInfoEntity::getDeclareId));
list.forEach(item -> item.setEvaluationInfoList(evaluationListMap.get(item.getId())));
} }
@Override @Override
protected void saveBefore(DeclareEntity entity, Context context) throws AppException { protected void saveBefore(DeclareEntity entity, Context context) throws AppException {
if(!ObjectUtils.isEmpty(entity.getCategoryId())){ if (!ObjectUtils.isEmpty(entity.getCategoryId())) {
CategoryEntity categoryEntity = categoryService.get(entity.getCategoryId()); CategoryEntity categoryEntity = categoryService.get(entity.getCategoryId());
entity.setCategoryName(categoryEntity==null?"":categoryEntity.getCategoryName()); entity.setCategoryName(categoryEntity == null ? "" : categoryEntity.getCategoryName());
entity.setCategoryCode(categoryEntity==null?"":categoryEntity.getCategoryCode()); entity.setCategoryCode(categoryEntity == null ? "" : categoryEntity.getCategoryCode());
} }
if(!ObjectUtils.isEmpty(entity.getParkId())){ if (!ObjectUtils.isEmpty(entity.getParkId())) {
ParkEntity parkEntity = parkService.get(entity.getParkId()); ParkEntity parkEntity = parkService.get(entity.getParkId());
entity.setParkName(parkEntity==null?"":parkEntity.getName()); entity.setParkName(parkEntity == null ? "" : parkEntity.getName());
} }
if(!ObjectUtils.isEmpty(entity.getCompanyId())){ if (!ObjectUtils.isEmpty(entity.getCompanyId())) {
CompanyEntity companyEntity = companyService.get(entity.getCompanyId()); CompanyEntity companyEntity = companyService.get(entity.getCompanyId());
entity.setCompanyName(companyEntity==null?"":companyEntity.getName()); entity.setCompanyName(companyEntity == null ? "" : companyEntity.getName());
} }
...@@ -172,10 +184,11 @@ public class DeclareServiceImpl extends AbstractCRUDServiceImpl<DeclareDao, Decl ...@@ -172,10 +184,11 @@ public class DeclareServiceImpl extends AbstractCRUDServiceImpl<DeclareDao, Decl
public Rest<String> declareCancel(DeclareQuery query, Context context) { public Rest<String> declareCancel(DeclareQuery query, Context context) {
//校验取消申报时间 //校验取消申报时间
DeclareEntity declareEntity = this.get(query.getId(), context); DeclareEntity declareEntity = this.get(query.getId(), context);
if(ObjectUtils.isEmpty(declareEntity)) throw new AppException("申报信息不存在!id:"+query.getId()); if (ObjectUtils.isEmpty(declareEntity)) throw new AppException("申报信息不存在!id:" + query.getId());
long between = DateUtil.between(declareEntity.getCreateTime(), new Date(), DateUnit.MINUTE); long between = DateUtil.between(declareEntity.getCreateTime(), new Date(), DateUnit.MINUTE);
if(between > 30) throw new AppException("超过30分钟无法取消申报!"); if (between > 30) throw new AppException("超过30分钟无法取消申报!");
if(declareEntity.getDeclareStatus() != DeclareStatusEnum.草稿.getValue()) throw new AppException("当前申报不是草稿状态,不能撤销!"); if (declareEntity.getDeclareStatus() != DeclareStatusEnum.草稿.getValue())
throw new AppException("当前申报不是草稿状态,不能撤销!");
declareEntity.setDeclareStatus(DeclareStatusEnum.撤销.getValue()); declareEntity.setDeclareStatus(DeclareStatusEnum.撤销.getValue());
declareEntity.setUpdateTime(new Date()); declareEntity.setUpdateTime(new Date());
......
...@@ -12,6 +12,9 @@ import com.mortals.xhx.module.declare.model.*; ...@@ -12,6 +12,9 @@ import com.mortals.xhx.module.declare.model.*;
import com.mortals.xhx.module.declare.service.DeclareFinImagesService; import com.mortals.xhx.module.declare.service.DeclareFinImagesService;
import com.mortals.xhx.module.declare.service.DeclareImagesService; import com.mortals.xhx.module.declare.service.DeclareImagesService;
import com.mortals.xhx.module.declare.service.DeclareService; import com.mortals.xhx.module.declare.service.DeclareService;
import com.mortals.xhx.module.evaluation.model.EvaluationInfoEntity;
import com.mortals.xhx.module.evaluation.model.EvaluationInfoQuery;
import com.mortals.xhx.module.evaluation.service.EvaluationInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -37,6 +40,9 @@ public class DeclareController extends BaseCRUDJsonBodyMappingController<Declare ...@@ -37,6 +40,9 @@ public class DeclareController extends BaseCRUDJsonBodyMappingController<Declare
@Autowired @Autowired
private DeclareFinImagesService declareFinImagesService; private DeclareFinImagesService declareFinImagesService;
@Autowired
private EvaluationInfoService evaluationInfoService;
public DeclareController() { public DeclareController() {
super.setModuleDesc("企业代办申报"); super.setModuleDesc("企业代办申报");
} }
...@@ -54,6 +60,11 @@ public class DeclareController extends BaseCRUDJsonBodyMappingController<Declare ...@@ -54,6 +60,11 @@ public class DeclareController extends BaseCRUDJsonBodyMappingController<Declare
entity.setDeclareImagesList(declareImagesEntities); entity.setDeclareImagesList(declareImagesEntities);
List<DeclareFinImagesEntity> declareFinImagesEntities = declareFinImagesService.find(new DeclareFinImagesQuery().declareId(id)); List<DeclareFinImagesEntity> declareFinImagesEntities = declareFinImagesService.find(new DeclareFinImagesQuery().declareId(id));
entity.setDeclareFinImagesList(declareFinImagesEntities); entity.setDeclareFinImagesList(declareFinImagesEntities);
List<EvaluationInfoEntity> evaluationInfoEntities = evaluationInfoService.find(new EvaluationInfoQuery().declareId(id));
entity.setEvaluationInfoList(evaluationInfoEntities);
return super.infoAfter(id, model, entity, context); return super.infoAfter(id, model, entity, context);
} }
...@@ -68,7 +79,7 @@ public class DeclareController extends BaseCRUDJsonBodyMappingController<Declare ...@@ -68,7 +79,7 @@ public class DeclareController extends BaseCRUDJsonBodyMappingController<Declare
String busiDesc = "申报撤销" + this.getModuleDesc(); String busiDesc = "申报撤销" + this.getModuleDesc();
try { try {
Rest<String> rest = this.service.declareCancel(query, getContext()); Rest<String> rest = this.service.declareCancel(query, getContext());
if(YesNoEnum.NO.getValue()==rest.getCode()){ if (YesNoEnum.NO.getValue() == rest.getCode()) {
throw new AppException(rest.getMsg()); throw new AppException(rest.getMsg());
} }
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment