wuxw лет назад: 6
Родитель
Сommit
3dd8a773b5

+ 196 - 0
Api/src/main/java/com/java110/api/listener/fee/SaveRoomCreateFeeListener.java

@@ -0,0 +1,196 @@
+package com.java110.api.listener.fee;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.listener.AbstractServiceApiDataFlowListener;
+import com.java110.api.listener.AbstractServiceApiListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.smo.room.IRoomInnerServiceSMO;
+import com.java110.dto.RoomDto;
+import com.java110.entity.center.AppService;
+import com.java110.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.constant.FeeTypeConstant;
+import com.java110.utils.constant.ServiceCodeConstant;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.DateUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.List;
+
+/**
+ * @ClassName SaveRoomCreateFeeListener
+ * @Description TODO
+ * @Author wuxw
+ * @Date 2020/1/31 15:57
+ * @Version 1.0
+ * add by wuxw 2020/1/31
+ **/
+@Java110Listener("saveRoomCreateFeeListener")
+public class SaveRoomCreateFeeListener extends AbstractServiceApiListener {
+    private static Logger logger = LoggerFactory.getLogger(SaveRoomCreateFeeListener.class);
+
+    private static final int DEFAULT_ADD_FEE_COUNT = 200;
+
+    @Autowired
+    private IRoomInnerServiceSMO roomInnerServiceSMOImpl;
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_SAVE_ROOM_CREATE_FEE;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        // super.validatePageInfo(pd);
+        Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区ID");
+        Assert.hasKeyAndValue(reqJson, "locationTypeCd", "未包含收费范围");
+        Assert.hasKeyAndValue(reqJson, "locationObjId", "未包含收费对象");
+        Assert.hasKeyAndValue(reqJson, "configId", "未包含收费项目");
+        Assert.hasKeyAndValue(reqJson, "billType", "未包含出账类型");
+        Assert.hasKeyAndValue(reqJson, "storeId", "未包含商户ID");
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+        logger.debug("ServiceDataFlowEvent : {}", event);
+        List<RoomDto> roomDtos = null;
+        //判断收费范围
+        if ("1000".equals(reqJson.getString("locationTypeCd"))) {//小区
+            RoomDto roomDto = new RoomDto();
+            roomDto.setCommunityId(reqJson.getString("communityId"));
+            roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
+
+        } else if ("4000".equals(reqJson.getString("locationTypeCd"))) {//楼栋
+            RoomDto roomDto = new RoomDto();
+            roomDto.setCommunityId(reqJson.getString("communityId"));
+            roomDto.setFloorId(reqJson.getString("locationObjId"));
+            roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
+
+        } else if ("2000".equals(reqJson.getString("locationTypeCd"))) {//单元
+            RoomDto roomDto = new RoomDto();
+            roomDto.setCommunityId(reqJson.getString("communityId"));
+            roomDto.setUnitId(reqJson.getString("locationObjId"));
+            roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
+        } else if ("3000".equals(reqJson.getString("locationTypeCd"))) {//房屋
+            RoomDto roomDto = new RoomDto();
+            roomDto.setCommunityId(reqJson.getString("communityId"));
+            roomDto.setRoomId(reqJson.getString("locationObjId"));
+            roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
+        } else {
+            throw new IllegalArgumentException("收费范围错误");
+        }
+
+        if (roomDtos == null || roomDtos.size() < 1) {
+            throw new IllegalArgumentException("未查到需要付费的房屋");
+        }
+
+        dealRoomFee(roomDtos, context, reqJson, event);
+    }
+
+    private void dealRoomFee(List<RoomDto> roomDtos, DataFlowContext context, JSONObject reqJson, ServiceDataFlowEvent event) {
+
+        AppService service = event.getAppService();
+
+
+
+        HttpHeaders header = new HttpHeaders();
+        context.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD, "D");
+        JSONArray businesses = new JSONArray();
+        JSONObject paramInObj = null;
+        ResponseEntity<String> responseEntity = null;
+        int failRooms = 0;
+        //添加单元信息
+        for (int roomIndex = 0; roomIndex < roomDtos.size(); roomIndex++) {
+            businesses.add(addFee(roomDtos.get(0), reqJson, context));
+
+            if (roomIndex % DEFAULT_ADD_FEE_COUNT == 0) {
+                paramInObj = super.restToCenterProtocol(businesses, context.getRequestCurrentHeaders());
+                //将 rest header 信息传递到下层服务中去
+                super.freshHttpHeader(header, context.getRequestCurrentHeaders());
+
+                responseEntity = this.callService(context, service.getServiceCode(), paramInObj);
+
+                if (responseEntity.getStatusCode() != HttpStatus.OK) {
+                    failRooms++;
+                }
+
+                businesses = new JSONArray();
+            }
+        }
+        if (businesses != null && businesses.size() > 0) {
+
+            paramInObj = super.restToCenterProtocol(businesses, context.getRequestCurrentHeaders());
+            //将 rest header 信息传递到下层服务中去
+            super.freshHttpHeader(header, context.getRequestCurrentHeaders());
+            responseEntity = this.callService(context, service.getServiceCode(), paramInObj);
+            if (responseEntity.getStatusCode() != HttpStatus.OK) {
+                failRooms++;
+            }
+        }
+
+        JSONObject paramOut = new JSONObject();
+        paramOut.put("totalRoom", roomDtos.size());
+        paramOut.put("successRoom", roomDtos.size() - failRooms);
+        paramOut.put("errorRoom", failRooms);
+
+        responseEntity = new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK);
+
+        context.setResponseEntity(responseEntity);
+    }
+
+    /**
+     * 添加物业费用
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    private JSONObject addFee(RoomDto roomDto, JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_INFO);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 1);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessUnit = new JSONObject();
+        businessUnit.put("feeId", "-1");
+        businessUnit.put("configId", paramInJson.getString("configId"));
+        businessUnit.put("incomeObjId", paramInJson.getString("storeId"));
+        businessUnit.put("amount", "-1.00");
+        businessUnit.put("startTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
+        businessUnit.put("endTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
+        businessUnit.put("communityId", paramInJson.getString("communityId"));
+        businessUnit.put("payerObjId", roomDto.getRoomId());
+        businessUnit.put("userId", dataFlowContext.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFee", businessUnit);
+
+        return business;
+    }
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+    public IRoomInnerServiceSMO getRoomInnerServiceSMOImpl() {
+        return roomInnerServiceSMOImpl;
+    }
+
+    public void setRoomInnerServiceSMOImpl(IRoomInnerServiceSMO roomInnerServiceSMOImpl) {
+        this.roomInnerServiceSMOImpl = roomInnerServiceSMOImpl;
+    }
+}

+ 2 - 1
CommunityService/src/main/java/com/java110/community/listener/room/AbstractRoomBusinessServiceDataFlowListener.java

@@ -49,6 +49,7 @@ public abstract class AbstractRoomBusinessServiceDataFlowListener extends Abstra
         businessRoomInfo.put("roomNum", businessRoomInfo.get("room_num"));
         businessRoomInfo.put("unitId", businessRoomInfo.get("unit_id"));
         businessRoomInfo.put("apartment", businessRoomInfo.get("apartment"));
+        businessRoomInfo.put("communityId", businessRoomInfo.get("community_id"));
         businessRoomInfo.remove("bId");
         businessRoomInfo.put("statusCd", statusCd);
     }
@@ -85,7 +86,7 @@ public abstract class AbstractRoomBusinessServiceDataFlowListener extends Abstra
         currentRoomInfo.put("roomNum", currentRoomInfo.get("room_num"));
         currentRoomInfo.put("unitId", currentRoomInfo.get("unit_id"));
         currentRoomInfo.put("apartment", currentRoomInfo.get("apartment"));
-
+        currentRoomInfo.put("communityId", currentRoomInfo.get("community_id"));
 
         currentRoomInfo.put("operate", StatusConstant.OPERATE_DEL);
         getRoomServiceDaoImpl().saveBusinessRoomInfo(currentRoomInfo);

+ 62 - 0
WebService/src/main/java/com/java110/web/components/fee/RoomCreateFeeAddComponent.java

@@ -0,0 +1,62 @@
+package com.java110.web.components.fee;
+
+
+import com.java110.core.context.IPageData;
+import com.java110.web.smo.feeConfig.IListFeeConfigsSMO;
+import com.java110.web.smo.feeConfig.IRoomCreateFeeSMO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+
+
+/**
+ * 费用项组件管理类
+ * <p>
+ * add by wuxw
+ * <p>
+ * 2019-06-29
+ */
+@Component("roomCreateFeeAdd")
+public class RoomCreateFeeAddComponent {
+
+    @Autowired
+    private IListFeeConfigsSMO listFeeConfigsSMOImpl;
+
+    @Autowired
+    private IRoomCreateFeeSMO roomCreateFeeSMOImpl;
+
+    /**
+     * 查询费用项列表
+     *
+     * @param pd 页面数据封装
+     * @return 返回 ResponseEntity 对象
+     */
+    public ResponseEntity<String> list(IPageData pd) {
+        return listFeeConfigsSMOImpl.listFeeConfigs(pd);
+    }
+
+    /**
+     * 批量创建费用
+     * @param pd
+     * @return
+     */
+    public ResponseEntity<String> save(IPageData pd) {
+        return roomCreateFeeSMOImpl.createFee(pd);
+    }
+
+    public IListFeeConfigsSMO getListFeeConfigsSMOImpl() {
+        return listFeeConfigsSMOImpl;
+    }
+
+    public void setListFeeConfigsSMOImpl(IListFeeConfigsSMO listFeeConfigsSMOImpl) {
+        this.listFeeConfigsSMOImpl = listFeeConfigsSMOImpl;
+    }
+
+    public IRoomCreateFeeSMO getRoomCreateFeeSMOImpl() {
+        return roomCreateFeeSMOImpl;
+    }
+
+    public void setRoomCreateFeeSMOImpl(IRoomCreateFeeSMO roomCreateFeeSMOImpl) {
+        this.roomCreateFeeSMOImpl = roomCreateFeeSMOImpl;
+    }
+}

