标准比对 以及产品规划部 批量关闭 加导出
This commit is contained in:
+42
-2
@@ -8,6 +8,8 @@ import com.adc.da.slrs.sarStandUnqualified.entity.ProductDeptIssue;
|
||||
import com.adc.da.slrs.sarStandUnqualified.entity.ProductDeptIssueVo;
|
||||
import com.adc.da.slrs.sarStandUnqualified.service.IBusinessDeptIssueService;
|
||||
import com.adc.da.slrs.sarStandUnqualified.service.IProductDeptIssueService;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -15,6 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -64,8 +69,6 @@ public class ProductDeptIssueController {
|
||||
boolean b = iProductDeptIssueService.updateProductDeptIssue(issue);
|
||||
return Result.success(b);
|
||||
}
|
||||
// 多态对接口具有可替换性接口 灵活性简化性易拓展 可替换的概念可以理解伟方法可以被同类重用
|
||||
// 可扩充性可以理解为该方法可以添加子类而不影响现有代码,接口性就是指的是向子类提供一个公用的高级接口子类来集成完善这个接口中的方法来实现要求。
|
||||
|
||||
@PostMapping("/closeProductIssue")
|
||||
@ApiOperation("关闭产品规划部重点问题")
|
||||
@@ -75,4 +78,41 @@ public class ProductDeptIssueController {
|
||||
|
||||
return Result.success(b);
|
||||
}
|
||||
|
||||
@GetMapping("/exportIssue")
|
||||
@ApiOperation("导出产品规划部重点问题")
|
||||
public void exportIssue(HttpServletResponse response, ProductDeptIssueVo issue ) throws IOException {
|
||||
try {
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
|
||||
if(issue.getFileName()==null || issue.getFileName()==""){
|
||||
issue.setFileName("事业部重点问题信息");
|
||||
}
|
||||
String fileName = URLEncoder.encode(issue.getFileName(), "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
|
||||
/**
|
||||
* 重写了get方法,无法使用net.sf.json.JSONObject转换对象
|
||||
*/
|
||||
// net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(issue.getExportContent());
|
||||
// BusinessDeptIssueVo businessDeptIssueVo = (BusinessDeptIssueVo) net.sf.json.JSONObject.toBean(jsonObject, BusinessDeptIssueVo.class);
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(issue.getExportContent());
|
||||
ProductDeptIssueVo businessDeptIssueVo = JSONObject.toJavaObject(jsonObject, ProductDeptIssueVo.class);
|
||||
List<ProductDeptIssue> page = iProductDeptIssueService.getExportData(businessDeptIssueVo,businessDeptIssueVo.getIdList());
|
||||
|
||||
|
||||
// 这里需要设置不关闭流
|
||||
EasyExcel.write(response.getOutputStream(), BusinessDeptIssue.class).autoCloseStream(Boolean.FALSE).sheet("sheet1")
|
||||
.doWrite(page);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
// 重置response
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.getWriter().println(JSONObject.toJSONString(Result.error()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -10,8 +10,10 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProductDeptIssueDao extends BaseMapper<ProductDeptIssue> {
|
||||
|
||||
public IPage<ProductDeptIssue> findPage1(IPage<ProductDeptIssue> page,@Param(Constants.WRAPPER) QueryWrapper<ProductDeptIssue> wrapper);
|
||||
public IPage<ProductDeptIssue> findPage(IPage<ProductDeptIssue> page, @Param("ew") ProductDeptIssueVo objVo);
|
||||
public List<ProductDeptIssue> findExportData(@Param("ew") ProductDeptIssueVo objVo, @Param("ids") List<String> ids);
|
||||
}
|
||||
|
||||
+22
@@ -1,4 +1,26 @@
|
||||
package com.adc.da.slrs.sarStandUnqualified.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ProductDeptIssueVo extends ProductDeptIssue {
|
||||
|
||||
private String numberOrName;
|
||||
|
||||
private String fileName;
|
||||
|
||||
private String idList;
|
||||
|
||||
private String exportContent;
|
||||
|
||||
public List<String> getIdList(){
|
||||
if (this.idList!=null){
|
||||
return Arrays.asList(this.idList.split(","));
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -16,6 +16,8 @@ public interface IProductDeptIssueService extends IService<ProductDeptIssue> {
|
||||
|
||||
public IPage<ProductDeptIssue> getProductDeptIssue(ProductDeptIssueVo objVo);
|
||||
|
||||
public List<ProductDeptIssue> getExportData(ProductDeptIssueVo objVo,List<String> ids);
|
||||
|
||||
public boolean updateProductDeptIssue(ProductDeptIssue obj);
|
||||
|
||||
public boolean closeProductDeptIssue(List<String> idList);
|
||||
|
||||
+6
@@ -64,6 +64,12 @@ public class ProductDeptIssueService extends ServiceImpl<ProductDeptIssueDao,Pro
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductDeptIssue> getExportData(ProductDeptIssueVo objVo, List<String> ids) {
|
||||
|
||||
return productDeptIssueDao.findExportData(objVo,ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateProductDeptIssue(ProductDeptIssue obj) {
|
||||
|
||||
|
||||
+4
@@ -247,6 +247,10 @@ public class SarStandCompareHisEOServiceImpl implements SarStandCompareHisEOServ
|
||||
sarStandCompareHisEO.setId(standHisId);
|
||||
sarStandCompareHisEO.setCompareStatus("比对完成");
|
||||
sarStandCompareHisEODao.updateByPrimaryKeySelective(sarStandCompareHisEO);
|
||||
if (oldList.size()==0 || newList.size()==0){
|
||||
resultMap.put("error","比对数据已删除");
|
||||
}
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user