标准预警

This commit is contained in:
zj
2021-06-05 11:23:41 +08:00
parent b8dc259f15
commit 56b9c1bb24
5 changed files with 342 additions and 0 deletions
@@ -0,0 +1,94 @@
package com.adc.da.slrs.sarStandWarning.controller;
import com.adc.da.base.web.BaseController;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.adc.da.slrs.sarStandWarning.service.Impl.EarlyWarningEOServiceImpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/${restPath}/sys/EarlyWarning")
@Api(tags = "标准预警")
public class EarlyWarningEOController extends BaseController<EarlyWarningEO> {
@Resource
private EarlyWarningEOServiceImpl earlyWarningEOService;
@GetMapping("/StandWarning")
@ApiOperation("分页查询标准预警")
public ResponseMessage newPageInfo(@RequestParam(defaultValue = "1", value = "current1")int current1, @RequestParam(defaultValue = "10", value = "pageSize1") int pageSize1,
@RequestParam(defaultValue = "1", value = "current2")int current2, @RequestParam(defaultValue = "10", value = "pageSize2") int pageSize2,
@RequestParam(defaultValue = "1", value = "current3")int current3, @RequestParam(defaultValue = "10", value = "pageSize3") int pageSize3,
@RequestParam(defaultValue = "1", value = "current4")int current4, @RequestParam(defaultValue = "10", value = "pageSize4") int pageSize4,String applyType) {
IPage<EarlyWarningEO> list1 = earlyWarningEOService.newQueryAll(current1,pageSize1,applyType);//新车标准预警
IPage<EarlyWarningEO> list2 = earlyWarningEOService.oldQueryAll(current2,pageSize2,applyType);//在产车标准预警
IPage<EarlyWarningEO> list3 = earlyWarningEOService.newItemsQueryAll(current3,pageSize3,applyType);//新车条款预警
IPage<EarlyWarningEO> list4 = earlyWarningEOService.oldItemsQueryAll(current4,pageSize4,applyType);//在产车条款预警
return getResponseMessage(list1, list2, list3, list4);
}
// @GetMapping("/queryStandByApplyType")
// @ApiOperation("分页根据适用车型查询标准预警")
// public ResponseMessage queryByApplyType(@RequestParam(defaultValue = "1", value = "current1")int current1, @RequestParam(defaultValue = "10", value = "pageSize1") int pageSize1,
// @RequestParam(defaultValue = "1", value = "current2")int current2, @RequestParam(defaultValue = "10", value = "pageSize2") int pageSize2,
// @RequestParam(defaultValue = "1", value = "current3")int current3, @RequestParam(defaultValue = "10", value = "pageSize3") int pageSize3,
// @RequestParam(defaultValue = "1", value = "current4")int current4, @RequestParam(defaultValue = "10", value = "pageSize4") int pageSize4,String applyType) {
//
// IPage<EarlyWarningEO> list1 = earlyWarningEOService.query1ByApplyType(current1,pageSize1,applyType);
// IPage<EarlyWarningEO> list2 = earlyWarningEOService.query2ByApplyType(current2,pageSize2,applyType);
// IPage<EarlyWarningEO> list3 = earlyWarningEOService.query3ByApplyType(current3,pageSize3,applyType);
// IPage<EarlyWarningEO> list4 = earlyWarningEOService.query4ByApplyType(current4,pageSize4,applyType);
// return getResponseMessage(list1, list2, list3, list4);
//
//
// }
private ResponseMessage getResponseMessage(IPage<EarlyWarningEO> list1, IPage<EarlyWarningEO> list2, IPage<EarlyWarningEO> list3, IPage<EarlyWarningEO> list4) {
List<Map<String, Object>> listMap = new ArrayList<Map<String,Object>>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("newStand", list1);
map.put("oldStand", list2);
map.put("newItems", list3);
map.put("oldItems", list4);
listMap .add(map);
return Result.success("200",listMap);
}
@GetMapping("/ChangePermissions")
@ApiOperation("更改权限")
public ResponseMessage ChangePermissions(String id) {
String power = earlyWarningEOService.ChangePermissions(id);
return Result.success("200",power);
}
@GetMapping("/PolicyWarning")
@ApiOperation("分页查询政策预警")
public ResponseMessage newPolicyPageInfo(@RequestParam(defaultValue = "1", value = "current1")int current1, @RequestParam(defaultValue = "10", value = "pageSize1") int pageSize1,
@RequestParam(defaultValue = "1", value = "current2")int current2, @RequestParam(defaultValue = "10", value = "pageSize2") int pageSize2) {
IPage<EarlyWarningEO> list1 = earlyWarningEOService.newPolicyQueryAll(current1,pageSize1);
IPage<EarlyWarningEO> list2 = earlyWarningEOService.oldPolicyQueryAll(current2,pageSize2);
List<Map<String, Object>> listMap = new ArrayList<Map<String,Object>>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("newPolicy", list1);
map.put("oldPolicy", list2);
System.out.println(map);
listMap .add(map);
System.out.println(listMap);
return Result.success("200",listMap);
}
}
@@ -0,0 +1,10 @@
package com.adc.da.slrs.sarStandWarning.dao;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface EarlyWarningEODao extends BaseMapper<EarlyWarningEO> {
}
@@ -0,0 +1,64 @@
package com.adc.da.slrs.sarStandWarning.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sar_stand_warning")
@ApiModel(value="SarStandWarning对象", description="")
public class EarlyWarningEO extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId("ID")
private String id;
@TableField("STAND_TYPE")
private String standType;
@TableField("STAND_CODE")
private String standCode;
@TableField("STAND_NAME")
private String standName;
@TableField("PUT_TIME")
private Date putTime;
@TableField("APPLY_TYPE")
private String applyType;
@TableField("DUTY_ENGINEER")
private String dutyEngineer;
@TableField("ITEMS_ID")
private String itemsId;
@TableField("ITEMS_NAME")
private String itemsName;
@TableField("POLICY_ID")
private String policyId;
@TableField("POLICY_NAME")
private String policyName;
@TableField("MARK")
private String mark;
@TableField("POWER")
private String power;
}
@@ -0,0 +1,26 @@
package com.adc.da.slrs.sarStandWarning.service;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
public interface EarlyWarningEOService extends IService<EarlyWarningEO> {
IPage<EarlyWarningEO> newQueryAll(int current,int pageSize,String applyType);
IPage<EarlyWarningEO> oldQueryAll(int current,int pageSize,String applyType);
IPage<EarlyWarningEO> newItemsQueryAll(int current,int pageSize,String applyType);
IPage<EarlyWarningEO> oldItemsQueryAll(int current,int pageSize,String applyType);
IPage<EarlyWarningEO> newPolicyQueryAll(int current,int pageSize);
IPage<EarlyWarningEO> oldPolicyQueryAll(int current,int pageSize);
// IPage<EarlyWarningEO> query1ByApplyType(int current, int pageSize, String applyType);
// IPage<EarlyWarningEO> query2ByApplyType(int current, int pageSize, String applyType);
// IPage<EarlyWarningEO> query3ByApplyType(int current, int pageSize, String applyType);
// IPage<EarlyWarningEO> query4ByApplyType(int current, int pageSize, String applyType);
String batchSave(List<EarlyWarningEO> earlyWarningEOS);
String ChangePermissions(String id);
}
@@ -0,0 +1,148 @@
package com.adc.da.slrs.sarStandWarning.service.Impl;
import com.adc.da.slrs.sarStandWarning.dao.EarlyWarningEODao;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.adc.da.slrs.sarStandWarning.service.EarlyWarningEOService;
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 org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service("EarlyWarningEOService")
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, EarlyWarningEO> implements EarlyWarningEOService {
@Resource
private EarlyWarningEODao earlyWarningEODao;
@Resource
private EarlyWarningEOServiceImpl earlyWarningEOService;
/**
mark:标识预警的种类
1:新车标准预警
2:在产车标准预警
3:新车条款预警
4:在产车条款预警
5:新车政策预警
6:在产车政策预警
*/
@Override
public IPage<EarlyWarningEO> newQueryAll(int current,int pageSize,String applyType){
QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
if (applyType!=null&&applyType.length()!=0){
wrapper.like("APPLY_TYPE",applyType);
}
wrapper.eq("mark",1);
return getEarlyWarningEOIPage(current, pageSize, wrapper);
}
@Override
public IPage<EarlyWarningEO> oldQueryAll(int current,int pageSize,String applyType){
QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
if (applyType!=null&&applyType.length()!=0){
wrapper.like("APPLY_TYPE",applyType);
}
wrapper.eq("mark",2);
return getEarlyWarningEOIPage(current, pageSize, wrapper);
}
@Override
public IPage<EarlyWarningEO> newItemsQueryAll(int current,int pageSize,String applyType){
QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
if (applyType!=null&&applyType.length()!=0){
wrapper.like("APPLY_TYPE",applyType);
}
wrapper.eq("mark",3);
return getEarlyWarningEOIPage(current, pageSize, wrapper);
}
@Override
public IPage<EarlyWarningEO> oldItemsQueryAll(int current,int pageSize,String applyType){
QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
if (applyType!=null&&applyType.length()!=0){
wrapper.like("APPLY_TYPE",applyType);
}
wrapper.eq("mark",4);
return getEarlyWarningEOIPage(current, pageSize, wrapper);
}
@Override
public IPage<EarlyWarningEO> newPolicyQueryAll(int current,int pageSize) {
QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
wrapper.eq("mark",5);
return getEarlyWarningEOIPage(current, pageSize, wrapper);
}
@Override
public IPage<EarlyWarningEO> oldPolicyQueryAll(int current,int pageSize) {
QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
wrapper.eq("mark",6);
return getEarlyWarningEOIPage(current, pageSize, wrapper);
}
// @Override
// public IPage<EarlyWarningEO> query1ByApplyType(int current, int pageSize, String applyType) {
// QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
//
// wrapper.like("APPLY_TYPE",applyType)
// .eq("mark",1);
// return getEarlyWarningEOIPage(current, pageSize, wrapper);
// }
// @Override
// public IPage<EarlyWarningEO> query2ByApplyType(int current, int pageSize, String applyType) {
// QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
// wrapper.like("APPLY_TYPE",applyType)
// .eq("mark",2);
// return getEarlyWarningEOIPage(current, pageSize, wrapper);
// }
// @Override
// public IPage<EarlyWarningEO> query3ByApplyType(int current, int pageSize, String applyType) {
// QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
// wrapper.like("APPLY_TYPE",applyType)
// .eq("mark",3);
// return getEarlyWarningEOIPage(current, pageSize, wrapper);
// }
// @Override
// public IPage<EarlyWarningEO> query4ByApplyType(int current, int pageSize, String applyType) {
// QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
// wrapper.like("APPLY_TYPE",applyType)
// .eq("mark",4);
// return getEarlyWarningEOIPage(current, pageSize, wrapper);
// }
//批量插入
@Override
public String batchSave(List<EarlyWarningEO> earlyWarningEOS) {
boolean a = earlyWarningEOService.saveBatch(earlyWarningEOS);
return a?"插入成功":"插入失败";
}
@Override
public String ChangePermissions(String id) {
try {
QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
EarlyWarningEO earlyWarningEO =earlyWarningEODao.selectById(id);
earlyWarningEO.setPower("0");
earlyWarningEODao.updateById(earlyWarningEO);
}catch (Exception e){
e.printStackTrace();
return "false";
}
return "成功";
}
private IPage<EarlyWarningEO> getEarlyWarningEOIPage(int current,int pageSize, QueryWrapper<EarlyWarningEO> wrapper) {
wrapper.eq("power",1);
Page<EarlyWarningEO> page = new Page<>(current, pageSize);
IPage<EarlyWarningEO> userIPage = earlyWarningEODao.selectPage(page, wrapper);
System.out.println("总条数"+userIPage.getTotal());
System.out.println("总页数"+userIPage.getPages());
return userIPage;
}
}