+ 22 - 0
WebService/src/main/java/com/java110/web/smo/feeConfig/IRoomCreateFeeSMO.java

@@ -0,0 +1,22 @@
+package com.java110.web.smo.feeConfig;
+
+import com.java110.core.context.IPageData;
+import com.java110.utils.exception.SMOException;
+import org.springframework.http.ResponseEntity;
+
+/**
+ * 费用项管理服务接口类
+ * <p>
+ * add by wuxw 2019-06-29
+ */
+public interface IRoomCreateFeeSMO {
+
+    /**
+     * 查询费用项信息
+     *
+     * @param pd 页面数据封装
+     * @return ResponseEntity 对象数据
+     * @throws SMOException 业务代码层
+     */
+    ResponseEntity<String> createFee(IPageData pd) throws SMOException;
+}

+ 68 - 0
WebService/src/main/java/com/java110/web/smo/feeConfig/impl/RoomCreateFeeSMOImpl.java

@@ -0,0 +1,68 @@
+package com.java110.web.smo.feeConfig.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.component.AbstractComponentSMO;
+import com.java110.core.context.IPageData;
+import com.java110.entity.component.ComponentValidateResult;
+import com.java110.utils.constant.ServiceConstant;
+import com.java110.utils.exception.SMOException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.web.smo.feeConfig.IListFeeConfigsSMO;
+import com.java110.web.smo.feeConfig.IRoomCreateFeeSMO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.Map;
+
+/**
+ * 查询feeConfig服务类
+ */
+@Service("roomCreateFeeSMOImpl")
+public class RoomCreateFeeSMOImpl extends AbstractComponentSMO implements IRoomCreateFeeSMO {
+
+    @Autowired
+    private RestTemplate restTemplate;
+
+    @Override
+    public ResponseEntity<String> createFee(IPageData pd) throws SMOException {
+        return businessProcess(pd);
+    }
+
+    @Override
+    protected void validate(IPageData pd, JSONObject paramIn) {
+        Assert.hasKeyAndValue(paramIn, "communityId", "未包含小区ID");
+        Assert.hasKeyAndValue(paramIn, "locationTypeCd", "未包含收费范围");
+        Assert.hasKeyAndValue(paramIn, "locationObjId", "未包含收费对象");
+        Assert.hasKeyAndValue(paramIn, "configId", "未包含收费项目");
+        Assert.hasKeyAndValue(paramIn, "billType", "未包含出账类型");
+    }
+
+    @Override
+    protected ResponseEntity<String> doBusinessProcess(IPageData pd, JSONObject paramIn) {
+        ComponentValidateResult result = super.validateStoreStaffCommunityRelationship(pd, restTemplate);
+
+        Map paramMap = BeanConvertUtil.beanCovertMap(result);
+        paramIn.putAll(paramMap);
+
+        String apiUrl = ServiceConstant.SERVICE_API_URL + "/api/fee.saveRoomCreateFee";
+
+
+        ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, JSONObject.toJSONString(paramMap),
+                apiUrl,
+                HttpMethod.POST);
+
+        return responseEntity;
+    }
+
+    public RestTemplate getRestTemplate() {
+        return restTemplate;
+    }
+
+    public void setRestTemplate(RestTemplate restTemplate) {
+        this.restTemplate = restTemplate;
+    }
+}

