|
@@ -7,6 +7,7 @@ import com.idea.oa.apply.mapper.ApplyPaymentSettleMapper;
|
|
|
import com.idea.oa.apply.model.ApplyPaymentSettle;
|
|
|
import com.idea.oa.apply.model.ApplyPaymentSettleExample;
|
|
|
import com.idea.oa.apply.model.inout.ApplyPaymentSettleIn;
|
|
|
+import com.idea.oa.apply.util.constant.RedisToUse;
|
|
|
import com.rockstar.common.base.BaseService;
|
|
|
import com.rockstar.common.support.Convert;
|
|
|
import com.rockstar.frame.model.extend.DateTrans;
|
|
@@ -14,7 +15,9 @@ import com.rockstar.frame.model.extend.Tablepar;
|
|
|
import com.rockstar.util.UUIDUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -143,5 +146,49 @@ public class ApplyPaymentSettleService implements BaseService<ApplyPaymentSettle
|
|
|
return userInfoByUserId;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+// public static void main(String[] args) {
|
|
|
+// System.out.println(new ApplyPaymentSettleService().getMaxNum());
|
|
|
+// }
|
|
|
+ /**
|
|
|
+ * 付款记录编号 : 付款领用单20240401-002
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getMaxNum(){
|
|
|
+ String maxnum = null;
|
|
|
+ try {
|
|
|
+ int c=0;
|
|
|
+ while ("#".equals(RedisToUse.pmnumber)){
|
|
|
+ try {
|
|
|
+ c++;
|
|
|
+ Thread.sleep(100);//等待毫秒
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ if (c>=1000){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ maxnum = RedisToUse.pmnumber;
|
|
|
+ RedisToUse.pmnumber="#";
|
|
|
+ if (maxnum==null){
|
|
|
+ maxnum = ApplyPaymentSettleExtendMapper.selectMaxNum();
|
|
|
+ }
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
+ String topName = "付款领用单"+sdf.format(new Date())+"-";
|
|
|
+// 20221111-04
|
|
|
+ if (StringUtils.isEmpty(maxnum)) {
|
|
|
+ maxnum = topName+"001";
|
|
|
+ }else {
|
|
|
+ String substring = maxnum.substring(0, topName.length());
|
|
|
+ if (topName.equals(substring)){
|
|
|
+ maxnum= RedisToUse.addNumber(topName, maxnum);
|
|
|
+ }else{
|
|
|
+ maxnum = topName+"001";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ RedisToUse.pmnumber=maxnum;
|
|
|
+ }
|
|
|
+ return maxnum;
|
|
|
+ }
|
|
|
}
|