Просмотр исходного кода

Merge branch 'test2' of jishutao/kede-server into prod

anderx 1 год назад
Родитель
Сommit
594d7ef9a1

+ 13 - 10
src/main/java/com/goafanti/business/service/impl/RestrictProjectServiceImpl.java

@@ -72,16 +72,19 @@ public class RestrictProjectServiceImpl extends BaseMybatisDao<RestrictProjectMa
             in.setId(use.getId());
             restrictProjectMapper.updateByPrimaryKeySelective(in);
         }
-        UserBusiness ub=new UserBusiness();
-        ub.setId(UUID.randomUUID().toString());
-        ub.setAid(aid);
-        ub.setUid(in.getUid());
-        ub.setBusinessProjectId(in.getPid());
-        ub.setCustomerStatus(in.getCustomerStatus());
-        ub.setFollowSituation(in.getFollowSituation());
-        ub.setCreateTime(new Date());
-        ub.setRemarks("领取限定项目触发");
-        userBusinessMapper.insertSelective(ub);
+        int i = userBusinessMapper.judgeBusiness(in.getUid(), in.getPid(), TokenManager.getAdminId());
+        if (i==0){
+            UserBusiness ub=new UserBusiness();
+            ub.setId(UUID.randomUUID().toString());
+            ub.setAid(aid);
+            ub.setUid(in.getUid());
+            ub.setBusinessProjectId(in.getPid());
+            ub.setCustomerStatus(in.getCustomerStatus());
+            ub.setFollowSituation(in.getFollowSituation());
+            ub.setCreateTime(new Date());
+            ub.setRemarks("领取限定项目触发");
+            userBusinessMapper.insertSelective(ub);
+        }
         addUserLog(in,0);
         User user = userMapper.queryById(in.getUid());
         BusinessProject businessProject = businessProjectMapper.queryById(in.getPid());

+ 47 - 15
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -1479,11 +1479,30 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                         }
                     }
                 }
+                List<OrderYearMaxDuration> yearMaxDurationList = orderYearMaxDurationMapper.selectByOrderNo(e.getOrderNo());
+                OrderYearMaxDuration useOyd = null;
+                for (int i = 0; i < yearMaxDurationList.size(); i++) {
+                    OrderYearMaxDuration oyd = yearMaxDurationList.get(i);
+                    //年份为0不是会员直接获取跳出循环,否则获取当前年份,获取不到获取最后一年
+                    if (oyd.getYear()==0){
+                        useOyd=oyd;
+                        break;
+                    }else {
+                        if (oyd.getYear().equals(year)){
+                            useOyd = oyd;
+                            break;
+                        }
+                        if(i==yearMaxDurationList.size()-1&&useOyd==null){
+                            useOyd = yearMaxDurationList.get(i);
+                        }
+                    }
+
+                }
 
                 //获取未归集的订单
                 List<BigDecimal> orderNoNotCountAmount = expenseAccountMapper.getOrderNoNotCountAmount(e.getOrderNo());
                 BigDecimal countAmount = orderNoNotCountAmount.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
-                String str = getString(e, out, count, yxyCount, zxsCount,qtCount);
+                String str = getString(e, out, count, yxyCount, zxsCount,qtCount,useOyd);
                 str=str+",未归集:"+countAmount.stripTrailingZeros().toPlainString()+"元";
                 orderList.add(str);
             }else if (e.getPrid() !=null){
@@ -1508,25 +1527,38 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     }
 
     private String getString(SonExpenseAccount e, TOrderPublicReleaseCount out, BigDecimal count, BigDecimal yxyCount,
-                             BigDecimal zxsCount, BigDecimal qtCount) {
+                             BigDecimal zxsCount, BigDecimal qtCount, OrderYearMaxDuration useOyd) {
         TOrderPublicReleaseCountBo bo = new TOrderPublicReleaseCountBo();
-        if (out==null)return String.format("订单%s统计信息不存在,请要营销员先将订单派单。",e.getOrderNo());
-        bo.setMaxDuration(out.getMaxDuration());
-        BigDecimal maxDuration = BigDecimal.valueOf(out.getMaxDuration());
-        bo.setExceedDuration(maxDuration.subtract(BigDecimal.valueOf(out.getActualDuration())).abs());
+//        if (out==null)return String.format("订单%s统计信息不存在,请要营销员先将订单派单。",e.getOrderNo());
+//        bo.setMaxDuration(out.getMaxDuration());
+//        BigDecimal maxDuration = BigDecimal.valueOf(out.getMaxDuration());
+//        bo.setExceedDuration(maxDuration.subtract(BigDecimal.valueOf(out.getActualDuration())).abs());
+//        bo.setActualDuration(out.getActualDuration());
+//        bo.setFrequency(out.getFrequency());
+//        bo.setPeopleCount(out.getPeopleCount());
+//        String maxString="";
+//        String actualString=",超过" + bo.getExceedDuration() + "小时,";
+//        if (out.getMaxType()==0){
+//            maxString=":原则上不能公出";
+//            maxString=":原则上不能公出";
+//        }else if (out.getMaxType()==1){
+//            maxString=":应公出" + bo.getMaxDuration() +"小时";
+//        }else if (out.getMaxType()==2){
+//            maxString=":无限制公出,预估" + bo.getMaxDuration() +"小时";
+//        }
+//        if (bo.getExceedDuration().compareTo(BigDecimal.ZERO) <1){
+//            actualString="";
+//        }
+        if (out==null||useOyd==null)return String.format("订单%s统计信息不存在,请要营销员先将订单派单。",e.getOrderNo());
+        bo.setMaxDuration(useOyd.getMaxDuration().doubleValue());
+        bo.setExceedDuration(useOyd.getMaxDuration().subtract(BigDecimal.valueOf(out.getActualDuration())).abs());
         bo.setActualDuration(out.getActualDuration());
         bo.setFrequency(out.getFrequency());
         bo.setPeopleCount(out.getPeopleCount());
-        String maxString="";
+        String maxString=":应公出" + bo.getMaxDuration() +"小时["+useOyd.getYear()+"年]";
         String actualString=",超过" + bo.getExceedDuration() + "小时,";
-        if (out.getMaxType()==0){
-            maxString=":原则上不能公出";
-        }else if (out.getMaxType()==1){
-            maxString=":应公出" + bo.getMaxDuration() +"小时";
-        }else if (out.getMaxType()==2){
-            maxString=":无限制公出,预估" + bo.getMaxDuration() +"小时";
-        }
-        if (bo.getExceedDuration().compareTo(BigDecimal.ZERO) <1){
+        if (useOyd.getStatus()==1){
+            maxString=":不限制公出小时["+useOyd.getYear()+"年]";
             actualString="";
         }
         StringBuilder expenseString=new StringBuilder().append("报销").append(count.stripTrailingZeros().toPlainString()).append("元");