+ 5 - 2
WebService/src/main/resources/components/feePackage/roomCreateFee/roomCreateFee.html

@@ -79,7 +79,7 @@
                     <h5>房屋信息</h5>
                     <div class="ibox-tools" style="top:10px;">
                         <button type="button" class="btn btn-primary btn-sm"
-                                style="margin-left:10px" v-on:click="_openAddRoom()">
+                                style="margin-left:10px" v-on:click="_openRoomCreateFeeAddModal(null,true)">
                             <i class="glyphicon glyphicon-plus"></i> 批量创建收费
                         </button>
                         <button type="button" class="btn btn-primary btn-sm"
@@ -126,7 +126,7 @@
                             </td>
                             <td class="text-right">
                                 <div class="btn-group">
-                                    <button class="btn-white btn btn-xs" v-on:click="_openEditRoomModel(room)">创建收费
+                                    <button class="btn-white btn btn-xs" v-on:click="_openRoomCreateFeeAddModal(room,false)">创建收费
                                     </button>
                                 </div>
                                 <div class="btn-group">
@@ -159,4 +159,7 @@
                emitChooseFloor="room"
                emitLoadData="room"
     ></vc:create>
+
+    <vc:create name="roomCreateFeeAdd"
+    ></vc:create>
 </div>

+ 5 - 2
WebService/src/main/resources/components/feePackage/roomCreateFee/roomCreateFee.js

