Commit 5e3c039d by yanHeng

[修改] 地磅数据兼容

parent 42bc3c0e
package com.xyst.dinas.contract.dao;
import java.util.UUID;
import com.beecode.bcp.type.KObject;
import java.util.List;
import java.util.UUID;
public interface SelfPickupCarDao {
void update(KObject kobject);
......@@ -13,4 +14,7 @@ public interface SelfPickupCarDao {
KObject load(UUID id);
KObject getCarInfoByContractId(UUID contractId);
List<KObject> queryListByCar(String carNum);
}
package com.xyst.dinas.contract.internal.dao;
import java.util.UUID;
import com.beecode.amino.core.Amino;
import com.beecode.bcp.type.KClass;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.biz.enumeration.SubmitStateEnum;
import com.xyst.dinas.contract.constant.SelfPickupCarConstant;
import com.xyst.dinas.contract.dao.SelfPickupCarDao;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateCallback;
import org.springframework.orm.hibernate5.HibernateOperations;
import org.springframework.stereotype.Repository;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.contract.constant.SelfPickupCarConstant;
import com.xyst.dinas.contract.dao.SelfPickupCarDao;
import java.util.List;
import java.util.UUID;
@Repository
public class SelfPickupCarDaoImpl implements SelfPickupCarDao {
......@@ -43,4 +48,12 @@ public class SelfPickupCarDaoImpl implements SelfPickupCarDao {
}
});
}
@Override
public List<KObject> queryListByCar(String carNum) {
KClass bean = Amino.getStaticMetadataContext().getBean(SelfPickupCarConstant.ENTITY, KClass.class);
DetachedCriteria detachedCriteria = DetachedCriteria.forEntityName(bean.getName());
detachedCriteria.add(Restrictions.like("carInfo", "%"+carNum+"%"));
return (List<KObject>)template.findByCriteria(detachedCriteria);
}
}
package com.xyst.dinas.contract.internal.service;
import java.util.Date;
import java.util.UUID;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.beecode.bcp.core.context.AminoContextHolder;
import com.beecode.bcp.type.KObject;
import com.beecode.inz.common.BaseConstants;
......@@ -18,6 +10,14 @@ import com.xyst.dinas.contract.internal.dao.ContractDao;
import com.xyst.dinas.contract.service.SelfPickupCarService;
import com.xyst.dinas.project.dao.ProjectFiledDao;
import com.xyst.dinas.project.dao.PurchaseSandCompanyDao;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Service
public class SelfPickupCarServiceImpl implements SelfPickupCarService {
......@@ -86,4 +86,9 @@ public class SelfPickupCarServiceImpl implements SelfPickupCarService {
return carInfo;
}
@Override
public List<KObject> queryListByCar(String carNum) {
return selfPickupCarDao.queryListByCar(carNum);
}
}
package com.xyst.dinas.contract.service;
import java.util.UUID;
import com.beecode.bcp.type.KObject;
import java.util.List;
import java.util.UUID;
public interface SelfPickupCarService {
UUID create(KObject kobject);
......@@ -11,4 +12,6 @@ public interface SelfPickupCarService {
void update(String param);
String getCarInfoByContractId(String contractId);
List<KObject> queryListByCar(String carNum);
}
......@@ -361,7 +361,8 @@ public class SalesPlanDao {
detachedCriteria.add(Restrictions.le("planningCycle.startTime", new Date()));
detachedCriteria.add(Restrictions.ge("planningCycle.endTime", new Date()));
detachedCriteria.add(Restrictions.eq("station.id", station.getUuid("id")));
detachedCriteria.add(Restrictions.like("carNumber", "%"+carNum+"%"));
// modify by 销售计划车辆撤销不维护 from yanH start
// detachedCriteria.add(Restrictions.like("carNumber", "%"+carNum+"%"));
return (List<KObject>) template.findByCriteria(detachedCriteria);
}
......@@ -411,7 +412,8 @@ public class SalesPlanDao {
detachedCriteria.add(Restrictions.ge("planningCycle.endTime", new Date()));
detachedCriteria.add(Restrictions.eq("station.id", station.getUuid("id")));
detachedCriteria.add(Restrictions.eq(BaseConstants.MASTER+"."+SalesPlanConstant.APPROVE_STATE, BizProcessState.DONE_WITH_AGREE.getValue()));
detachedCriteria.add(Restrictions.like("contract.carInfo", "%"+carNum+"%"));
// modify by 销售计划车辆撤销不维护 from yanH start
// detachedCriteria.add(Restrictions.like("contract.carInfo", "%"+carNum+"%"));
return (List<KObject>) template.findByCriteria(detachedCriteria);
}
}
......
......@@ -167,7 +167,8 @@ public class NeedPlanDaoImpl implements NeedPlanDao, NeedPlanConstant {
dinasTypeDao.addRegionalCompanyFilter(detachedCriteria);
detachedCriteria.add(Restrictions.eq("submitState", SubmitStateEnum.SUBMITTED.name()));
detachedCriteria.add(Restrictions.eq("planningCycle.id", planningCycleObj.getUuid("id")));
detachedCriteria.add(Restrictions.like("transportLicensePlateNumber", "%"+carNum+"%"));
// modify by 销售计划车辆撤销不维护 from yanH start
// detachedCriteria.add(Restrictions.like("transportLicensePlateNumber", "%"+carNum+"%"));
return (List<KObject>)template.findByCriteria(detachedCriteria);
}
......
......@@ -9,6 +9,7 @@ import com.beecode.bcp.type.KObject;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.beecode.util.Base64;
import com.xyst.dinas.biz.service.StationService;
import com.xyst.dinas.contract.service.SelfPickupCarService;
import com.xyst.dinas.sales.service.InventoryService;
import com.xyst.dinas.sales.service.SalesPlanService;
import com.xyst.dinas.sales.service.SalesRecordService;
......@@ -45,6 +46,8 @@ public class WeighbridgeSyncController {
private InventoryService inventoryService;
@Autowired
private AttachmentService attachmentService;
@Autowired
private SelfPickupCarService selfPickupCarService;
/**
......@@ -88,23 +91,28 @@ public class WeighbridgeSyncController {
if (station == null) {
return ResponseObj.error(500, "没有查询到地磅匹配的场站");
}
HashMap<String, Object> returnMap = new HashMap<>(4);
returnMap.put("code",200);
returnMap.put("message","查询成功");
if(StringUtils.isNotBlank(carNum)){
//根据车牌查询所属合同和销售计划
List<Map<String, Object>> salesPlan = salesPlanService.querySalesPlanByCarNum(station, carNum);
Collection<? extends Map<String, Object>> maps = vehicleDispatchService.vehicleDispatchService(station, carNum);
if (maps != null) {
salesPlan.addAll(maps);
}
if(salesPlan == null || salesPlan.isEmpty()){
//查询合同内自提车辆信息是否为自提
List<KObject> carInfoKObject = selfPickupCarService.queryListByCar(carNum);
if(carInfoKObject.size() > 0){ //如果有数据则为自提数据
//根据车牌查询所属合同和销售计划
List<Map<String, Object>> salesPlan = salesPlanService.querySalesPlanByCarNum(station, carNum);
Collection<? extends Map<String, Object>> maps = vehicleDispatchService.vehicleDispatchService(station, carNum);
if (maps != null) {
salesPlan.addAll(maps);
}
if(salesPlan != null || salesPlan.size()>0 ){
returnMap.put("saleType",1);
returnMap.put("data",salesPlan);
return returnMap;
}else {//否则认为是散户
return getDinasReturn(station, returnMap);
}
}else {//否则认为是散户
return getDinasReturn(station, returnMap);
}else{
returnMap.put("saleType",1);
returnMap.put("data",salesPlan);
return returnMap;
}
}else{
return getDinasReturn(station, returnMap);
......
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