Browse Source

â€提交è®订单明细(待优化)

曾成 6 years ago
parent
commit
7ba6103e87
27 changed files with 1868 additions and 32 deletions
  1. 38 0
      Api/src/main/java/com/java110/api/bmo/purchaseApplyDetail/IPurchaseApplyDetailBMO.java
  2. 97 0
      Api/src/main/java/com/java110/api/bmo/purchaseApplyDetail/impl/PurchaseApplyDetailBMOImpl.java
  3. 15 14
      Api/src/main/java/com/java110/api/listener/purchaseApply/DeletePurchaseApplyListener.java
  4. 61 0
      Api/src/main/java/com/java110/api/listener/purchaseApplyDetail/DeletePurchaseApplyDetailListener.java
  5. 88 0
      Api/src/main/java/com/java110/api/listener/purchaseApplyDetail/ListPurchaseApplyDetailsListener.java
  6. 71 0
      Api/src/main/java/com/java110/api/listener/purchaseApplyDetail/SavePurchaseApplyDetailListener.java
  7. 71 0
      Api/src/main/java/com/java110/api/listener/purchaseApplyDetail/UpdatePurchaseApplyDetailListener.java
  8. 6 0
      CommonService/.bpmn/src/main/resources/processes/resourceEnter.bpmn2d
  9. 0 6
      FrontService/src/main/java/com/java110/front/smo/purchaseApply/impl/DeletePurchaseApplySMOImpl.java
  10. 76 0
      StoreService/src/main/java/com/java110/store/dao/IPurchaseApplyDetailServiceDao.java
  11. 129 0
      StoreService/src/main/java/com/java110/store/dao/impl/PurchaseApplyDetailServiceDaoImpl.java
  12. 7 9
      StoreService/src/main/java/com/java110/store/listener/purchaseApply/AbstractPurchaseApplyBusinessServiceDataFlowListener.java
  13. 1 1
      StoreService/src/main/java/com/java110/store/listener/purchaseApply/DeletePurchaseApplyInfoListener.java
  14. 75 0
      StoreService/src/main/java/com/java110/store/listener/purchaseApplyDetail/AbstractPurchaseApplyDetailBusinessServiceDataFlowListener.java
  15. 177 0
      StoreService/src/main/java/com/java110/store/listener/purchaseApplyDetail/DeletePurchaseApplyDetailInfoListener.java
  16. 175 0
      StoreService/src/main/java/com/java110/store/listener/purchaseApplyDetail/SavePurchaseApplyDetailInfoListener.java
  17. 190 0
      StoreService/src/main/java/com/java110/store/listener/purchaseApplyDetail/UpdatePurchaseApplyDetailInfoListener.java
  18. 111 0
      StoreService/src/main/java/com/java110/store/smo/impl/PurchaseApplyDetailInnerServiceSMOImpl.java
  19. 118 0
      docs/document/services/purchaseApplyDetail/SavePurchaseApplyDetailInfo.md
  20. 68 0
      java110-bean/src/main/java/com/java110/dto/purchaseApplyDetail/PurchaseApplyDetailDto.java
  21. 53 0
      java110-bean/src/main/java/com/java110/vo/api/purchaseApplyDetail/ApiPurchaseApplyDetailDataVo.java
  22. 19 0
      java110-bean/src/main/java/com/java110/vo/api/purchaseApplyDetail/ApiPurchaseApplyDetailVo.java
  23. 43 0
      java110-core/src/main/java/com/java110/core/smo/purchaseApplyDetail/IPurchaseApplyDetailInnerServiceSMO.java
  24. 139 0
      java110-db/src/main/resources/mapper/store/PurchaseApplyDetailServiceDaoImplMapper.xml
  25. 2 2
      java110-db/src/main/resources/mapper/store/PurchaseApplyServiceDaoImplMapper.xml
  26. 7 0
      java110-utils/src/main/java/com/java110/utils/constant/BusinessTypeConstant.java
  27. 31 0
      java110-utils/src/main/java/com/java110/utils/constant/ServiceCodePurchaseApplyDetailConstant.java

+ 38 - 0
Api/src/main/java/com/java110/api/bmo/purchaseApplyDetail/IPurchaseApplyDetailBMO.java

@@ -0,0 +1,38 @@
+package com.java110.api.bmo.purchaseApplyDetail;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.IApiBaseBMO;
+import com.java110.core.context.DataFlowContext;
+
+public interface IPurchaseApplyDetailBMO extends IApiBaseBMO {
+
+
+    /**
+     * 添加订单明细
+     * @param paramInJson
+     * @param dataFlowContext
+     * @return
+     */
+     JSONObject addPurchaseApplyDetail(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+    /**
+     * 添加订单明细信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+     JSONObject updatePurchaseApplyDetail(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+    /**
+     * 删除订单明细
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+     JSONObject deletePurchaseApplyDetail(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+
+
+}

+ 97 - 0
Api/src/main/java/com/java110/api/bmo/purchaseApplyDetail/impl/PurchaseApplyDetailBMOImpl.java

@@ -0,0 +1,97 @@
+package com.java110.api.bmo.purchaseApplyDetail.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.ApiBaseBMO;
+import com.java110.api.bmo.purchaseApplyDetail.IPurchaseApplyDetailBMO;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.smo.purchaseApplyDetail.IPurchaseApplyDetailInnerServiceSMO;
+import com.java110.dto.purchaseApplyDetail.PurchaseApplyDetailDto;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.util.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("purchaseApplyDetailBMOImpl")
+public class PurchaseApplyDetailBMOImpl extends ApiBaseBMO implements IPurchaseApplyDetailBMO {
+
+    @Autowired
+    private IPurchaseApplyDetailInnerServiceSMO purchaseApplyDetailInnerServiceSMOImpl;
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public JSONObject addPurchaseApplyDetail(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_PURCHASE_APPLY_DETAIL);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessPurchaseApplyDetail = new JSONObject();
+        businessPurchaseApplyDetail.putAll(paramInJson);
+        businessPurchaseApplyDetail.put("id", "-1");
+        //计算 应收金额
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessPurchaseApplyDetail", businessPurchaseApplyDetail);
+        return business;
+    }
+
+
+    /**
+     * 添加活动信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public JSONObject updatePurchaseApplyDetail(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+        PurchaseApplyDetailDto purchaseApplyDetailDto = new PurchaseApplyDetailDto();
+        //purchaseApplyDetailDto.getApplyOrderId(paramInJson.getString("purchaseApplyDetailId"));
+        //purchaseApplyDetailDto.setCommunityId(paramInJson.getString("communityId"));
+        List<PurchaseApplyDetailDto> purchaseApplyDetailDtos = purchaseApplyDetailInnerServiceSMOImpl.queryPurchaseApplyDetails(purchaseApplyDetailDto);
+
+        Assert.listOnlyOne(purchaseApplyDetailDtos, "未找到需要修改的活动 或多条数据");
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_PURCHASE_APPLY_DETAIL);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessPurchaseApplyDetail = new JSONObject();
+        businessPurchaseApplyDetail.putAll(paramInJson);
+        //计算 应收金额
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessPurchaseApplyDetail", businessPurchaseApplyDetail);
+        return business;
+    }
+
+
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public JSONObject deletePurchaseApplyDetail(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_PURCHASE_APPLY_DETAIL);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessPurchaseApplyDetail = new JSONObject();
+        businessPurchaseApplyDetail.putAll(paramInJson);
+        //计算 应收金额
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessPurchaseApplyDetail", businessPurchaseApplyDetail);
+        return business;
+    }
+
+}

+ 15 - 14
Api/src/main/java/com/java110/api/listener/purchaseApply/DeletePurchaseApplyListener.java

@@ -18,8 +18,8 @@ import org.springframework.http.HttpMethod;
 import org.springframework.http.ResponseEntity;
 
 /**
- * 保存小区侦听
- * add by wuxw 2019-06-30
+ * 删除采购/出库订单
+ * add by zcc 2020/04/01
  */
 @Java110Listener("deletePurchaseApplyListener")
 public class DeletePurchaseApplyListener extends AbstractServiceApiListener {
@@ -28,27 +28,19 @@ public class DeletePurchaseApplyListener extends AbstractServiceApiListener {
     private IPurchaseApplyBMO purchaseApplyBMOImpl;
     @Override
     protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
-        //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
-
         Assert.hasKeyAndValue(reqJson, "applyOrderId", "订单号不能为空");
 
     }
 
     @Override
     protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
-
         HttpHeaders header = new HttpHeaders();
         context.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD, "D");
         JSONArray businesses = new JSONArray();
-
         AppService service = event.getAppService();
-
-        //添加单元信息
         businesses.add(deletePurchaseApply(reqJson, context));
-
-
+        businesses.add(deletePurchaseApplyDetail(reqJson, context));
         ResponseEntity<String> responseEntity = purchaseApplyBMOImpl.callService(context, service.getServiceCode(), businesses);
-
         context.setResponseEntity(responseEntity);
     }
 
@@ -69,15 +61,12 @@ public class DeletePurchaseApplyListener extends AbstractServiceApiListener {
 
 
     /**
-     * 添加小区信息
      *
      * @param paramInJson     接口调用放传入入参
      * @param dataFlowContext 数据上下文
      * @return 订单服务能够接受的报文
      */
     private JSONObject deletePurchaseApply(JSONObject paramInJson, DataFlowContext dataFlowContext) {
-
-
         JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
         business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_PURCHASE_APPLY);
         business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
@@ -89,4 +78,16 @@ public class DeletePurchaseApplyListener extends AbstractServiceApiListener {
         return business;
     }
 
+    //删除订单明细
+    private JSONObject deletePurchaseApplyDetail(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_PURCHASE_APPLY_DETAIL);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessPurchaseApply = new JSONObject();
+        businessPurchaseApply.putAll(paramInJson);
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessPurchaseApplyDetail", businessPurchaseApply);
+        return business;
+    }
+
 }