@@ -75,8 +75,11 @@
                              }
                            );
             },
-            _openAddRoom:function(){
-                vc.jumpToPage("/flow/addRoomBindingFlow");
+            _openRoomCreateFeeAddModal:function(_room,_isMore){
+                vc.emit('roomCreateFeeAdd', 'openRoomCreateFeeAddModal',{
+                    isMore:_isMore,
+                    room:_room
+                });
             },
             _openEditRoomModel:function(_room){
                 //_room.floorId = vc.component.roomCreateFeeInfo.conditions.floorId;

+ 100 - 0
WebService/src/main/resources/components/feePackage/roomCreateFeeAdd/roomCreateFeeAdd.html

@@ -0,0 +1,100 @@
+<div id="roomCreateFeeAddModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
+     aria-hidden="true">
+    <div class="modal-dialog modal-lg">
+        <div class="modal-content">
+            <div class="modal-body">
+                <h3 class="m-t-none m-b ">创建费用</h3>
+                <div class="ibox-content">
+                    <div>
+                        <div>
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-form-label">收费范围</label>
+                                <div class="col-sm-10">
+                                    <select class="custom-select" v-model="roomCreateFeeAddInfo.locationTypeCd">
+                                        <option selected disabled value="">必填,请选择收费范围</option>
+                                        <option value="1000">小区</option>
+                                        <option value="4000">楼栋</option>
+                                        <option value="2000">单元</option>
+                                        <option value="3000">房屋</option>
+                                    </select></div>
+                            </div>
+                            <div class="form-group row"
+                                 v-show="roomCreateFeeAddInfo.locationTypeCd == '2000' || roomCreateFeeAddInfo.locationTypeCd == '3000' ||roomCreateFeeAddInfo.locationTypeCd == '4000' ">
+                                <label class="col-sm-2 col-form-label">楼栋</label>
+                                <div class="col-sm-10">
+                                    <vc:create name="floorSelect2"
+                                               parentModal="roomCreateFeeAddModel"
+                                               namespace="roomCreateFeeAdd"
+                                    ></vc:create>
+                                </div>
+                            </div>
+                            <div class="form-group row"
+                                 v-show="roomCreateFeeAddInfo.locationTypeCd == '2000' || roomCreateFeeAddInfo.locationTypeCd == '3000'  ">
+                                <label class="col-sm-2 col-form-label">单元</label>
+                                <div class="col-sm-10">
+                                    <vc:create name="unitSelect2"
+                                               parentModal="roomCreateFeeAddModel"
+                                               callBackListener="roomCreateFeeAdd"
+                                               callBackFunction="notify"
+                                               namespace="roomCreateFeeAdd"
+                                    ></vc:create>
+                                </div>
+                            </div>
+                            <div class="form-group row"
+                                 v-show="roomCreateFeeAddInfo.locationTypeCd == '3000'  ">
+                                <label class="col-sm-2 col-form-label">房屋</label>
+                                <div class="col-sm-10">
+                                    <vc:create name="roomSelect2"
+                                               parentModal="roomCreateFeeAddModel"
+                                               callBackListener="roomCreateFeeAdd"
+                                               callBackFunction="notify"
+                                               namespace="roomCreateFeeAdd"
+                                    ></vc:create>
+                                </div>
+                            </div>
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-form-label">费用类型</label>
+                                <div class="col-sm-10">
+                                    <select class="custom-select" v-model="roomCreateFeeAddInfo.feeTypeCd" @change="_changeFeeTypeCd(roomCreateFeeAddInfo.feeTypeCd)">
+                                        <option selected disabled value="">必填,请选择费用类型</option>
+                                        <option v-for="(item,index) in roomCreateFeeAddInfo.feeTypeCds" :key="index"
+                                                v-bind:value="item.statusCd">{{item.name}}
+                                        </option>
+                                    </select></div>
+                            </div>
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-form-label">收费项目</label>
+                                <div class="col-sm-10">
+                                    <select class="custom-select" v-model="roomCreateFeeAddInfo.configId">
+                                        <option selected disabled value="">必填,请选择收费项目</option>
+                                        <option v-for="(item,index) in roomCreateFeeAddInfo.feeConfigs" :key="index"
+                                                v-bind:value="item.configId">{{item.feeName}}
+                                        </option>
+                                    </select></div>
+                            </div>
+                            <div class="form-group row" v-if="roomCreateFeeAddInfo.computingFormula != '2002'">
+                                <label class="col-sm-2 col-form-label">出账类型</label>
+                                <div class="col-sm-10">
+                                    <select class="custom-select" v-model="roomCreateFeeAddInfo.billType">
+                                        <option selected disabled value="">必填,请选择出账类型</option>
+                                        <option  value="001">每年1月1日</option>
+                                        <option  value="002">每月1日</option>
+                                        <option  value="003">每日</option>
+                                    </select>
+                                </div>
+                            </div>
+                            <div class="ibox-content">
+                                <button class="btn btn-primary float-right" type="button"
+                                        v-on:click="saveRoomCreateFeeInfo()"><i class="fa fa-check"></i>&nbsp;提交
+                                </button>
+                                <button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
+                                        data-dismiss="modal">取消
+                                </button>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>

+ 180 - 0
WebService/src/main/resources/components/feePackage/roomCreateFeeAdd/roomCreateFeeAdd.js

@@ -0,0 +1,180 @@
+(function(vc) {
+
+    vc.extends({
+        data: {
+            roomCreateFeeAddInfo: {
+                feeTypeCds:[],
+                feeConfigs:[],
+                locationTypeCd: '',
+                locationObjId: '',
+                floorId: '',
+                floorNum: '',
+                floorName: '',
+                unitId: '',
+                unitName: '',
+                roomId: '',
+                feeTypeCd:'',
+                configId:'',
+                billType:''
+            }
+        },
+        _initMethod: function() {
+            vc.getDict('pay_fee_config',"fee_type_cd",function(_data){
+                vc.component.roomCreateFeeAddInfo.feeTypeCds = _data;
+            });
+
+        },
+        _initEvent: function() {
+            vc.on('roomCreateFeeAdd', 'openRoomCreateFeeAddModal',
+            function() {
+                $('#roomCreateFeeAddModel').modal('show');
+            });
+
+            vc.on("roomCreateFeeAdd", "notify", function (_param) {
+                if (_param.hasOwnProperty("floorId")) {
+                    vc.component.roomCreateFeeAddInfo.floorId = _param.floorId;
+                }
+
+                if (_param.hasOwnProperty("unitId")) {
+                    vc.component.roomCreateFeeAddInfo.unitId = _param.unitId;
+                }
+
+                if (_param.hasOwnProperty("roomId")) {
+                    vc.component.roomCreateFeeAddInfo.roomId = _param.roomId;
+                }
+            });
+        },
+        methods: {
+
+            roomCreateFeeAddValidate() {
+                return vc.validate.validate({
+                    roomCreateFeeAddInfo: vc.component.roomCreateFeeAddInfo
+                },
+                {
+                    'roomCreateFeeAddInfo.locationTypeCd': [{
+                        limit: "required",
+                        param: "",
+                        errInfo: "收费范围不能为空"
+                    },
+                    {
+                        limit: "num",
+                        param: "",
+                        errInfo: "收费范围格式错误"
+                    },
+                    ],
+                    'roomCreateFeeAddInfo.locationObjId': [{
+                        limit: "required",
+                        param: "",
+                        errInfo: "收费对象不能为空"
+                    }
+                    ],
+                    'roomCreateFeeAddInfo.feeTypeCd': [{
+                        limit: "required",
+                        param: "",
+                        errInfo: "费用类型不能为空"
+                    }
+                    ],
+                    'roomCreateFeeAddInfo.configId': [{
+                        limit: "required",
+                        param: "",
+                        errInfo: "费用项目不能为空"
+                    }
+                    ],
+                    'roomCreateFeeAddInfo.billType': [{
+                        limit: "required",
+                        param: "",
+                        errInfo: "出账类型不能为空"
+                    }
+                    ]
+                });
+            },
+            saveRoomCreateFeeInfo: function() {
+
+                vc.component.roomCreateFeeAddInfo.communityId = vc.getCurrentCommunity().communityId;
+                if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '1000') { //大门时直接写 小区ID
+                    vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.communityId;
+                } else if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '2000') {
+                    vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.unitId;
+                } else if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '3000') {
+                    vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.roomId;
+                } else if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '4000') {
+                    vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.floorId;
+                } else {
+                    vc.toast("收费范围错误");
+                    return;
+                }
+
+                if (!vc.component.roomCreateFeeAddValidate()) {
+                    vc.toast(vc.validate.errInfo);
+                    return;
+                }
+
+                vc.component.roomCreateFeeAddInfo.communityId = vc.getCurrentCommunity().communityId;
+
+                vc.http.post('roomCreateFeeAdd', 'save', JSON.stringify(vc.component.roomCreateFeeAddInfo), {
+                    emulateJSON: true
+                },
+                function(json, res) {
+                    //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
+                    if (res.status == 200) {
+                        //关闭model
+                        $('#roomCreateFeeAddModel').modal('hide');
+                        vc.component.clearAddFeeConfigInfo();
+                        vc.toast("收费成功");
+                        return;
+                    }
+                    vc.message(json);
+
+                },
+                function(errInfo, error) {
+                    console.log('请求失败处理');
+
+                    vc.message(errInfo);
+
+                });
+            },
+            clearAddFeeConfigInfo: function() {
+                var _feeTypeCds = vc.component.roomCreateFeeAddInfo.feeTypeCds;
+                vc.component.roomCreateFeeAddInfo = {
+                    feeConfigs:[],
+                    locationTypeCd: '',
+                    locationObjId: '',
+                    floorId: '',
+                    floorNum: '',
+                    floorName: '',
+                    unitId: '',
+                    unitName: '',
+                    roomId: '',
+                    feeTypeCd:'',
+                    configId:'',
+                    billType:''
+                };
+
+                vc.component.roomCreateFeeAddInfo.feeTypeCds = _feeTypeCds;
+            },
+            _changeFeeTypeCd:function(_feeTypeCd){
+
+                var param = {
+                    params: {
+                        page:1,
+                        row:20,
+                        communityId:vc.getCurrentCommunity().communityId,
+                        feeTypeCd:_feeTypeCd,
+                        isDefault:'F'
+                    }
+                };
+
+                //发送get请求
+                vc.http.get('roomCreateFeeAdd', 'list', param,
+                function(json, res) {
+                    var _feeConfigManageInfo = JSON.parse(json);
+                    vc.component.roomCreateFeeAddInfo.feeConfigs = _feeConfigManageInfo.feeConfigs;
+                },
+                function(errInfo, error) {
+                    console.log('请求失败处理');
+                });
+            }
+        }
+    });
+
+})(window.vc);

