|
|
@@ -1,38 +1,35 @@
|
|
|
package com.uas.platform.b2b.erp.controller;
|
|
|
|
|
|
-import java.io.UnsupportedEncodingException;
|
|
|
-import java.net.URLDecoder;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Controller;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
-
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.uas.platform.b2b.dao.DeOrderDeleteLogDao;
|
|
|
import com.uas.platform.b2b.dao.DeputyOrderDao;
|
|
|
import com.uas.platform.b2b.dao.DeputyOrdersLogDao;
|
|
|
import com.uas.platform.b2b.dao.DeputyPaymentCompanyDao;
|
|
|
import com.uas.platform.b2b.erp.support.ErpBufferedLogger;
|
|
|
import com.uas.platform.b2b.mobile.dao.DeputyEnterpriseDao;
|
|
|
-import com.uas.platform.b2b.model.DeputyEnterprise;
|
|
|
-import com.uas.platform.b2b.model.DeputyOrder;
|
|
|
-import com.uas.platform.b2b.model.DeputyOrdersLog;
|
|
|
-import com.uas.platform.b2b.model.DeputyPaymentCompany;
|
|
|
+import com.uas.platform.b2b.model.*;
|
|
|
import com.uas.platform.b2b.service.DeputyOrderService;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
import com.uas.platform.core.logging.BufferedLoggerManager;
|
|
|
import com.uas.platform.core.model.Status;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.net.URLDecoder;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* ERP下载平台的代采订单
|
|
|
- *
|
|
|
+ *
|
|
|
* @author hejq
|
|
|
* @time 创建时间:2017年3月24日
|
|
|
*/
|
|
|
@@ -57,9 +54,12 @@ public class DeputyOrderDownController {
|
|
|
@Autowired
|
|
|
private DeputyOrdersLogDao deputyOrdersLogDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DeOrderDeleteLogDao deOrderDeleteLogDao;
|
|
|
+
|
|
|
/**
|
|
|
* 买家ERP从平台获取代采订单
|
|
|
- *
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(method = RequestMethod.GET)
|
|
|
@@ -69,10 +69,10 @@ public class DeputyOrderDownController {
|
|
|
logger.log("代采定单", "下载客户的代采订单", deOrders.size());
|
|
|
return deOrders;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 将已存入的数据id返回,更新下载状态
|
|
|
- *
|
|
|
+ *
|
|
|
* @param data
|
|
|
* @throws UnsupportedEncodingException
|
|
|
*/
|
|
|
@@ -95,7 +95,7 @@ public class DeputyOrderDownController {
|
|
|
|
|
|
/**
|
|
|
* 更新维护付款企业信息
|
|
|
- *
|
|
|
+ *
|
|
|
* @param data
|
|
|
* @throws UnsupportedEncodingException
|
|
|
*/
|
|
|
@@ -148,7 +148,7 @@ public class DeputyOrderDownController {
|
|
|
|
|
|
/**
|
|
|
* 将重复的数据返回,保存记录
|
|
|
- *
|
|
|
+ *
|
|
|
* @param data
|
|
|
* @throws UnsupportedEncodingException
|
|
|
*/
|
|
|
@@ -174,7 +174,7 @@ public class DeputyOrderDownController {
|
|
|
|
|
|
/**
|
|
|
* 代采订单传输日志
|
|
|
- *
|
|
|
+ *
|
|
|
* @param data
|
|
|
* @throws UnsupportedEncodingException
|
|
|
*/
|
|
|
@@ -203,7 +203,7 @@ public class DeputyOrderDownController {
|
|
|
|
|
|
/**
|
|
|
* ERP审核不通过的单据传回来更新状态
|
|
|
- *
|
|
|
+ *
|
|
|
* @param data
|
|
|
* @throws UnsupportedEncodingException
|
|
|
*/
|
|
|
@@ -234,7 +234,7 @@ public class DeputyOrderDownController {
|
|
|
|
|
|
/**
|
|
|
* ERP审核通过的单据传回来更新状态
|
|
|
- *
|
|
|
+ *
|
|
|
* @param data
|
|
|
* @throws UnsupportedEncodingException
|
|
|
*/
|
|
|
@@ -244,8 +244,9 @@ public class DeputyOrderDownController {
|
|
|
String codeStr = URLDecoder.decode(data, "UTF-8");
|
|
|
List<DeputyOrder> orders = JSONObject.parseArray(codeStr, DeputyOrder.class);
|
|
|
List<DeputyOrder> deOrders = new ArrayList<DeputyOrder>();
|
|
|
- if (CollectionUtils.isEmpty(orders)) {
|
|
|
+ if (!CollectionUtils.isEmpty(orders)) {
|
|
|
for (DeputyOrder order : orders) {
|
|
|
+ // 发现ERP很多没有fromcode,所以更新为salecode
|
|
|
DeputyOrder deOrder = deputyOrderDao.findByCodeAndDeputyuuAndDownloadstatus(order.getCode(),
|
|
|
SystemSession.getUser().getEnterprise().getUu(), "已下载");
|
|
|
if (deOrder != null) {
|
|
|
@@ -260,4 +261,38 @@ public class DeputyOrderDownController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取客户删除订单的记录,同步到ERP进行删除处理
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/deletelogs", method = RequestMethod.GET)
|
|
|
+ public List<DeOrderDeleteLog> getLogs() {
|
|
|
+ List<DeOrderDeleteLog> logs = deOrderDeleteLogDao
|
|
|
+ .findByDeputyuuAndStatus(SystemSession.getUser().getEnterprise().getUu(), Status.NOT_UPLOAD.value());
|
|
|
+ logger.log("代采定单", "下载客户订单删除记录", logs.size());
|
|
|
+ return logs;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取客户删除订单的记录,同步到ERP进行删除处理
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws UnsupportedEncodingException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/deletelogs/back", method = RequestMethod.POST)
|
|
|
+ public void updateDeleteLogs(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
+ String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
+ String idStr[] = jsonStr.split(",");
|
|
|
+ for (String id : idStr) {
|
|
|
+ if (id != null) {
|
|
|
+ DeOrderDeleteLog log = deOrderDeleteLogDao.findOne(Long.valueOf(id));
|
|
|
+ if (null != log) {
|
|
|
+ log.setStatus(Status.DOWNLOADED.value());
|
|
|
+ log.setDate(new Date());
|
|
|
+ deOrderDeleteLogDao.save(log);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|