1个文件已删除
10个文件已修改
23个文件已添加
| New file |
| | |
| | | package com.java110.community.listener.communityLocation; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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 com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.entity.center.Business; |
| | | import com.java110.community.dao.ICommunityLocationServiceDao; |
| | | 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; |
| | | |
| | | /** |
| | | * 删除小区位置信息 侦听 |
| | | * |
| | | * 处理节点 |
| | | * 1、businessCommunityLocation:{} 小区位置基本信息节点 |
| | | * 2、businessCommunityLocationAttr:[{}] 小区位置属性信息节点 |
| | | * 3、businessCommunityLocationPhoto:[{}] 小区位置照片信息节点 |
| | | * 4、businessCommunityLocationCerdentials:[{}] 小区位置证件信息节点 |
| | | * 协议地址 :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("deleteCommunityLocationInfoListener") |
| | | @Transactional |
| | | public class DeleteCommunityLocationInfoListener extends AbstractCommunityLocationBusinessServiceDataFlowListener { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(DeleteCommunityLocationInfoListener.class); |
| | | @Autowired |
| | | ICommunityLocationServiceDao communityLocationServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 3; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_DELETE_LOCATION; |
| | | } |
| | | |
| | | /** |
| | | * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | //处理 businessCommunityLocation 节点 |
| | | if(data.containsKey(CommunityLocationPo.class.getSimpleName())){ |
| | | Object _obj = data.get(CommunityLocationPo.class.getSimpleName()); |
| | | JSONArray businessCommunityLocations = null; |
| | | if(_obj instanceof JSONObject){ |
| | | businessCommunityLocations = new JSONArray(); |
| | | businessCommunityLocations.add(_obj); |
| | | }else { |
| | | businessCommunityLocations = (JSONArray)_obj; |
| | | } |
| | | //JSONObject businessCommunityLocation = data.getJSONObject(CommunityLocationPo.class.getSimpleName()); |
| | | for (int _communityLocationIndex = 0; _communityLocationIndex < businessCommunityLocations.size();_communityLocationIndex++) { |
| | | JSONObject businessCommunityLocation = businessCommunityLocations.getJSONObject(_communityLocationIndex); |
| | | doBusinessCommunityLocation(business, businessCommunityLocation); |
| | | if(_obj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("locationId", businessCommunityLocation.getString("locationId")); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 删除 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> businessCommunityLocationInfos = communityLocationServiceDaoImpl.getBusinessCommunityLocationInfo(info); |
| | | if( businessCommunityLocationInfos != null && businessCommunityLocationInfos.size() >0) { |
| | | for (int _communityLocationIndex = 0; _communityLocationIndex < businessCommunityLocationInfos.size();_communityLocationIndex++) { |
| | | Map businessCommunityLocationInfo = businessCommunityLocationInfos.get(_communityLocationIndex); |
| | | flushBusinessCommunityLocationInfo(businessCommunityLocationInfo,StatusConstant.STATUS_CD_INVALID); |
| | | communityLocationServiceDaoImpl.updateCommunityLocationInfoInstance(businessCommunityLocationInfo); |
| | | dataFlowContext.addParamOut("locationId",businessCommunityLocationInfo.get("location_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> communityLocationInfo = communityLocationServiceDaoImpl.getCommunityLocationInfo(info); |
| | | if(communityLocationInfo != null && communityLocationInfo.size() > 0){ |
| | | |
| | | //小区位置信息 |
| | | List<Map> businessCommunityLocationInfos = communityLocationServiceDaoImpl.getBusinessCommunityLocationInfo(delInfo); |
| | | //除非程序出错了,这里不会为空 |
| | | if(businessCommunityLocationInfos == null || businessCommunityLocationInfos.size() == 0){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(communityLocation),程序内部异常,请检查! "+delInfo); |
| | | } |
| | | for (int _communityLocationIndex = 0; _communityLocationIndex < businessCommunityLocationInfos.size();_communityLocationIndex++) { |
| | | Map businessCommunityLocationInfo = businessCommunityLocationInfos.get(_communityLocationIndex); |
| | | flushBusinessCommunityLocationInfo(businessCommunityLocationInfo,StatusConstant.STATUS_CD_VALID); |
| | | communityLocationServiceDaoImpl.updateCommunityLocationInfoInstance(businessCommunityLocationInfo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessCommunityLocation 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessCommunityLocation 小区位置节点 |
| | | */ |
| | | private void doBusinessCommunityLocation(Business business,JSONObject businessCommunityLocation){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessCommunityLocation,"locationId","businessCommunityLocation 节点下没有包含 locationId 节点"); |
| | | |
| | | if(businessCommunityLocation.getString("locationId").startsWith("-")){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"locationId 错误,不能自动生成(必须已经存在的locationId)"+businessCommunityLocation); |
| | | } |
| | | //自动插入DEL |
| | | autoSaveDelBusinessCommunityLocation(business,businessCommunityLocation); |
| | | } |
| | | @Override |
| | | public ICommunityLocationServiceDao getCommunityLocationServiceDaoImpl() { |
| | | return communityLocationServiceDaoImpl; |
| | | } |
| | | |
| | | public void setCommunityLocationServiceDaoImpl(ICommunityLocationServiceDao communityLocationServiceDaoImpl) { |
| | | this.communityLocationServiceDaoImpl = communityLocationServiceDaoImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.community.listener.communityLocation; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.constant.StatusConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.community.dao.ICommunityLocationServiceDao; |
| | | 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 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("saveCommunityLocationInfoListener") |
| | | @Transactional |
| | | public class SaveCommunityLocationInfoListener extends AbstractCommunityLocationBusinessServiceDataFlowListener{ |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(SaveCommunityLocationInfoListener.class); |
| | | |
| | | @Autowired |
| | | private ICommunityLocationServiceDao communityLocationServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_SAVE_LOCATION; |
| | | } |
| | | |
| | | /** |
| | | * 保存小区位置信息 business 表中 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | //处理 businessCommunityLocation 节点 |
| | | if(data.containsKey(CommunityLocationPo.class.getSimpleName())){ |
| | | Object bObj = data.get(CommunityLocationPo.class.getSimpleName()); |
| | | JSONArray businessCommunityLocations = null; |
| | | if(bObj instanceof JSONObject){ |
| | | businessCommunityLocations = new JSONArray(); |
| | | businessCommunityLocations.add(bObj); |
| | | }else { |
| | | businessCommunityLocations = (JSONArray)bObj; |
| | | } |
| | | //JSONObject businessCommunityLocation = data.getJSONObject(CommunityLocationPo.class.getSimpleName()); |
| | | for (int bCommunityLocationIndex = 0; bCommunityLocationIndex < businessCommunityLocations.size();bCommunityLocationIndex++) { |
| | | JSONObject businessCommunityLocation = businessCommunityLocations.getJSONObject(bCommunityLocationIndex); |
| | | doBusinessCommunityLocation(business, businessCommunityLocation); |
| | | if(bObj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("locationId", businessCommunityLocation.getString("locationId")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 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> businessCommunityLocationInfo = communityLocationServiceDaoImpl.getBusinessCommunityLocationInfo(info); |
| | | if( businessCommunityLocationInfo != null && businessCommunityLocationInfo.size() >0) { |
| | | reFreshShareColumn(info, businessCommunityLocationInfo.get(0)); |
| | | communityLocationServiceDaoImpl.saveCommunityLocationInfoInstance(info); |
| | | if(businessCommunityLocationInfo.size() == 1) { |
| | | dataFlowContext.addParamOut("locationId", businessCommunityLocationInfo.get(0).get("location_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> communityLocationInfo = communityLocationServiceDaoImpl.getCommunityLocationInfo(info); |
| | | if(communityLocationInfo != null && communityLocationInfo.size() > 0){ |
| | | reFreshShareColumn(paramIn, communityLocationInfo.get(0)); |
| | | communityLocationServiceDaoImpl.updateCommunityLocationInfoInstance(paramIn); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessCommunityLocation 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessCommunityLocation 小区位置节点 |
| | | */ |
| | | private void doBusinessCommunityLocation(Business business,JSONObject businessCommunityLocation){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessCommunityLocation,"locationId","businessCommunityLocation 节点下没有包含 locationId 节点"); |
| | | |
| | | if(businessCommunityLocation.getString("locationId").startsWith("-")){ |
| | | //刷新缓存 |
| | | //flushCommunityLocationId(business.getDatas()); |
| | | |
| | | businessCommunityLocation.put("locationId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_locationId)); |
| | | |
| | | } |
| | | |
| | | businessCommunityLocation.put("bId",business.getbId()); |
| | | businessCommunityLocation.put("operate", StatusConstant.OPERATE_ADD); |
| | | //保存小区位置信息 |
| | | communityLocationServiceDaoImpl.saveBusinessCommunityLocationInfo(businessCommunityLocation); |
| | | |
| | | } |
| | | @Override |
| | | public ICommunityLocationServiceDao getCommunityLocationServiceDaoImpl() { |
| | | return communityLocationServiceDaoImpl; |
| | | } |
| | | |
| | | public void setCommunityLocationServiceDaoImpl(ICommunityLocationServiceDao communityLocationServiceDaoImpl) { |
| | | this.communityLocationServiceDaoImpl = communityLocationServiceDaoImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.community.listener.communityLocation; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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 com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.entity.center.Business; |
| | | import com.java110.community.dao.ICommunityLocationServiceDao; |
| | | 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; |
| | | |
| | | /** |
| | | * 修改小区位置信息 侦听 |
| | | * |
| | | * 处理节点 |
| | | * 1、businessCommunityLocation:{} 小区位置基本信息节点 |
| | | * 2、businessCommunityLocationAttr:[{}] 小区位置属性信息节点 |
| | | * 3、businessCommunityLocationPhoto:[{}] 小区位置照片信息节点 |
| | | * 4、businessCommunityLocationCerdentials:[{}] 小区位置证件信息节点 |
| | | * 协议地址 :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("updateCommunityLocationInfoListener") |
| | | @Transactional |
| | | public class UpdateCommunityLocationInfoListener extends AbstractCommunityLocationBusinessServiceDataFlowListener { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(UpdateCommunityLocationInfoListener.class); |
| | | @Autowired |
| | | private ICommunityLocationServiceDao communityLocationServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 2; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_LOCATION; |
| | | } |
| | | |
| | | /** |
| | | * business过程 |
| | | * @param dataFlowContext 上下文对象 |
| | | * @param business 业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | |
| | | //处理 businessCommunityLocation 节点 |
| | | if(data.containsKey(CommunityLocationPo.class.getSimpleName())){ |
| | | Object _obj = data.get(CommunityLocationPo.class.getSimpleName()); |
| | | JSONArray businessCommunityLocations = null; |
| | | if(_obj instanceof JSONObject){ |
| | | businessCommunityLocations = new JSONArray(); |
| | | businessCommunityLocations.add(_obj); |
| | | }else { |
| | | businessCommunityLocations = (JSONArray)_obj; |
| | | } |
| | | //JSONObject businessCommunityLocation = data.getJSONObject(CommunityLocationPo.class.getSimpleName()); |
| | | for (int _communityLocationIndex = 0; _communityLocationIndex < businessCommunityLocations.size();_communityLocationIndex++) { |
| | | JSONObject businessCommunityLocation = businessCommunityLocations.getJSONObject(_communityLocationIndex); |
| | | doBusinessCommunityLocation(business, businessCommunityLocation); |
| | | if(_obj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("locationId", businessCommunityLocation.getString("locationId")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 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> businessCommunityLocationInfos = communityLocationServiceDaoImpl.getBusinessCommunityLocationInfo(info); |
| | | if( businessCommunityLocationInfos != null && businessCommunityLocationInfos.size() >0) { |
| | | for (int _communityLocationIndex = 0; _communityLocationIndex < businessCommunityLocationInfos.size();_communityLocationIndex++) { |
| | | Map businessCommunityLocationInfo = businessCommunityLocationInfos.get(_communityLocationIndex); |
| | | flushBusinessCommunityLocationInfo(businessCommunityLocationInfo,StatusConstant.STATUS_CD_VALID); |
| | | communityLocationServiceDaoImpl.updateCommunityLocationInfoInstance(businessCommunityLocationInfo); |
| | | if(businessCommunityLocationInfo.size() == 1) { |
| | | dataFlowContext.addParamOut("locationId", businessCommunityLocationInfo.get("location_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> communityLocationInfo = communityLocationServiceDaoImpl.getCommunityLocationInfo(info); |
| | | if(communityLocationInfo != null && communityLocationInfo.size() > 0){ |
| | | |
| | | //小区位置信息 |
| | | List<Map> businessCommunityLocationInfos = communityLocationServiceDaoImpl.getBusinessCommunityLocationInfo(delInfo); |
| | | //除非程序出错了,这里不会为空 |
| | | if(businessCommunityLocationInfos == null || businessCommunityLocationInfos.size() == 0){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(communityLocation),程序内部异常,请检查! "+delInfo); |
| | | } |
| | | for (int _communityLocationIndex = 0; _communityLocationIndex < businessCommunityLocationInfos.size();_communityLocationIndex++) { |
| | | Map businessCommunityLocationInfo = businessCommunityLocationInfos.get(_communityLocationIndex); |
| | | flushBusinessCommunityLocationInfo(businessCommunityLocationInfo,StatusConstant.STATUS_CD_VALID); |
| | | communityLocationServiceDaoImpl.updateCommunityLocationInfoInstance(businessCommunityLocationInfo); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessCommunityLocation 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessCommunityLocation 小区位置节点 |
| | | */ |
| | | private void doBusinessCommunityLocation(Business business,JSONObject businessCommunityLocation){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessCommunityLocation,"locationId","businessCommunityLocation 节点下没有包含 locationId 节点"); |
| | | |
| | | if(businessCommunityLocation.getString("locationId").startsWith("-")){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"locationId 错误,不能自动生成(必须已经存在的locationId)"+businessCommunityLocation); |
| | | } |
| | | //自动保存DEL |
| | | autoSaveDelBusinessCommunityLocation(business,businessCommunityLocation); |
| | | |
| | | businessCommunityLocation.put("bId",business.getbId()); |
| | | businessCommunityLocation.put("operate", StatusConstant.OPERATE_ADD); |
| | | //保存小区位置信息 |
| | | communityLocationServiceDaoImpl.saveBusinessCommunityLocationInfo(businessCommunityLocation); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ICommunityLocationServiceDao getCommunityLocationServiceDaoImpl() { |
| | | return communityLocationServiceDaoImpl; |
| | | } |
| | | |
| | | public void setCommunityLocationServiceDaoImpl(ICommunityLocationServiceDao communityLocationServiceDaoImpl) { |
| | | this.communityLocationServiceDaoImpl = communityLocationServiceDaoImpl; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.dto.communityLocation; |
| | | |
| | | 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 CommunityLocationDto extends PageDto implements Serializable { |
| | | |
| | | private String locationName; |
| | | private String locationId; |
| | | private String locationType; |
| | | private String communityId; |
| | | |
| | | |
| | | private Date createTime; |
| | | |
| | | private String statusCd = "0"; |
| | | |
| | | |
| | | public String getLocationName() { |
| | | return locationName; |
| | | } |
| | | public void setLocationName(String locationName) { |
| | | this.locationName = locationName; |
| | | } |
| | | public String getLocationId() { |
| | | return locationId; |
| | | } |
| | | public void setLocationId(String locationId) { |
| | | this.locationId = locationId; |
| | | } |
| | | public String getLocationType() { |
| | | return locationType; |
| | | } |
| | | public void setLocationType(String locationType) { |
| | | this.locationType = locationType; |
| | | } |
| | | 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; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.po.community; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | public class CommunityLocationPo implements Serializable { |
| | | |
| | | private String locationName; |
| | | private String locationId; |
| | | private String locationType; |
| | | private String communityId; |
| | | public String getLocationName() { |
| | | return locationName; |
| | | } |
| | | public void setLocationName(String locationName) { |
| | | this.locationName = locationName; |
| | | } |
| | | public String getLocationId() { |
| | | return locationId; |
| | | } |
| | | public void setLocationId(String locationId) { |
| | | this.locationId = locationId; |
| | | } |
| | | public String getLocationType() { |
| | | return locationType; |
| | | } |
| | | public void setLocationType(String locationType) { |
| | | this.locationType = locationType; |
| | | } |
| | | public String getCommunityId() { |
| | | return communityId; |
| | | } |
| | | public void setCommunityId(String communityId) { |
| | | this.communityId = communityId; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | public static final String CODE_PREFIX_returnFeeId = "70"; |
| | | public static final String CODE_PREFIX_weChatId = "71"; |
| | | public static final String CODE_PREFIX_oweId = "72"; |
| | | public static final String CODE_PREFIX_billId = "73"; |
| | | public static final String CODE_PREFIX_locationId = "74"; |
| | | |
| | | |
| | | |
| New file |
| | |
| | | package com.java110.core.smo.community; |
| | | |
| | | import com.java110.core.feign.FeignConfiguration; |
| | | import com.java110.dto.communityLocation.CommunityLocationDto; |
| | | 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 ICommunityLocationInnerServiceSMO |
| | | * @Description 小区位置接口类 |
| | | * @Author wuxw |
| | | * @Date 2019/4/24 9:04 |
| | | * @Version 1.0 |
| | | * add by wuxw 2019/4/24 |
| | | **/ |
| | | @FeignClient(name = "community-service", configuration = {FeignConfiguration.class}) |
| | | @RequestMapping("/communityLocationApi") |
| | | public interface ICommunityLocationInnerServiceSMO { |
| | | |
| | | /** |
| | | * <p>查询小区楼信息</p> |
| | | * |
| | | * |
| | | * @param communityLocationDto 数据对象分享 |
| | | * @return CommunityLocationDto 对象数据 |
| | | */ |
| | | @RequestMapping(value = "/queryCommunityLocations", method = RequestMethod.POST) |
| | | List<CommunityLocationDto> queryCommunityLocations(@RequestBody CommunityLocationDto communityLocationDto); |
| | | |
| | | /** |
| | | * 查询<p>小区楼</p>总记录数 |
| | | * |
| | | * @param communityLocationDto 数据对象分享 |
| | | * @return 小区下的小区楼记录数 |
| | | */ |
| | | @RequestMapping(value = "/queryCommunityLocationsCount", method = RequestMethod.POST) |
| | | int queryCommunityLocationsCount(@RequestBody CommunityLocationDto communityLocationDto); |
| | | } |
| | |
| | | */ |
| | | @RequestMapping(value = "/queryBillOweFees", method = RequestMethod.POST) |
| | | public List<BillOweFeeDto> queryBillOweFees(@RequestBody BillOweFeeDto billDto); |
| | | |
| | | /** |
| | | * 保存欠费 |
| | | * |
| | | * @param billDto |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/insertBillOweFees", method = RequestMethod.POST) |
| | | public int insertBillOweFees(@RequestBody BillOweFeeDto billDto) ; |
| | | /** |
| | | * 保存账单 |
| | | * |
| | | * @param billDto |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/insertBill", method = RequestMethod.POST) |
| | | public int insertBill(@RequestBody BillDto billDto); |
| | | } |
| New file |
| | |
| | | <?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="communityLocationServiceDaoImpl"> |
| | | |
| | | <!-- 保存小区位置信息 add by wuxw 2018-07-03 --> |
| | | <insert id="saveBusinessCommunityLocationInfo" parameterType="Map"> |
| | | insert into business_community_location( |
| | | location_name,operate,location_id,location_type,b_id,community_id |
| | | ) values ( |
| | | #{locationName},#{operate},#{locationId},#{locationType},#{bId},#{communityId} |
| | | ) |
| | | </insert> |
| | | |
| | | |
| | | <!-- 查询小区位置信息(Business) add by wuxw 2018-07-03 --> |
| | | <select id="getBusinessCommunityLocationInfo" parameterType="Map" resultType="Map"> |
| | | select t.location_name,t.location_name locationName,t.operate,t.location_id,t.location_id |
| | | locationId,t.location_type,t.location_type locationType,t.b_id,t.b_id bId,t.community_id,t.community_id |
| | | communityId |
| | | from business_community_location t |
| | | where 1 =1 |
| | | <if test="locationName !=null and locationName != ''"> |
| | | and t.location_name= #{locationName} |
| | | </if> |
| | | <if test="operate !=null and operate != ''"> |
| | | and t.operate= #{operate} |
| | | </if> |
| | | <if test="locationId !=null and locationId != ''"> |
| | | and t.location_id= #{locationId} |
| | | </if> |
| | | <if test="locationType !=null and locationType != ''"> |
| | | and t.location_type= #{locationType} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | and t.community_id= #{communityId} |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | <!-- 保存小区位置信息至 instance表中 add by wuxw 2018-07-03 --> |
| | | <insert id="saveCommunityLocationInfoInstance" parameterType="Map"> |
| | | insert into community_location( |
| | | location_name,location_id,location_type,status_cd,b_id,community_id |
| | | ) select t.location_name,t.location_id,t.location_type,'0',t.b_id,t.community_id from |
| | | business_community_location t where 1=1 |
| | | <if test="locationName !=null and locationName != ''"> |
| | | and t.location_name= #{locationName} |
| | | </if> |
| | | and t.operate= 'ADD' |
| | | <if test="locationId !=null and locationId != ''"> |
| | | and t.location_id= #{locationId} |
| | | </if> |
| | | <if test="locationType !=null and locationType != ''"> |
| | | and t.location_type= #{locationType} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | and t.community_id= #{communityId} |
| | | </if> |
| | | |
| | | </insert> |
| | | |
| | | |
| | | <!-- 查询小区位置信息 add by wuxw 2018-07-03 --> |
| | | <select id="getCommunityLocationInfo" parameterType="Map" resultType="Map"> |
| | | select t.location_name,t.location_name locationName,t.location_id,t.location_id |
| | | locationId,t.location_type,t.location_type locationType,t.status_cd,t.status_cd statusCd,t.b_id,t.b_id |
| | | bId,t.community_id,t.community_id communityId |
| | | from community_location t |
| | | where 1 =1 |
| | | <if test="locationName !=null and locationName != ''"> |
| | | and t.location_name= #{locationName} |
| | | </if> |
| | | <if test="locationId !=null and locationId != ''"> |
| | | and t.location_id= #{locationId} |
| | | </if> |
| | | <if test="locationType !=null and locationType != ''"> |
| | | and t.location_type= #{locationType} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </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> |
| | | |
| | | </select> |
| | | |
| | | |
| | | <!-- 修改小区位置信息 add by wuxw 2018-07-03 --> |
| | | <update id="updateCommunityLocationInfoInstance" parameterType="Map"> |
| | | update community_location t set t.status_cd = #{statusCd} |
| | | <if test="newBId != null and newBId != ''"> |
| | | ,t.b_id = #{newBId} |
| | | </if> |
| | | <if test="locationName !=null and locationName != ''"> |
| | | , t.location_name= #{locationName} |
| | | </if> |
| | | <if test="locationType !=null and locationType != ''"> |
| | | , t.location_type= #{locationType} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | , t.community_id= #{communityId} |
| | | </if> |
| | | where 1=1 |
| | | <if test="locationId !=null and locationId != ''"> |
| | | and t.location_id= #{locationId} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | |
| | | </update> |
| | | |
| | | <!-- 查询小区位置数量 add by wuxw 2018-07-03 --> |
| | | <select id="queryCommunityLocationsCount" parameterType="Map" resultType="Map"> |
| | | select count(1) count |
| | | from community_location t |
| | | where 1 =1 |
| | | <if test="locationName !=null and locationName != ''"> |
| | | and t.location_name= #{locationName} |
| | | </if> |
| | | <if test="locationId !=null and locationId != ''"> |
| | | and t.location_id= #{locationId} |
| | | </if> |
| | | <if test="locationType !=null and locationType != ''"> |
| | | and t.location_type= #{locationType} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | and t.community_id= #{communityId} |
| | | </if> |
| | | |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <!-- 查询账期 --> |
| | | <select id="queryBills" parameterType="Map" resultType="Map"> |
| | | select |
| | | t.bill_id billId, |
| | | t.bill_name billName, |
| | | t.receivable, |
| | | t.receipts, |
| | | t.bill_time billTime, |
| | | t.community_id communityId, |
| | | t.config_id configId, |
| | | t.cur_bill curBill |
| | | t.bill_id billId, |
| | | t.bill_name billName, |
| | | t.receivable, |
| | | t.receipts, |
| | | t.bill_time billTime, |
| | | t.community_id communityId, |
| | | t.config_id configId, |
| | | t.cur_bill curBill |
| | | from bill t |
| | | where 1 =1 |
| | | <if test="billId !=null and billId != ''"> |
| | |
| | | <!-- 查询账期 --> |
| | | <select id="queryBillOweFees" parameterType="Map" resultType="Map"> |
| | | select |
| | | t.owe_id oweId, |
| | | t.bill_id billId, |
| | | t.fee_id feeId, |
| | | t.bill_amount_owed billAmountOwed, |
| | | t.amount_owed amountOwed, |
| | | t.fee_end_time feeEndTime, |
| | | t.owner_id ownerId, |
| | | t.owner_name ownerName, |
| | | t.owner_tel ownerTel, |
| | | t.payer_obj_name payerObjName, |
| | | t.payer_obj_type payerObjType, |
| | | t.community_id communityId, |
| | | t.state, |
| | | t.create_time createTime |
| | | t.owe_id oweId, |
| | | t.bill_id billId, |
| | | t.fee_id feeId, |
| | | t.bill_amount_owed billAmountOwed, |
| | | t.amount_owed amountOwed, |
| | | t.fee_end_time feeEndTime, |
| | | t.owner_id ownerId, |
| | | t.owner_name ownerName, |
| | | t.owner_tel ownerTel, |
| | | t.payer_obj_name payerObjName, |
| | | t.payer_obj_type payerObjType, |
| | | t.community_id communityId, |
| | | t.state, |
| | | t.create_time createTime |
| | | from bill_owe_fee t |
| | | where 1 =1 |
| | | <if test="oweId !=null and oweId != ''"> |
| | |
| | | </select> |
| | | |
| | | |
| | | <insert id="insertBillOweFees" parameterType="Map"> |
| | | INSERT INTO bill_owe_fee |
| | | (`owe_id`, `bill_id`, `fee_id`, `bill_amount_owed`, `amount_owed`, `fee_end_time`, `owner_id`, `owner_name`, |
| | | `owner_tel`, `payer_obj_name`, `payer_obj_type`, `community_id`, `state`) |
| | | VALUES (#{oweId}, #{billId}, #{feeId}, #{billAmountOwed}, #{amountOwed}, #{feeEndTime}, #{ownerId}, |
| | | #{ownerName}, |
| | | #{ownerTel}, #{payerObjName}, #{payerObjType}, #{communityId}, #{state}) |
| | | </insert> |
| | | |
| | | <insert id="insertBill" parameterType="Map"> |
| | | INSERT INTO bill (`bill_id`, `bill_name`, `receivable`, `receipts`, `bill_time`, `community_id`, `config_id`, |
| | | `remark`, `cur_bill`, `cur_receivable`) |
| | | VALUES (#{billId}, #{billName}, #{receivable}, #{receipts}, #{billTime}, #{communityId}, #{configId}, |
| | | #{remark}, #{curBill}, #{curReceivable}) |
| | | </insert> |
| | | |
| | | <update id="updateBill" parameterType="Map"> |
| | | update bill set cur_bill= 'F' where config_id = #{configId} |
| | | </update> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | fileContext); |
| | | //复制生成的文件到对应分区目录下 |
| | | if (data.isAutoMove()) { |
| | | FileUtilBase.copyfile(writePath, toUpperCaseFirstOne(data.getShareName().toString()) + "Service\\src\\main\\java\\com\\java110\\"+data.getShareName()+"\\dao\\" + "I" + toUpperCaseFirstOne(data.getName()) + "ServiceDao.java"); |
| | | FileUtilBase.copyfile(writePath, "service-" + data.getShareName() + "\\src\\main\\java\\com\\java110\\"+data.getShareName()+"\\dao\\" + "I" + toUpperCaseFirstOne(data.getName()) + "ServiceDao.java"); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | "autoMove": true, |
| | | "id": "attrId", |
| | | "name": "taskAttr", |
| | | "desc": "定时任务属性", |
| | | "shareParam": "task_id", |
| | | "shareColumn": "taskId", |
| | | "shareName": "job", |
| | | "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_TASK_ATTR", |
| | | "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_TASK_ATTR", |
| | | "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_TASK_ATTR", |
| | | "newBusinessTypeCdValue": "560300030001", |
| | | "updateBusinessTypeCdValue": "560300040001", |
| | | "deleteBusinessTypeCdValue": "560300050001", |
| | | "businessTableName": "business_task_attr", |
| | | "tableName": "task_attr", |
| | | "id": "locationId", |
| | | "name": "communityLocation", |
| | | "desc": "小区位置", |
| | | "shareParam": "communityId", |
| | | "shareColumn": "community_id", |
| | | "shareName": "community", |
| | | "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_LOCATION", |
| | | "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_LOCATION", |
| | | "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_LOCATION", |
| | | "newBusinessTypeCdValue": "570100030001", |
| | | "updateBusinessTypeCdValue": "570100040001", |
| | | "deleteBusinessTypeCdValue": "570100050001", |
| | | "businessTableName": "business_community_location", |
| | | "tableName": "community_location", |
| | | "param": { |
| | | "attrId": "attr_id", |
| | | "locationId": "location_id", |
| | | "bId": "b_id", |
| | | "taskId": "task_id", |
| | | "specCd": "spec_cd", |
| | | "value": "value", |
| | | "locationName": "location_name", |
| | | "locationType": "location_type", |
| | | "communityId": "community_id", |
| | | "statusCd": "status_cd", |
| | | "createTime": "create_time", |
| | | "operate": "operate" |
| | | }, |
| | | "required": [ |
| | | { |
| | | |
| | | "code": "taskId", |
| | | "msg": "任务不能为空" |
| | | "code": "locationName", |
| | | "msg": "位置名称不能为空" |
| | | }, |
| | | { |
| | | "code": "specCd", |
| | | "msg": "任务属性不能为空" |
| | | }, |
| | | { |
| | | "code": "value", |
| | | "msg": "任务属性值不能为空" |
| | | "code": "locationType", |
| | | "msg": "位置类型不能为空" |
| | | } |
| | | ] |
| | | } |
| | | |
| New file |
| | |
| | | { |
| | | "autoMove": true, |
| | | "id": "attrId", |
| | | "name": "taskAttr", |
| | | "desc": "定时任务属性", |
| | | "shareParam": "task_id", |
| | | "shareColumn": "taskId", |
| | | "shareName": "job", |
| | | "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_TASK_ATTR", |
| | | "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_TASK_ATTR", |
| | | "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_TASK_ATTR", |
| | | "newBusinessTypeCdValue": "560300030001", |
| | | "updateBusinessTypeCdValue": "560300040001", |
| | | "deleteBusinessTypeCdValue": "560300050001", |
| | | "businessTableName": "business_task_attr", |
| | | "tableName": "task_attr", |
| | | "param": { |
| | | "attrId": "attr_id", |
| | | "bId": "b_id", |
| | | "taskId": "task_id", |
| | | "specCd": "spec_cd", |
| | | "value": "value", |
| | | "statusCd": "status_cd", |
| | | "createTime": "create_time", |
| | | "operate": "operate" |
| | | }, |
| | | "required": [ |
| | | { |
| | | |
| | | "code": "taskId", |
| | | "msg": "任务不能为空" |
| | | }, |
| | | { |
| | | "code": "specCd", |
| | | "msg": "任务属性不能为空" |
| | | }, |
| | | { |
| | | "code": "value", |
| | | "msg": "任务属性值不能为空" |
| | | } |
| | | ] |
| | | } |
| | |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public void update@@TemplateCode@@(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | @@TemplateCode@@Dto @@templateCode@@Dto = new @@TemplateCode@@Dto(); |
| | | @@templateCode@@Dto.set@@TemplateKey@@(paramInJson.getString("@@templateKey@@")); |
| | | @@templateCode@@Dto.set@@ShareName@@Id(paramInJson.getString("@@shareName@@Id")); |
| | | List<@@TemplateCode@@Dto> @@templateCode@@Dtos = @@templateCode@@InnerServiceSMOImpl.query@@TemplateCode@@s(@@templateCode@@Dto); |
| | | |
| | | Assert.listOnlyOne(@@templateCode@@Dtos, "未找到需要修改的活动 或多条数据"); |
| | | |
| | | |
| | | paramInJson.putAll(BeanConvertUtil.beanCovertMap(@@templateCode@@Dtos.get(0))); |
| | | @@TemplateCode@@Po @@templateCode@@Po = BeanConvertUtil.covertBean(paramInJson, @@TemplateCode@@Po.class); |
| | | super.update(dataFlowContext, @@templateCode@@Po, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_@@TEMPLATECODE@@); |
| | | } |
| | |
| | | public static final String BUSINESS_TYPE_DELETE_TASK_ATTR="560300050001"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存任务 |
| | | * 3保存 |
| | | */ |
| | | public static final String BUSINESS_TYPE_SAVE_LOCATION="570100030001"; |
| | | |
| | | |
| | | /** |
| | | * 修改任务 |
| | | * 3保存 |
| | | */ |
| | | public static final String BUSINESS_TYPE_UPDATE_LOCATION="570100040001"; |
| | | |
| | | /** |
| | | * 删除任务 |
| | | */ |
| | | public static final String BUSINESS_TYPE_DELETE_LOCATION="570100050001"; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.utils.constant; |
| | | |
| | | /** |
| | | * 小区位置常量类 |
| | | * Created by wuxw on 2017/5/20. |
| | | */ |
| | | public class ServiceCodeCommunityLocationConstant { |
| | | |
| | | /** |
| | | * 添加 小区位置 |
| | | */ |
| | | public static final String ADD_COMMUNITYLOCATION = "communityLocation.saveCommunityLocation"; |
| | | |
| | | |
| | | /** |
| | | * 修改 小区位置 |
| | | */ |
| | | public static final String UPDATE_COMMUNITYLOCATION = "communityLocation.updateCommunityLocation"; |
| | | /** |
| | | * 删除 小区位置 |
| | | */ |
| | | public static final String DELETE_COMMUNITYLOCATION = "communityLocation.deleteCommunityLocation"; |
| | | |
| | | |
| | | /** |
| | | * 查询 小区位置 |
| | | */ |
| | | public static final String LIST_COMMUNITYLOCATIONS = "communityLocation.listCommunityLocations"; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.bmo.communityLocation; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.IApiBaseBMO; |
| | | import com.java110.core.context.DataFlowContext; |
| | | |
| | | public interface ICommunityLocationBMO extends IApiBaseBMO { |
| | | |
| | | |
| | | /** |
| | | * 添加小区位置 |
| | | * @param paramInJson |
| | | * @param dataFlowContext |
| | | * @return |
| | | */ |
| | | void addCommunityLocation(JSONObject paramInJson, DataFlowContext dataFlowContext); |
| | | |
| | | /** |
| | | * 添加小区位置信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | void updateCommunityLocation(JSONObject paramInJson, DataFlowContext dataFlowContext); |
| | | |
| | | /** |
| | | * 删除小区位置 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | void deleteCommunityLocation(JSONObject paramInJson, DataFlowContext dataFlowContext); |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.bmo.communityLocation.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.ApiBaseBMO; |
| | | import com.java110.api.bmo.communityLocation.ICommunityLocationBMO; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.smo.community.ICommunityLocationInnerServiceSMO; |
| | | import com.java110.po.community.CommunityLocationPo; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("communityLocationBMOImpl") |
| | | public class CommunityLocationBMOImpl extends ApiBaseBMO implements ICommunityLocationBMO { |
| | | |
| | | @Autowired |
| | | private ICommunityLocationInnerServiceSMO communityLocationInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public void addCommunityLocation(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | paramInJson.put("locationId", "-1"); |
| | | CommunityLocationPo communityLocationPo = BeanConvertUtil.covertBean(paramInJson, CommunityLocationPo.class); |
| | | super.insert(dataFlowContext, communityLocationPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_LOCATION); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加活动信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public void updateCommunityLocation(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | CommunityLocationPo communityLocationPo = BeanConvertUtil.covertBean(paramInJson, CommunityLocationPo.class); |
| | | super.update(dataFlowContext, communityLocationPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_LOCATION); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public void deleteCommunityLocation(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | CommunityLocationPo communityLocationPo = BeanConvertUtil.covertBean(paramInJson, CommunityLocationPo.class); |
| | | super.update(dataFlowContext, communityLocationPo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_LOCATION); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.listener.communityLocation; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.communityLocation.ICommunityLocationBMO; |
| | | import com.java110.api.listener.AbstractServiceApiPlusListener; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.event.service.api.ServiceDataFlowEvent; |
| | | import com.java110.utils.constant.ServiceCodeCommunityLocationConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | |
| | | |
| | | /** |
| | | * 保存小区侦听 |
| | | * add by wuxw 2019-06-30 |
| | | */ |
| | | @Java110Listener("deleteCommunityLocationListener") |
| | | public class DeleteCommunityLocationListener extends AbstractServiceApiPlusListener { |
| | | |
| | | @Autowired |
| | | private ICommunityLocationBMO communityLocationBMOImpl; |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | //Assert.hasKeyAndValue(reqJson, "xxx", "xxx"); |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "locationId", "locationId不能为空"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | |
| | | communityLocationBMOImpl.deleteCommunityLocation(reqJson, context); |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeCommunityLocationConstant.DELETE_COMMUNITYLOCATION; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.POST; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.listener.communityLocation; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.listener.AbstractServiceApiListener; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.event.service.api.ServiceDataFlowEvent; |
| | | import com.java110.core.smo.community.ICommunityLocationInnerServiceSMO; |
| | | import com.java110.dto.communityLocation.CommunityLocationDto; |
| | | import com.java110.result.ResultVo; |
| | | import com.java110.utils.constant.ServiceCodeCommunityLocationConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 查询小区侦听类 |
| | | */ |
| | | @Java110Listener("listCommunityLocationsListener") |
| | | public class ListCommunityLocationsListener extends AbstractServiceApiListener { |
| | | |
| | | @Autowired |
| | | private ICommunityLocationInnerServiceSMO communityLocationInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeCommunityLocationConstant.LIST_COMMUNITYLOCATIONS; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.GET; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return DEFAULT_ORDER; |
| | | } |
| | | |
| | | |
| | | public ICommunityLocationInnerServiceSMO getCommunityLocationInnerServiceSMOImpl() { |
| | | return communityLocationInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public void setCommunityLocationInnerServiceSMOImpl(ICommunityLocationInnerServiceSMO communityLocationInnerServiceSMOImpl) { |
| | | this.communityLocationInnerServiceSMOImpl = communityLocationInnerServiceSMOImpl; |
| | | } |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | super.validatePageInfo(reqJson); |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含小区信息"); |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | |
| | | CommunityLocationDto communityLocationDto = BeanConvertUtil.covertBean(reqJson, CommunityLocationDto.class); |
| | | |
| | | int count = communityLocationInnerServiceSMOImpl.queryCommunityLocationsCount(communityLocationDto); |
| | | |
| | | List<CommunityLocationDto> communityLocationDtos = null; |
| | | |
| | | if (count > 0) { |
| | | communityLocationDtos = communityLocationInnerServiceSMOImpl.queryCommunityLocations(communityLocationDto); |
| | | } else { |
| | | communityLocationDtos = new ArrayList<>(); |
| | | } |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, communityLocationDtos); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.api.listener.communityLocation; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.communityLocation.ICommunityLocationBMO; |
| | | import com.java110.api.listener.AbstractServiceApiPlusListener; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.event.service.api.ServiceDataFlowEvent; |
| | | import com.java110.utils.constant.ServiceCodeCommunityLocationConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | |
| | | /** |
| | | * 保存商户侦听 |
| | | * add by wuxw 2019-06-30 |
| | | */ |
| | | @Java110Listener("saveCommunityLocationListener") |
| | | public class SaveCommunityLocationListener extends AbstractServiceApiPlusListener { |
| | | |
| | | @Autowired |
| | | private ICommunityLocationBMO communityLocationBMOImpl; |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | //Assert.hasKeyAndValue(reqJson, "xxx", "xxx"); |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "locationName", "请求报文中未包含locationName"); |
| | | Assert.hasKeyAndValue(reqJson, "locationType", "请求报文中未包含locationType"); |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含小区信息"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | communityLocationBMOImpl.addCommunityLocation(reqJson, context); |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeCommunityLocationConstant.ADD_COMMUNITYLOCATION; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.POST; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.listener.communityLocation; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.communityLocation.ICommunityLocationBMO; |
| | | import com.java110.api.listener.AbstractServiceApiPlusListener; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.event.service.api.ServiceDataFlowEvent; |
| | | import com.java110.utils.constant.ServiceCodeCommunityLocationConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | |
| | | |
| | | /** |
| | | * 保存小区位置侦听 |
| | | * add by wuxw 2019-06-30 |
| | | */ |
| | | @Java110Listener("updateCommunityLocationListener") |
| | | public class UpdateCommunityLocationListener extends AbstractServiceApiPlusListener { |
| | | |
| | | @Autowired |
| | | private ICommunityLocationBMO communityLocationBMOImpl; |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含小区信息"); |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "locationId", "locationId不能为空"); |
| | | Assert.hasKeyAndValue(reqJson, "locationName", "请求报文中未包含locationName"); |
| | | Assert.hasKeyAndValue(reqJson, "locationType", "请求报文中未包含locationType"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | |
| | | communityLocationBMOImpl.updateCommunityLocation(reqJson, context); |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeCommunityLocationConstant.UPDATE_COMMUNITYLOCATION; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.POST; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.community.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 ICommunityLocationServiceDao { |
| | | |
| | | /** |
| | | * 保存 小区位置信息 |
| | | * @param businessCommunityLocationInfo 小区位置信息 封装 |
| | | * @throws DAOException 操作数据库异常 |
| | | */ |
| | | void saveBusinessCommunityLocationInfo(Map businessCommunityLocationInfo) throws DAOException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询小区位置信息(business过程) |
| | | * 根据bId 查询小区位置信息 |
| | | * @param info bId 信息 |
| | | * @return 小区位置信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | List<Map> getBusinessCommunityLocationInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存 小区位置信息 Business数据到 Instance中 |
| | | * @param info |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | void saveCommunityLocationInfoInstance(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询小区位置信息(instance过程) |
| | | * 根据bId 查询小区位置信息 |
| | | * @param info bId 信息 |
| | | * @return 小区位置信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | List<Map> getCommunityLocationInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改小区位置信息 |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | void updateCommunityLocationInfoInstance(Map info) throws DAOException; |
| | | |
| | | |
| | | /** |
| | | * 查询小区位置总数 |
| | | * |
| | | * @param info 小区位置信息 |
| | | * @return 小区位置数量 |
| | | */ |
| | | int queryCommunityLocationsCount(Map info); |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.community.dao.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.exception.DAOException; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.core.base.dao.BaseServiceDao; |
| | | import com.java110.community.dao.ICommunityLocationServiceDao; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 小区位置服务 与数据库交互 |
| | | * Created by wuxw on 2017/4/5. |
| | | */ |
| | | @Service("communityLocationServiceDaoImpl") |
| | | //@Transactional |
| | | public class CommunityLocationServiceDaoImpl extends BaseServiceDao implements ICommunityLocationServiceDao { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(CommunityLocationServiceDaoImpl.class); |
| | | |
| | | /** |
| | | * 小区位置信息封装 |
| | | * @param businessCommunityLocationInfo 小区位置信息 封装 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void saveBusinessCommunityLocationInfo(Map businessCommunityLocationInfo) throws DAOException { |
| | | businessCommunityLocationInfo.put("month", DateUtil.getCurrentMonth()); |
| | | // 查询business_user 数据是否已经存在 |
| | | logger.debug("保存小区位置信息 入参 businessCommunityLocationInfo : {}",businessCommunityLocationInfo); |
| | | int saveFlag = sqlSessionTemplate.insert("communityLocationServiceDaoImpl.saveBusinessCommunityLocationInfo",businessCommunityLocationInfo); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存小区位置数据失败:"+ JSONObject.toJSONString(businessCommunityLocationInfo)); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询小区位置信息 |
| | | * @param info bId 信息 |
| | | * @return 小区位置信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public List<Map> getBusinessCommunityLocationInfo(Map info) throws DAOException { |
| | | |
| | | logger.debug("查询小区位置信息 入参 info : {}",info); |
| | | |
| | | List<Map> businessCommunityLocationInfos = sqlSessionTemplate.selectList("communityLocationServiceDaoImpl.getBusinessCommunityLocationInfo",info); |
| | | |
| | | return businessCommunityLocationInfos; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存小区位置信息 到 instance |
| | | * @param info bId 信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void saveCommunityLocationInfoInstance(Map info) throws DAOException { |
| | | logger.debug("保存小区位置信息Instance 入参 info : {}",info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.insert("communityLocationServiceDaoImpl.saveCommunityLocationInfoInstance",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> getCommunityLocationInfo(Map info) throws DAOException { |
| | | logger.debug("查询小区位置信息 入参 info : {}",info); |
| | | |
| | | List<Map> businessCommunityLocationInfos = sqlSessionTemplate.selectList("communityLocationServiceDaoImpl.getCommunityLocationInfo",info); |
| | | |
| | | return businessCommunityLocationInfos; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改小区位置信息 |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void updateCommunityLocationInfoInstance(Map info) throws DAOException { |
| | | logger.debug("修改小区位置信息Instance 入参 info : {}",info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.update("communityLocationServiceDaoImpl.updateCommunityLocationInfoInstance",info); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改小区位置信息Instance数据失败:"+ JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询小区位置数量 |
| | | * @param info 小区位置信息 |
| | | * @return 小区位置数量 |
| | | */ |
| | | @Override |
| | | public int queryCommunityLocationsCount(Map info) { |
| | | logger.debug("查询小区位置数据 入参 info : {}",info); |
| | | |
| | | List<Map> businessCommunityLocationInfos = sqlSessionTemplate.selectList("communityLocationServiceDaoImpl.queryCommunityLocationsCount", info); |
| | | if (businessCommunityLocationInfos.size() < 1) { |
| | | return 0; |
| | | } |
| | | |
| | | return Integer.parseInt(businessCommunityLocationInfos.get(0).get("count").toString()); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.community.listener.communityLocation; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.community.dao.ICommunityLocationServiceDao; |
| | | import com.java110.core.event.service.AbstractBusinessServiceDataFlowListener; |
| | | import com.java110.entity.center.Business; |
| | | 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 AbstractCommunityLocationBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener { |
| | | private static Logger logger = LoggerFactory.getLogger(AbstractCommunityLocationBusinessServiceDataFlowListener.class); |
| | | |
| | | |
| | | /** |
| | | * 获取 DAO工具类 |
| | | * |
| | | * @return |
| | | */ |
| | | public abstract ICommunityLocationServiceDao getCommunityLocationServiceDaoImpl(); |
| | | |
| | | /** |
| | | * 刷新 businessCommunityLocationInfo 数据 |
| | | * 主要将 数据库 中字段和 接口传递字段建立关系 |
| | | * |
| | | * @param businessCommunityLocationInfo |
| | | */ |
| | | protected void flushBusinessCommunityLocationInfo(Map businessCommunityLocationInfo, String statusCd) { |
| | | businessCommunityLocationInfo.put("newBId", businessCommunityLocationInfo.get("b_id")); |
| | | businessCommunityLocationInfo.put("locationName", businessCommunityLocationInfo.get("location_name")); |
| | | businessCommunityLocationInfo.put("operate", businessCommunityLocationInfo.get("operate")); |
| | | businessCommunityLocationInfo.put("locationId", businessCommunityLocationInfo.get("location_id")); |
| | | businessCommunityLocationInfo.put("locationType", businessCommunityLocationInfo.get("location_type")); |
| | | businessCommunityLocationInfo.put("communityId", businessCommunityLocationInfo.get("community_id")); |
| | | businessCommunityLocationInfo.remove("bId"); |
| | | businessCommunityLocationInfo.put("statusCd", statusCd); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中 |
| | | * |
| | | * @param businessCommunityLocation 小区位置信息 |
| | | */ |
| | | protected void autoSaveDelBusinessCommunityLocation(Business business, JSONObject businessCommunityLocation) { |
| | | //自动插入DEL |
| | | Map info = new HashMap(); |
| | | info.put("locationId", businessCommunityLocation.getString("locationId")); |
| | | info.put("statusCd", StatusConstant.STATUS_CD_VALID); |
| | | List<Map> currentCommunityLocationInfos = getCommunityLocationServiceDaoImpl().getCommunityLocationInfo(info); |
| | | if (currentCommunityLocationInfos == null || currentCommunityLocationInfos.size() != 1) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info); |
| | | } |
| | | |
| | | Map currentCommunityLocationInfo = currentCommunityLocationInfos.get(0); |
| | | |
| | | currentCommunityLocationInfo.put("bId", business.getbId()); |
| | | |
| | | currentCommunityLocationInfo.put("locationName", currentCommunityLocationInfo.get("location_name")); |
| | | currentCommunityLocationInfo.put("operate", currentCommunityLocationInfo.get("operate")); |
| | | currentCommunityLocationInfo.put("locationId", currentCommunityLocationInfo.get("location_id")); |
| | | currentCommunityLocationInfo.put("locationType", currentCommunityLocationInfo.get("location_type")); |
| | | currentCommunityLocationInfo.put("communityId", currentCommunityLocationInfo.get("community_id")); |
| | | |
| | | |
| | | currentCommunityLocationInfo.put("operate", StatusConstant.OPERATE_DEL); |
| | | getCommunityLocationServiceDaoImpl().saveBusinessCommunityLocationInfo(currentCommunityLocationInfo); |
| | | for (Object key : currentCommunityLocationInfo.keySet()) { |
| | | if (businessCommunityLocation.get(key) == null) { |
| | | businessCommunityLocation.put(key.toString(), currentCommunityLocationInfo.get(key)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.community.listener.communityLocation; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.community.dao.ICommunityLocationServiceDao; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.entity.center.Business; |
| | | import com.java110.po.community.CommunityLocationPo; |
| | | 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、businessCommunityLocation:{} 小区位置基本信息节点 |
| | | * 2、businessCommunityLocationAttr:[{}] 小区位置属性信息节点 |
| | | * 3、businessCommunityLocationPhoto:[{}] 小区位置照片信息节点 |
| | | * 4、businessCommunityLocationCerdentials:[{}] 小区位置证件信息节点 |
| | | * 协议地址 :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("deleteCommunityLocationInfoListener") |
| | | @Transactional |
| | | public class DeleteCommunityLocationInfoListener extends AbstractCommunityLocationBusinessServiceDataFlowListener { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(DeleteCommunityLocationInfoListener.class); |
| | | @Autowired |
| | | ICommunityLocationServiceDao communityLocationServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 3; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_DELETE_LOCATION; |
| | | } |
| | | |
| | | /** |
| | | * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去 |
| | | * |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | //处理 businessCommunityLocation 节点 |
| | | if (data.containsKey(CommunityLocationPo.class.getSimpleName())) { |
| | | Object _obj = data.get(CommunityLocationPo.class.getSimpleName()); |
| | | JSONArray businessCommunityLocations = null; |
| | | if (_obj instanceof JSONObject) { |
| | | businessCommunityLocations = new JSONArray(); |
| | | businessCommunityLocations.add(_obj); |
| | | } else { |
| | | businessCommunityLocations = (JSONArray) _obj; |
| | | } |
| | | //JSONObject businessCommunityLocation = data.getJSONObject(CommunityLocationPo.class.getSimpleName()); |
| | | for (int _communityLocationIndex = 0; _communityLocationIndex < businessCommunityLocations.size(); _communityLocationIndex++) { |
| | | JSONObject businessCommunityLocation = businessCommunityLocations.getJSONObject(_communityLocationIndex); |
| | | doBusinessCommunityLocation(business, businessCommunityLocation); |
| | | if (_obj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("locationId", businessCommunityLocation.getString("locationId")); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 删除 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> businessCommunityLocationInfos = communityLocationServiceDaoImpl.getBusinessCommunityLocationInfo(info); |
| | | if (businessCommunityLocationInfos != null && businessCommunityLocationInfos.size() > 0) { |
| | | for (int _communityLocationIndex = 0; _communityLocationIndex < businessCommunityLocationInfos.size(); _communityLocationIndex++) { |
| | | Map businessCommunityLocationInfo = businessCommunityLocationInfos.get(_communityLocationIndex); |
| | | flushBusinessCommunityLocationInfo(businessCommunityLocationInfo, StatusConstant.STATUS_CD_INVALID); |
| | | communityLocationServiceDaoImpl.updateCommunityLocationInfoInstance(businessCommunityLocationInfo); |
| | | dataFlowContext.addParamOut("locationId", businessCommunityLocationInfo.get("location_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> communityLocationInfo = communityLocationServiceDaoImpl.getCommunityLocationInfo(info); |
| | | if (communityLocationInfo != null && communityLocationInfo.size() > 0) { |
| | | |
| | | //小区位置信息 |
| | | List<Map> businessCommunityLocationInfos = communityLocationServiceDaoImpl.getBusinessCommunityLocationInfo(delInfo); |
| | | //除非程序出错了,这里不会为空 |
| | | if (businessCommunityLocationInfos == null || businessCommunityLocationInfos.size() == 0) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(communityLocation),程序内部异常,请检查! " + delInfo); |
| | | } |
| | | for (int _communityLocationIndex = 0; _communityLocationIndex < businessCommunityLocationInfos.size(); _communityLocationIndex++) { |
| | | Map businessCommunityLocationInfo = businessCommunityLocationInfos.get(_communityLocationIndex); |
| | | flushBusinessCommunityLocationInfo(businessCommunityLocationInfo, StatusConstant.STATUS_CD_VALID); |
| | | communityLocationServiceDaoImpl.updateCommunityLocationInfoInstance(businessCommunityLocationInfo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理 businessCommunityLocation 节点 |
| | | * |
| | | * @param business 总的数据节点 |
| | | * @param businessCommunityLocation 小区位置节点 |
| | | */ |
| | | private void doBusinessCommunityLocation(Business business, JSONObject businessCommunityLocation) { |
| | | |
| | | Assert.jsonObjectHaveKey(businessCommunityLocation, "locationId", "businessCommunityLocation 节点下没有包含 locationId 节点"); |
| | | |
| | | if (businessCommunityLocation.getString("locationId").startsWith("-")) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "locationId 错误,不能自动生成(必须已经存在的locationId)" + businessCommunityLocation); |
| | | } |
| | | //自动插入DEL |
| | | autoSaveDelBusinessCommunityLocation(business, businessCommunityLocation); |
| | | } |
| | | |
| | | @Override |
| | | public ICommunityLocationServiceDao getCommunityLocationServiceDaoImpl() { |
| | | return communityLocationServiceDaoImpl; |
| | | } |
| | | |
| | | public void setCommunityLocationServiceDaoImpl(ICommunityLocationServiceDao communityLocationServiceDaoImpl) { |
| | | this.communityLocationServiceDaoImpl = communityLocationServiceDaoImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.community.listener.communityLocation; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.po.community.CommunityLocationPo; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.constant.StatusConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.community.dao.ICommunityLocationServiceDao; |
| | | 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 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("saveCommunityLocationInfoListener") |
| | | @Transactional |
| | | public class SaveCommunityLocationInfoListener extends AbstractCommunityLocationBusinessServiceDataFlowListener{ |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(SaveCommunityLocationInfoListener.class); |
| | | |
| | | @Autowired |
| | | private ICommunityLocationServiceDao communityLocationServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_SAVE_LOCATION; |
| | | } |
| | | |
| | | /** |
| | | * 保存小区位置信息 business 表中 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | //处理 businessCommunityLocation 节点 |
| | | if(data.containsKey(CommunityLocationPo.class.getSimpleName())){ |
| | | Object bObj = data.get(CommunityLocationPo.class.getSimpleName()); |
| | | JSONArray businessCommunityLocations = null; |
| | | if(bObj instanceof JSONObject){ |
| | | businessCommunityLocations = new JSONArray(); |
| | | businessCommunityLocations.add(bObj); |
| | | }else { |
| | | businessCommunityLocations = (JSONArray)bObj; |
| | | } |
| | | //JSONObject businessCommunityLocation = data.getJSONObject(CommunityLocationPo.class.getSimpleName()); |
| | | for (int bCommunityLocationIndex = 0; bCommunityLocationIndex < businessCommunityLocations.size();bCommunityLocationIndex++) { |
| | | JSONObject businessCommunityLocation = businessCommunityLocations.getJSONObject(bCommunityLocationIndex); |
| | | doBusinessCommunityLocation(business, businessCommunityLocation); |
| | | if(bObj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("locationId", businessCommunityLocation.getString("locationId")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 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> businessCommunityLocationInfo = communityLocationServiceDaoImpl.getBusinessCommunityLocationInfo(info); |
| | | if( businessCommunityLocationInfo != null && businessCommunityLocationInfo.size() >0) { |
| | | reFreshShareColumn(info, businessCommunityLocationInfo.get(0)); |
| | | communityLocationServiceDaoImpl.saveCommunityLocationInfoInstance(info); |
| | | if(businessCommunityLocationInfo.size() == 1) { |
| | | dataFlowContext.addParamOut("locationId", businessCommunityLocationInfo.get(0).get("location_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> communityLocationInfo = communityLocationServiceDaoImpl.getCommunityLocationInfo(info); |
| | | if(communityLocationInfo != null && communityLocationInfo.size() > 0){ |
| | | reFreshShareColumn(paramIn, communityLocationInfo.get(0)); |
| | | communityLocationServiceDaoImpl.updateCommunityLocationInfoInstance(paramIn); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessCommunityLocation 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessCommunityLocation 小区位置节点 |
| | | */ |
| | | private void doBusinessCommunityLocation(Business business,JSONObject businessCommunityLocation){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessCommunityLocation,"locationId","businessCommunityLocation 节点下没有包含 locationId 节点"); |
| | | |
| | | if(businessCommunityLocation.getString("locationId").startsWith("-")){ |
| | | //刷新缓存 |
| | | //flushCommunityLocationId(business.getDatas()); |
| | | |
| | | businessCommunityLocation.put("locationId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_locationId)); |
| | | |
| | | } |
| | | |
| | | businessCommunityLocation.put("bId",business.getbId()); |
| | | businessCommunityLocation.put("operate", StatusConstant.OPERATE_ADD); |
| | | //保存小区位置信息 |
| | | communityLocationServiceDaoImpl.saveBusinessCommunityLocationInfo(businessCommunityLocation); |
| | | |
| | | } |
| | | @Override |
| | | public ICommunityLocationServiceDao getCommunityLocationServiceDaoImpl() { |
| | | return communityLocationServiceDaoImpl; |
| | | } |
| | | |
| | | public void setCommunityLocationServiceDaoImpl(ICommunityLocationServiceDao communityLocationServiceDaoImpl) { |
| | | this.communityLocationServiceDaoImpl = communityLocationServiceDaoImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.community.listener.communityLocation; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.community.dao.ICommunityLocationServiceDao; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.entity.center.Business; |
| | | import com.java110.po.community.CommunityLocationPo; |
| | | 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、businessCommunityLocation:{} 小区位置基本信息节点 |
| | | * 2、businessCommunityLocationAttr:[{}] 小区位置属性信息节点 |
| | | * 3、businessCommunityLocationPhoto:[{}] 小区位置照片信息节点 |
| | | * 4、businessCommunityLocationCerdentials:[{}] 小区位置证件信息节点 |
| | | * 协议地址 :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("updateCommunityLocationInfoListener") |
| | | @Transactional |
| | | public class UpdateCommunityLocationInfoListener extends AbstractCommunityLocationBusinessServiceDataFlowListener { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(UpdateCommunityLocationInfoListener.class); |
| | | @Autowired |
| | | private ICommunityLocationServiceDao communityLocationServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 2; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_LOCATION; |
| | | } |
| | | |
| | | /** |
| | | * business过程 |
| | | * |
| | | * @param dataFlowContext 上下文对象 |
| | | * @param business 业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | |
| | | //处理 businessCommunityLocation 节点 |
| | | if (data.containsKey(CommunityLocationPo.class.getSimpleName())) { |
| | | Object _obj = data.get(CommunityLocationPo.class.getSimpleName()); |
| | | JSONArray businessCommunityLocations = null; |
| | | if (_obj instanceof JSONObject) { |
| | | businessCommunityLocations = new JSONArray(); |
| | | businessCommunityLocations.add(_obj); |
| | | } else { |
| | | businessCommunityLocations = (JSONArray) _obj; |
| | | } |
| | | //JSONObject businessCommunityLocation = data.getJSONObject(CommunityLocationPo.class.getSimpleName()); |
| | | for (int _communityLocationIndex = 0; _communityLocationIndex < businessCommunityLocations.size(); _communityLocationIndex++) { |
| | | JSONObject businessCommunityLocation = businessCommunityLocations.getJSONObject(_communityLocationIndex); |
| | | doBusinessCommunityLocation(business, businessCommunityLocation); |
| | | if (_obj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("locationId", businessCommunityLocation.getString("locationId")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 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> businessCommunityLocationInfos = communityLocationServiceDaoImpl.getBusinessCommunityLocationInfo(info); |
| | | if (businessCommunityLocationInfos != null && businessCommunityLocationInfos.size() > 0) { |
| | | for (int _communityLocationIndex = 0; _communityLocationIndex < businessCommunityLocationInfos.size(); _communityLocationIndex++) { |
| | | Map businessCommunityLocationInfo = businessCommunityLocationInfos.get(_communityLocationIndex); |
| | | flushBusinessCommunityLocationInfo(businessCommunityLocationInfo, StatusConstant.STATUS_CD_VALID); |
| | | communityLocationServiceDaoImpl.updateCommunityLocationInfoInstance(businessCommunityLocationInfo); |
| | | if (businessCommunityLocationInfo.size() == 1) { |
| | | dataFlowContext.addParamOut("locationId", businessCommunityLocationInfo.get("location_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> communityLocationInfo = communityLocationServiceDaoImpl.getCommunityLocationInfo(info); |
| | | if (communityLocationInfo != null && communityLocationInfo.size() > 0) { |
| | | |
| | | //小区位置信息 |
| | | List<Map> businessCommunityLocationInfos = communityLocationServiceDaoImpl.getBusinessCommunityLocationInfo(delInfo); |
| | | //除非程序出错了,这里不会为空 |
| | | if (businessCommunityLocationInfos == null || businessCommunityLocationInfos.size() == 0) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(communityLocation),程序内部异常,请检查! " + delInfo); |
| | | } |
| | | for (int _communityLocationIndex = 0; _communityLocationIndex < businessCommunityLocationInfos.size(); _communityLocationIndex++) { |
| | | Map businessCommunityLocationInfo = businessCommunityLocationInfos.get(_communityLocationIndex); |
| | | flushBusinessCommunityLocationInfo(businessCommunityLocationInfo, StatusConstant.STATUS_CD_VALID); |
| | | communityLocationServiceDaoImpl.updateCommunityLocationInfoInstance(businessCommunityLocationInfo); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理 businessCommunityLocation 节点 |
| | | * |
| | | * @param business 总的数据节点 |
| | | * @param businessCommunityLocation 小区位置节点 |
| | | */ |
| | | private void doBusinessCommunityLocation(Business business, JSONObject businessCommunityLocation) { |
| | | |
| | | Assert.jsonObjectHaveKey(businessCommunityLocation, "locationId", "businessCommunityLocation 节点下没有包含 locationId 节点"); |
| | | |
| | | if (businessCommunityLocation.getString("locationId").startsWith("-")) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "locationId 错误,不能自动生成(必须已经存在的locationId)" + businessCommunityLocation); |
| | | } |
| | | //自动保存DEL |
| | | autoSaveDelBusinessCommunityLocation(business, businessCommunityLocation); |
| | | |
| | | businessCommunityLocation.put("bId", business.getbId()); |
| | | businessCommunityLocation.put("operate", StatusConstant.OPERATE_ADD); |
| | | //保存小区位置信息 |
| | | communityLocationServiceDaoImpl.saveBusinessCommunityLocationInfo(businessCommunityLocation); |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public ICommunityLocationServiceDao getCommunityLocationServiceDaoImpl() { |
| | | return communityLocationServiceDaoImpl; |
| | | } |
| | | |
| | | public void setCommunityLocationServiceDaoImpl(ICommunityLocationServiceDao communityLocationServiceDaoImpl) { |
| | | this.communityLocationServiceDaoImpl = communityLocationServiceDaoImpl; |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.community.smo.impl; |
| | | |
| | | |
| | | import com.java110.community.dao.ICommunityLocationServiceDao; |
| | | import com.java110.core.smo.community.ICommunityLocationInnerServiceSMO; |
| | | import com.java110.dto.communityLocation.CommunityLocationDto; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.core.base.smo.BaseServiceSMO; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.core.smo.user.IUserInnerServiceSMO; |
| | | import com.java110.dto.PageDto; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | 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 CommunityLocationInnerServiceSMOImpl extends BaseServiceSMO implements ICommunityLocationInnerServiceSMO { |
| | | |
| | | @Autowired |
| | | private ICommunityLocationServiceDao communityLocationServiceDaoImpl; |
| | | |
| | | @Autowired |
| | | private IUserInnerServiceSMO userInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public List<CommunityLocationDto> queryCommunityLocations(@RequestBody CommunityLocationDto communityLocationDto) { |
| | | |
| | | //校验是否传了 分页信息 |
| | | |
| | | int page = communityLocationDto.getPage(); |
| | | |
| | | if (page != PageDto.DEFAULT_PAGE) { |
| | | communityLocationDto.setPage((page - 1) * communityLocationDto.getRow()); |
| | | } |
| | | |
| | | List<CommunityLocationDto> communityLocations = BeanConvertUtil.covertBeanList(communityLocationServiceDaoImpl.getCommunityLocationInfo(BeanConvertUtil.beanCovertMap(communityLocationDto)), CommunityLocationDto.class); |
| | | |
| | | if (communityLocations == null || communityLocations.size() == 0) { |
| | | return communityLocations; |
| | | } |
| | | |
| | | String[] userIds = getUserIds(communityLocations); |
| | | //根据 userId 查询用户信息 |
| | | List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds); |
| | | |
| | | for (CommunityLocationDto communityLocation : communityLocations) { |
| | | refreshCommunityLocation(communityLocation, users); |
| | | } |
| | | return communityLocations; |
| | | } |
| | | |
| | | /** |
| | | * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中 |
| | | * |
| | | * @param communityLocation 小区小区位置信息 |
| | | * @param users 用户列表 |
| | | */ |
| | | private void refreshCommunityLocation(CommunityLocationDto communityLocation, List<UserDto> users) { |
| | | for (UserDto user : users) { |
| | | if (communityLocation.getLocationId().equals(user.getUserId())) { |
| | | BeanConvertUtil.covertBean(user, communityLocation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取批量userId |
| | | * |
| | | * @param communityLocations 小区楼信息 |
| | | * @return 批量userIds 信息 |
| | | */ |
| | | private String[] getUserIds(List<CommunityLocationDto> communityLocations) { |
| | | List<String> userIds = new ArrayList<String>(); |
| | | for (CommunityLocationDto communityLocation : communityLocations) { |
| | | userIds.add(communityLocation.getLocationId()); |
| | | } |
| | | |
| | | return userIds.toArray(new String[userIds.size()]); |
| | | } |
| | | |
| | | @Override |
| | | public int queryCommunityLocationsCount(@RequestBody CommunityLocationDto communityLocationDto) { |
| | | return communityLocationServiceDaoImpl.queryCommunityLocationsCount(BeanConvertUtil.beanCovertMap(communityLocationDto)); } |
| | | |
| | | public ICommunityLocationServiceDao getCommunityLocationServiceDaoImpl() { |
| | | return communityLocationServiceDaoImpl; |
| | | } |
| | | |
| | | public void setCommunityLocationServiceDaoImpl(ICommunityLocationServiceDao communityLocationServiceDaoImpl) { |
| | | this.communityLocationServiceDaoImpl = communityLocationServiceDaoImpl; |
| | | } |
| | | |
| | | public IUserInnerServiceSMO getUserInnerServiceSMOImpl() { |
| | | return userInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) { |
| | | this.userInnerServiceSMOImpl = userInnerServiceSMOImpl; |
| | | } |
| | | } |
| | |
| | | */ |
| | | public List<Map> queryBillOweFees(Map info) throws DAOException; |
| | | |
| | | /** |
| | | * 查询账单欠费 |
| | | * |
| | | * @param info bId 信息 |
| | | * @return List<Map> |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | int insertBillOweFees(Map info) throws DAOException; |
| | | |
| | | /** |
| | | * 保存账单 |
| | | * |
| | | * @param info bId 信息 |
| | | * @return List<Map> |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | int insertBill(Map info) throws DAOException; |
| | | |
| | | } |
| | |
| | | package com.java110.fee.dao.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.base.dao.BaseServiceDao; |
| | | import com.java110.fee.dao.IFeeServiceDao; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.exception.DAOException; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.core.base.dao.BaseServiceDao; |
| | | import com.java110.fee.dao.IFeeServiceDao; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | /** |
| | | * 费用信息封装 |
| | | * |
| | | * @param businessFeeInfo 费用信息 封装 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | |
| | | public void saveBusinessFeeInfo(Map businessFeeInfo) throws DAOException { |
| | | businessFeeInfo.put("month", DateUtil.getCurrentMonth()); |
| | | // 查询business_user 数据是否已经存在 |
| | | logger.debug("保存费用信息 入参 businessFeeInfo : {}",businessFeeInfo); |
| | | int saveFlag = sqlSessionTemplate.insert("feeServiceDaoImpl.saveBusinessFeeInfo",businessFeeInfo); |
| | | logger.debug("保存费用信息 入参 businessFeeInfo : {}", businessFeeInfo); |
| | | int saveFlag = sqlSessionTemplate.insert("feeServiceDaoImpl.saveBusinessFeeInfo", businessFeeInfo); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存费用数据失败:"+ JSONObject.toJSONString(businessFeeInfo)); |
| | | if (saveFlag < 1) { |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存费用数据失败:" + JSONObject.toJSONString(businessFeeInfo)); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询费用信息 |
| | | * |
| | | * @param info bId 信息 |
| | | * @return 费用信息 |
| | | * @throws DAOException DAO异常 |
| | |
| | | @Override |
| | | public List<Map> getBusinessFeeInfo(Map info) throws DAOException { |
| | | |
| | | logger.debug("查询费用信息 入参 info : {}",info); |
| | | logger.debug("查询费用信息 入参 info : {}", info); |
| | | |
| | | List<Map> businessFeeInfos = sqlSessionTemplate.selectList("feeServiceDaoImpl.getBusinessFeeInfo",info); |
| | | List<Map> businessFeeInfos = sqlSessionTemplate.selectList("feeServiceDaoImpl.getBusinessFeeInfo", info); |
| | | |
| | | return businessFeeInfos; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存费用信息 到 instance |
| | | * @param info bId 信息 |
| | | * |
| | | * @param info bId 信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void saveFeeInfoInstance(Map info) throws DAOException { |
| | | logger.debug("保存费用信息Instance 入参 info : {}",info); |
| | | logger.debug("保存费用信息Instance 入参 info : {}", info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.insert("feeServiceDaoImpl.saveFeeInfoInstance",info); |
| | | int saveFlag = sqlSessionTemplate.insert("feeServiceDaoImpl.saveFeeInfoInstance", info); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存费用信息Instance数据失败:"+ JSONObject.toJSONString(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> getFeeInfo(Map info) throws DAOException { |
| | | logger.debug("查询费用信息 入参 info : {}",info); |
| | | logger.debug("查询费用信息 入参 info : {}", info); |
| | | |
| | | List<Map> businessFeeInfos = sqlSessionTemplate.selectList("feeServiceDaoImpl.getFeeInfo",info); |
| | | List<Map> businessFeeInfos = sqlSessionTemplate.selectList("feeServiceDaoImpl.getFeeInfo", info); |
| | | |
| | | return businessFeeInfos; |
| | | } |
| | |
| | | |
| | | /** |
| | | * 修改费用信息 |
| | | * |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void updateFeeInfoInstance(Map info) throws DAOException { |
| | | logger.debug("修改费用信息Instance 入参 info : {}",info); |
| | | logger.debug("修改费用信息Instance 入参 info : {}", info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.update("feeServiceDaoImpl.updateFeeInfoInstance",info); |
| | | int saveFlag = sqlSessionTemplate.update("feeServiceDaoImpl.updateFeeInfoInstance", info); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改费用信息Instance数据失败:"+ JSONObject.toJSONString(info)); |
| | | if (saveFlag < 1) { |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "修改费用信息Instance数据失败:" + JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | /** |
| | | * 查询费用数量 |
| | | * |
| | | * @param info 费用信息 |
| | | * @return 费用数量 |
| | | */ |
| | | @Override |
| | | public int queryFeesCount(Map info) { |
| | | logger.debug("查询费用数据 入参 info : {}",info); |
| | | logger.debug("查询费用数据 入参 info : {}", info); |
| | | |
| | | List<Map> businessFeeInfos = sqlSessionTemplate.selectList("feeServiceDaoImpl.queryFeesCount", info); |
| | | if (businessFeeInfos.size() < 1) { |
| | |
| | | |
| | | /** |
| | | * 查询费用账期 |
| | | * |
| | | * @param info 费用信息 |
| | | * @return 费用数量 |
| | | */ |
| | | @Override |
| | | public int queryBillCount(Map info) { |
| | | logger.debug("查询费用数据 入参 info : {}",info); |
| | | logger.debug("查询费用数据 入参 info : {}", info); |
| | | |
| | | List<Map> businessFeeInfos = sqlSessionTemplate.selectList("feeServiceDaoImpl.queryBillCount", info); |
| | | if (businessFeeInfos.size() < 1) { |
| | |
| | | |
| | | /** |
| | | * 查询账期 |
| | | * |
| | | * @param info bId 信息 |
| | | * @return List<Map> |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public List<Map> queryBills(Map info) throws DAOException { |
| | | logger.debug("查询费用信息 入参 info : {}",info); |
| | | logger.debug("查询费用信息 入参 info : {}", info); |
| | | |
| | | List<Map> businessFeeInfos = sqlSessionTemplate.selectList("feeServiceDaoImpl.queryBills",info); |
| | | List<Map> businessFeeInfos = sqlSessionTemplate.selectList("feeServiceDaoImpl.queryBills", info); |
| | | |
| | | return businessFeeInfos; |
| | | } |
| | |
| | | |
| | | /** |
| | | * 查询账单欠费总数 |
| | | * |
| | | * @param info 费用信息 |
| | | * @return 费用数量 |
| | | */ |
| | | @Override |
| | | public int queryBillOweFeeCount(Map info) { |
| | | logger.debug("查询费用数据 入参 info : {}",info); |
| | | logger.debug("查询费用数据 入参 info : {}", info); |
| | | |
| | | List<Map> businessFeeInfos = sqlSessionTemplate.selectList("feeServiceDaoImpl.queryBillOweFeeCount", info); |
| | | if (businessFeeInfos.size() < 1) { |
| | |
| | | |
| | | /** |
| | | * 查询账单欠费 |
| | | * |
| | | * @param info bId 信息 |
| | | * @return List<Map> |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public List<Map> queryBillOweFees(Map info) throws DAOException { |
| | | logger.debug("查询费用信息 入参 info : {}",info); |
| | | logger.debug("查询费用信息 入参 info : {}", info); |
| | | |
| | | List<Map> businessFeeInfos = sqlSessionTemplate.selectList("feeServiceDaoImpl.queryBillOweFees",info); |
| | | List<Map> businessFeeInfos = sqlSessionTemplate.selectList("feeServiceDaoImpl.queryBillOweFees", info); |
| | | |
| | | return businessFeeInfos; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存欠费 |
| | | * |
| | | * @param info bId 信息 |
| | | * @return List<Map> |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public int insertBillOweFees(Map info) throws DAOException { |
| | | logger.debug("保存欠费费用信息 入参 info : {}", info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.insert("feeServiceDaoImpl.insertBillOweFees", info); |
| | | |
| | | return saveFlag; |
| | | } |
| | | |
| | | /** |
| | | * 保存欠费 |
| | | * |
| | | * @param info bId 信息 |
| | | * @return List<Map> |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public int insertBill(Map info) throws DAOException { |
| | | logger.debug("保存欠费费用信息 入参 info : {}", info); |
| | | |
| | | sqlSessionTemplate.update("feeServiceDaoImpl.updateBill", info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.insert("feeServiceDaoImpl.insertBill", info); |
| | | |
| | | return saveFlag; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 保存欠费 |
| | | * |
| | | * @param billDto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int insertBillOweFees(@RequestBody BillOweFeeDto billDto) { |
| | | return feeServiceDaoImpl.insertBillOweFees(BeanConvertUtil.beanCovertMap(billDto)); |
| | | } |
| | | |
| | | /** |
| | | * 保存账单 |
| | | * |
| | | * @param billDto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int insertBill(@RequestBody BillDto billDto) { |
| | | return feeServiceDaoImpl.insertBill(BeanConvertUtil.beanCovertMap(billDto)); |
| | | } |
| | | |
| | | public IFeeServiceDao getFeeServiceDaoImpl() { |
| | | return feeServiceDaoImpl; |
| | | } |
| New file |
| | |
| | | package com.java110.job.task.fee; |
| | | |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.core.smo.fee.IFeeConfigInnerServiceSMO; |
| | | import com.java110.core.smo.fee.IFeeDetailInnerServiceSMO; |
| | | import com.java110.core.smo.fee.IFeeInnerServiceSMO; |
| | | import com.java110.core.smo.owner.IOwnerCarInnerServiceSMO; |
| | | import com.java110.core.smo.owner.IOwnerRoomRelInnerServiceSMO; |
| | | import com.java110.core.smo.parkingSpace.IParkingSpaceInnerServiceSMO; |
| | | import com.java110.core.smo.room.IRoomInnerServiceSMO; |
| | | import com.java110.dto.RoomDto; |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.dto.fee.BillDto; |
| | | import com.java110.dto.fee.BillOweFeeDto; |
| | | import com.java110.dto.fee.FeeConfigDto; |
| | | import com.java110.dto.fee.FeeDetailDto; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.owner.OwnerRoomRelDto; |
| | | import com.java110.dto.parking.ParkingSpaceDto; |
| | | import com.java110.dto.task.TaskDto; |
| | | import com.java110.job.quartz.TaskSystemQuartz; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.exception.TaskTemplateException; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName GenerateOwnerBillTemplate |
| | | * @Description TODO 房屋费用账单生成 |
| | | * @Author wuxw |
| | | * @Date 2020/6/4 8:33 |
| | | * @Version 1.0 |
| | | * add by wuxw 2020/6/4 |
| | | **/ |
| | | @Component |
| | | public class GenerateBillTemplate extends TaskSystemQuartz { |
| | | private static final String TASK_ATTR_BILL_TYPE = "10002"; // 出账类型 |
| | | |
| | | private static final String TASK_ATTR_VALUE_MONTH = "002"; //按月出账 |
| | | |
| | | private static final String TASK_ATTR_VALUE_DAY = "003"; //按日出账 |
| | | |
| | | private static final String TASK_ATTR_VALUE_YEAR = "001"; //按年出账 |
| | | |
| | | private static final String TASK_ATTR_VALUE_ONCE_MONTH = "005"; //一次性按月出账 |
| | | |
| | | @Autowired |
| | | private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeInnerServiceSMO feeInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeDetailInnerServiceSMO feeDetailInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IRoomInnerServiceSMO roomInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerRoomRelInnerServiceSMO ownerRoomRelInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IParkingSpaceInnerServiceSMO parkingSpaceInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl; |
| | | |
| | | |
| | | @Override |
| | | protected void process(TaskDto taskDto) throws Exception { |
| | | |
| | | // 获取小区 |
| | | List<CommunityDto> communityDtos = getAllCommunity(); |
| | | |
| | | for (CommunityDto communityDto : communityDtos) { |
| | | GenerateBill(taskDto, communityDto); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 根据小区生成账单 |
| | | * |
| | | * @param communityDto |
| | | */ |
| | | private void GenerateBill(TaskDto taskDto, CommunityDto communityDto) { |
| | | |
| | | //查询费用项 |
| | | FeeConfigDto feeConfigDto = new FeeConfigDto(); |
| | | feeConfigDto.setCommunityId(communityDto.getCommunityId()); |
| | | feeConfigDto.setBillType(getCurTaskAttr(taskDto, TASK_ATTR_BILL_TYPE).getValue()); |
| | | List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto); |
| | | |
| | | for (FeeConfigDto tmpFeeConfigDto : feeConfigDtos) { |
| | | try { |
| | | GenerateBillByFeeConfig(taskDto, tmpFeeConfigDto); |
| | | } catch (Exception e) { |
| | | logger.error("费用出账失败" + tmpFeeConfigDto.getConfigId(), e); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 按费用项来出账 |
| | | * |
| | | * @param taskDto |
| | | * @param feeConfigDto |
| | | */ |
| | | private void GenerateBillByFeeConfig(TaskDto taskDto, FeeConfigDto feeConfigDto) throws Exception { |
| | | |
| | | |
| | | //当前费用项是否 |
| | | BillDto tmpBillDto = new BillDto(); |
| | | tmpBillDto.setCurBill("T"); |
| | | tmpBillDto.setConfigId(feeConfigDto.getConfigId()); |
| | | tmpBillDto.setCommunityId(feeConfigDto.getCommunityId()); |
| | | List<BillDto> billDtos = feeInnerServiceSMOImpl.queryBills(tmpBillDto); |
| | | |
| | | //Assert.listOnlyOne(billDtos, "当前存在多个有效账单" + feeConfigDto.getConfigId()); |
| | | if (billDtos != null && billDtos.size() > 1) { |
| | | throw new TaskTemplateException(ResponseConstant.RESULT_CODE_ERROR, "当前存在多个有效账单"); |
| | | } |
| | | |
| | | String billId = GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_billId); |
| | | BillDto billDto = new BillDto(); |
| | | billDto.setBillId(billId); |
| | | billDto.setBillName(feeConfigDto.getFeeName() + "-" + DateUtil.getFormatTimeString(new Date(), DateUtil.DATE_FORMATE_STRING_H)); |
| | | billDto.setBillTime(DateUtil.getFormatTimeString(new Date(), DateUtil.DATE_FORMATE_STRING_A)); |
| | | billDto.setCommunityId(feeConfigDto.getCommunityId()); |
| | | billDto.setConfigId(feeConfigDto.getConfigId()); |
| | | billDto.setCurBill("T"); |
| | | |
| | | Date startTime = billDtos == null ? getDefaultStartTime(feeConfigDto.getBillType()) : DateUtil.getDateFromString(billDtos.get(0).getBillTime(), DateUtil.DATE_FORMATE_STRING_A); |
| | | |
| | | FeeDto feeDto = new FeeDto(); |
| | | feeDto.setConfigId(feeConfigDto.getConfigId()); |
| | | feeDto.setCommunityId(feeConfigDto.getCommunityId()); |
| | | List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto); |
| | | |
| | | //没有关联费用不做出账 |
| | | if (feeDto == null || feeDtos.size() < 1) { |
| | | return; |
| | | } |
| | | |
| | | for (FeeDto tmpFeeDto : feeDtos) { |
| | | generateFee(startTime, tmpFeeDto, billDto); |
| | | } |
| | | |
| | | //生成本次账单 |
| | | Date billEndTime = DateUtil.getCurrentDate(); |
| | | billDto.setRemark(DateUtil.getFormatTimeString(startTime,DateUtil.DATE_FORMATE_STRING_A) + |
| | | "-"+DateUtil.getFormatTimeString(billEndTime,DateUtil.DATE_FORMATE_STRING_A) + "账单数据"); |
| | | feeInnerServiceSMOImpl.insertBill(billDto); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 生成 费用 |
| | | * |
| | | * @param feeDto |
| | | */ |
| | | private void generateFee(Date startTime, FeeDto feeDto, BillDto billDto) { |
| | | Date billEndTime = DateUtil.getCurrentDate(); |
| | | if ("2009001".equals(feeDto.getState())) { //判断是否缴费结束 |
| | | FeeDetailDto feeDetailDto = new FeeDetailDto(); |
| | | feeDetailDto.setCommunityId(feeDto.getCommunityId()); |
| | | feeDetailDto.setFeeId(feeDto.getFeeId()); |
| | | List<FeeDetailDto> feeDetailDtos = feeDetailInnerServiceSMOImpl.queryFeeDetails(feeDetailDto); |
| | | |
| | | if (feeDetailDtos == null || feeDetailDtos.size() < 1) { |
| | | return;//这种数据有问题 不做出账处理 |
| | | } |
| | | |
| | | Date detailTime = feeDetailDtos.get(0).getCreateTime(); |
| | | if (detailTime.getTime() < startTime.getTime()) { |
| | | //说明上次出账已经出国 无需再出 |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (feeDto.getEndTime().getTime() > billEndTime.getTime()) { //当期没有欠费 |
| | | return; |
| | | } |
| | | |
| | | computeFeePriceByRoom(feeDto); |
| | | |
| | | if (feeDto.getFeePrice() <= 0) { |
| | | return;//这个没有欠费可算 |
| | | } |
| | | |
| | | BillOweFeeDto billOweFeeDto = new BillOweFeeDto(); |
| | | billOweFeeDto.setOweId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_oweId)); |
| | | billOweFeeDto.setFeeId(feeDto.getFeeId()); |
| | | billOweFeeDto.setBillId(billDto.getBillId()); |
| | | |
| | | int month = dayCompare(startTime, billEndTime); |
| | | BigDecimal curFeePrice = new BigDecimal(feeDto.getFeePrice()); |
| | | curFeePrice = curFeePrice.multiply(new BigDecimal(month)); |
| | | billOweFeeDto.setAmountOwed(curFeePrice.doubleValue() + ""); |
| | | month = dayCompare(feeDto.getEndTime(), billEndTime); |
| | | BigDecimal feePrice = new BigDecimal(feeDto.getFeePrice()); |
| | | feePrice = feePrice.multiply(new BigDecimal(month)); |
| | | billOweFeeDto.setBillAmountOwed(feePrice.doubleValue() + ""); |
| | | billOweFeeDto.setFeeEndTime(DateUtil.getFormatTimeString(feeDto.getEndTime(), DateUtil.DATE_FORMATE_STRING_A)); |
| | | billOweFeeDto.setCommunityId(feeDto.getCommunityId()); |
| | | billOweFeeDto.setPayerObjType(feeDto.getPayerObjType()); |
| | | billOweFeeDto.setState("1000"); |
| | | |
| | | if ("3333".equals(feeDto.getPayerObjType())) { |
| | | getRoomInfo(billOweFeeDto, feeDto); |
| | | } else { |
| | | getParkingSpaceInfo(billOweFeeDto, feeDto); |
| | | } |
| | | |
| | | feeInnerServiceSMOImpl.insertBillOweFees(billOweFeeDto); |
| | | |
| | | double recFee = StringUtil.isEmpty(billDto.getReceipts()) ? 0.0 : Double.parseDouble(billDto.getReceipts()); |
| | | |
| | | BigDecimal recFeeBig = new BigDecimal(recFee); |
| | | BigDecimal newRecFee = recFeeBig.add(feePrice); |
| | | |
| | | //应收 |
| | | billDto.setReceivable(newRecFee.doubleValue() + ""); |
| | | |
| | | //当期应收 |
| | | double curRecFee = StringUtil.isEmpty(billDto.getCurReceivable()) ? 0.0 : Double.parseDouble(billDto.getCurReceivable()); |
| | | BigDecimal curRecFeeBig = new BigDecimal(curRecFee); |
| | | BigDecimal curNewRecFee = curRecFeeBig.add(curFeePrice); |
| | | billDto.setCurReceivable(curNewRecFee.doubleValue() + ""); |
| | | |
| | | FeeDetailDto feeDetailDto = new FeeDetailDto(); |
| | | feeDetailDto.setFeeId(feeDto.getFeeId()); |
| | | feeDetailDto.setCommunityId(feeDto.getCommunityId()); |
| | | feeDetailDto.setStartTime(startTime); |
| | | feeDetailDto.setEndTime(billEndTime); |
| | | List<FeeDetailDto> feeDetailDtos = feeDetailInnerServiceSMOImpl.queryFeeDetails(feeDetailDto); |
| | | |
| | | double curReceiptFee = StringUtil.isEmpty(billDto.getReceipts()) ? 0.0 : Double.parseDouble(billDto.getReceipts()); |
| | | BigDecimal curReceipts = new BigDecimal(curReceiptFee); |
| | | if (feeDetailDtos != null && feeDetailDtos.size() > 0) { |
| | | for (FeeDetailDto tmpFeeDetailDto : feeDetailDtos) { |
| | | BigDecimal recAmount = new BigDecimal(Double.parseDouble(tmpFeeDetailDto.getReceivedAmount())); |
| | | curReceipts = recAmount.add(curReceipts); |
| | | } |
| | | } |
| | | |
| | | billDto.setReceipts(curReceipts.doubleValue() + ""); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 查询车位信息 |
| | | * |
| | | * @param billOweFeeDto |
| | | * @param feeDto |
| | | */ |
| | | private void getParkingSpaceInfo(BillOweFeeDto billOweFeeDto, FeeDto feeDto) { |
| | | |
| | | ParkingSpaceDto parkingSpaceDto = new ParkingSpaceDto(); |
| | | parkingSpaceDto.setPsId(feeDto.getPayerObjId()); |
| | | parkingSpaceDto.setCommunityId(feeDto.getCommunityId()); |
| | | List<ParkingSpaceDto> parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto); |
| | | if (parkingSpaceDtos == null || parkingSpaceDtos.size() < 1) { |
| | | //车位可能被删除了 |
| | | billOweFeeDto.setOweId("1"); |
| | | billOweFeeDto.setOwnerName("未知"); |
| | | billOweFeeDto.setOwnerTel("19999999999"); |
| | | billOweFeeDto.setPayerObjName("未知"); |
| | | return; |
| | | } |
| | | |
| | | billOweFeeDto.setPayerObjName(parkingSpaceDtos.get(0).getAreaNum() + "停车场" + parkingSpaceDtos.get(0).getNum() + "车位"); |
| | | |
| | | |
| | | OwnerCarDto ownerCarDto = new OwnerCarDto(); |
| | | ownerCarDto.setWithOwner(true); |
| | | ownerCarDto.setPsId(parkingSpaceDtos.get(0).getPsId()); |
| | | ownerCarDto.setCommunityId(feeDto.getCommunityId()); |
| | | |
| | | List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto); |
| | | |
| | | |
| | | if (ownerCarDtos == null || ownerCarDtos.size() < 1) { |
| | | //房屋可能被删除了 |
| | | billOweFeeDto.setOweId("1"); |
| | | billOweFeeDto.setOwnerName("未知"); |
| | | billOweFeeDto.setOwnerTel("19999999999"); |
| | | return; |
| | | } |
| | | |
| | | billOweFeeDto.setOweId(ownerCarDtos.get(0).getOwnerId()); |
| | | billOweFeeDto.setOwnerName(ownerCarDtos.get(0).getOwnerName()); |
| | | billOweFeeDto.setOwnerTel(ownerCarDtos.get(0).getLink()); |
| | | } |
| | | |
| | | /** |
| | | * 查询房屋信息 |
| | | * |
| | | * @param billOweFeeDto |
| | | * @param feeDto |
| | | */ |
| | | private void getRoomInfo(BillOweFeeDto billOweFeeDto, FeeDto feeDto) { |
| | | RoomDto roomDto = new RoomDto(); |
| | | roomDto.setRoomId(feeDto.getPayerObjId()); |
| | | roomDto.setCommunityId(feeDto.getCommunityId()); |
| | | List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto); |
| | | |
| | | if (roomDtos == null || roomDtos.size() < 1) { |
| | | //房屋可能被删除了 |
| | | billOweFeeDto.setOweId("1"); |
| | | billOweFeeDto.setOwnerName("未知"); |
| | | billOweFeeDto.setOwnerTel("19999999999"); |
| | | billOweFeeDto.setPayerObjName("未知"); |
| | | return; |
| | | } |
| | | |
| | | RoomDto tmpRoomDto = roomDtos.get(0); |
| | | |
| | | billOweFeeDto.setPayerObjName(tmpRoomDto.getFloorNum() + "栋" + tmpRoomDto.getUnitNum() + "单元" + tmpRoomDto.getRoomNum() + "室"); |
| | | |
| | | OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto(); |
| | | ownerRoomRelDto.setByOwnerInfo(true); |
| | | ownerRoomRelDto.setRoomId(tmpRoomDto.getRoomId()); |
| | | List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto); |
| | | |
| | | if (ownerRoomRelDtos == null || ownerRoomRelDtos.size() < 1) { |
| | | //房屋可能被删除了 |
| | | billOweFeeDto.setOweId("1"); |
| | | billOweFeeDto.setOwnerName("未知"); |
| | | billOweFeeDto.setOwnerTel("19999999999"); |
| | | return; |
| | | } |
| | | |
| | | billOweFeeDto.setOweId(ownerRoomRelDtos.get(0).getOwnerId()); |
| | | billOweFeeDto.setOwnerName(ownerRoomRelDtos.get(0).getOwnerName()); |
| | | billOweFeeDto.setOwnerTel(ownerRoomRelDtos.get(0).getLink()); |
| | | |
| | | } |
| | | |
| | | private Date getDefaultStartTime(String billType) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | if (billType.equals(TASK_ATTR_VALUE_MONTH)) { |
| | | calendar.add(Calendar.MONTH, -1); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | if (billType.equals(TASK_ATTR_VALUE_DAY)) { |
| | | calendar.add(Calendar.DATE, -1); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | if (billType.equals(TASK_ATTR_VALUE_DAY)) { |
| | | calendar.add(Calendar.DATE, -1); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | if (billType.equals(TASK_ATTR_VALUE_YEAR)) { |
| | | calendar.add(Calendar.YEAR, -1); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | return calendar.getTime(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 根据房屋来算单价 |
| | | * |
| | | * @param feeDto |
| | | */ |
| | | private void computeFeePriceByRoom(FeeDto feeDto) { |
| | | RoomDto roomDto = new RoomDto(); |
| | | roomDto.setCommunityId(feeDto.getCommunityId()); |
| | | roomDto.setRoomId(feeDto.getPayerObjId()); |
| | | List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto); |
| | | |
| | | if (roomDtos == null || roomDtos.size() < 1) { //数据有问题 |
| | | return; |
| | | } |
| | | |
| | | String computingFormula = feeDto.getComputingFormula(); |
| | | double feePrice = 0.00; |
| | | if ("1001".equals(computingFormula)) { //面积*单价+附加费 |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice())); |
| | | BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDtos.get(0).getBuiltUpArea())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } else if ("2002".equals(computingFormula)) { // 固定费用 |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } else { |
| | | feePrice = -1.00; |
| | | } |
| | | |
| | | feeDto.setFeePrice(feePrice); |
| | | } |
| | | |
| | | /** |
| | | * 计算2个日期之间相差的 以年、月、日为单位,各自计算结果是多少 |
| | | * 比如:2011-02-02 到 2017-03-02 |
| | | * 以年为单位相差为:6年 |
| | | * 以月为单位相差为:73个月 |
| | | * 以日为单位相差为:2220天 |
| | | * |
| | | * @param fromDate |
| | | * @param toDate |
| | | * @return |
| | | */ |
| | | public static int dayCompare(Date fromDate, Date toDate) { |
| | | Calendar from = Calendar.getInstance(); |
| | | from.setTime(fromDate); |
| | | Calendar to = Calendar.getInstance(); |
| | | to.setTime(toDate); |
| | | //只要年月 |
| | | int fromYear = from.get(Calendar.YEAR); |
| | | int fromMonth = from.get(Calendar.MONTH); |
| | | int toYear = to.get(Calendar.YEAR); |
| | | int toMonth = to.get(Calendar.MONTH); |
| | | int month = toYear * 12 + toMonth - (fromYear * 12 + fromMonth); |
| | | return month; |
| | | } |
| | | } |