From 6f9623981926d78ce8ccd80bce55ad631bd2c76b Mon Sep 17 00:00:00 2001
From: kongdeqiang <123456>
Date: 星期四, 27 三月 2025 17:16:13 +0800
Subject: [PATCH] fix: 计划合并提交

---
 platformx-device-biz/src/main/java/com/by4cloud/platformx/device/service/DeviceDemandSubService.java          |    4 
 platformx-device-biz/src/main/java/com/by4cloud/platformx/device/controller/DeviceDemandPlanController.java   |  112 +++++++++++++++
 platformx-device-api/src/main/java/com/by4cloud/platformx/device/entity/DeviceDemandPlan.java                 |   10 +
 platformx-device-biz/src/main/java/com/by4cloud/platformx/device/service/impl/DeviceDemandSubServiceImpl.java |   25 +++
 platformx-device-biz/src/main/java/com/by4cloud/platformx/device/util/NumUtils.java                           |  259 +++++++++++++++++++++++++++++++++++++
 platformx-device-biz/src/main/java/com/by4cloud/platformx/device/controller/DeviceDemandTotalController.java  |    1 
 6 files changed, 405 insertions(+), 6 deletions(-)

diff --git a/platformx-device-api/src/main/java/com/by4cloud/platformx/device/entity/DeviceDemandPlan.java b/platformx-device-api/src/main/java/com/by4cloud/platformx/device/entity/DeviceDemandPlan.java
index 55c75fd..fc026bc 100644
--- a/platformx-device-api/src/main/java/com/by4cloud/platformx/device/entity/DeviceDemandPlan.java
+++ b/platformx-device-api/src/main/java/com/by4cloud/platformx/device/entity/DeviceDemandPlan.java
@@ -22,6 +22,10 @@
 @Entity
 @Table(appliesTo = "device_demand_plan", comment = "璁惧闇�姹傝鍒掍富琛�")
 public class DeviceDemandPlan extends BaseModel<DeviceDemandPlan> {
+
+	@Schema(description = "鍚堝苟璁″垝id")
+	@Column(columnDefinition="long comment '鍚堝苟璁″垝id'")
+	private Long planId;
 	@Schema(description = "缂栫爜")
 	@Column(columnDefinition="VARCHAR(64) comment '缂栫爜'")
 	private String number;
@@ -31,12 +35,16 @@
 	@Schema(description = "鑱旂郴浜�")
 	@Column(columnDefinition="VARCHAR(64) comment '鑱旂郴浜�'")
 	private String contacts;
-	@Schema(description = "鐢虫姤鐘舵�� 0鐢宠涓紝1浜岀骇鍗曚綅瀹℃牳鎷掔粷  2浜岀骇鍗曚綅瀹℃牳閫氳繃 3闆嗗洟瀹℃牳鎷掔粷 4闆嗗洟瀹℃牳閫氳繃")
+	@Schema(description = "鐢虫姤鐘舵�� 0鐢宠涓紝1浜岀骇鍗曚綅瀹℃牳鎷掔粷  2浜岀骇鍗曚綅瀹℃牳閫氳繃 3寰呴泦鍥㈡壒鍑� 4闆嗗洟瀹℃牳鎷掔粷 5闆嗗洟瀹℃牳閫氳繃")
 	@Column(columnDefinition="int comment '鐢虫姤鐘舵��'")
 	private Integer status;
 	@Schema(description = "鐢虫姤绫诲瀷")
 	@Column(columnDefinition="int comment '鐢虫姤绫诲瀷'")
 	private Integer type;
+
+	@Schema(description = "鎻愪氦绫诲瀷")
+	@Column(columnDefinition="int comment '鎻愪氦绫诲瀷 0鐭挎彁浜� 1瀛愬崟浣嶆彁浜�'")
+	private Integer type2;
 	@Schema(description = "鐢虫姤鍏徃id")
 	@Column(columnDefinition="long comment '鐢虫姤鍏徃id'")
 	private Long declareCompId;
diff --git a/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/controller/DeviceDemandPlanController.java b/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/controller/DeviceDemandPlanController.java
index 03ff167..f67a136 100644
--- a/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/controller/DeviceDemandPlanController.java
+++ b/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/controller/DeviceDemandPlanController.java
@@ -3,14 +3,19 @@
 import cn.hutool.core.util.ArrayUtil;
 import cn.hutool.core.collection.CollUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.by4cloud.platformx.common.core.util.R;
 import com.by4cloud.platformx.common.log.annotation.SysLog;
+import com.by4cloud.platformx.common.security.util.SecurityUtils;
 import com.by4cloud.platformx.device.constant.MaxSizeContant;
+import com.by4cloud.platformx.device.entity.Device;
 import com.by4cloud.platformx.device.entity.DeviceDemandPlan;
-import com.by4cloud.platformx.device.service.DeviceDemandPlanService;
-import com.by4cloud.platformx.device.service.JcMaxSizeService;
+import com.by4cloud.platformx.device.entity.DeviceDemandSub;
+import com.by4cloud.platformx.device.service.*;
+import com.by4cloud.platformx.device.util.NumUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import com.by4cloud.platformx.common.excel.annotation.ResponseExcel;
 import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -21,8 +26,8 @@
 import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 璁惧闇�姹傝鍒掍富琛�
@@ -38,7 +43,10 @@
 public class DeviceDemandPlanController {
 
     private final  DeviceDemandPlanService deviceDemandPlanService;
+    private final DeviceDemandTotalService deviceDemandTotalService;
+    private final DeviceDemandSubService deviceDemandSubService;
     private final JcMaxSizeService maxSizeService;
+    private final DeviceService deviceService;
 
     /**
      * 鍒嗛〉鏌ヨ
@@ -55,6 +63,23 @@
 		wrapper.eq(deviceDemandPlan.getYear() !=null,DeviceDemandPlan::getYear,deviceDemandPlan.getYear());
         return R.ok(deviceDemandPlanService.pageByScope(page, wrapper));
     }
+
+	/**
+	 * 鍒嗛〉鏌ヨ2
+	 * @param page 鍒嗛〉瀵硅薄
+	 * @param deviceDemandPlan 璁惧闇�姹傝鍒掍富琛�
+	 * @return
+	 */
+	@Operation(summary = "鏈崟浣嶅垎椤垫煡璇�" , description = "鏈崟浣嶅垎椤垫煡璇�" )
+	@GetMapping("/page2" )
+	public R page2(@ParameterObject Page page, @ParameterObject DeviceDemandPlan deviceDemandPlan) {
+		LambdaQueryWrapper<DeviceDemandPlan> wrapper = Wrappers.lambdaQuery();
+		wrapper.eq(deviceDemandPlan.getDeclareCompId() !=null,DeviceDemandPlan::getDeclareCompId,deviceDemandPlan.getDeclareCompId());
+		wrapper.eq(deviceDemandPlan.getReleasePerson() !=null,DeviceDemandPlan::getReleasePerson,deviceDemandPlan.getReleasePerson());
+		wrapper.eq(deviceDemandPlan.getYear() !=null,DeviceDemandPlan::getYear,deviceDemandPlan.getYear());
+		wrapper.eq(DeviceDemandPlan::getType2,1);
+		return R.ok(deviceDemandPlanService.page(page, wrapper));
+	}
 
 
     /**
@@ -80,9 +105,88 @@
     @PreAuthorize("@pms.hasPermission('platformx_deviceDemandPlan_add')" )
     public R save(@RequestBody DeviceDemandPlan deviceDemandPlan) {
 		deviceDemandPlan.setNumber(maxSizeService.nextNo(MaxSizeContant.PLAN_NUM));
+		deviceDemandPlan.setType2(0);
         return R.ok(deviceDemandPlanService.save(deviceDemandPlan));
     }
 
+	@Operation(summary = "鍚堝苟璁″垝鎻愪氦" , description = "鍚堝苟璁″垝鎻愪氦" )
+	@GetMapping("/mergePlan" )
+	public R mergePlan(String ids) {
+		List<DeviceDemandSub> subs = new ArrayList<>();
+		DeviceDemandPlan plan = new DeviceDemandPlan();
+		deviceDemandPlanService.save(plan);
+		Double aa = 0d;
+		String name = SecurityUtils.getUser().getName();
+		if(StringUtils.isNotBlank(ids)){
+			String[] split = ids.split(",");
+			for (String s : split) {
+				long l = Long.parseLong(s);
+				DeviceDemandPlan byId = deviceDemandPlanService.getById(l);
+				byId.setPlanId(plan.getId());
+				byId.setSendDate(new Date());
+				deviceDemandPlanService.updateById(byId);
+				plan.setYear(byId.getYear());
+				plan.setType(byId.getType());
+				aa= NumUtils.addDoubles(aa,byId.getAmount());
+				//鍚堝苟瀛愰」
+				List<DeviceDemandSub> byPlanId = deviceDemandSubService.getByPlanId(l);
+				subs.addAll(byPlanId);
+			}
+		}
+		plan.setAmount(aa);
+		plan.setReleasePerson(name);
+		plan.setStatus(3);
+		plan.setType2(1);
+		if(subs.size()>0){
+			deviceDemandPlanService.updateById(plan);
+			return R.ok("鎻愪氦鎴愬姛");
+		}else {
+			return R.failed("璇烽�夋嫨璁″垝鎻愪氦");
+		}
+	}
+
+	@Operation(summary = "鏌ョ湅瀛愰」璇︽儏" , description = "鏌ョ湅瀛愰」璇︽儏" )
+	@GetMapping("/getByMergePlanId/{id}" )
+	public R getByMergePlanId(@PathVariable("id" ) Long id) {
+		List<DeviceDemandSub> subs = new ArrayList<>();
+		QueryWrapper<DeviceDemandPlan> wrapper = new QueryWrapper<>();
+		wrapper.lambda()
+				.eq(DeviceDemandPlan::getPlanId,id);
+		List<DeviceDemandPlan> list = deviceDemandPlanService.list(wrapper);
+		List<Long> collect = list.stream().map(DeviceDemandPlan::getId).collect(Collectors.toList());
+		for (Long l : collect) {
+			//鍚堝苟瀛愰」
+			List<DeviceDemandSub> byPlanId = deviceDemandSubService.getByPlanId(l);
+			subs.addAll(byPlanId);
+		}
+		List<Map<String,Object>> resultList = new ArrayList<>();
+		for (Map.Entry<Integer, List<DeviceDemandSub>> integerListEntry : subs.stream().collect(Collectors.groupingBy(item -> item.getMonth())).entrySet()) {
+			Integer month = integerListEntry.getKey();
+			List<Map<String,Object>> mapList = new ArrayList<>();
+			for (Map.Entry<Long, List<DeviceDemandSub>> entry : integerListEntry.getValue().stream().collect(Collectors.groupingBy(item -> item.getDeviceId())).entrySet()) {
+				Long key = entry.getKey();
+				int size = entry.getValue().size();
+				Device device = deviceService.getById(key);
+				Map<String,Object> map = new HashMap<>();
+				map.put("deviceNumber",device.getNumber());
+				map.put("name",device.getName());
+				map.put("count",size);
+				map.put("manu",device.getManu());
+				map.put("beforeDate",device.getBeforeDate());
+				map.put("depreciation",device.getDepreciation());
+				map.put("remindDate",device.getRemindDate());
+				mapList.add(map);
+			}
+			Map<String,Object> map = new HashMap<>();
+			map.put("month",month);
+			map.put("deviceList",mapList);
+			resultList.add(map);
+
+		}
+		return R.ok(resultList);
+
+	}
+
     /**
      * 淇敼璁惧闇�姹傝鍒掍富琛�
      * @param deviceDemandPlan 璁惧闇�姹傝鍒掍富琛�
diff --git a/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/controller/DeviceDemandTotalController.java b/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/controller/DeviceDemandTotalController.java
index a5d572c..5379c42 100644
--- a/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/controller/DeviceDemandTotalController.java
+++ b/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/controller/DeviceDemandTotalController.java
@@ -64,7 +64,6 @@
      */
     @Operation(summary = "閫氳繃id鏌ヨ" , description = "閫氳繃id鏌ヨ" )
     @GetMapping("/{id}" )
-    @PreAuthorize("@pms.hasPermission('platformx_deviceDemandTotal_view')" )
     public R getById(@PathVariable("id" ) Long id) {
 		DeviceDemandTotal demandTotal = deviceDemandTotalService.getById(id);
 		QueryWrapper<DeviceDemandSub> wrapper = new QueryWrapper<>();
diff --git a/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/service/DeviceDemandSubService.java b/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/service/DeviceDemandSubService.java
index 3b55a73..be7e935 100644
--- a/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/service/DeviceDemandSubService.java
+++ b/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/service/DeviceDemandSubService.java
@@ -3,6 +3,10 @@
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.by4cloud.platformx.device.entity.DeviceDemandSub;
 
+import java.util.List;
+
 public interface DeviceDemandSubService extends IService<DeviceDemandSub> {
 
+	List<DeviceDemandSub> getByPlanId(Long planId);
+
 }
diff --git a/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/service/impl/DeviceDemandSubServiceImpl.java b/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/service/impl/DeviceDemandSubServiceImpl.java
index 8fc2f94..9171963 100644
--- a/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/service/impl/DeviceDemandSubServiceImpl.java
+++ b/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/service/impl/DeviceDemandSubServiceImpl.java
@@ -1,10 +1,18 @@
 package com.by4cloud.platformx.device.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.by4cloud.platformx.device.entity.DeviceDemandSub;
+import com.by4cloud.platformx.device.entity.DeviceDemandTotal;
 import com.by4cloud.platformx.device.mapper.DeviceDemandSubMapper;
+import com.by4cloud.platformx.device.mapper.DeviceDemandTotalMapper;
 import com.by4cloud.platformx.device.service.DeviceDemandSubService;
+import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
  * 璁惧闇�姹傝鍒掕澶囧瓙琛�
  *
@@ -12,5 +20,22 @@
  * @date 2025-03-05 15:40:29
  */
 @Service
+@AllArgsConstructor
 public class DeviceDemandSubServiceImpl extends ServiceImpl<DeviceDemandSubMapper, DeviceDemandSub> implements DeviceDemandSubService {
+	private DeviceDemandTotalMapper totalMapper;
+
+	@Override
+	public List<DeviceDemandSub> getByPlanId(Long planId) {
+		QueryWrapper<DeviceDemandTotal> wrapper = new QueryWrapper<>();
+		wrapper.lambda()
+				.eq(DeviceDemandTotal::getPlanId,planId);
+		List<DeviceDemandTotal> deviceDemandTotals = totalMapper.selectList(wrapper);
+		List<Long> collect = deviceDemandTotals.stream().map(DeviceDemandTotal::getId).collect(Collectors.toList());
+
+		QueryWrapper<DeviceDemandSub> subwrapper = new QueryWrapper<>();
+		subwrapper.lambda()
+				.in(DeviceDemandSub::getTotalId,collect);
+		List<DeviceDemandSub> subs = list(subwrapper);
+		return subs;
+	}
 }
diff --git a/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/util/NumUtils.java b/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/util/NumUtils.java
new file mode 100644
index 0000000..88b38fa
--- /dev/null
+++ b/platformx-device-biz/src/main/java/com/by4cloud/platformx/device/util/NumUtils.java
@@ -0,0 +1,259 @@
+package com.by4cloud.platformx.device.util;
+
+import java.math.BigDecimal;
+
+/**
+ * @author xfei
+ * @date 2022/5/27涓嬪崍8:26
+ */
+public class NumUtils {
+	/**
+	 * 绮剧‘灏忔暟
+	 * @param f 灏忔暟
+	 * @param length 绮剧‘浣嶆暟
+	 * @return
+	 */
+	public static Float accurateFloat(Float f,int length){
+		BigDecimal b = new BigDecimal(f.toString());
+		f = b.setScale(length,BigDecimal.ROUND_HALF_UP).floatValue();
+		return f;
+	}
+	public static Float accurateFloat(Float f){
+		return accurateFloat(f,3);
+	}
+
+	public static Double accurateFloat(Double f,int length){
+		BigDecimal b = new BigDecimal(f.toString());
+		f = b.setScale(length,BigDecimal.ROUND_HALF_UP).doubleValue();
+		return f;
+	}
+	public static Double accurateFloat(Double f){
+		return accurateFloat(f,3);
+	}
+
+
+	public static Double accurateDouble(Double f,int length){
+		if(f==null){
+			f=0d;
+		}
+		BigDecimal b2 = new BigDecimal(f.toString());
+		f = b2.setScale(length,BigDecimal.ROUND_HALF_UP).doubleValue();
+		return f;
+	}
+	public static Double accurateDouble(Double f){
+		return accurateDouble(f,3);
+	}
+
+	/**
+	 * 鍔�
+	 * @param a
+	 * @param b
+	 * @return
+	 */
+	public static Double addDouble(Double a,Double b){
+		if (a==null)a=0d;
+		if (b==null)b=0d;
+		BigDecimal aa = new BigDecimal(a+"");
+		BigDecimal bb = new BigDecimal(b+"");
+		aa = aa.add(bb);
+		aa = aa.setScale(2,BigDecimal.ROUND_HALF_UP);
+		return aa.doubleValue();
+	}
+	public static Double addDoubles(Double ... a){
+		Double result = 0d;
+		for (Double d :a){
+			result =addDouble(result,d);
+		}
+		return result;
+	}
+
+	public static Double addDoubles(int len,Double ... a){
+		Double result = 0d;
+		for (Double d :a){
+			result =addDouble(result,d,len);
+		}
+		return result;
+	}
+
+	/**
+	 * 鍑�
+	 * @param a
+	 * @param b
+	 * @return
+	 */
+	public static Double subtractDouble(Double a,Double b){
+		if (a==null)a=0d;
+		if (b==null)b=0d;
+		BigDecimal aa = new BigDecimal(a+"");
+		BigDecimal bb = new BigDecimal(b+"");
+		aa = aa.subtract(bb);
+		aa = aa.setScale(2,BigDecimal.ROUND_HALF_UP);
+		return aa.doubleValue();
+	}
+
+	/**
+	 * 鍑� 鍙垗涓嶅叆
+	 * @param a
+	 * @param b
+	 * @return
+	 */
+	public static Double subtractDoubleDown(Double a,Double b){
+		if (a==null)a=0d;
+		if (b==null)b=0d;
+		BigDecimal aa = new BigDecimal(a+"");
+		BigDecimal bb = new BigDecimal(b+"");
+		aa = aa.subtract(bb);
+		aa = aa.setScale(2,BigDecimal.ROUND_DOWN);
+		return aa.doubleValue();
+	}
+
+	/**
+	 * 涔�
+	 * @param a
+	 * @param b
+	 * @return
+	 */
+	public static Double multiplyDouble(Double a,Double b){
+		if (a==null)a=0d;
+		if (b==null)b=0d;
+		BigDecimal aa = new BigDecimal(a+"");
+		BigDecimal bb = new BigDecimal(b+"");
+		aa = aa.multiply(bb);
+		aa = aa.setScale(2,BigDecimal.ROUND_HALF_UP);
+		return aa.doubleValue();
+	}
+	/**
+	 * 涔� 鍙垗涓嶅叆
+	 * @param a
+	 * @param b
+	 * @return
+	 */
+	public static Double multiplyDoubleDown(Double a,Double b){
+		if (a==null)a=0d;
+		if (b==null)b=0d;
+		BigDecimal aa = new BigDecimal(a+"");
+		BigDecimal bb = new BigDecimal(b+"");
+		aa = aa.multiply(bb);
+		aa = aa.setScale(2,BigDecimal.ROUND_DOWN);
+		return aa.doubleValue();
+	}
+	/**
+	 * 闄�
+	 * 闄ゆ硶
+	 * @param a
+	 * @param b
+	 * @return
+	 */
+	public static Double divideDouble(Double a,Double b){
+		if (a==null)a=0d;
+		if (b==null)b=0d;
+		BigDecimal aa = new BigDecimal(a+"");
+		BigDecimal bb = new BigDecimal(b+"");
+		aa = aa.divide(bb);
+		aa = aa.setScale(2,BigDecimal.ROUND_HALF_UP);
+		return aa.doubleValue();
+	}
+
+	public static Double divideDoubleUp(Double a,Double b){
+		if (a==null)a=0d;
+		if (b==null)b=0d;
+		BigDecimal aa = new BigDecimal(a+"");
+		BigDecimal bb = new BigDecimal(b+"");
+		aa = aa.divide(bb,BigDecimal.ROUND_HALF_UP);
+		aa = aa.setScale(2,BigDecimal.ROUND_HALF_UP);
+		return aa.doubleValue();
+	}
+
+	/**
+	 * 闄�
+	 * 闄ゆ硶
+	 * @param a
+	 * @param b
+	 * @return
+	 */
+	public static Double divideDoubleDown(Double a,Double b){
+		if (a==null)a=0d;
+		if (b==null)b=0d;
+		BigDecimal aa = new BigDecimal(a+"");
+		BigDecimal bb = new BigDecimal(b+"");
+		aa = aa.divide(bb);
+		aa = aa.setScale(2,BigDecimal.ROUND_DOWN);
+		return aa.doubleValue();
+	}
+	/**
+	 * 鍔�
+	 * @param a
+	 * @param b
+	 * @return
+	 */
+	public static Double addDouble(Double a,Double b,int len){
+		if (a==null)a=0d;
+		if (b==null)b=0d;
+		BigDecimal aa = new BigDecimal(a+"");
+		BigDecimal bb = new BigDecimal(b+"");
+		aa = aa.add(bb);
+		aa = aa.setScale(len,BigDecimal.ROUND_HALF_UP);
+		return aa.doubleValue();
+	}
+
+	/**
+	 * 鍑�
+	 * @param a
+	 * @param b
+	 * @return
+	 */
+	public static Double subtractDouble(Double a,Double b,int len){
+		if (a==null)a=0d;
+		if (b==null)b=0d;
+		BigDecimal aa = new BigDecimal(a+"");
+		BigDecimal bb = new BigDecimal(b+"");
+		aa = aa.subtract(bb);
+		aa = aa.setScale(len,BigDecimal.ROUND_HALF_UP);
+		return aa.doubleValue();
+	}
+
+	/**
+	 * 涔�
+	 * @param a
+	 * @param b
+	 * @return
+	 */
+	public static Double multiplyDouble(Double a,Double b,int len){
+		if (a==null)a=0d;
+		if (b==null)b=0d;
+		BigDecimal aa = new BigDecimal(a+"");
+		BigDecimal bb = new BigDecimal(b+"");
+		aa = aa.multiply(bb);
+		aa = aa.setScale(len,BigDecimal.ROUND_HALF_UP);
+		return aa.doubleValue();
+	}
+	/**
+	 * 闄�
+	 * @param a
+	 * @param b
+	 * @return
+	 */
+	public static Double divideDouble(Double a,Double b,int len){
+		if (a==null)a=0d;
+		if (b==null)b=0d;
+		BigDecimal aa = new BigDecimal(a+"");
+		BigDecimal bb = new BigDecimal(b+"");
+		aa = aa.divide(bb,len, BigDecimal.ROUND_HALF_UP);
+		return aa.doubleValue();
+	}
+
+
+
+	public static Double floatToD(Float f){
+		if (f==null){
+			return new Double(0);
+		}
+		return new Double(f);
+	}
+
+	public static void main(String[] args) {
+//		System.out.println(NumUtils.accurateDouble(60.1575,3));
+		System.out.println(NumUtils.addDoubles(6.1234d,6.1234d,4.33d));
+	}
+
+}

--
Gitblit v1.9.1