This commit is contained in:
pengjie 2023-08-17 15:02:56 +08:00
parent 9f5e5ad13d
commit 995d27fd61
7 changed files with 64 additions and 22 deletions

View File

@ -92,32 +92,40 @@ public class GovEnterpriseScoreController {
@ApiOperation(value = " 排行榜列表查询企业对应工程得分信息", notes = "排行榜列表查询企业对应工程得分信息", httpMethod = "POST") @ApiOperation(value = " 排行榜列表查询企业对应工程得分信息", notes = "排行榜列表查询企业对应工程得分信息", httpMethod = "POST")
@PostMapping(value = "/rankList") @PostMapping(value = "/rankList")
public Result<List<EnterpriseScoreDto>> rankList(@RequestBody EnterpriseScoreVo enterpriseScoreVo) { public Result<List<EnterpriseScoreDto>> rankList(@RequestBody EnterpriseScoreVo enterpriseScoreVo) {
LambdaQueryWrapper<EnterpriseScore> queryWrapper = Wrappers.<EnterpriseScore>lambdaQuery(); QueryWrapper<EnterpriseScore> wrapper = Wrappers.<EnterpriseScore>query();
if (null != enterpriseScoreVo.getEnterpriseType()) { if (null != enterpriseScoreVo.getEnterpriseType()) {
queryWrapper.eq(EnterpriseScore::getEnterpriseType, enterpriseScoreVo.getEnterpriseType()); wrapper.lambda().eq(EnterpriseScore::getEnterpriseType, enterpriseScoreVo.getEnterpriseType());
} }
if (null != enterpriseScoreVo.getListType()) { if (null != enterpriseScoreVo.getListType()) {
if (enterpriseScoreVo.getListType() == 1) { if (enterpriseScoreVo.getListType() == 1) {
queryWrapper.between(EnterpriseScore::getScore, 60, 100); wrapper.lambda().between(EnterpriseScore::getScore, 60, 100);
} else { } else {
queryWrapper.between(EnterpriseScore::getScore, 0, 60); wrapper.lambda().between(EnterpriseScore::getScore, 0, 60);
} }
} }
if (null != enterpriseScoreVo.getEngineeringState()) { if (null != enterpriseScoreVo.getEngineeringState()) {
queryWrapper.eq(EnterpriseScore::getEngineeringState, enterpriseScoreVo.getEngineeringState()); wrapper.lambda().eq(EnterpriseScore::getEngineeringState, enterpriseScoreVo.getEngineeringState());
} }
if (null != enterpriseScoreVo.getScoreSort()) { if (null != enterpriseScoreVo.getScoreSort()) {
if (enterpriseScoreVo.getScoreSort() == 1) { if (enterpriseScoreVo.getScoreSort() == 1) {
queryWrapper.orderByDesc(EnterpriseScore::getScore); if (enterpriseScoreVo.getScoreType() == 0) {
wrapper.lambda().orderByDesc(EnterpriseScore::getScore);
} else {
wrapper.orderByDesc("engineering_name");
}
} else { } else {
queryWrapper.orderByAsc(EnterpriseScore::getScore); if (enterpriseScoreVo.getScoreType() == 0) {
wrapper.lambda().orderByAsc(EnterpriseScore::getScore);
} else {
wrapper.orderByAsc("engineering_name");
}
} }
} }
if (StringUtils.isNotBlank(enterpriseScoreVo.getEngineeringName())) { if (StringUtils.isNotBlank(enterpriseScoreVo.getEngineeringName())) {
queryWrapper.like(EnterpriseScore::getEngineeringName, enterpriseScoreVo.getEngineeringName()); wrapper.like("engineering_name", enterpriseScoreVo.getEngineeringName());
} }
queryWrapper.isNotNull(EnterpriseScore::getScore); wrapper.lambda().isNotNull(EnterpriseScore::getScore);
List<EnterpriseScoreDto> list = enterpriseScoreService.pageList(queryWrapper); List<EnterpriseScoreDto> list = enterpriseScoreService.pageList(wrapper);
return Result.success(list); return Result.success(list);
} }
@ -129,23 +137,13 @@ public class GovEnterpriseScoreController {
*/ */
@OperLog(operModul = "企业对应工程得分管理", operType = "查询", operDesc = "排行榜企业数量查询") @OperLog(operModul = "企业对应工程得分管理", operType = "查询", operDesc = "排行榜企业数量查询")
@ApiOperation(value = " 排行榜企业数量查询", notes = "排行榜企业数量查询", httpMethod = "POST") @ApiOperation(value = " 排行榜企业数量查询", notes = "排行榜企业数量查询", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParam(name = "enterpriseType", value = "企业类型", paramType = "body", dataType = "Integer")
@ApiImplicitParam(name = "enterpriseType", value = "企业类型", paramType = "body", dataType = "Integer"),
@ApiImplicitParam(name = "listType", value = "榜单类型(1:红榜;2:黑榜;)", paramType = "body", dataType = "Integer")
})
@PostMapping(value = "/rankEnterpriseStat") @PostMapping(value = "/rankEnterpriseStat")
public Result<Object> rankEnterpriseStat(@ApiIgnore @RequestBody EnterpriseScoreVo enterpriseScoreVo) { public Result<Object> rankEnterpriseStat(@ApiIgnore @RequestBody EnterpriseScoreVo enterpriseScoreVo) {
LambdaQueryWrapper<EnterpriseScore> queryWrapper = Wrappers.<EnterpriseScore>lambdaQuery(); LambdaQueryWrapper<EnterpriseScore> queryWrapper = Wrappers.<EnterpriseScore>lambdaQuery();
if (null != enterpriseScoreVo.getEnterpriseType()) { if (null != enterpriseScoreVo.getEnterpriseType()) {
queryWrapper.eq(EnterpriseScore::getEnterpriseType, enterpriseScoreVo.getEnterpriseType()); queryWrapper.eq(EnterpriseScore::getEnterpriseType, enterpriseScoreVo.getEnterpriseType());
} }
if (null != enterpriseScoreVo.getListType()) {
if (enterpriseScoreVo.getListType() == 1) {
queryWrapper.between(EnterpriseScore::getScore, 60, 100);
} else {
queryWrapper.between(EnterpriseScore::getScore, 0, 60);
}
}
queryWrapper.isNotNull(EnterpriseScore::getScore); queryWrapper.isNotNull(EnterpriseScore::getScore);
return Result.success(enterpriseScoreService.enterpriseNum(queryWrapper)); return Result.success(enterpriseScoreService.enterpriseNum(queryWrapper));
} }

View File

@ -6,6 +6,9 @@ import com.zhgd.xmgl.modules.basicdata.constant.CacheConstants;
import com.zhgd.xmgl.modules.basicdata.entity.SystemDictData; import com.zhgd.xmgl.modules.basicdata.entity.SystemDictData;
import com.zhgd.xmgl.modules.basicdata.mapper.SystemDictDataMapper; import com.zhgd.xmgl.modules.basicdata.mapper.SystemDictDataMapper;
import com.zhgd.xmgl.modules.basicdata.service.ISystemDictDataService; import com.zhgd.xmgl.modules.basicdata.service.ISystemDictDataService;
import com.zhgd.xmgl.modules.safety.service.IEnterpriseScoreService;
import com.zhgd.xmgl.util.ParamEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -21,6 +24,8 @@ import java.util.List;
@Service @Service
public class SystemDictDataServiceImpl extends ServiceImpl<SystemDictDataMapper, SystemDictData> implements ISystemDictDataService { public class SystemDictDataServiceImpl extends ServiceImpl<SystemDictDataMapper, SystemDictData> implements ISystemDictDataService {
@Autowired
private IEnterpriseScoreService enterpriseScoreService;
@Override @Override
@Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type", unless = "#result.isEmpty()") @Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type", unless = "#result.isEmpty()")
@ -32,6 +37,10 @@ public class SystemDictDataServiceImpl extends ServiceImpl<SystemDictDataMapper,
@Override @Override
@CacheEvict(value = CacheConstants.DICT_DETAILS, key = "#systemDictData.dictType") @CacheEvict(value = CacheConstants.DICT_DETAILS, key = "#systemDictData.dictType")
public boolean delInfo(SystemDictData systemDictData) { public boolean delInfo(SystemDictData systemDictData) {
// 判断企业类型需保证其下面无企业工程绑定信息需要全部删除
if (systemDictData.getDictType().equals(ParamEnum.SysDictType.ENTERPRISE_MAIN.getValue())) {
enterpriseScoreService.delInfo(systemDictData.getDictLabel());
}
return baseMapper.deleteById(systemDictData.getDictCode()) == 1 ? true : false; return baseMapper.deleteById(systemDictData.getDictCode()) == 1 ? true : false;
} }
} }

View File

@ -1,9 +1,13 @@
package com.zhgd.xmgl.modules.safety.dto; package com.zhgd.xmgl.modules.safety.dto;
import com.zhgd.xmgl.modules.safety.entity.EnterpriseScore; import com.zhgd.xmgl.modules.safety.entity.EnterpriseScore;
import com.zhgd.xmgl.valid.AddGroup;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import javax.validation.constraints.NotBlank;
@Data @Data
@ApiModel(value = "企业对应工程得分分数(DTO)", description = "EnterpriseScoreDto") @ApiModel(value = "企业对应工程得分分数(DTO)", description = "EnterpriseScoreDto")
@ -17,4 +21,10 @@ public class EnterpriseScoreDto extends EnterpriseScore {
@ApiModelProperty(value = "企业地址") @ApiModelProperty(value = "企业地址")
private String businessAddress; private String businessAddress;
@ApiModelProperty(value = "企业主体负责人")
private String leadName;
@ApiModelProperty(value = "企业主体负责人电话")
private String leadTel;
} }

