Commit 016777c2 authored by zhoumaotao's avatar zhoumaotao

合格率接口

parent 93bce632
...@@ -3,6 +3,7 @@ package com.gavel.kwell.controller; ...@@ -3,6 +3,7 @@ package com.gavel.kwell.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gavel.common.base.controller.BaseController; import com.gavel.common.base.controller.BaseController;
import com.gavel.kwell.service.KmesBoardService; import com.gavel.kwell.service.KmesBoardService;
import com.gavel.kwell.vo.GpfkHgVO;
import com.gavel.kwell.vo.PsclVO; import com.gavel.kwell.vo.PsclVO;
import com.gavel.kwell.vo.SdclVO; import com.gavel.kwell.vo.SdclVO;
import com.gavel.kwell.vo.UWoVO; import com.gavel.kwell.vo.UWoVO;
...@@ -67,7 +68,7 @@ public class KmesBoardController extends BaseController { ...@@ -67,7 +68,7 @@ public class KmesBoardController extends BaseController {
@RequestMapping(value = "queryWeekPcsl", method = RequestMethod.POST) @RequestMapping(value = "queryWeekPcsl", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public Object queryPcsl(@RequestBody JSONObject param) { public Object queryPcsl(@RequestBody JSONObject param) {
List<Pcjhmx> pcjhmxList = kmesBoardService.queryPcsl(); List<Pcjhmx> pcjhmxList = kmesBoardService.queryWeekPcsl();
return buildReturnData(pcjhmxList); return buildReturnData(pcjhmxList);
} }
...@@ -94,6 +95,12 @@ public class KmesBoardController extends BaseController { ...@@ -94,6 +95,12 @@ public class KmesBoardController extends BaseController {
/** /**
*合格率 *合格率
*/ */
@RequestMapping(value = "queryGpfkHgl", method = RequestMethod.POST)
@ResponseBody
public Object queryGpfkHgl(@RequestBody JSONObject param) {
List<GpfkHgVO> gpfkHgVOS = kmesBoardService.queryGpfkHgl();
return buildReturnData(gpfkHgVOS);
}
/** /**
......
...@@ -20,4 +20,6 @@ public interface GpfkcxDao extends BaseDao { ...@@ -20,4 +20,6 @@ public interface GpfkcxDao extends BaseDao {
public List<BzgxVO> listBzgxName(); public List<BzgxVO> listBzgxName();
public List<Gpfk> queryByBetween(Date start, Date end); public List<Gpfk> queryByBetween(Date start, Date end);
public List<Gpfk> queryGpfk(Date date);
} }
...@@ -14,7 +14,7 @@ import java.util.List; ...@@ -14,7 +14,7 @@ import java.util.List;
public interface KmesBoardDao extends BaseDao { public interface KmesBoardDao extends BaseDao {
public List<Pcjhmx> queryPcsl(); public List<Pcjhmx> queryWeekPcsl();
public PsclVO queryTodayPcsl(); public PsclVO queryTodayPcsl();
......
...@@ -2,6 +2,7 @@ package com.gavel.kwell.dao.impl; ...@@ -2,6 +2,7 @@ package com.gavel.kwell.dao.impl;
import com.gavel.bom.utils.GxlxGxbzEnum; import com.gavel.bom.utils.GxlxGxbzEnum;
import com.gavel.common.base.dao.impl.BaseDaoImpl; import com.gavel.common.base.dao.impl.BaseDaoImpl;
import com.gavel.common.utils.DateUtils;
import com.gavel.common.utils.StringUtils; import com.gavel.common.utils.StringUtils;
import com.gavel.gygl.vo.BzgxVO; import com.gavel.gygl.vo.BzgxVO;
import com.gavel.kwell.dao.GpfkcxDao; import com.gavel.kwell.dao.GpfkcxDao;
...@@ -127,5 +128,21 @@ public class GpfkcxDaoImpl extends BaseDaoImpl implements GpfkcxDao { ...@@ -127,5 +128,21 @@ public class GpfkcxDaoImpl extends BaseDaoImpl implements GpfkcxDao {
sqlMap.setParamValue("pGxbz", GxlxGxbzEnum.LAST.getId()); sqlMap.setParamValue("pGxbz", GxlxGxbzEnum.LAST.getId());
return sqlMap.query(Gpfk.class); return sqlMap.query(Gpfk.class);
} }
@Override
public List<Gpfk> queryGpfk(Date date) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select GPFK_ID, GPFK_WOSNID, GPFK_FKLX, GPFK_FKGX, ");
sqlMap.append(" GPFK_FKSJ,GPFK_FKR,GPFK_FKRID, GPFK_FKBX, GPFK_FKJSSJ,");
sqlMap.append(" GPFK_HGBZ,GPFK_FKSL,GPFK_HGSL,GPFK_BHGSL,GPFK_GFSL,GPFK_WOGYLX, ");
sqlMap.append(" GPFK_LFSL,WOGYLX_GXBZ ");
sqlMap.append("from GPFK ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFK_WOGYLX ");
sqlMap.append("where (GPFK_FKSJ >= :pStart and GPFK_FKSJ < :pEnd) and WOGYLX_GXBZ = :pGxbz ");//[a,b)
sqlMap.setParamValue("ksrq", DateUtils.beginOfDay(date));
sqlMap.setParamValue("jsrq", DateUtils.endOfDay(date));
sqlMap.setParamValue("pGxbz", GxlxGxbzEnum.FIRST.getId());
return sqlMap.query(Gpfk.class);
}
} }
...@@ -18,7 +18,7 @@ public class KmesBoardDaoImpl extends BaseDaoImpl implements KmesBoardDao { ...@@ -18,7 +18,7 @@ public class KmesBoardDaoImpl extends BaseDaoImpl implements KmesBoardDao {
@Override @Override
public List<Pcjhmx> queryPcsl() { public List<Pcjhmx> queryWeekPcsl() {
SqlMap sqlMap = new SqlMap(); SqlMap sqlMap = new SqlMap();
sqlMap.append("select PCJHMX_JHRQ,sum(PCJHMX_JHSL) as PCJHMX_JHSL,sum(PCJHMX_WGSL) as PCJHMX_WGSL "); sqlMap.append("select PCJHMX_JHRQ,sum(PCJHMX_JHSL) as PCJHMX_JHSL,sum(PCJHMX_WGSL) as PCJHMX_WGSL ");
sqlMap.append("from PCJHMX "); sqlMap.append("from PCJHMX ");
......
package com.gavel.kwell.service; package com.gavel.kwell.service;
import com.gavel.common.base.service.BaseEditService; import com.gavel.common.base.service.BaseEditService;
import com.gavel.kwell.vo.GpfkHgVO;
import com.gavel.kwell.vo.PsclVO; import com.gavel.kwell.vo.PsclVO;
import com.gavel.kwell.vo.SdclVO; import com.gavel.kwell.vo.SdclVO;
import com.gavel.kwell.vo.UWoVO; import com.gavel.kwell.vo.UWoVO;
...@@ -13,7 +14,7 @@ public interface KmesBoardService extends BaseEditService { ...@@ -13,7 +14,7 @@ public interface KmesBoardService extends BaseEditService {
public SdclVO querySdcl(); public SdclVO querySdcl();
public List<Pcjhmx> queryPcsl(); public List<Pcjhmx> queryWeekPcsl();
public PsclVO queryTodayPcsl(); public PsclVO queryTodayPcsl();
...@@ -22,4 +23,6 @@ public interface KmesBoardService extends BaseEditService { ...@@ -22,4 +23,6 @@ public interface KmesBoardService extends BaseEditService {
public List<UWoVO> queryWo(); public List<UWoVO> queryWo();
public UWoVO queryWorkingWO(); public UWoVO queryWorkingWO();
public List<GpfkHgVO> queryGpfkHgl();
} }
package com.gavel.kwell.service.impl; package com.gavel.kwell.service.impl;
import com.gavel.common.base.entity.BaseEntity;
import com.gavel.common.base.service.impl.BaseEditServiceImpl; import com.gavel.common.base.service.impl.BaseEditServiceImpl;
import com.gavel.common.utils.DateUtils; import com.gavel.common.utils.DateUtils;
import com.gavel.common.utils.NumberUtils; import com.gavel.common.utils.NumberUtils;
import com.gavel.kwell.dao.GpfkcxDao; import com.gavel.kwell.dao.GpfkcxDao;
import com.gavel.kwell.dao.KmesBoardDao; import com.gavel.kwell.dao.KmesBoardDao;
import com.gavel.kwell.dao.WlsnDao;
import com.gavel.kwell.persistent.Gpfk; import com.gavel.kwell.persistent.Gpfk;
import com.gavel.kwell.persistent.Wlsn;
import com.gavel.kwell.service.KmesBoardService; import com.gavel.kwell.service.KmesBoardService;
import com.gavel.kwell.service.WlsnService;
import com.gavel.kwell.utils.DateCalculateUtil; import com.gavel.kwell.utils.DateCalculateUtil;
import com.gavel.kwell.utils.WlsnLxEnum; import com.gavel.kwell.vo.GpfkHgVO;
import com.gavel.kwell.vo.*; import com.gavel.kwell.vo.PsclVO;
import com.gavel.persistence.sql.RecordSet; import com.gavel.kwell.vo.SdclVO;
import com.gavel.kwell.vo.UWoVO;
import com.gavel.wo.persistent.Pcjhmx; import com.gavel.wo.persistent.Pcjhmx;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.xml.crypto.Data;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -73,8 +72,8 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa ...@@ -73,8 +72,8 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
} }
@Override @Override
public List<Pcjhmx> queryPcsl() { public List<Pcjhmx> queryWeekPcsl() {
return kmesBoardDao.queryPcsl(); return kmesBoardDao.queryWeekPcsl();
} }
@Override @Override
...@@ -97,4 +96,25 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa ...@@ -97,4 +96,25 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
public UWoVO queryWorkingWO() { public UWoVO queryWorkingWO() {
return kmesBoardDao.queryWorkingWO(); return kmesBoardDao.queryWorkingWO();
} }
@Override
public List<GpfkHgVO> queryGpfkHgl() {
//首到工序的工票反馈最近7天合格率
Date beginDate = DateUtils.calcDate(DateUtils.getDate(),0,0,-7,0,0,0);
Date endDate = DateUtils.calcDate(DateUtils.getDate(),0,0,-1,0,0,0);
List<Date> dateList = DateCalculateUtil.findDates("D", beginDate, endDate);
List<GpfkHgVO> gpfkHgVOList = new ArrayList<>();
for(Date date : dateList){
GpfkHgVO gpfkHgVO = new GpfkHgVO();
List<Gpfk> gpfks = gpfkcxDao.queryGpfk(date);
Double fksl = gpfks.stream().mapToDouble(Gpfk::getFksl).sum();
Double hgsl = gpfks.stream().mapToDouble(Gpfk::getHgsl).sum();
gpfkHgVO.setFkrq(date);
gpfkHgVO.setFksl(fksl);
gpfkHgVO.setHgsl(hgsl);
gpfkHgVOList.add(gpfkHgVO);
}
return gpfkHgVOList;
}
} }
...@@ -45,9 +45,9 @@ public class DateCalculateUtil { ...@@ -45,9 +45,9 @@ public class DateCalculateUtil {
public static void main(String[] args) { public static void main(String[] args) {
Date start = DateUtils.parseDate("2021-05-29 08:30:00"); Date start = DateUtils.parseDate("2021-05-24 00:00:00");
Date end = DateUtils.parseDate("2021-05-29 21:00:00"); Date end = DateUtils.parseDate("2021-05-30 00:00:00");
List<Date> list = findDates("H", start, end); List<Date> list = findDates("D", start, end);
for (Date date :list){ for (Date date :list){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(sdf.format(date)); System.out.println(sdf.format(date));
......
package com.gavel.kwell.vo;
import com.gavel.common.base.entity.BaseEntity;
import java.util.Date;
public class GpfkHgVO extends BaseEntity {
private Date fkrq;
private Double fksl;//反馈数量
private Double hgsl;//合格数量
public Date getFkrq() {
return fkrq;
}
public void setFkrq(Date fkrq) {
this.fkrq = fkrq;
}
public Double getFksl() {
return fksl;
}
public void setFksl(Double fksl) {
this.fksl = fksl;
}
public Double getHgsl() {
return hgsl;
}
public void setHgsl(Double hgsl) {
this.hgsl = hgsl;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment