Commit 3743712b authored by 13223's avatar 13223

添加房产管理实体

parent 4380e3b7
package com.ejianc.business.propertmanagement.vo;
import java.util.Date;
import java.math.*;
import java.util.List;
import java.util.ArrayList;
import java.io.Serializable;
import com.ejianc.framework.skeleton.template.BaseVO;
/**
* 房产管理
*
* @author generator
*
*/
public class houseMaintenanceVO extends BaseVO {
private static final long serialVersionUID = 1L;
}
package com.ejianc.business.propertmanagement.bean;
import java.util.Date;
import java.math.*;
import java.util.List;
import java.util.ArrayList;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ejianc.framework.skeleton.template.BaseEntity;
import com.ejianc.framework.skeleton.template.annotation.SubEntity;
/**
* 房产管理
*
* @author generator
*
*/
@TableName("house_maintenance_entity")
public class houseMaintenanceEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
}
package com.ejianc.business.propertmanagement.controller;
import java.io.Serializable;
import com.ejianc.foundation.orgcenter.vo.OrgVO;
import com.ejianc.foundation.support.vo.BillCodeParam;
import com.ejianc.foundation.support.api.IBillCodeApi;
import com.ejianc.foundation.support.api.IBillTypeApi;
import com.ejianc.framework.core.exception.BusinessException;
import com.ejianc.framework.core.util.ExcelExport;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.apache.commons.collections.CollectionUtils;
import javax.servlet.http.HttpServletResponse;
import com.ejianc.foundation.orgcenter.api.IOrgApi;
import com.ejianc.framework.core.response.CommonResponse;
import org.springframework.beans.factory.annotation.Autowired;
import com.ejianc.framework.core.context.InvocationInfoProxy;
import com.ejianc.framework.core.kit.mapper.BeanMapper;
import com.ejianc.framework.core.kit.collection.ListUtil;
import com.ejianc.framework.auth.session.SessionManager;
import com.ejianc.framework.auth.session.UserContext;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ejianc.framework.core.response.Parameter;
import com.ejianc.framework.core.response.QueryParam;
import com.ejianc.business.propertmanagement.bean.houseMaintenanceEntity;
import com.ejianc.business.propertmanagement.service.IhouseMaintenanceService;
import com.ejianc.business.propertmanagement.vo.houseMaintenanceVO;
/**
* 房产管理
*
* @author generator
*
*/
@Controller
@RequestMapping("houseMaintenance")
public class houseMaintenanceController implements Serializable {
private static final long serialVersionUID = 1L;
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private IBillTypeApi billTypeApi;
@Autowired
private IBillCodeApi billCodeApi;
@Autowired
private IOrgApi iOrgApi;
private static final String BILL_CODE = "Invoice_Open_Apply_Code";//此处需要根据实际修改
@Autowired
private IhouseMaintenanceService service;
@Autowired
private SessionManager sessionManager;
/**
* @Description saveOrUpdate 新增或者修改
*/
@RequestMapping(value = "/saveOrUpdate", method = RequestMethod.POST)
@ResponseBody
public CommonResponse<houseMaintenanceVO> saveOrUpdate(@RequestBody houseMaintenanceVO saveOrUpdateVO) {
houseMaintenanceEntity entity = BeanMapper.map(saveOrUpdateVO, houseMaintenanceEntity.class);
if(entity.getId() == null || entity.getId() == 0){
BillCodeParam billCodeParam = BillCodeParam.build(BILL_CODE,InvocationInfoProxy.getTenantid(),saveOrUpdateVO);
CommonResponse<String> billCode = billCodeApi.generateBillCode(billCodeParam);
if(billCode.isSuccess()) {
entity.setCode(billCode.getData());//此处需要根据实际修改 删除本行或者下一行
entity.setBillCode(billCode.getData());//此处需要根据实际修改 删除本行或者上一行
}else{
throw new BusinessException("网络异常, 编码生成失败, 请稍后再试");
}
}
service.saveOrUpdate(entity, false);
houseMaintenanceVO vo = BeanMapper.map(entity, houseMaintenanceVO.class);
return CommonResponse.success("保存或修改单据成功!",vo);
}
/**
* @Description queryDetail 查询详情
* @param id
*/
@RequestMapping(value = "/queryDetail", method = RequestMethod.GET)
@ResponseBody
public CommonResponse<houseMaintenanceVO> queryDetail(Long id) {
houseMaintenanceEntity entity = service.selectById(id);
houseMaintenanceVO vo = BeanMapper.map(entity, houseMaintenanceVO.class);
return CommonResponse.success("查询详情数据成功!",vo);
}
/**
* @Description delete 批量删除单据
* @Param [ids]
*/
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResponse<String> delete(@RequestBody List<houseMaintenanceVO> vos) {
if(ListUtil.isNotEmpty(vos)){
for (houseMaintenanceVO vo : vos) {
// 参数是单据类型编码字符串 根据需求是否打开下面代码
/* CommonResponse<String> resp = billTypeApi.checkQuote("billTypeCode", vo.getId());
if(!resp.isSuccess()){
return CommonResponse.error("删除失败!"+resp.getMsg());
}*/
}
}
service.removeByIds(vos.stream().map(houseMaintenanceVO::getId).collect(Collectors.toList()),true);
return CommonResponse.success("删除成功!");
}
/**
* @Description queryList 查询列表
* @param param
* @Return com.ejianc.framework.core.response.CommonResponse<java.lang.String>
*/
@RequestMapping(value = "/queryList", method = RequestMethod.POST)
@ResponseBody
public CommonResponse<IPage<houseMaintenanceVO>> queryList(@RequestBody QueryParam param) {
/** 模糊搜索配置字段示例 */
List<String> fuzzyFields = param.getFuzzyFields();
/** 租户隔离 */
param.getParams().put("tenantId", new Parameter(QueryParam.EQ, InvocationInfoProxy.getTenantid()));
/** 数据隔离 本下 没有组织orgId的删除下面代码-------------开始 */
UserContext userContextCache =sessionManager.getUserContext();
//当前应用有权限的根orgId,以逗号分割,可据此查询其本下数据,需判空
String authOrgIds = userContextCache.getAuthOrgIds();
List<OrgVO> orgVOList = null;
if(StringUtils.isNotBlank(authOrgIds)){//移动端查询
orgVOList = (List<OrgVO>) getRespData(iOrgApi.findChildrenByParentIds(Arrays.stream(authOrgIds.split(",")).map(Long::parseLong).collect(Collectors.toList())), true, "查询失败,获取当前本下组织信息失败。");
}else {//pc端查询
orgVOList = (List<OrgVO>) getRespData(iOrgApi.findChildrenByParentId(InvocationInfoProxy.getOrgId()), true, "查询失败,获取当前本下组织信息失败。");
}
//普通组织 id
List<Long> commonOrgIds = new ArrayList<>();
//项目部 id
List<Long> departmentIds = new ArrayList<>();
orgVOList.stream().forEach(org -> {
if(5 == org.getOrgType()) {
//项目部
departmentIds.add(org.getId());
} else {
//普通组织
commonOrgIds.add(org.getId());
}
});
if(CollectionUtils.isNotEmpty(commonOrgIds)) {
/** 要求主表有orgId字段,保存单据所属组织 */
param.getParams().put("orgId", new Parameter(QueryParam.IN, commonOrgIds));
} else if(CollectionUtils.isNotEmpty(departmentIds)) {
/** 要求主表有projectDepartmentId字段,保存单据所属项目部 */
param.getParams().put("orgId", new Parameter(QueryParam.IN, departmentIds));
}
/** 数据隔离 本下 没有组织orgId的删除上面代码-------------结束!!! */
IPage<houseMaintenanceEntity> page = service.queryPage(param,false);
IPage<houseMaintenanceVO> pageData = new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
pageData.setRecords(BeanMapper.mapList(page.getRecords(), houseMaintenanceVO.class));
return CommonResponse.success("查询列表数据成功!",pageData);
}
/**
* 获取RPC数据
* resp 返回值
* isMustSuc 是否必须成功
* errMsg 失败提示
*/
private Object getRespData(CommonResponse<?> resp, boolean isMustSuc, String errMsg) {
if(isMustSuc && !resp.isSuccess()) {
throw new BusinessException(StringUtils.isNoneBlank(errMsg) ? errMsg : "调用Rpc服务失败");
}
return resp.getData();
}
/**
* @Description 导出
* @param param
* @Return void
*/
@RequestMapping(value = "/excelExport", method = RequestMethod.POST)
@ResponseBody
public void excelExport(@RequestBody QueryParam param, HttpServletResponse response) {
/** 模糊搜索配置字段示例 */
List<String> fuzzyFields = param.getFuzzyFields();
param.getParams().put("tenant_id",new Parameter(QueryParam.EQ,InvocationInfoProxy.getTenantid()));
param.setPageIndex(1);
param.setPageSize(-1);
/** 数据隔离 本下 没有组织orgId的删除下面代码 */
param.getParams().put("orgId",new Parameter(QueryParam.IN,iOrgApi.findChildrenByParentId(InvocationInfoProxy.getOrgId()).getData().stream().map(OrgVO::getId).collect(Collectors.toList())));
List<houseMaintenanceEntity> list = service.queryList(param);
//todo:字段翻译等等
Map<String, Object> beans = new HashMap<>();
beans.put("records", list);
ExcelExport.getInstance().export("houseMaintenance-export.xlsx", beans, response);
}
/**
* @Description 参照
* @param param
* @Return void
*/
@RequestMapping(value = "/refhouseMaintenanceData", method = RequestMethod.GET)
@ResponseBody
public CommonResponse<IPage<houseMaintenanceVO>> refhouseMaintenanceData(@RequestParam Integer pageNumber, @RequestParam Integer pageSize,
String condition,
String searchObject,
String searchText) {
QueryParam param = new QueryParam();
param.setPageSize(pageSize);
param.setPageIndex(pageNumber);
param.setSearchText(searchText);
param.setSearchObject(searchObject);
/** 租户隔离 */
param.getParams().put("tenantId", new Parameter(QueryParam.EQ, InvocationInfoProxy.getTenantid()));
if(StringUtils.isNotEmpty(condition)){
/** 处理condition */
JSONObject _con = JSONObject.parseObject(condition);
}
IPage<houseMaintenanceEntity> page = service.queryPage(param,false);
IPage<houseMaintenanceVO> pageData = new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
pageData.setRecords(BeanMapper.mapList(page.getRecords(), houseMaintenanceVO.class));
return CommonResponse.success("查询参照数据成功!",pageData);
}
}
package com.ejianc.business.propertmanagement.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.ejianc.framework.skeleton.template.BaseCrudMapper;
import com.ejianc.business.propertmanagement.bean.houseMaintenanceEntity;
/**
* 房产管理
*
* @author generator
*
*/
@Mapper
public interface houseMaintenanceMapper extends BaseCrudMapper<houseMaintenanceEntity> {
}
package com.ejianc.business.propertmanagement.service;
import com.ejianc.framework.skeleton.template.IBaseService;
import com.ejianc.business.propertmanagement.bean.houseMaintenanceEntity;
/**
* 房产管理
*
* @author generator
*
*/
public interface IhouseMaintenanceService extends IBaseService<houseMaintenanceEntity> {
}
package com.ejianc.business.propertmanagement.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.ejianc.framework.core.response.CommonResponse;
import com.ejianc.framework.skeleton.billState.service.ICommonBusinessService;
@Service("houseMaintenance")
public class houseMaintenanceBpmServiceImpl implements ICommonBusinessService {
/**
* 提交前回调
*
* @param billId
* @param state
* @return
*/
@Override
public CommonResponse<String> beforeSubmitProcessor(Long billId, Integer state, String billTypeCode) {
//TODO
return CommonResponse.success();
};
/**
* 提交完回调
*
* @param
* @return
*/
@Override
public CommonResponse<String> afterSubmitProcessor(Long billId, Integer state, String billTypeCode){
//TODO
return CommonResponse.success();
}
/**
* 有审批流的撤回前回调
*
* @param billId
* @param state
* @return
*/
@Override
public CommonResponse<String> beforeHasBpmBack(Long billId, Integer state, String billTypeCode) {
return CommonResponse.success();
};
/**
* 有审批流的撤回后回调
*
* @param
* @return
*/
@Override
public CommonResponse<String> afterHasBpmBack(Long billId, Integer state, String billTypeCode){
return CommonResponse.success();
};
/**
* 审批节点审批中时节点审批前回调
*
* @param billId
* @param state
* @return
*/
@Override
public CommonResponse<String> beforeInApprovalBack(Long billId, Integer state, String billTypeCode, String sign) {
return CommonResponse.success();
};
/**
* 审批节点审批中时节点审批后回调
*
* @param billId //单据id
* @param state //单据状态
* @param billTypeCode //单据类型code
* @param taskId //该流程id
* @param isEnd //该节点是否结束
* @return
*/
@Override
public CommonResponse<String> afterInApprovalBack(Long billId, Integer state, String billTypeCode, String taskId, Boolean isEnd, String sign, Map<String,Object> other){
return CommonResponse.success();
};
/**
* 终审审核前回调
*
* @param billId
* @param state
* @return
*/
@Override
public CommonResponse<String> beforeApprovalProcessor(Long billId, Integer state, String billTypeCode) {
//TODO
return CommonResponse.success();
}
/**
* 终审审核完回调
*
* @param
* @return
*/
@Override
public CommonResponse<String> afterApprovalProcessor(Long billId, Integer state, String billTypeCode) {
//TODO
return CommonResponse.success();
}
/**
* 弃审前事件回调
*
* @param billId
* @param state
* @return
*/
@Override
public CommonResponse<String> beforeAbstainingProcessor(Long billId, Integer state, String billTypeCode) {
//TODO
return CommonResponse.success();
}
/**
* 弃审后事件回调
*
* @param billId
* @param state
* @return
*/
@Override
public CommonResponse<String> afterAbstainingProcessor(Long billId, Integer state, String billTypeCode) {
//TODO
return CommonResponse.success();
}
}
package com.ejianc.business.propertmanagement.service.impl;
import org.springframework.stereotype.Service;
import com.ejianc.framework.skeleton.template.BaseServiceImpl;
import com.ejianc.business.propertmanagement.mapper.houseMaintenanceMapper;
import com.ejianc.business.propertmanagement.bean.houseMaintenanceEntity;
import com.ejianc.business.propertmanagement.service.IhouseMaintenanceService;
/**
* 房产管理
*
* @author generator
*
*/
@Service("houseMaintenanceService")
public class houseMaintenanceServiceImpl extends BaseServiceImpl<houseMaintenanceMapper, houseMaintenanceEntity> implements IhouseMaintenanceService{
}
common:
security:
user:
name: ejianc
password: ejianc
name: SYSDBA
# # 本地测试
#password: ejianc
# 测试环境
# password: xN0sQ1eX2xM0nI7
# #正式环境
password: 4ewyFGC0gA!
server:
port: 8080
......@@ -24,10 +29,18 @@ spring:
cloud:
config:
name: ${spring.application.name}
profile: local
label: master
uri: https://${common.security.user.name}:${common.security.user.password}@portal.17elian.com/ejc-configserver
# 本地开发
#profile: zhhtlocal
#uri: https://${common.security.user.name}:${common.security.user.password}@portal.17elian.com/ejc-configserver
# 测试环境
# profile: zhhttest
# uri: http://${common.security.user.name}:${common.security.user.password}@172.16.42.231:8068/ejc-configserver
#正式环境
profile: zhhtprod
uri: http://${common.security.user.name}:${common.security.user.password}@192.168.7.192:8068/ejc-configserver
eureka:
client:
register-with-eureka: false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment