java110-utils/src/main/java/com/java110/utils/constant/ServiceCodeAuditUserConstant.java
@@ -59,5 +59,10 @@ */ public static final String LIST_ALLOCATION_STORE_AUDITORDERS = "resourceStore.listAllocationStoreAuditOrders"; /** * 查询 审核订单 */ public static final String LIST_ALLOCATION_STORE_HISTORY_AUDITORDERS = "resourceStore.listAllocationStoreHisAuditOrders"; } service-api/src/main/java/com/java110/api/listener/resourceStore/ListAllocationStoreHisAuditOrders.java
New file @@ -0,0 +1,83 @@ package com.java110.api.listener.resourceStore; 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.event.service.api.ServiceDataFlowEvent; import com.java110.dto.allocationStorehouse.AllocationStorehouseDto; import com.java110.entity.audit.AuditUser; import com.java110.intf.common.IAllocationStorehouseUserInnerServiceSMO; import com.java110.utils.constant.ServiceCodeAuditUserConstant; import com.java110.utils.util.Assert; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import java.util.ArrayList; import java.util.List; /** * 查询待审核调拨单 */ @Java110Listener("listAllocationStoreAuditHistoryOrdersListener") public class ListAllocationStoreHisAuditOrders extends AbstractServiceApiListener { @Autowired private IAllocationStorehouseUserInnerServiceSMO allocationStorehouseUserInnerServiceSMOImpl; @Override public String getServiceCode() { return ServiceCodeAuditUserConstant.LIST_ALLOCATION_STORE_HISTORY_AUDITORDERS; } @Override public HttpMethod getHttpMethod() { return HttpMethod.GET; } @Override public int getOrder() { return DEFAULT_ORDER; } @Override protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { Assert.hasKeyAndValue(reqJson, "storeId", "必填,请填写商户ID"); Assert.hasKeyAndValue(reqJson, "userId", "必填,请填写用户ID"); Assert.hasKeyAndValue(reqJson, "row", "必填,请填写每页显示数"); Assert.hasKeyAndValue(reqJson, "page", "必填,请填写页数"); super.validatePageInfo(reqJson); } @Override protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { AuditUser auditUser = new AuditUser(); auditUser.setUserId(reqJson.getString("userId")); auditUser.setPage(reqJson.getInteger("page")); auditUser.setRow(reqJson.getInteger("row")); auditUser.setStoreId(reqJson.getString("storeId")); long count = allocationStorehouseUserInnerServiceSMOImpl.getUserHistoryTaskCount(auditUser); List<AllocationStorehouseDto> purchaseApplyDtos = null; if (count > 0) { purchaseApplyDtos = allocationStorehouseUserInnerServiceSMOImpl.getUserHistoryTasks(auditUser); } else { purchaseApplyDtos = new ArrayList<>(); } ResponseEntity responseEntity = ResultVo.createResponseEntity((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), (int) count, purchaseApplyDtos); context.setResponseEntity(responseEntity); } } service-api/src/main/java/com/java110/api/listener/resourceStore/SaveAllocationStorehouseListener.java
@@ -6,8 +6,11 @@ import com.java110.core.annotation.Java110Listener; import com.java110.core.context.DataFlowContext; import com.java110.core.event.service.api.ServiceDataFlowEvent; import com.java110.core.factory.GenerateCodeFactory; import com.java110.dto.allocationStorehouse.AllocationStorehouseDto; import com.java110.dto.purchaseApply.PurchaseApplyDto; import com.java110.dto.resourceStore.ResourceStoreDto; import com.java110.intf.common.IAllocationStorehouseUserInnerServiceSMO; import com.java110.intf.store.IResourceStoreInnerServiceSMO; import com.java110.po.allocationStorehouse.AllocationStorehousePo; import com.java110.po.purchase.ResourceStorePo; @@ -17,6 +20,8 @@ import com.java110.utils.util.BeanConvertUtil; 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.List; @@ -32,6 +37,9 @@ @Autowired private IResourceStoreInnerServiceSMO resourceStoreInnerServiceSMOImpl; @Autowired private IAllocationStorehouseUserInnerServiceSMO allocationStorehouseUserInnerServiceSMOImpl; @Override protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { @@ -69,7 +77,7 @@ @Override protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { reqJson.put("asId", "-1"); reqJson.put("asId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_allocationStorehouseId)); AllocationStorehousePo allocationStorehousePo = BeanConvertUtil.covertBean(reqJson, AllocationStorehousePo.class); allocationStorehousePo.setRemark(reqJson.getString("remark")); allocationStorehousePo.setStartUserId(reqJson.getString("userId")); @@ -87,6 +95,17 @@ int stockB = Integer.parseInt(reqJson.getString("stock")); resourceStorePo.setStock((stockA - stockB) + ""); super.update(context, resourceStorePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_RESOURCE_STORE); commit(context); ResponseEntity<String> responseEntity = context.getResponseEntity(); //开始流程 if (HttpStatus.OK == responseEntity.getStatusCode()) { AllocationStorehouseDto allocationStorehouseDto = BeanConvertUtil.covertBean(reqJson, AllocationStorehouseDto.class); allocationStorehouseDto.setCurrentUserId(reqJson.getString("userId")); allocationStorehouseUserInnerServiceSMOImpl.startProcess(allocationStorehouseDto); } context.setResponseEntity(responseEntity); } @Override service-common/src/main/java/com/java110/common/smo/impl/AllocationStorehouseUserInnerServiceSMOImpl.java
@@ -173,7 +173,7 @@ //开启流程 //WorkflowDto.DEFAULT_PROCESS + workflowDto.getFlowId() WorkflowDto workflowDto = new WorkflowDto(); workflowDto.setFlowType(WorkflowDto.FLOW_TYPE_CONTRACT_APPLY); workflowDto.setFlowType(WorkflowDto.FLOW_TYPE_ALLOCATION_STOREHOUSE); workflowDto.setStoreId(storeId); List<WorkflowDto> workflowDtos = workflowInnerServiceSMOImpl.queryWorkflows(workflowDto); Assert.listOnlyOne(workflowDtos, "未找到 投诉建议流程或找到多条,请在物业账号系统管理下流程管理中配置流程");