+ 61 - 0
Api/src/main/java/com/java110/api/listener/purchaseApplyDetail/DeletePurchaseApplyDetailListener.java

@@ -0,0 +1,61 @@
+package com.java110.api.listener.purchaseApplyDetail;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.purchaseApplyDetail.IPurchaseApplyDetailBMO;
+import com.java110.api.listener.AbstractServiceApiListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.AppService;
+import com.java110.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.constant.ServiceCodePurchaseApplyDetailConstant;
+import com.java110.utils.util.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+
+/**
+ * 删除订单明细(采购/出库明细订单)
+ * add by zcc 2020-04-09
+ */
+@Java110Listener("deletePurchaseApplyDetailListener")
+public class DeletePurchaseApplyDetailListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private IPurchaseApplyDetailBMO purchaseApplyDetailBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "applyOrderId", "订单号applyOrderId不能为空");
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+        HttpHeaders header = new HttpHeaders();
+        context.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD, "D");
+        JSONArray businesses = new JSONArray();
+        AppService service = event.getAppService();
+        businesses.add(purchaseApplyDetailBMOImpl.deletePurchaseApplyDetail(reqJson, context));
+        ResponseEntity<String> responseEntity = purchaseApplyDetailBMOImpl.callService(context, service.getServiceCode(), businesses);
+        context.setResponseEntity(responseEntity);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodePurchaseApplyDetailConstant.DELETE_PURCHASEAPPLYDETAIL;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+}

+ 88 - 0
Api/src/main/java/com/java110/api/listener/purchaseApplyDetail/ListPurchaseApplyDetailsListener.java

@@ -0,0 +1,88 @@
+package com.java110.api.listener.purchaseApplyDetail;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.listener.AbstractServiceApiListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.smo.purchaseApplyDetail.IPurchaseApplyDetailInnerServiceSMO;
+import com.java110.dto.purchaseApplyDetail.PurchaseApplyDetailDto;
+import com.java110.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.ServiceCodePurchaseApplyDetailConstant;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.api.purchaseApplyDetail.ApiPurchaseApplyDetailDataVo;
+import com.java110.vo.api.purchaseApplyDetail.ApiPurchaseApplyDetailVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * 查询小区侦听类
+ */
+@Java110Listener("listPurchaseApplyDetailsListener")
+public class ListPurchaseApplyDetailsListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private IPurchaseApplyDetailInnerServiceSMO purchaseApplyDetailInnerServiceSMOImpl;
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodePurchaseApplyDetailConstant.LIST_PURCHASEAPPLYDETAILS;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.GET;
+    }
+
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+
+    public IPurchaseApplyDetailInnerServiceSMO getPurchaseApplyDetailInnerServiceSMOImpl() {
+        return purchaseApplyDetailInnerServiceSMOImpl;
+    }
+
+    public void setPurchaseApplyDetailInnerServiceSMOImpl(IPurchaseApplyDetailInnerServiceSMO purchaseApplyDetailInnerServiceSMOImpl) {
+        this.purchaseApplyDetailInnerServiceSMOImpl = purchaseApplyDetailInnerServiceSMOImpl;
+    }
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        PurchaseApplyDetailDto purchaseApplyDetailDto = BeanConvertUtil.covertBean(reqJson, PurchaseApplyDetailDto.class);
+
+        int count = purchaseApplyDetailInnerServiceSMOImpl.queryPurchaseApplyDetailsCount(purchaseApplyDetailDto);
+
+        List<ApiPurchaseApplyDetailDataVo> purchaseApplyDetails = null;
+
+        if (count > 0) {
+            purchaseApplyDetails = BeanConvertUtil.covertBeanList(purchaseApplyDetailInnerServiceSMOImpl.queryPurchaseApplyDetails(purchaseApplyDetailDto), ApiPurchaseApplyDetailDataVo.class);
+        } else {
+            purchaseApplyDetails = new ArrayList<>();
+        }
+
+        ApiPurchaseApplyDetailVo apiPurchaseApplyDetailVo = new ApiPurchaseApplyDetailVo();
+
+        apiPurchaseApplyDetailVo.setTotal(count);
+        apiPurchaseApplyDetailVo.setRecords((int) Math.ceil((double) count / (double) reqJson.getInteger("row")));
+        apiPurchaseApplyDetailVo.setPurchaseApplyDetails(purchaseApplyDetails);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiPurchaseApplyDetailVo), HttpStatus.OK);
+
+        context.setResponseEntity(responseEntity);
+
+    }
+}

+ 71 - 0
Api/src/main/java/com/java110/api/listener/purchaseApplyDetail/SavePurchaseApplyDetailListener.java

@@ -0,0 +1,71 @@
+package com.java110.api.listener.purchaseApplyDetail;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.purchaseApplyDetail.IPurchaseApplyDetailBMO;
+import com.java110.api.listener.AbstractServiceApiListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.AppService;
+import com.java110.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.constant.ServiceCodePurchaseApplyDetailConstant;
+import com.java110.utils.util.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+/**
+ * 保存小区侦听
+ * add by wuxw 2019-06-30
+ */
+@Java110Listener("savePurchaseApplyDetailListener")
+public class SavePurchaseApplyDetailListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private IPurchaseApplyDetailBMO purchaseApplyDetailBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
+
+        Assert.hasKeyAndValue(reqJson, "applyOrderId", "请求报文中未包含applyOrderId");
+        Assert.hasKeyAndValue(reqJson, "resId", "请求报文中未包含resId");
+        Assert.hasKeyAndValue(reqJson, "quantity", "请求报文中未包含quantity");
+
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        HttpHeaders header = new HttpHeaders();
+        context.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD, "D");
+        JSONArray businesses = new JSONArray();
+
+        AppService service = event.getAppService();
+
+        //添加单元信息
+        businesses.add(purchaseApplyDetailBMOImpl.addPurchaseApplyDetail(reqJson, context));
+
+        ResponseEntity<String> responseEntity = purchaseApplyDetailBMOImpl.callService(context, service.getServiceCode(), businesses);
+
+        context.setResponseEntity(responseEntity);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodePurchaseApplyDetailConstant.ADD_PURCHASEAPPLYDETAIL;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+}

+ 71 - 0
Api/src/main/java/com/java110/api/listener/purchaseApplyDetail/UpdatePurchaseApplyDetailListener.java

@@ -0,0 +1,71 @@
+package com.java110.api.listener.purchaseApplyDetail;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.purchaseApplyDetail.IPurchaseApplyDetailBMO;
+import com.java110.api.listener.AbstractServiceApiListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.AppService;
+import com.java110.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.constant.ServiceCodePurchaseApplyDetailConstant;
+import com.java110.utils.util.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+
+/**
+ * 保存订单明细侦听
+ * add by wuxw 2019-06-30
+ */
+@Java110Listener("updatePurchaseApplyDetailListener")
+public class UpdatePurchaseApplyDetailListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private IPurchaseApplyDetailBMO purchaseApplyDetailBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+
+        Assert.hasKeyAndValue(reqJson, "id", "id不能为空");
+        Assert.hasKeyAndValue(reqJson, "applyOrderId", "请求报文中未包含applyOrderId");
+        Assert.hasKeyAndValue(reqJson, "resId", "请求报文中未包含resId");
+        Assert.hasKeyAndValue(reqJson, "quantity", "请求报文中未包含quantity");
+
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        HttpHeaders header = new HttpHeaders();
+        context.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD, "D");
+        JSONArray businesses = new JSONArray();
+
+        AppService service = event.getAppService();
+
+        //添加单元信息
+        businesses.add(purchaseApplyDetailBMOImpl.updatePurchaseApplyDetail(reqJson, context));
+
+        ResponseEntity<String> responseEntity = purchaseApplyDetailBMOImpl.callService(context, service.getServiceCode(), businesses);
+
+        context.setResponseEntity(responseEntity);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodePurchaseApplyDetailConstant.UPDATE_PURCHASEAPPLYDETAIL;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+}

