Procházet zdrojové kódy

加入小区市场 旧货市场后台代码

java110 před 6 roky
rodič
revize
5c5361fab9
25 změnil soubory, kde provedl 2228 přidání a 30 odebrání
  1. 38 0
      Api/src/main/java/com/java110/api/bmo/junkRequirement/IJunkRequirementBMO.java
  2. 99 0
      Api/src/main/java/com/java110/api/bmo/junkRequirement/impl/JunkRequirementBMOImpl.java
  3. 69 0
      Api/src/main/java/com/java110/api/listener/junkRequirement/DeleteJunkRequirementListener.java
  4. 88 0
      Api/src/main/java/com/java110/api/listener/junkRequirement/ListJunkRequirementsListener.java
  5. 76 0
      Api/src/main/java/com/java110/api/listener/junkRequirement/SaveJunkRequirementListener.java
  6. 76 0
      Api/src/main/java/com/java110/api/listener/junkRequirement/UpdateJunkRequirementListener.java
  7. 81 0
      UserService/src/main/java/com/java110/user/dao/IJunkRequirementServiceDao.java
  8. 134 0
      UserService/src/main/java/com/java110/user/dao/impl/JunkRequirementServiceDaoImpl.java
  9. 93 0
      UserService/src/main/java/com/java110/user/listener/junkRequirement/AbstractJunkRequirementBusinessServiceDataFlowListener.java
  10. 180 0
      UserService/src/main/java/com/java110/user/listener/junkRequirement/DeleteJunkRequirementInfoListener.java
  11. 179 0
      UserService/src/main/java/com/java110/user/listener/junkRequirement/SaveJunkRequirementInfoListener.java
  12. 190 0
      UserService/src/main/java/com/java110/user/listener/junkRequirement/UpdateJunkRequirementInfoListener.java
  13. 71 0
      UserService/src/main/java/com/java110/user/smo/impl/JunkRequirementInnerServiceSMOImpl.java
  14. 132 0
      docs/document/services/junkRequirement/SaveJunkRequirementInfo.md
  15. 112 0
      java110-bean/src/main/java/com/java110/dto/junkRequirement/JunkRequirementDto.java
  16. 126 0
      java110-bean/src/main/java/com/java110/vo/api/junkRequirement/ApiJunkRequirementDataVo.java
  17. 19 0
      java110-bean/src/main/java/com/java110/vo/api/junkRequirement/ApiJunkRequirementVo.java
  18. 38 30
      java110-code-generator/src/main/resources/back/template_1.json
  19. 56 0
      java110-code-generator/src/main/resources/back/template_inspection_task.json
  20. 1 0
      java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
  21. 41 0
      java110-core/src/main/java/com/java110/core/smo/junkRequirement/IJunkRequirementInnerServiceSMO.java
  22. 38 0
      java110-db/db/UserService/create_junk_market.sql
  23. 247 0
      java110-db/src/main/resources/mapper/user/JunkRequirementServiceDaoImplMapper.xml
  24. 13 0
      java110-utils/src/main/java/com/java110/utils/constant/BusinessTypeConstant.java
  25. 31 0
      java110-utils/src/main/java/com/java110/utils/constant/ServiceCodeJunkRequirementConstant.java

+ 38 - 0
Api/src/main/java/com/java110/api/bmo/junkRequirement/IJunkRequirementBMO.java

