bug修复
This commit is contained in:
parent
3bd1682a99
commit
1bae32285f
@ -104,9 +104,10 @@ public class PoisonousGasDevCurrentDataController {
|
||||
@ApiOperation(value = " 添加有毒气体-数据信息", notes = "添加有毒气体-数据信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<PoisonousGasDevCurrentData> add(@RequestBody PoisonousGasDevCurrentData poisonousGasDevCurrentData) {
|
||||
log.info("添加有毒气体-数据信息:{}", JSON.toJSONString(poisonousGasDevCurrentData));
|
||||
Result<PoisonousGasDevCurrentData> result = new Result<PoisonousGasDevCurrentData>();
|
||||
try {
|
||||
poisonousGasDevCurrentDataService.save(poisonousGasDevCurrentData);
|
||||
poisonousGasDevCurrentDataService.add(poisonousGasDevCurrentData);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@ -24,4 +24,6 @@ public interface IPoisonousGasDevCurrentDataService extends IService<PoisonousGa
|
||||
ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, PoisonousGasDevCurrentData poisonousGasDevCurrentData);
|
||||
|
||||
IPage<PoisonousGasDevCurrentData> queryPageList(PoisonousGasDevCurrentData poisonousGasDevCurrentData, Integer pageNo, Integer pageSize, HttpServletRequest req);
|
||||
|
||||
void add(PoisonousGasDevCurrentData poisonousGasDevCurrentData);
|
||||
}
|
||||
|
||||
@ -6,6 +6,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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.poisonous.entity.PoisonousGasDev;
|
||||
import com.zhgd.xmgl.modules.poisonous.entity.PoisonousGasDevAlarm;
|
||||
@ -178,6 +179,18 @@ public class PoisonousGasDevCurrentDataServiceImpl extends ServiceImpl<Poisonous
|
||||
return poisonousGasDevCurrentDataMapper.queryPageList(page, queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(PoisonousGasDevCurrentData poisonousGasDevCurrentData) {
|
||||
PoisonousGasDev poisonousGasDev = poisonousGasDevMapper.selectOne(new LambdaQueryWrapper<PoisonousGasDev>().eq(PoisonousGasDev::getDevSn, poisonousGasDevCurrentData.getDevSn()));
|
||||
if (poisonousGasDev == null) {
|
||||
throw new OpenAlertException("设备sn不存在");
|
||||
}
|
||||
poisonousGasDevCurrentData.setDevName(poisonousGasDev.getDevName());
|
||||
poisonousGasDevCurrentData.setProjectSn(poisonousGasDev.getProjectSn());
|
||||
poisonousGasDevCurrentData.setLocation(poisonousGasDev.getLocation());
|
||||
save(poisonousGasDevCurrentData);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private QueryWrapper<PoisonousGasDevCurrentData> getPoisonousGasDevCurrentDataQueryWrapper(PoisonousGasDevCurrentData poisonousGasDevCurrentData, HttpServletRequest req) {
|
||||
String defaultAlias = "pgdcd.";
|
||||
|
||||
@ -6,18 +6,23 @@ import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.quality.entity.DangerTypeRecord;
|
||||
import com.zhgd.xmgl.modules.quality.service.IDangerItemRecordService;
|
||||
import com.zhgd.xmgl.modules.quality.service.IDangerTypeRecordService;
|
||||
import com.zhgd.xmgl.util.ExcelUtils;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -167,7 +172,18 @@ public class DangerTypeRecordController {
|
||||
@ApiOperation(value = "质量检查模板导入下载", notes = "质量检查模板导入下载")
|
||||
@GetMapping("/downloadDangerTypeRecordExcelTemplate")
|
||||
public void downloadDangerTypeRecordExcelTemplate(HttpServletResponse response) {
|
||||
ExcelUtils.downloadDangerTypeRecordExcelTemplate(response);
|
||||
try {
|
||||
OutputStream out = response.getOutputStream();
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/vnd.ms-excel;charset=gb2312");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("质量检查模板_导入模板.xlsx", "UTF-8"));
|
||||
InputStream fis = new ClassPathResource("excel/质量检查模板_导入模板.xlsx").getInputStream();
|
||||
IOUtils.copy(fis, out);
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -236,6 +236,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.antMatchers("/xmgl/callback/ammeter/status").permitAll()
|
||||
.antMatchers("/xmgl/electricalData/add").permitAll()
|
||||
.antMatchers("/xmgl/upload/getRenameFile").permitAll()
|
||||
.antMatchers("/xmgl/poisonousGasDevCurrentData/add").permitAll()
|
||||
.antMatchers(HttpMethod.OPTIONS, "/**").anonymous()
|
||||
.anyRequest().authenticated() // 剩下所有的验证都需要验证
|
||||
.and()
|
||||
|
||||
@ -221,17 +221,6 @@ public class ExcelUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void downloadDangerTypeRecordExcelTemplate(HttpServletResponse response) {
|
||||
try {
|
||||
ClassPathResource classPathResource = new ClassPathResource("excel/质量检查模板_导入模板.xlsx");
|
||||
InputStream inputStream = classPathResource.getInputStream();
|
||||
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
|
||||
downLoadExcel("质量检查模板_导入模板.xlsx", response, workbook);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void exporExcelWorkerTemplate(HttpServletResponse response, List<EntityMap> teamList, List<EntityMap> departmentList) {
|
||||
try {
|
||||
ClassPathResource classPathResource = new ClassPathResource("excel/人员导入模板.xlsx");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user