22 changed files with 703 additions and 14 deletions
@ -0,0 +1,17 @@
|
||||
package com.logpm.supervise.dto; |
||||
|
||||
import com.logpm.supervise.entity.ClassifyEntity; |
||||
import com.logpm.supervise.entity.PointsEntity; |
||||
import lombok.Data; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
@Data |
||||
public class ClassifyDTO extends ClassifyEntity { |
||||
|
||||
private Integer isPid; |
||||
|
||||
private List<PointsEntity> pointsEntities = new ArrayList<>(); |
||||
|
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.logpm.supervise.dto; |
||||
|
||||
import com.logpm.supervise.entity.IndicatorsEntity; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
@Data |
||||
public class IndicatorsDTO extends IndicatorsEntity { |
||||
|
||||
@ApiModelProperty("当前页") |
||||
private Integer current; |
||||
@ApiModelProperty("每页的数量") |
||||
private Integer size; |
||||
private Long parentClassifyId; |
||||
|
||||
private String startDateStr; |
||||
private String endDateStr; |
||||
|
||||
private Date start; |
||||
private Date end; |
||||
|
||||
} |
@ -1,12 +1,24 @@
|
||||
package com.logpm.supervise.vo; |
||||
|
||||
import com.logpm.supervise.entity.IndicatorsAnnexEntity; |
||||
import com.logpm.supervise.entity.IndicatorsEntity; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class IndicatorsVO extends IndicatorsEntity { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
private String classifyName; |
||||
|
||||
private Long parentClassifyId; |
||||
private String parentClassifyName; |
||||
|
||||
private List<IndicatorsAnnexEntity> pictures = new ArrayList<>(); |
||||
private List<IndicatorsAnnexEntity> files = new ArrayList<>(); |
||||
|
||||
} |
||||
|
@ -0,0 +1,95 @@
|
||||
package com.logpm.supervise.controller; |
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.logpm.supervise.dto.IndicatorsDTO; |
||||
import com.logpm.supervise.service.IIndicatorsService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.common.exception.CustomerException; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
@Slf4j |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/classify") |
||||
@Api(value = "分类指标表", tags = "指标接口") |
||||
public class IndicatorsController { |
||||
|
||||
private final IIndicatorsService indicatorsService; |
||||
|
||||
@PostMapping("/findIndicatorsList") |
||||
@ApiOperationSupport(order = 5) |
||||
@ApiOperation(value = "查询指标列表", notes = "传入indicatorsDTO") |
||||
public R findIndicatorsList(@RequestBody IndicatorsDTO indicatorsDTO) { |
||||
String method = "##############findIndicatorsList: "; |
||||
log.info(method+"添加指标 参数={}",indicatorsDTO); |
||||
|
||||
try{ |
||||
return indicatorsService.findIndicatorsList(indicatorsDTO); |
||||
}catch (CustomerException e){ |
||||
log.error(e.message,e); |
||||
return R.fail(e.code,e.message); |
||||
}catch (Exception e){ |
||||
log.error(method+"系统异常",e); |
||||
return R.fail(500,"系统异常"); |
||||
} |
||||
} |
||||
|
||||
@PostMapping("/findIndicatorsDetail") |
||||
@ApiOperationSupport(order = 5) |
||||
@ApiOperation(value = "查询指标详情", notes = "传入indicatorsDTO") |
||||
public R findIndicatorsDetail(@RequestBody IndicatorsDTO indicatorsDTO) { |
||||
String method = "##############findIndicatorsDetail: "; |
||||
log.info(method+"查询指标详情 参数={}",indicatorsDTO); |
||||
|
||||
try{ |
||||
Long id = indicatorsDTO.getId(); |
||||
if(Objects.isNull(id)){ |
||||
log.warn(method+"指标id为空 id={}",id); |
||||
return R.fail(405,"指标id为空"); |
||||
} |
||||
|
||||
return indicatorsService.findIndicatorsDetail(indicatorsDTO); |
||||
}catch (CustomerException e){ |
||||
log.error(e.message,e); |
||||
return R.fail(e.code,e.message); |
||||
}catch (Exception e){ |
||||
log.error(method+"系统异常",e); |
||||
return R.fail(500,"系统异常"); |
||||
} |
||||
} |
||||
|
||||
|
||||
@PostMapping("/updateIndicators") |
||||
@ApiOperationSupport(order = 5) |
||||
@ApiOperation(value = "更新指标", notes = "传入indicatorsDTO") |
||||
public R updateIndicators(@RequestBody IndicatorsDTO indicatorsDTO) { |
||||
String method = "##############updateIndicators: "; |
||||
log.info(method+"更新指标 参数={}",indicatorsDTO); |
||||
|
||||
try{ |
||||
Long id = indicatorsDTO.getId(); |
||||
if(Objects.isNull(id)){ |
||||
log.warn(method+"指标id为空 id={}",id); |
||||
return R.fail(405,"指标id为空"); |
||||
} |
||||
|
||||
return indicatorsService.updateIndicators(indicatorsDTO); |
||||
}catch (CustomerException e){ |
||||
log.error(e.message,e); |
||||
return R.fail(e.code,e.message); |
||||
}catch (Exception e){ |
||||
log.error(method+"系统异常",e); |
||||
return R.fail(500,"系统异常"); |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,10 +1,20 @@
|
||||
package com.logpm.supervise.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.logpm.supervise.dto.ClassifyDTO; |
||||
import com.logpm.supervise.entity.ClassifyEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Mapper |
||||
public interface ClassifyMapper extends BaseMapper<ClassifyEntity> { |
||||
|
||||
IPage<ClassifyEntity> pageList(IPage<Object> page, @Param("param") ClassifyDTO classifyDTO); |
||||
|
||||
List<ClassifyEntity> selectParentCalssifyList(@Param("param") ClassifyDTO classifyDTO); |
||||
|
||||
List<ClassifyEntity> selectChildCalssifyList(@Param("param") ClassifyDTO classifyDTO); |
||||
} |
||||
|
@ -0,0 +1,15 @@
|
||||
package com.logpm.supervise.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.logpm.supervise.entity.IndicatorsAnnexEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Mapper |
||||
public interface IndicatorsAnnexMapper extends BaseMapper<IndicatorsAnnexEntity> { |
||||
|
||||
|
||||
List<IndicatorsAnnexEntity> findListByIndicatorsIdAndType(@Param("id") Long id, @Param("type") int type); |
||||
} |
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.logpm.supervise.mapper.IndicatorsAnnexMapper"> |
||||
|
||||
<select id="findListByIndicatorsIdAndType" resultType="com.logpm.supervise.entity.IndicatorsAnnexEntity"> |
||||
select * |
||||
from sup_indicators_annex |
||||
and indicators_id = #{id} |
||||
and type = #{type} |
||||
</select> |
||||
|
||||
</mapper> |
@ -0,0 +1,18 @@
|
||||
package com.logpm.supervise.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.logpm.supervise.dto.IndicatorsDTO; |
||||
import com.logpm.supervise.entity.IndicatorsEntity; |
||||
import com.logpm.supervise.vo.IndicatorsVO; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
@Mapper |
||||
public interface IndicatorsMapper extends BaseMapper<IndicatorsEntity> { |
||||
|
||||
|
||||
IPage<IndicatorsVO> pageList(IPage<Object> page, @Param("param") IndicatorsDTO indicatorsDTO); |
||||
|
||||
IndicatorsVO findIndicatorsDetail(@Param("id") Long id); |
||||
} |
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.logpm.supervise.mapper.IndicatorsMapper"> |
||||
|
||||
<select id="pageList" resultType="com.logpm.supervise.vo.IndicatorsVO"> |
||||
|
||||
select sc.name classifyName, |
||||
psc.name parentClassifyName, |
||||
si.assess_dept_name assessDeptName, |
||||
si.assess_user_name assessUserName, |
||||
si.point point, |
||||
si.remark remark, |
||||
si.indicators_status indicatorsStatus, |
||||
si.is_objection isObjection, |
||||
si.objection_remark objectionRemark |
||||
from sup_indicators si |
||||
left join sup_classify sc on sc.id = si.classify_id |
||||
left join sup_classify psc on psc.id = sc.p_id |
||||
where 1=1 |
||||
and si.id = #{param.id} |
||||
<if test="param.assessDept != null"> |
||||
and si.assess_dept = #{param.assessDept} |
||||
</if> |
||||
<if test="param.parentClassifyId != null"> |
||||
and psc.id = #{param.parentClassifyId} |
||||
</if> |
||||
<if test="param.start != null"> |
||||
and si.create_time >= #{param.start} |
||||
</if> |
||||
<if test="param.end != null"> |
||||
and si.create_time <= #{param.end} |
||||
</if> |
||||
|
||||
</select> |
||||
|
||||
<select id="findIndicatorsDetail" resultType="com.logpm.supervise.vo.IndicatorsVO"> |
||||
select si.*, |
||||
sc.name classifyName, |
||||
psc.id parentClassifyId, |
||||
psc.name parentClassifyName |
||||
from sup_indicators si |
||||
left join sup_classify sc on sc.id = si.classify_id |
||||
left join sup_classify psc on psc.id = sc.p_id |
||||
where 1=1 |
||||
and si.id = #{id} |
||||
</select> |
||||
|
||||
</mapper> |
@ -0,0 +1,10 @@
|
||||
package com.logpm.supervise.service; |
||||
|
||||
import com.logpm.supervise.entity.IndicatorsAnnexEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface IIndicatorsAnnexService extends BaseService<IndicatorsAnnexEntity> { |
||||
List<IndicatorsAnnexEntity> findListByIndicatorsIdAndType(Long id, int type); |
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.logpm.supervise.service; |
||||
|
||||
import com.logpm.supervise.dto.IndicatorsDTO; |
||||
import com.logpm.supervise.entity.IndicatorsEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.tool.api.R; |
||||
|
||||
public interface IIndicatorsService extends BaseService<IndicatorsEntity> { |
||||
R findIndicatorsList(IndicatorsDTO indicatorsDTO); |
||||
|
||||
R findIndicatorsDetail(IndicatorsDTO indicatorsDTO); |
||||
|
||||
R updateIndicators(IndicatorsDTO indicatorsDTO); |
||||
|
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.logpm.supervise.service.impl; |
||||
|
||||
import com.logpm.supervise.entity.IndicatorsAnnexEntity; |
||||
import com.logpm.supervise.mapper.IndicatorsAnnexMapper; |
||||
import com.logpm.supervise.service.IIndicatorsAnnexService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Slf4j |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class IndicatorsAnnexServiceImpl extends BaseServiceImpl<IndicatorsAnnexMapper, IndicatorsAnnexEntity> implements IIndicatorsAnnexService { |
||||
@Override |
||||
public List<IndicatorsAnnexEntity> findListByIndicatorsIdAndType(Long id, int type) { |
||||
return baseMapper.findListByIndicatorsIdAndType(id,type); |
||||
} |
||||
} |
@ -0,0 +1,89 @@
|
||||
package com.logpm.supervise.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.logpm.supervise.dto.IndicatorsDTO; |
||||
import com.logpm.supervise.entity.IndicatorsAnnexEntity; |
||||
import com.logpm.supervise.entity.IndicatorsEntity; |
||||
import com.logpm.supervise.mapper.IndicatorsMapper; |
||||
import com.logpm.supervise.service.IIndicatorsAnnexService; |
||||
import com.logpm.supervise.service.IIndicatorsService; |
||||
import com.logpm.supervise.vo.IndicatorsVO; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.common.utils.CommonUtil; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Objects; |
||||
|
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@Service |
||||
public class IndicatorsServiceImpl extends BaseServiceImpl<IndicatorsMapper, IndicatorsEntity> implements IIndicatorsService { |
||||
|
||||
private final IIndicatorsAnnexService iIndicatorsAnnexService; |
||||
|
||||
@Override |
||||
public R findIndicatorsList(IndicatorsDTO indicatorsDTO) { |
||||
|
||||
IPage<Object> page = new Page<>(); |
||||
page.setCurrent(indicatorsDTO.getCurrent()); |
||||
page.setSize(indicatorsDTO.getSize()); |
||||
|
||||
String startDateStr = indicatorsDTO.getStartDateStr(); |
||||
String endDateStr = indicatorsDTO.getEndDateStr(); |
||||
|
||||
Date start = CommonUtil.getStartByDateStr(startDateStr); |
||||
Date end = CommonUtil.getEndByDateStr(endDateStr); |
||||
indicatorsDTO.setStart(start); |
||||
indicatorsDTO.setEnd(end); |
||||
|
||||
IPage<IndicatorsVO> pages = baseMapper.pageList(page,indicatorsDTO); |
||||
|
||||
|
||||
return R.data(pages); |
||||
} |
||||
|
||||
@Override |
||||
public R findIndicatorsDetail(IndicatorsDTO indicatorsDTO) { |
||||
|
||||
Long id = indicatorsDTO.getId(); |
||||
|
||||
IndicatorsVO indiactorsVO = baseMapper.findIndicatorsDetail(id); |
||||
|
||||
List<IndicatorsAnnexEntity> pictures = iIndicatorsAnnexService.findListByIndicatorsIdAndType(id,1); |
||||
List<IndicatorsAnnexEntity> files = iIndicatorsAnnexService.findListByIndicatorsIdAndType(id,2); |
||||
|
||||
indiactorsVO.setPictures(pictures); |
||||
indiactorsVO.setFiles(files); |
||||
|
||||
return R.data(indiactorsVO); |
||||
} |
||||
|
||||
@Override |
||||
public R updateIndicators(IndicatorsDTO indicatorsDTO) { |
||||
Long id = indicatorsDTO.getId(); |
||||
IndicatorsEntity indicatorsEntity = getById(id); |
||||
if(Objects.isNull(indicatorsEntity)){ |
||||
log.warn("###########updateIndicators: 指标信息不存在 id={}",id); |
||||
return R.fail(405,"指标信息不存在"); |
||||
} |
||||
|
||||
indicatorsEntity.setAssessDept(indicatorsDTO.getAssessDept()); |
||||
indicatorsEntity.setAssessDeptName(indicatorsDTO.getAssessDeptName()); |
||||
indicatorsEntity.setAssessUserId(indicatorsDTO.getAssessUserId()); |
||||
indicatorsEntity.setAssessUserName(indicatorsDTO.getAssessUserName()); |
||||
indicatorsEntity.setClassifyId(indicatorsDTO.getClassifyId()); |
||||
indicatorsEntity.setPoint(indicatorsDTO.getPoint()); |
||||
indicatorsEntity.setRemark(indicatorsDTO.getRemark()); |
||||
indicatorsEntity.setObjectionRemark(indicatorsDTO.getObjectionRemark()); |
||||
|
||||
updateById(indicatorsEntity); |
||||
return R.success("更新成功"); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue