|
|
@@ -12,9 +12,14 @@ 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.uas.platform.b2b.dao.DeputyOrderDao;
|
|
|
+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.DeputyPaymentCompany;
|
|
|
import com.uas.platform.b2b.service.DeputyOrderService;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
import com.uas.platform.core.logging.BufferedLoggerManager;
|
|
|
@@ -37,6 +42,12 @@ public class DeputyOrderDownController {
|
|
|
@Autowired
|
|
|
private DeputyOrderDao deputyOrderDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DeputyEnterpriseDao deputyEnterpriseDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DeputyPaymentCompanyDao deputyPaymentCompanyDao;
|
|
|
+
|
|
|
/**
|
|
|
* 买家ERP从平台获取代采订单
|
|
|
*
|
|
|
@@ -68,4 +79,57 @@ public class DeputyOrderDownController {
|
|
|
deputyOrderDao.save(deOrder);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新维护付款企业信息
|
|
|
+ *
|
|
|
+ * @param data
|
|
|
+ * @throws UnsupportedEncodingException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/payCompany", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public void saveOrUpdatePayCompany(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
+ String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
+ DeputyPaymentCompany company = JSON.parseObject(jsonStr, DeputyPaymentCompany.class);
|
|
|
+ DeputyPaymentCompany deCompany = new DeputyPaymentCompany();
|
|
|
+ // 先判断维护企业是不是代采企业
|
|
|
+ DeputyEnterprise enterprise = deputyEnterpriseDao.findByDeputyenuu(SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ if (enterprise == null) {
|
|
|
+ enterprise = new DeputyEnterprise();
|
|
|
+ enterprise.setDate(new Date());
|
|
|
+ enterprise.setDeputyenuu(SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ enterprise.setUseruu(SystemSession.getUser().getUserUU());
|
|
|
+ enterprise.setEnuu(SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ deputyEnterpriseDao.save(enterprise);
|
|
|
+ deCompany = deputyPaymentCompanyDao.findByEnuuAndEnname(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
+ company.getEnname());
|
|
|
+ if (deCompany != null) {
|
|
|
+ deCompany.setAddress(company.getAddress());
|
|
|
+ deCompany.setDepuseruu(SystemSession.getUser().getUserUU());
|
|
|
+ deCompany.setUser(company.getUser());
|
|
|
+ deCompany.setUsertel(company.getUsertel());
|
|
|
+ deCompany.setDate(new Date());
|
|
|
+ deputyPaymentCompanyDao.save(deCompany);
|
|
|
+ logger.log("付款企业", "更新付款企业信息", 1);
|
|
|
+ } else {
|
|
|
+ deputyPaymentCompanyDao.save(company);
|
|
|
+ logger.log("付款企业", "新增付款企业信息", 1);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ deCompany = deputyPaymentCompanyDao.findByEnuuAndEnname(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
+ company.getEnname());
|
|
|
+ if (deCompany != null) {
|
|
|
+ deCompany.setAddress(company.getAddress());
|
|
|
+ deCompany.setDepuseruu(SystemSession.getUser().getUserUU());
|
|
|
+ deCompany.setUser(company.getUser());
|
|
|
+ deCompany.setUsertel(company.getUsertel());
|
|
|
+ deCompany.setDate(new Date());
|
|
|
+ deputyPaymentCompanyDao.save(deCompany);
|
|
|
+ logger.log("付款企业", "更新付款企业信息", 1);
|
|
|
+ } else {
|
|
|
+ deputyPaymentCompanyDao.save(company);
|
|
|
+ logger.log("付款企业", "新增付款企业信息", 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|