5a450e0f 张雷

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

2 个父辈 7705c933 4e3dfbf2
正在显示 17 个修改的文件 包含 1239 行增加1 行删除
package com.skua.modules.common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @auther kangwei
* @create 2025-01-15-9:52
*/
@Data
@ApiModel(value="树结构", description="树结构")
public class TreeNodeVO {
@ApiModelProperty(value = "节点编号")
private String id;
@ApiModelProperty(value = "上级节点编号")
private String parentId;
@ApiModelProperty(value = "节点名称")
private String label;
@ApiModelProperty(value = "是否叶子结点")
private boolean isLeaf;
@ApiModelProperty(value = "完成时间")
private String completeTime;
@ApiModelProperty(value = "负责人")
private String responsibler;
@ApiModelProperty(value = "子集合")
private List<TreeNodeVO> children = new ArrayList<>();
public TreeNodeVO() {
}
public TreeNodeVO(String id, String parentId, String label) {
this.id = id;
this.parentId = parentId;
this.label = label;
}
public TreeNodeVO(String id, String parentId, String label, String completeTime, String responsibler) {
this.id = id;
this.parentId = parentId;
this.label = label;
this.completeTime = completeTime;
this.responsibler = responsibler;
}
public boolean isLeaf() {
isLeaf = true;
if(children != null && !children.isEmpty()){
isLeaf = false;
}
return isLeaf;
}
public void addChild(TreeNodeVO child) {
this.children.add(child);
}
}
package com.skua.tool.util;
import com.skua.modules.common.vo.TreeNodeVO;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @auther kangwei
* @create 2025-01-15-10:07
*/
public class TreeBuilder {
//构建树结构
public static List<TreeNodeVO> buildTree(List<TreeNodeVO> nodes) {
Map<String, TreeNodeVO> nodeMap = nodes.stream().collect(Collectors.toMap(TreeNodeVO::getId, node -> node));
List<TreeNodeVO> roots = new ArrayList<>();
TreeNodeVO parent = null;
for (TreeNodeVO node : nodes) {
parent = nodeMap.get(node.getParentId());
if (parent != null) {
parent.addChild(node);
} else {
roots.add(node);
}
}
return roots;
}
}
package com.skua.modules.ajh.controller;
import java.util.*;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.query.QueryGenerator;
import com.skua.core.service.ISequenceService;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.ajh.entity.AjhPlanScheduleConfig;
import com.skua.modules.ajh.service.IAjhPlanScheduleConfigService;
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.tool.util.TreeBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* <pre>
* 经营方案计划表
* </pre>
* @author 开发者姓名
* @version V0.1, 开发时间
*/
@Slf4j
@Api(tags="经营方案计划表")
@RestController("webAjhPlanScheduleConfigController")
@RequestMapping("/web/ajh/ajhPlanScheduleConfig")
public class AjhPlanScheduleConfigController {
@Autowired
private IAjhPlanScheduleConfigService ajhPlanScheduleConfigService;
/**
* <pre>
* 分页列表查询
* </pre>
* @param ajhPlanScheduleConfig
* @param pageNo
* @param pageSize
* @param req
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "经营方案计划表-分页列表查询")
@ApiOperation(value="经营方案计划表-分页列表查询", notes="经营方案计划表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<AjhPlanScheduleConfig>> queryPageList(AjhPlanScheduleConfig ajhPlanScheduleConfig,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<AjhPlanScheduleConfig>> result = new Result<IPage<AjhPlanScheduleConfig>>();
QueryWrapper<AjhPlanScheduleConfig> queryWrapper = QueryGenerator.initQueryWrapper(ajhPlanScheduleConfig, req.getParameterMap());
Page<AjhPlanScheduleConfig> page = new Page<AjhPlanScheduleConfig>(pageNo, pageSize);
queryWrapper.orderByAsc("sort_num");
IPage<AjhPlanScheduleConfig> pageList = ajhPlanScheduleConfigService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "经营方案计划表-列表查询")
@ApiOperation(value="经营方案计划表-列表查询(树结构)", notes="经营方案计划表-列表查询(树结构)")
@GetMapping(value = "/treeList")
public Result<List<TreeNodeVO>> queryTreeList(AjhPlanScheduleConfig ajhPlanScheduleConfig,
HttpServletRequest req) {
Result<List<TreeNodeVO>> result = new Result<List<TreeNodeVO>>();
QueryWrapper<AjhPlanScheduleConfig> queryWrapper = QueryGenerator.initQueryWrapper(ajhPlanScheduleConfig, req.getParameterMap());
if(StringUtils.isEmpty(ajhPlanScheduleConfig.getFactoryId())){
queryWrapper.eq("factory_id",BaseContextHandler.getRealDepartId());
}
queryWrapper.orderByAsc("sort_num");
List<AjhPlanScheduleConfig> configList = ajhPlanScheduleConfigService.list( queryWrapper);
List<TreeNodeVO> treeList = new ArrayList<TreeNodeVO>();
if(configList != null && !configList.isEmpty()){
for(AjhPlanScheduleConfig config : configList){
//String id, String parentId, String label, String completeTime, String responsibler
treeList.add( new TreeNodeVO(config.getId(),config.getParentId(),config.getConfigName(),config.getCompleteTime(),config.getResponsibler()));
}
treeList = TreeBuilder.buildTree(treeList);
}
result.setSuccess(true);
result.setResult(treeList);
return result;
}
/**
* <pre>
* 添加
* </pre>
* @param ajhPlanScheduleConfig
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "经营方案计划表-添加")
@ApiOperation(value="经营方案计划表-添加", notes="经营方案计划表-添加")
@PostMapping(value = "/add")
public Result<AjhPlanScheduleConfig> add(@RequestBody AjhPlanScheduleConfig ajhPlanScheduleConfig) {
Result<AjhPlanScheduleConfig> result = new Result<AjhPlanScheduleConfig>();
try {
ajhPlanScheduleConfigService.save(ajhPlanScheduleConfig);
result.success("添加成功!");
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
}
return result;
}
/**
* <pre>
* 编辑
* </pre>
* @param ajhPlanScheduleConfig
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "经营方案计划表-编辑")
@ApiOperation(value="经营方案计划表-编辑", notes="经营方案计划表-编辑")
@PutMapping(value = "/edit")
public Result<AjhPlanScheduleConfig> edit(@RequestBody AjhPlanScheduleConfig ajhPlanScheduleConfig) {
Result<AjhPlanScheduleConfig> result = new Result<AjhPlanScheduleConfig>();
AjhPlanScheduleConfig ajhPlanScheduleConfigEntity = ajhPlanScheduleConfigService.getById(ajhPlanScheduleConfig.getId());
if(ajhPlanScheduleConfigEntity==null) {
result.error500("未找到对应实体");
}else {
boolean ok = ajhPlanScheduleConfigService.updateById(ajhPlanScheduleConfig);
//TODO 返回false说明什么?
if(ok) {
result.success("修改成功!");
}
}
return result;
}
/**
* <pre>
* 通过id删除
* </pre>
* @param id
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "经营方案计划表-通过id删除")
@ApiOperation(value="经营方案计划表-通过id删除", notes="经营方案计划表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
try {
ajhPlanScheduleConfigService.removeById(id);
} catch (Exception e) {
log.error("删除失败",e.getMessage());
return Result.error("删除失败!");
}
return Result.ok("删除成功!");
}
/**
* <pre>
* 批量删除
* </pre>
* @param ids
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "经营方案计划表-批量删除")
@ApiOperation(value="经营方案计划表-批量删除", notes="经营方案计划表-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<AjhPlanScheduleConfig> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
Result<AjhPlanScheduleConfig> result = new Result<AjhPlanScheduleConfig>();
if(ids==null || "".equals(ids.trim())) {
result.error500("参数不识别!");
}else {
this.ajhPlanScheduleConfigService.removeByIds(Arrays.asList(ids.split(",")));
result.success("删除成功!");
}
return result;
}
/**
* <pre>
* 通过id查询
* </pre>
* @param id
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "经营方案计划表-通过id查询")
@ApiOperation(value="经营方案计划表-通过id查询", notes="经营方案计划表-通过id查询")
@GetMapping(value = "/queryById")
public Result<AjhPlanScheduleConfig> queryById(@RequestParam(name="id",required=true) String id) {
Result<AjhPlanScheduleConfig> result = new Result<AjhPlanScheduleConfig>();
AjhPlanScheduleConfig ajhPlanScheduleConfig = ajhPlanScheduleConfigService.getById(id);
if(ajhPlanScheduleConfig==null) {
result.error500("未找到对应实体");
}else {
result.setResult(ajhPlanScheduleConfig);
result.setSuccess(true);
}
return result;
}
/**
* <pre>
* 导出excel
* </pre>
* @param request
* @param response
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
QueryWrapper<AjhPlanScheduleConfig> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (ConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
AjhPlanScheduleConfig ajhPlanScheduleConfig = JSON.parseObject(deString, AjhPlanScheduleConfig.class);
queryWrapper = QueryGenerator.initQueryWrapper(ajhPlanScheduleConfig, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<AjhPlanScheduleConfig> pageList = ajhPlanScheduleConfigService.list(queryWrapper);
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "经营方案计划表列表");
mv.addObject(NormalExcelConstants.CLASS, AjhPlanScheduleConfig.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("经营方案计划表列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
/**
* <pre>
* 通过excel导入数据
* </pre>
* @param request
* @param response
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<AjhPlanScheduleConfig> listAjhPlanScheduleConfigs = ExcelImportUtil.importExcel(file.getInputStream(), AjhPlanScheduleConfig.class, params);
ajhPlanScheduleConfigService.saveBatch(listAjhPlanScheduleConfigs);
return Result.ok("文件导入成功!数据行数:" + listAjhPlanScheduleConfigs.size());
} catch (Exception e) {
log.error(e.getMessage(),e);
return Result.error("文件导入失败:"+e.getMessage());
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.ok("文件导入失败!");
}
}
package com.skua.modules.ajh.controller;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.query.QueryGenerator;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.ajh.entity.AjhPlanScheduleData;
import com.skua.modules.ajh.service.IAjhPlanScheduleConfigService;
import com.skua.modules.ajh.service.IAjhPlanScheduleDataService;
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.ajh.vo.AjhPlanScheduleDataVO;
import com.skua.modules.common.vo.TreeNodeVO;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* <pre>
* 经营方案数据表
* </pre>
* @author 开发者姓名
* @version V0.1, 开发时间
*/
@Slf4j
@Api(tags="经营方案数据表")
@RestController("webAjhPlanScheduleDataController")
@RequestMapping("/web/ajh/ajhPlanScheduleData")
public class AjhPlanScheduleDataController {
@Autowired
private IAjhPlanScheduleDataService ajhPlanScheduleDataService;
@Autowired
private IAjhPlanScheduleConfigService ajhPlanScheduleConfigService;
/**
* <pre>
* 分页列表查询
* </pre>
* @param ajhPlanScheduleData
* @param pageNo
* @param pageSize
* @param req
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "经营方案数据表-分页列表查询")
@ApiOperation(value="经营方案数据表-分页列表查询", notes="经营方案数据表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<AjhPlanScheduleDataVO>> queryPageList(AjhPlanScheduleData ajhPlanScheduleData,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<AjhPlanScheduleDataVO>> result = new Result<IPage<AjhPlanScheduleDataVO>>();
QueryWrapper<AjhPlanScheduleData> queryWrapper = QueryGenerator.initQueryWrapper(ajhPlanScheduleData, req.getParameterMap());
Page<AjhPlanScheduleData> page = new Page<AjhPlanScheduleData>(pageNo, pageSize);
//queryWrapper.orderByDesc("factory_id","date_time");
queryWrapper.orderByAsc("date_time");
IPage<AjhPlanScheduleDataVO> pageList = ajhPlanScheduleDataService.queryPageList(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "经营方案数据表-分页列表查询")
@ApiOperation(value="经营方案数据表-分页列表查询", notes="经营方案数据表-分页列表查询")
@GetMapping(value = "/queryList")
public Result<List<AjhPlanScheduleDataVO>> queryList(AjhPlanScheduleData ajhPlanScheduleData,
HttpServletRequest req) {
Result<List<AjhPlanScheduleDataVO>> result = new Result<List<AjhPlanScheduleDataVO>>();
QueryWrapper<AjhPlanScheduleData> queryWrapper = QueryGenerator.initQueryWrapper(ajhPlanScheduleData, req.getParameterMap());
//queryWrapper.orderByDesc("factory_id","date_time");
queryWrapper.orderByAsc("date_time");
List<AjhPlanScheduleDataVO> pageList = ajhPlanScheduleDataService.queryByList( queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
/**
* <pre>
* 添加
* </pre>
* @param dataVOList
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "经营方案数据表-添加或保存")
@ApiOperation(value="经营方案数据表-添加或保存", notes="经营方案数据表-添加或保存")
@PostMapping(value = "/saveUpdate")
public Result<String> saveUpdate(@RequestBody List<AjhPlanScheduleData> dataVOList) {
Result<String> result = new Result<String>();
try {
ajhPlanScheduleDataService.saveOrUpdateBatch(dataVOList);
result.success("添加成功!");
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
}
return result;
}
/**
* <pre>
* 通过id删除
* </pre>
* @param
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "经营方案数据表-通过id删除")
@ApiOperation(value="经营方案数据表-通过id删除", notes="经营方案数据表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="factoryId",required=true) String factoryId , @RequestParam(name="month",required=true) String month) {
try {
ajhPlanScheduleDataService.delById(factoryId,month);
} catch (Exception e) {
log.error("删除失败",e.getMessage());
return Result.error("删除失败!");
}
return Result.ok("删除成功!");
}
/**
* <pre>
* 通过id查询
* </pre>
* @param
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "经营方案数据表-通过id查询")
@ApiOperation(value="经营方案数据表-通过id查询", notes="经营方案数据表-通过id查询")
@GetMapping(value = "/queryById")
public Result<List<AjhPlanScheduleDataVO>> queryById(@RequestParam(name="factoryId",required=true) String factoryId , @RequestParam(name="month",required=true) String month) {
Result<List<AjhPlanScheduleDataVO>> result = new Result<List<AjhPlanScheduleDataVO>>();
QueryWrapper<AjhPlanScheduleData> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("sd.factory_id",factoryId);
queryWrapper.eq("sd.date_time",month);
List<AjhPlanScheduleDataVO> dataList = ajhPlanScheduleDataService.queryByList( queryWrapper);
AjhPlanScheduleDataVO dataVO = null;
if(dataList != null && !dataList.isEmpty() ){
}else{
List<TreeNodeVO> treeNodeVOList = ajhPlanScheduleConfigService.queryTreeList(factoryId);
if(treeNodeVOList != null && !treeNodeVOList.isEmpty()){
for(TreeNodeVO treeNodeVO : treeNodeVOList){
if(treeNodeVO.getChildren() != null && !treeNodeVO.getChildren().isEmpty()){
for(TreeNodeVO childrenVO : treeNodeVO.getChildren()){
//String factoryId,String workItermName, String workContent,String configLevel1, String completeTime1,String configLevel2, String responsibler1, String completeTime2, String responsibler2
dataList.add( new AjhPlanScheduleDataVO(factoryId ,treeNodeVO.getLabel(),childrenVO.getLabel(),treeNodeVO.getId(),treeNodeVO.getCompleteTime(),treeNodeVO.getResponsibler(),
childrenVO.getId(),childrenVO.getCompleteTime(),childrenVO.getResponsibler()) ) ;
}
}else{
//String factoryId,String workItermName,String configLevel1, String completeTime1, String responsibler1
dataList.add( new AjhPlanScheduleDataVO(factoryId ,treeNodeVO.getLabel(),treeNodeVO.getId(),treeNodeVO.getCompleteTime(),treeNodeVO.getResponsibler())) ;
}
}
}
}
result.setResult(dataList);
result.setSuccess(true);
return result;
}
/**
* <pre>
* 导出excel
* </pre>
* @param request
* @param response
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
QueryWrapper<AjhPlanScheduleData> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (ConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
AjhPlanScheduleData ajhPlanScheduleData = JSON.parseObject(deString, AjhPlanScheduleData.class);
queryWrapper = QueryGenerator.initQueryWrapper(ajhPlanScheduleData, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<AjhPlanScheduleData> pageList = ajhPlanScheduleDataService.list(queryWrapper);
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "经营方案数据表列表");
mv.addObject(NormalExcelConstants.CLASS, AjhPlanScheduleData.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("经营方案数据表列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
/**
* <pre>
* 通过excel导入数据
* </pre>
* @param request
* @param response
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<AjhPlanScheduleData> listAjhPlanScheduleDatas = ExcelImportUtil.importExcel(file.getInputStream(), AjhPlanScheduleData.class, params);
ajhPlanScheduleDataService.saveBatch(listAjhPlanScheduleDatas);
return Result.ok("文件导入成功!数据行数:" + listAjhPlanScheduleDatas.size());
} catch (Exception e) {
log.error(e.getMessage(),e);
return Result.error("文件导入失败:"+e.getMessage());
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.ok("文件导入失败!");
}
}
package com.skua.modules.ajh.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* 经营方案计划表
*/
@Data
@TableName("ajh_plan_schedule_config")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="ajh_plan_schedule_config对象", description="经营方案计划表")
public class AjhPlanScheduleConfig {
/**id*/
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "id")
private String id;
/**所属厂站*/
@Excel(name = "所属厂站", width = 15)
@ApiModelProperty(value = "所属厂站")
private String factoryId;
/**上级编号*/
@Excel(name = "上级编号", width = 15)
@ApiModelProperty(value = "上级编号")
private String parentId;
/**配置名称*/
@Excel(name = "配置名称", width = 15)
@ApiModelProperty(value = "配置名称")
private String configName;
/**完成时间*/
@Excel(name = "完成时间", width = 15)
@ApiModelProperty(value = "完成时间")
private String completeTime;
/**负责人*/
@Excel(name = "负责人", width = 15)
@ApiModelProperty(value = "负责人")
private String responsibler;
/**排序序号*/
@Excel(name = "排序序号", width = 15)
@ApiModelProperty(value = "排序序号")
private Integer sortNum;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
/**创建人Id*/
@Excel(name = "创建人Id", width = 15)
@ApiModelProperty(value = "创建人Id")
private String createBy;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**修改人Id*/
@Excel(name = "修改人Id", width = 15)
@ApiModelProperty(value = "修改人Id")
private String updateBy;
/**修改时间*/
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
}
package com.skua.modules.ajh.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* 经营方案数据表
*/
@Data
@TableName("ajh_plan_schedule_data")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="ajh_plan_schedule_data对象", description="经营方案数据表")
public class AjhPlanScheduleData {
/**id*/
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "id")
private String id;
@Excel(name = "所属厂站", width = 15)
@ApiModelProperty(value = "所属厂站")
private String factoryId;
@ApiModelProperty(value = "时间yyyy-MM")
private String dateTime;
@ApiModelProperty(value = "一级指标编号")
private String configLevel1;
@ApiModelProperty(value = "二级指标编号")
private String configLevel2;
@ApiModelProperty(value = "三级指标编号")
private String configLevel3;
/**序时进度*/
@Excel(name = "序时进度", width = 15)
@ApiModelProperty(value = "序时进度")
private String seqProgress;
/**控制成本*/
@Excel(name = "控制成本", width = 15)
@ApiModelProperty(value = "控制成本")
private String controlCosts;
/**实际进度*/
@Excel(name = "实际进度", width = 15)
@ApiModelProperty(value = "实际进度")
private String actualProgress;
/**实际成本*/
@Excel(name = "实际成本", width = 15)
@ApiModelProperty(value = "实际成本")
private String actualCosts;
/**偏差原因*/
@Excel(name = "偏差原因", width = 15)
@ApiModelProperty(value = "偏差原因")
private String deviationReason;
/**纠偏措施*/
@Excel(name = "纠偏措施", width = 15)
@ApiModelProperty(value = "纠偏措施")
private String measures;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
/**创建人Id*/
@Excel(name = "创建人Id", width = 15)
@ApiModelProperty(value = "创建人Id")
private String createBy;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**修改人Id*/
@Excel(name = "修改人Id", width = 15)
@ApiModelProperty(value = "修改人Id")
private String updateBy;
/**修改时间*/
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
}
package com.skua.modules.ajh.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.ajh.entity.AjhPlanScheduleConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 经营方案计划表
*/
public interface AjhPlanScheduleConfigMapper extends BaseMapper<AjhPlanScheduleConfig> {
}
package com.skua.modules.ajh.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.ajh.vo.AjhPlanScheduleDataVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.ajh.entity.AjhPlanScheduleData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
/**
* 经营方案数据表
*/
public interface AjhPlanScheduleDataMapper extends BaseMapper<AjhPlanScheduleData> {
@Select("select d.depart_name , s1.config_name 'workItermName', s2.config_name 'workContent' ,s1.complete_time 'complete_time1',s1.responsibler 'responsibler1' ,s2.complete_time 'complete_time2',s2.responsibler 'responsibler12',sd.* " +
" from ajh_plan_schedule_data sd " +
" left join ajh_plan_schedule_config s1 on s1.id = sd.config_level1 " +
" left join ajh_plan_schedule_config s2 on s2.id = sd.config_level2 " +
" left join sys_depart d on sd.factory_id = d.id ${ew.customSqlSegment}")
IPage<AjhPlanScheduleDataVO> queryPageList(Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper);
@Select("select d.depart_name , s1.config_name 'workItermName', s2.config_name 'workContent' ,s1.complete_time 'complete_time1',s1.responsibler 'responsibler1' ,s2.complete_time 'complete_time2',s2.responsibler 'responsibler12',sd.* " +
" from ajh_plan_schedule_data sd " +
" left join ajh_plan_schedule_config s1 on s1.id = sd.config_level1 " +
" left join ajh_plan_schedule_config s2 on s2.id = sd.config_level2 " +
" left join sys_depart d on sd.factory_id = d.id ${ew.customSqlSegment}")
List<AjhPlanScheduleDataVO> queryByList(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);
void delById(@Param("factoryId") String factoryId, @Param("dateTime")String dateTime);
}
<?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.skua.modules.ajh.mapper.AjhPlanScheduleConfigMapper">
</mapper>
\ No newline at end of file
<?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.skua.modules.ajh.mapper.AjhPlanScheduleDataMapper">
<delete id="delById">
delete from ajh_plan_schedule_data where factory_id=#{factoryId} and date_time = #{dateTime}
</delete>
</mapper>
package com.skua.modules.ajh.service;
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 java.util.List;
/**
* 经营方案计划表
*/
public interface IAjhPlanScheduleConfigService extends IService<AjhPlanScheduleConfig> {
/***
* 列表查询
* @param factoryId
* @return
*/
List<TreeNodeVO> queryTreeList(String factoryId);
}
package com.skua.modules.ajh.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.ajh.entity.AjhPlanScheduleData;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.ajh.vo.AjhPlanScheduleDataVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 经营方案数据表
*/
public interface IAjhPlanScheduleDataService extends IService<AjhPlanScheduleData> {
/***
* 分页检索
* @param page
* @param queryWrapper
* @return
*/
IPage<AjhPlanScheduleDataVO> queryPageList(Page page, QueryWrapper queryWrapper);
/***
* 列表查询
* @param queryWrapper
* @return
*/
List<AjhPlanScheduleDataVO> queryByList(QueryWrapper queryWrapper);
/***
*
* @param factoryId
* @param dateTime
*/
void delById(String factoryId ,String dateTime );
}
package com.skua.modules.ajh.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.tool.util.TreeBuilder;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.ArrayList;
import java.util.List;
/**
* 经营方案计划表
*/
@Service
public class AjhPlanScheduleConfigServiceImpl extends ServiceImpl<AjhPlanScheduleConfigMapper, AjhPlanScheduleConfig> implements IAjhPlanScheduleConfigService {
/***
* 列表查询
* @param factoryId
* @return
*/
public List<TreeNodeVO> queryTreeList(String factoryId){
QueryWrapper<AjhPlanScheduleConfig> queryConfigWrapper = new QueryWrapper();
queryConfigWrapper.eq("factory_id", factoryId);
List<AjhPlanScheduleConfig> configList = this.baseMapper.selectList( queryConfigWrapper);
List<TreeNodeVO> treeList = new ArrayList<TreeNodeVO>();
if(configList != null && !configList.isEmpty()){
for(AjhPlanScheduleConfig config : configList){
//String id, String parentId, String label, String completeTime, String responsibler
treeList.add( new TreeNodeVO(config.getId(),config.getParentId(),config.getConfigName(),config.getCompleteTime(),config.getResponsibler()));
}
treeList = TreeBuilder.buildTree(treeList);
}
return treeList;
}
}
package com.skua.modules.ajh.service.impl;
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.ajh.entity.AjhPlanScheduleData;
import com.skua.modules.ajh.mapper.AjhPlanScheduleDataMapper;
import com.skua.modules.ajh.service.IAjhPlanScheduleDataService;
import com.skua.modules.ajh.vo.AjhPlanScheduleDataVO;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
/**
* 经营方案数据表
*/
@Service
public class AjhPlanScheduleDataServiceImpl extends ServiceImpl<AjhPlanScheduleDataMapper, AjhPlanScheduleData> implements IAjhPlanScheduleDataService {
/***
* 分页检索
* @param page
* @param queryWrapper
* @return
*/
public IPage<AjhPlanScheduleDataVO> queryPageList(Page page, QueryWrapper queryWrapper){
return this.baseMapper.queryPageList(page,queryWrapper);
}
/***
* 列表查询
* @param queryWrapper
* @return
*/
public List<AjhPlanScheduleDataVO> queryByList(QueryWrapper queryWrapper){
return this.baseMapper.queryByList(queryWrapper);
}
/***
* 删除记录
* @param factoryId
* @param dateTime
*/
public void delById(String factoryId ,String dateTime ){
this.baseMapper.delById(factoryId , dateTime);
}
}
......@@ -175,6 +175,7 @@ public class AjhRectificationInfoServiceImpl extends ServiceImpl<AjhRectificatio
throw new JeecgBootException("实体不存在!");
}
BeanUtils.copyProperties(dto, updateParam);
updateParam.setHandleResult(DicRectificationInfoHandleResultEnums.HANDLED.getItemValue());
this.updateById(updateParam);
......
package com.skua.modules.ajh.vo;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* 经营方案数据表
*/
@Data
@ApiModel(value="ajh_plan_schedule_data数据传输对象", description="经营方案数据表")
public class AjhPlanScheduleDataVO {
/**id*/
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "id")
private String id;
@Excel(name = "所属厂站", width = 15)
@ApiModelProperty(value = "所属厂站")
private String factoryId;
@ApiModelProperty(value = "所属厂站名称")
private String departName;
@ApiModelProperty(value = "时间yyyy-MM")
private String dateTime;
@ApiModelProperty(value = "工作事项")
private String workItermName;
@ApiModelProperty(value = "具体内容")
private String workContent;
@ApiModelProperty(value = "一级指标编号")
private String configLevel1;
@ApiModelProperty(value = "二级指标编号")
private String configLevel2;
@ApiModelProperty(value = "一级指标-完成时间")
private String completeTime1;
@ApiModelProperty(value = "一级指标-责任人")
private String responsibler1;
@ApiModelProperty(value = "二级指标-完成时间")
private String completeTime2;
@ApiModelProperty(value = "二级指标-责任人")
private String responsibler2;
@ApiModelProperty(value = "完成时间")
private String completeTime;
/**负责人*/
@Excel(name = "负责人", width = 15)
@ApiModelProperty(value = "负责人")
private String responsibler;
/**序时进度*/
@Excel(name = "序时进度", width = 15)
@ApiModelProperty(value = "序时进度")
private String seqProgress;
/**控制成本*/
@Excel(name = "控制成本", width = 15)
@ApiModelProperty(value = "控制成本")
private String controlCosts;
/**实际进度*/
@Excel(name = "实际进度", width = 15)
@ApiModelProperty(value = "实际进度")
private String actualProgress;
/**实际成本*/
@Excel(name = "实际成本", width = 15)
@ApiModelProperty(value = "实际成本")
private String actualCosts;
/**偏差原因*/
@Excel(name = "偏差原因", width = 15)
@ApiModelProperty(value = "偏差原因")
private String deviationReason;
/**纠偏措施*/
@Excel(name = "纠偏措施", width = 15)
@ApiModelProperty(value = "纠偏措施")
private String measures;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
public AjhPlanScheduleDataVO() {
}
public AjhPlanScheduleDataVO(String factoryId,String workItermName, String workContent,String configLevel1, String completeTime1, String responsibler1, String configLevel2,String completeTime2, String responsibler2) {
this.factoryId = factoryId;
this.workItermName = workItermName;
this.workContent = workContent;
this.configLevel1 = configLevel1;
this.completeTime1 = completeTime1;
this.responsibler1 = responsibler1;
this.configLevel2 = configLevel2;
this.completeTime2 = completeTime2;
this.responsibler2 = responsibler2;
}
public AjhPlanScheduleDataVO(String factoryId,String workItermName,String configLevel1, String completeTime1, String responsibler1) {
this.factoryId = factoryId;
this.workItermName = workItermName;
this.workContent = workContent;
this.configLevel1 = configLevel1;
this.completeTime1 = completeTime1;
this.responsibler1 = responsibler1;
}
public String getCompleteTime() {
completeTime = completeTime1;
if(StringUtils.isNotEmpty(completeTime2)){
completeTime = completeTime2;
}
return completeTime;
}
public String getResponsibler() {
responsibler = responsibler1;
if(StringUtils.isNotEmpty(responsibler2)){
responsibler = responsibler2;
}
return responsibler;
}
}
......@@ -8,6 +8,8 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.common.collect.Lists;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
......@@ -83,18 +85,49 @@ public class ErpProblemController {
String endTime = req.getParameter("endTime");
if (StringUtils.isNotEmpty(startTime)) {
queryWrapper.ge("report_date", startTime+" 00:00:00");
}
if (StringUtils.isNotEmpty(endTime)) {
queryWrapper.le("report_date", endTime+" 23:59:59");
}
//queryWrapper.in("alarm_rule_type", Lists.newArrayList("1", "2", "3", "5", "8"));
if(erpProblem.getHandleStatus() != null){//0:未提交,1:待处理,2退回,3已处理,4 关闭
queryWrapper.in("handle_status",Lists.newArrayList("0","1", "2", "3", "4"));
}
queryWrapper.orderByDesc("create_time");
IPage<ErpProblem> pageList = erpProblemService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "ERP-数据问题上报-审批列表")
@ApiOperation(value="ERP-数据问题上报-审批列表", notes="数据问题上报-审批列表")
@GetMapping(value = "/handleList")
public Result<IPage<ErpProblem>> handleList(ErpProblem erpProblem,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<ErpProblem>> result = new Result<IPage<ErpProblem>>();
QueryWrapper<ErpProblem> queryWrapper = QueryGenerator.initQueryWrapper(erpProblem, req.getParameterMap());
Page<ErpProblem> page = new Page<ErpProblem>(pageNo, pageSize);
String startTime = req.getParameter("startTime");
String endTime = req.getParameter("endTime");
if (StringUtils.isNotEmpty(startTime)) {
queryWrapper.ge("report_date", startTime+" 00:00:00");
}
if (StringUtils.isNotEmpty(endTime)) {
queryWrapper.le("report_date", endTime+" 23:59:59");
}
if(erpProblem.getHandleStatus() != null){//0:未提交,1:待处理,2退回,3已处理,4 关闭
queryWrapper.in("handle_status",Lists.newArrayList("1"));
}
queryWrapper.orderByDesc("create_time");
IPage<ErpProblem> pageList = erpProblemService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
/**
* <pre>
* 添加
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!