+ 42 - 6
java110-db/src/main/resources/mapper/community/RoomServiceDaoImplMapper.xml

@@ -7,9 +7,9 @@
     <!-- 保存小区房屋信息 add by wuxw 2018-07-03 -->
     <insert id="saveBusinessRoomInfo" parameterType="Map">
         insert into business_building_room(
-        unit_price,section,remark,user_id,room_id,layer,built_up_area,operate,room_num,unit_id,b_id,apartment,state
+        unit_price,section,remark,user_id,room_id,layer,built_up_area,operate,room_num,unit_id,b_id,apartment,state,community_id
         ) values (
-        #{unitPrice},#{section},#{remark},#{userId},#{roomId},#{layer},#{builtUpArea},#{operate},#{roomNum},#{unitId},#{bId},#{apartment},#{state}
+        #{unitPrice},#{section},#{remark},#{userId},#{roomId},#{layer},#{builtUpArea},#{operate},#{roomNum},#{unitId},#{bId},#{apartment},#{state},#{communityId}
         )
     </insert>
 
@@ -18,7 +18,8 @@
     <select id="getBusinessRoomInfo" parameterType="Map" resultType="Map">
         select t.unit_price,t.unit_price unitPrice,t.section,t.remark,t.user_id,t.user_id userId,t.room_id,t.room_id
         roomId,t.layer,t.built_up_area,t.built_up_area builtUpArea,t.operate,t.room_num,t.room_num