View File

@ -10,6 +10,8 @@
p.enterprise_name, p.enterprise_name,
p.credit_code, p.credit_code,
p.business_address, p.business_address,
m.lead_name,
m.lead_tel,
s.engineering_sn, s.engineering_sn,
s.score, s.score,
s.engineering_state, s.engineering_state,
@ -20,6 +22,7 @@
FROM FROM
enterprise_score s enterprise_score s
LEFT JOIN enterprise p ON s.enterprise_sn = p.enterprise_sn LEFT JOIN enterprise p ON s.enterprise_sn = p.enterprise_sn
LEFT JOIN enterprise_main m ON p.enterprise_sn = m.enterprise_sn AND m.main_type = s.enterprise_type
LEFT JOIN engineering e ON s.engineering_sn = e.engineering_sn) a LEFT JOIN engineering e ON s.engineering_sn = e.engineering_sn) a
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>

View File

@ -24,4 +24,6 @@ public interface IEnterpriseScoreService extends IService<EnterpriseScore> {
boolean saveInfo(EnterpriseScore enterpriseScore); boolean saveInfo(EnterpriseScore enterpriseScore);
Integer enterpriseNum(Wrapper<EnterpriseScore> queryWrapper); Integer enterpriseNum(Wrapper<EnterpriseScore> queryWrapper);
boolean delInfo(Integer enterpriseType);
} }

