¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.home.xining.service; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.text.Format; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.product.core.dao.BaseDao; |
| | | import com.product.core.entity.FieldSetEntity; |
| | | import com.product.core.service.support.AbstractBaseService; |
| | | |
| | | /** |
| | | * æµç¨ç»æåå¤çå¨è°ç¨ï¼èªå¨ç»è¡æ¿å¤ç½ç¸å
³ä¸å¡æ·»å åå· |
| | | * @author 86151 |
| | | * |
| | | */ |
| | | @Component |
| | | public class FlowEndCreateSerialNumber extends AbstractBaseService{ |
| | | |
| | | @Autowired |
| | | BaseDao baseDao; |
| | | |
| | | /** |
| | | * èªå¨çæåå· |
| | | * @param tableName 表å |
| | | * @param serviceUUID ä¸å¡UUID |
| | | * @param yearNo 宿¿å |
| | | */ |
| | | public synchronized void autoCreateSerialNumber(FieldSetEntity fse, String serviceUUID, String yearNo) { |
| | | //æ¥è¯¢ååæ°æ®ä¸æå¤§çå· |
| | | FieldSetEntity fseMax =baseDao.getFieldSetEntityBySQL("SELECT IFNULL(MAX(no02),0)+1 no02 FROM "+fse.getTableName()+" WHERE no01=?", new Object[] {yearNo}, false); |
| | | if (fseMax!=null) { |
| | | Integer maxNo = fseMax.getInteger("no02"); |
| | | |
| | | //æ ¼å¼åå· |
| | | Format format = new DecimalFormat("000"); |
| | | String finalNo= format.format(maxNo); |
| | | |
| | | //ä¿®æ¹æ°æ® |
| | | baseDao.executeUpdate("UPDATE "+ fse.getTableName() +" SET no02 =? WHERE uuid=?", new Object[] {finalNo, serviceUUID}); |
| | | } |
| | | } |
| | | } |