|  |  |  | @ -1,9 +1,13 @@ | 
			
		
	
		
			
				
					|  |  |  |  | package com.glxp.api.controller.stat; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | import cn.hutool.core.collection.CollectionUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import cn.hutool.core.util.StrUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
			
				
					|  |  |  |  | import com.beust.jcommander.internal.Lists; | 
			
		
	
		
			
				
					|  |  |  |  | import com.github.pagehelper.Page; | 
			
		
	
		
			
				
					|  |  |  |  | import com.github.pagehelper.PageHelper; | 
			
		
	
		
			
				
					|  |  |  |  | import com.github.pagehelper.PageInfo; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.annotation.AuthRuleAnnotation; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.annotation.Log; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.common.enums.ResultEnum; | 
			
		
	
	
		
			
				
					|  |  |  | @ -11,18 +15,23 @@ import com.glxp.api.common.res.BaseResponse; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.common.util.ResultVOUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.constant.BusinessType; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.controller.BaseController; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.basic.BasicUdiProductEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.basic.ProductInfoEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.basic.UdiEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.stat.IoStatOrderEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.stat.IoStatSetDetailEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.stat.IoStatSetEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.stat.IoStatOrderEntityRequest; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.stat.IoStatSetDetailEntityRequest; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.stat.IoStatSetEntityRequest; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.basic.FilterUdiRelRequest; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.stat.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.system.DeleteRequest; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.res.PageSimpleResponse; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.basic.BasicUdiProductService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.stat.IoStatSetDetailService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.stat.IoStatSetService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.BeanCopyUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.StringUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.udi.FilterUdiUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import io.swagger.annotations.ApiOperation; | 
			
		
	
		
			
				
					|  |  |  |  | import lombok.RequiredArgsConstructor; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.validation.BindingResult; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.validation.annotation.Validated; | 
			
		
	
	
		
			
				
					|  |  |  | @ -44,7 +53,10 @@ import java.util.List; | 
			
		
	
		
			
				
					|  |  |  |  | @RequestMapping("/stat/setDetail") | 
			
		
	
		
			
				
					|  |  |  |  | public class IoStatSetDetailEntityController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         private final IoStatSetDetailService ioStatSetDetailService; | 
			
		
	
		
			
				
					|  |  |  |  |     private final IoStatSetDetailService ioStatSetDetailService; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     private final BasicUdiProductService basicUdiProductService; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @GetMapping("/list") | 
			
		
	
	
		
			
				
					|  |  |  | @ -65,19 +77,72 @@ public class IoStatSetDetailEntityController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  |     @AuthRuleAnnotation("") | 
			
		
	
		
			
				
					|  |  |  |  |     @PostMapping("/save") | 
			
		
	
		
			
				
					|  |  |  |  |     @Log(title = "器械公告管理", businessType = BusinessType.INSERT) | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse save(@RequestBody IoStatSetDetailEntity entity, | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse save(@RequestBody IoStatSetDetailEntitySaveRequest entity, | 
			
		
	
		
			
				
					|  |  |  |  |                              BindingResult bindingResult) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         if (bindingResult.hasErrors()) { | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         boolean b = ioStatSetDetailService.save(entity); | 
			
		
	
		
			
				
					|  |  |  |  |         List<IoStatSetDetailEntity> list = Lists.newArrayList(); | 
			
		
	
		
			
				
					|  |  |  |  |         List<IoStatSetDetailProductRequest> detailList =  entity.getProducts(); | 
			
		
	
		
			
				
					|  |  |  |  |         if(CollectionUtil.isNotEmpty(detailList)){ | 
			
		
	
		
			
				
					|  |  |  |  |             detailList.stream().forEach(s->{ | 
			
		
	
		
			
				
					|  |  |  |  |                 IoStatSetDetailEntity ioStatSetDetailEntity = new IoStatSetDetailEntity(); | 
			
		
	
		
			
				
					|  |  |  |  |                 ioStatSetDetailEntity.setSetFk(entity.getSetFk()); | 
			
		
	
		
			
				
					|  |  |  |  |                 ioStatSetDetailEntity.setCpmctymc(s.getCpmctymc()); | 
			
		
	
		
			
				
					|  |  |  |  |                 ioStatSetDetailEntity.setGgxh(s.getGgxh()); | 
			
		
	
		
			
				
					|  |  |  |  |                 list.add(ioStatSetDetailEntity); | 
			
		
	
		
			
				
					|  |  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         boolean b = ioStatSetDetailService.saveBatch(list); | 
			
		
	
		
			
				
					|  |  |  |  |         if (!b) { | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(ResultEnum.NOT_NETWORK); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         return ResultVOUtils.success("添加成功!"); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     //获取同步库UDI信息
 | 
			
		
	
		
			
				
					|  |  |  |  |     @ApiOperation(value = "获取同步库UDI信息", response = BasicUdiProductEntity.class) | 
			
		
	
		
			
				
					|  |  |  |  |     @AuthRuleAnnotation("") | 
			
		
	
		
			
				
					|  |  |  |  |     @ApiIgnore | 
			
		
	
		
			
				
					|  |  |  |  |     @GetMapping("getUdiProduct") | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse filterDict(FilterUdiRelRequest filterUdiRelRequest) { | 
			
		
	
		
			
				
					|  |  |  |  |         String nameCode; | 
			
		
	
		
			
				
					|  |  |  |  |         if (StrUtil.isNotEmpty(filterUdiRelRequest.getUdiCode())) { | 
			
		
	
		
			
				
					|  |  |  |  |             UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiRelRequest.getUdiCode()); | 
			
		
	
		
			
				
					|  |  |  |  |             if (udiEntity != null) { | 
			
		
	
		
			
				
					|  |  |  |  |                 nameCode = udiEntity.getUdi(); | 
			
		
	
		
			
				
					|  |  |  |  |             } else { | 
			
		
	
		
			
				
					|  |  |  |  |                 return ResultVOUtils.error(500, "无效UDI码!"); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } else | 
			
		
	
		
			
				
					|  |  |  |  |             nameCode = filterUdiRelRequest.getNameCode(); | 
			
		
	
		
			
				
					|  |  |  |  |         if (StrUtil.isNotEmpty(nameCode)) { | 
			
		
	
		
			
				
					|  |  |  |  |             filterUdiRelRequest.setNameCode(nameCode); | 
			
		
	
		
			
				
					|  |  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |  |             filterUdiRelRequest.setDiType(1); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         List<BasicUdiProductEntity> udiDlDeviceResponse = basicUdiProductService.filterList(filterUdiRelRequest); | 
			
		
	
		
			
				
					|  |  |  |  |         if (CollectionUtil.isNotEmpty(udiDlDeviceResponse)) { | 
			
		
	
		
			
				
					|  |  |  |  |             for (BasicUdiProductEntity basicUdiProductEntity : udiDlDeviceResponse) { | 
			
		
	
		
			
				
					|  |  |  |  |                 QueryWrapper queryWrapper = new QueryWrapper(); | 
			
		
	
		
			
				
					|  |  |  |  |                 queryWrapper.eq("setFk",filterUdiRelRequest.getSetFk()); | 
			
		
	
		
			
				
					|  |  |  |  |                 queryWrapper.eq("cpmctymc",basicUdiProductEntity.getCpmctymc()); | 
			
		
	
		
			
				
					|  |  |  |  |                 queryWrapper.eq("ggxh",basicUdiProductEntity.getGgxh()); | 
			
		
	
		
			
				
					|  |  |  |  |                 List<IoStatSetDetailEntity> tempList = ioStatSetDetailService.list(queryWrapper); | 
			
		
	
		
			
				
					|  |  |  |  |                 if (CollectionUtil.isNotEmpty(tempList)) { | 
			
		
	
		
			
				
					|  |  |  |  |                     basicUdiProductEntity.setCheck(true); | 
			
		
	
		
			
				
					|  |  |  |  |                 } else | 
			
		
	
		
			
				
					|  |  |  |  |                     basicUdiProductEntity.setCheck(false); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         PageInfo<BasicUdiProductEntity> basicUdiRelResponsePageInfo = new PageInfo<>(udiDlDeviceResponse); | 
			
		
	
		
			
				
					|  |  |  |  |         PageSimpleResponse<BasicUdiProductEntity> basicUdiRelResponsePageSimpleResponse = new PageSimpleResponse<>(); | 
			
		
	
		
			
				
					|  |  |  |  |         basicUdiRelResponsePageSimpleResponse.setTotal(basicUdiRelResponsePageInfo.getTotal()); | 
			
		
	
		
			
				
					|  |  |  |  |         basicUdiRelResponsePageSimpleResponse.setList(udiDlDeviceResponse); | 
			
		
	
		
			
				
					|  |  |  |  |         return ResultVOUtils.success(basicUdiRelResponsePageSimpleResponse); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @AuthRuleAnnotation("") | 
			
		
	
		
			
				
					|  |  |  |  |     @PostMapping("/edit") | 
			
		
	
		
			
				
					|  |  |  |  |     @Log(title = "器械公告管理", businessType = BusinessType.UPDATE) | 
			
		
	
	
		
			
				
					|  |  |  | 
 |