Browse Source

修改审批相关的问题

lwx_dev
erdanergou 3 years ago
parent
commit
e9271147e5
  1. 2
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  2. 66
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  3. 7
      src/main/java/com/dreamchaser/depository_manage/utils/ObjectFormatUtil.java
  4. 2
      src/test/java/com/dreamchaser/depository_manage/OtherTest.java

2
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -1971,7 +1971,7 @@ public class PageController {
String unit = applicationOutRecordMin.getUnit();
if ("-1".equals(unit)) {
if (inventoryById.getPrice() != null) {
double amounts = inventoryById.getPrice() * applicationOutRecordMin.getQuantity();
double amounts = ObjectFormatUtil.multiply(inventoryById.getPrice(), applicationOutRecordMin.getQuantity());
sumPrice = ObjectFormatUtil.sum(sumPrice,amounts);
}

66
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -631,7 +631,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
BigDecimal bg = new BigDecimal(price_out / 100);
price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
priceForToday = ObjectFormatUtil.sum(priceForToday,price_out);
priceForToday = ObjectFormatUtil.sum(priceForToday, price_out);
}
for (ApplicationOutRecordMin recordMin : applicationOutMinForCompleteForYesterday) {
@ -658,7 +658,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
BigDecimal bg = new BigDecimal(price_out / 100);
price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
priceForYesterday = ObjectFormatUtil.sum(price_out,priceForYesterday);
priceForYesterday = ObjectFormatUtil.sum(price_out, priceForYesterday);
}
// 设置今天的额度
result.put("price", priceForToday);
@ -2326,8 +2326,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey,stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey,72,TimeUnit.HOURS);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
});
} else {
// 如果是通过仓库
@ -2383,8 +2383,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey,stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey,72,TimeUnit.HOURS);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
});
}
@ -2794,29 +2794,33 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 用于标志该仓库是否为前置仓下的仓库
boolean flagForHasOtherDepository = true; //默认是前置仓下的仓库
// 获取当前出库是否为开放出库
String manager1 = record.getDepositoryManager();
int flagForOpenDepository = record.getFlagForOpenDepository();
if (flagForOpenDepository != 1) {
// 如果是开放仓库
if (manager1 != null) {
flagForHasOtherDepository = false;
} else {
// 如果不是
for (ApplicationOutRecordMin min : minByParent
) {
Depository depositoryById = depositoryMapper.findDepositoryById(min.getDepositoryId());
if (Integer.compare(depositoryById.getParentId(), 0) != 0) {
// 如果不是
List<Depository> depositoryAll = depositoryMapper.findDepositoryAll();
depositoryById = findParentDepository(depositoryById, depositoryAll);
}
if (flagForOpenDepository != 1) {
if (!depositoryById.getDname().contains("前置仓")) {
// 如果不是前置仓下的仓库
flagForHasOtherDepository = false;
// 如果是开放仓库
flagForHasOtherDepository = false;
} else {
// 如果不是
for (ApplicationOutRecordMin min : minByParent
) {
Depository depositoryById = depositoryMapper.findDepositoryById(min.getDepositoryId());
if (Integer.compare(depositoryById.getParentId(), 0) != 0) {
// 如果不是
List<Depository> depositoryAll = depositoryMapper.findDepositoryAll();
depositoryById = findParentDepository(depositoryById, depositoryAll);
}
if (!depositoryById.getDname().contains("前置仓")) {
// 如果不是前置仓下的仓库
flagForHasOtherDepository = false;
}
}
}
}
if (map.containsKey("departmentheadPass") && !flagForHasOtherDepository) {
// 如果是第一位部门负责人审批且可进入该流程
@ -3060,8 +3064,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey,stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey,72,TimeUnit.HOURS);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
});
} else {
// 如果是通过仓库
@ -3116,8 +3120,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey,stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey,72,TimeUnit.HOURS);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
});
}
}
@ -3490,8 +3494,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey,stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey,72,TimeUnit.HOURS);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
});
} else {
// 如果是通过仓库
@ -3546,8 +3550,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey,stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey,72,TimeUnit.HOURS);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
});
}
}
@ -5092,7 +5096,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
BigDecimal bg = new BigDecimal(price_out / 100);
price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
price = ObjectFormatUtil.sum(price,price_out);
price = ObjectFormatUtil.sum(price, price_out);
}
result.put("count", count);
result.put("price", price);

7
src/main/java/com/dreamchaser/depository_manage/utils/ObjectFormatUtil.java

@ -36,4 +36,11 @@ public class ObjectFormatUtil {
return bd1.add(bd2).doubleValue();
}
// double 类型相乘
public static double multiply(double d1,double d2){
BigDecimal bd1 = new BigDecimal(Double.toString(d1));
BigDecimal bd2 = new BigDecimal(Double.toString(d2));
return bd1.multiply(bd2).doubleValue();
}
}

2
src/test/java/com/dreamchaser/depository_manage/OtherTest.java

@ -101,7 +101,7 @@ public class OtherTest {
public void someTest(){
double a = 1.1;
double b = 2.2;
a += b;
a = ObjectFormatUtil.multiply(a,b);
System.out.println(a);
}

Loading…
Cancel
Save