View File

@ -13,7 +13,9 @@ import com.zhgd.xmgl.modules.basicdata.service.IEngineeringMainService;
import com.zhgd.xmgl.modules.basicdata.service.ISystemDictDataService; import com.zhgd.xmgl.modules.basicdata.service.ISystemDictDataService;
import com.zhgd.xmgl.modules.safety.dto.EnterpriseScoreDto; import com.zhgd.xmgl.modules.safety.dto.EnterpriseScoreDto;
import com.zhgd.xmgl.modules.safety.entity.EnterpriseScore; import com.zhgd.xmgl.modules.safety.entity.EnterpriseScore;
import com.zhgd.xmgl.modules.safety.entity.EnterpriseScoreDetail;
import com.zhgd.xmgl.modules.safety.mapper.EnterpriseScoreMapper; import com.zhgd.xmgl.modules.safety.mapper.EnterpriseScoreMapper;
import com.zhgd.xmgl.modules.safety.service.IEnterpriseScoreDetailService;
import com.zhgd.xmgl.modules.safety.service.IEnterpriseScoreService; import com.zhgd.xmgl.modules.safety.service.IEnterpriseScoreService;
import com.zhgd.xmgl.util.CommonUtil; import com.zhgd.xmgl.util.CommonUtil;
import com.zhgd.xmgl.util.ParamEnum; import com.zhgd.xmgl.util.ParamEnum;
@ -25,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @Description: 企业对应工程得分 * @Description: 企业对应工程得分
@ -42,6 +45,9 @@ public class EnterpriseScoreServiceImpl extends ServiceImpl<EnterpriseScoreMappe
@Autowired @Autowired
private ISystemDictDataService systemDictDataService; private ISystemDictDataService systemDictDataService;
@Autowired
private IEnterpriseScoreDetailService enterpriseScoreDetailService;
@Override @Override
public Page<EnterpriseScoreDto> pageList(Map<String, Object> map) { public Page<EnterpriseScoreDto> pageList(Map<String, Object> map) {
Integer enterpriseType = MapUtils.getInteger(map, "enterpriseType"); Integer enterpriseType = MapUtils.getInteger(map, "enterpriseType");
@ -88,4 +94,15 @@ public class EnterpriseScoreServiceImpl extends ServiceImpl<EnterpriseScoreMappe
public Integer enterpriseNum(Wrapper<EnterpriseScore> queryWrapper) { public Integer enterpriseNum(Wrapper<EnterpriseScore> queryWrapper) {
return baseMapper.enterpriseNum(queryWrapper); return baseMapper.enterpriseNum(queryWrapper);
} }
@Override
public boolean delInfo(Integer enterpriseType) {
List<EnterpriseScore> enterpriseScores = baseMapper.selectList(Wrappers.<EnterpriseScore>lambdaQuery().eq(EnterpriseScore::getEnterpriseType, enterpriseType));
if (enterpriseScores.size() > 0) {
List<EnterpriseScoreDetail> enterpriseScoreDetails = enterpriseScoreDetailService.list(Wrappers.<EnterpriseScoreDetail>lambdaQuery()
.in(EnterpriseScoreDetail::getScoreId, enterpriseScores.stream().map(e -> e.getId()).collect(Collectors.toList())));
enterpriseScoreDetailService.removeByIds(enterpriseScoreDetails);
}
return this.removeByIds(enterpriseScores);
}
} }

View File

@ -17,9 +17,12 @@ public class EnterpriseScoreVo {
@ApiModelProperty(value="工程状态(0:未验收;1:已验收)") @ApiModelProperty(value="工程状态(0:未验收;1:已验收)")
private Integer engineeringState; private Integer engineeringState;
@ApiModelProperty(value="得分排序(0:倒叙;1:正序)") @ApiModelProperty(value="排序(0:倒叙;1:正序)")
private Integer scoreSort; private Integer scoreSort;
@ApiModelProperty(value="排序方式(0:得分排序;1:项目排序)")
private Integer scoreType;
@ApiModelProperty(value="工程名称") @ApiModelProperty(value="工程名称")
private String engineeringName; private String engineeringName;
} }