|
@@ -1,527 +0,0 @@
|
|
|
-package com.zglc.kg.service;
|
|
|
-
|
|
|
-import com.zglc.kg.dao.AircraftDao;
|
|
|
-import com.zglc.kg.entity.*;
|
|
|
-import com.zglc.kg.dao.FaultRecordDao;
|
|
|
-import com.zglc.kg.utils.ExcelUtils;
|
|
|
-import org.apache.poi.ss.usermodel.Sheet;
|
|
|
-import org.apache.poi.ss.usermodel.Workbook;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import com.zglc.kg.base.Result;
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
-import tk.mybatis.mapper.entity.Example;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
-
|
|
|
-@Service
|
|
|
-public class FaultRecordService {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private FaultRecordDao faultRecordDao;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private AircraftDao aircraftDao;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private RepairManualService repairManualService;
|
|
|
-
|
|
|
-
|
|
|
- public List<FaultRecordEntity> getAllFaultRecord() {
|
|
|
- return faultRecordDao.selectAll();
|
|
|
- }
|
|
|
-
|
|
|
- public List<FaultRecordEntity> listAll() {
|
|
|
- return faultRecordDao.listAll();
|
|
|
- }
|
|
|
-
|
|
|
- //关于统计排序,先获取机型的记录数量和每一个机型的故障件记录数量
|
|
|
- //当要导出记录要,从数据库中获取每一个机型排序后的数据,然后再根据上面故障件统计的排序对数据再次排序
|
|
|
- //数据库中排序后的结果没有对机型进行数据量排序,但已经进行了初步排序
|
|
|
-
|
|
|
- public FaultRecordEntity getFaultRecord(Integer id) {
|
|
|
- return faultRecordDao.selectByPrimaryKey(id);
|
|
|
- }
|
|
|
-
|
|
|
- public Integer getCount() {
|
|
|
- return faultRecordDao.getCount();
|
|
|
- }
|
|
|
-
|
|
|
- public Result<String> add(FaultRecordEntity data) {
|
|
|
- data.setId(null);
|
|
|
- boolean flag = true;
|
|
|
- String msg = "";
|
|
|
- int index = faultRecordDao.insertSelective(data);
|
|
|
- if (index == 0) {
|
|
|
- flag = false;
|
|
|
- msg = "添加故障记录失败!";
|
|
|
- } else {
|
|
|
- msg = "添加故障记录成功!";
|
|
|
- }
|
|
|
-
|
|
|
- return Result.result(flag, msg, msg);
|
|
|
- }
|
|
|
-
|
|
|
- public Result<String> delete(List<Integer> ids) {
|
|
|
- boolean flag = true;
|
|
|
- String msg = "";
|
|
|
- Iterator iter = ids.iterator();
|
|
|
- while (iter.hasNext()) {
|
|
|
- Integer id = (Integer) iter.next();
|
|
|
- int index = faultRecordDao.deleteByPrimaryKey(id);
|
|
|
- if (index == 0) {
|
|
|
- flag = false;
|
|
|
- msg += "故障记录删除失败!" + id + ";";
|
|
|
- } else {
|
|
|
- msg += "故障记录删除成功!" + id + ";";
|
|
|
- }
|
|
|
- }
|
|
|
- return Result.result(flag, msg, msg);
|
|
|
- }
|
|
|
-
|
|
|
- public Result<String> edit(FaultRecordEntity data) {
|
|
|
- boolean flag = true;
|
|
|
- String msg = "";
|
|
|
- FaultRecordEntity tmpData = faultRecordDao.selectByPrimaryKey(data.getId());
|
|
|
- if (tmpData != null) {
|
|
|
- int index = faultRecordDao.updateByPrimaryKeySelective(data);
|
|
|
- if (index == 0) {
|
|
|
- flag = false;
|
|
|
- msg = "故障记录修改失败";
|
|
|
- } else {
|
|
|
- msg = "故障记录修改成功";
|
|
|
- }
|
|
|
- } else {
|
|
|
- flag = false;
|
|
|
- msg = "故障记录不存在!";
|
|
|
- }
|
|
|
- return Result.result(flag, msg, msg);
|
|
|
- }
|
|
|
-
|
|
|
- public Result<List<FaultRecordEntity>> findByName(String name) {
|
|
|
- if (name == null || "".equals(name)) {
|
|
|
- return Result.result(false, "名称不能为空!", null);
|
|
|
- }
|
|
|
- List<FaultRecordEntity> list = faultRecordDao.findByName("%" + name + "%");
|
|
|
- return Result.success(list);
|
|
|
- }
|
|
|
-
|
|
|
- public Result<List<FaultRecordEntity>> refindByName(String name1,String name2){
|
|
|
- if (name1==null || "".equals(name1)){
|
|
|
- return Result.result(false, "名称不能为空", null);
|
|
|
- }
|
|
|
- List<FaultRecordEntity> list = faultRecordDao.refindByName("%" + name1 + "%","%" + name2 + "%");
|
|
|
- return Result.success(list);
|
|
|
- }
|
|
|
-
|
|
|
- public Result<Map<Object,Object>> statistics(FaultRecordStatistics faultRecordStatistics) {
|
|
|
-
|
|
|
- return Result.success(statisCal(faultRecordStatistics));
|
|
|
- }
|
|
|
-
|
|
|
- private Map<Object,Object> statisCal(FaultRecordStatistics faultRecordStatistics) {
|
|
|
- List<Map<String, Object>> list = faultRecordDao.findAllDevice(faultRecordStatistics.getAircarftId());
|
|
|
- Map<Object,Object> result = new HashMap<>();
|
|
|
- Map params = new HashMap<>();
|
|
|
- params.put("aircraftId", faultRecordStatistics.getAircarftId());
|
|
|
- for (Map<String, Object> m : list) {
|
|
|
- Map<String, Integer> res = new LinkedHashMap<>();
|
|
|
- params.put("device",m.get("id").toString());
|
|
|
- for (int year = faultRecordStatistics.getStartyear(); year <= faultRecordStatistics.getEndyear(); year++) {
|
|
|
- if ("month".equals(faultRecordStatistics.getType())) {
|
|
|
- for (int month = 0; month <= 11; month++) {
|
|
|
- Date start = null;
|
|
|
- Date end = null;
|
|
|
- start = new Date(year - 1900, month, 1);
|
|
|
- if (month == 0 || month == 2 || month == 4 || month == 6 || month == 7 || month == 9 || month == 11) {
|
|
|
- end = new Date(year - 1900, month, 31, 23, 59, 59);
|
|
|
- }
|
|
|
- if (month == 1) {
|
|
|
- end = new Date(year - 1900, month, 28, 23, 59, 59);
|
|
|
- }else {
|
|
|
- end = new Date(year - 1900, month, 30, 23, 59, 59);
|
|
|
- }
|
|
|
- params.put("startTime", start);
|
|
|
- params.put("endTime", end);
|
|
|
-
|
|
|
- Integer count = faultRecordDao.statistics(params);
|
|
|
- res.put(year + "." + (month + 1), count);
|
|
|
- }
|
|
|
- }
|
|
|
- if ("quarter".equals(faultRecordStatistics.getType())){
|
|
|
- for (int i = 1;i<=4;i++){
|
|
|
- Date start = new Date(year - 1900, 3*(i-1), 1);
|
|
|
- Date end = null;
|
|
|
- if (i == 1||i==4){
|
|
|
- end = new Date(year-1900,3*i-1,31,23,59,59);
|
|
|
- }else {
|
|
|
- end = new Date(year-1900,3*i-1,30,23,59,59);
|
|
|
- }
|
|
|
- params.put("startTime", start);
|
|
|
- params.put("endTime", end);
|
|
|
- Integer count = faultRecordDao.statistics(params);
|
|
|
- res.put(year + "." + i, count);
|
|
|
- }
|
|
|
- }
|
|
|
- if ("year".equals(faultRecordStatistics.getType())){
|
|
|
- Date start = new Date(year - 1900, 0, 1);
|
|
|
- Date end = new Date(year - 1900, 11, 31,23,59,59);
|
|
|
- params.put("startTime", start);
|
|
|
- params.put("endTime", end);
|
|
|
- Integer count = faultRecordDao.statistics(params);
|
|
|
- res.put(year+"", count);
|
|
|
- }
|
|
|
- }
|
|
|
- result.put(m.get("device_name"), res);
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- public Result<List<FaultRecordEntity>> faultFind(FaultFind faultFind) {
|
|
|
- List<FaultRecordEntity> list = faultRecordDao.faultFind(faultFind);
|
|
|
- return Result.success(list);
|
|
|
- }
|
|
|
-
|
|
|
- public Result<List<FaultRecordEntity>> faultSta(FaultFind faultFind) {
|
|
|
- List<FaultRecordEntity> list = faultRecordDao.faultsta(faultFind);
|
|
|
- return Result.success(list);
|
|
|
- }
|
|
|
-
|
|
|
- public List<FaultRecordEntity> faultSta1(Date startTime, Date endTime, String name) {
|
|
|
- return faultRecordDao.faultsta1(startTime,endTime,name);
|
|
|
- }
|
|
|
-
|
|
|
- public List<StatisticEntity> systemSta(Date startTime, Date endTime) {
|
|
|
- return faultRecordDao.staBySystem(startTime,endTime);
|
|
|
- }
|
|
|
-
|
|
|
- public Boolean getExcelContext(MultipartFile file){
|
|
|
- Workbook wb = ExcelUtils.readExcel(file);
|
|
|
- Sheet sheet = ExcelUtils.getSheet(wb, "sheet1");
|
|
|
- Map<String, Integer> heads = ExcelUtils.getHeads(sheet);
|
|
|
-
|
|
|
- List<FaultRecordEntity> list = new ArrayList<>();
|
|
|
- for(int i = 1; i<= sheet.getLastRowNum(); i++) {
|
|
|
- System.out.println("current import record row: " + i+1);
|
|
|
- boolean flag1 = false;
|
|
|
- boolean flag2 = false;
|
|
|
- FaultRecordEntity fault = new FaultRecordEntity();
|
|
|
- fault.setFault_time(ExcelUtils.getDateValue(sheet,i,heads.get("发现日期")));
|
|
|
- fault.setAircraft_type(ExcelUtils.getCeilValue(sheet,i,heads.get("机型")));
|
|
|
- if (fault.getAircraft_type().isEmpty() || fault.getAircraft_type() == null)
|
|
|
- flag1 = true;
|
|
|
- if (ExcelUtils.getCeilValue(sheet,i,heads.get("机型")) != null) {
|
|
|
- AircraftEntity aircraft = new AircraftEntity();
|
|
|
- aircraft.setAircraft_type(ExcelUtils.getCeilValue(sheet,i,heads.get("机型")));
|
|
|
- SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
|
|
|
- aircraft.setInput_time(date.format(new Date()));
|
|
|
- aircraftDao.addNotExist(aircraft);
|
|
|
- }
|
|
|
- if ( fault.getAircraft_no() == null || fault.getAircraft_no().isEmpty())
|
|
|
- flag2 = true;
|
|
|
- if (flag1 & flag2) continue;
|
|
|
- fault.setAircraft_no(ExcelUtils.getCeilValue(sheet,i,heads.get("飞机号")));
|
|
|
- fault.setProduct_no(ExcelUtils.getCeilValue(sheet,i,heads.get("出厂号")));
|
|
|
- fault.setMajor(ExcelUtils.getCeilValue(sheet,i,heads.get("专业")));
|
|
|
- fault.setFaultparts_system(ExcelUtils.getCeilValue(sheet,i,heads.get("故障件所属系统")));
|
|
|
- fault.setDevice_name(ExcelUtils.getCeilValue(sheet,i,heads.get("故障件名称")));
|
|
|
- fault.setDevice_type(ExcelUtils.getCeilValue(sheet,i,heads.get("故障件型别")));
|
|
|
- fault.setInfo_sources(ExcelUtils.getCeilValue(sheet,i,heads.get("故障信息来源")));
|
|
|
- fault.setFault_content(ExcelUtils.getCeilValue(sheet,i,heads.get("故障描述")));
|
|
|
- fault.setFault_reason(ExcelUtils.getCeilValue(sheet,i,heads.get("故障原因")));
|
|
|
- fault.setDiscover_opportunity(ExcelUtils.getCeilValue(sheet,i,heads.get("发现时机")));
|
|
|
- fault.setDiagnosis_method(ExcelUtils.getCeilValue(sheet,i,heads.get("故障判断方法")));
|
|
|
- fault.setRepair_method(ExcelUtils.getCeilValue(sheet,i,heads.get("排除方法")));
|
|
|
- fault.setWar_zone(ExcelUtils.getCeilValue(sheet,i,heads.get("战区")));
|
|
|
- fault.setArmy(ExcelUtils.getCeilValue(sheet,i,heads.get("军")));
|
|
|
- fault.setDivision(ExcelUtils.getCeilValue(sheet,i,heads.get("师")));
|
|
|
- fault.setBrigade(ExcelUtils.getCeilValue(sheet,i,heads.get("团")));
|
|
|
- String tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("起落"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setUp_down(Integer.parseInt(ExcelUtils.getCeilValue(sheet,i,heads.get("起落"))));
|
|
|
- }
|
|
|
- fault.setDiscoverer(ExcelUtils.getCeilValue(sheet,i,heads.get("发现人")));
|
|
|
- fault.setIs_falsealarm(ExcelUtils.getCeilValue(sheet,i,heads.get("是否虚警")));
|
|
|
- fault.setFault_degree(ExcelUtils.getCeilValue(sheet,i,heads.get("故障性质")));
|
|
|
- fault.setFault_consequence(ExcelUtils.getCeilValue(sheet,i,heads.get("故障后果")));
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("误飞次数"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setMissflight_times(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("误飞次数"))));
|
|
|
- }
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("影响次数"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setImpact_times(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("影响次数"))));
|
|
|
- }
|
|
|
- fault.setDevice_productor(ExcelUtils.getCeilValue(sheet,i,heads.get("故障件制造厂")));
|
|
|
- fault.setDevice_no(ExcelUtils.getCeilValue(sheet,i,heads.get("故障件号码")));
|
|
|
- fault.setFault_liability(ExcelUtils.getCeilValue(sheet,i,heads.get("故障责任")));
|
|
|
- fault.setFault_location(ExcelUtils.getCeilValue(sheet,i,heads.get("故障发生地点")));
|
|
|
- fault.setReviewer(ExcelUtils.getCeilValue(sheet,i,heads.get("审核人")));
|
|
|
- fault.setReview_time(ExcelUtils.getDateValue(sheet,i,heads.get("审核时间")));
|
|
|
- fault.setRepair_time(ExcelUtils.getDateValue(sheet,i,heads.get("排除时间")));
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("排故工时"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setRepair_hours(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("排故工时"))));
|
|
|
- }
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("排故人数"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setRepair_peoplenum(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("排故人数"))));
|
|
|
- }
|
|
|
- fault.setRepaired_time(ExcelUtils.getDateValue(sheet,i,heads.get("排故时间")));
|
|
|
- fault.setClassification(ExcelUtils.getCeilValue(sheet,i,heads.get("分类")));
|
|
|
- fault.setIs_grounded(ExcelUtils.getCeilValue(sheet,i,heads.get("是否停飞")));
|
|
|
- fault.setReporting_department(ExcelUtils.getCeilValue(sheet,i,heads.get("报告部门")));
|
|
|
- fault.setReplace_device(ExcelUtils.getCeilValue(sheet,i,heads.get("故换件名称")));
|
|
|
- fault.setReplace_type(ExcelUtils.getCeilValue(sheet,i,heads.get("故换件型别")));
|
|
|
- fault.setDiagnosis_people(ExcelUtils.getCeilValue(sheet,i,heads.get("故障判明人")));
|
|
|
- fault.setFaultparts_date(ExcelUtils.getDateValue(sheet,i,heads.get("故障件装机日期")));
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("故障件总工作时次"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setFaultparts_hours(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("故障件总工作时次"))));
|
|
|
- }
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("故障件装本机工作次"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setFaultparts_worktimes(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("故障件装本机工作次"))));
|
|
|
- }
|
|
|
- fault.setFaultparts_renovation_manu(ExcelUtils.getCeilValue(sheet,i,heads.get("故障件翻修厂")));
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("故障件修后时次"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setFaultparts_renovation_hours(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("故障件修后时次"))));
|
|
|
- }
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("故障件翻修次数"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setFaultparts_renovation_times(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("故障件翻修次数"))));
|
|
|
- }
|
|
|
- fault.setRepair_person(ExcelUtils.getCeilValue(sheet,i,heads.get("排故人")));
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("故换件总工作时次"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setReplace_device_hours(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("故换件总工作时次"))));
|
|
|
- }
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("故换件翻修次数"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setReplace_device_repairtimes(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("故换件翻修次数"))));
|
|
|
- }
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("故换件修后时次"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setReplace_device_repairhours(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("故换件修后时次"))));
|
|
|
- }
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("排故领件次数"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setReplace_device_applytimes(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("排故领件次数"))));
|
|
|
- }
|
|
|
- fault.setReplace_device_manufacturer(ExcelUtils.getCeilValue(sheet,i,heads.get("故换件翻修厂")));
|
|
|
- fault.setIs_history(ExcelUtils.getCeilValue(sheet,i,heads.get("是否历史")));
|
|
|
- fault.setInspector(ExcelUtils.getCeilValue(sheet,i,heads.get("检查人")));
|
|
|
- fault.setHandling_opinions(ExcelUtils.getCeilValue(sheet,i,heads.get("处理意见")));
|
|
|
- fault.setHmc(ExcelUtils.getCeilValue(sheet,i,heads.get("HMC代码")));
|
|
|
- fault.setMfl(ExcelUtils.getCeilValue(sheet,i,heads.get("MFL")));
|
|
|
- fault.setPfl(ExcelUtils.getCeilValue(sheet,i,heads.get("PFL")));
|
|
|
- fault.setGmp(ExcelUtils.getCeilValue(sheet,i,heads.get("GMP")));
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("是否偶发"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setIs_almost(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("是否偶发"))));
|
|
|
- }
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("是否严重故障"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setIs_error(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("是否严重故障"))));
|
|
|
- }
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("是否未定位"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setIs_undefined(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("是否未定位"))));
|
|
|
- }
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("是否解决"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setIs_done(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("是否解决"))));
|
|
|
- }
|
|
|
- fault.setRemark(ExcelUtils.getCeilValue(sheet,i,heads.get("备注")));
|
|
|
- tmp = ExcelUtils.getCeilValue(sheet,i,heads.get("隐藏"));
|
|
|
- if (tmp != null && !tmp.isEmpty()) {
|
|
|
- fault.setIs_hide(Integer.parseInt(ExcelUtils.getCeilValue(sheet, i, heads.get("隐藏"))));
|
|
|
- }
|
|
|
- list.add(fault);
|
|
|
- }
|
|
|
- faultRecordDao.addBatch(list);
|
|
|
- return true;
|
|
|
- }
|
|
|
- public static final String SEARCHTYPE[] = {"aircraft_type","faultparts_system","major"};
|
|
|
-
|
|
|
- public void setLogicString(int nType ,Example.Criteria criteria,int nKey,String v)
|
|
|
- {
|
|
|
- switch (nType){
|
|
|
- case 0:criteria.andLike(SEARCHTYPE[nKey],v);break;
|
|
|
- case 1:criteria.orLike(SEARCHTYPE[nKey],v);break;
|
|
|
- case 2:criteria.andNotLike(SEARCHTYPE[nKey],v);break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public List<FaultRecordEntity> advanceSearch(LogicSearchEntity logicSearchEntity) {
|
|
|
- Example example = new Example(FaultRecordEntity.class);
|
|
|
- Example.Criteria criteria = example.createCriteria();
|
|
|
- criteria.andLike("device_name","%"+logicSearchEntity.getMasterKey()+"%");
|
|
|
- if (logicSearchEntity.getFirstLogic() != -1)
|
|
|
- {
|
|
|
- setLogicString(logicSearchEntity.getFirstLogic(),criteria,logicSearchEntity.getFirstType(),logicSearchEntity.getFirstKey());
|
|
|
- if (logicSearchEntity.getSecondLogic() != -1)
|
|
|
- {
|
|
|
- setLogicString(logicSearchEntity.getSecondLogic(),criteria,logicSearchEntity.getSearchType(),logicSearchEntity.getSecondKey());
|
|
|
- if (logicSearchEntity.getThirdLogic() != -1)
|
|
|
- setLogicString(logicSearchEntity.getThirdLogic(),criteria,logicSearchEntity.getThirdType(),logicSearchEntity.getThirdKey());
|
|
|
- }
|
|
|
- }
|
|
|
- return faultRecordDao.selectByExample(example);
|
|
|
- }
|
|
|
-
|
|
|
- public String changeDone(int id, int isDone){
|
|
|
- if (id <= 0)
|
|
|
- return "故障缺陷不存在!";
|
|
|
- FaultRecordEntity faultRecordEntity = faultRecordDao.selectByPrimaryKey(id);
|
|
|
- if (faultRecordEntity == null)
|
|
|
- {
|
|
|
- return "故障缺陷不存在!";
|
|
|
- }
|
|
|
- faultRecordEntity.setIs_done(isDone);
|
|
|
- int n = faultRecordDao.updateByPrimaryKeySelective(faultRecordEntity);
|
|
|
- if (n >0)
|
|
|
- return "处理成功!";
|
|
|
- else
|
|
|
- return "处理失败";
|
|
|
- }
|
|
|
-
|
|
|
- public Result<Map<String, Object>> getByHmc(String keyword,String type){
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- if (type == null || "".equals(type) || "all".equals(type)){
|
|
|
- map.put("repairManual", repairManualService.findByHmc(keyword));
|
|
|
- map.put("faultRecord", findByHmc(keyword));
|
|
|
- }else if("faultRecord".equals(type)){
|
|
|
- map.put("faultRecord", findByHmc(keyword));
|
|
|
- }else if("repairManual".equals(type)){
|
|
|
- map.put("repairManual", repairManualService.findByHmc(keyword));
|
|
|
- }
|
|
|
- return Result.success(map);
|
|
|
- }
|
|
|
-
|
|
|
- public Result<List<FaultRecordEntity>> findByHmc(String name) {
|
|
|
- if (name == null || "".equals(name)) {
|
|
|
- return Result.result(false, "名称不能为空!", null);
|
|
|
- }
|
|
|
- List<FaultRecordEntity> list = faultRecordDao.findByHmc("%" + name + "%");
|
|
|
- return Result.success(list);
|
|
|
- }
|
|
|
-
|
|
|
- public Result<Map<String, Object>> getByMfl(String keyword,String type){
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- if (type == null || "".equals(type) || "all".equals(type)){
|
|
|
- map.put("repairManual", repairManualService.findByMfl(keyword));
|
|
|
- map.put("faultRecord", findByMfl(keyword));
|
|
|
- }else if("faultRecord".equals(type)){
|
|
|
- map.put("faultRecord", findByMfl(keyword));
|
|
|
- }else if("repairManual".equals(type)){
|
|
|
- map.put("repairManual", repairManualService.findByMfl(keyword));
|
|
|
- }
|
|
|
- return Result.success(map);
|
|
|
- }
|
|
|
-
|
|
|
- public Result<List<FaultRecordEntity>> findByMfl(String name) {
|
|
|
- if (name == null || "".equals(name)) {
|
|
|
- return Result.result(false, "名称不能为空!", null);
|
|
|
- }
|
|
|
- List<FaultRecordEntity> list = faultRecordDao.findByMfl("%" + name + "%");
|
|
|
- return Result.success(list);
|
|
|
- }
|
|
|
-
|
|
|
- public Result<Map<String, Object>> getByPfl(String keyword,String type){
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- if (type == null || "".equals(type) || "all".equals(type)){
|
|
|
- map.put("repairManual", repairManualService.findByPfl(keyword));
|
|
|
- map.put("faultRecord", findByPfl(keyword));
|
|
|
- }else if("faultRecord".equals(type)){
|
|
|
- map.put("faultRecord", findByPfl(keyword));
|
|
|
- }else if("repairManual".equals(type)){
|
|
|
- map.put("repairManual", repairManualService.findByPfl(keyword));
|
|
|
- }
|
|
|
- return Result.success(map);
|
|
|
- }
|
|
|
-
|
|
|
- public Result<List<FaultRecordEntity>> findByPfl(String name) {
|
|
|
- if (name == null || "".equals(name)) {
|
|
|
- return Result.result(false, "名称不能为空!", null);
|
|
|
- }
|
|
|
- List<FaultRecordEntity> list = faultRecordDao.findByPfl("%" + name + "%");
|
|
|
- return Result.success(list);
|
|
|
- }
|
|
|
-
|
|
|
- public Result<Map<String, Object>> getByGmp(String keyword,String type){
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- if (type == null || "".equals(type) || "all".equals(type)){
|
|
|
- map.put("repairManual", repairManualService.findByGmp(keyword));
|
|
|
- map.put("faultRecord", findByGmp(keyword));
|
|
|
- }else if("faultRecord".equals(type)){
|
|
|
- map.put("faultRecord", findByGmp(keyword));
|
|
|
- }else if("repairManual".equals(type)){
|
|
|
- map.put("repairManual", repairManualService.findByGmp(keyword));
|
|
|
- }
|
|
|
- return Result.success(map);
|
|
|
- }
|
|
|
-
|
|
|
- public Result<List<FaultRecordEntity>> findByGmp(String name) {
|
|
|
- if (name == null || "".equals(name)) {
|
|
|
- return Result.result(false, "名称不能为空!", null);
|
|
|
- }
|
|
|
- List<FaultRecordEntity> list = faultRecordDao.findByGmp("%" + name + "%");
|
|
|
- return Result.success(list);
|
|
|
- }
|
|
|
-
|
|
|
- public List<StatisticEntity> getAirNo(String air_type){
|
|
|
- return faultRecordDao.getAirNo(air_type);
|
|
|
- }
|
|
|
-
|
|
|
- public List<StatisticEntity> getMajor(String air_type){
|
|
|
- return faultRecordDao.getMajor(air_type);
|
|
|
- }
|
|
|
-
|
|
|
- public List<StatisticEntity> getSystem(String major){
|
|
|
- return faultRecordDao.getSystem(major);
|
|
|
- }
|
|
|
-
|
|
|
- public List<StatisticEntity> getDepartment(String parent,int level){
|
|
|
- List<StatisticEntity> lst = new ArrayList<>();
|
|
|
- switch (level){
|
|
|
- case 0:lst = faultRecordDao.getD1();break;
|
|
|
- case 1:lst = faultRecordDao.getD2(parent);break;
|
|
|
- case 2:lst = faultRecordDao.getD3(parent);break;
|
|
|
- case 3:lst = faultRecordDao.getD4(parent);break;
|
|
|
- }
|
|
|
- return lst ;
|
|
|
- }
|
|
|
-
|
|
|
- public List<FaultRecordEntity> singleSta(SingleStaEntity singleStaEntity){
|
|
|
-
|
|
|
- return faultRecordDao.singleSta(singleStaEntity.getAirType(),singleStaEntity.getAirNo(),singleStaEntity.getStartTime(),singleStaEntity.getEndTme());
|
|
|
- }
|
|
|
-
|
|
|
- public List<StatisticEntity> singleStaAll(SingleStaEntity singleStaEntity){
|
|
|
-
|
|
|
- return faultRecordDao.singleStaAll(singleStaEntity.getAirType(),singleStaEntity.getStartTime(),singleStaEntity.getEndTme());
|
|
|
- }
|
|
|
-
|
|
|
- public List<FaultRecordEntity> majorSta(SingleStaEntity singleStaEntity){
|
|
|
-
|
|
|
- return faultRecordDao.majorSta(singleStaEntity.getAirType(),singleStaEntity.getMajor(),
|
|
|
- singleStaEntity.getStartTime(),singleStaEntity.getEndTme());
|
|
|
- }
|
|
|
-
|
|
|
- public List<StatisticEntity> majorStaAll(SingleStaEntity singleStaEntity){
|
|
|
-
|
|
|
- return faultRecordDao.majorStaAll(singleStaEntity.getAirType(),singleStaEntity.getStartTime(),singleStaEntity.getEndTme());
|
|
|
- }
|
|
|
-
|
|
|
- public List<StatisticEntity> getAirType(){
|
|
|
- return faultRecordDao.getAirType();
|
|
|
- }
|
|
|
-
|
|
|
-}
|