| | |
| | | Assert.hasKeyAndValue(reqJson, "storeId", "必填,请填写商户信息"); |
| | | //Assert.hasKeyAndValue(reqJson, "resCode", "必填,请填写物品编码"); |
| | | Assert.hasKeyAndValue(reqJson, "price", "必填,请填写物品价格"); |
| | | Assert.hasKeyAndValue(reqJson, "stock", "必填,请填写物品库存"); |
| | | Assert.hasKeyAndValue(reqJson, "description", "必填,请填写描述"); |
| | | /*Assert.hasKeyAndValue(reqJson, "stock", "必填,请填写物品库存"); |
| | | Assert.hasKeyAndValue(reqJson, "description", "必填,请填写描述");*/ |
| | | |
| | | } |
| | | |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.listener.AbstractServiceApiListener; |
| | | import com.java110.core.smo.resourceStore.IResourceStoreInnerServiceSMO; |
| | | import com.java110.dto.resourceStore.ResourceStoreDto; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.constant.CommonConstant; |
| | | import com.java110.utils.constant.ServiceCodeConstant; |
| | |
| | | import com.java110.entity.center.AppService; |
| | | import com.java110.event.service.api.ServiceDataFlowEvent; |
| | | import com.java110.utils.constant.ServiceCodeResourceStoreConstant; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 保存物品管理侦听 |
| | |
| | | */ |
| | | @Java110Listener("updateResourceStoreListener") |
| | | public class UpdateResourceStoreListener extends AbstractServiceApiListener { |
| | | |
| | | @Autowired |
| | | private IResourceStoreInnerServiceSMO resourceStoreInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | |
| | |
| | | Assert.hasKeyAndValue(reqJson, "resName", "必填,请填写物品名称"); |
| | | //Assert.hasKeyAndValue(reqJson, "resCode", "必填,请填写物品编码"); |
| | | Assert.hasKeyAndValue(reqJson, "price", "必填,请填写物品价格"); |
| | | Assert.hasKeyAndValue(reqJson, "stock", "必填,请填写物品库存"); |
| | | Assert.hasKeyAndValue(reqJson, "description", "必填,请填写描述"); |
| | | //Assert.hasKeyAndValue(reqJson, "stock", "必填,请填写物品库存"); |
| | | //Assert.hasKeyAndValue(reqJson, "description", "必填,请填写描述"); |
| | | Assert.hasKeyAndValue(reqJson, "storeId", "商户信息不能为空"); |
| | | |
| | | } |
| | |
| | | */ |
| | | private JSONObject updateResourceStore(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | ResourceStoreDto resourceStoreDto = new ResourceStoreDto(); |
| | | resourceStoreDto.setResId(paramInJson.getString("resId")); |
| | | resourceStoreDto.setStoreId(paramInJson.getString("storeId")); |
| | | |
| | | List<ResourceStoreDto> resourceStoreDtos = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto); |
| | | |
| | | Assert.isOne(resourceStoreDtos, "查询到多条物品 或未查到物品,resId=" + resourceStoreDto.getResId()); |
| | | |
| | | |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_RESOURCE_STORE); |
| | |
| | | business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S); |
| | | JSONObject businessResourceStore = new JSONObject(); |
| | | businessResourceStore.putAll(paramInJson); |
| | | businessResourceStore.put("stock", resourceStoreDtos.get(0).getStock()); |
| | | //计算 应收金额 |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessResourceStore", businessResourceStore); |
| | | return business; |
| | | } |
| | | |
| | | public IResourceStoreInnerServiceSMO getResourceStoreInnerServiceSMOImpl() { |
| | | return resourceStoreInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public void setResourceStoreInnerServiceSMOImpl(IResourceStoreInnerServiceSMO resourceStoreInnerServiceSMOImpl) { |
| | | this.resourceStoreInnerServiceSMOImpl = resourceStoreInnerServiceSMOImpl; |
| | | } |
| | | } |
| | |
| | | Assert.hasKeyAndValue(paramIn, "resName", "必填,请填写物品名称"); |
| | | //Assert.hasKeyAndValue(paramIn, "resCode", "必填,请填写物品编码"); |
| | | Assert.hasKeyAndValue(paramIn, "price", "必填,请填写物品价格"); |
| | | Assert.hasKeyAndValue(paramIn, "stock", "必填,请填写物品库存"); |
| | | Assert.hasKeyAndValue(paramIn, "description", "必填,请填写描述"); |
| | | //Assert.hasKeyAndValue(paramIn, "stock", "必填,请填写物品库存"); |
| | | //Assert.hasKeyAndValue(paramIn, "description", "必填,请填写描述"); |
| | | |
| | | |
| | | super.checkUserHasPrivilege(pd, restTemplate, PrivilegeCodeConstant.AGENT_HAS_LIST_RESOURCESTORE); |
| | |
| | | Assert.hasKeyAndValue(paramIn, "resName", "必填,请填写物品名称"); |
| | | //Assert.hasKeyAndValue(paramIn, "resCode", "必填,请填写物品编码"); |
| | | Assert.hasKeyAndValue(paramIn, "price", "必填,请填写物品价格"); |
| | | Assert.hasKeyAndValue(paramIn, "stock", "必填,请填写物品库存"); |
| | | Assert.hasKeyAndValue(paramIn, "description", "必填,请填写描述"); |
| | | //Assert.hasKeyAndValue(paramIn, "stock", "必填,请填写物品库存"); |
| | | //Assert.hasKeyAndValue(paramIn, "description", "必填,请填写描述"); |
| | | |
| | | |
| | | |
| | |
| | | ResponseEntity<String> responseEntity = null; |
| | | ComponentValidateResult result = super.validateStoreStaffCommunityRelationship(pd, restTemplate); |
| | | paramIn.put("storeId",result.getStoreId()); |
| | | |
| | | Map newParamIn = new HashMap(); |
| | | newParamIn.put("storeId",result.getStoreId()); |
| | | newParamIn.put("resId",paramIn.getString("resId")); |
| | | |
| | | String apiUrl = ServiceConstant.SERVICE_API_URL + "/api/resourceStore.listResourceStores" + mapToUrlParam(paramIn); |
| | | |
| | | |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", |
| | | apiUrl, |
| | | HttpMethod.GET); |
| | | |
| | | if(responseEntity.getStatusCode() != HttpStatus.OK){ |
| | | return responseEntity; |
| | | } |
| | | |
| | | JSONArray resourceStores = JSONObject.parseObject(responseEntity.getBody()).getJSONArray("resourceStores"); |
| | | |
| | | Assert.isOne(resourceStores,"查询物品数据存在多条或0条"); |
| | | |
| | | paramIn.put("stock", resourceStores.getJSONObject(0).getString("stock")); |
| | | |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), |
| | | ServiceConstant.SERVICE_API_URL + "/api/resourceStore.updateResourceStore", |