|
@@ -8,15 +8,18 @@ import com.dingtalk.api.request.OapiProcessinstanceCreateRequest;
|
|
|
import com.dingtalk.api.response.OapiProcessinstanceCreateResponse;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.taobao.api.ApiException;
|
|
|
+import net.chenlin.dp.common.openapi4j.examples.consignment.ConsignmentAdd;
|
|
|
import net.chenlin.dp.common.openapi4j.exception.OpenAPIException;
|
|
|
import net.chenlin.dp.common.openapi4j.platform.ResultService;
|
|
|
+import net.chenlin.dp.common.openapi4j.service.AcceptService;
|
|
|
+import net.chenlin.dp.common.openapi4j.service.ConsignmentService;
|
|
|
import net.chenlin.dp.common.openapi4j.util.PropUtil;
|
|
|
import net.chenlin.dp.common.support.orm.db.DynamicDataSource;
|
|
|
+import net.chenlin.dp.common.utils.SpringContextUtils;
|
|
|
import net.chenlin.dp.modules.api.controller.DingdingOpenInterface;
|
|
|
-import net.chenlin.dp.modules.api.vo.SaleOrderRest;
|
|
|
-import net.chenlin.dp.modules.api.vo.YonyouMaterial;
|
|
|
-import net.chenlin.dp.modules.api.vo.YonyouSaleOrder;
|
|
|
+import net.chenlin.dp.modules.api.vo.*;
|
|
|
import net.chenlin.dp.modules.sys.service.SysUserService;
|
|
|
+import net.chenlin.dp.modules.sys.service.impl.SysUserServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import java.util.*;
|
|
@@ -25,8 +28,8 @@ public class SaleOrderService {
|
|
|
|
|
|
private net.chenlin.dp.common.openapi4j.service.SaleOrderService saleOrderService=new net.chenlin.dp.common.openapi4j.service.SaleOrderService();
|
|
|
private DingdingOpenInterface dingdingOpenInterface=new DingdingOpenInterface();
|
|
|
-
|
|
|
-
|
|
|
+ private ConsignmentService consignmentService=new ConsignmentService();
|
|
|
+ private AcceptService acceptService=new AcceptService();
|
|
|
|
|
|
private static String getToaccount="";
|
|
|
|
|
@@ -189,7 +192,7 @@ public class SaleOrderService {
|
|
|
|
|
|
OapiProcessinstanceCreateRequest.FormComponentValueVo fc = new OapiProcessinstanceCreateRequest.FormComponentValueVo();
|
|
|
fc.setName("单据日期");
|
|
|
- fc.setValue(so.getDate());
|
|
|
+ fc.setValue(so.getDate().toString());
|
|
|
formComponentValueVoList.add(fc);
|
|
|
|
|
|
OapiProcessinstanceCreateRequest.FormComponentValueVo fc2 = new OapiProcessinstanceCreateRequest.FormComponentValueVo();
|
|
@@ -331,6 +334,77 @@ public class SaleOrderService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ * 销售发货单
|
|
|
+ * @param
|
|
|
+ * @throws OpenAPIException
|
|
|
+ */
|
|
|
+ public void ConsignMentAdd(SaleOrderFH saleOrderFH) throws OpenAPIException {
|
|
|
+ Map<String,Object>map=new HashMap<>();
|
|
|
+ map.put("consignment",saleOrderFH);
|
|
|
+ String s = JSONObject.toJSONString(map);
|
|
|
+ try {
|
|
|
+ JSONObject add = consignmentService.add(s, getToaccount);
|
|
|
+ HashMap hashMap = JSONObject.parseObject(add.toString(), HashMap.class);
|
|
|
+ Object tradeid = hashMap.get("tradeid");
|
|
|
+ if (!tradeid.equals("")&&tradeid!=null){
|
|
|
+ String result = ResultService.getResult(tradeid.toString());
|
|
|
+ System.out.println(result);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new OpenAPIException(e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ * 销售退货单
|
|
|
+ * @param body
|
|
|
+ * @throws OpenAPIException
|
|
|
+ */
|
|
|
+ public void ConsignTHAdd(SaleOrderTH saleOrderTH) throws OpenAPIException {
|
|
|
+ Map<String,Object>map=new HashMap<>();
|
|
|
+ map.put("returnorder",saleOrderTH);
|
|
|
+ String s = JSONObject.toJSONString(map);
|
|
|
+ try {
|
|
|
+ JSONObject add = saleOrderService.addTH(s, getToaccount);
|
|
|
+ HashMap hashMap = JSONObject.parseObject(add.toString(), HashMap.class);
|
|
|
+ Object tradeid = hashMap.get("tradeid");
|
|
|
+ if (!tradeid.equals("")&&tradeid!=null){
|
|
|
+ String result = ResultService.getResult(tradeid.toString());
|
|
|
+ System.out.println(result);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new OpenAPIException(e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 收款单
|
|
|
+ * @param body
|
|
|
+ * @throws OpenAPIException
|
|
|
+ */
|
|
|
+ public void acceptAdd(AcceptOrder acceptOrder) throws OpenAPIException {
|
|
|
+ Map<String,Object>map=new HashMap<>();
|
|
|
+ map.put("accept",acceptOrder);
|
|
|
+ String s = JSONObject.toJSONString(map);
|
|
|
+ try {
|
|
|
+ JSONObject add = acceptService.add(s, getToaccount);
|
|
|
+ HashMap hashMap = JSONObject.parseObject(add.toString(), HashMap.class);
|
|
|
+ Object tradeid = hashMap.get("tradeid");
|
|
|
+ if (!tradeid.equals("")&&tradeid!=null){
|
|
|
+ String result = ResultService.getResult(tradeid.toString());
|
|
|
+ System.out.println(result);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new OpenAPIException(e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public void getToaccount(){
|
|
|
Properties prop = PropUtil.getProperties("/config.properties");
|
|
@@ -340,10 +414,82 @@ public class SaleOrderService {
|
|
|
|
|
|
public static void main(String[] args) throws OpenAPIException {
|
|
|
SaleOrderService service=new SaleOrderService();
|
|
|
+ List<YonyouSaleOrder>list=new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|