|
|
@ -1,25 +1,24 @@ |
|
|
package com.dreamchaser.depository_manage.service.impl; |
|
|
package com.dreamchaser.depository_manage.service.impl; |
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.dreamchaser.depository_manage.config.PortConfig; |
|
|
import com.dreamchaser.depository_manage.config.PublicConfig; |
|
|
import com.dreamchaser.depository_manage.config.QyWxConfig; |
|
|
import com.dreamchaser.depository_manage.config.QyWxConfig; |
|
|
import com.dreamchaser.depository_manage.entity.*; |
|
|
import com.dreamchaser.depository_manage.entity.*; |
|
|
import com.dreamchaser.depository_manage.entity.MaterialAndPlace; |
|
|
import com.dreamchaser.depository_manage.entity.MaterialAndPlace; |
|
|
import com.dreamchaser.depository_manage.exception.MyException; |
|
|
|
|
|
import com.dreamchaser.depository_manage.mapper.*; |
|
|
import com.dreamchaser.depository_manage.mapper.*; |
|
|
import com.dreamchaser.depository_manage.pojo.*; |
|
|
import com.dreamchaser.depository_manage.pojo.*; |
|
|
import com.dreamchaser.depository_manage.pojo.callBackXml.approvalCallBackXml.ApprovalInfo_Details; |
|
|
import com.dreamchaser.depository_manage.pojo.callBackXml.approvalCallBackXml.ApprovalInfo_Details; |
|
|
import com.dreamchaser.depository_manage.pojo.callBackXml.approvalCallBackXml.ApprovalInfo_Details_Approver; |
|
|
import com.dreamchaser.depository_manage.pojo.callBackXml.approvalCallBackXml.ApprovalInfo_Details_Approver; |
|
|
import com.dreamchaser.depository_manage.pojo.callBackXml.callBackXml_button_templatecard.TemplateCard; |
|
|
import com.dreamchaser.depository_manage.pojo.callBackXml.callBackXml_button_templatecard.TemplateCard; |
|
|
|
|
|
import com.dreamchaser.depository_manage.security.pool.RedisPool; |
|
|
|
|
|
import com.dreamchaser.depository_manage.security.pool.SendQyWxMessageThreadPool; |
|
|
import com.dreamchaser.depository_manage.service.DepositoryRecordService; |
|
|
import com.dreamchaser.depository_manage.service.DepositoryRecordService; |
|
|
import com.dreamchaser.depository_manage.service.RoleService; |
|
|
import com.dreamchaser.depository_manage.service.RoleService; |
|
|
import com.dreamchaser.depository_manage.service.SplitUnitService; |
|
|
import com.dreamchaser.depository_manage.service.SplitUnitService; |
|
|
import com.dreamchaser.depository_manage.utils.*; |
|
|
import com.dreamchaser.depository_manage.utils.*; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
|
|
import org.redisson.api.RLock; |
|
|
import org.redisson.api.RLock; |
|
|
import org.redisson.api.RedissonClient; |
|
|
import org.redisson.api.RedissonClient; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
@ -45,7 +44,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private RoleService roleService; |
|
|
private RoleService roleService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private RedisTemplate<String, String> redisTemplate; |
|
|
private RedisPool redisPool; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private PlaceMapper placeMapper; |
|
|
private PlaceMapper placeMapper; |
|
|
@ -82,7 +81,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
map.put("applyTime", DateUtil.DateTimeToTimeStamp(simpleTime)); |
|
|
map.put("applyTime", DateUtil.DateTimeToTimeStamp(simpleTime)); |
|
|
map.put("state", "待审核"); |
|
|
map.put("state", "待审核"); |
|
|
String mname = (String) map.get("mname"); |
|
|
String mname = (String) map.get("mname"); |
|
|
Double quantity = Double.parseDouble((String) map.get("quantity")); |
|
|
double quantity = Double.parseDouble((String) map.get("quantity")); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
param.put("mname", mname); |
|
|
param.put("mname", mname); |
|
|
List<Material> list = materialMapper.findMaterialByCondition(param); |
|
|
List<Material> list = materialMapper.findMaterialByCondition(param); |
|
|
@ -290,43 +289,35 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(id); |
|
|
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(id); |
|
|
|
|
|
|
|
|
// 开启一个线程去删除redis中的数据
|
|
|
// 开启一个线程去删除redis中的数据
|
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
// 获取该用户在redis中的订单记录
|
|
|
public void run() { |
|
|
String key = "user:" + recordP.getApplicantId(); |
|
|
// 获取该用户在redis中的订单记录
|
|
|
// 获取当前用户所有处理单
|
|
|
String key = "user:" + recordP.getApplicantId(); |
|
|
String minRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get(key, "minRecord"); |
|
|
// 获取当前用户所有处理单
|
|
|
for (ApplicationOutRecordMin recordMin : |
|
|
String minRecord = (String) redisTemplate.opsForHash().get(key, "minRecord"); |
|
|
applicationOutRecordMinByParent) { |
|
|
for (ApplicationOutRecordMin recordMin : |
|
|
Inventory inventoryById = materialMapper.findInventoryById(recordMin.getMid()); |
|
|
applicationOutRecordMinByParent) { |
|
|
inventoryById.setNumberOfTemporary(inventoryById.getNumberOfTemporary() - recordMin.getQuantity()); |
|
|
Inventory inventoryById = materialMapper.findInventoryById(recordMin.getMid()); |
|
|
materialMapper.updateInventory(inventoryById); |
|
|
inventoryById.setNumberOfTemporary(inventoryById.getNumberOfTemporary() - recordMin.getQuantity()); |
|
|
String redisMinRecordKey = "minRecord:" + recordMin.getId(); |
|
|
materialMapper.updateInventory(inventoryById); |
|
|
minRecord = minRecord.replace(redisMinRecordKey + ",", ""); |
|
|
String redisMinRecordKey = "minRecord:" + recordMin.getId(); |
|
|
if (minRecord.length() == 2) { |
|
|
minRecord = minRecord.replace(redisMinRecordKey + ",", ""); |
|
|
// []
|
|
|
if (minRecord.length() == 2) { |
|
|
// 如果当前用户已经没有剩余订单,则删除
|
|
|
// []
|
|
|
redisPool.getRedisTemplateByDb(15).delete(key); |
|
|
// 如果当前用户已经没有剩余订单,则删除
|
|
|
} else { |
|
|
redisTemplate.delete(key); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().put(key, "minRecord", minRecord); |
|
|
} else { |
|
|
|
|
|
redisTemplate.opsForHash().put(key, "minRecord", minRecord); |
|
|
|
|
|
} |
|
|
|
|
|
redisTemplate.delete(redisMinRecordKey); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
String redisMainRecordKey = "record:" + id; // 设置redis中主订单键值
|
|
|
redisPool.getRedisTemplateByDb(15).delete(redisMinRecordKey); |
|
|
redisTemplate.delete(redisMainRecordKey); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}).start(); |
|
|
String redisMainRecordKey = "record:" + id; // 设置redis中主订单键值
|
|
|
|
|
|
redisPool.getRedisTemplateByDb(15).delete(redisMainRecordKey); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
// 开启一个线程去删除子订单
|
|
|
// 开启一个线程去删除子订单
|
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> depositoryRecordMapper.deleteApplicationOutRecordMinById(id)); |
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
depositoryRecordMapper.deleteApplicationOutRecordMinById(id); |
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
|
|
|
|
|
|
return integer; |
|
|
return integer; |
|
|
} |
|
|
} |
|
|
@ -340,46 +331,36 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
Integer integer = depositoryRecordMapper.deleteApplicationOutRecordByIds(list); |
|
|
Integer integer = depositoryRecordMapper.deleteApplicationOutRecordByIds(list); |
|
|
|
|
|
|
|
|
// 开启一个线程去删除redis中的数据
|
|
|
// 开启一个线程去删除redis中的数据
|
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
for (ApplicationOutRecord recordP : recordPList |
|
|
public void run() { |
|
|
) { |
|
|
|
|
|
// 获取该用户在redis中的订单记录
|
|
|
|
|
|
String key = "user:" + recordP.getApplicantId(); |
|
|
for (ApplicationOutRecord recordP : recordPList |
|
|
|
|
|
) { |
|
|
List<ApplicationOutRecordMin> recordMinList = depositoryRecordMapper.findApplicationOutRecordMinByParent(recordP.getId()); |
|
|
// 获取该用户在redis中的订单记录
|
|
|
for (ApplicationOutRecordMin recordMin : recordMinList |
|
|
String key = "user:" + recordP.getApplicantId(); |
|
|
) { |
|
|
|
|
|
// 获取当前用户所有订单
|
|
|
List<ApplicationOutRecordMin> recordMinList = depositoryRecordMapper.findApplicationOutRecordMinByParent(recordP.getId()); |
|
|
String minRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get(key, "minRecord"); |
|
|
for (ApplicationOutRecordMin recordMin : recordMinList |
|
|
|
|
|
) { |
|
|
String redisMinRecordKey = "minRecord:" + recordMin.getId(); |
|
|
// 获取当前用户所有订单
|
|
|
minRecord = minRecord.replace(redisMinRecordKey + ",", ""); |
|
|
String minRecord = (String) redisTemplate.opsForHash().get(key, "minRecord"); |
|
|
if (minRecord.length() == 2) { |
|
|
|
|
|
// []
|
|
|
String redisMinRecordKey = "minRecord:" + recordMin.getId(); |
|
|
// 如果当前用户已经没有剩余订单,则删除
|
|
|
minRecord = minRecord.replace(redisMinRecordKey + ",", ""); |
|
|
redisPool.getRedisTemplateByDb(15).delete(key); |
|
|
if (minRecord.length() == 2) { |
|
|
} else { |
|
|
// []
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().put(key, "minRecord", minRecord); |
|
|
// 如果当前用户已经没有剩余订单,则删除
|
|
|
} |
|
|
redisTemplate.delete(key); |
|
|
redisPool.getRedisTemplateByDb(15).delete(redisMinRecordKey); |
|
|
} else { |
|
|
} |
|
|
redisTemplate.opsForHash().put(key, "minRecord", minRecord); |
|
|
String redisMainRecordKey = "record:" + recordP.getId(); // 设置redis中主订单键值
|
|
|
} |
|
|
redisPool.getRedisTemplateByDb(15).delete(redisMainRecordKey); |
|
|
redisTemplate.delete(redisMinRecordKey); |
|
|
} |
|
|
} |
|
|
|
|
|
String redisMainRecordKey = "record:" + recordP.getId(); // 设置redis中主订单键值
|
|
|
}); |
|
|
redisTemplate.delete(redisMainRecordKey); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
// 开启一个线程用于删除
|
|
|
// 开启一个线程用于删除
|
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> depositoryRecordMapper.deleteApplicationOutRecordMinByIds(list)); |
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
depositoryRecordMapper.deleteApplicationOutRecordMinByIds(list); |
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
|
|
|
|
|
|
return integer; |
|
|
return integer; |
|
|
} |
|
|
} |
|
|
@ -541,7 +522,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
int yesterdaySize = applicationOutRecordPForYesterday.size(); |
|
|
int yesterdaySize = applicationOutRecordPForYesterday.size(); |
|
|
if (todaySize > 0) { |
|
|
if (todaySize > 0) { |
|
|
// 定义线程用于计算今天的记录
|
|
|
// 定义线程用于计算今天的记录
|
|
|
ExecutorService exsForToday = Executors.newFixedThreadPool(todaySize); |
|
|
ExecutorService exsForToday = new ThreadPoolExecutor(todaySize, todaySize, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(todaySize)); |
|
|
|
|
|
|
|
|
// 结果集
|
|
|
// 结果集
|
|
|
List<Future<Object>> futureListForToday = new ArrayList<Future<Object>>(); |
|
|
List<Future<Object>> futureListForToday = new ArrayList<Future<Object>>(); |
|
|
// 1.定义CompletionService
|
|
|
// 1.定义CompletionService
|
|
|
@ -569,7 +551,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
if (yesterdaySize > 0) { |
|
|
if (yesterdaySize > 0) { |
|
|
// 定义线程用于计算昨天的记录
|
|
|
// 定义线程用于计算昨天的记录
|
|
|
ExecutorService exsForYesterday = Executors.newFixedThreadPool(yesterdaySize); |
|
|
ExecutorService exsForYesterday = new ThreadPoolExecutor(yesterdaySize, yesterdaySize, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(yesterdaySize)); |
|
|
|
|
|
|
|
|
// 结果集
|
|
|
// 结果集
|
|
|
List<Future<Object>> futureListForYesterday = new ArrayList<Future<Object>>(); |
|
|
List<Future<Object>> futureListForYesterday = new ArrayList<Future<Object>>(); |
|
|
// 1.定义CompletionService
|
|
|
// 1.定义CompletionService
|
|
|
@ -1115,30 +1098,27 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); |
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); |
|
|
|
|
|
|
|
|
// 更新入库批次中的物料数量
|
|
|
// 更新入库批次中的物料数量
|
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
// 获取出库物料id
|
|
|
public void run() { |
|
|
Integer mid1 = inventory.getId(); |
|
|
// 获取出库物料id
|
|
|
// 获取当前物料对应的生产日期
|
|
|
Integer mid = inventory.getId(); |
|
|
List<MaterialAndProducedDate> materialAndProducedDateByMid = materialMapper.findMaterialAndProducedDateByMid(mid1); |
|
|
// 获取当前物料对应的生产日期
|
|
|
if (materialAndProducedDateByMid.size() > 0) { |
|
|
List<MaterialAndProducedDate> materialAndProducedDateByMid = materialMapper.findMaterialAndProducedDateByMid(mid); |
|
|
// 获取距今生产日期远的(即生产日期最早的)
|
|
|
if (materialAndProducedDateByMid.size() > 0) { |
|
|
for (MaterialAndProducedDate materialAndProducedDate : |
|
|
// 获取距今生产日期远的(即生产日期最早的)
|
|
|
materialAndProducedDateByMid) { |
|
|
for (MaterialAndProducedDate materialAndProducedDate : |
|
|
if (materialAndProducedDate.getInventory() > quantity) { |
|
|
materialAndProducedDateByMid) { |
|
|
// 设置使用的数量
|
|
|
if (materialAndProducedDate.getInventory() > quantity) { |
|
|
materialAndProducedDate.setExpendnum(materialAndProducedDate.getExpendnum() + (int) quantity); |
|
|
// 设置使用的数量
|
|
|
// 设置剩余的数量
|
|
|
materialAndProducedDate.setExpendnum(materialAndProducedDate.getExpendnum() + (int) quantity); |
|
|
materialAndProducedDate.setInventory(materialAndProducedDate.getInventory() - (int) quantity); |
|
|
// 设置剩余的数量
|
|
|
materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); |
|
|
materialAndProducedDate.setInventory(materialAndProducedDate.getInventory() - (int) quantity); |
|
|
// 跳出循环
|
|
|
materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); |
|
|
break; |
|
|
// 跳出循环
|
|
|
} |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
restResponse.setStatus(508); |
|
|
restResponse.setStatus(508); |
|
|
restResponse.setData(""); |
|
|
restResponse.setData(""); |
|
|
@ -1970,9 +1950,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
QyWxApprovalMap.put("mainId", integerList.toString()); |
|
|
QyWxApprovalMap.put("mainId", integerList.toString()); |
|
|
redisTemplate.opsForHash().putAll(sp_no, QyWxApprovalMap); |
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_"+sp_no, QyWxApprovalMap); |
|
|
// 设置过期为7天
|
|
|
// 设置过期为7天
|
|
|
redisTemplate.expire(sp_no, 7, TimeUnit.DAYS); |
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_"+sp_no, 7, TimeUnit.DAYS); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2074,11 +2054,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Double trueOut, UserByPort userByPort, Integer placeId, String userAgent) { |
|
|
void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Double trueOut, UserByPort userByPort, Integer placeId, String userAgent) { |
|
|
String redisMinRecordKey = "minRecord:" + id; // 设置redis中子订单键值
|
|
|
String redisMinRecordKey = "minRecord:" + id; // 设置redis中子订单键值
|
|
|
// 修改redis中本子订单状态
|
|
|
|
|
|
// redisTemplate.opsForHash().put(redisMinRecordKey,"state","2");
|
|
|
|
|
|
// 修改redis中本子订单完成人
|
|
|
|
|
|
// redisTemplate.opsForHash().put(redisMinRecordKey,"manager",userByPort.getId().toString());
|
|
|
|
|
|
|
|
|
|
|
|
// 修改当前已经出库的数量
|
|
|
// 修改当前已经出库的数量
|
|
|
applicationOutMinById.setTrueOut((int) ((trueOut * 100) + applicationOutMinById.getTrueOut())); |
|
|
applicationOutMinById.setTrueOut((int) ((trueOut * 100) + applicationOutMinById.getTrueOut())); |
|
|
if (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut() > 0) { |
|
|
if (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut() > 0) { |
|
|
@ -2089,7 +2064,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果完成出库
|
|
|
// 如果完成出库
|
|
|
|
|
|
|
|
|
// 获取当前订单中所有管理员
|
|
|
// 获取当前订单中所有管理员
|
|
|
String manager = (String) redisTemplate.opsForHash().get(redisMinRecordKey, "manager"); |
|
|
String manager = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get(redisMinRecordKey, "manager"); |
|
|
String[] managerSplit = new String[0]; |
|
|
String[] managerSplit = new String[0]; |
|
|
if (manager != null) { |
|
|
if (manager != null) { |
|
|
// 获取其他管理员
|
|
|
// 获取其他管理员
|
|
|
@ -2101,7 +2076,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
for (String item : managerSplit) { |
|
|
for (String item : managerSplit) { |
|
|
// 删除其他管理员的订单记录
|
|
|
// 删除其他管理员的订单记录
|
|
|
String otherManager = "user:" + item; |
|
|
String otherManager = "user:" + item; |
|
|
String minRecord = (String) redisTemplate.opsForHash().get(otherManager, "minRecord"); |
|
|
String minRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get(otherManager, "minRecord"); |
|
|
// 删除其他管理员中当前已完成的订单
|
|
|
// 删除其他管理员中当前已完成的订单
|
|
|
if (minRecord == null) { |
|
|
if (minRecord == null) { |
|
|
continue; |
|
|
continue; |
|
|
@ -2110,17 +2085,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
if (minRecord.length() == 2) { |
|
|
if (minRecord.length() == 2) { |
|
|
// []
|
|
|
// []
|
|
|
// 如果当前用户已经没有剩余订单,则删除
|
|
|
// 如果当前用户已经没有剩余订单,则删除
|
|
|
redisTemplate.delete(otherManager); |
|
|
redisPool.getRedisTemplateByDb(15).delete(otherManager); |
|
|
} else { |
|
|
} else { |
|
|
redisTemplate.opsForHash().put(otherManager, "minRecord", minRecord); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().put(otherManager, "minRecord", minRecord); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// 删除已完成的订单
|
|
|
// 删除已完成的订单
|
|
|
redisTemplate.delete(redisMinRecordKey); |
|
|
redisPool.getRedisTemplateByDb(15).delete(redisMinRecordKey); |
|
|
// 获取该用户在redis中的订单记录
|
|
|
// 获取该用户在redis中的订单记录
|
|
|
String key = "user:" + userByPort.getId().toString(); |
|
|
String key = "user:" + userByPort.getId().toString(); |
|
|
// 获取当前用户所有订单
|
|
|
// 获取当前用户所有订单
|
|
|
String minRecord = (String) redisTemplate.opsForHash().get(key, "minRecord"); |
|
|
String minRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get(key, "minRecord"); |
|
|
if (minRecord == null) { |
|
|
if (minRecord == null) { |
|
|
minRecord = ""; |
|
|
minRecord = ""; |
|
|
} |
|
|
} |
|
|
@ -2129,9 +2104,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
if (minRecord.length() == 2) { |
|
|
if (minRecord.length() == 2) { |
|
|
// []
|
|
|
// []
|
|
|
// 如果当前用户已经没有剩余订单,则删除
|
|
|
// 如果当前用户已经没有剩余订单,则删除
|
|
|
redisTemplate.delete("user:" + userByPort.getId()); |
|
|
redisPool.getRedisTemplateByDb(15).delete("user:" + userByPort.getId()); |
|
|
} else { |
|
|
} else { |
|
|
redisTemplate.opsForHash().put(key, "minRecord", minRecord); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().put(key, "minRecord", minRecord); |
|
|
} |
|
|
} |
|
|
// 获取出库仓库信息
|
|
|
// 获取出库仓库信息
|
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(applicationOutMinById.getDepositoryId()); |
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(applicationOutMinById.getDepositoryId()); |
|
|
@ -2163,13 +2138,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
String redisMainRecordKey = "record:" + record.getId(); // 设置redis中主订单键值
|
|
|
String redisMainRecordKey = "record:" + record.getId(); // 设置redis中主订单键值
|
|
|
// 获取redis中主订单的所有子订单
|
|
|
// 获取redis中主订单的所有子订单
|
|
|
String minRecordList = (String) redisTemplate.opsForHash().get(redisMainRecordKey, "minRecord"); |
|
|
String minRecordList = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get(redisMainRecordKey, "minRecord"); |
|
|
// 获取所有子订单键值
|
|
|
// 获取所有子订单键值
|
|
|
String[] split = minRecordList.replace("[", "").replace("]", "").split(","); |
|
|
String[] split = minRecordList.replace("[", "").replace("]", "").split(","); |
|
|
int pass = 1; // 设置主订单最终状态
|
|
|
int pass = 1; // 设置主订单最终状态
|
|
|
for (String value : split) { |
|
|
for (String value : split) { |
|
|
// 获取所有子订单状态
|
|
|
// 获取所有子订单状态
|
|
|
String state = (String) redisTemplate.opsForHash().get(value, "state"); |
|
|
String state = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get(value, "state"); |
|
|
if ("1".equals(state)) { |
|
|
if ("1".equals(state)) { |
|
|
// 如果有子订单未完成
|
|
|
// 如果有子订单未完成
|
|
|
pass = 3; // 设置主订单状态为处理中
|
|
|
pass = 3; // 设置主订单状态为处理中
|
|
|
@ -2178,7 +2153,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
if (pass == 1) { // 如果最终状态为完成
|
|
|
if (pass == 1) { // 如果最终状态为完成
|
|
|
|
|
|
|
|
|
redisTemplate.delete(redisMainRecordKey); |
|
|
redisPool.getRedisTemplateByDb(15).delete(redisMainRecordKey); |
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
map.put("pass", pass); |
|
|
map.put("pass", pass); |
|
|
@ -2210,7 +2185,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
JSONObject jsonObject = qyWxOperationService.sendCcMessageToUsers(depositoryManagerByQyWx.toString(), record.getId(), userAgent); |
|
|
JSONObject jsonObject = qyWxOperationService.sendCcMessageToUsers(depositoryManagerByQyWx.toString(), record.getId(), userAgent); |
|
|
|
|
|
|
|
|
// 删除redis中本订单
|
|
|
// 删除redis中本订单
|
|
|
redisTemplate.delete("record:" + record.getId()); |
|
|
redisPool.getRedisTemplateByDb(15).delete("record:" + record.getId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -2239,7 +2214,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 获取审批人userId
|
|
|
// 获取审批人userId
|
|
|
String userId = approver.getUserId(); |
|
|
String userId = approver.getUserId(); |
|
|
// 获取审批人
|
|
|
// 获取审批人
|
|
|
Map<String, Object> portInfo = PortConfig.findUserByQyWxUserId(userId); |
|
|
Map<String, Object> portInfo = PublicConfig.findUserByQyWxUserId(userId); |
|
|
UserByPort userByPort = (UserByPort) portInfo.get("user"); |
|
|
UserByPort userByPort = (UserByPort) portInfo.get("user"); |
|
|
|
|
|
|
|
|
// 用于标志是否更新当前申请明细
|
|
|
// 用于标志是否更新当前申请明细
|
|
|
@ -2350,7 +2325,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 仓库管理员订单信息
|
|
|
// 仓库管理员订单信息
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
// 用户当前子订单
|
|
|
// 用户当前子订单
|
|
|
String userMinRecord = (String) redisTemplate.opsForHash().get("user:" + integer, "minRecord"); |
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + integer, "minRecord"); |
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
@ -2359,7 +2334,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
} |
|
|
} |
|
|
// 更新redis中用户记录
|
|
|
// 更新redis中用户记录
|
|
|
redisTemplate.opsForHash().putAll("user:" + integer, userRecord); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + integer, userRecord); |
|
|
minRecordManage.append(integer).append(","); |
|
|
minRecordManage.append(integer).append(","); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
@ -2370,14 +2345,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
minRecord.put("manager", minRecordManage.toString()); |
|
|
minRecord.put("manager", minRecordManage.toString()); |
|
|
// 添加子订单到redis中
|
|
|
// 添加子订单到redis中
|
|
|
redisTemplate.opsForHash().putAll(minRecordKey, minRecord); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll(minRecordKey, minRecord); |
|
|
// 开启线程向仓库管理员发送消息
|
|
|
// 开启线程向仓库管理员发送消息
|
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
public void run() { |
|
|
}); |
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
// 如果是通过仓库
|
|
|
// 如果是通过仓库
|
|
|
|
|
|
|
|
|
@ -2405,7 +2377,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 仓库管理员订单信息
|
|
|
// 仓库管理员订单信息
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
// 用户当前子订单
|
|
|
// 用户当前子订单
|
|
|
String userMinRecord = (String) redisTemplate.opsForHash().get("user:" + integer, "minRecord"); |
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + integer, "minRecord"); |
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
@ -2414,7 +2386,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
} |
|
|
} |
|
|
// 更新redis中用户记录
|
|
|
// 更新redis中用户记录
|
|
|
redisTemplate.opsForHash().putAll("user:" + integer, userRecord); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + integer, userRecord); |
|
|
minRecordManage.append(integer).append(","); |
|
|
minRecordManage.append(integer).append(","); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
@ -2425,21 +2397,19 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
minRecord.put("manager", minRecordManage.toString()); |
|
|
minRecord.put("manager", minRecordManage.toString()); |
|
|
// 添加子订单到redis中
|
|
|
// 添加子订单到redis中
|
|
|
redisTemplate.opsForHash().putAll(minRecordKey, minRecord); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll(minRecordKey, minRecord); |
|
|
// 开启线程向仓库管理员发送消息
|
|
|
// 开启线程向仓库管理员发送消息
|
|
|
new Thread(new Runnable() { |
|
|
|
|
|
@Override |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
public void run() { |
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
}); |
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 将主订单插入到redis中
|
|
|
// 将主订单插入到redis中
|
|
|
redisTemplate.opsForHash().put("record:" + recordP.getId(), "minRecord", minRecordByMain.toString()); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().put("record:" + recordP.getId(), "minRecord", minRecordByMain.toString()); |
|
|
map.put("state", "仓储中心负责人审核通过"); |
|
|
map.put("state", "仓储中心负责人审核通过"); |
|
|
if (flagForDepartmentHeadPass || flagForOpenDepository == 2) { |
|
|
if (flagForDepartmentHeadPass || flagForOpenDepository == 2) { |
|
|
map.put("state", "部门负责人审核通过"); |
|
|
map.put("state", "部门负责人审核通过"); |
|
|
@ -2464,7 +2434,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// 将当前redis中存储的spno删除
|
|
|
// 将当前redis中存储的spno删除
|
|
|
redisTemplate.delete(spNo); |
|
|
redisPool.getRedisTemplateByDb(14).delete("wms_QyWxMessage_"+spNo); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
@ -2488,7 +2458,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(recordP.getDepositoryId()); |
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(recordP.getDepositoryId()); |
|
|
// 获取当前仓库所属的部门
|
|
|
// 获取当前仓库所属的部门
|
|
|
String adminorg = depositoryById.getAdminorg(); |
|
|
String adminorg = depositoryById.getAdminorg(); |
|
|
List<UserByPort> departmentHeadByUser = PortConfig.findDepartmentHeadByUser(ObjectFormatUtil.toInteger(adminorg),null); |
|
|
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toInteger(adminorg),null); |
|
|
for (UserByPort departmentHead:departmentHeadByUser |
|
|
for (UserByPort departmentHead:departmentHeadByUser |
|
|
) { |
|
|
) { |
|
|
depositoryManager.append(departmentHead.getId()).append(","); |
|
|
depositoryManager.append(departmentHead.getId()).append(","); |
|
|
@ -2500,7 +2470,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 获取仓储中心负责人标签的用户userId
|
|
|
// 获取仓储中心负责人标签的用户userId
|
|
|
List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserList(userAgent); |
|
|
List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserList(userAgent); |
|
|
for (String s : qyWxLabelUserList) { |
|
|
for (String s : qyWxLabelUserList) { |
|
|
Map<String, Object> userByQyWxUserId = PortConfig.findUserByQyWxUserId(s); |
|
|
Map<String, Object> userByQyWxUserId = PublicConfig.findUserByQyWxUserId(s); |
|
|
UserByPort user = (UserByPort) userByQyWxUserId.get("user"); |
|
|
UserByPort user = (UserByPort) userByQyWxUserId.get("user"); |
|
|
depositoryManager.append(user.getId()).append(","); |
|
|
depositoryManager.append(user.getId()).append(","); |
|
|
} |
|
|
} |
|
|
@ -2513,7 +2483,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
map.put("pass", 2); |
|
|
map.put("pass", 2); |
|
|
map.put("departmentheadPass", 2); |
|
|
map.put("departmentheadPass", 2); |
|
|
map.put("state", "部门负责人审核未通过"); |
|
|
map.put("state", "部门负责人审核未通过"); |
|
|
redisTemplate.delete(spNo); |
|
|
redisPool.getRedisTemplateByDb(14).delete("wms_QyWxMessage_"+spNo); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -2590,7 +2560,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 获取审批人userId
|
|
|
// 获取审批人userId
|
|
|
String userId = approver.getUserId(); |
|
|
String userId = approver.getUserId(); |
|
|
// 获取审批人
|
|
|
// 获取审批人
|
|
|
Map<String, Object> portInfo = PortConfig.findUserByQyWxUserId(userId); |
|
|
Map<String, Object> portInfo = PublicConfig.findUserByQyWxUserId(userId); |
|
|
UserByPort userByPort = (UserByPort) portInfo.get("user"); |
|
|
UserByPort userByPort = (UserByPort) portInfo.get("user"); |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
map.put("approverId", userByPort.getId()); |
|
|
map.put("approverId", userByPort.getId()); |
|
|
@ -2714,7 +2684,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
depositoryRecordMapper.updateApplicationInRecord(map); |
|
|
depositoryRecordMapper.updateApplicationInRecord(map); |
|
|
} else { |
|
|
} else { |
|
|
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(sid.trim())); |
|
|
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(sid.trim())); |
|
|
String mainGidId = (String) redisTemplate.opsForHash().get(spNo, "mainGidId"); |
|
|
String mainGidId = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get(spNo, "mainGidId"); |
|
|
String[] replace = mainGidId.replace("[", "").replace("]", "").split(","); |
|
|
String[] replace = mainGidId.replace("[", "").replace("]", "").split(","); |
|
|
for (String rid : replace |
|
|
for (String rid : replace |
|
|
) { |
|
|
) { |
|
|
@ -2725,7 +2695,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
redisTemplate.delete(spNo); |
|
|
redisPool.getRedisTemplateByDb(14).delete("wms_QyWxMessage_"+spNo); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2892,7 +2862,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 获取当前仓库所属的部门
|
|
|
// 获取当前仓库所属的部门
|
|
|
String adminorg = depositoryById.getAdminorg(); |
|
|
String adminorg = depositoryById.getAdminorg(); |
|
|
|
|
|
|
|
|
List<UserByPort> departmentHeadByUser = PortConfig.findDepartmentHeadByUser(ObjectFormatUtil.toInteger(adminorg),null); |
|
|
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toInteger(adminorg),null); |
|
|
for (UserByPort departmentHead:departmentHeadByUser |
|
|
for (UserByPort departmentHead:departmentHeadByUser |
|
|
) { |
|
|
) { |
|
|
depositoryManager.append(departmentHead.getId()).append(","); |
|
|
depositoryManager.append(departmentHead.getId()).append(","); |
|
|
@ -2907,7 +2877,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取仓储中心负责人
|
|
|
// 获取仓储中心负责人
|
|
|
List<UserByPort> departmentHeadByUser = PortConfig.findDepartmentHeadByUser(361,userToken); |
|
|
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(361,userToken); |
|
|
|
|
|
|
|
|
for (UserByPort userByPort : departmentHeadByUser) { |
|
|
for (UserByPort userByPort : departmentHeadByUser) { |
|
|
depositoryManager.append(userByPort.getId()).append(","); |
|
|
depositoryManager.append(userByPort.getId()).append(","); |
|
|
@ -2924,21 +2894,18 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 向仓储中心负责人发送新的消息
|
|
|
// 向仓储中心负责人发送新的消息
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
JSONObject jsonObject = qyWxOperationService.sendQyWxToApplicationOutMessage(QyWxUid.toString(), ObjectFormatUtil.toInteger(id), false, userAgent); |
|
|
public void run() { |
|
|
// 将当前返回结果保存到redis中
|
|
|
JSONObject jsonObject = qyWxOperationService.sendQyWxToApplicationOutMessage(QyWxUid.toString(), ObjectFormatUtil.toInteger(id), false, userAgent); |
|
|
Map<String, Object> QyWxMessageMap = new HashMap<>(); |
|
|
// 将当前返回结果保存到redis中
|
|
|
QyWxMessageMap.put("MsgId", jsonObject.getString("msgid")); |
|
|
Map<String, Object> QyWxMessageMap = new HashMap<>(); |
|
|
QyWxMessageMap.put("responseCode", jsonObject.getString("response_code")); |
|
|
QyWxMessageMap.put("MsgId", jsonObject.getString("msgid")); |
|
|
// key user:300450:QyWxOut:1
|
|
|
QyWxMessageMap.put("responseCode", jsonObject.getString("response_code")); |
|
|
// 部门负责人number
|
|
|
// key user:300450:QyWxOut:1
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + userToken.getNumber() + ":QyWxOutId:" + id, QyWxMessageMap); |
|
|
// 部门负责人number
|
|
|
// 设置过期时间为三天
|
|
|
redisTemplate.opsForHash().putAll("user:" + userToken.getNumber() + ":QyWxOutId:" + id, QyWxMessageMap); |
|
|
redisPool.getRedisTemplateByDb(15).expire("user:" + userToken.getNumber() + ":QyWxOutId:" + id, 72, TimeUnit.HOURS); |
|
|
// 设置过期时间为三天
|
|
|
}); |
|
|
redisTemplate.expire("user:" + userToken.getNumber() + ":QyWxOutId:" + id, 72, TimeUnit.HOURS); |
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
@ -2951,41 +2918,35 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
// 开启线程更改其他用户卡片模板样式
|
|
|
// 开启线程更改其他用户卡片模板样式
|
|
|
String finalResult = result; |
|
|
String finalResult = result; |
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
// 获取responseCode(key为申请人number)
|
|
|
public void run() { |
|
|
//获取申请人信息
|
|
|
// 获取responseCode(key为申请人number)
|
|
|
String key = "user:" + applicantUser.getNumber() + ":QyWxOutId:" + id; |
|
|
//获取申请人信息
|
|
|
String responseCode = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get(key, "responseCode"); |
|
|
String key = "user:" + applicantUser.getNumber() + ":QyWxOutId:" + id; |
|
|
qyWxOperationService.updateButtonTemplateCardToUnEnable(responseCode, userToken.getName(), finalResult, userAgent); |
|
|
String responseCode = (String) redisTemplate.opsForHash().get(key, "responseCode"); |
|
|
}); |
|
|
qyWxOperationService.updateButtonTemplateCardToUnEnable(responseCode, userToken.getName(), finalResult, userAgent); |
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
|
|
|
|
|
|
// 开启流程通知其他人忽略审批流程
|
|
|
// 开启流程通知其他人忽略审批流程
|
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
String departmenthead = record.getDepartmenthead(); |
|
|
public void run() { |
|
|
String[] split = departmenthead.split(","); |
|
|
String departmenthead = record.getDepartmenthead(); |
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
String[] split = departmenthead.split(","); |
|
|
for (int i = 0; i < split.length; i++) { |
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
String s = split[i]; |
|
|
for (int i = 0; i < split.length; i++) { |
|
|
if ("".equals(s)) { |
|
|
String s = split[i]; |
|
|
continue; |
|
|
if ("".equals(s)) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null); |
|
|
|
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
|
|
workwechat = userByPort.getWechat(); |
|
|
|
|
|
} |
|
|
|
|
|
// QyWxUid.append(workwechat).append(",");
|
|
|
|
|
|
} |
|
|
} |
|
|
String s = QyWxUid.toString(); |
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null); |
|
|
s = "PangFuZhen,"; |
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
|
|
workwechat = userByPort.getWechat(); |
|
|
|
|
|
} |
|
|
|
|
|
// QyWxUid.append(workwechat).append(",");
|
|
|
} |
|
|
} |
|
|
}).start(); |
|
|
String s = QyWxUid.toString(); |
|
|
|
|
|
s = "PangFuZhen,"; |
|
|
|
|
|
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
String result = ""; |
|
|
String result = ""; |
|
|
@ -3078,7 +3039,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 仓库管理员订单信息
|
|
|
// 仓库管理员订单信息
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
// 用户当前子订单
|
|
|
// 用户当前子订单
|
|
|
String userMinRecord = (String) redisTemplate.opsForHash().get("user:" + integer, "minRecord"); |
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + integer, "minRecord"); |
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
@ -3087,7 +3048,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
} |
|
|
} |
|
|
// 更新redis中用户记录
|
|
|
// 更新redis中用户记录
|
|
|
redisTemplate.opsForHash().putAll("user:" + integer, userRecord); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + integer, userRecord); |
|
|
minRecordManage.append(integer).append(","); |
|
|
minRecordManage.append(integer).append(","); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
@ -3098,14 +3059,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
minRecord.put("manager", minRecordManage.toString()); |
|
|
minRecord.put("manager", minRecordManage.toString()); |
|
|
// 添加子订单到redis中
|
|
|
// 添加子订单到redis中
|
|
|
redisTemplate.opsForHash().putAll(minRecordKey, minRecord); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll(minRecordKey, minRecord); |
|
|
// 开启线程向仓库管理员发送消息
|
|
|
// 开启线程向仓库管理员发送消息
|
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
public void run() { |
|
|
}); |
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
// 如果是通过仓库
|
|
|
// 如果是通过仓库
|
|
|
@ -3134,7 +3092,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 仓库管理员订单信息
|
|
|
// 仓库管理员订单信息
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
// 用户当前子订单
|
|
|
// 用户当前子订单
|
|
|
String userMinRecord = (String) redisTemplate.opsForHash().get("user:" + integer, "minRecord"); |
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + integer, "minRecord"); |
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
@ -3143,7 +3101,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
} |
|
|
} |
|
|
// 更新redis中用户记录
|
|
|
// 更新redis中用户记录
|
|
|
redisTemplate.opsForHash().putAll("user:" + integer, userRecord); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + integer, userRecord); |
|
|
minRecordManage.append(integer).append(","); |
|
|
minRecordManage.append(integer).append(","); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
@ -3154,44 +3112,38 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
minRecord.put("manager", minRecordManage.toString()); |
|
|
minRecord.put("manager", minRecordManage.toString()); |
|
|
// 添加子订单到redis中
|
|
|
// 添加子订单到redis中
|
|
|
redisTemplate.opsForHash().putAll(minRecordKey, minRecord); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll(minRecordKey, minRecord); |
|
|
// 开启线程向仓库管理员发送消息
|
|
|
// 开启线程向仓库管理员发送消息
|
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
public void run() { |
|
|
}); |
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 开启流程通知其他人忽略审批流程
|
|
|
// 开启流程通知其他人忽略审批流程
|
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
String depositoryManager = record.getDepositoryManager(); |
|
|
public void run() { |
|
|
String[] split = depositoryManager.split(","); |
|
|
String depositoryManager = record.getDepositoryManager(); |
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
String[] split = depositoryManager.split(","); |
|
|
for (String s : split) { |
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
if ("".equals(s)) { |
|
|
for (String s : split) { |
|
|
continue; |
|
|
if ("".equals(s)) { |
|
|
} |
|
|
continue; |
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null); |
|
|
} |
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
workwechat = userByPort.getWechat(); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
|
|
workwechat = userByPort.getWechat(); |
|
|
|
|
|
} |
|
|
|
|
|
// QyWxUid.append(workwechat).append(",");
|
|
|
|
|
|
} |
|
|
} |
|
|
String s = QyWxUid.toString(); |
|
|
// QyWxUid.append(workwechat).append(",");
|
|
|
s = "PangFuZhen,"; |
|
|
|
|
|
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1); |
|
|
|
|
|
} |
|
|
} |
|
|
}).start(); |
|
|
String s = QyWxUid.toString(); |
|
|
|
|
|
s = "PangFuZhen,"; |
|
|
|
|
|
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
// 将主订单插入到redis中
|
|
|
// 将主订单插入到redis中
|
|
|
redisTemplate.opsForHash().put("record:" + record.getId(), "minRecord", minRecordByMain.toString()); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().put("record:" + record.getId(), "minRecord", minRecordByMain.toString()); |
|
|
map.put("state", "仓储中心负责人审核通过"); |
|
|
map.put("state", "仓储中心负责人审核通过"); |
|
|
|
|
|
|
|
|
if (flagFordepartmentTime || flagForOpenDepository == 2) { |
|
|
if (flagFordepartmentTime || flagForOpenDepository == 2) { |
|
|
@ -3218,17 +3170,14 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
// 开启线程更改其他用户卡片模板样式
|
|
|
// 开启线程更改其他用户卡片模板样式
|
|
|
String finalResult = result; |
|
|
String finalResult = result; |
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
// 获取responseCode(key为申请人number)
|
|
|
public void run() { |
|
|
//获取部门负责人信息
|
|
|
// 获取responseCode(key为申请人number)
|
|
|
UserByPort departHead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(record.getDepartmenthead()), userToken); |
|
|
//获取部门负责人信息
|
|
|
String key = "user:" + departHead.getNumber() + ":QyWxOutId:" + id; |
|
|
UserByPort departHead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(record.getDepartmenthead()), userToken); |
|
|
String responseCode = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get(key, "responseCode"); |
|
|
String key = "user:" + departHead.getNumber() + ":QyWxOutId:" + id; |
|
|
qyWxOperationService.updateButtonTemplateCardToUnEnable(responseCode, userToken.getName(), finalResult, userAgent); |
|
|
String responseCode = (String) redisTemplate.opsForHash().get(key, "responseCode"); |
|
|
}); |
|
|
qyWxOperationService.updateButtonTemplateCardToUnEnable(responseCode, userToken.getName(), finalResult, userAgent); |
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
} |
|
|
} |
|
|
map.put("id", id); |
|
|
map.put("id", id); |
|
|
return depositoryRecordMapper.updateApplicationOutRecord(map); |
|
|
return depositoryRecordMapper.updateApplicationOutRecord(map); |
|
|
@ -3357,7 +3306,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 点击用户
|
|
|
// 点击用户
|
|
|
String fromUserName = templateCard.getFromUserName(); |
|
|
String fromUserName = templateCard.getFromUserName(); |
|
|
// 根据userId获取处理人
|
|
|
// 根据userId获取处理人
|
|
|
Map<String, Object> portInfo = PortConfig.findUserByQyWxUserId(fromUserName); |
|
|
Map<String, Object> portInfo = PublicConfig.findUserByQyWxUserId(fromUserName); |
|
|
UserByPort userByPort = (UserByPort) portInfo.get("user"); |
|
|
UserByPort userByPort = (UserByPort) portInfo.get("user"); |
|
|
// 获取点击的按钮
|
|
|
// 获取点击的按钮
|
|
|
String eventKey = templateCard.getEventKey(); |
|
|
String eventKey = templateCard.getEventKey(); |
|
|
@ -3384,7 +3333,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
map.put("departmentheadPass", 1); |
|
|
map.put("departmentheadPass", 1); |
|
|
map.put("state", "待仓储中心负责人审核"); |
|
|
map.put("state", "待仓储中心负责人审核"); |
|
|
// 获取仓储中心负责人
|
|
|
// 获取仓储中心负责人
|
|
|
List<UserByPort> departmentHeadByUser = PortConfig.findDepartmentHeadByUser(361,null); |
|
|
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(361,null); |
|
|
StringBuilder depositoryManager = new StringBuilder(); |
|
|
StringBuilder depositoryManager = new StringBuilder(); |
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
// for (int i = 0; i < departmentHeadByUser.size(); i++) {
|
|
|
// for (int i = 0; i < departmentHeadByUser.size(); i++) {
|
|
|
@ -3404,9 +3353,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
QyWxMessageMap.put("MsgId", jsonObject.getString("msgid")); |
|
|
QyWxMessageMap.put("MsgId", jsonObject.getString("msgid")); |
|
|
QyWxMessageMap.put("responseCode", jsonObject.getString("response_code")); |
|
|
QyWxMessageMap.put("responseCode", jsonObject.getString("response_code")); |
|
|
// key user:300450:QyWxOut:1
|
|
|
// key user:300450:QyWxOut:1
|
|
|
redisTemplate.opsForHash().putAll("user:" + userByPort.getNumber() + ":QyWxOutId:" + outId, QyWxMessageMap); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + userByPort.getNumber() + ":QyWxOutId:" + outId, QyWxMessageMap); |
|
|
// 设置过期时间为三天
|
|
|
// 设置过期时间为三天
|
|
|
redisTemplate.expire("user:" + userByPort.getNumber() + ":QyWxOutId:" + outId, 72, TimeUnit.HOURS); |
|
|
redisPool.getRedisTemplateByDb(15).expire("user:" + userByPort.getNumber() + ":QyWxOutId:" + outId, 72, TimeUnit.HOURS); |
|
|
} else { |
|
|
} else { |
|
|
updateInventoryForOutRefused(recordP); |
|
|
updateInventoryForOutRefused(recordP); |
|
|
// 如果点击的是驳回
|
|
|
// 如果点击的是驳回
|
|
|
@ -3475,7 +3424,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 仓库管理员订单信息
|
|
|
// 仓库管理员订单信息
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
// 用户当前子订单
|
|
|
// 用户当前子订单
|
|
|
String userMinRecord = (String) redisTemplate.opsForHash().get("user:" + userIdByDid.get(j), "minRecord"); |
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + userIdByDid.get(j), "minRecord"); |
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
@ -3484,7 +3433,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
} |
|
|
} |
|
|
// 更新redis中用户记录
|
|
|
// 更新redis中用户记录
|
|
|
redisTemplate.opsForHash().putAll("user:" + userIdByDid.get(j), userRecord); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + userIdByDid.get(j), userRecord); |
|
|
minRecordManage.append(userIdByDid.get(j)).append(","); |
|
|
minRecordManage.append(userIdByDid.get(j)).append(","); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
@ -3495,18 +3444,15 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
minRecord.put("manager", minRecordManage.toString()); |
|
|
minRecord.put("manager", minRecordManage.toString()); |
|
|
// 添加子订单到redis中
|
|
|
// 添加子订单到redis中
|
|
|
redisTemplate.opsForHash().putAll(minRecordKey, minRecord); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll(minRecordKey, minRecord); |
|
|
// 开启线程向仓库管理员发送消息
|
|
|
// 开启线程向仓库管理员发送消息
|
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
public void run() { |
|
|
}); |
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 将主订单插入到redis中
|
|
|
// 将主订单插入到redis中
|
|
|
redisTemplate.opsForHash().put("record:" + recordP.getId(), "minRecord", minRecordByMain.toString()); |
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().put("record:" + recordP.getId(), "minRecord", minRecordByMain.toString()); |
|
|
map.put("state", "仓储中心负责人审核通过"); |
|
|
map.put("state", "仓储中心负责人审核通过"); |
|
|
} else { |
|
|
} else { |
|
|
// 如果是不通过
|
|
|
// 如果是不通过
|
|
|
@ -4718,15 +4664,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
@Override |
|
|
@Override |
|
|
public Integer deleteApplicationInRecordById(Integer id, UserByPort userToken, String userAgent) { |
|
|
public Integer deleteApplicationInRecordById(Integer id, UserByPort userToken, String userAgent) { |
|
|
ApplicationInRecord record = depositoryRecordMapper.findApplicationInRecordPById(id); |
|
|
ApplicationInRecord record = depositoryRecordMapper.findApplicationInRecordPById(id); |
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
if (Integer.compare(record.getAirapproverPass(), 4) == 0 || Integer.compare(record.getAirapproverPass(), 1) == 0) { |
|
|
public void run() { |
|
|
// 如果已经入库
|
|
|
if (Integer.compare(record.getAirapproverPass(), 4) == 0 || Integer.compare(record.getAirapproverPass(), 1) == 0) { |
|
|
updateInventoryForErrorInRecord(record.getMid(), record.getQuantity(), record.getAirUnit(), record.getPlaceId(), record.getDepositoryId()); |
|
|
// 如果已经入库
|
|
|
|
|
|
updateInventoryForErrorInRecord(record.getMid(), record.getQuantity(), record.getAirUnit(), record.getPlaceId(), record.getDepositoryId()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
}).start(); |
|
|
}); |
|
|
return depositoryRecordMapper.deleteApplicationInRecordById(id); |
|
|
return depositoryRecordMapper.deleteApplicationInRecordById(id); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -4739,17 +4682,14 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
@Override |
|
|
@Override |
|
|
public Integer deleteApplicationInRecordByIds(List<Integer> list, UserByPort userToken, String userAgent) { |
|
|
public Integer deleteApplicationInRecordByIds(List<Integer> list, UserByPort userToken, String userAgent) { |
|
|
List<ApplicationInRecord> applicationInRecordsByIds = depositoryRecordMapper.findApplicationInRecordsByIds(list); |
|
|
List<ApplicationInRecord> applicationInRecordsByIds = depositoryRecordMapper.findApplicationInRecordsByIds(list); |
|
|
new Thread(new Runnable() { |
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
@Override |
|
|
for (ApplicationInRecord record : applicationInRecordsByIds |
|
|
public void run() { |
|
|
) { |
|
|
for (ApplicationInRecord record : applicationInRecordsByIds |
|
|
if (Integer.compare(record.getAirapproverPass(), 4) == 0 || Integer.compare(record.getAirapproverPass(), 1) == 0) { |
|
|
) { |
|
|
updateInventoryForErrorInRecord(record.getMid(), record.getQuantity(), record.getAirUnit(), record.getPlaceId(), record.getDepositoryId()); |
|
|
if (Integer.compare(record.getAirapproverPass(), 4) == 0 || Integer.compare(record.getAirapproverPass(), 1) == 0) { |
|
|
|
|
|
updateInventoryForErrorInRecord(record.getMid(), record.getQuantity(), record.getAirUnit(), record.getPlaceId(), record.getDepositoryId()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}).start(); |
|
|
}); |
|
|
return depositoryRecordMapper.deleteApplicationInRecordByIds(list); |
|
|
return depositoryRecordMapper.deleteApplicationInRecordByIds(list); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -5097,19 +5037,19 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
public String createCode(String depositoryName, String key, String type, String mainDeparmentName) { |
|
|
public String createCode(String depositoryName, String key, String type, String mainDeparmentName) { |
|
|
RLock lock = redissonClient.getLock(key); |
|
|
RLock lock = redissonClient.getLock(PublicConfig.redis_Lock_name); |
|
|
// 入库单号(公司简称+仓库简称+年月日+数字(位数设置>=9))
|
|
|
// 单号(公司简称+仓库简称+年月日+数字(位数设置>=9))
|
|
|
String code = "GK"; |
|
|
String code = "GK"; |
|
|
String nowTime = DateUtil.getNowTime(); |
|
|
String nowTime = DateUtil.getNowTime(); |
|
|
depositoryName = WordUtil.getPinYinHeadChar(depositoryName); |
|
|
depositoryName = WordUtil.getPinYinHeadChar(depositoryName); |
|
|
lock.lock(5, TimeUnit.SECONDS); |
|
|
lock.lock(3, TimeUnit.SECONDS); |
|
|
String orderNumber = redisTemplate.opsForValue().get(key); |
|
|
String orderNumber = redisPool.getRedisTemplateByDb(15).opsForValue().get(key); |
|
|
if (orderNumber == null) { |
|
|
if (orderNumber == null) { |
|
|
redisTemplate.opsForValue().set(key, "1", DateUtil.getSecondsNextEarlyMorning(), TimeUnit.SECONDS); |
|
|
redisPool.getRedisTemplateByDb(15).opsForValue().set(key, "1", DateUtil.getSecondsNextEarlyMorning(), TimeUnit.SECONDS); |
|
|
orderNumber = "1"; |
|
|
orderNumber = "1"; |
|
|
} |
|
|
} |
|
|
int newNumber = ObjectFormatUtil.toInteger(orderNumber) + 1; |
|
|
int newNumber = ObjectFormatUtil.toInteger(orderNumber) + 1; |
|
|
redisTemplate.boundValueOps(key).set(String.valueOf(newNumber), DateUtil.getSecondsNextEarlyMorning(), TimeUnit.SECONDS); |
|
|
redisPool.getRedisTemplateByDb(15).boundValueOps(key).set(String.valueOf(newNumber), DateUtil.getSecondsNextEarlyMorning(), TimeUnit.SECONDS); |
|
|
lock.unlock(); |
|
|
lock.unlock(); |
|
|
orderNumber = String.format("%04d", ObjectFormatUtil.toInteger(orderNumber)); |
|
|
orderNumber = String.format("%04d", ObjectFormatUtil.toInteger(orderNumber)); |
|
|
if ("in".equals(type)) { |
|
|
if ("in".equals(type)) { |
|
|
|