java110
2022-06-28 22e8a676ee42c0d78b3526bcd9a635abbe8dca03
service-api/src/main/java/com/java110/api/bmo/community/impl/CommunityBMOImpl.java
old mode 100644 new mode 100755
@@ -6,12 +6,16 @@
import com.java110.api.bmo.community.ICommunityBMO;
import com.java110.core.context.DataFlowContext;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.intf.community.ICommunityInnerServiceSMO;
import com.java110.dto.CommunityMemberDto;
import com.java110.dto.community.CommunityDto;
import com.java110.dto.workflow.WorkflowDto;
import com.java110.intf.common.IWorkflowInnerServiceSMO;
import com.java110.intf.community.ICommunityInnerServiceSMO;
import com.java110.po.community.CommunityAttrPo;
import com.java110.po.community.CommunityMemberPo;
import com.java110.po.community.CommunityPo;
import com.java110.po.fee.PayFeeConfigPo;
import com.java110.po.workflow.WorkflowPo;
import com.java110.utils.cache.MappingCache;
import com.java110.utils.constant.*;
import com.java110.utils.exception.ListenerExecuteException;
@@ -22,6 +26,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@@ -36,9 +41,11 @@
@Service("communityBMOImpl")
public class CommunityBMOImpl extends ApiBaseBMO implements ICommunityBMO {
    @Autowired
    private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
    @Autowired
    private IWorkflowInnerServiceSMO workflowInnerServiceSMOImpl;
    /**
     * 添加小区信息
@@ -94,6 +101,13 @@
     */
    public JSONObject addCommunityMember(JSONObject paramInJson) {
        //查询小区是否存在
        CommunityDto communityDto = new CommunityDto();
        communityDto.setCommunityId(paramInJson.getString("communityId"));
        List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
        Assert.listOnlyOne(communityDtos, "小区不存在");
        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_MEMBER_JOINED_COMMUNITY);
        business.put(CommonConstant.HTTP_SEQ, 2);
@@ -103,6 +117,10 @@
        businessCommunityMember.put("communityId", paramInJson.getString("communityId"));
        businessCommunityMember.put("memberId", paramInJson.getString("memberId"));
        businessCommunityMember.put("memberTypeCd", paramInJson.getString("memberTypeCd"));
        businessCommunityMember.put("startTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
        Calendar endTime = Calendar.getInstance();
        endTime.add(Calendar.MONTH, Integer.parseInt(communityDtos.get(0).getPayFeeMonth()));
        businessCommunityMember.put("endTime", DateUtil.getFormatTimeString(endTime.getTime(), DateUtil.DATE_FORMATE_STRING_A));
        String auditStatusCd = MappingCache.getValue(MappingConstant.DOMAIN_COMMUNITY_MEMBER_AUDIT, paramInJson.getString("memberTypeCd"));
        auditStatusCd = StringUtils.isEmpty(auditStatusCd) ? StateConstant.AGREE_AUDIT : auditStatusCd;
        businessCommunityMember.put("auditStatusCd", auditStatusCd);
@@ -110,6 +128,76 @@
        return business;
    }
    /**
     * 添加小区成员
     *
     * @param paramInJson 接口请求数据封装
     * @return 封装好的 data数据
     */
    public JSONObject updateWorkflow(JSONObject paramInJson,String flowType) {
        WorkflowDto workflowDto = new WorkflowDto();
        workflowDto.setCommunityId(paramInJson.getString("communityId"));
        workflowDto.setFlowType(flowType);
        List<WorkflowDto> workflowDtos = workflowInnerServiceSMOImpl.queryWorkflows(workflowDto);
        if (workflowDtos == null || workflowDtos.size() < 1) {
            return null;
        }
        return getBusiness(paramInJson, workflowDtos);
    }
    /**
     * 修改物品领用
     *
     * @param paramInJson
     * @return
     */
    public JSONObject updateComplaint2(JSONObject paramInJson) {
        WorkflowDto workflowDto = new WorkflowDto();
        workflowDto.setCommunityId(paramInJson.getString("communityId"));
        workflowDto.setFlowType(WorkflowDto.FLOW_TYPE_COLLECTION);
        List<WorkflowDto> workflowDtos = workflowInnerServiceSMOImpl.queryWorkflows(workflowDto);
        if (workflowDtos == null || workflowDtos.size() < 1) {
            return null;
        }
        return getBusiness(paramInJson, workflowDtos);
    }
    /**
     * 修改物品被调拨
     *
     * @param paramInJson
     * @return
     */
    public JSONObject updateComplaint3(JSONObject paramInJson) {
        WorkflowDto workflowDto = new WorkflowDto();
        workflowDto.setCommunityId(paramInJson.getString("communityId"));
        workflowDto.setFlowType(WorkflowDto.FLOW_TYPE_ALLOCATION_STOREHOUSE_GO);
        List<WorkflowDto> workflowDtos = workflowInnerServiceSMOImpl.queryWorkflows(workflowDto);
        if (workflowDtos == null || workflowDtos.size() < 1) {
            return null;
        }
        return getBusiness(paramInJson, workflowDtos);
    }
    public JSONObject getBusiness(JSONObject paramInJson, List<WorkflowDto> workflowDtos) {
        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_WORKFLOW);
        business.put(CommonConstant.HTTP_SEQ, 2);
        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
        JSONObject businessCommunityMember = new JSONObject();
        businessCommunityMember.put("flowId", workflowDtos.get(0).getFlowId());
        businessCommunityMember.put("communityId", paramInJson.getString("communityId"));
        businessCommunityMember.put("storeId", paramInJson.getString("memberId"));
        JSONArray data = new JSONArray();
        data.add(businessCommunityMember);
        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(WorkflowPo.class.getSimpleName(), data);
        return business;
    }
    /**
     * 添加小区成员
@@ -441,6 +529,7 @@
     */
    public void addCommunityMembers(JSONObject paramInJson, DataFlowContext dataFlowContext) {
        JSONObject businessCommunityMember = new JSONObject();
        businessCommunityMember.put("communityMemberId", "-1");
        businessCommunityMember.put("communityId", paramInJson.getString("communityId"));
@@ -483,6 +572,7 @@
        paramInJson.put("communityId", GenerateCodeFactory.getCommunityId());
        paramInJson.put("state", "1000");
        paramInJson.put("communityArea", "0");
        CommunityPo communityPo = BeanConvertUtil.covertBean(paramInJson, CommunityPo.class);
        super.insert(dataFlowContext, communityPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_COMMUNITY_INFO);
@@ -495,12 +585,39 @@
     * @param dataFlowContext 数据上下文
     * @return 订单服务能够接受的报文
     */
    public void updateCommunityOne(JSONObject paramInJson, DataFlowContext dataFlowContext) {
    public void addAttr(JSONObject paramInJson, DataFlowContext dataFlowContext) {
        paramInJson.put("attrId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId));
        CommunityAttrPo communityAttrPo = BeanConvertUtil.covertBean(paramInJson, CommunityAttrPo.class);
        super.insert(dataFlowContext, communityAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_COMMUNITY_INFO);
    }
    /**
     * 添加小区信息
     *
     * @param paramInJson     接口调用放传入入参
     * @param dataFlowContext 数据上下文
     * @return 订单服务能够接受的报文
     */
    public void updateAttr(JSONObject paramInJson, DataFlowContext dataFlowContext) {
        CommunityAttrPo communityAttrPo = BeanConvertUtil.covertBean(paramInJson, CommunityAttrPo.class);
        super.insert(dataFlowContext, communityAttrPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_COMMUNITY_INFO);
    }
    /**
     * 添加小区信息
     *
     * @param paramInJson     接口调用放传入入参
     * @param dataFlowContext 数据上下文
     * @return 订单服务能够接受的报文
     */
    public void updateCommunityOne(JSONObject paramInJson, DataFlowContext dataFlowContext) {
        CommunityPo communityPo = BeanConvertUtil.covertBean(paramInJson, CommunityPo.class);
        super.update(dataFlowContext, communityPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_COMMUNITY_INFO);
    }
}