2799b218 张雷

Merge remote-tracking branch 'origin/master' into master

2 个父辈 2d4d5edb ec4bee21
正在显示 20 个修改的文件 包含 349 行增加87 行删除
......@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.common.vo.TreeNodeVO;
import com.skua.test.AjhPlanScheduleConfigXls;
import com.skua.tool.util.TreeBuilder;
import lombok.extern.slf4j.Slf4j;
......@@ -263,6 +264,25 @@ public class AjhPlanScheduleConfigController {
return mv;
}
/**
* 导出配置模版
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/exportXlsTemplate")
public ModelAndView exportXlsTemplate(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<AjhPlanScheduleConfigXls> pageList = new ArrayList<>();
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "经营方案计划表列表");
mv.addObject(NormalExcelConstants.CLASS, AjhPlanScheduleConfigXls.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("经营方案计划表列表数据", "", ""));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
/**
* <pre>
* 通过excel导入数据
......@@ -277,6 +297,8 @@ public class AjhPlanScheduleConfigController {
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
String factoryId = request.getParameter("departId");
String year = request.getParameter("year");
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
......@@ -284,8 +306,8 @@ public class AjhPlanScheduleConfigController {
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<AjhPlanScheduleConfig> listAjhPlanScheduleConfigs = ExcelImportUtil.importExcel(file.getInputStream(), AjhPlanScheduleConfig.class, params);
ajhPlanScheduleConfigService.saveBatch(listAjhPlanScheduleConfigs);
List<AjhPlanScheduleConfigXls> listAjhPlanScheduleConfigs = ExcelImportUtil.importExcel(file.getInputStream(), AjhPlanScheduleConfigXls.class, params);
ajhPlanScheduleConfigService.importExcel(listAjhPlanScheduleConfigs,factoryId,year);
return Result.ok("文件导入成功!数据行数:" + listAjhPlanScheduleConfigs.size());
} catch (Exception e) {
log.error(e.getMessage(),e);
......
......@@ -33,6 +33,9 @@ public class AjhPlanScheduleConfig {
@Excel(name = "所属厂站", width = 15)
@ApiModelProperty(value = "所属厂站")
private String factoryId;
@ApiModelProperty(value = "年份")
private String years;
/**上级编号*/
@Excel(name = "上级编号", width = 15)
@ApiModelProperty(value = "上级编号")
......@@ -82,4 +85,23 @@ public class AjhPlanScheduleConfig {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
public AjhPlanScheduleConfig(){
}
public AjhPlanScheduleConfig( String factoryId,String years, String configName) {
this.years = years;
this.factoryId = factoryId;
this.configName = configName;
}
public AjhPlanScheduleConfig(String factoryId, String year, String parentId, String configName, String completeTime, String responsibler) {
this.factoryId = factoryId;
this.years = years;
this.parentId = parentId;
this.configName = configName;
this.completeTime = completeTime;
this.responsibler = responsibler;
}
}
......
......@@ -40,6 +40,14 @@ public class AjhPlanScheduleData {
private String configLevel2;
@ApiModelProperty(value = "三级指标编号")
private String configLevel3;
/**完成时间*/
@Excel(name = "完成时间", width = 15)
@ApiModelProperty(value = "完成时间")
private String completeTime;
/**负责人*/
@Excel(name = "负责人", width = 15)
@ApiModelProperty(value = "负责人")
private String responsibler;
/**序时进度*/
@Excel(name = "序时进度", width = 15)
@ApiModelProperty(value = "序时进度")
......
......@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.modules.ajh.entity.AjhPlanScheduleConfig;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.common.vo.TreeNodeVO;
import com.skua.test.AjhPlanScheduleConfigXls;
import java.util.List;
......@@ -11,12 +13,16 @@ import java.util.List;
* 经营方案计划表
*/
public interface IAjhPlanScheduleConfigService extends IService<AjhPlanScheduleConfig> {
/***
* 列表查询
* @param factoryId
* @return
*/
List<TreeNodeVO> queryTreeList(String factoryId);
/**
* 导入excel文件
* @param listAjhPlanScheduleConfigs
*/
void importExcel(List<AjhPlanScheduleConfigXls> listAjhPlanScheduleConfigs,String factoryId,String years);
}
......
......@@ -5,13 +5,18 @@ import com.skua.modules.ajh.entity.AjhPlanScheduleConfig;
import com.skua.modules.ajh.mapper.AjhPlanScheduleConfigMapper;
import com.skua.modules.ajh.service.IAjhPlanScheduleConfigService;
import com.skua.modules.common.vo.TreeNodeVO;
import com.skua.test.AjhPlanScheduleConfigXls;
import com.skua.tool.util.TreeBuilder;
import com.skua.tool.util.UniqIdUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 经营方案计划表
......@@ -38,5 +43,38 @@ public class AjhPlanScheduleConfigServiceImpl extends ServiceImpl<AjhPlanSchedul
}
return treeList;
}
/**
* 导入excel文件
* @param listAjhPlanScheduleConfigs
*/
@Transactional
public void importExcel(List<AjhPlanScheduleConfigXls> listAjhPlanScheduleConfigs,String factoryId,String year){
Map<String,List<AjhPlanScheduleConfigXls>> dataMap = new HashMap<>();
List<AjhPlanScheduleConfigXls> confiList = null;
for(AjhPlanScheduleConfigXls scheduleConfigXls :listAjhPlanScheduleConfigs){
confiList = dataMap.get(scheduleConfigXls.getWorkName());
if(confiList != null && !confiList.isEmpty()){
confiList.add(scheduleConfigXls);
}else{
confiList = new ArrayList<>();
confiList.add( scheduleConfigXls );
dataMap.put(scheduleConfigXls.getWorkName(),confiList);
}
}
AjhPlanScheduleConfig planScheduleConfig = null;
// 使用For-Each迭代entries,通过Map.entrySet遍历key和value
for (Map.Entry<String, List<AjhPlanScheduleConfigXls>> entry : dataMap.entrySet()) {
//System.out.println("key = " + entry.getKey() + ", value = " + entry.getValue());
//新增父类
//String configId = UniqIdUtils.getInstance().getUniqID();
planScheduleConfig = new AjhPlanScheduleConfig( factoryId ,year,entry.getKey());
this.baseMapper.insert(planScheduleConfig);
//新增子类
for( AjhPlanScheduleConfigXls planScheduleConfigXls : entry.getValue()){
this.baseMapper.insert(new AjhPlanScheduleConfig( factoryId,year ,planScheduleConfig.getParentId(),planScheduleConfig.getConfigName(),planScheduleConfig.getCompleteTime(),planScheduleConfig.getResponsibler()));
}
}
}
}
......
......@@ -18,6 +18,7 @@ import com.skua.core.util.push.IPushService;
import com.skua.core.util.push.MessageEntity;
import com.skua.core.util.push.PushMessageFactory;
import com.skua.modules.edu.entity.Paper;
import com.skua.modules.edu.entity.Question;
import com.skua.modules.edu.service.IPaperService;
import java.util.Date;
import java.util.stream.Collectors;
......@@ -25,6 +26,8 @@ import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.edu.service.IQuestionService;
import com.skua.modules.edu.vo.PaperRandomVO;
import com.skua.modules.edu.vo.PaperVO;
import com.skua.modules.guest.util.DateUtil;
import com.skua.modules.system.entity.SysUser;
......@@ -65,18 +68,10 @@ public class PaperController {
@Autowired
private IPaperService paperService;
/**
* <pre>
* 分页列表查询
* </pre>
* @param paper
* @param pageNo
* @param pageSize
* @param req
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@Autowired
private IQuestionService questionService;
@AutoLog(value = "在线考试-试卷-分页列表查询")
@ApiOperation(value="在线考试-试卷-分页列表查询", notes="在线考试-试卷-分页列表查询")
@GetMapping(value = "/list")
......@@ -93,15 +88,24 @@ public class PaperController {
return result;
}
/**
* <pre>
* 添加
* </pre>
* @param paperVO
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "在线考试-随机组卷试题")
@ApiOperation(value="在线考试-随机组卷试题", notes="在线考试-随机组卷试题")
@PostMapping(value = "/randomQuestion")
public Result<List<Question>> randomQuestion(@RequestBody PaperRandomVO paperRandomVO) throws Exception{
Result<List<Question>> result = new Result<>();
try {
List<Question> dataList = questionService.randomQuestion(paperRandomVO);
result.setResult( dataList );
result.success("操作成功!");
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
}
return result;
}
@AutoLog(value = "在线考试-试卷-添加")
@ApiOperation(value="在线考试-试卷-添加", notes="在线考试-试卷-添加")
@PostMapping(value = "/add")
......@@ -116,15 +120,7 @@ public class PaperController {
}
return result;
}
/**
* <pre>
* 编辑
* </pre>
* @param paperVO
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "在线考试-试卷-编辑")
@ApiOperation(value="在线考试-试卷-编辑", notes="在线考试-试卷-编辑")
@PutMapping(value = "/edit")
......
......@@ -27,6 +27,7 @@ import com.skua.modules.system.service.ISysDepartService;
import com.skua.tool.util.JSUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
......@@ -65,15 +66,39 @@ public class QuestionController {
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<Question>> result = new Result<IPage<Question>>();
//QueryWrapper<Question> queryWrapper = QueryGenerator.initQueryWrapper(question, req.getParameterMap());
QueryWrapper<Question> queryWrapper = QueryGenerator.initQueryWrapper(question, req.getParameterMap());
Page<Question> page = new Page<Question>(pageNo, pageSize);
//IPage<Question> pageList = questionService.page(page, queryWrapper);
IPage<Question> pageList = questionService.queryPageList(page, question);
queryWrapper.orderByDesc("create_time");
IPage<Question> pageList = questionService.page(page, queryWrapper);
//IPage<Question> pageList = questionService.queryPageList(page, question);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "在线考试-试题-审批列表")
@ApiOperation(value="在线考试-试题-审批列表", notes="在线考试-试题-审批列表")
@GetMapping(value = "/handleList")
public Result<IPage<Question>> handleList(Question question,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<Question>> result = new Result<IPage<Question>>();
QueryWrapper<Question> queryWrapper = QueryGenerator.initQueryWrapper(question, req.getParameterMap());
Page<Question> page = new Page<Question>(pageNo, pageSize);
//queryWrapper.gt("audit_status","0");//>0
//queryWrapper.lt("audit_status","3");// < 3
if(StringUtils.isEmpty(question.getAuditStatus())){
queryWrapper.eq("audit_status","1");
}
queryWrapper.orderByDesc("create_time");
IPage<Question> pageList = questionService.page(page, queryWrapper);
//IPage<Question> pageList = questionService.queryPageList(page, question);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "在线考试-题库-题库下试题列表")
@ApiOperation(value="在线考试-题库下试题列表", notes="在线考试-题库下试题列表")
@GetMapping(value = "/questionList/{dbId}")
......@@ -250,6 +275,9 @@ public class QuestionController {
return result;
}
@RequestMapping(value = "/exportXlsTemplate")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
......
package com.skua.modules.edu.mapper;
import java.util.Collection;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -61,4 +62,7 @@ public interface QuestionMapper extends BaseMapper<Question> {
* @return
*/
public int batchSendAudit(@Param("id")String ids, @Param("auditStatus")String auditStatus);
/**随机试题集合*/
List<Question> randomQuestion(@Param("dbId")String dbId, @Param("questionType")String questionType, @Param("qNums")String qNums, @Param("qScore")String qScore);
}
......
......@@ -20,6 +20,8 @@
<result property="departName" column="depart_name" />
<result property="userName" column="user_name" />
<result property="score" column="score" />
</resultMap>
<sql id="selectEduQuestionVo">
......@@ -36,12 +38,23 @@
<if test="param.questionAnswer != null and param.questionAnswer != ''"> and t.question_answer = #{param.questionAnswer}</if>
<if test="param.questionData != null and param.questionData != ''"> and t.question_data = #{param.questionData}</if>
<if test="param.analyzes != null and param.analyzes != ''"> and t.analyzes = #{param.analyzes}</if>
<if test="param.createDept != null and param.createDept != ''"> and t.create_dept = #{param.createDept}</if>
<if test="param.auditStatus != null and param.auditStatus != ''"> and t.audit_status = #{param.auditStatus}</if>
<if test="param.delFlag != null "> and t.del_flag = #{param.delFlag}</if>
</where>
order by create_time desc
</select>
<!-- 随机试题集合-->
<select id="randomQuestion" resultMap="EduQuestionResult">
select t.* , #{qScore} score from edu_question t
<where> t.audit_status = 3
<if test="dbId!= null and dbId != ''"> and t.question_db_id = #{dbId}</if>
<if test="questionType != null and questionType != ''"> and t.question_type = #{questionType}</if>
</where>
order by rand() limit ${qNums}
</select>
<select id="selectQuestionList" parameterType="com.skua.modules.edu.entity.Question" resultMap="EduQuestionResult">
select d.depart_name ,u.realname 'user_name' , t.* from edu_question t
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.edu.entity.Question;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.edu.vo.PaperRandomVO;
import com.skua.modules.edu.vo.QuestionExcel;
import java.util.List;
......@@ -80,4 +81,11 @@ public interface IQuestionService extends IService<Question> {
* @return
*/
String auditBatchQuestion(String ids, String approveState, String approveMessage);
/***
* 随机组卷的试题集合
* @param paperRandomVO
* @return
*/
List<Question> randomQuestion(PaperRandomVO paperRandomVO);
}
......
......@@ -13,6 +13,7 @@ import com.skua.modules.edu.mapper.QuestionMapper;
import com.skua.modules.edu.mapper.QuestionOptionMapper;
import com.skua.modules.edu.service.IQuestionOptionService;
import com.skua.modules.edu.service.IQuestionService;
import com.skua.modules.edu.vo.PaperRandomVO;
import com.skua.modules.edu.vo.QuestionExcel;
import com.skua.modules.erp.entity.ApproveRecord;
import com.skua.modules.erp.mapper.ApproveRecordMapper;
......@@ -185,6 +186,28 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
return "0" ;
}
/***
* 随机组卷的试题集合
* @param paperRandomVO
* @return
*/
public List<Question> randomQuestion(PaperRandomVO paperRandomVO){
List<Question> dataList = new ArrayList<>();
//单选题
if(StringUtils.isNotEmpty(paperRandomVO.getSingleNums())){
dataList.addAll( this.baseMapper.randomQuestion(paperRandomVO.getDbId(),"1",paperRandomVO.getSingleNums(),paperRandomVO.getSingleScore()) );
}
// 多选题
if(StringUtils.isNotEmpty(paperRandomVO.getMultipleNums())){
dataList.addAll( this.baseMapper.randomQuestion(paperRandomVO.getDbId(),"2",paperRandomVO.getMultipleNums(),paperRandomVO.getMultipleScore()) );
}
// 判断题
if(StringUtils.isNotEmpty(paperRandomVO.getJudgeNums())){
dataList.addAll( this.baseMapper.randomQuestion(paperRandomVO.getDbId(),"3",paperRandomVO.getJudgeNums(),paperRandomVO.getJudgeScore()) );
}
return dataList;
}
/***
* 批量送审
......
package com.skua.modules.edu.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @auther kangwei
* @create 2025-02-25-17:18
*/
@Data
@ApiModel(value="随机组卷对象", description="随机组卷对象")
public class PaperRandomVO {
@ApiModelProperty(value = "题库编号")
private String dbId;
@ApiModelProperty(value = "单选-试题数量")
private String singleNums;
@ApiModelProperty(value = "单选-试题分值")
private String singleScore;
@ApiModelProperty(value = "多选-试题数量")
private String multipleNums;
@ApiModelProperty(value = "多选-试题分值")
private String multipleScore;
@ApiModelProperty(value = "判断-试题数量")
private String judgeNums;
@ApiModelProperty(value = "判断-试题分值")
private String judgeScore;
}
package com.skua.modules.edu.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @auther kangwei
* @create 2025-02-25-17:18
*/
@Data
@ApiModel(value="随机组卷--章节对象", description="随机组卷--章节")
public class PaperSectionVO {
@ApiModelProperty(value = "题库编号")
private String dbId;
@ApiModelProperty(value = "试题类型:1 单选、2多选、3判断")
private String questionType;
//@ApiModelProperty(value = "试题难易程度")
//private String qLevel;
@ApiModelProperty(value = "试题数量")
private String qNums;
@ApiModelProperty(value = "试题分值")
private String qScore;
}
......@@ -386,7 +386,7 @@ public class ErpSettlementController {
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "药剂结算单详情列表");
mv.addObject(NormalExcelConstants.CLASS, ErpSettlement.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("药剂结算单详情列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("药剂结算单详情列表数据", "", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
......
......@@ -97,8 +97,8 @@ public class SafetyOffenceRecord {
@ApiModelProperty(value = "处理时间")
private String handleTime;
/**处理状态【1 已处理 2 暂不处理】*/
@Excel(name = "处理状态【1 已处理 2 暂不处理】", width = 15)
@ApiModelProperty(value = "处理状态【1 已处理 2 暂不处理】")
@Excel(name = "处理状态【1 认定违章、 2 不认定违章】", width = 15)
@ApiModelProperty(value = "处理状态【1 认定违章、 2 不认定违章】")
@Dict( dicCode = "safety_handle_status")
private String handleStatus;
/**反馈意见*/
......
......@@ -3,15 +3,18 @@ package com.skua.modules.dataAnalysis.controller;
import com.skua.common.constant.ReportConstant;
import com.skua.common.report.ReportViewUtil;
import com.skua.core.api.vo.Result;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.context.SpringContextUtils;
import com.skua.modules.dataAnalysis.vo.SafeProgressVO;
import com.skua.modules.dataAnalysis.vo.WorkProgressVO;
import com.skua.modules.system.service.ISysDepartService;
import com.skua.tool.util.DateUtils;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -33,7 +36,8 @@ import java.util.List;
@RestController
@RequestMapping("/v1/dataAnalysis/work")
public class WorkAnalysisController {
@Autowired
private ISysDepartService departService;
@ApiOperation(value = "工作进度列表", notes = "工作进度列表 departType = 1 自营水厂 departType=2 表示恩菲水厂 timeType = 1 表示月份,timeType=2 表示年")
@GetMapping("/analysisByWorkProgress")
......@@ -43,14 +47,15 @@ public class WorkAnalysisController {
if(2 == timeType){//表示年
month = DateUtils.formatDate(startTime,"YYYY");
}
String departIds = departId;//DAY(LAST_DAY('"+startTime+"'))
if(StringUtils.isEmpty(departId )){
if(departType == 1){//自营水厂
departIds = getSelfDepartIds();
}
if(departType == 2){//恩菲水厂
departIds = getEFDepartIds();
}
String departIds = BaseContextHandler.getDeparts();//DAY(LAST_DAY('"+startTime+"'))
if(StringUtils.isNotEmpty(departId )){
departIds = departService.getChildDepartId(departId);
}
if(departType == 1){//自营水厂
departIds = getSelfDepartIds(departIds);
}
if(departType == 2){//恩菲水厂
departIds = getEFDepartIds(departIds);
}
endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比
int index =1;
......@@ -84,14 +89,15 @@ public class WorkAnalysisController {
if(2 == timeType){//表示年
month = DateUtils.formatDate(startTime,"YYYY");
}
String departIds = departId;//DAY(LAST_DAY('"+startTime+"'))
if(StringUtils.isEmpty(departId )){
if(departType == 1){//自营水厂
departIds = getSelfDepartIds();
}
if(departType == 2){//恩菲水厂
departIds = getEFDepartIds();
}
String departIds = BaseContextHandler.getDeparts();//DAY(LAST_DAY('"+startTime+"'))
if(StringUtils.isNotEmpty(departId )){
departIds = departService.getChildDepartId(departId);
}
if(departType == 1){//自营水厂
departIds = getSelfDepartIds(departIds);
}
if(departType == 2){//恩菲水厂
departIds = getEFDepartIds(departIds);
}
endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比
int index =1;
......@@ -123,14 +129,15 @@ public class WorkAnalysisController {
public Result<List<SafeProgressVO>> analysisBySafeProgress(@RequestParam(defaultValue = "1") Integer departType,String departId,@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) {
Result<List<SafeProgressVO>> result = new Result<>();
JdbcTemplate jdbcTemplate = (JdbcTemplate) SpringContextUtils.getBean("master");
String departIds = departId;//DAY(LAST_DAY('"+startTime+"'))
if(StringUtils.isEmpty(departId )){
if(departType == 1){//自营水厂
departIds = getSelfDepartIds();
}
if(departType == 2){//恩菲水厂
departIds = getEFDepartIds();
}
String departIds = BaseContextHandler.getDeparts();//DAY(LAST_DAY('"+startTime+"'))
if(StringUtils.isNotEmpty(departId )){
departIds = departService.getChildDepartId(departId);
}
if(departType == 1){//自营水厂
departIds = getSelfDepartIds(departIds);
}
if(departType == 2){//恩菲水厂
departIds = getEFDepartIds(departIds);
}
endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比
String sql = "select d.id 'depart_id' , d.depart_name , ifnull(aaa.count,0) 'meet_num', ifnull(bbb.count,0) 'meet_total', ifnull(ccc.count,0) 'exam_num', ifnull(ddd.count,0) 'exam_total',ifnull(eee.count, 0) 'frequency_num' , ifnull(fff.count , 0) 'frequency_total'";
......@@ -151,14 +158,15 @@ public class WorkAnalysisController {
@GetMapping("/analysisTotalBySafeProgress")
public Result<SafeProgressVO> analysisTotalBySafeProgress(@RequestParam(defaultValue = "1") Integer departType, String departId ,@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) {
Result<SafeProgressVO> result = new Result<>();
String departIds = departId;//DAY(LAST_DAY('"+startTime+"'))
if(StringUtils.isEmpty(departId )){
if(departType == 1){//自营水厂
departIds = getSelfDepartIds();
}
if(departType == 2){//恩菲水厂
departIds = getEFDepartIds();
}
String departIds = BaseContextHandler.getDeparts();//DAY(LAST_DAY('"+startTime+"'))
if(StringUtils.isNotEmpty(departId )){
departIds = departService.getChildDepartId(departId);
}
if(departType == 1){//自营水厂
departIds = getSelfDepartIds(departIds);
}
if(departType == 2){//恩菲水厂
departIds = getEFDepartIds(departIds);
}
endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比
......@@ -233,12 +241,12 @@ public class WorkAnalysisController {
return sql;
}
private String getSelfDepartIds(){
String sql = "select GROUP_CONCAT(id) 'departIds' from sys_depart where depart_type =1 and parent_id <> '1818215543140909056'";
private String getSelfDepartIds(String departIds){
String sql = "select GROUP_CONCAT(id) 'departIds' from sys_depart where depart_type =1 and parent_id <> '1818215543140909056' and id in ("+JSUtils.quoteEach(departIds,",")+")";
return getJdbcTemplate().queryForObject(sql,String.class);
}
private String getEFDepartIds(){//获取恩菲水厂编号
String sql = "select GROUP_CONCAT(id) 'departIds' from sys_depart where depart_type =1 and parent_id = '1818215543140909056'";
private String getEFDepartIds(String departIds){//获取恩菲水厂编号
String sql = "select GROUP_CONCAT(id) 'departIds' from sys_depart where depart_type =1 and parent_id = '1818215543140909056' and id in ("+JSUtils.quoteEach(departIds,",")+")";
return getJdbcTemplate().queryForObject(sql,String.class);
}
......
......@@ -50,6 +50,9 @@ public class EquipmentCenterController {
public Result<FaultStatisticsVO> equipmentStatistics(ReportStatisticsDTO reportStatisticsDTO) {
Result<FaultStatisticsVO> result = new Result<>();
setDepartIds(reportStatisticsDTO);
//取消时间参数
reportStatisticsDTO.setStartTime(null);
reportStatisticsDTO.setEndTime(null);
FaultStatisticsVO equipmentStatistics = iProductionEquipmentService.getEquipmentStatistics(reportStatisticsDTO);
result.setResult(equipmentStatistics);
result.setSuccess(true);
......@@ -65,6 +68,9 @@ public class EquipmentCenterController {
Result<IPage<EquipmentNewMaintenancePlanVO>> result = new Result<IPage<EquipmentNewMaintenancePlanVO>>();
Page<EquipmentNewMaintenancePlanVO> pageList = new Page<EquipmentNewMaintenancePlanVO>(pageNo, pageSize);
setDepartIds(reportStatisticsDTO);
//取消时间参数
reportStatisticsDTO.setStartTime(null);
reportStatisticsDTO.setEndTime(null);
pageList = iProductionEquipmentService.getEquipmentStatisticsDetails(pageList, reportStatisticsDTO);
result.setSuccess(true);
result.setResult(pageList);
......@@ -92,6 +98,9 @@ public class EquipmentCenterController {
public Result<List<TOPTenVO>> equipmentState(ReportStatisticsDTO reportStatisticsDTO) {
Result<List<TOPTenVO>> result = new Result<>();
setDepartIds(reportStatisticsDTO);
//取消时间参数
reportStatisticsDTO.setStartTime(null);
reportStatisticsDTO.setEndTime(null);
List<TOPTenVO> equipmentState = iProductionEquipmentService.getEquipmentState(reportStatisticsDTO);
result.setSuccess(true);
result.setResult(equipmentState);
......
......@@ -29,7 +29,7 @@ import java.util.Map;
@Mapper
public interface ProductionEquipmentMapper {
//根据时间获取设备数量
Integer getEquipmentNum(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("level") String level);
Integer getEquipmentNum(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("level") String level,@Param("departIds") String departIds);
//获取总的停机天数
Map getDowntime(@Param("startTime") String startTime, @Param("endTime") String endTime);
......
......@@ -15,6 +15,9 @@
<if test="endTime !=null and endTime !=''">
and #{endTime}
</if>
<if test="departIds !=null and departIds !=''">
and depart_id in(${departIds})
</if>
</where>
</select>
<select id="getDowntime" resultType="java.util.Map" parameterType="java.lang.String">
......@@ -160,6 +163,10 @@
<if test="departIds != null ">
and ei.depart_id in(${departIds})
</if>
<if test="departIds !=null and departIds !=''">
and ei.depart_id in(${departIds})
</if>
group by ei.equipment_level
</select>
<select id="getTypeByTime" parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO"
......@@ -208,6 +215,10 @@
<if test="endTime !=null and endTime !=''">
AND #{endTime}
</if>
<if test="departIds !=null and departIds !=''">
and ei.depart_id in(${departIds})
</if>
</where>
GROUP BY
sd1.id
......@@ -336,6 +347,10 @@
<if test="endTime !=null and endTime !=''">
AND #{endTime}
</if>
<if test="departIds !=null and departIds !=''">
and depart_id in(${departIds})
</if>
</where>
</select>
<select id="getStatusByHeadquarters" resultType="java.util.Map"
......
......@@ -73,11 +73,11 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
reportStatisticsDTO.setTime(reportStatisticsDTO.getEndTime().substring(0,7));
}
//总数
equipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), null);
equipmentNum = productionEquipmentMapper.getEquipmentNum(null,null, null,reportStatisticsDTO.getDepartIds());
//ab总数
ABEquipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), "C");
ABEquipmentNum = productionEquipmentMapper.getEquipmentNum(null,null, "C",reportStatisticsDTO.getDepartIds());
//这个月新增
increase = productionEquipmentMapper.getEquipmentNum(reportStatisticsDTO.getStartTime(), reportStatisticsDTO.getEndTime(), null);
increase = productionEquipmentMapper.getEquipmentNum(reportStatisticsDTO.getStartTime(), reportStatisticsDTO.getEndTime(), null,reportStatisticsDTO.getDepartIds());
// DateFormat format = new SimpleDateFormat("yyyy-MM");
String lastMonth = DateUtils.getHbMonth(DateUtils.formatDate(reportStatisticsDTO.getStartTime(),"yyyy-MM"));
/* Date parse = null;
......@@ -110,7 +110,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
if (null != downtime2.get("downtime")) {
downtime3 = downtime2.get("downtime").toString();
}
Integer increase1 = productionEquipmentMapper.getEquipmentNum(lastMonth + MONTH_START, lastMonth + MONTH_END, null);
Integer increase1 = productionEquipmentMapper.getEquipmentNum(lastMonth + MONTH_START, lastMonth + MONTH_END, null,reportStatisticsDTO.getDepartIds());
Double v1 = 0.00;
if (increase1 > 0) {
v1 = (increase1 * 30 - Double.parseDouble(downtime3)) / (increase1 * 30);
......@@ -154,14 +154,14 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
reportStatisticsDTO.setTime(reportStatisticsDTO.getEndTime().substring(0,4));
}
//总数
equipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), null);
equipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), null,reportStatisticsDTO.getDepartIds());
//ab总数
ABEquipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), "C");
ABEquipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), "C",reportStatisticsDTO.getDepartIds());
if (null == reportStatisticsDTO.getTime()) {
Calendar cal = Calendar.getInstance();
reportStatisticsDTO.setTime(String.valueOf(cal.get(Calendar.YEAR)));
}
increase = productionEquipmentMapper.getEquipmentNum(reportStatisticsDTO.getTime() + YEAR_START, reportStatisticsDTO.getTime() + YEAR_END, null);
increase = productionEquipmentMapper.getEquipmentNum(reportStatisticsDTO.getTime() + YEAR_START, reportStatisticsDTO.getTime() + YEAR_END, null,reportStatisticsDTO.getDepartIds());
//设备完好率
//求总停机天数
Map downtime = productionEquipmentMapper.getDowntime(reportStatisticsDTO.getTime() + YEAR_START, reportStatisticsDTO.getTime() + YEAR_END);
......@@ -188,7 +188,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
} else {
downtime3 = downtime2.get("downtime").toString();
}
Integer increase1 = productionEquipmentMapper.getEquipmentNum(lastYear + YEAR_START, lastYear + YEAR_END, null);
Integer increase1 = productionEquipmentMapper.getEquipmentNum(lastYear + YEAR_START, lastYear + YEAR_END, null,reportStatisticsDTO.getDepartIds());
Double v1 = 0.00;
if (increase1 > 0) {
v1 = (increase1 * 365 - Double.parseDouble(downtime3)) / (increase1 * 365);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!