|  |  | @ -3,6 +3,7 @@ package com.dsic.gj_erp.service.jhgk.impl; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.date.DateTime; |  |  |  | import cn.hutool.core.date.DateTime; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.date.DateUtil; |  |  |  | import cn.hutool.core.date.DateUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import cn.hutool.core.util.ObjUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.util.StrUtil; |  |  |  | import cn.hutool.core.util.StrUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
			
		
	
	
		
		
			
				
					|  |  | @ -41,6 +42,7 @@ import java.util.stream.Collectors; | 
			
		
	
		
		
			
				
					
					|  |  |  |  * @author xn |  |  |  |  * @author xn | 
			
		
	
		
		
			
				
					
					|  |  |  |  * @since 2023-11-09 |  |  |  |  * @since 2023-11-09 | 
			
		
	
		
		
			
				
					
					|  |  |  |  */ |  |  |  |  */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | @SuppressWarnings("ALL") | 
			
		
	
		
		
			
				
					
					|  |  |  | @Service |  |  |  | @Service | 
			
		
	
		
		
			
				
					
					|  |  |  | public class DmYdjhServiceImpl extends ServiceImpl<DmYdjhMapper, DmYdjh> implements DmYdjhService { |  |  |  | public class DmYdjhServiceImpl extends ServiceImpl<DmYdjhMapper, DmYdjh> implements DmYdjhService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -246,14 +248,9 @@ public class DmYdjhServiceImpl extends ServiceImpl<DmYdjhMapper, DmYdjh> impleme | 
			
		
	
		
		
			
				
					
					|  |  |  |         String bzrq= DateUtil.format(DateUtil.date(), "yyyy/MM/dd"); |  |  |  |         String bzrq= DateUtil.format(DateUtil.date(), "yyyy/MM/dd"); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         //工单号
 |  |  |  |         //工单号
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<DmYdjh> updateList = ydjhList.stream().filter(item->StrUtil.isNotEmpty(item.getSljhrq())).map(item -> { |  |  |  |         List<DmYdjh> updateList = ydjhList.stream() | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             Long increment = redisTemplate.opsForHash().increment("ZYJH_GDH::", item.getSljhrq(), 1); |  |  |  |                 .filter(item->StrUtil.isNotEmpty(item.getSljhrq())) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             DmYdjh dmYdjh = new DmYdjh(); |  |  |  |                 .map(this::ofXf).collect(Collectors.toList()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             dmYdjh.setId(item.getId()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             dmYdjh.setZt("2"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             dmYdjh.setDjh(StrUtil.format("{}{}",item.getSljhrq().replace("/",""), String.format("%03d",increment))); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             return dmYdjh; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         }).collect(Collectors.toList()); |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         this.updateBatchById(updateList); |  |  |  |         this.updateBatchById(updateList); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -309,4 +306,24 @@ public class DmYdjhServiceImpl extends ServiceImpl<DmYdjhMapper, DmYdjh> impleme | 
			
		
	
		
		
			
				
					
					|  |  |  |         publisher.publishEvent(ydjhList); |  |  |  |         publisher.publishEvent(ydjhList); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private DmYdjh ofXf(DmYdjh item){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Long djh=this.handlerDjh(item); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         DmYdjh dmYdjh = new DmYdjh(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         dmYdjh.setId(item.getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         dmYdjh.setZt("2"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         String perfix=item.getSljhrq().replace("/",""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         perfix=perfix.substring(2); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         dmYdjh.setDjh(StrUtil.format("{}{}",perfix, String.format("%03d",djh))); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return dmYdjh; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private Long handlerDjh(DmYdjh item){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         String key="ZYJH_GDH::"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //从101开始生成工单号,方便工人念出
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (ObjUtil.isEmpty(redisTemplate.opsForHash().get(key, item.getSljhrq()))) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             redisTemplate.opsForHash().put(key, item.getSljhrq(),100); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return redisTemplate.opsForHash().increment(key, item.getSljhrq(), 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |