zt 9 mesi fa
parent
commit
581ddc0f57

+ 17 - 0
pro-base/src/main/java/com/idea/oa/apply/controller/ApplyPaymentSettleController.java

@@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 
 import java.math.BigDecimal;
 import java.math.MathContext;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -58,6 +59,22 @@ public class ApplyPaymentSettleController extends BaseController {
     @Autowired
     private FrameUserService frameUserService;
 
+
+
+
+
+
+    /**
+     * 付款记录编号 : 付款领用单20240401-002
+     * @return
+     */
+    @PostMapping(value = "getMaxNum", produces = {"application/json;charset=UTF-8"})
+    @ResponseBody
+    public String getMaxNum() {
+
+        return modelService.getMaxNum();
+    }
+
     /**
      * 添加审核结果
      * 根据不同的状态值confirmResult判断是 1:审核通过,转下一步;2:退回发起人;3:退回上节点;4:结束流程;

+ 2 - 1
pro-base/src/main/java/com/idea/oa/apply/mapper/ApplyPaymentSettleExtendMapper.java

@@ -21,5 +21,6 @@ public interface ApplyPaymentSettleExtendMapper {
 //    frame_user.posts,frame_post.post_name,frame_user.id,frame_user.truename,frame_user.department,sys_dept.dept_name as deptName
     @Select("SELECT frame_user.posts,frame_post.post_name as postName,frame_user.id,frame_user.truename,frame_user.department,sys_dept.dept_name as deptName  FROM frame_user LEFT JOIN sys_dept ON sys_dept.id=frame_user.department LEFT JOIN frame_post ON frame_post.id=frame_user.posts WHERE frame_user.id=#{userId}")
     Map<String, Object> getUserInfoByUserId(@Param("userId")  String userId);
-
+    @Select("SELECT MAX(title) as maxnum FROM apply_payment_settle")
+    String selectMaxNum();
 }

+ 48 - 1
pro-base/src/main/java/com/idea/oa/apply/service/ApplyPaymentSettleService.java

@@ -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;
+    }
 }

+ 42 - 0
pro-base/src/main/java/com/idea/oa/apply/util/constant/RedisToUse.java

@@ -0,0 +1,42 @@
+package com.idea.oa.apply.util.constant;
+
+import org.springframework.util.StringUtils;
+
+public class RedisToUse {
+
+
+    //拍卖场次
+    public static String pmnumber = null;//"付款领用单20240401-002";
+
+
+    /**
+     * 获取各种订单编号递增的值
+     *
+     * @param topName
+     * @param maxnum
+     * @return
+     */
+    public static String addNumber(String topName, String maxnum) {
+        if (StringUtils.isEmpty(maxnum)) {
+            return null;
+        } else {
+            String substring = maxnum.substring(maxnum.length() - 1);
+            if ("9".equals(substring)) {
+                Integer num = Integer.parseInt(maxnum.substring(topName.length()));
+                num++;
+                int i = maxnum.length() - topName.length() - num.toString().length();
+                StringBuilder sb = new StringBuilder();
+                sb.append(topName);
+                for (int i1 = 0; i1 < i; i1++) {
+                    sb.append('0');
+                }
+                sb.append(num.toString());
+                maxnum = sb.toString();
+            } else {
+                int i = Integer.parseInt(substring) + 1;
+                maxnum = maxnum.substring(0, maxnum.length() - 1) + i;
+            }
+        }
+        return maxnum;
+    }
+}

+ 11 - 5
pro-base/src/main/java/com/idea/oa/flow2/mapper/FlowMainExtendMapper.java

@@ -30,11 +30,17 @@ public interface FlowMainExtendMapper {
     @Select("SELECT frame_user.* FROM frame_role_data_user LEFT JOIN frame_role_data ON frame_role_data.id=frame_role_data_user.role_data_id LEFT JOIN frame_user ON frame_user.id=frame_role_data_user.user_id WHERE frame_role_data.role_key=#{roleKey} AND frame_role_data.role_type=#{roleType} ")
     List<FrameUser> findFrameUsersByRoleKey(@Param("roleKey")String roleKey,@Param("roleType")String roleType);
 
-    @Select("SELECT frame_user.* FROM frame_role_data_user " +
-            "LEFT JOIN frame_role_data ON frame_role_data.id=frame_role_data_user.role_data_id " +
-            "LEFT JOIN frame_user ON frame_user.id=frame_role_data_user.user_id " +
-            "WHERE frame_role_data.role_key=#{roleKey} AND frame_role_data.role_type=#{roleType} " +
-            "AND frame_user.group_id=#{groupId} AND frame_user.status = '1'")
+//    @Select("SELECT frame_user.* FROM frame_role_data_user " +
+//            "LEFT JOIN frame_role_data ON frame_role_data.id=frame_role_data_user.role_data_id " +
+//            "LEFT JOIN frame_user ON frame_user.id=frame_role_data_user.user_id " +
+//            "WHERE frame_role_data.role_key=#{roleKey} AND frame_role_data.role_type=#{roleType} " +
+//            "AND frame_user.group_id=#{groupId} AND frame_user.status = '1'")
+    //下面是取消过滤group_id的数据
+@Select("SELECT frame_user.* FROM frame_role_data_user " +
+        "LEFT JOIN frame_role_data ON frame_role_data.id=frame_role_data_user.role_data_id " +
+        "LEFT JOIN frame_user ON frame_user.id=frame_role_data_user.user_id " +
+        "WHERE frame_role_data.role_key=#{roleKey} AND frame_role_data.role_type=#{roleType} " +
+        "AND frame_user.status = '1'")
     List<FrameUser> findFrameUsersByRoleKeyAndGroup(@Param("roleKey")String roleKey, @Param("roleType")String roleType,
                                             @Param("groupId")String groupId);