+ 6 - 0
CommonService/.bpmn/src/main/resources/processes/resourceEnter.bpmn2d

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="ASCII"?>
+<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="BPMNdiagram" name="resourceEnter" snapToGrid="true" version="0.11.0">
+  <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/>
+  <colors red="227" green="238" blue="249"/>
+  <colors red="255" green="255" blue="255"/>
+</pi:Diagram>

+ 0 - 6
FrontService/src/main/java/com/java110/front/smo/purchaseApply/impl/DeletePurchaseApplySMOImpl.java

@@ -25,13 +25,7 @@ public class DeletePurchaseApplySMOImpl extends AbstractComponentSMO implements
     @Override
     protected void validate(IPageData pd, JSONObject paramIn) {
 
-        //super.validatePageInfo(pd);
-
-        //Assert.hasKeyAndValue(paramIn, "xxx", "xxx");
         Assert.hasKeyAndValue(paramIn, "applyOrderId", "订单号不能为空");
-
-
-
         //super.checkUserHasPrivilege(pd, restTemplate, PrivilegeCodeConstant.AGENT_HAS_LIST_PURCHASEAPPLY);
 
     }

+ 76 - 0
StoreService/src/main/java/com/java110/store/dao/IPurchaseApplyDetailServiceDao.java

@@ -0,0 +1,76 @@
+package com.java110.store.dao;
+
+
+import com.java110.utils.exception.DAOException;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 订单明细组件内部之间使用,没有给外围系统提供服务能力
+ * 订单明细服务接口类,要求全部以字符串传输,方便微服务化
+ * 新建客户,修改客户,删除客户,查询客户等功能
+ *
+ * Created by wuxw on 2016/12/27.
+ */
+public interface IPurchaseApplyDetailServiceDao {
+
+    /**
+     * 保存 订单明细信息
+     * @param businessPurchaseApplyDetailInfo 订单明细信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    void saveBusinessPurchaseApplyDetailInfo(Map businessPurchaseApplyDetailInfo) throws DAOException;
+
+
+
+    /**
+     * 查询订单明细信息(business过程)
+     * 根据bId 查询订单明细信息
+     * @param info bId 信息
+     * @return 订单明细信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getBusinessPurchaseApplyDetailInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 保存 订单明细信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void savePurchaseApplyDetailInfoInstance(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询订单明细信息(instance过程)
+     * 根据bId 查询订单明细信息
+     * @param info bId 信息
+     * @return 订单明细信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getPurchaseApplyDetailInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改订单明细信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updatePurchaseApplyDetailInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询订单明细总数
+     *
+     * @param info 订单明细信息
+     * @return 订单明细数量
+     */
+    int queryPurchaseApplyDetailsCount(Map info);
+
+}

+ 129 - 0
StoreService/src/main/java/com/java110/store/dao/impl/PurchaseApplyDetailServiceDaoImpl.java

