|
@@ -1,48 +1,38 @@
|
|
|
package org.jeecg.modules.prowork.controller;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
-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 javax.validation.Valid;
|
|
|
-
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.dto.prowork.ProWorkMilestoneAddReqDTO;
|
|
|
+import org.jeecg.common.dto.prowork.ProWorkMilestoneReqDTO;
|
|
|
+import org.jeecg.common.dto.prowork.ProWorkMilestoneRespDTO;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
-import org.jeecg.common.util.oConvertUtils;
|
|
|
-import org.jeecg.modules.prowork.entity.proWorkMilestone;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import org.jeecg.modules.prowork.entity.ProWorkMilestone;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.modules.prowork.service.ProWorkMilestoneService;
|
|
|
-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.validation.BindingResult;
|
|
|
-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 org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
- * @Title: Controller
|
|
|
- * @Description: 项目工作--里程碑确认单
|
|
|
- * @author: jeecg-boot
|
|
|
- * @date: 2021-03-03
|
|
|
- * @version: V1.0
|
|
|
- */
|
|
|
+ * @Author jihaosen
|
|
|
+ * @date 2021/3/3
|
|
|
+ */
|
|
|
+
|
|
|
@Api("里程碑确认单接口")
|
|
|
@RestController
|
|
|
@RequestMapping("/prowork/proWorkMilestone")
|
|
@@ -58,15 +48,17 @@ import com.alibaba.fastjson.JSON;
|
|
|
@ApiImplicitParam(name="type", value="1.开发 2.实施 3.服务",required=true, dataType="String"),
|
|
|
})
|
|
|
@GetMapping(value = "/list")
|
|
|
- public Result<IPage<proWorkMilestone>> queryPageList(@Valid proWorkMilestone proWorkMilestone,
|
|
|
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
- Result<IPage<proWorkMilestone>> result = new Result<IPage<proWorkMilestone>>();
|
|
|
- QueryWrapper<proWorkMilestone> queryWrapper = QueryGenerator.initQueryWrapper(proWorkMilestone, req.getParameterMap());
|
|
|
- queryWrapper.orderByDesc("create_time");
|
|
|
- Page<proWorkMilestone> page = new Page<proWorkMilestone>(pageNo, pageSize);
|
|
|
- IPage<proWorkMilestone> pageList = proWorkMilestoneService.page(page, queryWrapper);
|
|
|
+ public Result<IPage<ProWorkMilestone>> queryPageList(@Valid ProWorkMilestone proWorkMilestone,
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ Result<IPage<ProWorkMilestone>> result = new Result<IPage<ProWorkMilestone>>();
|
|
|
+ proWorkMilestone.setDelFlag(null);
|
|
|
+ QueryWrapper<ProWorkMilestone> queryWrapper = QueryGenerator.initQueryWrapper(proWorkMilestone, req.getParameterMap());
|
|
|
+ queryWrapper.eq("del_flag", "0");
|
|
|
+ queryWrapper.orderByDesc("create_time");
|
|
|
+ Page<ProWorkMilestone> page = new Page<ProWorkMilestone>(pageNo, pageSize);
|
|
|
+ IPage<ProWorkMilestone> pageList = proWorkMilestoneService.page(page, queryWrapper);
|
|
|
result.setSuccess(true);
|
|
|
result.setResult(pageList);
|
|
|
return result;
|
|
@@ -85,51 +77,17 @@ import com.alibaba.fastjson.JSON;
|
|
|
@ApiImplicitParam(name="mileId", value="里程碑id",required=true, dataType="String"),
|
|
|
@ApiImplicitParam(name="mileName", value="里程碑(计划)",required=true, dataType="String"),
|
|
|
@ApiImplicitParam(name="mileId", value="里程碑确认(0,未确认 1,确认)",required=true, dataType="String"),
|
|
|
- @ApiImplicitParam(name="mileId", value="里程碑id",required=true, dataType="String"),
|
|
|
- @ApiImplicitParam(name="mileId", value="里程碑id",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="confirmTime", value="确认时间",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="content", value="工作内容",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="duration", value="工作时长",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="updateFileId", value="文件id",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="currentUser", value="填写人(当前用户)",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="content", value="工作内容",required=true, dataType="String"),
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
})
|
|
|
@PostMapping(value = "/add")
|
|
|
- public Result<proWorkMilestone> add(@RequestBody proWorkMilestone proWorkMilestone, BindingResult bindingResult) {
|
|
|
- Result<proWorkMilestone> result = new Result<proWorkMilestone>();
|
|
|
+ public Result<ProWorkMilestone> add(@RequestBody ProWorkMilestoneAddReqDTO reqDTO, BindingResult bindingResult) {
|
|
|
+ Result<ProWorkMilestone> result = new Result<ProWorkMilestone>();
|
|
|
try {
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
if (bindingResult.hasErrors()){
|
|
@@ -138,7 +96,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
result.error500(sb.toString());
|
|
|
return result;
|
|
|
}
|
|
|
- proWorkMilestoneService.save(proWorkMilestone);
|
|
|
+ proWorkMilestoneService.add(reqDTO);
|
|
|
result.success("添加成功!");
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -147,21 +105,37 @@ import com.alibaba.fastjson.JSON;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- * 编辑
|
|
|
- * @param proWorkMilestone
|
|
|
- * @return
|
|
|
- */
|
|
|
+
|
|
|
+ @ApiOperation(value = "编辑", notes = "里程碑确认单编辑")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="id", value="id",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="pkOrg", value="组织",required=false, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="billcode", value="单据编号",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="type", value="1.开发 2.实施 3.服务",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="proId", value="项目档案id",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="proCode", value="项目档案编码",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="proName", value="项目档案名称",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="cusId", value="客户档案id",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="cusCode", value="客户编码",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="mileId", value="里程碑id",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="mileName", value="里程碑(计划)",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="mileId", value="里程碑确认(0,未确认 1,确认)",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="confirmTime", value="确认时间",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="content", value="工作内容",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="duration", value="工作时长",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="updateFileId", value="文件id",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="currentUser", value="填写人(当前用户)",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="content", value="工作内容",required=true, dataType="String"),
|
|
|
+
|
|
|
+ })
|
|
|
@PutMapping(value = "/edit")
|
|
|
- public Result<proWorkMilestone> edit(@RequestBody proWorkMilestone proWorkMilestone) {
|
|
|
- Result<proWorkMilestone> result = new Result<proWorkMilestone>();
|
|
|
- proWorkMilestone proWorkMilestoneEntity = proWorkMilestoneService.getById(proWorkMilestone.getId());
|
|
|
+ public Result<ProWorkMilestone> edit(@RequestBody ProWorkMilestoneAddReqDTO reqDTO) {
|
|
|
+ Result<ProWorkMilestone> result = new Result<ProWorkMilestone>();
|
|
|
+ ProWorkMilestone proWorkMilestoneEntity = proWorkMilestoneService.getById(reqDTO.getId());
|
|
|
if(proWorkMilestoneEntity==null) {
|
|
|
result.error500("未找到对应实体");
|
|
|
}else {
|
|
|
- boolean ok = proWorkMilestoneService.updateById(proWorkMilestone);
|
|
|
-
|
|
|
+ boolean ok = proWorkMilestoneService.edit(reqDTO);
|
|
|
if(ok) {
|
|
|
result.success("修改成功!");
|
|
|
}
|
|
@@ -170,19 +144,18 @@ import com.alibaba.fastjson.JSON;
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- * 通过id删除
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
+ @ApiOperation(value = "通过id删除", notes = "通过id删除主子表")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="id", value="id",required=true, dataType="String"),
|
|
|
+ })
|
|
|
@DeleteMapping(value = "/delete")
|
|
|
- public Result<proWorkMilestone> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
- Result<proWorkMilestone> result = new Result<proWorkMilestone>();
|
|
|
- proWorkMilestone proWorkMilestone = proWorkMilestoneService.getById(id);
|
|
|
+ public Result<ProWorkMilestone> delete(@RequestBody ProWorkMilestoneReqDTO reqDTO) {
|
|
|
+ Result<ProWorkMilestone> result = new Result<ProWorkMilestone>();
|
|
|
+ ProWorkMilestone proWorkMilestone = proWorkMilestoneService.getById(reqDTO.getId());
|
|
|
if(proWorkMilestone==null) {
|
|
|
result.error500("未找到对应实体");
|
|
|
}else {
|
|
|
- boolean ok = proWorkMilestoneService.removeById(id);
|
|
|
+ boolean ok = proWorkMilestoneService.dropById(proWorkMilestone);
|
|
|
if(ok) {
|
|
|
result.success("删除成功!");
|
|
|
}
|
|
@@ -190,33 +163,16 @@ import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- * 批量删除
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @DeleteMapping(value = "/deleteBatch")
|
|
|
- public Result<proWorkMilestone> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
- Result<proWorkMilestone> result = new Result<proWorkMilestone>();
|
|
|
- if(ids==null || "".equals(ids.trim())) {
|
|
|
- result.error500("参数不识别!");
|
|
|
- }else {
|
|
|
- this.proWorkMilestoneService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
- result.success("删除成功!");
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- * 通过id查询
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "通过id查询", notes = "通过id查询主子表")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="id", value="id",required=true, dataType="String"),
|
|
|
+ })
|
|
|
@GetMapping(value = "/queryById")
|
|
|
- public Result<proWorkMilestone> queryById(@RequestParam(name="id",required=true) String id) {
|
|
|
- Result<proWorkMilestone> result = new Result<proWorkMilestone>();
|
|
|
- proWorkMilestone proWorkMilestone = proWorkMilestoneService.getById(id);
|
|
|
+ public Result<ProWorkMilestoneRespDTO> queryById(ProWorkMilestoneReqDTO reqDTO) {
|
|
|
+ Result<ProWorkMilestoneRespDTO> result = new Result<ProWorkMilestoneRespDTO>();
|
|
|
+ ProWorkMilestoneRespDTO proWorkMilestone = proWorkMilestoneService.queryById(reqDTO.getId());
|
|
|
if(proWorkMilestone==null) {
|
|
|
result.error500("未找到对应实体");
|
|
|
}else {
|
|
@@ -225,74 +181,4 @@ import com.alibaba.fastjson.JSON;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- * 导出excel
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param response
|
|
|
- */
|
|
|
- @RequestMapping(value = "/exportXls")
|
|
|
- public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
|
|
|
-
|
|
|
- QueryWrapper<proWorkMilestone> queryWrapper = null;
|
|
|
- try {
|
|
|
- String paramsStr = request.getParameter("paramsStr");
|
|
|
- if (oConvertUtils.isNotEmpty(paramsStr)) {
|
|
|
- String deString = URLDecoder.decode(paramsStr, "UTF-8");
|
|
|
- proWorkMilestone proWorkMilestone = JSON.parseObject(deString, proWorkMilestone.class);
|
|
|
- queryWrapper = QueryGenerator.initQueryWrapper(proWorkMilestone, request.getParameterMap());
|
|
|
- }
|
|
|
- } catch (UnsupportedEncodingException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
- List<proWorkMilestone> pageList = proWorkMilestoneService.list(queryWrapper);
|
|
|
-
|
|
|
- mv.addObject(NormalExcelConstants.FILE_NAME, "项目工作--里程碑确认单列表");
|
|
|
- mv.addObject(NormalExcelConstants.CLASS, proWorkMilestone.class);
|
|
|
- mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("项目工作--里程碑确认单列表数据", "导出人:Jeecg", "导出信息"));
|
|
|
- mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
|
|
- return mv;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- * 通过excel导入数据
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param response
|
|
|
- * @return
|
|
|
- */
|
|
|
- @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<proWorkMilestone> listproWorkMilestones = ExcelImportUtil.importExcel(file.getInputStream(), proWorkMilestone.class, params);
|
|
|
- for (proWorkMilestone proWorkMilestoneExcel : listproWorkMilestones) {
|
|
|
- proWorkMilestoneService.save(proWorkMilestoneExcel);
|
|
|
- }
|
|
|
- return Result.ok("文件导入成功!数据行数:" + listproWorkMilestones.size());
|
|
|
- } catch (Exception e) {
|
|
|
- log.error(e.getMessage());
|
|
|
- return Result.error("文件导入失败!");
|
|
|
- } finally {
|
|
|
- try {
|
|
|
- file.getInputStream().close();
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return Result.ok("文件导入失败!");
|
|
|
- }
|
|
|
-
|
|
|
}
|