|
|
|
@ -20,6 +20,7 @@ import com.dreamchaser.depository_manage.utils.CrudUtil; |
|
|
|
import com.dreamchaser.depository_manage.utils.DateUtil; |
|
|
|
import com.dreamchaser.depository_manage.utils.Md5; |
|
|
|
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; |
|
|
|
import org.apache.ibatis.jdbc.Null; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
@ -350,6 +351,8 @@ public class StockTakingController { |
|
|
|
int success = 0; |
|
|
|
int size = 0; |
|
|
|
if (keys != null && keys.size() > 0) { |
|
|
|
Object mainId = null; |
|
|
|
|
|
|
|
size = keys.size(); |
|
|
|
// 定义用于插入的盘点记录
|
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
@ -397,6 +400,7 @@ public class StockTakingController { |
|
|
|
param.remove("id"); |
|
|
|
|
|
|
|
} |
|
|
|
mainId = param.get("mainId"); |
|
|
|
redisTemplateForHash.opsForHash().put(key, "flagForSubmit", "true"); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -405,7 +409,58 @@ public class StockTakingController { |
|
|
|
success = stockTakingService.insertStockTakingByMaterial(map, keys, userToken); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 用于设置企业微信接收人
|
|
|
|
String departmentManagerId = (String) map.get("departmentManager"); |
|
|
|
StringBuilder QyWxDepartmentManager = new StringBuilder(); |
|
|
|
String[] split = departmentManagerId.split(","); |
|
|
|
for (String s : split) { |
|
|
|
if ("".equals(s)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
UserByPort departmentManager = PortConfig.findUserByPortByNumber(s); |
|
|
|
// QyWxDepartmentManager.append(departmentManager.getWorkwechat()+",");
|
|
|
|
} |
|
|
|
QyWxDepartmentManager.append("PangFuZhen"); |
|
|
|
if(map.containsKey("mainIdList")){ |
|
|
|
List<Object> mainIdList = (List<Object>) map.get("mainIdList"); |
|
|
|
for (Object main:mainIdList |
|
|
|
) { |
|
|
|
new Thread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateStockTaking(crypt, userToken, ObjectFormatUtil.toInteger(main), QyWxDepartmentManager.toString()); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", main.toString()); |
|
|
|
redisTemplateForHash.opsForHash().putAll(sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期时间为7天
|
|
|
|
redisTemplateForHash.expire(sp_no, 7, TimeUnit.DAYS); |
|
|
|
} |
|
|
|
}).start(); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
// 用于发送审批
|
|
|
|
Object finalMainId = mainId; |
|
|
|
new Thread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateStockTaking(crypt, userToken, ObjectFormatUtil.toInteger(finalMainId), QyWxDepartmentManager.toString()); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", finalMainId.toString()); |
|
|
|
redisTemplateForHash.opsForHash().putAll(sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期时间为7天
|
|
|
|
redisTemplateForHash.expire(sp_no, 7, TimeUnit.DAYS); |
|
|
|
} |
|
|
|
}).start(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return CrudUtil.putHandle(success, size); |
|
|
|
} |
|
|
|
} |
|
|
|
|