-        roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id bId,t.apartment,t.state
+        roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id bId,t.apartment,t.state,t.community_id,t.community_id
+        communityId
         from business_building_room t
         where 1 =1
         <if test="unitPrice !=null and unitPrice != ''">
@@ -60,6 +61,9 @@
         <if test="state !=null and state != ''">
             and t.state= #{state}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
     </select>
 
@@ -67,9 +71,9 @@
     <!-- 保存小区房屋信息至 instance表中 add by wuxw 2018-07-03 -->
     <insert id="saveRoomInfoInstance" parameterType="Map">
         insert into building_room(
-        unit_price,section,status_cd,remark,user_id,room_id,layer,built_up_area,room_num,unit_id,b_id,apartment,state
+        unit_price,section,status_cd,remark,user_id,room_id,layer,built_up_area,room_num,unit_id,b_id,apartment,state,community_id
         ) select
-        t.unit_price,t.section,'0',t.remark,t.user_id,t.room_id,t.layer,t.built_up_area,t.room_num,t.unit_id,t.b_id,t.apartment,t.state
+        t.unit_price,t.section,'0',t.remark,t.user_id,t.room_id,t.layer,t.built_up_area,t.room_num,t.unit_id,t.b_id,t.apartment,t.state,t.community_id
         from business_building_room t where 1=1
         <if test="unitPrice !=null and unitPrice != ''">
             and t.unit_price= #{unitPrice}
