三江-业务中台接收合作单位接口

This commit is contained in:
Administrator 2023-04-15 11:25:21 +08:00
parent ec18d6b193
commit 810140b6da
4 changed files with 473 additions and 148 deletions

View File

@ -5,6 +5,7 @@ import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo; import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
import com.zhgd.xmgl.modules.worker.entity.SjEnterpriseInfo;
import com.zhgd.xmgl.modules.worker.service.IEnterpriseInfoService; import com.zhgd.xmgl.modules.worker.service.IEnterpriseInfoService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@ -21,7 +22,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @Title: Controller * @Title: Controller
* @Description: 劳务公司 * @Description: 劳务公司
* @author pds * @author pds
@ -38,9 +39,10 @@ public class EnterpriseInfoController {
/** /**
* 分页列表查询 * 分页列表查询
*
* @return * @return
*/ */
@ApiOperation(value = " 列表查询劳务公司信息", notes = "列表查询劳务公司信息", httpMethod="POST") @ApiOperation(value = " 列表查询劳务公司信息", notes = "列表查询劳务公司信息", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userEnterpriseId", value = "用户能查看的企业", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "userEnterpriseId", value = "用户能查看的企业", paramType = "query", required = false, dataType = "String"),
@ApiImplicitParam(name = "enterpriseName", value = "劳务公司名称", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "enterpriseName", value = "劳务公司名称", paramType = "query", required = false, dataType = "String"),
@ -48,11 +50,11 @@ public class EnterpriseInfoController {
@ApiImplicitParam(name = "projectSn", value = "项目sN", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目sN", paramType = "query", required = true, dataType = "String"),
}) })
@PostMapping(value = "/list") @PostMapping(value = "/list")
public Result<List<EntityMap>> getEnterpriseInfoList(@RequestBody Map<String,Object> map) { public Result<List<EntityMap>> getEnterpriseInfoList(@RequestBody Map<String, Object> map) {
return Result.success(enterpriseInfoService.getEnterpriseInfoList(map)); return Result.success(enterpriseInfoService.getEnterpriseInfoList(map));
} }
@ApiOperation(value = " 层级查询劳务公司信息", notes = "列表查询劳务公司信息", httpMethod="POST") @ApiOperation(value = " 层级查询劳务公司信息", notes = "列表查询劳务公司信息", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userEnterpriseId", value = "用户能查看的企业", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "userEnterpriseId", value = "用户能查看的企业", paramType = "query", required = false, dataType = "String"),
@ApiImplicitParam(name = "enterpriseName", value = "劳务公司名称", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "enterpriseName", value = "劳务公司名称", paramType = "query", required = false, dataType = "String"),
@ -60,16 +62,18 @@ public class EnterpriseInfoController {
@ApiImplicitParam(name = "projectSn", value = "项目sN", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目sN", paramType = "query", required = true, dataType = "String"),
}) })
@PostMapping(value = "/selectHierarchyEnterpriseList") @PostMapping(value = "/selectHierarchyEnterpriseList")
public Result<JSONArray> selectHierarchyEnterpriseList(@RequestBody Map<String,Object> map) { public Result<JSONArray> selectHierarchyEnterpriseList(@RequestBody Map<String, Object> map) {
return Result.success(enterpriseInfoService.selectHierarchyEnterpriseList(map)); return Result.success(enterpriseInfoService.selectHierarchyEnterpriseList(map));
} }
/** /**
* 添加 * 添加
*
* @param enterpriseInfo * @param enterpriseInfo
* @return * @return
*/ */
@OperLog(operModul = "劳务管理",operType = "添加劳务公司",operDesc = "添加劳务公司") @OperLog(operModul = "劳务管理", operType = "添加劳务公司", operDesc = "添加劳务公司")
@ApiOperation(value = " 添加劳务公司信息", notes = "添加劳务公司信息" , httpMethod="POST") @ApiOperation(value = " 添加劳务公司信息", notes = "添加劳务公司信息", httpMethod = "POST")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<EnterpriseInfo> add(@RequestBody EnterpriseInfo enterpriseInfo) { public Result<EnterpriseInfo> add(@RequestBody EnterpriseInfo enterpriseInfo) {
enterpriseInfoService.saveEnterpriseInfo(enterpriseInfo); enterpriseInfoService.saveEnterpriseInfo(enterpriseInfo);
@ -77,12 +81,26 @@ public class EnterpriseInfoController {
} }
/** /**
* 编辑 * 三江业务中台添加合作单位
*
* @param enterpriseInfo * @param enterpriseInfo
* @return * @return
*/ */
@OperLog(operModul = "劳务管理",operType = "编辑劳务公司",operDesc = "编辑劳务公司") //@OperLog(operModul = "劳务管理",operType = "添加劳务公司",operDesc = "添加劳务公司")
@ApiOperation(value = "编辑劳务公司信息", notes = "编辑劳务公司信息" , httpMethod="POST") @ApiOperation(value = " 三江业务中台添加合作单位", notes = "三江业务中台添加合作单位", httpMethod = "POST")
@PostMapping(value = "/sj/add")
public Result addSj(@RequestBody SjEnterpriseInfo enterpriseInfo) {
return enterpriseInfoService.addSj(enterpriseInfo);
}
/**
* 编辑
*
* @param enterpriseInfo
* @return
*/
@OperLog(operModul = "劳务管理", operType = "编辑劳务公司", operDesc = "编辑劳务公司")
@ApiOperation(value = "编辑劳务公司信息", notes = "编辑劳务公司信息", httpMethod = "POST")
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<EnterpriseInfo> edit(@RequestBody EnterpriseInfo enterpriseInfo) { public Result<EnterpriseInfo> edit(@RequestBody EnterpriseInfo enterpriseInfo) {
enterpriseInfoService.updateEnterpriseInfo(enterpriseInfo); enterpriseInfoService.updateEnterpriseInfo(enterpriseInfo);
@ -90,56 +108,77 @@ public class EnterpriseInfoController {
} }
/** /**
* 通过id删除 * 三江业务中台编辑合作单位
* @param *
* @param enterpriseInfo
* @return * @return
*/ */
@OperLog(operModul = "劳务管理",operType = "删除劳务公司",operDesc = "删除劳务公司") //@OperLog(operModul = "劳务管理", operType = "编辑劳务公司", operDesc = "编辑劳务公司")
@ApiOperation(value = "删除劳务公司信息", notes = "删除劳务公司信息" , httpMethod="POST") @ApiOperation(value = "三江业务中台编辑合作单位", notes = "三江业务中台编辑合作单位", httpMethod = "POST")
@PostMapping(value = "/sj/edit")
public Result editSj(@RequestBody SjEnterpriseInfo enterpriseInfo) {
return enterpriseInfoService.editSj(enterpriseInfo);
}
@OperLog(operModul = "劳务管理", operType = "删除劳务公司", operDesc = "删除劳务公司")
@ApiOperation(value = "删除劳务公司信息", notes = "删除劳务公司信息", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseId", value = "劳务公司ID", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "enterpriseId", value = "劳务公司ID", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "projectSn", value = "项目sN", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目sN", paramType = "query", required = true, dataType = "String"),
}) })
@PostMapping(value = "/delete") @PostMapping(value = "/delete")
public Result<EnterpriseInfo> delete(@RequestBody Map<String,Object> map) { public Result<EnterpriseInfo> delete(@RequestBody Map<String, Object> map) {
enterpriseInfoService.removeEnterpriseInfo(map); enterpriseInfoService.removeEnterpriseInfo(map);
return Result.ok(); return Result.ok();
} }
/**
* 三江业务中台通过id和projectNumber删除合作单位
*
* @param
* @return
*/
//@OperLog(operModul = "劳务管理", operType = "删除劳务公司", operDesc = "删除劳务公司")
@ApiOperation(value = "三江业务中台通过id和projectNumber删除合作单位", notes = "三江业务中台通过id和projectNumber删除合作单位", httpMethod = "POST")
@PostMapping(value = "/sj/delete")
public Result deleteSj(@RequestBody SjEnterpriseInfo enterpriseInfo) {
return enterpriseInfoService.deleteSj(enterpriseInfo);
}
/** /**
* 通过id查询 * 通过id查询
*
* @param * @param
* @return * @return
*/ */
@ApiOperation(value = "通过id查询劳务公司信息", notes = "通过id查询劳务公司信息" , httpMethod="POST") @ApiOperation(value = "通过id查询劳务公司信息", notes = "通过id查询劳务公司信息", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseId", value = "劳务公司ID", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "enterpriseId", value = "劳务公司ID", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "projectSn", value = "项目sN", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目sN", paramType = "query", required = true, dataType = "String"),
}) })
@PostMapping(value = "/getEnterpriseInfoById") @PostMapping(value = "/getEnterpriseInfoById")
public Result<EnterpriseInfo> getEnterpriseInfoById(@RequestBody Map<String,Object> map) { public Result<EnterpriseInfo> getEnterpriseInfoById(@RequestBody Map<String, Object> map) {
return Result.success(enterpriseInfoService.getEnterpriseInfoById(map)); return Result.success(enterpriseInfoService.getEnterpriseInfoById(map));
} }
@ApiOperation(value = "通过社会统一信用代码查询劳务公司", notes = "通过社会统一信用代码查询劳务公司" , httpMethod="POST") @ApiOperation(value = "通过社会统一信用代码查询劳务公司", notes = "通过社会统一信用代码查询劳务公司", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "socialCode", value = "社会统一信用代码", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "socialCode", value = "社会统一信用代码", paramType = "query", required = true, dataType = "String"),
}) })
@PostMapping(value = "/getEnterpriseInfoBySocialCode") @PostMapping(value = "/getEnterpriseInfoBySocialCode")
public Result<EnterpriseInfo> getEnterpriseInfoBySocialCode(@RequestBody Map<String,Object> map) { public Result<EnterpriseInfo> getEnterpriseInfoBySocialCode(@RequestBody Map<String, Object> map) {
return Result.success(enterpriseInfoService.getEnterpriseInfoBySocialCode(map)); return Result.success(enterpriseInfoService.getEnterpriseInfoBySocialCode(map));
} }
@ApiOperation(value = " 列表查询总公司下所有项目劳务公司信息", notes = "列表查询总公司下所有项目劳务公司信息", httpMethod="POST") @ApiOperation(value = " 列表查询总公司下所有项目劳务公司信息", notes = "列表查询总公司下所有项目劳务公司信息", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseName", value = "劳务公司名称", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "enterpriseName", value = "劳务公司名称", paramType = "query", required = false, dataType = "String"),
@ApiImplicitParam(name = "headquartersSn", value = "总公司sn", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "headquartersSn", value = "总公司sn", paramType = "query", required = true, dataType = "String"),
}) })
@PostMapping(value = "/getAllEnterpriseList") @PostMapping(value = "/getAllEnterpriseList")
public Result<List<EnterpriseInfo>> getAllEnterpriseList(@RequestBody Map<String,Object> map) { public Result<List<EnterpriseInfo>> getAllEnterpriseList(@RequestBody Map<String, Object> map) {
return Result.success(enterpriseInfoService.getAllEnterpriseList(map)); return Result.success(enterpriseInfoService.getAllEnterpriseList(map));
} }

