增加删除劳务公司、删除班组的接口
This commit is contained in:
parent
caf24dc623
commit
4f1eed5204
@ -511,14 +511,14 @@ public class ProjectWorkerApiController {
|
||||
@PostMapping(value = "/delGroup")
|
||||
public Map<String, Object> delGroup(@RequestBody Map<String, Object> map) {
|
||||
log.info("delGroup:{}",JSON.toJSONString(map));
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
try {
|
||||
teamInfoService.delGroup(map);
|
||||
resultMap.put("msg", "操作成功");
|
||||
resultMap.put("status", "1");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
resultMap.put("msg", "操作失败");
|
||||
log.info("err:", e);
|
||||
resultMap.put("msg", e.getMessage());
|
||||
resultMap.put("status", "0");
|
||||
}
|
||||
return resultMap;
|
||||
@ -574,14 +574,14 @@ public class ProjectWorkerApiController {
|
||||
@PostMapping(value = "/delCompany")
|
||||
public Map<String, Object> delCompany(@RequestBody Map<String, Object> map) {
|
||||
log.info("delCompany:{}",JSON.toJSONString(map));
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
try {
|
||||
enterpriseInfoService.delCompany(map);
|
||||
resultMap.put("msg", "操作成功");
|
||||
resultMap.put("status", "1");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
resultMap.put("msg", "操作失败");
|
||||
log.info("err:", e);
|
||||
resultMap.put("msg", e.getMessage());
|
||||
resultMap.put("status", "0");
|
||||
}
|
||||
return resultMap;
|
||||
|
||||
@ -46,4 +46,6 @@ public interface IEnterpriseInfoService extends IService<EnterpriseInfo> {
|
||||
Result deleteSj(SjEnterpriseInfo enterpriseInfo);
|
||||
|
||||
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> modGroup(ModGroupDto dto);
|
||||
|
||||
void delGroup(Map<String, Object> map);
|
||||
}
|
||||
|
||||
@ -277,6 +277,31 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper,
|
||||
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) {
|
||||
EnterpriseInfo enterpriseInfo = new EnterpriseInfo();
|
||||
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.service.ITeamInfoService;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -214,4 +215,24 @@ socialCode 班组所属的劳务公司统一社会信用代码 string 是
|
||||
}
|
||||
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