|
|
|
@ -2,16 +2,23 @@ package org.jeecg.modules.demo.base.service.impl; |
|
|
|
|
|
|
|
|
|
import org.jeecg.modules.demo.base.entity.ZyClothsComponent; |
|
|
|
|
import org.jeecg.modules.demo.base.entity.ZyClothsModular; |
|
|
|
|
import org.jeecg.modules.demo.base.entity.ZyClothsType; |
|
|
|
|
import org.jeecg.modules.demo.base.entity.vo.ZyProcessVo; |
|
|
|
|
import org.jeecg.modules.demo.base.mapper.ZyClothsComponentMapper; |
|
|
|
|
import org.jeecg.modules.demo.base.mapper.ZyClothsModularMapper; |
|
|
|
|
import org.jeecg.modules.demo.base.mapper.ZyClothsTypeMapper; |
|
|
|
|
import org.jeecg.modules.demo.base.service.IZyClothsComponentService; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Collections; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @Description: zy_cloths_component |
|
|
|
@ -21,8 +28,10 @@ import java.util.List; |
|
|
|
|
*/ |
|
|
|
|
@Service |
|
|
|
|
public class ZyClothsComponentServiceImpl extends ServiceImpl<ZyClothsComponentMapper, ZyClothsComponent> implements IZyClothsComponentService { |
|
|
|
|
@Autowired |
|
|
|
|
@Resource |
|
|
|
|
private ZyClothsComponentMapper zyClothsComponentMapper; |
|
|
|
|
@Resource |
|
|
|
|
ZyClothsTypeMapper zyClothsTypeMapper; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<ZyProcessVo> selectList(String id) { |
|
|
|
@ -30,9 +39,43 @@ public class ZyClothsComponentServiceImpl extends ServiceImpl<ZyClothsComponentM |
|
|
|
|
List<ZyProcessVo> zyProcessVoList=baseMapper.selectProcessVo(list); |
|
|
|
|
return zyProcessVoList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<ZyClothsComponent> selectByModular(String modular_id) { |
|
|
|
|
return zyClothsComponentMapper.selectByModular(modular_id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 编码规则:服装类型(10)+序号(8) |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public String generateNumber(ZyClothsComponent zyClothsComponent) { |
|
|
|
|
String nums = zyClothsComponent.getClothsTypeId(); |
|
|
|
|
ZyClothsType zyClothsType = zyClothsTypeMapper.selectById(nums); |
|
|
|
|
String nums1 = zyClothsType.getNums(); |
|
|
|
|
//String substring = nums.substring(nums.length() - 10);
|
|
|
|
|
String format = String.format("%06d", orderNumber()); |
|
|
|
|
return nums1 + format; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Long orderNumber() { |
|
|
|
|
List<String> listString = zyClothsComponentMapper.selectNumsList2(); |
|
|
|
|
//System.err.println(listString);
|
|
|
|
|
List<Long> listLong = new ArrayList<>(); |
|
|
|
|
for (String nums : listString) { |
|
|
|
|
String REGEX = "[^0-9]"; |
|
|
|
|
String newNums = Pattern.compile(REGEX).matcher(nums).replaceAll("").trim(); |
|
|
|
|
if (!StringUtils.hasText(newNums)){ |
|
|
|
|
newNums = "0"; |
|
|
|
|
} |
|
|
|
|
if (newNums.length() > 8) { |
|
|
|
|
String substring = nums.substring(nums.length() - 8); |
|
|
|
|
listLong.add(Long.valueOf(substring)); |
|
|
|
|
}else { |
|
|
|
|
listLong.add(Long.valueOf(newNums)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
System.out.println(listLong); |
|
|
|
|
return Collections.max(listLong)+1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|