@@ -0,0 +1,38 @@
+package com.java110.api.bmo.junkRequirement;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.IApiBaseBMO;
+import com.java110.core.context.DataFlowContext;
+
+public interface IJunkRequirementBMO extends IApiBaseBMO {
+
+
+    /**
+     * 添加旧货市场
+     * @param paramInJson
+     * @param dataFlowContext
+     * @return
+     */
+     JSONObject addJunkRequirement(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+    /**
+     * 添加旧货市场信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+     JSONObject updateJunkRequirement(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+    /**
+     * 删除旧货市场
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+     JSONObject deleteJunkRequirement(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+
+
+}

+ 99 - 0
Api/src/main/java/com/java110/api/bmo/junkRequirement/impl/JunkRequirementBMOImpl.java

@@ -0,0 +1,99 @@
+package com.java110.api.bmo.junkRequirement.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.ApiBaseBMO;
+import com.java110.api.bmo.junkRequirement.IJunkRequirementBMO;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.smo.junkRequirement.IJunkRequirementInnerServiceSMO;
+import com.java110.dto.junkRequirement.JunkRequirementDto;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+@Service("junkRequirementBMOImpl")
+public class JunkRequirementBMOImpl extends ApiBaseBMO implements IJunkRequirementBMO {
+
+    @Autowired
+    private IJunkRequirementInnerServiceSMO junkRequirementInnerServiceSMOImpl;
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public JSONObject addJunkRequirement(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_JUNK_REQUIREMENT);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessJunkRequirement = new JSONObject();
+        businessJunkRequirement.putAll(paramInJson);
+        businessJunkRequirement.put("junkRequirementId", "-1");
+        //计算 应收金额
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessJunkRequirement", businessJunkRequirement);
+        return business;
+    }
+
+
+    /**
+     * 添加活动信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public JSONObject updateJunkRequirement(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+        JunkRequirementDto junkRequirementDto = new JunkRequirementDto();
+        junkRequirementDto.setJunkRequirementId(paramInJson.getString("junkRequirementId"));
+        junkRequirementDto.setCommunityId(paramInJson.getString("communityId"));
+        List<JunkRequirementDto> junkRequirementDtos = junkRequirementInnerServiceSMOImpl.queryJunkRequirements(junkRequirementDto);
+
+        Assert.listOnlyOne(junkRequirementDtos, "未找到需要修改的活动 或多条数据");
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_JUNK_REQUIREMENT);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessJunkRequirement = new JSONObject();
+        businessJunkRequirement.putAll(BeanConvertUtil.beanCovertMap(junkRequirementDtos.get(0)));
+        businessJunkRequirement.putAll(paramInJson);
+        //计算 应收金额
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessJunkRequirement", businessJunkRequirement);
+        return business;
+    }
+
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public JSONObject deleteJunkRequirement(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_JUNK_REQUIREMENT);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessJunkRequirement = new JSONObject();
+        businessJunkRequirement.putAll(paramInJson);
+        //计算 应收金额
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessJunkRequirement", businessJunkRequirement);
+        return business;
+    }
+
+}

+ 69 - 0
Api/src/main/java/com/java110/api/listener/junkRequirement/DeleteJunkRequirementListener.java

@@ -0,0 +1,69 @@
+package com.java110.api.listener.junkRequirement;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.junkRequirement.IJunkRequirementBMO;
+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.ServiceCodeJunkRequirementConstant;
+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("deleteJunkRequirementListener")
+public class DeleteJunkRequirementListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private IJunkRequirementBMO junkRequirementBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
+
+        Assert.hasKeyAndValue(reqJson, "junkRequirementId", "junkRequirementId不能为空");
+
+    }
+
+    @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(junkRequirementBMOImpl.deleteJunkRequirement(reqJson, context));
+
+        ResponseEntity<String> responseEntity = junkRequirementBMOImpl.callService(context, service.getServiceCode(), businesses);
+
+        context.setResponseEntity(responseEntity);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeJunkRequirementConstant.DELETE_JUNKREQUIREMENT;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+}

+ 88 - 0
Api/src/main/java/com/java110/api/listener/junkRequirement/ListJunkRequirementsListener.java

@@ -0,0 +1,88 @@
+package com.java110.api.listener.junkRequirement;
+
+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.junkRequirement.IJunkRequirementInnerServiceSMO;
+import com.java110.dto.junkRequirement.JunkRequirementDto;
+import com.java110.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.ServiceCodeJunkRequirementConstant;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.api.junkRequirement.ApiJunkRequirementDataVo;
+import com.java110.vo.api.junkRequirement.ApiJunkRequirementVo;
+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("listJunkRequirementsListener")
+public class ListJunkRequirementsListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private IJunkRequirementInnerServiceSMO junkRequirementInnerServiceSMOImpl;
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeJunkRequirementConstant.LIST_JUNKREQUIREMENTS;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.GET;
+    }
+
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+
+    public IJunkRequirementInnerServiceSMO getJunkRequirementInnerServiceSMOImpl() {
+        return junkRequirementInnerServiceSMOImpl;
+    }
+
+    public void setJunkRequirementInnerServiceSMOImpl(IJunkRequirementInnerServiceSMO junkRequirementInnerServiceSMOImpl) {
+        this.junkRequirementInnerServiceSMOImpl = junkRequirementInnerServiceSMOImpl;
+    }
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        JunkRequirementDto junkRequirementDto = BeanConvertUtil.covertBean(reqJson, JunkRequirementDto.class);
+
+        int count = junkRequirementInnerServiceSMOImpl.queryJunkRequirementsCount(junkRequirementDto);
+
+        List<ApiJunkRequirementDataVo> junkRequirements = null;
+
+        if (count > 0) {
+            junkRequirements = BeanConvertUtil.covertBeanList(junkRequirementInnerServiceSMOImpl.queryJunkRequirements(junkRequirementDto), ApiJunkRequirementDataVo.class);
+        } else {
+            junkRequirements = new ArrayList<>();
+        }
+
+        ApiJunkRequirementVo apiJunkRequirementVo = new ApiJunkRequirementVo();
+
+        apiJunkRequirementVo.setTotal(count);
+        apiJunkRequirementVo.setRecords((int) Math.ceil((double) count / (double) reqJson.getInteger("row")));
+        apiJunkRequirementVo.setJunkRequirements(junkRequirements);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiJunkRequirementVo), HttpStatus.OK);
+
+        context.setResponseEntity(responseEntity);
+
+    }
+}

+ 76 - 0
Api/src/main/java/com/java110/api/listener/junkRequirement/SaveJunkRequirementListener.java

@@ -0,0 +1,76 @@
+package com.java110.api.listener.junkRequirement;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.junkRequirement.IJunkRequirementBMO;
+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.ServiceCodeJunkRequirementConstant;
+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("saveJunkRequirementListener")
+public class SaveJunkRequirementListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private IJunkRequirementBMO junkRequirementBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
+
+        Assert.hasKeyAndValue(reqJson, "typeCd", "请求报文中未包含typeCd");
+        Assert.hasKeyAndValue(reqJson, "classification", "请求报文中未包含classification");
+        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
+        Assert.hasKeyAndValue(reqJson, "context", "请求报文中未包含context");
+        Assert.hasKeyAndValue(reqJson, "referencePrice", "请求报文中未包含referencePrice");
+        Assert.hasKeyAndValue(reqJson, "publishUserId", "请求报文中未包含publishUserId");
+        Assert.hasKeyAndValue(reqJson, "publishUserName", "请求报文中未包含publishUserName");
+        Assert.hasKeyAndValue(reqJson, "publishUserLink", "请求报文中未包含publishUserLink");
+
+    }
+
+    @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(junkRequirementBMOImpl.addJunkRequirement(reqJson, context));
+
+        ResponseEntity<String> responseEntity = junkRequirementBMOImpl.callService(context, service.getServiceCode(), businesses);
+
+        context.setResponseEntity(responseEntity);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeJunkRequirementConstant.ADD_JUNKREQUIREMENT;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+}

+ 76 - 0
Api/src/main/java/com/java110/api/listener/junkRequirement/UpdateJunkRequirementListener.java

@@ -0,0 +1,76 @@
+package com.java110.api.listener.junkRequirement;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.junkRequirement.IJunkRequirementBMO;
+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.ServiceCodeJunkRequirementConstant;
+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("updateJunkRequirementListener")
+public class UpdateJunkRequirementListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private IJunkRequirementBMO junkRequirementBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+
+        Assert.hasKeyAndValue(reqJson, "junkRequirementId", "junkRequirementId不能为空");
+        Assert.hasKeyAndValue(reqJson, "typeCd", "请求报文中未包含typeCd");
+        Assert.hasKeyAndValue(reqJson, "classification", "请求报文中未包含classification");
+        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
+        Assert.hasKeyAndValue(reqJson, "context", "请求报文中未包含context");
+        Assert.hasKeyAndValue(reqJson, "referencePrice", "请求报文中未包含referencePrice");
+        Assert.hasKeyAndValue(reqJson, "publishUserId", "请求报文中未包含publishUserId");
+        Assert.hasKeyAndValue(reqJson, "publishUserName", "请求报文中未包含publishUserName");
+        Assert.hasKeyAndValue(reqJson, "publishUserLink", "请求报文中未包含publishUserLink");
+
+    }
+
+    @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(junkRequirementBMOImpl.updateJunkRequirement(reqJson, context));
+
+        ResponseEntity<String> responseEntity = junkRequirementBMOImpl.callService(context, service.getServiceCode(), businesses);
+
+        context.setResponseEntity(responseEntity);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeJunkRequirementConstant.UPDATE_JUNKREQUIREMENT;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+}

+ 81 - 0
UserService/src/main/java/com/java110/user/dao/IJunkRequirementServiceDao.java

@@ -0,0 +1,81 @@
+package com.java110.user.dao;
+
+
+import com.java110.utils.exception.DAOException;
+import com.java110.entity.merchant.BoMerchant;
+import com.java110.entity.merchant.BoMerchantAttr;
+import com.java110.entity.merchant.Merchant;
+import com.java110.entity.merchant.MerchantAttr;
+
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 旧货市场组件内部之间使用,没有给外围系统提供服务能力
+ * 旧货市场服务接口类,要求全部以字符串传输,方便微服务化
+ * 新建客户,修改客户,删除客户,查询客户等功能
+ *
+ * Created by wuxw on 2016/12/27.
+ */
+public interface IJunkRequirementServiceDao {
+
+    /**
+     * 保存 旧货市场信息
+     * @param businessJunkRequirementInfo 旧货市场信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    void saveBusinessJunkRequirementInfo(Map businessJunkRequirementInfo) throws DAOException;
+
+
+
+    /**
+     * 查询旧货市场信息(business过程)
+     * 根据bId 查询旧货市场信息
+     * @param info bId 信息
+     * @return 旧货市场信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getBusinessJunkRequirementInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 保存 旧货市场信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveJunkRequirementInfoInstance(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询旧货市场信息(instance过程)
+     * 根据bId 查询旧货市场信息
+     * @param info bId 信息
+     * @return 旧货市场信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getJunkRequirementInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改旧货市场信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateJunkRequirementInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询旧货市场总数
+     *
+     * @param info 旧货市场信息
+     * @return 旧货市场数量
+     */
+    int queryJunkRequirementsCount(Map info);
+
+}

+ 134 - 0
UserService/src/main/java/com/java110/user/dao/impl/JunkRequirementServiceDaoImpl.java

@@ -0,0 +1,134 @@
+package com.java110.user.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.user.dao.IJunkRequirementServiceDao;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+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("junkRequirementServiceDaoImpl")
+//@Transactional
+public class JunkRequirementServiceDaoImpl extends BaseServiceDao implements IJunkRequirementServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(JunkRequirementServiceDaoImpl.class);
+
+    /**
+     * 旧货市场信息封装
+     *
+     * @param businessJunkRequirementInfo 旧货市场信息 封装
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveBusinessJunkRequirementInfo(Map businessJunkRequirementInfo) throws DAOException {
+        businessJunkRequirementInfo.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存旧货市场信息 入参 businessJunkRequirementInfo : {}", businessJunkRequirementInfo);
+        int saveFlag = sqlSessionTemplate.insert("junkRequirementServiceDaoImpl.saveBusinessJunkRequirementInfo", businessJunkRequirementInfo);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存旧货市场数据失败:" + JSONObject.toJSONString(businessJunkRequirementInfo));
+        }
+    }
+
+
+    /**
+     * 查询旧货市场信息
+     *
+     * @param info bId 信息
+     * @return 旧货市场信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getBusinessJunkRequirementInfo(Map info) throws DAOException {
+
+        logger.debug("查询旧货市场信息 入参 info : {}", info);
+
+        List<Map> businessJunkRequirementInfos = sqlSessionTemplate.selectList("junkRequirementServiceDaoImpl.getBusinessJunkRequirementInfo", info);
+
+        return businessJunkRequirementInfos;
+    }
+
+
+    /**
+     * 保存旧货市场信息 到 instance
+     *
+     * @param info bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveJunkRequirementInfoInstance(Map info) throws DAOException {
+        logger.debug("保存旧货市场信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.insert("junkRequirementServiceDaoImpl.saveJunkRequirementInfoInstance", 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> getJunkRequirementInfo(Map info) throws DAOException {
+        logger.debug("查询旧货市场信息 入参 info : {}", info);
+
+        List<Map> businessJunkRequirementInfos = sqlSessionTemplate.selectList("junkRequirementServiceDaoImpl.getJunkRequirementInfo", info);
+
+        return businessJunkRequirementInfos;
+    }
+
+
+    /**
+     * 修改旧货市场信息
+     *
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updateJunkRequirementInfoInstance(Map info) throws DAOException {
+        logger.debug("修改旧货市场信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.update("junkRequirementServiceDaoImpl.updateJunkRequirementInfoInstance", info);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "修改旧货市场信息Instance数据失败:" + JSONObject.toJSONString(info));
+        }
+    }
+
+    /**
+     * 查询旧货市场数量
+     *
+     * @param info 旧货市场信息
+     * @return 旧货市场数量
+     */
+    @Override
+    public int queryJunkRequirementsCount(Map info) {
+        logger.debug("查询旧货市场数据 入参 info : {}", info);
+
+        List<Map> businessJunkRequirementInfos = sqlSessionTemplate.selectList("junkRequirementServiceDaoImpl.queryJunkRequirementsCount", info);
+        if (businessJunkRequirementInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessJunkRequirementInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 93 - 0
UserService/src/main/java/com/java110/user/listener/junkRequirement/AbstractJunkRequirementBusinessServiceDataFlowListener.java

@@ -0,0 +1,93 @@
+package com.java110.user.listener.junkRequirement;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.entity.center.Business;
+import com.java110.event.service.AbstractBusinessServiceDataFlowListener;
+import com.java110.user.dao.IJunkRequirementServiceDao;
+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 AbstractJunkRequirementBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener {
+    private static Logger logger = LoggerFactory.getLogger(AbstractJunkRequirementBusinessServiceDataFlowListener.class);
+
+
+    /**
+     * 获取 DAO工具类
+     *
+     * @return
+     */
+    public abstract IJunkRequirementServiceDao getJunkRequirementServiceDaoImpl();
+
+    /**
+     * 刷新 businessJunkRequirementInfo 数据
+     * 主要将 数据库 中字段和 接口传递字段建立关系
+     *
+     * @param businessJunkRequirementInfo
+     */
+    protected void flushBusinessJunkRequirementInfo(Map businessJunkRequirementInfo, String statusCd) {
+        businessJunkRequirementInfo.put("newBId", businessJunkRequirementInfo.get("b_id"));
+        businessJunkRequirementInfo.put("publishUserName", businessJunkRequirementInfo.get("publish_user_name"));
+        businessJunkRequirementInfo.put("publishUserId", businessJunkRequirementInfo.get("publish_user_id"));
+        businessJunkRequirementInfo.put("junkRequirementId", businessJunkRequirementInfo.get("junk_requirement_id"));
+        businessJunkRequirementInfo.put("classification", businessJunkRequirementInfo.get("classification"));
+        businessJunkRequirementInfo.put("referencePrice", businessJunkRequirementInfo.get("reference_price"));
+        businessJunkRequirementInfo.put("operate", businessJunkRequirementInfo.get("operate"));
+        businessJunkRequirementInfo.put("typeCd", businessJunkRequirementInfo.get("type_cd"));
+        businessJunkRequirementInfo.put("publishUserLink", businessJunkRequirementInfo.get("publish_user_link"));
+        businessJunkRequirementInfo.put("context", businessJunkRequirementInfo.get("context"));
+        businessJunkRequirementInfo.put("state", businessJunkRequirementInfo.get("state"));
+        businessJunkRequirementInfo.put("communityId", businessJunkRequirementInfo.get("community_id"));
+        businessJunkRequirementInfo.remove("bId");
+        businessJunkRequirementInfo.put("statusCd", statusCd);
+    }
+
+
+    /**
+     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     *
+     * @param businessJunkRequirement 旧货市场信息
+     */
+    protected void autoSaveDelBusinessJunkRequirement(Business business, JSONObject businessJunkRequirement) {
+//自动插入DEL
+        Map info = new HashMap();
+        info.put("junkRequirementId", businessJunkRequirement.getString("junkRequirementId"));
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        List<Map> currentJunkRequirementInfos = getJunkRequirementServiceDaoImpl().getJunkRequirementInfo(info);
+        if (currentJunkRequirementInfos == null || currentJunkRequirementInfos.size() != 1) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
+        }
+
+        Map currentJunkRequirementInfo = currentJunkRequirementInfos.get(0);
+
+        currentJunkRequirementInfo.put("bId", business.getbId());
+
+        currentJunkRequirementInfo.put("publishUserName", currentJunkRequirementInfo.get("publish_user_name"));
+        currentJunkRequirementInfo.put("publishUserId", currentJunkRequirementInfo.get("publish_user_id"));
+        currentJunkRequirementInfo.put("junkRequirementId", currentJunkRequirementInfo.get("junk_requirement_id"));
+        currentJunkRequirementInfo.put("classification", currentJunkRequirementInfo.get("classification"));
+        currentJunkRequirementInfo.put("referencePrice", currentJunkRequirementInfo.get("reference_price"));
+        currentJunkRequirementInfo.put("operate", currentJunkRequirementInfo.get("operate"));
+        currentJunkRequirementInfo.put("typeCd", currentJunkRequirementInfo.get("type_cd"));
+        currentJunkRequirementInfo.put("publishUserLink", currentJunkRequirementInfo.get("publish_user_link"));
+        currentJunkRequirementInfo.put("context", currentJunkRequirementInfo.get("context"));
+        currentJunkRequirementInfo.put("state", currentJunkRequirementInfo.get("state"));
+        currentJunkRequirementInfo.put("communityId", currentJunkRequirementInfo.get("community_id"));
+
+
+        currentJunkRequirementInfo.put("operate", StatusConstant.OPERATE_DEL);
+        getJunkRequirementServiceDaoImpl().saveBusinessJunkRequirementInfo(currentJunkRequirementInfo);
+    }
+
+
+}

+ 180 - 0
UserService/src/main/java/com/java110/user/listener/junkRequirement/DeleteJunkRequirementInfoListener.java

@@ -0,0 +1,180 @@
+package com.java110.user.listener.junkRequirement;
+
+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.user.dao.IJunkRequirementServiceDao;
+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;
+
+/**
+ * 删除旧货市场信息 侦听
+ * <p>
+ * 处理节点
+ * 1、businessJunkRequirement:{} 旧货市场基本信息节点
+ * 2、businessJunkRequirementAttr:[{}] 旧货市场属性信息节点
+ * 3、businessJunkRequirementPhoto:[{}] 旧货市场照片信息节点
+ * 4、businessJunkRequirementCerdentials:[{}] 旧货市场证件信息节点
+ * 协议地址 :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("deleteJunkRequirementInfoListener")
+@Transactional
+public class DeleteJunkRequirementInfoListener extends AbstractJunkRequirementBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeleteJunkRequirementInfoListener.class);
+    @Autowired
+    IJunkRequirementServiceDao junkRequirementServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_JUNK_REQUIREMENT;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessJunkRequirement 节点
+        if (data.containsKey("businessJunkRequirement")) {
+            //处理 businessJunkRequirement 节点
+            if (data.containsKey("businessJunkRequirement")) {
+                Object _obj = data.get("businessJunkRequirement");
+                JSONArray businessJunkRequirements = null;
+                if (_obj instanceof JSONObject) {
+                    businessJunkRequirements = new JSONArray();
+                    businessJunkRequirements.add(_obj);
+                } else {
+                    businessJunkRequirements = (JSONArray) _obj;
+                }
+                //JSONObject businessJunkRequirement = data.getJSONObject("businessJunkRequirement");
+                for (int _junkRequirementIndex = 0; _junkRequirementIndex < businessJunkRequirements.size(); _junkRequirementIndex++) {
+                    JSONObject businessJunkRequirement = businessJunkRequirements.getJSONObject(_junkRequirementIndex);
+                    doBusinessJunkRequirement(business, businessJunkRequirement);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("junkRequirementId", businessJunkRequirement.getString("junkRequirementId"));
+                    }
+                }
+            }
+        }
+
+
+    }
+
+    /**
+     * 删除 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> businessJunkRequirementInfos = junkRequirementServiceDaoImpl.getBusinessJunkRequirementInfo(info);
+        if (businessJunkRequirementInfos != null && businessJunkRequirementInfos.size() > 0) {
+            for (int _junkRequirementIndex = 0; _junkRequirementIndex < businessJunkRequirementInfos.size(); _junkRequirementIndex++) {
+                Map businessJunkRequirementInfo = businessJunkRequirementInfos.get(_junkRequirementIndex);
+                flushBusinessJunkRequirementInfo(businessJunkRequirementInfo, StatusConstant.STATUS_CD_INVALID);
+                junkRequirementServiceDaoImpl.updateJunkRequirementInfoInstance(businessJunkRequirementInfo);
+                dataFlowContext.addParamOut("junkRequirementId", businessJunkRequirementInfo.get("junk_requirement_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> junkRequirementInfo = junkRequirementServiceDaoImpl.getJunkRequirementInfo(info);
+        if (junkRequirementInfo != null && junkRequirementInfo.size() > 0) {
+
+            //旧货市场信息
+            List<Map> businessJunkRequirementInfos = junkRequirementServiceDaoImpl.getBusinessJunkRequirementInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessJunkRequirementInfos == null || businessJunkRequirementInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(junkRequirement),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _junkRequirementIndex = 0; _junkRequirementIndex < businessJunkRequirementInfos.size(); _junkRequirementIndex++) {
+                Map businessJunkRequirementInfo = businessJunkRequirementInfos.get(_junkRequirementIndex);
+                flushBusinessJunkRequirementInfo(businessJunkRequirementInfo, StatusConstant.STATUS_CD_VALID);
+                junkRequirementServiceDaoImpl.updateJunkRequirementInfoInstance(businessJunkRequirementInfo);
+            }
+        }
+    }
+
+
+    /**
+     * 处理 businessJunkRequirement 节点
+     *
+     * @param business                总的数据节点
+     * @param businessJunkRequirement 旧货市场节点
+     */
+    private void doBusinessJunkRequirement(Business business, JSONObject businessJunkRequirement) {
+
+        Assert.jsonObjectHaveKey(businessJunkRequirement, "junkRequirementId", "businessJunkRequirement 节点下没有包含 junkRequirementId 节点");
+
+        if (businessJunkRequirement.getString("junkRequirementId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "junkRequirementId 错误,不能自动生成(必须已经存在的junkRequirementId)" + businessJunkRequirement);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessJunkRequirement(business, businessJunkRequirement);
+    }
+
+    public IJunkRequirementServiceDao getJunkRequirementServiceDaoImpl() {
+        return junkRequirementServiceDaoImpl;
+    }
+
+    public void setJunkRequirementServiceDaoImpl(IJunkRequirementServiceDao junkRequirementServiceDaoImpl) {
+        this.junkRequirementServiceDaoImpl = junkRequirementServiceDaoImpl;
+    }
+}

+ 179 - 0
UserService/src/main/java/com/java110/user/listener/junkRequirement/SaveJunkRequirementInfoListener.java

@@ -0,0 +1,179 @@
+package com.java110.user.listener.junkRequirement;
+
+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.user.dao.IJunkRequirementServiceDao;
+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("saveJunkRequirementInfoListener")
+@Transactional
+public class SaveJunkRequirementInfoListener extends AbstractJunkRequirementBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveJunkRequirementInfoListener.class);
+
+    @Autowired
+    private IJunkRequirementServiceDao junkRequirementServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_JUNK_REQUIREMENT;
+    }
+
+    /**
+     * 保存旧货市场信息 business 表中
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessJunkRequirement 节点
+        if (data.containsKey("businessJunkRequirement")) {
+            Object bObj = data.get("businessJunkRequirement");
+            JSONArray businessJunkRequirements = null;
+            if (bObj instanceof JSONObject) {
+                businessJunkRequirements = new JSONArray();
+                businessJunkRequirements.add(bObj);
+            } else {
+                businessJunkRequirements = (JSONArray) bObj;
+            }
+            //JSONObject businessJunkRequirement = data.getJSONObject("businessJunkRequirement");
+            for (int bJunkRequirementIndex = 0; bJunkRequirementIndex < businessJunkRequirements.size(); bJunkRequirementIndex++) {
+                JSONObject businessJunkRequirement = businessJunkRequirements.getJSONObject(bJunkRequirementIndex);
+                doBusinessJunkRequirement(business, businessJunkRequirement);
+                if (bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("junkRequirementId", businessJunkRequirement.getString("junkRequirementId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * 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> businessJunkRequirementInfo = junkRequirementServiceDaoImpl.getBusinessJunkRequirementInfo(info);
+        if (businessJunkRequirementInfo != null && businessJunkRequirementInfo.size() > 0) {
+            reFreshShareColumn(info, businessJunkRequirementInfo.get(0));
+            junkRequirementServiceDaoImpl.saveJunkRequirementInfoInstance(info);
+            if (businessJunkRequirementInfo.size() == 1) {
+                dataFlowContext.addParamOut("junkRequirementId", businessJunkRequirementInfo.get(0).get("junk_requirement_id"));
+            }
+        }
+    }
+
+
+    /**
+     * 刷 分片字段
+     *
+     * @param info         查询对象
+     * @param businessInfo 小区ID
+     */
+    private void reFreshShareColumn(Map info, Map businessInfo) {
+
+        if (info.containsKey("communityId")) {
+            return;
+        }
+
+        if (!businessInfo.containsKey("community_id")) {
+            return;
+        }
+
+        info.put("communityId", businessInfo.get("community_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> junkRequirementInfo = junkRequirementServiceDaoImpl.getJunkRequirementInfo(info);
+        if (junkRequirementInfo != null && junkRequirementInfo.size() > 0) {
+            reFreshShareColumn(paramIn, junkRequirementInfo.get(0));
+            junkRequirementServiceDaoImpl.updateJunkRequirementInfoInstance(paramIn);
+        }
+    }
+
+
+    /**
+     * 处理 businessJunkRequirement 节点
+     *
+     * @param business                总的数据节点
+     * @param businessJunkRequirement 旧货市场节点
+     */
+    private void doBusinessJunkRequirement(Business business, JSONObject businessJunkRequirement) {
+
+        Assert.jsonObjectHaveKey(businessJunkRequirement, "junkRequirementId", "businessJunkRequirement 节点下没有包含 junkRequirementId 节点");
+
+        if (businessJunkRequirement.getString("junkRequirementId").startsWith("-")) {
+            //刷新缓存
+            //flushJunkRequirementId(business.getDatas());
+
+            businessJunkRequirement.put("junkRequirementId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_junkRequirementId));
+
+        }
+
+        businessJunkRequirement.put("bId", business.getbId());
+        businessJunkRequirement.put("operate", StatusConstant.OPERATE_ADD);
+        //保存旧货市场信息
+        junkRequirementServiceDaoImpl.saveBusinessJunkRequirementInfo(businessJunkRequirement);
+
+    }
+
+    public IJunkRequirementServiceDao getJunkRequirementServiceDaoImpl() {
+        return junkRequirementServiceDaoImpl;
+    }
+
+    public void setJunkRequirementServiceDaoImpl(IJunkRequirementServiceDao junkRequirementServiceDaoImpl) {
+        this.junkRequirementServiceDaoImpl = junkRequirementServiceDaoImpl;
+    }
+}

+ 190 - 0
UserService/src/main/java/com/java110/user/listener/junkRequirement/UpdateJunkRequirementInfoListener.java

@@ -0,0 +1,190 @@
+package com.java110.user.listener.junkRequirement;
+
+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.user.dao.IJunkRequirementServiceDao;
+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;
+
+/**
+ * 修改旧货市场信息 侦听
+ * <p>
+ * 处理节点
+ * 1、businessJunkRequirement:{} 旧货市场基本信息节点
+ * 2、businessJunkRequirementAttr:[{}] 旧货市场属性信息节点
+ * 3、businessJunkRequirementPhoto:[{}] 旧货市场照片信息节点
+ * 4、businessJunkRequirementCerdentials:[{}] 旧货市场证件信息节点
+ * 协议地址 :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("updateJunkRequirementInfoListener")
+@Transactional
+public class UpdateJunkRequirementInfoListener extends AbstractJunkRequirementBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateJunkRequirementInfoListener.class);
+    @Autowired
+    private IJunkRequirementServiceDao junkRequirementServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_JUNK_REQUIREMENT;
+    }
+
+    /**
+     * business过程
+     *
+     * @param dataFlowContext 上下文对象
+     * @param business        业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessJunkRequirement 节点
+        if (data.containsKey("businessJunkRequirement")) {
+            //处理 businessJunkRequirement 节点
+            if (data.containsKey("businessJunkRequirement")) {
+                Object _obj = data.get("businessJunkRequirement");
+                JSONArray businessJunkRequirements = null;
+                if (_obj instanceof JSONObject) {
+                    businessJunkRequirements = new JSONArray();
+                    businessJunkRequirements.add(_obj);
+                } else {
+                    businessJunkRequirements = (JSONArray) _obj;
+                }
+                //JSONObject businessJunkRequirement = data.getJSONObject("businessJunkRequirement");
+                for (int _junkRequirementIndex = 0; _junkRequirementIndex < businessJunkRequirements.size(); _junkRequirementIndex++) {
+                    JSONObject businessJunkRequirement = businessJunkRequirements.getJSONObject(_junkRequirementIndex);
+                    doBusinessJunkRequirement(business, businessJunkRequirement);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("junkRequirementId", businessJunkRequirement.getString("junkRequirementId"));
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 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> businessJunkRequirementInfos = junkRequirementServiceDaoImpl.getBusinessJunkRequirementInfo(info);
+        if (businessJunkRequirementInfos != null && businessJunkRequirementInfos.size() > 0) {
+            for (int _junkRequirementIndex = 0; _junkRequirementIndex < businessJunkRequirementInfos.size(); _junkRequirementIndex++) {
+                Map businessJunkRequirementInfo = businessJunkRequirementInfos.get(_junkRequirementIndex);
+                flushBusinessJunkRequirementInfo(businessJunkRequirementInfo, StatusConstant.STATUS_CD_VALID);
+                junkRequirementServiceDaoImpl.updateJunkRequirementInfoInstance(businessJunkRequirementInfo);
+                if (businessJunkRequirementInfo.size() == 1) {
+                    dataFlowContext.addParamOut("junkRequirementId", businessJunkRequirementInfo.get("junk_requirement_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> junkRequirementInfo = junkRequirementServiceDaoImpl.getJunkRequirementInfo(info);
+        if (junkRequirementInfo != null && junkRequirementInfo.size() > 0) {
+
+            //旧货市场信息
+            List<Map> businessJunkRequirementInfos = junkRequirementServiceDaoImpl.getBusinessJunkRequirementInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessJunkRequirementInfos == null || businessJunkRequirementInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(junkRequirement),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _junkRequirementIndex = 0; _junkRequirementIndex < businessJunkRequirementInfos.size(); _junkRequirementIndex++) {
+                Map businessJunkRequirementInfo = businessJunkRequirementInfos.get(_junkRequirementIndex);
+                flushBusinessJunkRequirementInfo(businessJunkRequirementInfo, StatusConstant.STATUS_CD_VALID);
+                junkRequirementServiceDaoImpl.updateJunkRequirementInfoInstance(businessJunkRequirementInfo);
+            }
+        }
+
+    }
+
+
+    /**
+     * 处理 businessJunkRequirement 节点
+     *
+     * @param business                总的数据节点
+     * @param businessJunkRequirement 旧货市场节点
+     */
+    private void doBusinessJunkRequirement(Business business, JSONObject businessJunkRequirement) {
+
+        Assert.jsonObjectHaveKey(businessJunkRequirement, "junkRequirementId", "businessJunkRequirement 节点下没有包含 junkRequirementId 节点");
+
+        if (businessJunkRequirement.getString("junkRequirementId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "junkRequirementId 错误,不能自动生成(必须已经存在的junkRequirementId)" + businessJunkRequirement);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessJunkRequirement(business, businessJunkRequirement);
+
+        businessJunkRequirement.put("bId", business.getbId());
+        businessJunkRequirement.put("operate", StatusConstant.OPERATE_ADD);
+        //保存旧货市场信息
+        junkRequirementServiceDaoImpl.saveBusinessJunkRequirementInfo(businessJunkRequirement);
+
+    }
+
+
+    public IJunkRequirementServiceDao getJunkRequirementServiceDaoImpl() {
+        return junkRequirementServiceDaoImpl;
+    }
+
+    public void setJunkRequirementServiceDaoImpl(IJunkRequirementServiceDao junkRequirementServiceDaoImpl) {
+        this.junkRequirementServiceDaoImpl = junkRequirementServiceDaoImpl;
+    }
+
+
+}

+ 71 - 0
UserService/src/main/java/com/java110/user/smo/impl/JunkRequirementInnerServiceSMOImpl.java

@@ -0,0 +1,71 @@
+package com.java110.user.smo.impl;
+
+
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.smo.junkRequirement.IJunkRequirementInnerServiceSMO;
+import com.java110.core.smo.user.IUserInnerServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.junkRequirement.JunkRequirementDto;
+import com.java110.user.dao.IJunkRequirementServiceDao;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+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 JunkRequirementInnerServiceSMOImpl extends BaseServiceSMO implements IJunkRequirementInnerServiceSMO {
+
+    @Autowired
+    private IJunkRequirementServiceDao junkRequirementServiceDaoImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Override
+    public List<JunkRequirementDto> queryJunkRequirements(@RequestBody JunkRequirementDto junkRequirementDto) {
+
+        //校验是否传了 分页信息
+
+        int page = junkRequirementDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            junkRequirementDto.setPage((page - 1) * junkRequirementDto.getRow());
+        }
+
+        List<JunkRequirementDto> junkRequirements = BeanConvertUtil.covertBeanList(junkRequirementServiceDaoImpl.getJunkRequirementInfo(BeanConvertUtil.beanCovertMap(junkRequirementDto)), JunkRequirementDto.class);
+
+        return junkRequirements;
+    }
+
+
+    @Override
+    public int queryJunkRequirementsCount(@RequestBody JunkRequirementDto junkRequirementDto) {
+        return junkRequirementServiceDaoImpl.queryJunkRequirementsCount(BeanConvertUtil.beanCovertMap(junkRequirementDto));
+    }
+
+    public IJunkRequirementServiceDao getJunkRequirementServiceDaoImpl() {
+        return junkRequirementServiceDaoImpl;
+    }
+
+    public void setJunkRequirementServiceDaoImpl(IJunkRequirementServiceDao junkRequirementServiceDaoImpl) {
+        this.junkRequirementServiceDaoImpl = junkRequirementServiceDaoImpl;
+    }
+
+    public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
+        return userInnerServiceSMOImpl;
+    }
+
+    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
+        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
+    }
+}

+ 132 - 0
docs/document/services/junkRequirement/SaveJunkRequirementInfo.md

@@ -0,0 +1,132 @@
+
+
+**1\. 保存旧货市场**
+###### 接口功能
+> API服务做保存旧货市场时调用该接口
+
+###### URL
+> [http://junkRequirement-service/junkRequirementApi/service](http://junkRequirement-service/junkRequirementApi/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|businessJunkRequirementInfo|1|Object|-|小区成员|小区成员|
+|businessJunkRequirementInfo|publishUserName|1|String|30|-|-|
+|businessJunkRequirementInfo|publishUserId|1|String|30|-|-|
+|businessJunkRequirementInfo|junkRequirementId|1|String|30|-|-|
+|businessJunkRequirementInfo|classification|1|String|30|-|-|
+|businessJunkRequirementInfo|referencePrice|1|String|30|-|-|
+|businessJunkRequirementInfo|typeCd|1|String|30|-|-|
+|businessJunkRequirementInfo|publishUserLink|1|String|30|-|-|
+|businessJunkRequirementInfo|context|1|String|30|-|-|
+|businessJunkRequirementInfo|state|1|String|30|-|-|
+|businessJunkRequirementInfo|communityId|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://junkRequirement-service/junkRequirementApi/service](http://junkRequirement-service/junkRequirementApi/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": "550200030001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessJunkRequirementInfo": {
+                "publishUserName":"填写具体值",
+        "publishUserId":"填写具体值",
+        "junkRequirementId":"填写具体值",
+        "classification":"填写具体值",
+        "referencePrice":"填写具体值",
+        "typeCd":"填写具体值",
+        "publishUserLink":"填写具体值",
+        "context":"填写具体值",
+        "state":"填写具体值",
+        "communityId":"填写具体值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 112 - 0
java110-bean/src/main/java/com/java110/dto/junkRequirement/JunkRequirementDto.java

@@ -0,0 +1,112 @@
+package com.java110.dto.junkRequirement;
+
+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 JunkRequirementDto extends PageDto implements Serializable {
+
+    private String publishUserName;
+private String publishUserId;
+private String junkRequirementId;
+private String classification;
+private String referencePrice;
+private String typeCd;
+private String publishUserLink;
+private String context;
+private String state;
+private String communityId;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getPublishUserName() {
+        return publishUserName;
+    }
+public void setPublishUserName(String publishUserName) {
+        this.publishUserName = publishUserName;
+    }
+public String getPublishUserId() {
+        return publishUserId;
+    }
+public void setPublishUserId(String publishUserId) {
+        this.publishUserId = publishUserId;
+    }
+public String getJunkRequirementId() {
+        return junkRequirementId;
+    }
+public void setJunkRequirementId(String junkRequirementId) {
+        this.junkRequirementId = junkRequirementId;
+    }
+public String getClassification() {
+        return classification;
+    }
+public void setClassification(String classification) {
+        this.classification = classification;
+    }
+public String getReferencePrice() {
+        return referencePrice;
+    }
+public void setReferencePrice(String referencePrice) {
+        this.referencePrice = referencePrice;
+    }
+public String getTypeCd() {
+        return typeCd;
+    }
+public void setTypeCd(String typeCd) {
+        this.typeCd = typeCd;
+    }
+public String getPublishUserLink() {
+        return publishUserLink;
+    }
+public void setPublishUserLink(String publishUserLink) {
+        this.publishUserLink = publishUserLink;
+    }
+public String getContext() {
+        return context;
+    }
+public void setContext(String context) {
+        this.context = context;
+    }
+public String getState() {
+        return state;
+    }
+public void setState(String state) {
+        this.state = state;
+    }
+public String getCommunityId() {
+        return communityId;
+    }
+public void setCommunityId(String communityId) {
+        this.communityId = communityId;
+    }
+
+
+    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;
+    }
+}

+ 126 - 0
java110-bean/src/main/java/com/java110/vo/api/junkRequirement/ApiJunkRequirementDataVo.java

@@ -0,0 +1,126 @@
+package com.java110.vo.api.junkRequirement;
+
+import java.io.Serializable;
+
+public class ApiJunkRequirementDataVo implements Serializable {
+
+    private String publishUserName;
+    private String publishUserId;
+    private String statusCd;
+    private String junkRequirementId;
+    private String classification;
+    private String referencePrice;
+    private String operate;
+    private String typeCd;
+    private String publishUserLink;
+    private String context;
+    private String state;
+    private String communityId;
+    private String bId;
+
+    public String getPublishUserName() {
+        return publishUserName;
+    }
+
+    public void setPublishUserName(String publishUserName) {
+        this.publishUserName = publishUserName;
+    }
+
+    public String getPublishUserId() {
+        return publishUserId;
+    }
+
+    public void setPublishUserId(String publishUserId) {
+        this.publishUserId = publishUserId;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+
+    public String getJunkRequirementId() {
+        return junkRequirementId;
+    }
+
+    public void setJunkRequirementId(String junkRequirementId) {
+        this.junkRequirementId = junkRequirementId;
+    }
+
+    public String getClassification() {
+        return classification;
+    }
+
+    public void setClassification(String classification) {
+        this.classification = classification;
+    }
+
+    public String getReferencePrice() {
+        return referencePrice;
+    }
+
+    public void setReferencePrice(String referencePrice) {
+        this.referencePrice = referencePrice;
+    }
+
+    public String getOperate() {
+        return operate;
+    }
+
+    public void setOperate(String operate) {
+        this.operate = operate;
+    }
+
+    public String getTypeCd() {
+        return typeCd;
+    }
+
+    public void setTypeCd(String typeCd) {
+        this.typeCd = typeCd;
+    }
+
+    public String getPublishUserLink() {
+        return publishUserLink;
+    }
+
+    public void setPublishUserLink(String publishUserLink) {
+        this.publishUserLink = publishUserLink;
+    }
+
+    public String getContext() {
+        return context;
+    }
+
+    public void setContext(String context) {
+        this.context = context;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getCommunityId() {
+        return communityId;
+    }
+
+    public void setCommunityId(String communityId) {
+        this.communityId = communityId;
+    }
+
+    public String getBId() {
+        return bId;
+    }
+
+    public void setBId(String bId) {
+        this.bId = bId;
+    }
+
+
+}

+ 19 - 0
java110-bean/src/main/java/com/java110/vo/api/junkRequirement/ApiJunkRequirementVo.java

@@ -0,0 +1,19 @@
+package com.java110.vo.api.junkRequirement;
+
+import com.java110.vo.MorePageVo;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class ApiJunkRequirementVo extends MorePageVo implements Serializable {
+    List<ApiJunkRequirementDataVo> junkRequirements;
+
+
+    public List<ApiJunkRequirementDataVo> getJunkRequirements() {
+        return junkRequirements;
+    }
+
+    public void setJunkRequirements(List<ApiJunkRequirementDataVo> junkRequirements) {
+        this.junkRequirements = junkRequirements;
+    }
+}

+ 38 - 30
java110-code-generator/src/main/resources/back/template_1.json

@@ -1,56 +1,64 @@
 {
-  "id": "taskId",
-  "name": "inspectionTask",
-  "desc": "活动",
+  "id": "junkRequirementId",
+  "name": "junkRequirement",
+  "desc": "旧货市场",
   "shareParam": "communityId",
   "shareColumn": "community_id",
-  "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_INSPECTION_TASK",
-  "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_INSPECTION_TASK",
-  "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_INSPECTION_TASK",
-  "newBusinessTypeCdValue": "530200030001",
-  "updateBusinessTypeCdValue": "530200040001",
-  "deleteBusinessTypeCdValue": "530200050001",
-  "businessTableName": "business_inspection_task",
-  "tableName": "inspection_task",
+  "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_JUNK_REQUIREMENT",
+  "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_JUNK_REQUIREMENT",
+  "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_JUNK_REQUIREMENT",
+  "newBusinessTypeCdValue": "550200030001",
+  "updateBusinessTypeCdValue": "550200040001",
+  "deleteBusinessTypeCdValue": "550200050001",
+  "businessTableName": "business_junk_requirement",
+  "tableName": "junk_requirement",
   "param": {
-    "taskId": "task_id",
-    "inspectionPlanId": "inspection_plan_id",
-    "planInsTime": "plan_ins_time",
-    "actInsTime": "act_ins_time",
-    "planUserId": "plan_user_id",
+    "junkRequirementId": "junk_requirement_id",
+    "typeCd": "type_cd",
+    "classification": "classification",
+    "context": "context",
+    "referencePrice": "reference_price",
     "communityId": "community_id",
-    "planUserName": "plan_user_name",
-    "actUserId": "act_user_id",
-    "actUserName": "act_user_name",
-    "signType": "sign_type",
+    "publishUserId": "publish_user_id",
+    "publishUserName": "publish_user_name",
+    "publishUserLink": "publish_user_link",
+    "state": "state",
     "statusCd": "status_cd",
     "operate": "operate",
     "bId": "b_id"
   },
   "required": [
     {
-      "code": "inspectionPlanId",
-      "msg": "巡检计划不能为空"
+      "code": "typeCd",
+      "msg": "类型不能为空"
     },
     {
-      "code": "actInsTime",
-      "msg": "巡检时间不能为空"
+      "code": "classification",
+      "msg": "分类不能为空"
     },
     {
       "code": "communityId",
       "msg": "小区不能为空"
     },
     {
-      "code": "actUserId",
-      "msg": "巡检人不能为空"
+      "code": "context",
+      "msg": "内容不能为空"
     },
     {
-      "code": "actUserName",
-      "msg": "巡检人不能为空"
+      "code": "referencePrice",
+      "msg": "参考价格不能为空"
     },
     {
-      "code": "signType",
-      "msg": "巡检方式不能为空"
+      "code": "publishUserId",
+      "msg": "发布人ID不能为空"
+    },
+    {
+      "code": "publishUserName",
+      "msg": "发布人名称不能为空"
+    },
+    {
+      "code": "publishUserLink",
+      "msg": "发布人联系电话不能为空"
     }
   ]
 }

+ 56 - 0
java110-code-generator/src/main/resources/back/template_inspection_task.json

@@ -0,0 +1,56 @@
+{
+  "id": "taskId",
+  "name": "inspectionTask",
+  "desc": "活动",
+  "shareParam": "communityId",
+  "shareColumn": "community_id",
+  "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_INSPECTION_TASK",
+  "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_INSPECTION_TASK",
+  "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_INSPECTION_TASK",
+  "newBusinessTypeCdValue": "530200030001",
+  "updateBusinessTypeCdValue": "530200040001",
+  "deleteBusinessTypeCdValue": "530200050001",
+  "businessTableName": "business_inspection_task",
+  "tableName": "inspection_task",
+  "param": {
+    "taskId": "task_id",
+    "inspectionPlanId": "inspection_plan_id",
+    "planInsTime": "plan_ins_time",
+    "actInsTime": "act_ins_time",
+    "planUserId": "plan_user_id",
+    "communityId": "community_id",
+    "planUserName": "plan_user_name",
+    "actUserId": "act_user_id",
+    "actUserName": "act_user_name",
+    "signType": "sign_type",
+    "statusCd": "status_cd",
+    "operate": "operate",
+    "bId": "b_id"
+  },
+  "required": [
+    {
+      "code": "inspectionPlanId",
+      "msg": "巡检计划不能为空"
+    },
+    {
+      "code": "actInsTime",
+      "msg": "巡检时间不能为空"
+    },
+    {
+      "code": "communityId",
+      "msg": "小区不能为空"
+    },
+    {
+      "code": "actUserId",
+      "msg": "巡检人不能为空"
+    },
+    {
+      "code": "actUserName",
+      "msg": "巡检人不能为空"
+    },
+    {
+      "code": "signType",
+      "msg": "巡检方式不能为空"
+    }
+  ]
+}

+ 1 - 0
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java

@@ -123,6 +123,7 @@ public class GenerateCodeFactory {
     public static final String CODE_PREFIX_taskDetailId = "53";
     public static final String CODE_PREFIX_applyOrderId = "15";
     public static final String CODE_PREFIX_fastuserId = "68";
+    public static final String CODE_PREFIX_junkRequirementId = "69";
 
 
 

+ 41 - 0
java110-core/src/main/java/com/java110/core/smo/junkRequirement/IJunkRequirementInnerServiceSMO.java

@@ -0,0 +1,41 @@
+package com.java110.core.smo.junkRequirement;
+
+import com.java110.core.feign.FeignConfiguration;
+import com.java110.dto.junkRequirement.JunkRequirementDto;
+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 IJunkRequirementInnerServiceSMO
+ * @Description 旧货市场接口类
+ * @Author wuxw
+ * @Date 2019/4/24 9:04
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@FeignClient(name = "user-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/junkRequirementApi")
+public interface IJunkRequirementInnerServiceSMO {
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     * @param junkRequirementDto 数据对象分享
+     * @return JunkRequirementDto 对象数据
+     */
+    @RequestMapping(value = "/queryJunkRequirements", method = RequestMethod.POST)
+    List<JunkRequirementDto> queryJunkRequirements(@RequestBody JunkRequirementDto junkRequirementDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param junkRequirementDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryJunkRequirementsCount", method = RequestMethod.POST)
+    int queryJunkRequirementsCount(@RequestBody JunkRequirementDto junkRequirementDto);
+}

+ 38 - 0
java110-db/db/UserService/create_junk_market.sql

@@ -0,0 +1,38 @@
+
+-- 单元信息 building 楼宇管理
+CREATE TABLE business_junk_requirement(
+  junk_requirement_id VARCHAR(30) NOT NULL COMMENT 'ID编码',
+  b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
+  type_cd VARCHAR(12) NOT NULL COMMENT '类型 旧货还是需求 旧货 222222 需求 333333',
+  classification VARCHAR(12) NOT NULL COMMENT '类别,具体查看t_dict 表',
+  context VARCHAR(200) NOT NULL COMMENT '内容',
+  reference_price DECIMAL(12,2) NOT NULL COMMENT '参考价格',
+  community_id varchar(30) not null comment '小区ID',
+  publish_user_id VARCHAR(30) NOT NULL COMMENT '发布用户ID',
+  publish_user_name VARCHAR(30) NOT NULL COMMENT '发布用户名称',
+  publish_user_link VARCHAR(11) NOT NULL COMMENT '联系电话',
+  state VARCHAR(12) NOT NULL COMMENT '状态,12001 未审核 13001 审核通过 14001 审核失败  15001 处理完成',
+  create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  operate VARCHAR(4) NOT NULL COMMENT '数据状态,添加ADD,修改MOD 删除DEL'
+);
+
+
+CREATE TABLE junk_requirement(
+  junk_requirement_id VARCHAR(30) NOT NULL COMMENT 'ID编码',
+  b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
+  type_cd VARCHAR(12) NOT NULL COMMENT '类型 旧货还是需求 旧货 222222 需求 333333',
+  classification VARCHAR(12) NOT NULL COMMENT '类别,具体查看t_dict 表',
+  context VARCHAR(200) NOT NULL COMMENT '内容',
+  reference_price DECIMAL(12,2) NOT NULL COMMENT '参考价格',
+  community_id varchar(30) not null comment '小区ID',
+  publish_user_id VARCHAR(30) NOT NULL COMMENT '发布用户ID',
+  publish_user_name VARCHAR(30) NOT NULL COMMENT '发布用户名称',
+  publish_user_link VARCHAR(11) NOT NULL COMMENT '联系电话',
+  state VARCHAR(12) NOT NULL COMMENT '状态,12001 未审核 13001 审核通过 14001 审核失败  15001 处理完成',
+  create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,0, 在用 1失效',
+  UNIQUE KEY (junk_requirement_id)
+);
+CREATE INDEX idx_junk_req_id ON junk_requirement(junk_requirement_id);
+CREATE INDEX idx_junk_req_b_id ON junk_requirement(b_id);
+

+ 247 - 0
java110-db/src/main/resources/mapper/user/JunkRequirementServiceDaoImplMapper.xml

@@ -0,0 +1,247 @@
+<?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="junkRequirementServiceDaoImpl">
+
+    <!-- 保存旧货市场信息 add by wuxw 2018-07-03 -->
+       <insert id="saveBusinessJunkRequirementInfo" parameterType="Map">
+           insert into business_junk_requirement(
+publish_user_name,publish_user_id,junk_requirement_id,classification,reference_price,operate,type_cd,publish_user_link,context,state,community_id,b_id
+) values (
+#{publishUserName},#{publishUserId},#{junkRequirementId},#{classification},#{referencePrice},#{operate},#{typeCd},#{publishUserLink},#{context},#{state},#{communityId},#{bId}
+)
+       </insert>
+
+
+       <!-- 查询旧货市场信息(Business) add by wuxw 2018-07-03 -->
+       <select id="getBusinessJunkRequirementInfo" parameterType="Map" resultType="Map">
+           select  t.publish_user_name,t.publish_user_name publishUserName,t.publish_user_id,t.publish_user_id publishUserId,t.junk_requirement_id,t.junk_requirement_id junkRequirementId,t.classification,t.reference_price,t.reference_price referencePrice,t.operate,t.type_cd,t.type_cd typeCd,t.publish_user_link,t.publish_user_link publishUserLink,t.context,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id bId 
+from business_junk_requirement t 
+where 1 =1 
+<if test="publishUserName !=null and publishUserName != ''">
+   and t.publish_user_name= #{publishUserName}
+</if> 
+<if test="publishUserId !=null and publishUserId != ''">
+   and t.publish_user_id= #{publishUserId}
+</if> 
+<if test="junkRequirementId !=null and junkRequirementId != ''">
+   and t.junk_requirement_id= #{junkRequirementId}
+</if> 
+<if test="classification !=null and classification != ''">
+   and t.classification= #{classification}
+</if> 
+<if test="referencePrice !=null and referencePrice != ''">
+   and t.reference_price= #{referencePrice}
+</if> 
+<if test="operate !=null and operate != ''">
+   and t.operate= #{operate}
+</if> 
+<if test="typeCd !=null and typeCd != ''">
+   and t.type_cd= #{typeCd}
+</if> 
+<if test="publishUserLink !=null and publishUserLink != ''">
+   and t.publish_user_link= #{publishUserLink}
+</if> 
+<if test="context !=null and context != ''">
+   and t.context= #{context}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+
+       </select>
+
+
+
+
+
+    <!-- 保存旧货市场信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="saveJunkRequirementInfoInstance" parameterType="Map">
+        insert into junk_requirement(
+publish_user_name,publish_user_id,status_cd,junk_requirement_id,classification,reference_price,type_cd,publish_user_link,context,state,community_id,b_id
+) select t.publish_user_name,t.publish_user_id,'0',t.junk_requirement_id,t.classification,t.reference_price,t.type_cd,t.publish_user_link,t.context,t.state,t.community_id,t.b_id from business_junk_requirement t where 1=1
+<if test="publishUserName !=null and publishUserName != ''">
+   and t.publish_user_name= #{publishUserName}
+</if> 
+<if test="publishUserId !=null and publishUserId != ''">
+   and t.publish_user_id= #{publishUserId}
+</if> 
+<if test="junkRequirementId !=null and junkRequirementId != ''">
+   and t.junk_requirement_id= #{junkRequirementId}
+</if> 
+<if test="classification !=null and classification != ''">
+   and t.classification= #{classification}
+</if> 
+<if test="referencePrice !=null and referencePrice != ''">
+   and t.reference_price= #{referencePrice}
+</if> 
+   and t.operate= 'ADD'
+<if test="typeCd !=null and typeCd != ''">
+   and t.type_cd= #{typeCd}
+</if> 
+<if test="publishUserLink !=null and publishUserLink != ''">
+   and t.publish_user_link= #{publishUserLink}
+</if> 
+<if test="context !=null and context != ''">
+   and t.context= #{context}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+
+    </insert>
+
+
+
+    <!-- 查询旧货市场信息 add by wuxw 2018-07-03 -->
+    <select id="getJunkRequirementInfo" parameterType="Map" resultType="Map">
+        select  t.publish_user_name,t.publish_user_name publishUserName,t.publish_user_id,t.publish_user_id publishUserId,t.status_cd,t.status_cd statusCd,t.junk_requirement_id,t.junk_requirement_id junkRequirementId,t.classification,t.reference_price,t.reference_price referencePrice,t.type_cd,t.type_cd typeCd,t.publish_user_link,t.publish_user_link publishUserLink,t.context,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id bId 
+from junk_requirement t 
+where 1 =1 
+<if test="publishUserName !=null and publishUserName != ''">
+   and t.publish_user_name= #{publishUserName}
+</if> 
+<if test="publishUserId !=null and publishUserId != ''">
+   and t.publish_user_id= #{publishUserId}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="junkRequirementId !=null and junkRequirementId != ''">
+   and t.junk_requirement_id= #{junkRequirementId}
+</if> 
+<if test="classification !=null and classification != ''">
+   and t.classification= #{classification}
+</if> 
+<if test="referencePrice !=null and referencePrice != ''">
+   and t.reference_price= #{referencePrice}
+</if> 
+<if test="typeCd !=null and typeCd != ''">
+   and t.type_cd= #{typeCd}
+</if> 
+<if test="publishUserLink !=null and publishUserLink != ''">
+   and t.publish_user_link= #{publishUserLink}
+</if> 
+<if test="context !=null and context != ''">
+   and t.context= #{context}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+order by t.create_time desc
+<if test="page != -1 and page != null ">
+   limit #{page}, #{row}
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改旧货市场信息 add by wuxw 2018-07-03 -->
+    <update id="updateJunkRequirementInfoInstance" parameterType="Map">
+        update  junk_requirement t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="publishUserName !=null and publishUserName != ''">
+, t.publish_user_name= #{publishUserName}
+</if> 
+<if test="publishUserId !=null and publishUserId != ''">
+, t.publish_user_id= #{publishUserId}
+</if> 
+<if test="classification !=null and classification != ''">
+, t.classification= #{classification}
+</if> 
+<if test="referencePrice !=null and referencePrice != ''">
+, t.reference_price= #{referencePrice}
+</if> 
+<if test="typeCd !=null and typeCd != ''">
+, t.type_cd= #{typeCd}
+</if> 
+<if test="publishUserLink !=null and publishUserLink != ''">
+, t.publish_user_link= #{publishUserLink}
+</if> 
+<if test="context !=null and context != ''">
+, t.context= #{context}
+</if> 
+<if test="state !=null and state != ''">
+, t.state= #{state}
+</if> 
+<if test="communityId !=null and communityId != ''">
+, t.community_id= #{communityId}
+</if> 
+ where 1=1 <if test="junkRequirementId !=null and junkRequirementId != ''">
+and t.junk_requirement_id= #{junkRequirementId}
+</if> 
+<if test="bId !=null and bId != ''">
+and t.b_id= #{bId}
+</if> 
+
+    </update>
+
+    <!-- 查询旧货市场数量 add by wuxw 2018-07-03 -->
+     <select id="queryJunkRequirementsCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from junk_requirement t 
+where 1 =1 
+<if test="publishUserName !=null and publishUserName != ''">
+   and t.publish_user_name= #{publishUserName}
+</if> 
+<if test="publishUserId !=null and publishUserId != ''">
+   and t.publish_user_id= #{publishUserId}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="junkRequirementId !=null and junkRequirementId != ''">
+   and t.junk_requirement_id= #{junkRequirementId}
+</if> 
+<if test="classification !=null and classification != ''">
+   and t.classification= #{classification}
+</if> 
+<if test="referencePrice !=null and referencePrice != ''">
+   and t.reference_price= #{referencePrice}
+</if> 
+<if test="typeCd !=null and typeCd != ''">
+   and t.type_cd= #{typeCd}
+</if> 
+<if test="publishUserLink !=null and publishUserLink != ''">
+   and t.publish_user_link= #{publishUserLink}
+</if> 
+<if test="context !=null and context != ''">
+   and t.context= #{context}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+
+
+     </select>
+
+</mapper>

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

@@ -945,7 +945,20 @@ public class BusinessTypeConstant {
 
     public static final String BUSINESS_TYPE_DELETE_INSPECTION_TASK_DETAIL="540200050001";
 
+    /**
+     *  保存巡检任务
+     *  3保存
+     */
+    public static final String BUSINESS_TYPE_SAVE_JUNK_REQUIREMENT="550200030001";
+
+
+    /**
+     *  保存巡检任务
+     *  3保存
+     */
+    public static final String BUSINESS_TYPE_UPDATE_JUNK_REQUIREMENT="550200040001";
 
+    public static final String BUSINESS_TYPE_DELETE_JUNK_REQUIREMENT="550200050001";
 
 
 }

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

@@ -0,0 +1,31 @@
+package com.java110.utils.constant;
+
+/**
+ * 旧货市场常量类
+ * Created by wuxw on 2017/5/20.
+ */
+public class ServiceCodeJunkRequirementConstant {
+
+    /**
+     * 添加 旧货市场
+     */
+    public static final String ADD_JUNKREQUIREMENT = "junkRequirement.saveJunkRequirement";
+
+
+    /**
+     * 修改 旧货市场
+     */
+    public static final String UPDATE_JUNKREQUIREMENT = "junkRequirement.updateJunkRequirement";
+    /**
+     * 删除 旧货市场
+     */
+    public static final String DELETE_JUNKREQUIREMENT = "junkRequirement.deleteJunkRequirement";
+
+
+    /**
+     * 查询 旧货市场
+     */
+    public static final String LIST_JUNKREQUIREMENTS = "junkRequirement.listJunkRequirements";
+
+
+}