| | |
| | | import com.ruoyi.project.domain.BaseOnlyvalue; |
| | | import com.ruoyi.project.mapper.BaseOnlyvalueMapper; |
| | | import com.ruoyi.project.service.IBaseOnlyvalueService; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取序列号 |
| | | * |
| | | * @param businessType |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String getSequence(String businessType, String orgId) { |
| | | LocalDate currentDate = LocalDate.now(); |
| | | int year = currentDate.getYear(); |
| | | String month = currentDate.getMonthValue()+""; |
| | | if(month.length()==1) |
| | | month="0"+month; |
| | | if(ObjectUtils.isEmpty(orgId)){ |
| | | orgId=""; |
| | | } |
| | | //通过年月日期去查询该月份是否存在 |
| | | String data =year + month+orgId; |
| | | BaseOnlyvalue baseOnlyvalue = new BaseOnlyvalue(); |
| | | baseOnlyvalue.setBusinesstype(businessType); |
| | | |
| | | List<BaseOnlyvalue> baseOnlyvalues = queryList(baseOnlyvalue); |
| | | if(baseOnlyvalues.size()==0){ |
| | | baseOnlyvalue.setAppentvalue(businessType); |
| | | baseOnlyvalue.setCurrentvalue(1L); |
| | | baseOnlyvalue.setBusinesstype(businessType); |
| | | save(baseOnlyvalue); |
| | | }else { |
| | | baseOnlyvalue= baseOnlyvalues.get(0); |
| | | baseOnlyvalue.setCurrentvalue(baseOnlyvalue.getCurrentvalue()+1); |
| | | updateById(baseOnlyvalue); |
| | | } |
| | | return baseOnlyvalue.getAppentvalue() + data + baseOnlyvalue.getCurrentvalue(); |
| | | } |
| | | |
| | | } |