@@ -0,0 +1,129 @@
+package com.java110.store.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.store.dao.IPurchaseApplyDetailServiceDao;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+import com.java110.core.base.dao.BaseServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 订单明细服务 与数据库交互
+ * Created by wuxw on 2017/4/5.
+ */
+@Service("purchaseApplyDetailServiceDaoImpl")
+//@Transactional
+public class PurchaseApplyDetailServiceDaoImpl extends BaseServiceDao implements IPurchaseApplyDetailServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(PurchaseApplyDetailServiceDaoImpl.class);
+
+    /**
+     * 订单明细信息封装
+     * @param businessPurchaseApplyDetailInfo 订单明细信息 封装
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveBusinessPurchaseApplyDetailInfo(Map businessPurchaseApplyDetailInfo) throws DAOException {
+        businessPurchaseApplyDetailInfo.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存订单明细信息 入参 businessPurchaseApplyDetailInfo : {}",businessPurchaseApplyDetailInfo);
+        int saveFlag = sqlSessionTemplate.insert("purchaseApplyDetailServiceDaoImpl.saveBusinessPurchaseApplyDetailInfo",businessPurchaseApplyDetailInfo);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存订单明细数据失败:"+ JSONObject.toJSONString(businessPurchaseApplyDetailInfo));
+        }
+    }
+
+
+    /**
+     * 查询订单明细信息
+     * @param info bId 信息
+     * @return 订单明细信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getBusinessPurchaseApplyDetailInfo(Map info) throws DAOException {
+
+        logger.debug("查询订单明细信息 入参 info : {}",info);
+
+        List<Map> businessPurchaseApplyDetailInfos = sqlSessionTemplate.selectList("purchaseApplyDetailServiceDaoImpl.getBusinessPurchaseApplyDetailInfo",info);
+
+        return businessPurchaseApplyDetailInfos;
+    }
+
+
+
+    /**
+     * 保存订单明细信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void savePurchaseApplyDetailInfoInstance(Map info) throws DAOException {
+        logger.debug("保存订单明细信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("purchaseApplyDetailServiceDaoImpl.savePurchaseApplyDetailInfoInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存订单明细信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+
+    /**
+     * 查询订单明细信息(instance)
+     * @param info bId 信息
+     * @return List<Map>
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getPurchaseApplyDetailInfo(Map info) throws DAOException {
+        logger.debug("查询订单明细信息 入参 info : {}",info);
+
+        List<Map> businessPurchaseApplyDetailInfos = sqlSessionTemplate.selectList("purchaseApplyDetailServiceDaoImpl.getPurchaseApplyDetailInfo",info);
+
+        return businessPurchaseApplyDetailInfos;
+    }
+
+
+    /**
+     * 修改订单明细信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updatePurchaseApplyDetailInfoInstance(Map info) throws DAOException {
+        logger.debug("修改订单明细信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("purchaseApplyDetailServiceDaoImpl.updatePurchaseApplyDetailInfoInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改订单明细信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+     /**
+     * 查询订单明细数量
+     * @param info 订单明细信息
+     * @return 订单明细数量
+     */
+    @Override
+    public int queryPurchaseApplyDetailsCount(Map info) {
+        logger.debug("查询订单明细数据 入参 info : {}",info);
+
+        List<Map> businessPurchaseApplyDetailInfos = sqlSessionTemplate.selectList("purchaseApplyDetailServiceDaoImpl.queryPurchaseApplyDetailsCount", info);
+        if (businessPurchaseApplyDetailInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessPurchaseApplyDetailInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 7 - 9
StoreService/src/main/java/com/java110/store/listener/purchaseApply/AbstractPurchaseApplyBusinessServiceDataFlowListener.java

@@ -69,18 +69,16 @@ public abstract class AbstractPurchaseApplyBusinessServiceDataFlowListener exten
         Map currentPurchaseApplyInfo = currentPurchaseApplyInfos.get(0);
 
         currentPurchaseApplyInfo.put("bId", business.getbId());
-
         currentPurchaseApplyInfo.put("operate", currentPurchaseApplyInfo.get("operate"));
-        currentPurchaseApplyInfo.put("applyDetailId", currentPurchaseApplyInfo.get("apply_detail_id"));
-        currentPurchaseApplyInfo.put("resOrderType", currentPurchaseApplyInfo.get("res_order_type"));
+        currentPurchaseApplyInfo.put("applyDetailId", currentPurchaseApplyInfo.get("applyDetailId"));
+        currentPurchaseApplyInfo.put("resOrderType", currentPurchaseApplyInfo.get("resOrderType"));
         currentPurchaseApplyInfo.put("description", currentPurchaseApplyInfo.get("description"));
-        currentPurchaseApplyInfo.put("applyOrderId", currentPurchaseApplyInfo.get("apply_order_id"));
+        currentPurchaseApplyInfo.put("applyOrderId", currentPurchaseApplyInfo.get("applyOrderId"));
         currentPurchaseApplyInfo.put("state", currentPurchaseApplyInfo.get("state"));
-        currentPurchaseApplyInfo.put("storeId", currentPurchaseApplyInfo.get("store_id"));
-        currentPurchaseApplyInfo.put("entryPerson", currentPurchaseApplyInfo.get("entry_person"));
-        currentPurchaseApplyInfo.put("userId", currentPurchaseApplyInfo.get("user_id"));
-
-
+        currentPurchaseApplyInfo.put("storeId", currentPurchaseApplyInfo.get("storeId"));
+        currentPurchaseApplyInfo.put("userId", currentPurchaseApplyInfo.get("userId"));
+        currentPurchaseApplyInfo.put("userName", currentPurchaseApplyInfo.get("userName"));
+        currentPurchaseApplyInfo.put("createTime", currentPurchaseApplyInfo.get("createTime"));
         currentPurchaseApplyInfo.put("operate", StatusConstant.OPERATE_DEL);
         getPurchaseApplyServiceDaoImpl().saveBusinessPurchaseApplyInfo(currentPurchaseApplyInfo);
     }

+ 1 - 1
StoreService/src/main/java/com/java110/store/listener/purchaseApply/DeletePurchaseApplyInfoListener.java

@@ -101,7 +101,7 @@ public class DeletePurchaseApplyInfoListener extends AbstractPurchaseApplyBusine
         info.put("bId",business.getbId());
         info.put("operate",StatusConstant.OPERATE_DEL);
 
-        //采购申请信息
+
         List<Map> businessPurchaseApplyInfos = purchaseApplyServiceDaoImpl.getBusinessPurchaseApplyInfo(info);
         if( businessPurchaseApplyInfos != null && businessPurchaseApplyInfos.size() >0) {
             for (int _purchaseApplyIndex = 0; _purchaseApplyIndex < businessPurchaseApplyInfos.size();_purchaseApplyIndex++) {

+ 75 - 0
StoreService/src/main/java/com/java110/store/listener/purchaseApplyDetail/AbstractPurchaseApplyDetailBusinessServiceDataFlowListener.java

@@ -0,0 +1,75 @@
+package com.java110.store.listener.purchaseApplyDetail;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.entity.center.Business;
+import com.java110.event.service.AbstractBusinessServiceDataFlowListener;
+import com.java110.store.dao.IPurchaseApplyDetailServiceDao;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.ListenerExecuteException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 订单明细 服务侦听 父类
+ * Created by wuxw on 2018/7/4.
+ */
+public abstract class AbstractPurchaseApplyDetailBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener {
+    private static Logger logger = LoggerFactory.getLogger(AbstractPurchaseApplyDetailBusinessServiceDataFlowListener.class);
+
+
+    /**
+     * 获取 DAO工具类
+     *
+     * @return
+     */
+    public abstract IPurchaseApplyDetailServiceDao getPurchaseApplyDetailServiceDaoImpl();
+
+    /**
+     * 刷新 businessPurchaseApplyDetailInfo 数据
+     * 主要将 数据库 中字段和 接口传递字段建立关系
+     *
+     * @param businessPurchaseApplyDetailInfo
+     */
+    protected void flushBusinessPurchaseApplyDetailInfo(Map businessPurchaseApplyDetailInfo, String statusCd) {
+        businessPurchaseApplyDetailInfo.put("newBId", businessPurchaseApplyDetailInfo.get("b_id"));
+        businessPurchaseApplyDetailInfo.put("operate", businessPurchaseApplyDetailInfo.get("operate"));
+        businessPurchaseApplyDetailInfo.put("applyOrderId", businessPurchaseApplyDetailInfo.get("apply_order_id"));
+        businessPurchaseApplyDetailInfo.put("id", businessPurchaseApplyDetailInfo.get("id"));
+        businessPurchaseApplyDetailInfo.put("resId", businessPurchaseApplyDetailInfo.get("res_id"));
+        businessPurchaseApplyDetailInfo.remove("bId");
+        businessPurchaseApplyDetailInfo.put("statusCd", statusCd);
+    }
+
+
+    /**
+     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     *
+     * @param businessPurchaseApplyDetail 订单明细信息
+     */
+    protected void autoSaveDelBusinessPurchaseApplyDetail(Business business, JSONObject businessPurchaseApplyDetail) {
+//自动插入DEL
+        Map info = new HashMap();
+        info.put("applyOrderId", businessPurchaseApplyDetail.getString("applyOrderId"));
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        List<Map> currentPurchaseApplyDetailInfos = getPurchaseApplyDetailServiceDaoImpl().getPurchaseApplyDetailInfo(info);
+        if (currentPurchaseApplyDetailInfos == null || currentPurchaseApplyDetailInfos.size() != 1) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
+        }
+        Map currentPurchaseApplyDetailInfo = currentPurchaseApplyDetailInfos.get(0);
+        currentPurchaseApplyDetailInfo.put("bId", business.getbId());
+        currentPurchaseApplyDetailInfo.put("operate", currentPurchaseApplyDetailInfo.get("operate"));
+        currentPurchaseApplyDetailInfo.put("applyOrderId", currentPurchaseApplyDetailInfo.get("applyOrderId"));
+        currentPurchaseApplyDetailInfo.put("resId", currentPurchaseApplyDetailInfo.get("resId"));
+        currentPurchaseApplyDetailInfo.put("remark", currentPurchaseApplyDetailInfo.get("remark"));
+        currentPurchaseApplyDetailInfo.put("quantity", currentPurchaseApplyDetailInfo.get("quantity"));
+        currentPurchaseApplyDetailInfo.put("operate", StatusConstant.OPERATE_DEL);
+        getPurchaseApplyDetailServiceDaoImpl().saveBusinessPurchaseApplyDetailInfo(currentPurchaseApplyDetailInfo);
+    }
+
+
+}

+ 177 - 0
StoreService/src/main/java/com/java110/store/listener/purchaseApplyDetail/DeletePurchaseApplyDetailInfoListener.java

@@ -0,0 +1,177 @@
+package com.java110.store.listener.purchaseApplyDetail;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.IPurchaseApplyDetailServiceDao;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.ListenerExecuteException;
+import com.java110.utils.util.Assert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 删除订单明细信息 侦听
+ *
+ * 处理节点
+ * 1、businessPurchaseApplyDetail:{} 订单明细基本信息节点
+ * 2、businessPurchaseApplyDetailAttr:[{}] 订单明细属性信息节点
+ * 3、businessPurchaseApplyDetailPhoto:[{}] 订单明细照片信息节点
+ * 4、businessPurchaseApplyDetailCerdentials:[{}] 订单明细证件信息节点
+ * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E5%88%A0%E9%99%A4%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("deletePurchaseApplyDetailInfoListener")
+@Transactional
+public class DeletePurchaseApplyDetailInfoListener extends AbstractPurchaseApplyDetailBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeletePurchaseApplyDetailInfoListener.class);
+    @Autowired
+    IPurchaseApplyDetailServiceDao purchaseApplyDetailServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_PURCHASE_APPLY_DETAIL;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessPurchaseApplyDetail 节点
+        if(data.containsKey("businessPurchaseApplyDetail")){
+            //处理 businessPurchaseApplyDetail 节点
+            if(data.containsKey("businessPurchaseApplyDetail")){
+                Object _obj = data.get("businessPurchaseApplyDetail");
+                JSONArray businessPurchaseApplyDetails = null;
+                if(_obj instanceof JSONObject){
+                    businessPurchaseApplyDetails = new JSONArray();
+                    businessPurchaseApplyDetails.add(_obj);
+                }else {
+                    businessPurchaseApplyDetails = (JSONArray)_obj;
+                }
+                //JSONObject businessPurchaseApplyDetail = data.getJSONObject("businessPurchaseApplyDetail");
+                for (int _purchaseApplyDetailIndex = 0; _purchaseApplyDetailIndex < businessPurchaseApplyDetails.size();_purchaseApplyDetailIndex++) {
+                    JSONObject businessPurchaseApplyDetail = businessPurchaseApplyDetails.getJSONObject(_purchaseApplyDetailIndex);
+                    doBusinessPurchaseApplyDetail(business, businessPurchaseApplyDetail);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("id", businessPurchaseApplyDetail.getString("id"));
+                    }
+                }
+            }
+        }
+
+
+    }
+
+    /**
+     * 删除 instance数据
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+
+        //订单明细信息
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_DEL);
+
+        //订单明细信息
+        List<Map> businessPurchaseApplyDetailInfos = purchaseApplyDetailServiceDaoImpl.getBusinessPurchaseApplyDetailInfo(info);
+        if( businessPurchaseApplyDetailInfos != null && businessPurchaseApplyDetailInfos.size() >0) {
+            for (int _purchaseApplyDetailIndex = 0; _purchaseApplyDetailIndex < businessPurchaseApplyDetailInfos.size();_purchaseApplyDetailIndex++) {
+                Map businessPurchaseApplyDetailInfo = businessPurchaseApplyDetailInfos.get(_purchaseApplyDetailIndex);
+                flushBusinessPurchaseApplyDetailInfo(businessPurchaseApplyDetailInfo,StatusConstant.STATUS_CD_INVALID);
+                purchaseApplyDetailServiceDaoImpl.updatePurchaseApplyDetailInfoInstance(businessPurchaseApplyDetailInfo);
+                dataFlowContext.addParamOut("id",businessPurchaseApplyDetailInfo.get("id"));
+            }
+        }
+
+    }
+
+    /**
+     * 撤单
+     * 从business表中查询到DEL的数据 将instance中的数据更新回来
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+        Map info = new HashMap();
+        info.put("bId",bId);
+        info.put("statusCd",StatusConstant.STATUS_CD_INVALID);
+
+        Map delInfo = new HashMap();
+        delInfo.put("bId",business.getbId());
+        delInfo.put("operate",StatusConstant.OPERATE_DEL);
+        //订单明细信息
+        List<Map> purchaseApplyDetailInfo = purchaseApplyDetailServiceDaoImpl.getPurchaseApplyDetailInfo(info);
+        if(purchaseApplyDetailInfo != null && purchaseApplyDetailInfo.size() > 0){
+
+            //订单明细信息
+            List<Map> businessPurchaseApplyDetailInfos = purchaseApplyDetailServiceDaoImpl.getBusinessPurchaseApplyDetailInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessPurchaseApplyDetailInfos == null ||  businessPurchaseApplyDetailInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(purchaseApplyDetail),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _purchaseApplyDetailIndex = 0; _purchaseApplyDetailIndex < businessPurchaseApplyDetailInfos.size();_purchaseApplyDetailIndex++) {
+                Map businessPurchaseApplyDetailInfo = businessPurchaseApplyDetailInfos.get(_purchaseApplyDetailIndex);
+                flushBusinessPurchaseApplyDetailInfo(businessPurchaseApplyDetailInfo,StatusConstant.STATUS_CD_VALID);
+                purchaseApplyDetailServiceDaoImpl.updatePurchaseApplyDetailInfoInstance(businessPurchaseApplyDetailInfo);
+            }
+        }
+    }
+
+
+
+    /**
+     * 处理 businessPurchaseApplyDetail 节点
+     * @param business 总的数据节点
+     * @param businessPurchaseApplyDetail 订单明细节点
+     */
+    private void doBusinessPurchaseApplyDetail(Business business,JSONObject businessPurchaseApplyDetail){
+        Assert.jsonObjectHaveKey(businessPurchaseApplyDetail,"applyOrderId","businessPurchaseApplyDetail 节点下没有包含 applyOrderId 节点");
+        if(businessPurchaseApplyDetail.getString("applyOrderId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"applyOrderId 错误,不能自动生成(必须已经存在的applyOrderId)"+businessPurchaseApplyDetail);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessPurchaseApplyDetail(business,businessPurchaseApplyDetail);
+    }
+
+
+    @Override
+    public IPurchaseApplyDetailServiceDao getPurchaseApplyDetailServiceDaoImpl() {
+        return purchaseApplyDetailServiceDaoImpl;
+    }
+
+    public void setPurchaseApplyDetailServiceDaoImpl(IPurchaseApplyDetailServiceDao purchaseApplyDetailServiceDaoImpl) {
+        this.purchaseApplyDetailServiceDaoImpl = purchaseApplyDetailServiceDaoImpl;
+    }
+}

+ 175 - 0
StoreService/src/main/java/com/java110/store/listener/purchaseApplyDetail/SavePurchaseApplyDetailInfoListener.java

@@ -0,0 +1,175 @@
+package com.java110.store.listener.purchaseApplyDetail;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.IPurchaseApplyDetailServiceDao;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.util.Assert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 保存 订单明细信息 侦听
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("savePurchaseApplyDetailInfoListener")
+@Transactional
+public class SavePurchaseApplyDetailInfoListener extends AbstractPurchaseApplyDetailBusinessServiceDataFlowListener{
+
+    private static Logger logger = LoggerFactory.getLogger(SavePurchaseApplyDetailInfoListener.class);
+
+    @Autowired
+    private IPurchaseApplyDetailServiceDao purchaseApplyDetailServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_PURCHASE_APPLY_DETAIL;
+    }
+
+    /**
+     * 保存订单明细信息 business 表中
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessPurchaseApplyDetail 节点
+        if(data.containsKey("businessPurchaseApplyDetail")){
+            Object bObj = data.get("businessPurchaseApplyDetail");
+            JSONArray businessPurchaseApplyDetails = null;
+            if(bObj instanceof JSONObject){
+                businessPurchaseApplyDetails = new JSONArray();
+                businessPurchaseApplyDetails.add(bObj);
+            }else {
+                businessPurchaseApplyDetails = (JSONArray)bObj;
+            }
+            //JSONObject businessPurchaseApplyDetail = data.getJSONObject("businessPurchaseApplyDetail");
+            for (int bPurchaseApplyDetailIndex = 0; bPurchaseApplyDetailIndex < businessPurchaseApplyDetails.size();bPurchaseApplyDetailIndex++) {
+                JSONObject businessPurchaseApplyDetail = businessPurchaseApplyDetails.getJSONObject(bPurchaseApplyDetailIndex);
+                doBusinessPurchaseApplyDetail(business, businessPurchaseApplyDetail);
+                if(bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("id", businessPurchaseApplyDetail.getString("id"));
+                }
+            }
+        }
+    }
+
+    /**
+     * business 数据转移到 instance
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_ADD);
+
+        //订单明细信息
+        List<Map> businessPurchaseApplyDetailInfo = purchaseApplyDetailServiceDaoImpl.getBusinessPurchaseApplyDetailInfo(info);
+        if( businessPurchaseApplyDetailInfo != null && businessPurchaseApplyDetailInfo.size() >0) {
+            reFreshShareColumn(info, businessPurchaseApplyDetailInfo.get(0));
+            purchaseApplyDetailServiceDaoImpl.savePurchaseApplyDetailInfoInstance(info);
+            if(businessPurchaseApplyDetailInfo.size() == 1) {
+                dataFlowContext.addParamOut("id", businessPurchaseApplyDetailInfo.get(0).get("id"));
+            }
+        }
+    }
+
+
+    /**
+     * 刷 分片字段
+     *
+     * @param info         查询对象
+     * @param businessInfo 小区ID
+     */
+    private void reFreshShareColumn(Map info, Map businessInfo) {
+
+        if (info.containsKey("storeId")) {
+            return;
+        }
+
+        if (!businessInfo.containsKey("store_id")) {
+            return;
+        }
+
+        info.put("storeId", businessInfo.get("store_id"));
+    }
+    /**
+     * 撤单
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+        Map info = new HashMap();
+        info.put("bId",bId);
+        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
+        Map paramIn = new HashMap();
+        paramIn.put("bId",bId);
+        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
+        //订单明细信息
+        List<Map> purchaseApplyDetailInfo = purchaseApplyDetailServiceDaoImpl.getPurchaseApplyDetailInfo(info);
+        if(purchaseApplyDetailInfo != null && purchaseApplyDetailInfo.size() > 0){
+            reFreshShareColumn(paramIn, purchaseApplyDetailInfo.get(0));
+            purchaseApplyDetailServiceDaoImpl.updatePurchaseApplyDetailInfoInstance(paramIn);
+        }
+    }
+
+
+
+    /**
+     * 处理 businessPurchaseApplyDetail 节点
+     * @param business 总的数据节点
+     * @param businessPurchaseApplyDetail 订单明细节点
+     */
+    private void doBusinessPurchaseApplyDetail(Business business,JSONObject businessPurchaseApplyDetail){
+
+        Assert.jsonObjectHaveKey(businessPurchaseApplyDetail,"id","businessPurchaseApplyDetail 节点下没有包含 id 节点");
+
+        if(businessPurchaseApplyDetail.getString("id").startsWith("-")){
+            //刷新缓存
+            //flushPurchaseApplyDetailId(business.getDatas());
+
+            businessPurchaseApplyDetail.put("id",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_id));
+
+        }
+
+        businessPurchaseApplyDetail.put("bId",business.getbId());
+        businessPurchaseApplyDetail.put("operate", StatusConstant.OPERATE_ADD);
+        //保存订单明细信息
+        purchaseApplyDetailServiceDaoImpl.saveBusinessPurchaseApplyDetailInfo(businessPurchaseApplyDetail);
+
+    }
+
+    public IPurchaseApplyDetailServiceDao getPurchaseApplyDetailServiceDaoImpl() {
+        return purchaseApplyDetailServiceDaoImpl;
+    }
+
+    public void setPurchaseApplyDetailServiceDaoImpl(IPurchaseApplyDetailServiceDao purchaseApplyDetailServiceDaoImpl) {
+        this.purchaseApplyDetailServiceDaoImpl = purchaseApplyDetailServiceDaoImpl;
+    }
+}