@@ -108,6 +112,9 @@
         <if test="state !=null and state != ''">
             and t.state= #{state}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
     </insert>
 
@@ -116,7 +123,8 @@
     <select id="getRoomInfo" parameterType="Map" resultType="Map">
         select t.unit_price,t.unit_price unitPrice,t.section,t.status_cd,t.status_cd
         statusCd,t.remark,t.user_id,t.user_id userId,t.room_id,t.room_id roomId,t.layer,t.built_up_area,t.built_up_area
-        builtUpArea,t.room_num,t.room_num roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id bId,t.apartment,t.state
+        builtUpArea,t.room_num,t.room_num roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id
+        bId,t.apartment,t.state,t.community_id,t.community_id communityId
         from building_room t
         where 1 =1
         <if test="unitPrice !=null and unitPrice != ''">
@@ -165,6 +173,10 @@
         <if test="state !=null and state != ''">
             and t.state= #{state}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        order by t.create_time desc
         <if test="page != -1 and page != null">
             limit #{page},#{row}
         </if>
@@ -213,6 +225,9 @@
         <if test="roomId !=null and roomId != ''">
             and t.room_id= #{roomId}
         </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>
@@ -263,6 +278,9 @@
         <if test="state !=null and state != ''">
             and t.state= #{state}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
 
     </select>
