Browse Source

订单最大公出值开发

anderx 1 year ago
parent
commit
879ced3b2b

+ 12 - 0
src/main/java/com/goafanti/common/controller/PublicController.java

@@ -966,5 +966,17 @@ public class PublicController extends CertifyApiController {
 		return res;
 	}
 
+	/**
+	 * 处理订单最大公出小时
+	 */
+	@RequestMapping(value = "/pushOrderMaxDuration",method = RequestMethod.GET)
+	@ResponseBody
+	public Result pushOrderMaxDuration(){
+		Result res =new Result();
+		orderNewService.pushOrderMaxDuration();
+		res.data("ok");
+		return res;
+	}
+
 
 }

+ 26 - 2
src/main/java/com/goafanti/common/model/TOrderPublicReleaseCount.java

@@ -8,10 +8,10 @@ import java.util.Date;
  * 订单公出信息表(TOrderPublicReleaseCount)实体类
  *
  * @author makejava
- * @since 2024-07-05 09:21:46
+ * @since 2024-09-20 14:43:41
  */
 public class TOrderPublicReleaseCount implements Serializable {
-    private static final long serialVersionUID = 515848789423733193L;
+    private static final long serialVersionUID = 722323303069013820L;
 
     private Integer id;
     /**
@@ -34,6 +34,14 @@ public class TOrderPublicReleaseCount implements Serializable {
      * 发起时间
      */
     private Date createTime;
+    /**
+     * 最大公出小时
+     */
+    private Double maxDuration;
+    /**
+     * 最大公出审核 0=未发起,1=技术总监审核中,2=财务总监审核中,3=驳回,4=完成
+     */
+    private Integer maxProcess;
 
 
     public Integer getId() {
@@ -84,5 +92,21 @@ public class TOrderPublicReleaseCount implements Serializable {
         this.createTime = createTime;
     }
 
+    public Double getMaxDuration() {
+        return maxDuration;
+    }
+
+    public void setMaxDuration(Double maxDuration) {
+        this.maxDuration = maxDuration;
+    }
+
+    public Integer getMaxProcess() {
+        return maxProcess;
+    }
+
+    public void setMaxProcess(Integer maxProcess) {
+        this.maxProcess = maxProcess;
+    }
+
 }
 

+ 1 - 8
src/main/java/com/goafanti/expenseAccount/bo/TOrderPublicReleaseCountBo.java

@@ -6,17 +6,10 @@ import java.math.BigDecimal;
 
 public class TOrderPublicReleaseCountBo extends TOrderPublicReleaseCount {
 
-    private BigDecimal maxDuration;
 
-    private BigDecimal exceedDuration;
 
-    public BigDecimal getMaxDuration() {
-        return maxDuration;
-    }
+    private BigDecimal exceedDuration;
 
-    public void setMaxDuration(BigDecimal maxDuration) {
-        this.maxDuration = maxDuration;
-    }
 
     public BigDecimal getExceedDuration() {
         return exceedDuration;

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

@@ -1512,7 +1512,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                              BigDecimal zxsCount, BigDecimal qtCount,OrderYearMaxDuration useOyd) {
         TOrderPublicReleaseCountBo bo = new TOrderPublicReleaseCountBo();
         if (out==null||useOyd==null)return String.format("订单%s统计信息不存在,请要营销员先将订单派单。",e.getOrderNo());
-        bo.setMaxDuration(useOyd.getMaxDuration());
+        bo.setMaxDuration(out.getMaxDuration());
         bo.setExceedDuration(useOyd.getMaxDuration().subtract(BigDecimal.valueOf(out.getActualDuration())).abs());
         bo.setActualDuration(out.getActualDuration());
         bo.setFrequency(out.getFrequency());
@@ -1538,7 +1538,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             expenseString.deleteCharAt(expenseString.length() - 1);
             expenseString.append(")");
         }
-        if (bo.getMaxDuration().compareTo(BigDecimal.valueOf(bo.getActualDuration()))>0){
+        if (BigDecimal.valueOf(bo.getMaxDuration()).compareTo(BigDecimal.valueOf(bo.getActualDuration()))>0){
             actualString="";
         }
         return e.getBuyerName() + e.getContractNo() +

+ 2 - 0
src/main/java/com/goafanti/order/service/OrderNewService.java

@@ -241,4 +241,6 @@ public interface OrderNewService {
 	void pushOrderDunContent(TOrderNew e);
 
 	String pushOrderGetDunContent(TOrderNew e);
+
+	void pushOrderMaxDuration();
 }

+ 22 - 4
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -733,11 +733,21 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		out.setPeopleCount(peopleList.size());
 		out.setFrequency(count);
 		TOrderPublicReleaseCount tOrderPublicReleaseCount = tOrderPublicReleaseCountMapper.selectByOrderNo(orderNew.getOrderNo());
+		//获取最大值
+		BigDecimal maxDuration = pushOrderMaxDuration(orderNew);
+		out.setMaxDuration(maxDuration.doubleValue());
+		out.setMaxProcess(4);
 		if (tOrderPublicReleaseCount!=null){
 			tOrderPublicReleaseCountMapper.updateByOrderNo(out);
 		}else {
 			tOrderPublicReleaseCountMapper.insert(out);
 		}
+
+
+	}
+
+	private BigDecimal pushOrderMaxDuration(TOrderNew orderNew) {
+		BigDecimal maxDuration = BigDecimal.ZERO;
 		//获取会员信息
 		List<TTaskMember> tTaskMembers = tTaskMemberMapper.selectByOrderNo(orderNew.getOrderNo());
 		int yearSum=0;
@@ -745,7 +755,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		if (tTaskMembers.isEmpty()){
 			OrderYearMaxDuration orderYearMaxDuration = new OrderYearMaxDuration();
 			orderYearMaxDuration.setYear(0);
-			BigDecimal maxDuration = pushMaxDuration(orderNew.getTotalAmount());
+			maxDuration = pushMaxDuration(orderNew.getTotalAmount());
 			//需修改成判定
 			if (maxDuration.compareTo(new BigDecimal(-1))==0){
 				orderYearMaxDuration.setMaxDuration(BigDecimal.ZERO);
@@ -769,7 +779,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				collect = strings.stream().map(this::extractYear).collect(Collectors.toList());
 				int size = collect.size();
 				BigDecimal divide = orderNew.getTotalAmount().divide(new BigDecimal(size), RoundingMode.HALF_EVEN);
-				BigDecimal maxDuration = pushMaxDuration(divide);
+				maxDuration = pushMaxDuration(divide);
 				List<OrderYearMaxDuration> maxLists = new ArrayList<>();
 				int i = 1;
 				for (Integer year : collect) {
@@ -796,7 +806,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				OrderYearMaxDuration orderYearMaxDuration = new OrderYearMaxDuration();
 				orderYearMaxDuration.setYear(0);
 				orderYearMaxDuration.setOrderNo(orderNew.getOrderNo());
-				BigDecimal maxDuration = pushMaxDuration(orderNew.getTotalAmount());
+				maxDuration = pushMaxDuration(orderNew.getTotalAmount());
 				if (maxDuration.compareTo(new BigDecimal(-1))==0){
 					orderYearMaxDuration.setMaxDuration(BigDecimal.ZERO);
 					orderYearMaxDuration.setStatus(1);
@@ -816,7 +826,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				}
 			}
 		}
-
+		return maxDuration;
 	}
 
 	private  Integer extractYear(String yearStr) {
@@ -2564,4 +2574,12 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		return valueByCode.toString();
 	}
 
+	@Override
+	public void pushOrderMaxDuration() {
+		List<TOrderNew> tOrderNews = tOrderNewMapper.selectgetAll();
+		for (TOrderNew e : tOrderNews) {
+			pushOrderPublicReleaseCount(e);
+		}
+	}
+
 }

+ 5 - 5
src/main/resources/props/config_local.properties

@@ -5,12 +5,12 @@ jdbc.driverClassName=com.mysql.jdbc.Driver
 static.host=//172.16.1.187/1.3.25
 
 #jdbc.url=jdbc\:mysql://localhost:3306/aft20240430?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-#jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-#jdbc.username=root
-#jdbc.password=123456
-jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 jdbc.username=root
-jdbc.password=aftdev
+jdbc.password=123456
+#jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+#jdbc.username=root
+#jdbc.password=aftdev
 jdbc.validationQuery=SELECT 'x'
 jdbc.initialSize=3
 jdbc.maxActive=20