+ 190 - 0
StoreService/src/main/java/com/java110/store/listener/purchaseApplyDetail/UpdatePurchaseApplyDetailInfoListener.java

@@ -0,0 +1,190 @@
+package com.java110.store.listener.purchaseApplyDetail;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.store.dao.IPurchaseApplyDetailServiceDao;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.ListenerExecuteException;
+import com.java110.utils.util.Assert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 修改订单明细信息 侦听
+ *
+ * 处理节点
+ * 1、businessPurchaseApplyDetail:{} 订单明细基本信息节点
+ * 2、businessPurchaseApplyDetailAttr:[{}] 订单明细属性信息节点
+ * 3、businessPurchaseApplyDetailPhoto:[{}] 订单明细照片信息节点
+ * 4、businessPurchaseApplyDetailCerdentials:[{}] 订单明细证件信息节点
+ * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("updatePurchaseApplyDetailInfoListener")
+@Transactional
+public class UpdatePurchaseApplyDetailInfoListener extends AbstractPurchaseApplyDetailBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdatePurchaseApplyDetailInfoListener.class);
+    @Autowired
+    private IPurchaseApplyDetailServiceDao purchaseApplyDetailServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_PURCHASE_APPLY_DETAIL;
+    }
+
+    /**
+     * business过程
+     * @param dataFlowContext 上下文对象
+     * @param business 业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessPurchaseApplyDetail 节点
+        if(data.containsKey("businessPurchaseApplyDetail")){
+            //处理 businessPurchaseApplyDetail 节点
+            if(data.containsKey("businessPurchaseApplyDetail")){
+                Object _obj = data.get("businessPurchaseApplyDetail");
+                JSONArray businessPurchaseApplyDetails = null;
+                if(_obj instanceof JSONObject){
+                    businessPurchaseApplyDetails = new JSONArray();
+                    businessPurchaseApplyDetails.add(_obj);
+                }else {
+                    businessPurchaseApplyDetails = (JSONArray)_obj;
+                }
+                //JSONObject businessPurchaseApplyDetail = data.getJSONObject("businessPurchaseApplyDetail");
+                for (int _purchaseApplyDetailIndex = 0; _purchaseApplyDetailIndex < businessPurchaseApplyDetails.size();_purchaseApplyDetailIndex++) {
+                    JSONObject businessPurchaseApplyDetail = businessPurchaseApplyDetails.getJSONObject(_purchaseApplyDetailIndex);
+                    doBusinessPurchaseApplyDetail(business, businessPurchaseApplyDetail);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("id", businessPurchaseApplyDetail.getString("id"));
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * business to instance 过程
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_ADD);
+
+        //订单明细信息
+        List<Map> businessPurchaseApplyDetailInfos = purchaseApplyDetailServiceDaoImpl.getBusinessPurchaseApplyDetailInfo(info);
+        if( businessPurchaseApplyDetailInfos != null && businessPurchaseApplyDetailInfos.size() >0) {
+            for (int _purchaseApplyDetailIndex = 0; _purchaseApplyDetailIndex < businessPurchaseApplyDetailInfos.size();_purchaseApplyDetailIndex++) {
+                Map businessPurchaseApplyDetailInfo = businessPurchaseApplyDetailInfos.get(_purchaseApplyDetailIndex);
+                flushBusinessPurchaseApplyDetailInfo(businessPurchaseApplyDetailInfo,StatusConstant.STATUS_CD_VALID);
+                purchaseApplyDetailServiceDaoImpl.updatePurchaseApplyDetailInfoInstance(businessPurchaseApplyDetailInfo);
+                if(businessPurchaseApplyDetailInfo.size() == 1) {
+                    dataFlowContext.addParamOut("id", businessPurchaseApplyDetailInfo.get("id"));
+                }
+            }
+        }
+
+    }
+
+    /**
+     * 撤单
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
+
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+        Map info = new HashMap();
+        info.put("bId",bId);
+        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
+        Map delInfo = new HashMap();
+        delInfo.put("bId",business.getbId());
+        delInfo.put("operate",StatusConstant.OPERATE_DEL);
+        //订单明细信息
+        List<Map> purchaseApplyDetailInfo = purchaseApplyDetailServiceDaoImpl.getPurchaseApplyDetailInfo(info);
+        if(purchaseApplyDetailInfo != null && purchaseApplyDetailInfo.size() > 0){
+
+            //订单明细信息
+            List<Map> businessPurchaseApplyDetailInfos = purchaseApplyDetailServiceDaoImpl.getBusinessPurchaseApplyDetailInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessPurchaseApplyDetailInfos == null || businessPurchaseApplyDetailInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(purchaseApplyDetail),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _purchaseApplyDetailIndex = 0; _purchaseApplyDetailIndex < businessPurchaseApplyDetailInfos.size();_purchaseApplyDetailIndex++) {
+                Map businessPurchaseApplyDetailInfo = businessPurchaseApplyDetailInfos.get(_purchaseApplyDetailIndex);
+                flushBusinessPurchaseApplyDetailInfo(businessPurchaseApplyDetailInfo,StatusConstant.STATUS_CD_VALID);
+                purchaseApplyDetailServiceDaoImpl.updatePurchaseApplyDetailInfoInstance(businessPurchaseApplyDetailInfo);
+            }
+        }
+
+    }
+
+
+
+    /**
+     * 处理 businessPurchaseApplyDetail 节点
+     * @param business 总的数据节点
+     * @param businessPurchaseApplyDetail 订单明细节点
+     */
+    private void doBusinessPurchaseApplyDetail(Business business,JSONObject businessPurchaseApplyDetail){
+
+        Assert.jsonObjectHaveKey(businessPurchaseApplyDetail,"id","businessPurchaseApplyDetail 节点下没有包含 id 节点");
+
+        if(businessPurchaseApplyDetail.getString("id").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"id 错误,不能自动生成(必须已经存在的id)"+businessPurchaseApplyDetail);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessPurchaseApplyDetail(business,businessPurchaseApplyDetail);
+
+        businessPurchaseApplyDetail.put("bId",business.getbId());
+        businessPurchaseApplyDetail.put("operate", StatusConstant.OPERATE_ADD);
+        //保存订单明细信息
+        purchaseApplyDetailServiceDaoImpl.saveBusinessPurchaseApplyDetailInfo(businessPurchaseApplyDetail);
+
+    }
+
+
+
+
+    public IPurchaseApplyDetailServiceDao getPurchaseApplyDetailServiceDaoImpl() {
+        return purchaseApplyDetailServiceDaoImpl;
+    }
+
+    public void setPurchaseApplyDetailServiceDaoImpl(IPurchaseApplyDetailServiceDao purchaseApplyDetailServiceDaoImpl) {
+        this.purchaseApplyDetailServiceDaoImpl = purchaseApplyDetailServiceDaoImpl;
+    }
+
+
+
+}