View File

@ -0,0 +1,189 @@
package com.zhgd.xmgl.modules.worker.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
@Data
@ApiModel(value = "企业实体类")
public class SjEnterpriseInfo {
/**
* 企业账号表
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "企业账号表")
private java.lang.Long id;
/**
* 企业名称
*/
@Excel(name = "企业名称", width = 15)
@ApiModelProperty(value = "企业名称")
private java.lang.String enterpriseName;
/**
* 描述
*/
@Excel(name = "描述", width = 15)
@ApiModelProperty(value = "描述")
private java.lang.String description;
/**
* 企业地址
*/
@Excel(name = "企业地址", width = 15)
@ApiModelProperty(value = "企业地址")
private java.lang.String enterpriseAddress;
/**
* 法定代表人
*/
@Excel(name = "法定代表人", width = 15)
@ApiModelProperty(value = "法定代表人")
private java.lang.String enterpriseLegalPerson;
/**
* 法定人证件号
*/
@Excel(name = "法定人证件号", width = 15)
@ApiModelProperty(value = "法定人证件号")
private java.lang.String legalPersonIdCard;
/**
* 企业安全生产许可证
*/
@Excel(name = "企业安全生产许可证", width = 15)
@ApiModelProperty(value = "企业安全生产许可证")
private java.lang.String enterpriseSafeAllow;
/**
* 单位性质 1.国有企业 2三资企业 3集体企业 4私营企业
*/
@Excel(name = "单位性质 1.国有企业 2三资企业 3集体企业 4私营企业", width = 15)
@ApiModelProperty(value = "单位性质 1.国有企业 2三资企业 3集体企业 4私营企业")
private java.lang.Integer enterpriseProperty;
/**
* 法人电话
*/
@Excel(name = "法人电话", width = 15)
@ApiModelProperty(value = "法人电话")
private java.lang.String legalPersonTel;
/**
* 社会统一信用代码
*/
@Excel(name = "社会统一信用代码", width = 15)
@ApiModelProperty(value = "社会统一信用代码")
private java.lang.String socialCode;
/**
* 营业执照注册号
*/
@Excel(name = "营业执照注册号", width = 15)
@ApiModelProperty(value = "营业执照注册号")
private java.lang.String businessNumber;
/**
* 资质证书号
*/
@Excel(name = "资质证书号", width = 15)
@ApiModelProperty(value = "资质证书号")
private java.lang.String qualificationNumber;
/**
* 企业邮箱
*/
@Excel(name = "企业邮箱", width = 15)
@ApiModelProperty(value = "企业邮箱")
private java.lang.String enterpriseEmail;
/**
* 注册资金
*/
@Excel(name = "注册资金", width = 15)
@ApiModelProperty(value = "注册资金")
private java.lang.String registeredCapital;
/**
* 开户行
*/
@Excel(name = "开户行", width = 15)
@ApiModelProperty(value = "开户行")
private java.lang.String bankname;
/**
* 银行卡号
*/
@Excel(name = "银行卡号", width = 15)
@ApiModelProperty(value = "银行卡号")
private java.lang.String bankcardnumber;
/**
* 银行代码
*/
@Excel(name = "银行代码", width = 15)
@ApiModelProperty(value = "银行代码")
private java.lang.String bankcode;
/**
* 企业资质图片地址
*/
@Excel(name = "企业资质图片地址", width = 15)
@ApiModelProperty(value = "企业资质图片地址")
private java.lang.String enterpriseQualificationUrl;
/**
* 营业执照截止日期
*/
@Excel(name = "营业执照截止日期", width = 15)
@ApiModelProperty(value = "营业执照截止日期")
private java.lang.String businessLicenseEndDate;
/**
* 注册人姓名
*/
@Excel(name = "注册人姓名", width = 15)
@ApiModelProperty(value = "注册人姓名")
private java.lang.String registerPersonName;
/**
* 注册人电话
*/
@Excel(name = "注册人电话 ", width = 15)
@ApiModelProperty(value = "注册人电话 ")
private java.lang.String registerPersonPhoneTel;
/**
* 企业sn
*/
@Excel(name = "企业sn", width = 15)
@ApiModelProperty(value = "企业sn")
private java.lang.String enterpriseSn;
/**
* logo
*/
@Excel(name = "logo", width = 15)
@ApiModelProperty(value = "logo")
private java.lang.String logo;
/**
* 企业注册日期
*/
@Excel(name = "企业注册日期", width = 15)
@ApiModelProperty(value = "企业注册日期")
private java.lang.String registDate;
@Excel(name = "营业执照图片地址", width = 15)
@ApiModelProperty(value = "营业执照图片地址")
private java.lang.String businessLicenseUrl;
/////////////////////下面的不是enterprise_info表///////////////////////////
/**
* enterprise_type表外键
*/
@ApiModelProperty(value = "企业类型1专业分包2设备分包3材料分包4后勤服务5特殊设备6劳务分包7监理单位8建设单位9总承包单位10勘查单位11设计单位12其它")
private Long enterpriseTypeId;
/**
* enterprise_type表外键
*/
@ApiModelProperty(value = "父级企业ID")
private java.lang.Long parentEnterpriseId;
@ApiModelProperty(value = "企业类型名称")
private java.lang.String enterpriseTypeName;
@ApiModelProperty(value = "项目负责人")
private java.lang.String projectDirectorName;
@ApiModelProperty(value = "项目负责人电话")
private java.lang.String projectDirectorPhone;
///////////////////////////////下面自己添加属性//////////////////////////////////////
@ApiModelProperty(value = "项目编号")
private String projectNumber;
}

