增加删除劳务公司、删除班组的接口
This commit is contained in:
parent
caf24dc623
commit
4f1eed5204
@ -511,14 +511,14 @@ public class ProjectWorkerApiController {
|
|||||||
@PostMapping(value = "/delGroup")
|
@PostMapping(value = "/delGroup")
|
||||||
public Map<String, Object> delGroup(@RequestBody Map<String, Object> map) {
|
public Map<String, Object> delGroup(@RequestBody Map<String, Object> map) {
|
||||||
log.info("delGroup:{}",JSON.toJSONString(map));
|
log.info("delGroup:{}",JSON.toJSONString(map));
|
||||||
|
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
|
teamInfoService.delGroup(map);
|
||||||
resultMap.put("msg", "操作成功");
|
resultMap.put("msg", "操作成功");
|
||||||
resultMap.put("status", "1");
|
resultMap.put("status", "1");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.info("err:", e);
|
||||||
resultMap.put("msg", "操作失败");
|
resultMap.put("msg", e.getMessage());
|
||||||
resultMap.put("status", "0");
|
resultMap.put("status", "0");
|
||||||
}
|
}
|
||||||
return resultMap;
|
return resultMap;
|
||||||
@ -574,14 +574,14 @@ public class ProjectWorkerApiController {
|
|||||||
@PostMapping(value = "/delCompany")
|
@PostMapping(value = "/delCompany")
|
||||||
public Map<String, Object> delCompany(@RequestBody Map<String, Object> map) {
|
public Map<String, Object> delCompany(@RequestBody Map<String, Object> map) {
|
||||||
log.info("delCompany:{}",JSON.toJSONString(map));
|
log.info("delCompany:{}",JSON.toJSONString(map));
|
||||||
|
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
|
enterpriseInfoService.delCompany(map);
|
||||||
resultMap.put("msg", "操作成功");
|
resultMap.put("msg", "操作成功");
|
||||||
resultMap.put("status", "1");
|
resultMap.put("status", "1");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.info("err:", e);
|
||||||
resultMap.put("msg", "操作失败");
|
resultMap.put("msg", e.getMessage());
|
||||||
resultMap.put("status", "0");
|
resultMap.put("status", "0");
|
||||||
}
|
}
|
||||||
return resultMap;
|
return resultMap;
|
||||||
|
|||||||
@ -46,4 +46,6 @@ public interface IEnterpriseInfoService extends IService<EnterpriseInfo> {
|
|||||||
Result deleteSj(SjEnterpriseInfo enterpriseInfo);
|
Result deleteSj(SjEnterpriseInfo enterpriseInfo);
|
||||||
|
|
||||||
IPage<EntityMap> getEnterpriseInfoPage(Map<String, Object> map);
|
IPage<EntityMap> getEnterpriseInfoPage(Map<String, Object> map);
|
||||||
|
|
||||||
|
void delCompany(Map<String, Object> map);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,4 +35,6 @@ public interface ITeamInfoService extends IService<TeamInfo> {
|
|||||||
Map<String, Object> getGroup(Map<String, Object> map);
|
Map<String, Object> getGroup(Map<String, Object> map);
|
||||||
|
|
||||||
Map<String, Object> modGroup(ModGroupDto dto);
|
Map<String, Object> modGroup(ModGroupDto dto);
|
||||||
|
|
||||||
|
void delGroup(Map<String, Object> map);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -277,6 +277,31 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper,
|
|||||||
return enterpriseInfoMapper.getEnterpriseInfoPage(map, qp);
|
return enterpriseInfoMapper.getEnterpriseInfoPage(map, qp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delCompany(Map<String, Object> map) {
|
||||||
|
EnterpriseInfo enterpriseInfo = enterpriseInfoMapper.selectOne(new LambdaQueryWrapper<EnterpriseInfo>()
|
||||||
|
.eq(EnterpriseInfo::getSocialCode, MapUtils.getString(map, "socialCode")));
|
||||||
|
if (enterpriseInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QueryWrapper<TeamInfo> wrapper = new QueryWrapper<>();
|
||||||
|
Long enterpriseId = enterpriseInfo.getId();
|
||||||
|
wrapper.lambda().eq(TeamInfo::getEnterpriseId, enterpriseId);
|
||||||
|
int count = teamInfoMapper.selectCount(wrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new OpenAlertException(MessageUtil.get("notDeleteEnterpriseErr"));
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryWrapper<ProjectEnterprise> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.lambda().eq(ProjectEnterprise::getEnterpriseId, enterpriseId);
|
||||||
|
List<ProjectEnterprise> projectEnterprises = projectEnterpriseMapper.selectList(queryWrapper);
|
||||||
|
for (ProjectEnterprise projectEnterprise : projectEnterprises) {
|
||||||
|
//projectEnterpriseMapper.delete(queryWrapper);
|
||||||
|
projectEnterpriseMapper.deleteById(projectEnterprise.getId());
|
||||||
|
asyncWorker.removeEnterpriseInfo(projectEnterprise);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private EnterpriseInfo getEnterpriseInfo(SjEnterpriseInfo e, String projectSn) {
|
private EnterpriseInfo getEnterpriseInfo(SjEnterpriseInfo e, String projectSn) {
|
||||||
EnterpriseInfo enterpriseInfo = new EnterpriseInfo();
|
EnterpriseInfo enterpriseInfo = new EnterpriseInfo();
|
||||||
enterpriseInfo.setId(e.getId());
|
enterpriseInfo.setId(e.getId());
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import com.zhgd.xmgl.modules.worker.mapper.TeamInfoMapper;
|
|||||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
||||||
import com.zhgd.xmgl.modules.worker.service.ITeamInfoService;
|
import com.zhgd.xmgl.modules.worker.service.ITeamInfoService;
|
||||||
import com.zhgd.xmgl.util.MessageUtil;
|
import com.zhgd.xmgl.util.MessageUtil;
|
||||||
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
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;
|
||||||
@ -214,4 +215,24 @@ socialCode 班组所属的劳务公司统一社会信用代码 string 是
|
|||||||
}
|
}
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delGroup(Map<String, Object> map) {
|
||||||
|
String projectCode = MapUtils.getString(map, "projectCode");
|
||||||
|
String groupName = MapUtils.getString(map, "groupName");
|
||||||
|
TeamInfo teamInfo = teamInfoMapper.selectOne(new LambdaQueryWrapper<TeamInfo>()
|
||||||
|
.eq(TeamInfo::getProjectSn, projectCode)
|
||||||
|
.eq(TeamInfo::getTeamName, groupName));
|
||||||
|
if (teamInfo == null) {
|
||||||
|
throw new OpenAlertException(MessageUtil.get("notFindErr"));
|
||||||
|
}
|
||||||
|
QueryWrapper<WorkerInfo> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.lambda().eq(WorkerInfo::getProjectSn, teamInfo.getProjectSn())
|
||||||
|
.eq(WorkerInfo::getTeamId, teamInfo.getId());
|
||||||
|
int count = workerInfoMapper.selectCount(queryWrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new OpenAlertException(MessageUtil.get("notDeleteTeamErr"));
|
||||||
|
}
|
||||||
|
teamInfoMapper.deleteById(teamInfo.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user