@@ -325,6 +343,9 @@
         <if test="state !=null and state != ''">
             and t.state= #{state}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
 
     </select>
@@ -392,6 +413,9 @@
         <if test="state !=null and state != ''">
             and t.state= #{state}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
         AND NOT EXISTS(
         SELECT 1 FROM building_owner_room_rel borr
         WHERE borr.`status_cd` = '0'
@@ -464,6 +488,9 @@
         <if test="state !=null and state != ''">
             and t.state= #{state}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
         AND EXISTS(
         SELECT 1 FROM building_owner_room_rel borr
         WHERE borr.`status_cd` = '0'
@@ -532,6 +559,9 @@
         <if test="state !=null and state != ''">
             and t.state= #{state}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
         AND NOT EXISTS(
         SELECT 1 FROM building_owner_room_rel borr
         WHERE borr.`status_cd` = '0'
@@ -602,6 +632,9 @@
         <if test="state !=null and state != ''">
             and t.state= #{state}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
         AND EXISTS(
         SELECT 1 FROM building_owner_room_rel borr
         WHERE borr.`status_cd` = '0'
@@ -680,6 +713,9 @@
         <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="page != -1 and page != null">
             limit #{page},#{row}
         </if>

+ 3 - 0
java110-utils/src/main/java/com/java110/utils/constant/ServiceCodeConstant.java

@@ -497,6 +497,9 @@ public class ServiceCodeConstant {
     //缴费
     public static final String SERVICE_CODE_PAY_FEE = "fee.payFee";
 
+    //设置费用
+    public static final String SERVICE_CODE_SAVE_ROOM_CREATE_FEE = "fee.saveRoomCreateFee";
+
     //预交费
     public static final String SERVICE_CODE_PAY_FEE_PRE = "fee.payFeePre";
     /**