View File

@ -1,10 +1,12 @@
package com.zhgd.xmgl.modules.worker.service; package com.zhgd.xmgl.modules.worker.service;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.base.CompanyVo; import com.zhgd.xmgl.base.CompanyVo;
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo; import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.worker.entity.SjEnterpriseInfo;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -34,4 +36,11 @@ public interface IEnterpriseInfoService extends IService<EnterpriseInfo> {
JSONArray selectHierarchyEnterpriseList(Map<String, Object> map); JSONArray selectHierarchyEnterpriseList(Map<String, Object> map);
Map<String, Object> modCompany(CompanyVo companyVo); Map<String, Object> modCompany(CompanyVo companyVo);
Result addSj(SjEnterpriseInfo enterpriseInfo);
Result editSj(SjEnterpriseInfo enterpriseInfo);
Result deleteSj(SjEnterpriseInfo enterpriseInfo);
} }

View File

@ -2,25 +2,31 @@ package com.zhgd.xmgl.modules.worker.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.execption.OpenAlertException; import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.async.AsyncWorker; import com.zhgd.xmgl.async.AsyncWorker;
import com.zhgd.xmgl.base.CompanyVo; import com.zhgd.xmgl.base.CompanyVo;
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo; import com.zhgd.xmgl.modules.project.entity.Project;
import com.zhgd.xmgl.modules.project.entity.ProjectEnterprise; import com.zhgd.xmgl.modules.project.entity.ProjectEnterprise;
import com.zhgd.xmgl.modules.project.mapper.ProjectEnterpriseMapper;
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
import com.zhgd.xmgl.modules.worker.entity.SjEnterpriseInfo;
import com.zhgd.xmgl.modules.worker.entity.TeamInfo; import com.zhgd.xmgl.modules.worker.entity.TeamInfo;
import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper; import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper;
import com.zhgd.xmgl.modules.project.mapper.ProjectEnterpriseMapper;
import com.zhgd.xmgl.modules.worker.mapper.TeamInfoMapper; import com.zhgd.xmgl.modules.worker.mapper.TeamInfoMapper;
import com.zhgd.xmgl.modules.worker.service.IEnterpriseInfoService; import com.zhgd.xmgl.modules.worker.service.IEnterpriseInfoService;
import com.zhgd.xmgl.util.ListUtils; import com.zhgd.xmgl.util.ListUtils;
import com.zhgd.xmgl.util.MessageUtil; import com.zhgd.xmgl.util.MessageUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap; import java.util.HashMap;
@ -37,6 +43,8 @@ import java.util.UUID;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper, EnterpriseInfo> implements IEnterpriseInfoService { public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper, EnterpriseInfo> implements IEnterpriseInfoService {
@Autowired
ProjectMapper projectMapper;
@Autowired @Autowired
private EnterpriseInfoMapper enterpriseInfoMapper; private EnterpriseInfoMapper enterpriseInfoMapper;
@Autowired @Autowired
@ -53,24 +61,24 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper,
@Override @Override
public EnterpriseInfo saveEnterpriseInfo(EnterpriseInfo enterpriseInfo) { public EnterpriseInfo saveEnterpriseInfo(EnterpriseInfo enterpriseInfo) {
QueryWrapper<EnterpriseInfo> queryWrapper=new QueryWrapper<>(); QueryWrapper<EnterpriseInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EnterpriseInfo::getSocialCode,enterpriseInfo.getSocialCode()); queryWrapper.lambda().eq(EnterpriseInfo::getSocialCode, enterpriseInfo.getSocialCode());
EnterpriseInfo tempEnterpriseInfo=enterpriseInfoMapper.selectOne(queryWrapper); EnterpriseInfo tempEnterpriseInfo = enterpriseInfoMapper.selectOne(queryWrapper);
if(enterpriseInfo.getParentEnterpriseId()==null){ if (enterpriseInfo.getParentEnterpriseId() == null) {
enterpriseInfo.setParentEnterpriseId(0L); enterpriseInfo.setParentEnterpriseId(0L);
} }
ProjectEnterprise projectEnterprise=new ProjectEnterprise(); ProjectEnterprise projectEnterprise = new ProjectEnterprise();
if(tempEnterpriseInfo!=null){ if (tempEnterpriseInfo != null) {
QueryWrapper<ProjectEnterprise> queryWrapper1=new QueryWrapper<>(); QueryWrapper<ProjectEnterprise> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.lambda().eq(ProjectEnterprise::getEnterpriseId, tempEnterpriseInfo.getId()) queryWrapper1.lambda().eq(ProjectEnterprise::getEnterpriseId, tempEnterpriseInfo.getId())
.eq(ProjectEnterprise::getProjectSn,enterpriseInfo.getProjectSn()); .eq(ProjectEnterprise::getProjectSn, enterpriseInfo.getProjectSn());
int count=projectEnterpriseMapper.selectCount(queryWrapper1); int count = projectEnterpriseMapper.selectCount(queryWrapper1);
if(count>0){ if (count > 0) {
throw new OpenAlertException(MessageUtil.get("existsEnterpriseErr")); throw new OpenAlertException(MessageUtil.get("existsEnterpriseErr"));
} }
enterpriseInfo.setId(tempEnterpriseInfo.getId()); enterpriseInfo.setId(tempEnterpriseInfo.getId());
enterpriseInfoMapper.updateById(enterpriseInfo); enterpriseInfoMapper.updateById(enterpriseInfo);
}else { } else {
String uuid = UUID.randomUUID().toString().replace("-", "").toUpperCase(); String uuid = UUID.randomUUID().toString().replace("-", "").toUpperCase();
enterpriseInfo.setEnterpriseSn(uuid); enterpriseInfo.setEnterpriseSn(uuid);
enterpriseInfoMapper.insert(enterpriseInfo); enterpriseInfoMapper.insert(enterpriseInfo);
@ -97,18 +105,18 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper,
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void removeEnterpriseInfo(Map<String, Object> map) { public void removeEnterpriseInfo(Map<String, Object> map) {
QueryWrapper<TeamInfo> wrapper=new QueryWrapper<>(); QueryWrapper<TeamInfo> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(TeamInfo::getEnterpriseId,MapUtils.getString(map,"enterpriseId")) wrapper.lambda().eq(TeamInfo::getEnterpriseId, MapUtils.getString(map, "enterpriseId"))
.eq(TeamInfo::getProjectSn,MapUtils.getString(map,"projectSn")); .eq(TeamInfo::getProjectSn, MapUtils.getString(map, "projectSn"));
int count=teamInfoMapper.selectCount(wrapper); int count = teamInfoMapper.selectCount(wrapper);
if(count>0){ if (count > 0) {
throw new OpenAlertException(MessageUtil.get("notDeleteEnterpriseErr")); throw new OpenAlertException(MessageUtil.get("notDeleteEnterpriseErr"));
} }
QueryWrapper<ProjectEnterprise> queryWrapper=new QueryWrapper<>(); QueryWrapper<ProjectEnterprise> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProjectEnterprise::getEnterpriseId, MapUtils.getString(map,"enterpriseId")) queryWrapper.lambda().eq(ProjectEnterprise::getEnterpriseId, MapUtils.getString(map, "enterpriseId"))
.eq(ProjectEnterprise::getProjectSn,MapUtils.getString(map,"projectSn")); .eq(ProjectEnterprise::getProjectSn, MapUtils.getString(map, "projectSn"));
ProjectEnterprise projectEnterprise=projectEnterpriseMapper.selectOne(queryWrapper); ProjectEnterprise projectEnterprise = projectEnterpriseMapper.selectOne(queryWrapper);
if(projectEnterprise!=null){ if (projectEnterprise != null) {
//projectEnterpriseMapper.delete(queryWrapper); //projectEnterpriseMapper.delete(queryWrapper);
projectEnterpriseMapper.deleteById(projectEnterprise.getId()); projectEnterpriseMapper.deleteById(projectEnterprise.getId());
asyncWorker.removeEnterpriseInfo(projectEnterprise); asyncWorker.removeEnterpriseInfo(projectEnterprise);
@ -124,33 +132,33 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper,
@Override @Override
public EnterpriseInfo updateEnterpriseInfo(EnterpriseInfo enterpriseInfo) { public EnterpriseInfo updateEnterpriseInfo(EnterpriseInfo enterpriseInfo) {
QueryWrapper<EnterpriseInfo> queryWrapper=new QueryWrapper<>(); QueryWrapper<EnterpriseInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EnterpriseInfo::getSocialCode,enterpriseInfo.getSocialCode()) queryWrapper.lambda().eq(EnterpriseInfo::getSocialCode, enterpriseInfo.getSocialCode())
.ne(EnterpriseInfo::getId,enterpriseInfo.getId()); .ne(EnterpriseInfo::getId, enterpriseInfo.getId());
int count=enterpriseInfoMapper.selectCount(queryWrapper); int count = enterpriseInfoMapper.selectCount(queryWrapper);
if(count>0){ if (count > 0) {
throw new OpenAlertException(MessageUtil.get("existsEnterpriseSocialCodeErr")); throw new OpenAlertException(MessageUtil.get("existsEnterpriseSocialCodeErr"));
} }
//企业如果选择有父级时候需要排除企业和父级企业存在相互绑定的情况 //企业如果选择有父级时候需要排除企业和父级企业存在相互绑定的情况
if(enterpriseInfo.getParentEnterpriseId()!=null){ if (enterpriseInfo.getParentEnterpriseId() != null) {
QueryWrapper<ProjectEnterprise> qu=new QueryWrapper<>(); QueryWrapper<ProjectEnterprise> qu = new QueryWrapper<>();
qu.lambda().eq(ProjectEnterprise::getEnterpriseId, enterpriseInfo.getParentEnterpriseId()) qu.lambda().eq(ProjectEnterprise::getEnterpriseId, enterpriseInfo.getParentEnterpriseId())
.eq(ProjectEnterprise::getParentEnterpriseId, enterpriseInfo.getId()) .eq(ProjectEnterprise::getParentEnterpriseId, enterpriseInfo.getId())
.eq(ProjectEnterprise::getProjectSn,enterpriseInfo.getProjectSn()); .eq(ProjectEnterprise::getProjectSn, enterpriseInfo.getProjectSn());
int count1=projectEnterpriseMapper.selectCount(qu); int count1 = projectEnterpriseMapper.selectCount(qu);
if(count1>0){ if (count1 > 0) {
throw new OpenAlertException(MessageUtil.get("enterpriseBoundErr")); throw new OpenAlertException(MessageUtil.get("enterpriseBoundErr"));
} }
} }
if(enterpriseInfo.getParentEnterpriseId()==null){ if (enterpriseInfo.getParentEnterpriseId() == null) {
enterpriseInfo.setParentEnterpriseId(0L); enterpriseInfo.setParentEnterpriseId(0L);
} }
enterpriseInfoMapper.updateById(enterpriseInfo); enterpriseInfoMapper.updateById(enterpriseInfo);
//保存企业和项目关联记录 //保存企业和项目关联记录
QueryWrapper<ProjectEnterprise> queryWrapper1=new QueryWrapper<>(); QueryWrapper<ProjectEnterprise> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.lambda().eq(ProjectEnterprise::getEnterpriseId, enterpriseInfo.getId()) queryWrapper1.lambda().eq(ProjectEnterprise::getEnterpriseId, enterpriseInfo.getId())
.eq(ProjectEnterprise::getProjectSn,enterpriseInfo.getProjectSn()); .eq(ProjectEnterprise::getProjectSn, enterpriseInfo.getProjectSn());
ProjectEnterprise projectEnterpris=projectEnterpriseMapper.selectOne(queryWrapper1); ProjectEnterprise projectEnterpris = projectEnterpriseMapper.selectOne(queryWrapper1);
projectEnterpris.setEnterpriseTypeId(enterpriseInfo.getEnterpriseTypeId()); projectEnterpris.setEnterpriseTypeId(enterpriseInfo.getEnterpriseTypeId());
projectEnterpris.setParentEnterpriseId(enterpriseInfo.getParentEnterpriseId()); projectEnterpris.setParentEnterpriseId(enterpriseInfo.getParentEnterpriseId());
projectEnterpris.setProjectDirectorName(enterpriseInfo.getProjectDirectorName()); projectEnterpris.setProjectDirectorName(enterpriseInfo.getProjectDirectorName());
@ -171,15 +179,15 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper,
@Override @Override
public JSONArray selectHierarchyEnterpriseList(Map<String, Object> map) { public JSONArray selectHierarchyEnterpriseList(Map<String, Object> map) {
List<EntityMap> list=enterpriseInfoMapper.getEnterpriseInfoList(map); List<EntityMap> list = enterpriseInfoMapper.getEnterpriseInfoList(map);
JSONArray result = ListUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(list)),"id","parentEnterpriseId","children"); JSONArray result = ListUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(list)), "id", "parentEnterpriseId", "children");
return result; return result;
} }
@Override @Override
public Map<String, Object> modCompany(CompanyVo companyVo) { public Map<String, Object> modCompany(CompanyVo companyVo) {
Map<String, Object> resultMap=new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
EnterpriseInfo enterpriseInfo=new EnterpriseInfo(); EnterpriseInfo enterpriseInfo = new EnterpriseInfo();
enterpriseInfo.setSocialCode(companyVo.getSocialCode()); enterpriseInfo.setSocialCode(companyVo.getSocialCode());
enterpriseInfo.setEnterpriseName(companyVo.getCompanyName()); enterpriseInfo.setEnterpriseName(companyVo.getCompanyName());
enterpriseInfo.setEnterpriseLegalPerson(companyVo.getCompanyLegalPerson()); enterpriseInfo.setEnterpriseLegalPerson(companyVo.getCompanyLegalPerson());
@ -192,20 +200,100 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper,
enterpriseInfo.setQualificationNumber(companyVo.getQualificationNumber()); enterpriseInfo.setQualificationNumber(companyVo.getQualificationNumber());
enterpriseInfo.setEnterpriseQualificationUrl(companyVo.getCompanyQualificationUrl()); enterpriseInfo.setEnterpriseQualificationUrl(companyVo.getCompanyQualificationUrl());
enterpriseInfo.setBusinessLicenseEndDate(companyVo.getBusinessLicenseEndDate()); enterpriseInfo.setBusinessLicenseEndDate(companyVo.getBusinessLicenseEndDate());
QueryWrapper<EnterpriseInfo> queryWrapper=new QueryWrapper<>(); QueryWrapper<EnterpriseInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EnterpriseInfo::getSocialCode,enterpriseInfo.getSocialCode()); queryWrapper.lambda().eq(EnterpriseInfo::getSocialCode, enterpriseInfo.getSocialCode());
EnterpriseInfo tempEnterpriseInfo=enterpriseInfoMapper.selectOne(queryWrapper); EnterpriseInfo tempEnterpriseInfo = enterpriseInfoMapper.selectOne(queryWrapper);
if(tempEnterpriseInfo!=null){ if (tempEnterpriseInfo != null) {
enterpriseInfo.setId(tempEnterpriseInfo.getId()); enterpriseInfo.setId(tempEnterpriseInfo.getId());
enterpriseInfoMapper.updateById(enterpriseInfo); enterpriseInfoMapper.updateById(enterpriseInfo);
}else { } else {
enterpriseInfo.setParentEnterpriseId(0L); enterpriseInfo.setParentEnterpriseId(0L);
String uuid = UUID.randomUUID().toString().replace("-", "").toUpperCase(); String uuid = UUID.randomUUID().toString().replace("-", "").toUpperCase();
enterpriseInfo.setEnterpriseSn(uuid); enterpriseInfo.setEnterpriseSn(uuid);
enterpriseInfoMapper.insert(enterpriseInfo); enterpriseInfoMapper.insert(enterpriseInfo);
} }
resultMap.put("msg","操作成功"); resultMap.put("msg", "操作成功");
resultMap.put("status","1"); resultMap.put("status", "1");
return resultMap; return resultMap;
} }
@Override
public Result addSj(SjEnterpriseInfo e) {
EnterpriseInfo ei = getEnterpriseInfo(e);
saveEnterpriseInfo(ei);
return Result.ok();
}
@Override
public Result editSj(SjEnterpriseInfo e) {
EnterpriseInfo ei = getEnterpriseInfo(e);
updateEnterpriseInfo(ei);
return Result.ok();
}
@Override
public Result deleteSj(SjEnterpriseInfo enterpriseInfo) {
if (StringUtils.isBlank(enterpriseInfo.getProjectNumber()) || enterpriseInfo.getId() == null) {
return Result.error("项目编号projectNumber和企业id都不能为空");
}
String projectSn = getProjectSn(enterpriseInfo.getProjectNumber());
List<ProjectEnterprise> projectEnterprises = projectEnterpriseMapper.selectList(new LambdaQueryWrapper<ProjectEnterprise>()
.eq(ProjectEnterprise::getEnterpriseId, enterpriseInfo.getId())
.eq(ProjectEnterprise::getProjectSn, projectSn));
if (CollectionUtils.isNotEmpty(projectEnterprises)) {
for (ProjectEnterprise projectEnterprise : projectEnterprises) {
if (projectEnterprise != null) {
projectEnterpriseMapper.deleteById(projectEnterprise.getId());
asyncWorker.removeEnterpriseInfo(projectEnterprise);
}
}
}
return Result.ok();
}
private EnterpriseInfo getEnterpriseInfo(SjEnterpriseInfo e) {
EnterpriseInfo enterpriseInfo = new EnterpriseInfo();
enterpriseInfo.setId(e.getId());
enterpriseInfo.setEnterpriseName(e.getEnterpriseName());
enterpriseInfo.setDescription(e.getDescription());
enterpriseInfo.setEnterpriseAddress(e.getEnterpriseAddress());
enterpriseInfo.setEnterpriseLegalPerson(e.getEnterpriseLegalPerson());
enterpriseInfo.setLegalPersonIdCard(e.getLegalPersonIdCard());
enterpriseInfo.setEnterpriseSafeAllow(e.getEnterpriseSafeAllow());
enterpriseInfo.setEnterpriseProperty(e.getEnterpriseProperty());
enterpriseInfo.setLegalPersonTel(e.getLegalPersonTel());
enterpriseInfo.setSocialCode(e.getSocialCode());
enterpriseInfo.setBusinessNumber(e.getBusinessNumber());
enterpriseInfo.setQualificationNumber(e.getQualificationNumber());
enterpriseInfo.setEnterpriseEmail(e.getEnterpriseEmail());
enterpriseInfo.setRegisteredCapital(e.getRegisteredCapital());
enterpriseInfo.setBankname(e.getBankname());
enterpriseInfo.setBankcardnumber(e.getBankcardnumber());
enterpriseInfo.setBankcode(e.getBankcode());
enterpriseInfo.setEnterpriseQualificationUrl(e.getEnterpriseQualificationUrl());
enterpriseInfo.setBusinessLicenseEndDate(e.getBusinessLicenseEndDate());
enterpriseInfo.setRegisterPersonName(e.getRegisterPersonName());
enterpriseInfo.setRegisterPersonPhoneTel(e.getRegisterPersonPhoneTel());
enterpriseInfo.setEnterpriseSn(e.getEnterpriseSn());
enterpriseInfo.setLogo(e.getLogo());
enterpriseInfo.setRegistDate(e.getRegistDate());
enterpriseInfo.setBusinessLicenseUrl(e.getBusinessLicenseUrl());
enterpriseInfo.setEnterpriseTypeId(e.getEnterpriseTypeId());
enterpriseInfo.setParentEnterpriseId(e.getParentEnterpriseId());
enterpriseInfo.setEnterpriseTypeName(e.getEnterpriseTypeName());
enterpriseInfo.setProjectSn(getProjectSn(e.getProjectNumber()));
enterpriseInfo.setType(1);
enterpriseInfo.setProjectDirectorName(e.getProjectDirectorName());
enterpriseInfo.setProjectDirectorPhone(e.getProjectDirectorPhone());
enterpriseInfo.setDepartmentType(1);
return enterpriseInfo;
}
private String getProjectSn(String projectNumber) {
if (StringUtils.isBlank(projectNumber)) {
return null;
}
Project project = projectMapper.selectOne(new LambdaQueryWrapper<Project>().eq(Project::getProjectNumber, projectNumber));
return project == null ? null : project.getProjectSn();
}
} }