+ 111 - 0
StoreService/src/main/java/com/java110/store/smo/impl/PurchaseApplyDetailInnerServiceSMOImpl.java

@@ -0,0 +1,111 @@
+package com.java110.store.smo.impl;
+
+
+import com.java110.dto.purchaseApplyDetail.PurchaseApplyDetailDto;
+import com.java110.store.dao.IPurchaseApplyDetailServiceDao;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.smo.purchaseApplyDetail.IPurchaseApplyDetailInnerServiceSMO;
+import com.java110.core.smo.user.IUserInnerServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.user.UserDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName FloorInnerServiceSMOImpl
+ * @Description 订单明细内部服务实现类
+ * @Author wuxw
+ * @Date 2019/4/24 9:20
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@RestController
+public class PurchaseApplyDetailInnerServiceSMOImpl extends BaseServiceSMO implements IPurchaseApplyDetailInnerServiceSMO {
+
+    @Autowired
+    private IPurchaseApplyDetailServiceDao purchaseApplyDetailServiceDaoImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Override
+    public List<PurchaseApplyDetailDto> queryPurchaseApplyDetails(@RequestBody  PurchaseApplyDetailDto purchaseApplyDetailDto) {
+
+        //校验是否传了 分页信息
+
+        int page = purchaseApplyDetailDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            purchaseApplyDetailDto.setPage((page - 1) * purchaseApplyDetailDto.getRow());
+        }
+
+        List<PurchaseApplyDetailDto> purchaseApplyDetails = BeanConvertUtil.covertBeanList(purchaseApplyDetailServiceDaoImpl.getPurchaseApplyDetailInfo(BeanConvertUtil.beanCovertMap(purchaseApplyDetailDto)), PurchaseApplyDetailDto.class);
+
+        if (purchaseApplyDetails == null || purchaseApplyDetails.size() == 0) {
+            return purchaseApplyDetails;
+        }
+
+//        //String[] userIds = getUserIds(purchaseApplyDetails);
+//        //根据 userId 查询用户信息
+//        List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds);
+
+//        for (PurchaseApplyDetailDto purchaseApplyDetail : purchaseApplyDetails) {
+//            refreshPurchaseApplyDetail(purchaseApplyDetail, users);
+//        }
+        return purchaseApplyDetails;
+    }
+
+//    /**
+//     * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
+//     *
+//     * @param purchaseApplyDetail 小区订单明细信息
+//     * @param users 用户列表
+//     */
+//    private void refreshPurchaseApplyDetail(PurchaseApplyDetailDto purchaseApplyDetail, List<UserDto> users) {
+//        for (UserDto user : users) {
+//            if (purchaseApplyDetail.getUserId().equals(user.getUserId())) {
+//                BeanConvertUtil.covertBean(user, purchaseApplyDetail);
+//            }
+//        }
+//    }
+
+//    /**
+//     * 获取批量userId
+//     *
+//     * @param purchaseApplyDetails 小区楼信息
+//     * @return 批量userIds 信息
+//     */
+//    private String[] getUserIds(List<PurchaseApplyDetailDto> purchaseApplyDetails) {
+//        List<String> userIds = new ArrayList<String>();
+//        for (PurchaseApplyDetailDto purchaseApplyDetail : purchaseApplyDetails) {
+//            userIds.add(purchaseApplyDetail.getUserId());
+//        }
+//
+//        return userIds.toArray(new String[userIds.size()]);
+//    }
+
+    @Override
+    public int queryPurchaseApplyDetailsCount(@RequestBody PurchaseApplyDetailDto purchaseApplyDetailDto) {
+        return purchaseApplyDetailServiceDaoImpl.queryPurchaseApplyDetailsCount(BeanConvertUtil.beanCovertMap(purchaseApplyDetailDto));    }
+
+    public IPurchaseApplyDetailServiceDao getPurchaseApplyDetailServiceDaoImpl() {
+        return purchaseApplyDetailServiceDaoImpl;
+    }
+
+    public void setPurchaseApplyDetailServiceDaoImpl(IPurchaseApplyDetailServiceDao purchaseApplyDetailServiceDaoImpl) {
+        this.purchaseApplyDetailServiceDaoImpl = purchaseApplyDetailServiceDaoImpl;
+    }
+
+    public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
+        return userInnerServiceSMOImpl;
+    }
+
+    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
+        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
+    }
+}

