|
@@ -10,6 +10,7 @@ import com.iamberry.rst.core.order.ProductColor;
|
|
|
import com.iamberry.rst.core.order.ProductType;
|
|
|
import com.iamberry.rst.core.sms.OrderMessage;
|
|
|
import com.iamberry.rst.core.sms.SmsMessage;
|
|
|
+import com.iamberry.rst.core.sys.Admin;
|
|
|
import com.iamberry.rst.core.sys.Relu;
|
|
|
import com.iamberry.rst.core.sys.SysConfig;
|
|
|
import com.iamberry.rst.faces.address.AddressService;
|
|
@@ -78,9 +79,12 @@ public class MQTask implements InitializingBean {
|
|
|
private CustomerCommonService customerCommonService;
|
|
|
@Autowired
|
|
|
private KuaiDi100 kuaidi100;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private PostageAuthorityService postageAuthorityService;
|
|
|
+ @Autowired
|
|
|
+ private PostageService postageService;
|
|
|
+ @Autowired
|
|
|
+ private CompanyInfoService companyInfoService;
|
|
|
|
|
|
private Object lock = new Object();
|
|
|
private Object lock1 = new Object();
|
|
@@ -454,11 +458,94 @@ public class MQTask implements InitializingBean {
|
|
|
|
|
|
|
|
|
/**客诉系统 自动追踪发货信息**/
|
|
|
-// @Scheduled(cron = "0 0/30 * * * ?")//每30分钟执行一次
|
|
|
-// // @Scheduled(cron = "0 0 9 * * ?")//每天上午午9点触发
|
|
|
-// public void postageRemind()throws Exception{
|
|
|
-//
|
|
|
-// }
|
|
|
+ @Scheduled(cron = "0 0/2 * * * ?")//每30分钟执行一次
|
|
|
+ // @Scheduled(cron = "0 0 9 * * ?")//每天上午午9点触发
|
|
|
+ public void postageRemind()throws Exception{
|
|
|
+
|
|
|
+ Map<Integer,Integer> map = new HashMap<Integer,Integer>();
|
|
|
+
|
|
|
+ List<CompanyInfo> companyInfoList = companyInfoService.listCompanyInfo(new CompanyInfo());
|
|
|
+ for (CompanyInfo ci: companyInfoList ) {
|
|
|
+ /*权限去重*/
|
|
|
+ Set<Integer> authorityCustomerManagerSet = new HashSet();
|
|
|
+ Set<Integer> authorityFinancialManagerSet = new HashSet();
|
|
|
+ Set<Integer> authorityFinancialPaymentSet = new HashSet();
|
|
|
+
|
|
|
+ PostageAuthority postageAuthority = new PostageAuthority();
|
|
|
+ postageAuthority.setAuthorityStatus(1);
|
|
|
+ postageAuthority.setCompanyId(ci.getCompanyId());
|
|
|
+ List<PostageAuthority> postageAuthorityList = postageAuthorityService.getPostageAuthorityList(postageAuthority);
|
|
|
+ for (int j=0;j<postageAuthorityList.size();j++){
|
|
|
+ PostageAuthority pa = postageAuthorityList.get(j);
|
|
|
+
|
|
|
+ if(pa.getAuthorityCustomerManager() != null && pa.getAuthorityCustomerManager() != 0){
|
|
|
+ authorityCustomerManagerSet.add(pa.getAuthorityCustomerManager());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(pa.getAuthorityFinancialManager() != null && pa.getAuthorityFinancialManager() != 0){
|
|
|
+ authorityFinancialManagerSet.add(pa.getAuthorityFinancialManager());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(pa.getAuthorityFinancialPayment() != null && pa.getAuthorityFinancialPayment() != 0){
|
|
|
+ authorityFinancialPaymentSet.add(pa.getAuthorityFinancialPayment());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Postage pt = new Postage();
|
|
|
+ pt.setCompanyId(ci.getCompanyId());
|
|
|
+ pt.setPostageManagerStatus(1); //客服经理审核 1:审核中
|
|
|
+ for (Integer customerManager: authorityCustomerManagerSet) { //customerManager 为id
|
|
|
+ Integer postageNumber = postageService.getPostageNumber(pt);
|
|
|
+ if(map.get(customerManager) != null){
|
|
|
+ map.put(customerManager,postageNumber);
|
|
|
+ }else{
|
|
|
+ Integer number = map.get(customerManager);
|
|
|
+ map.put(customerManager,number + postageNumber);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ pt = new Postage();
|
|
|
+ pt.setCompanyId(ci.getCompanyId());
|
|
|
+ pt.setPostageFinanceStatus(1); //状态(财务审核) 1:审核中
|
|
|
+ for (Integer financialManager: authorityFinancialManagerSet) { //financialManager 为id
|
|
|
+ Integer postageNumber = postageService.getPostageNumber(pt);
|
|
|
+ if(map.get(financialManager) != null){
|
|
|
+ map.put(financialManager,postageNumber);
|
|
|
+ }else{
|
|
|
+ Integer number = map.get(financialManager);
|
|
|
+ map.put(financialManager,number + postageNumber);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ pt = new Postage();
|
|
|
+ pt.setCompanyId(ci.getCompanyId());
|
|
|
+ pt.setPostageFinanceStatus(2); //状态(财务审核) 2:通过(已申请待转账)
|
|
|
+ for (Integer financialPayment: authorityFinancialPaymentSet) { //financialPayment 为id
|
|
|
+ Integer postageNumber = postageService.getPostageNumber(pt);
|
|
|
+ if(map.get(financialPayment) != null){
|
|
|
+ map.put(financialPayment,postageNumber);
|
|
|
+ }else{
|
|
|
+ Integer number = map.get(financialPayment);
|
|
|
+ map.put(financialPayment,number + postageNumber);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (Map.Entry<Integer,Integer> m: map.entrySet()) {
|
|
|
+ Integer number = m.getValue();
|
|
|
+ Admin admin = new Admin();
|
|
|
+ admin.setAdminId(m.getKey());
|
|
|
+ admin = sysService.get(admin);
|
|
|
+
|
|
|
+ String tel = admin.getAdminTel();
|
|
|
+ if(admin == null || tel == null || "".equals(tel)){
|
|
|
+ logger.info("邮费转账发送待处理短信,手机号码为空,"+ tel+"===id为"+m.getKey());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String text = MessageFormat.format(REMIND_POSTAGE_PENDING,number);
|
|
|
+ smsService.sendOtherCMS(tel,text);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|