Commit 7f450eda authored by 赵啸非's avatar 赵啸非

添加窗口编码

parent a05c5027
package com.mortals.xhx.module.window.service.impl; package com.mortals.xhx.module.window.service.impl;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.code.FillStatusEnum; import com.mortals.xhx.common.code.FillStatusEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.window.WindowPdu;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.feign.window.IWindowFeign;
import com.mortals.xhx.module.check.model.CheckWindowPerformEntity; import com.mortals.xhx.module.check.model.CheckWindowPerformEntity;
import com.mortals.xhx.module.check.model.CheckWindowPerformQuery; import com.mortals.xhx.module.check.model.CheckWindowPerformQuery;
import com.mortals.xhx.module.check.model.CheckWindowWorkmanPerformEntity; import com.mortals.xhx.module.check.model.CheckWindowWorkmanPerformEntity;
...@@ -21,18 +26,19 @@ import com.mortals.xhx.module.window.dao.WindowWorkmanPerformDao; ...@@ -21,18 +26,19 @@ import com.mortals.xhx.module.window.dao.WindowWorkmanPerformDao;
import com.mortals.xhx.module.window.model.WindowWorkmanPerformEntity; import com.mortals.xhx.module.window.model.WindowWorkmanPerformEntity;
import com.mortals.xhx.module.window.service.WindowWorkmanPerformService; import com.mortals.xhx.module.window.service.WindowWorkmanPerformService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* WindowWorkmanPerformService * WindowWorkmanPerformService
* 窗口人员考核汇总登记 service实现 * 窗口人员考核汇总登记 service实现
* *
* @author zxfei * @author zxfei
* @date 2024-01-17 * @date 2024-01-17
*/ */
@Service("windowWorkmanPerformService") @Service("windowWorkmanPerformService")
@Slf4j @Slf4j
public class WindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<WindowWorkmanPerformDao, WindowWorkmanPerformEntity, Long> implements WindowWorkmanPerformService { public class WindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<WindowWorkmanPerformDao, WindowWorkmanPerformEntity, Long> implements WindowWorkmanPerformService {
...@@ -43,17 +49,44 @@ public class WindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<Win ...@@ -43,17 +49,44 @@ public class WindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<Win
private CheckWindowWorkmanPerformService checkWindowWorkmanPerformService; private CheckWindowWorkmanPerformService checkWindowWorkmanPerformService;
@Autowired
private IWindowFeign windowFeign;
@Override
protected void saveBefore(WindowWorkmanPerformEntity entity, Context context) throws AppException {
buildWindowInfo(entity);
super.saveBefore(entity, context);
}
private void buildWindowInfo(WindowWorkmanPerformEntity entity) {
if (!ObjectUtils.isEmpty(entity.getWindowId())) {
Rest<WindowPdu> rest = windowFeign.info(entity.getWindowId());
if (YesNoEnum.YES.getValue() == rest.getCode()) {
entity.setWindowName(rest.getData().getName());
entity.setWindowCode(rest.getData().getFromnum());
}
}
}
@Override
protected void updateBefore(WindowWorkmanPerformEntity entity, Context context) throws AppException {
buildWindowInfo(entity);
super.updateBefore(entity, context);
}
@Override @Override
protected void saveAfter(WindowWorkmanPerformEntity entity, Context context) throws AppException { protected void saveAfter(WindowWorkmanPerformEntity entity, Context context) throws AppException {
if(CollectionUtils.isNotEmpty(entity.getWorkmanPerformDetailList())){ if (CollectionUtils.isNotEmpty(entity.getWorkmanPerformDetailList())) {
entity.getWorkmanPerformDetailList().forEach(item->{ entity.getWorkmanPerformDetailList().forEach(item -> {
item.setPerformId(entity.getId()); item.setPerformId(entity.getId());
item.setCreateUserId(this.getContextUserId(context)); item.setCreateUserId(this.getContextUserId(context));
item.setCreateTime(new Date()); item.setCreateTime(new Date());
}); });
windowWorkmanPerformDetailService.save(entity.getWorkmanPerformDetailList()); windowWorkmanPerformDetailService.save(entity.getWorkmanPerformDetailList());
} }
if(entity.getFillStatus()== FillStatusEnum.提交.getValue()){ if (entity.getFillStatus() == FillStatusEnum.提交.getValue()) {
saveToCheck(entity); saveToCheck(entity);
} }
super.saveAfter(entity, context); super.saveAfter(entity, context);
...@@ -61,10 +94,10 @@ public class WindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<Win ...@@ -61,10 +94,10 @@ public class WindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<Win
@Override @Override
protected void updateAfter(WindowWorkmanPerformEntity entity, Context context) throws AppException { protected void updateAfter(WindowWorkmanPerformEntity entity, Context context) throws AppException {
if(CollectionUtils.isNotEmpty(entity.getWorkmanPerformDetailList())){ if (CollectionUtils.isNotEmpty(entity.getWorkmanPerformDetailList())) {
Long[] detailList = windowWorkmanPerformDetailService.find(new WindowWorkmanPerformDetailQuery().performId(entity.getId())).stream().map(WindowWorkmanPerformDetailEntity::getId).toArray(Long[]::new); Long[] detailList = windowWorkmanPerformDetailService.find(new WindowWorkmanPerformDetailQuery().performId(entity.getId())).stream().map(WindowWorkmanPerformDetailEntity::getId).toArray(Long[]::new);
windowWorkmanPerformDetailService.remove(detailList,context); windowWorkmanPerformDetailService.remove(detailList, context);
entity.getWorkmanPerformDetailList().forEach(item->{ entity.getWorkmanPerformDetailList().forEach(item -> {
item.setPerformId(entity.getId()); item.setPerformId(entity.getId());
item.setCreateUserId(this.getContextUserId(context)); item.setCreateUserId(this.getContextUserId(context));
item.setCreateTime(new Date()); item.setCreateTime(new Date());
...@@ -73,7 +106,7 @@ public class WindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<Win ...@@ -73,7 +106,7 @@ public class WindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<Win
}); });
windowWorkmanPerformDetailService.save(entity.getWorkmanPerformDetailList()); windowWorkmanPerformDetailService.save(entity.getWorkmanPerformDetailList());
} }
if(entity.getFillStatus()== FillStatusEnum.提交.getValue()){ if (entity.getFillStatus() == FillStatusEnum.提交.getValue()) {
saveToCheck(entity); saveToCheck(entity);
} }
super.updateAfter(entity, context); super.updateAfter(entity, context);
...@@ -84,11 +117,11 @@ public class WindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<Win ...@@ -84,11 +117,11 @@ public class WindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<Win
List<WindowWorkmanPerformDetailEntity> detailEntities = windowWorkmanPerformDetailService.find(new WindowWorkmanPerformDetailQuery().performIdList(Arrays.asList(ids))); List<WindowWorkmanPerformDetailEntity> detailEntities = windowWorkmanPerformDetailService.find(new WindowWorkmanPerformDetailQuery().performIdList(Arrays.asList(ids)));
windowWorkmanPerformDetailService.removeList(detailEntities, context); windowWorkmanPerformDetailService.removeList(detailEntities, context);
List<CheckWindowWorkmanPerformEntity> performEntitys = checkWindowWorkmanPerformService.find(new CheckWindowWorkmanPerformQuery().recordIdList(Arrays.asList(ids))); List<CheckWindowWorkmanPerformEntity> performEntitys = checkWindowWorkmanPerformService.find(new CheckWindowWorkmanPerformQuery().recordIdList(Arrays.asList(ids)));
checkWindowWorkmanPerformService.removeList(performEntitys,context); checkWindowWorkmanPerformService.removeList(performEntitys, context);
super.removeAfter(ids, context, result); super.removeAfter(ids, context, result);
} }
private void saveToCheck(WindowWorkmanPerformEntity entity){ private void saveToCheck(WindowWorkmanPerformEntity entity) {
CheckWindowWorkmanPerformEntity perform = new CheckWindowWorkmanPerformEntity(); CheckWindowWorkmanPerformEntity perform = new CheckWindowWorkmanPerformEntity();
perform.initAttrValue(); perform.initAttrValue();
BeanUtils.copyProperties(entity, perform, BeanUtil.getNullPropertyNames(entity)); BeanUtils.copyProperties(entity, perform, BeanUtil.getNullPropertyNames(entity));
......
...@@ -9,8 +9,10 @@ import feign.hystrix.FallbackFactory; ...@@ -9,8 +9,10 @@ import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
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;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
...@@ -23,9 +25,14 @@ public interface IWindowFeign extends IFeign { ...@@ -23,9 +25,14 @@ public interface IWindowFeign extends IFeign {
@PostMapping(value = "/window/interlist") @PostMapping(value = "/window/interlist")
Rest<RespData<List<WindowPdu>>> list(@RequestBody WindowPdu windowPdu); Rest<RespData<List<WindowPdu>>> list(@RequestBody WindowPdu windowPdu);
/**
* 查看站点部门窗口
*
* @param id
* @return
*/
@GetMapping(value = "/window/interinfo")
Rest<WindowPdu> info(@RequestParam(value = "id") Long id);
} }
...@@ -41,6 +48,12 @@ class WindowFeignFallbackFactory implements FallbackFactory<IWindowFeign> { ...@@ -41,6 +48,12 @@ class WindowFeignFallbackFactory implements FallbackFactory<IWindowFeign> {
public Rest<RespData<List<WindowPdu>>> list(WindowPdu windowPdu) { public Rest<RespData<List<WindowPdu>>> list(WindowPdu windowPdu) {
return Rest.fail("暂时无法访问窗口列表接口,请稍后再试!"); return Rest.fail("暂时无法访问窗口列表接口,请稍后再试!");
} }
@Override
public Rest<WindowPdu> info(Long id) {
return Rest.fail("暂时无法获取站点部门窗口详细,请稍后再试!");
}
}; };
} }
} }
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