+ 118 - 0
docs/document/services/purchaseApplyDetail/SavePurchaseApplyDetailInfo.md

@@ -0,0 +1,118 @@
+
+
+**1\. 保存订单明细**
+###### 接口功能
+> API服务做保存订单明细时调用该接口
+
+###### URL
+> [http://purchaseApplyDetail-service/purchaseApplyDetailApi/service](http://purchaseApplyDetail-service/purchaseApplyDetailApi/service)
+
+###### 支持格式
+> JSON
+
+###### HTTP请求方式
+> POST
+
+###### 协议接口
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-:|
+|-|orders|1|Object|-|订单节点|-|
+|-|business|1|Array|-|业务节点|-|
+
+###### orders
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|orders|1|Object|-|订单节点|-|
+|orders|appId|1|String|10|系统ID|由中心服务提供|
+|orders|transactionId|1|String|30|交互流水|appId+'00'+YYYYMMDD+10位序列|
+|orders|userId|1|String|30|用户ID|已有用户ID|
+|orders|orderTypeCd|1|String|4|订单类型|查看订单类型说明|
+|orders|requestTime|1|String|14|请求时间|YYYYMMDDhhmmss|
+|orders|remark|1|String|200|备注|备注|
+|orders|sign|?|String|64|签名|查看加密说明|
+|orders|attrs|?|Array|-|订单属性|-|
+|attrs|specCd|1|String|12|规格编码|由中心服务提供|
+|attrs|value|1|String|50|属性值|-|
+|orders|response|1|Object|-|返回结果节点|-|
+|response|code|1|String|4|返回状态|查看状态说明|
+|response|message|1|String|200|返回状态描述|-|
+
+###### business
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|business|?|Array|-|业务节点|-|
+|business|businessTypeCd|1|String|12|业务类型编码|500100030002|
+|business|datas|1|Object|-|数据节点|不同的服务下的节点不一样|
+|datas|businessPurchaseApplyDetailInfo|1|Object|-|小区成员|小区成员|
+|businessPurchaseApplyDetailInfo|applyOrderId|1|String|30|-|-|
+|businessPurchaseApplyDetailInfo|id|1|String|30|-|-|
+|businessPurchaseApplyDetailInfo|resId|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://purchaseApplyDetail-service/purchaseApplyDetailApi/service](http://purchaseApplyDetail-service/purchaseApplyDetailApi/service)
+
+``` javascript
+请求头信息:
+Content-Type:application/json
+
+请求报文:
+
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "businessType":"I",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": {
+    "businessTypeCd": "210100060001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessPurchaseApplyDetailInfo": {
+                "applyOrderId":"填写具体值",
+        "id":"填写具体值",
+        "resId":"填写具体值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 68 - 0
java110-bean/src/main/java/com/java110/dto/purchaseApplyDetail/PurchaseApplyDetailDto.java

@@ -0,0 +1,68 @@
+package com.java110.dto.purchaseApplyDetail;
+
+import com.java110.dto.PageDto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @ClassName FloorDto
+ * @Description 订单明细数据层封装
+ * @Author wuxw
+ * @Date 2019/4/24 8:52
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+public class PurchaseApplyDetailDto extends PageDto implements Serializable {
+
+    private String applyOrderId;
+    private String id;
+    private String resId;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getApplyOrderId() {
+        return applyOrderId;
+    }
+
+    public void setApplyOrderId(String applyOrderId) {
+        this.applyOrderId = applyOrderId;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getResId() {
+        return resId;
+    }
+
+    public void setResId(String resId) {
+        this.resId = resId;
+    }
+
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+}

+ 53 - 0
java110-bean/src/main/java/com/java110/vo/api/purchaseApplyDetail/ApiPurchaseApplyDetailDataVo.java

@@ -0,0 +1,53 @@
+package com.java110.vo.api.purchaseApplyDetail;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class ApiPurchaseApplyDetailDataVo implements Serializable {
+
+    private String operate;
+private String applyOrderId;
+private String statusCd;
+private String id;
+private String bId;
+private String resId;
+public String getOperate() {
+        return operate;
+    }
+public void setOperate(String operate) {
+        this.operate = operate;
+    }
+public String getApplyOrderId() {
+        return applyOrderId;
+    }
+public void setApplyOrderId(String applyOrderId) {
+        this.applyOrderId = applyOrderId;
+    }
+public String getStatusCd() {
+        return statusCd;
+    }
+public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+public String getId() {
+        return id;
+    }
+public void setId(String id) {
+        this.id = id;
+    }
+public String getBId() {
+        return bId;
+    }
+public void setBId(String bId) {
+        this.bId = bId;
+    }
+public String getResId() {
+        return resId;
+    }
+public void setResId(String resId) {
+        this.resId = resId;
+    }
+
+
+
+}

+ 19 - 0
java110-bean/src/main/java/com/java110/vo/api/purchaseApplyDetail/ApiPurchaseApplyDetailVo.java

@@ -0,0 +1,19 @@
+package com.java110.vo.api.purchaseApplyDetail;
+
+import com.java110.vo.MorePageVo;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class ApiPurchaseApplyDetailVo extends MorePageVo implements Serializable {
+    List<ApiPurchaseApplyDetailDataVo> purchaseApplyDetails;
+
+
+    public List<ApiPurchaseApplyDetailDataVo> getPurchaseApplyDetails() {
+        return purchaseApplyDetails;
+    }
+
+    public void setPurchaseApplyDetails(List<ApiPurchaseApplyDetailDataVo> purchaseApplyDetails) {
+        this.purchaseApplyDetails = purchaseApplyDetails;
+    }
+}

+ 43 - 0
java110-core/src/main/java/com/java110/core/smo/purchaseApplyDetail/IPurchaseApplyDetailInnerServiceSMO.java

@@ -0,0 +1,43 @@
+package com.java110.core.smo.purchaseApplyDetail;
+
+import com.java110.core.feign.FeignConfiguration;
+import com.java110.dto.purchaseApplyDetail.PurchaseApplyDetailDto;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+
+/**
+ * @ClassName IPurchaseApplyDetailInnerServiceSMO
+ * @Description 订单明细接口类
+ * @Author wuxw
+ * @Date 2019/4/24 9:04
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@FeignClient(name = "store-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/purchaseApplyDetailApi")
+public interface IPurchaseApplyDetailInnerServiceSMO {
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param purchaseApplyDetailDto 数据对象分享
+     * @return PurchaseApplyDetailDto 对象数据
+     */
+    @RequestMapping(value = "/queryPurchaseApplyDetails", method = RequestMethod.POST)
+    List<PurchaseApplyDetailDto> queryPurchaseApplyDetails(@RequestBody PurchaseApplyDetailDto purchaseApplyDetailDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param purchaseApplyDetailDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryPurchaseApplyDetailsCount", method = RequestMethod.POST)
+    int queryPurchaseApplyDetailsCount(@RequestBody PurchaseApplyDetailDto purchaseApplyDetailDto);
+}

+ 139 - 0
java110-db/src/main/resources/mapper/store/PurchaseApplyDetailServiceDaoImplMapper.xml

@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="purchaseApplyDetailServiceDaoImpl">
+
+    <!-- 保存订单明细信息 add by wuxw 2018-07-03 -->
+    <insert id="saveBusinessPurchaseApplyDetailInfo" parameterType="Map">
+           insert into business_purchase_apply_detail
+                (operate,apply_order_id,b_id,res_id,quantity,remark,status_cd) values
+           (#{operate},#{applyOrderId},#{bId},#{resId},#{quantity},#{remark},#{statusCd})
+       </insert>
+
+
+    <!-- 查询订单明细信息(Business) add by wuxw 2018-07-03 -->
+    <select id="getBusinessPurchaseApplyDetailInfo" parameterType="Map" resultType="Map">
+        select
+            t.operate,t.apply_order_id,t.apply_order_id applyOrderId,
+            t.b_id,t.b_id bId,t.res_id,t.res_id resId
+        from business_purchase_apply_detail t
+        where 1 =1
+        <if test="operate !=null and operate != ''">
+            and t.operate= #{operate}
+        </if>
+        <if test="applyOrderId !=null and applyOrderId != ''">
+            and t.apply_order_id= #{applyOrderId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="resId !=null and resId != ''">
+            and t.res_id= #{resId}
+        </if>
+
+    </select>
+
+
+    <!-- 保存订单明细信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="savePurchaseApplyDetailInfoInstance" parameterType="Map">
+        insert into purchase_apply_detail(
+        apply_order_id,status_cd,id,b_id,res_id
+        ) select t.apply_order_id,'0',t.id,t.b_id,t.res_id from business_purchase_apply_detail t where 1=1
+        and t.operate= 'ADD'
+        <if test="applyOrderId !=null and applyOrderId != ''">
+            and t.apply_order_id= #{applyOrderId}
+        </if>
+        <if test="id !=null and id != ''">
+            and t.id= #{id}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="resId !=null and resId != ''">
+            and t.res_id= #{resId}
+        </if>
+
+    </insert>
+
+
+    <!-- 查询订单明细信息 add by wuxw 2018-07-03 -->
+    <select id="getPurchaseApplyDetailInfo" parameterType="Map" resultType="Map">
+        select
+        t.apply_order_id applyOrderId,
+        t.status_cd statusCd,
+        t.b_id bId,
+        t.res_id resId,
+        t.remark remark,
+        t.quantity quantity
+        from purchase_apply_detail t
+        where 1 =1
+        <if test="applyOrderId !=null and applyOrderId != ''">
+            and t.apply_order_id= #{applyOrderId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="id !=null and id != ''">
+            and t.id= #{id}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="resId !=null and resId != ''">
+            and t.res_id= #{resId}
+        </if>
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+
+    </select>
+
+
+    <!-- 修改订单明细信息 add by wuxw 2018-07-03 -->
+    <update id="updatePurchaseApplyDetailInfoInstance" parameterType="Map">
+        update purchase_apply_detail t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="applyOrderId !=null and applyOrderId != ''">
+            , t.apply_order_id= #{applyOrderId}
+        </if>
+        <if test="resId !=null and resId != ''">
+            , t.res_id= #{resId}
+        </if>
+        where 1=1
+        <if test="id !=null and id != ''">
+            and t.id= #{id}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+
+    </update>
+
+    <!-- 查询订单明细数量 add by wuxw 2018-07-03 -->
+    <select id="queryPurchaseApplyDetailsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from purchase_apply_detail t
+        where 1 =1
+        <if test="applyOrderId !=null and applyOrderId != ''">
+            and t.apply_order_id= #{applyOrderId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="id !=null and id != ''">
+            and t.id= #{id}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="resId !=null and resId != ''">
+            and t.res_id= #{resId}
+        </if>
+
+
+    </select>
+
+</mapper>

+ 2 - 2
java110-db/src/main/resources/mapper/store/PurchaseApplyServiceDaoImplMapper.xml

@@ -171,7 +171,7 @@
             t.res_order_type resOrderType,t.description,
             t.apply_order_id applyOrderId,t.status_cd statusCd,t.state,
             t.store_id storeId,t.user_name userName,
-            t.b_id bId,t.user_id userId,t.create_time createTime,d.name stateName,
+            t.b_id bId,t.user_id userId,t.create_time createTime,d.name stateName
         from purchase_apply t
         inner join t_dict d on t.state = d.status_cd and d.table_name = 'purchase_apply' and d.table_columns = 'state'
         where 1 =1
@@ -215,7 +215,7 @@
         t.apply_order_id applyOrderId,t.status_cd statusCd,t.state,
         t.store_id storeId,t.user_name userName,
         t.b_id bId,t.user_id userId,t.create_time createTime,d.name stateName,
-        de.apply_order_id applyOrderId,de.res_id resId,de.quantity,de.remark,de.id,rs.res_name resName,rs.price,rs.stock,rs.res_code resCode
+        de.apply_order_id applyOrderId,de.res_id resId,de.quantity,de.remark,rs.res_name resName,rs.price,rs.stock,rs.res_code resCode
         from purchase_apply t
         inner join t_dict d on t.state = d.status_cd and d.table_name = 'purchase_apply' and d.table_columns = 'state'
         inner join purchase_apply_detail de on de.apply_order_id = t.apply_order_id

+ 7 - 0
java110-utils/src/main/java/com/java110/utils/constant/BusinessTypeConstant.java

@@ -184,6 +184,13 @@ public class BusinessTypeConstant {
      */
     public static final String BUSINESS_TYPE_DELETE_PURCHASE_APPLY = "210100050001";
 
+    //采购,出库 新增订单明细
+    public static final String BUSINESS_TYPE_SAVE_PURCHASE_APPLY_DETAIL = "210100060001";
+    //采购/出库 修改订单明细
+    public static final String BUSINESS_TYPE_UPDATE_PURCHASE_APPLY_DETAIL = "210100070001";
+    //采购,出库 删除订单明细
+    public static final String BUSINESS_TYPE_DELETE_PURCHASE_APPLY_DETAIL = "210100080001";
+
 
 
 

+ 31 - 0
java110-utils/src/main/java/com/java110/utils/constant/ServiceCodePurchaseApplyDetailConstant.java

@@ -0,0 +1,31 @@
+package com.java110.utils.constant;
+
+/**
+ * 订单明细常量类
+ * Created by wuxw on 2017/5/20.
+ */
+public class ServiceCodePurchaseApplyDetailConstant {
+
+    /**
+     * 添加 订单明细
+     */
+    public static final String ADD_PURCHASEAPPLYDETAIL = "purchaseApplyDetail.savePurchaseApplyDetail";
+
+
+    /**
+     * 修改 订单明细
+     */
+    public static final String UPDATE_PURCHASEAPPLYDETAIL = "purchaseApplyDetail.updatePurchaseApplyDetail";
+    /**
+     * 删除 订单明细
+     */
+    public static final String DELETE_PURCHASEAPPLYDETAIL = "purchaseApplyDetail.deletePurchaseApplyDetail";
+
+
+    /**
+     * 查询 订单明细
+     */
+    public static final String LIST_PURCHASEAPPLYDETAILS = "purchaseApplyDetail.listPurchaseApplyDetails";
+
+
+}