Commit 3bcf137f by 高晓磊

生产专题趋势图接口

parent 33283599
......@@ -9,6 +9,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.UUID;
/**
* @author scol
*/
public interface DischargingDao extends BaseDao {
KObject load(UUID id);
......@@ -20,7 +23,7 @@ public interface DischargingDao extends BaseDao {
void deleteById(UUID id);
List<HashMap<String, Object>> groupInfo(List<UUID> regionalCompanyIds, Integer year, Boolean isGroupByMonth, Boolean isGroupByRegionalCompany, Boolean isGroupBySandMiningArea);
List<HashMap<String, Object>> groupInfo(List<UUID> stationIds,List<UUID> regionalCompanyIds, Date startDate,Date endDate, Integer type,Boolean isGroupByMonth, Boolean isGroupByRegionalCompany, Boolean isGroupBySandMiningArea,Boolean isGroupByDay,Boolean isGroupByStationId);
List<KObject> getByCodeNum(String name, UUID id);
......
......@@ -6,6 +6,7 @@ import com.beecode.inz.basis.dao.BaseDao;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
public interface ProductionPlanReportDao extends BaseDao {
......@@ -35,4 +36,8 @@ public interface ProductionPlanReportDao extends BaseDao {
List<KObject> getNoWareHousing(UUID productionPlanId);
List<Map<String, Object>> getProductionGroup(Date startDate, Date endDate, List<UUID> ids, List<UUID> stationIds, Boolean isGroupByProductionLine, Boolean isGroupByRegionalCompany, Boolean isGroupByStation);
List<Map<String, Object>> getProductionByDinasTypeAndProductionLine(Date startDate, Date endDate, List<UUID> stationIds, List<UUID> ids);
}
package com.xyst.dinas.production.entity;
import java.util.List;
import java.util.UUID;
/**
* @author scol
*/
public class DinasTypeParent {
private UUID dinasTypeId;
private String dinasTypeName;
private List<TimeValueParentEntity> timeValueParentEntityList;
public UUID getDinasTypeId() {
return dinasTypeId;
}
public void setDinasTypeId(UUID dinasTypeId) {
this.dinasTypeId = dinasTypeId;
}
public String getDinasTypeName() {
return dinasTypeName;
}
public void setDinasTypeName(String dinasTypeName) {
this.dinasTypeName = dinasTypeName;
}
public List<TimeValueParentEntity> getTimeValueParentEntityList() {
return timeValueParentEntityList;
}
public void setTimeValueParentEntityList(List<TimeValueParentEntity> timeValueParentEntityList) {
this.timeValueParentEntityList = timeValueParentEntityList;
}
}
package com.xyst.dinas.production.entity;
import java.util.Date;
import java.util.UUID;
public class TimeValue {
private UUID id;
private Date time;
private Double value;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public Double getValue() {
return value;
}
public void setValue(Double value) {
this.value = value;
}
public TimeValue(UUID id, Date time, Double value) {
this.id = id;
this.time = time;
this.value = value;
}
public TimeValue() {
}
}
package com.xyst.dinas.production.entity;
import java.util.List;
import java.util.UUID;
public class TimeValueParentEntity {
private String parentName;
private UUID parentId;
private List<TimeValue> timeValues;
public List<TimeValue> getTimeValues() {
return timeValues;
}
public void setTimeValues(List<TimeValue> timeValues) {
this.timeValues = timeValues;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public UUID getParentId() {
return parentId;
}
public void setParentId(UUID parentId) {
this.parentId = parentId;
}
}
\ No newline at end of file
......@@ -112,11 +112,13 @@ public class DischargingDaoImpl extends AbstractBaseDao implements DischargingDa
return page;
}
@Override
public List<HashMap<String, Object>> groupInfo(List<UUID> regionalCompanyIds, Integer year, Boolean isGroupByMonth, Boolean isGroupByRegionalCompany, Boolean isGroupBySandMiningArea) {
DetachedCriteria detachedCriteria = getDetachedCriteria(null, null, DateTimeUtils.getYearStart(year), DateTimeUtils.getYearEnd(year), null, null, null, null, null, regionalCompanyIds);
public List<HashMap<String, Object>> groupInfo(List<UUID> stationIds,List<UUID> regionalCompanyIds, Date startDate,Date endDate,Integer type, Boolean isGroupByMonth, Boolean isGroupByRegionalCompany, Boolean isGroupBySandMiningArea,Boolean isGroupByDay,Boolean isGroupByStationId) {
DetachedCriteria detachedCriteria = getDetachedCriteria(type, null, startDate, endDate, null, stationIds, null, null, null, regionalCompanyIds);
ProjectionList add = Projections.projectionList()
.add(Projections.alias(Projections.sum("dischargingWeight"), "sumDischargingWeight"))
.add(Projections.alias(Projections.property("dischargingTime"), "dischargingTime"))
.add(Projections.alias(Projections.sqlGroupProjection(" year({alias}.discharging_time) as year", " year({alias}.discharging_time)", new String[]{"year"}, new Type[]{StandardBasicTypes.INTEGER}), "year"));
if (isGroupByMonth) {
add.add(Projections.alias(
......@@ -126,11 +128,42 @@ public class DischargingDaoImpl extends AbstractBaseDao implements DischargingDa
new Type[]{StandardBasicTypes.INTEGER}), "month"));
}
if (isGroupByDay) {
add.add(Projections.alias(
Projections.sqlGroupProjection("day({alias}.discharging_time) as day",
"day({alias}.discharging_time)",
new String[]{"day"},
new Type[]{StandardBasicTypes.INTEGER}), "day"));
}
if (isGroupByRegionalCompany) {
detachedCriteria.createCriteria("regionalCompany","company");
add.add(Projections.alias(Projections.groupProperty("regionalCompany.id"), "regionalCompany"));
add.add(Projections.alias(Projections.property("company.name"), "companyName"))
.add(Projections.alias(Projections.property("company.id"), "companyId"));
//图表用,起个别名
add.add(Projections.alias(Projections.property("company.name"), "parentName"))
.add(Projections.alias(Projections.property("company.id"), "parentId"));
}
if (isGroupBySandMiningArea) {
add.add(Projections.alias(Projections.groupProperty("sandMiningArea.id"), "sandMiningArea"));
detachedCriteria.createCriteria("sandMiningArea","area");
add.add(Projections.alias(Projections.groupProperty("area.id"), "sandMiningArea"));
add.add(Projections.alias(Projections.property("area.sandMiningAreaName"), "sandMiningAreaName"))
.add(Projections.alias(Projections.property("area.id"), "sandMiningAreaId"))
//图表用,起个别名
.add(Projections.alias(Projections.property("area.sandMiningAreaName"), "parentName"))
.add(Projections.alias(Projections.property("area.id"), "parentId"))
;
}
if (isGroupByStationId) {
detachedCriteria.createCriteria("station","station");
add.add(Projections.alias(Projections.groupProperty("station.id"), "stationId"));
add.add(Projections.alias(Projections.property("station.stationName"), "stationName"));
//图表用,起个别名
add.add(Projections.alias(Projections.property("station.stationName"), "parentName"));
add.add(Projections.alias(Projections.property("station.id"), "parentId"));
}
detachedCriteria.setProjection(add);
// projL.add(Projections.sqlGroupProjection("day({alias}.dataHoraEnt) as day, month({alias}.dataHoraEnt) as month, year({alias}.dataHoraEnt) as year", "day({alias}.dataHoraEnt), month({alias}.dataHoraEnt), year({alias}.dataHoraEnt)", new String[]{"day","month", "year"}, (org.hibernate.type.Type[]) new Type[]{Hibernate.INTEGER, Hibernate.INTEGER, Hibernate.INTEGER}));
......@@ -169,7 +202,7 @@ public class DischargingDaoImpl extends AbstractBaseDao implements DischargingDa
if (null != sandMiningAreaType) {
criteria.add(Restrictions.eq("sandMiningArea.sandMiningAreaType", sandMiningAreaType));
}
if (null != stationIds) {
if (!CollectionUtils.isEmpty(stationIds)) {
criteria.add(Restrictions.in("station.id", stationIds));
}
if (null != sandMiningAreaId) {
......
......@@ -11,20 +11,14 @@ import com.beecode.inz.common.util.DateTimeUtils;
import com.xyst.dinas.biz.dao.DinasTypeDao;
import com.xyst.dinas.production.constant.ProductionPlanReportConstant;
import com.xyst.dinas.production.dao.ProductionPlanReportDao;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.hibernate.criterion.*;
import org.hibernate.query.Query;
import org.hibernate.transform.Transformers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.*;
/**
* @author scol
......@@ -75,28 +69,26 @@ public class ProductionPlanReportDaoImpl extends AbstractBaseDao implements Prod
private ArrayList<KObject> removeBaseFiled(List<KObject> list) {
ArrayList<KObject> kObjects = new ArrayList<>();
KObject dinasTypeDetailsKObj;
KObject dinasTypeDetailsKobj;
KObject[] dinasTypeDetails;
for (KObject kObject : list) {
KObject clone = kObject.clone();
// clone.setNull(BaseConstants.CREATOR);
// clone.setNull(BaseConstants.MODIFIER);
clone.setNull("regionalCompany");
KObject station = clone.get("station").clone();
station.setNull(BaseConstants.CREATOR);
station.setNull(BaseConstants.MODIFIER);
station.setNull("regionalCompany");
clone.set("station",station);
dinasTypeDetailsKObj = clone.get("dinasTypeDetails").clone();
if(null!=dinasTypeDetailsKObj){
dinasTypeDetails = dinasTypeDetailsKObj.toArray();
clone.set("station", station);
dinasTypeDetailsKobj = clone.get("dinasTypeDetails").clone();
if (null != dinasTypeDetailsKobj) {
dinasTypeDetails = dinasTypeDetailsKobj.toArray();
for (KObject dinasTypeDetail : dinasTypeDetails) {
dinasTypeDetail.get("dinasType").setNull(BaseConstants.CREATOR);
dinasTypeDetail.get("dinasType").setNull(BaseConstants.MODIFIER);
dinasTypeDetail.get("dinasType").setNull("regionalCompany");
}
}
clone.set("dinasTypeDetails",dinasTypeDetailsKObj);
clone.set("dinasTypeDetails", dinasTypeDetailsKobj);
kObjects.add(clone);
}
return kObjects;
......@@ -163,8 +155,8 @@ public class ProductionPlanReportDaoImpl extends AbstractBaseDao implements Prod
DetachedCriteria detachedCriteria = DetachedCriteria.forEntityName(bean.getName());
detachedCriteria.createAlias("master", "master");
detachedCriteria.createAlias("dinasType", "dinasType");
detachedCriteria.add(Restrictions.eq("dinasType.del",false));
detachedCriteria.add(Restrictions.eq("master.del",false));
detachedCriteria.add(Restrictions.eq("dinasType.del", false));
detachedCriteria.add(Restrictions.eq("master.del", false));
if (null != stationId) {
detachedCriteria.add(Restrictions.eq("master.station.id", stationId));
}
......@@ -239,17 +231,90 @@ public class ProductionPlanReportDaoImpl extends AbstractBaseDao implements Prod
public List<KObject> getNoWareHousing(UUID productionPlanId) {
DetachedCriteria detachedCriteria = DetachedCriteria.forEntityName(ENTITY);
detachedCriteria.add(Restrictions.eq(BaseConstants.DEL, false));
if (null==productionPlanId) {
if (null == productionPlanId) {
detachedCriteria.add(Restrictions.le("productionPlanDate", DateTimeUtils.getStartDateTimeOfDay(new Date())));
} else {
//根据单条生产计划id查询该场站今天所有的生产计划
List<UUID> ids= getAllByOne(productionPlanId);
List<UUID> ids = getAllByOne(productionPlanId);
detachedCriteria.add(Restrictions.in("id", ids));
}
detachedCriteria.add(Restrictions.eq("warehousingStatus", false));
return (List<KObject>) template.findByCriteria(detachedCriteria);
}
@Override
public List<Map<String, Object>> getProductionGroup(Date startDate, Date endDate, List<UUID> ids, List<UUID> stationIds, Boolean isGroupByProductionLine, Boolean isGroupByRegionalCompany, Boolean isGroupByStation) {
DetachedCriteria detachedCriteria = getProductionGroup(ids, stationIds, isGroupByProductionLine, isGroupByRegionalCompany, isGroupByStation, false, true);
detachedCriteria.add(Restrictions.ge(BaseConstants.MASTER +".productionPlanDate",startDate))
.add(Restrictions.lt(BaseConstants.MASTER +".productionPlanDate",endDate));
return (List<Map<String, Object>>) template.findByCriteria(detachedCriteria);
}
private DetachedCriteria getProductionGroup(List<UUID> ids, List<UUID> stationIds, Boolean isGroupByProductionLine, Boolean isGroupByRegionalCompany, Boolean isGroupByStation, Boolean isGroupByDinasType, Boolean isGroupByDay) {
DetachedCriteria detachedCriteria = DetachedCriteria.forEntityName(DETAIL_ENTITY);
ProjectionList add = Projections.projectionList();
detachedCriteria.createCriteria(BaseConstants.MASTER, BaseConstants.MASTER);
detachedCriteria.createAlias(BaseConstants.MASTER + ".regionalCompany", "regionalCompany");
detachedCriteria.createAlias(BaseConstants.MASTER + ".station", "station");
detachedCriteria.add(Restrictions.eq(BaseConstants.MASTER + "." + BaseConstants.DEL, false));
if (isGroupByDay) {
add.add(Projections.alias(
Projections.property(BaseConstants.MASTER + ".productionPlanDate"), "productionPlanDate"));
add.add(Projections.alias(
Projections.groupProperty(BaseConstants.MASTER + ".productionPlanDate"), "productionPlanDate"));
}
if (isGroupByDinasType) {
detachedCriteria.createCriteria("dinasType", "dinasType");
add.add(Projections.alias(Projections.groupProperty("dinasType.dinasTypeName"), "dinasTypeName"));
add.add(Projections.alias(
Projections.groupProperty("dinasType.id"), "dinasTypeId"));
}
if (!CollectionUtils.isEmpty(ids)) {
detachedCriteria.add(Restrictions.in("regionalCompany.id", ids));
}
if (!CollectionUtils.isEmpty(stationIds)) {
detachedCriteria.add(Restrictions.in("station.id", stationIds));
}
if (isGroupByRegionalCompany) {
add.add(Projections.alias(Projections.groupProperty("regionalCompany.id"), "regionalCompanyId"));
//图表用,起个别名
add.add(Projections.alias(Projections.property("regionalCompany.name"), "parentName"))
.add(Projections.alias(Projections.property("regionalCompany.id"), "parentId"));
}
if (isGroupByStation) {
add.add(Projections.alias(Projections.groupProperty("station.id"), "stationId"));
//图表用,起个别名
add.add(Projections.alias(Projections.property("station.stationName"), "parentName"))
.add(Projections.alias(Projections.property("station.id"), "parentId"));
}
if (isGroupByProductionLine) {
detachedCriteria.createCriteria(BaseConstants.MASTER + ".productionLine", "productionLine");
add.add(Projections.alias(Projections.groupProperty("productionLine.id"), "productionLineId"));
add.add(Projections.alias(Projections.groupProperty("productionLine.name"), "productionLineName"));
//图表用,起个别名
add.add(Projections.alias(Projections.property("productionLine.name"), "parentName"))
.add(Projections.alias(Projections.property("productionLine.id"), "parentId"));
}
add.add(Projections.alias(Projections.sum("dinasWeight"), "sumDinasWeight"));
detachedCriteria.setProjection(add);
detachedCriteria.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
return detachedCriteria;
}
@Override
public List<Map<String, Object>> getProductionByDinasTypeAndProductionLine(Date startDate, Date endDate, List<UUID> stationIds, List<UUID> ids) {
DetachedCriteria detachedCriteria = getProductionGroup(ids, stationIds, true, false, false, true, false);
detachedCriteria.add(Restrictions.ge(BaseConstants.MASTER +".productionPlanDate",startDate))
.add(Restrictions.lt(BaseConstants.MASTER +".productionPlanDate",endDate));
return (List<Map<String, Object>>)template.findByCriteria(detachedCriteria);
}
private List<UUID> getAllByOne(UUID productionPlanId) {
KObject load = load(productionPlanId);
......@@ -258,7 +323,7 @@ public class ProductionPlanReportDaoImpl extends AbstractBaseDao implements Prod
detachedCriteria.add(Restrictions.eq("productionPlanDate", load.getDate("productionPlanDate")));
detachedCriteria.add(Restrictions.eq("station.id", load.get("station").getUuid("id")));
detachedCriteria.setProjection(Projections.projectionList().add(Projections.distinct(Projections.property("id"))));
return (List<UUID>)template.findByCriteria(detachedCriteria);
return (List<UUID>) template.findByCriteria(detachedCriteria);
}
......
......@@ -14,15 +14,24 @@ import com.xyst.dinas.biz.dao.ProductionLineDao;
import com.xyst.dinas.biz.dao.StationDao;
import com.xyst.dinas.production.constant.ProductionPlanReportConstant;
import com.xyst.dinas.production.dao.ProductionPlanReportDao;
import com.xyst.dinas.production.entity.DinasTypeParent;
import com.xyst.dinas.production.entity.TimeValue;
import com.xyst.dinas.production.entity.TimeValueParentEntity;
import com.xyst.dinas.production.service.DischargingService;
import com.xyst.dinas.production.service.ProductionPlanReportService;
import com.xyst.dinas.sales.service.InventoryService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Stream;
@Transactional(rollbackFor = Exception.class)
public class ProductionPlanReportServiceImpl implements ProductionPlanReportService {
......@@ -37,6 +46,8 @@ public class ProductionPlanReportServiceImpl implements ProductionPlanReportServ
private ProductionLineDao productionLineDao;
@Autowired
private InventoryService inventoryService;
@Autowired
private DischargingService dischargingService;
@Override
public Page<KObject> queryByPaging(Page<KObject> page, UUID stationId, UUID productionLineId, Date startDate, Date endDate) throws Exception {
......@@ -173,7 +184,6 @@ public class ProductionPlanReportServiceImpl implements ProductionPlanReportServ
List<KObject> a = productionPlanReportDao.getNoWareHousing(productionLineIds);
JSONObject params = new JSONObject();
// JSONArray regionalCompanyList = params.getJSONArray("datas");
for (KObject kObject : a) {
UUID regionalCompanyId = kObject.get("regionalCompany").getUuid("id");
......@@ -208,6 +218,116 @@ public class ProductionPlanReportServiceImpl implements ProductionPlanReportServ
}
@Override
public List<TimeValueParentEntity> getProductionGroup(Date startDate, Date endDate,
List<UUID> ids, List<UUID> stationIds,
Boolean isGroupByProductionLine,
Boolean isGroupByRegionalCompany,
Boolean isGroupByStation,
Integer showType) {
List<Map<String, Object>> productionList = productionPlanReportDao.getProductionGroup(startDate, endDate, ids, stationIds, isGroupByProductionLine, isGroupByRegionalCompany, isGroupByStation);
LocalDateTime localStartDate = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
LocalDateTime localEndDate = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
long distance = ChronoUnit.DAYS.between(localStartDate, localEndDate);
HashMap<UUID, TimeValueParentEntity> stringTimeValueParentEntityHashMap = new HashMap<>(12);
List<TimeValueParentEntity> timeValueParentEntities = new ArrayList<>();
TimeValueParentEntity timeValueParentEntity;
for (Map<String, Object> stringObjectMap : productionList) {
UUID parentId = UUID.fromString(stringObjectMap.get("parentId").toString());
Date productionPlanDate = (Date) stringObjectMap.get("productionPlanDate");
double sumDinasWeight = Double.parseDouble(stringObjectMap.get("sumDinasWeight").toString());
if(!stringTimeValueParentEntityHashMap.containsKey(parentId)){
timeValueParentEntity= new TimeValueParentEntity();
timeValueParentEntity.setParentId(parentId);
timeValueParentEntity.setParentName(stringObjectMap.get("parentName").toString());
timeValueParentEntity.setTimeValues(new ArrayList<>());
timeValueParentEntities.add(timeValueParentEntity);
stringTimeValueParentEntityHashMap.put(parentId,timeValueParentEntity);
}
timeValueParentEntity = stringTimeValueParentEntityHashMap.get(parentId);
List<TimeValue> timeValues = timeValueParentEntity.getTimeValues();
timeValues.add(new TimeValue(UUID.randomUUID(),productionPlanDate,sumDinasWeight));
}
for (TimeValueParentEntity valueParentEntity : timeValueParentEntities) {
List<TimeValue> timeValues = valueParentEntity.getTimeValues();
setEveryDayValue(localStartDate, distance, timeValues);
}
return dischargingService.replaceShowType(showType, timeValueParentEntities);
}
@Override
public void setEveryDayValue(LocalDateTime localStartDate, long distance, List<TimeValue> timeValues) {
Stream.iterate(localStartDate, a -> a.plusDays(1)).limit(distance+1).forEach(
localTime -> {
Date from = Date.from(localTime.atZone(ZoneId.systemDefault()).toInstant());
boolean canAdd = true;
for (TimeValue timeValue : timeValues) {
if (DateUtils.isSameDay(from, timeValue.getTime())) {
canAdd = false;
}
}
if (canAdd) {
timeValues.add(new TimeValue(UUID.randomUUID(), from, 0.0d));
}
}
);
timeValues.sort(Comparator.comparing(TimeValue::getTime));
}
@Override
public Map<String, Object> getProductionDinasTypeGroup(List<UUID> stationIds, List<UUID> ids, Date startDate, Date endDate) {
Map<String, String> productionLineNameMap;
Set<Map<String, String>> productionLineNameSet = new HashSet<>();
Map<UUID, DinasTypeParent> dinasTypeMap = new HashMap<>(12);
List<DinasTypeParent> dinasTypeParents = new ArrayList<>();
Map<String, TimeValueParentEntity> productionLineMap = new HashMap<>(12);
List<TimeValueParentEntity> timeValueParentEntityList;
//根据生产线和砂石类型分组
List<Map<String, Object>> productionByDinasTypeAndProductionLine = productionPlanReportDao.getProductionByDinasTypeAndProductionLine(startDate, endDate, stationIds, ids);
for (Map<String, Object> stringObjectMap : productionByDinasTypeAndProductionLine) {
UUID productionLineId = UUID.fromString(stringObjectMap.get("productionLineId").toString());
UUID dinasTypeId = UUID.fromString(stringObjectMap.get("dinasTypeId").toString());
String dinasTypeName = stringObjectMap.get("dinasTypeName").toString();
String productionLineName = stringObjectMap.get("productionLineName").toString();
Double sumDinasWeight = Double.parseDouble(stringObjectMap.get("sumDinasWeight").toString());
productionLineNameMap=new HashMap<>(12);
productionLineNameMap.put("id",productionLineId.toString());
productionLineNameMap.put("name",productionLineName);
productionLineNameSet.add(productionLineNameMap);
if(!dinasTypeMap.containsKey(dinasTypeId)){
DinasTypeParent productionLineEchart = new DinasTypeParent();
productionLineEchart.setDinasTypeId(dinasTypeId);
productionLineEchart.setDinasTypeName(dinasTypeName);
productionLineEchart.setTimeValueParentEntityList(new ArrayList<>());
dinasTypeMap.put(dinasTypeId,productionLineEchart);
dinasTypeParents.add(productionLineEchart);
}
DinasTypeParent dinasTypeParent = dinasTypeMap.get(dinasTypeId);
timeValueParentEntityList = dinasTypeParent.getTimeValueParentEntityList();
if(!productionLineMap.containsKey(productionLineId.toString()+ dinasTypeId)){
TimeValueParentEntity timeValueParentEntity = new TimeValueParentEntity();
timeValueParentEntity.setParentId(productionLineId);
timeValueParentEntity.setParentName(productionLineName);
timeValueParentEntity.setTimeValues(new ArrayList<>());
timeValueParentEntityList.add(timeValueParentEntity);
productionLineMap.put(productionLineId.toString()+ dinasTypeId,timeValueParentEntity);
}
TimeValueParentEntity timeValueParentEntity = productionLineMap.get(productionLineId.toString() + dinasTypeId);
List<TimeValue> timeValues = timeValueParentEntity.getTimeValues();
timeValues.add(new TimeValue(UUID.randomUUID(),null,sumDinasWeight));
}
Map<String, Object> returnMap = new HashMap<>(2);
returnMap.put("productionLineNameSet",productionLineNameSet);
returnMap.put("dinasTypeParents",dinasTypeParents);
return returnMap;
}
@Override
public List<KObject> listByStationAndDate(UUID stationId, Date date) {
return productionPlanReportDao.listByStationAndDate(stationId,date, null);
}
......
......@@ -2,6 +2,7 @@ package com.xyst.dinas.production.service;
import com.beecode.bap.attachment.common.Page;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.production.entity.TimeValueParentEntity;
import java.util.Date;
import java.util.List;
......@@ -10,6 +11,8 @@ import java.util.UUID;
public interface DischargingService {
List<TimeValueParentEntity> replaceShowType(Integer showType, List<TimeValueParentEntity> timeValueParentEntities);
UUID addDischarging(KObject kObject);
......@@ -33,4 +36,6 @@ public interface DischargingService {
Page<KObject> queryPagingByCreator(Page<KObject> objectPage, Date startDate, Date endDate, UUID creatorId);
List<TimeValueParentEntity> getDischargingGroup(Date startDate, Date endDate, List<UUID> stationIds,List<UUID> regionalCompanyIds, Boolean isGroupByArea, Boolean isGroupByRegionalCompany, Boolean isGroupByStation, Integer showType);
}
......@@ -3,9 +3,13 @@ package com.xyst.dinas.production.service;
import com.beecode.bap.attachment.common.Page;
import com.beecode.bcp.type.KObject;
import com.fasterxml.jackson.databind.JsonNode;
import com.xyst.dinas.production.entity.TimeValue;
import com.xyst.dinas.production.entity.TimeValueParentEntity;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
public interface ProductionPlanReportService {
......@@ -40,4 +44,9 @@ public interface ProductionPlanReportService {
void warehousing(UUID productionLineIds);
List<TimeValueParentEntity> getProductionGroup(Date startDate, Date endDate, List<UUID> ids, List<UUID> stationIds, Boolean isGroupByProductionLine, Boolean isGroupByRegionalCompany, Boolean isGroupByStation,Integer showType);
void setEveryDayValue(LocalDateTime localStartDate, long distance, List<TimeValue> timeValues);
Map<String,Object> getProductionDinasTypeGroup(List<UUID> stationIds, List<UUID> ids, Date startDate, Date endDate);
}
......@@ -6,7 +6,7 @@ import com.beecode.bcp.type.KClass;
import com.beecode.bcp.type.KObject;
import com.beecode.bcp.type.json.JSONObjectUtils;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.beecode.nlib.utils.StringUtils;
import com.beecode.inz.common.BaseConstants;
import com.xyst.dinas.production.constant.DischargingConstant;
import com.xyst.dinas.production.service.DischargingService;
import org.slf4j.Logger;
......@@ -94,7 +94,7 @@ public class DischargingController {
public ResponseObj create(@RequestBody String body){
KObject kobject = JSONObjectUtils.toObject(body,Amino.getApplicationMetadataContext().getBean(DischargingConstant.ENTITY, KClass.class));
if(kobject.getUuid("id") == null){
if(kobject.getUuid(BaseConstants.ID) == null){
return ResponseObj.error(400,"'id' must be not null!");
}
UUID id = dischargingService.addDischarging(kobject);
......@@ -109,7 +109,7 @@ public class DischargingController {
@PutMapping
public ResponseObj update(@RequestBody String body){
KObject kobject = JSONObjectUtils.toObject(body,Amino.getApplicationMetadataContext().getBean(DischargingConstant.ENTITY, KClass.class));
if(kobject.getUuid("id") == null){
if(kobject.getUuid(BaseConstants.ID) == null){
return ResponseObj.error(400,"'id' must be not null!");
}
dischargingService.update(kobject);
......@@ -192,4 +192,28 @@ public class DischargingController {
}
/**
* 获取近xx天内xx的接驳量
* @param startDate 开始时间
* @param endDate yyyy-mm-dd 结束时间
* @param ids 区域公司id
* @return
*/
@GetMapping("/getDischargingGroupByDataChartLine")
public ResponseObj getDischargingGroupByDataChartLine( @DateTimeFormat(pattern = "yyyy-MM-dd") @RequestParam("startDate") Date startDate,
@DateTimeFormat(pattern = "yyyy-MM-dd") @RequestParam("endDate") Date endDate,
@RequestParam(value = "ids",required = false) List<UUID> ids,
@RequestParam(value = "stationIds",required = false) List<UUID> stationIds,
@RequestParam(value = "isGroupByArea",required = false,defaultValue = "true") Boolean isGroupByArea,
@RequestParam(value = "isGroupByRegionalCompany",required = false,defaultValue = "false") Boolean isGroupByRegionalCompany,
@RequestParam(value = "isGroupByStation",required = false,defaultValue = "false") Boolean isGroupByStation,
@RequestParam(value = "showType",required = false,defaultValue = "0") Integer showType
){
return ResponseObj.success("查询成功",dischargingService.getDischargingGroup(startDate,endDate,stationIds,ids,isGroupByArea,isGroupByRegionalCompany,isGroupByStation,showType));
}
}
\ No newline at end of file
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