|
@@ -3,7 +3,9 @@ package com.steerinfo.dil.controller;
|
|
|
import com.steerinfo.dil.feign.ColumnDataFeign;
|
|
|
import com.steerinfo.dil.feign.ESFeign;
|
|
|
import com.steerinfo.dil.mapper.AmsContractTruckPriceMapper;
|
|
|
+import com.steerinfo.dil.mapper.RmsReceivePlaceMapper;
|
|
|
import com.steerinfo.dil.model.AmsContractTransportPrice;
|
|
|
+import com.steerinfo.dil.model.RmsReceivePlace;
|
|
|
import com.steerinfo.dil.service.IAmsContractTruckPriceService;
|
|
|
import com.steerinfo.dil.util.BaseRESTfulController;
|
|
|
import com.steerinfo.dil.util.ColumnDataUtil;
|
|
@@ -56,16 +58,149 @@ public class AmsContractTruckPriceController extends BaseRESTfulController {
|
|
|
@Autowired
|
|
|
AmsContractTruckPriceMapper amsContractTruckPriceMapper;
|
|
|
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ RmsReceivePlaceMapper rmsReceivePlaceMapper;
|
|
|
+
|
|
|
+ @ApiOperation(value="导入单价的数据写入数据库")
|
|
|
@PostMapping("/importDataForAmsContractTransportPrice")
|
|
|
- public RESTfulResult importDataForAmsContractTransportPrice(@RequestBody(required = false) List<Map<String,Object>> mapList){
|
|
|
+ public RESTfulResult importDataForAmsContractTransportPrice(@RequestBody(required = false) List<Map<String,Object>> mapList,
|
|
|
+ BigDecimal importPriceValue,String importPriceDate) throws ParseException {
|
|
|
|
|
|
|
|
|
|
|
|
- amsContractTruckPriceMapper
|
|
|
+
|
|
|
+ Date date=new Date();
|
|
|
+ SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
for (Map<String, Object> stringObjectMap : mapList) {
|
|
|
+ String address="";
|
|
|
+ String addressProvince="";
|
|
|
+ String addressDistrict="";
|
|
|
+ String addressDdp="";
|
|
|
+
|
|
|
+ String s = (String) stringObjectMap.get("addressProvince");
|
|
|
+ if(s!=null){
|
|
|
+ addressProvince= s.replaceAll("省", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ String s1 = (String) stringObjectMap.get("addressDistrict");
|
|
|
+ if(s1!=null){
|
|
|
+ addressDistrict = s1.replaceAll("市", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ String addressTown = (String) stringObjectMap.get("addressTown");
|
|
|
+ if (addressTown==null){
|
|
|
+ addressTown=addressDistrict;
|
|
|
+ addressDistrict=addressProvince;
|
|
|
+ }
|
|
|
+
|
|
|
+ String addressDeliveryAddress = (String) stringObjectMap.get("addressDeliveryAddress");
|
|
|
+ if (addressDeliveryAddress==null){
|
|
|
+ addressDeliveryAddress=addressTown;
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal priceValue = DataChange.dataToBigDecimal(stringObjectMap.get("priceValue"));
|
|
|
+ if (priceValue==null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal haulDistance = DataChange.dataToBigDecimal(stringObjectMap.get("haulDistance"));
|
|
|
+
|
|
|
+ BigDecimal priceTonKilometer = DataChange.dataToBigDecimal(stringObjectMap.get("priceTonKilometer"));
|
|
|
+
|
|
|
+ addressDdp="%"+addressProvince+addressDistrict+addressTown+"%";
|
|
|
+
|
|
|
+ address="%"+addressProvince+addressDistrict+addressTown+addressDeliveryAddress+"%";
|
|
|
+
|
|
|
+ Map<String, Object> amsPriceForImport = amsContractTruckPriceMapper.getAmsContractTransportPriceForImport(address);
|
|
|
+
|
|
|
+ BigDecimal priceId=BigDecimal.ZERO;
|
|
|
+ BigDecimal placeId=BigDecimal.ZERO;
|
|
|
+ if (amsPriceForImport!=null){
|
|
|
+ if (amsPriceForImport.get("priceId")!=null){
|
|
|
+ priceId= DataChange.dataToBigDecimal(amsPriceForImport.get("priceId"));
|
|
|
+ }
|
|
|
+ placeId= DataChange.dataToBigDecimal(amsPriceForImport.get("placeId"));
|
|
|
+ }
|
|
|
+ BigDecimal addressId = amsContractTruckPriceMapper.getAddressIdForImport(addressDdp);
|
|
|
+
|
|
|
+ if (addressId==null){
|
|
|
+ amsContractTruckPriceMapper.insertIntoRRAForImport(addressProvince,addressDistrict,addressTown);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ AmsContractTransportPrice amsContractTransportPrice = new AmsContractTransportPrice();
|
|
|
+
|
|
|
+ amsContractTransportPrice.setType(new BigDecimal(1));
|
|
|
+ amsContractTransportPrice.setInsertUsername("admin");
|
|
|
+ amsContractTransportPrice.setInsertTime(date);
|
|
|
+ amsContractTransportPrice.setUpdateUsername("admin");
|
|
|
+ amsContractTransportPrice.setUpdateTime(date);
|
|
|
+ amsContractTransportPrice.setInsertUpdateRemark("无");
|
|
|
+ amsContractTransportPrice.setDeleted(new BigDecimal(0));
|
|
|
+ amsContractTransportPrice.setShipperId(new BigDecimal(1));
|
|
|
+ amsContractTransportPrice.setOilpriceChangeThreshold(new BigDecimal(0.05));
|
|
|
+ amsContractTransportPrice.setOilTypeId(new BigDecimal(10));
|
|
|
+ amsContractTransportPrice.setCargonameId(new BigDecimal(14));
|
|
|
+ amsContractTransportPrice.setPriceValue(priceValue);
|
|
|
+ amsContractTransportPrice.setPriceDate(simpleDateFormat.parse(importPriceDate));
|
|
|
+ amsContractTransportPrice.setOilpriceBase(importPriceValue);
|
|
|
+ if (haulDistance!=null){
|
|
|
+ amsContractTransportPrice.setHaulDistance(haulDistance);
|
|
|
+ }
|
|
|
+ if (priceTonKilometer!=null){
|
|
|
+ amsContractTransportPrice.setPriceTonKilometer(priceTonKilometer);
|
|
|
+ }
|
|
|
+ if (amsPriceForImport==null||amsPriceForImport.get("placeId")==null){
|
|
|
+
|
|
|
+ RmsReceivePlace rmsReceivePlace = new RmsReceivePlace();
|
|
|
+ rmsReceivePlace.setAddressId(addressId);
|
|
|
+ rmsReceivePlace.setAddressDeliveryAddress(addressDeliveryAddress);
|
|
|
+ rmsReceivePlace.setPlaceId(rmsReceivePlaceMapper.selectMaxId());
|
|
|
+ amsContractTransportPrice.setPlaceId(rmsReceivePlace.getPlaceId());
|
|
|
+ rmsReceivePlaceMapper.insertSelective(rmsReceivePlace);
|
|
|
+ }else {
|
|
|
+ amsContractTransportPrice.setPlaceId(placeId);
|
|
|
+ }
|
|
|
+
|
|
|
+ String carrierName = (String) stringObjectMap.get("carrierName");
|
|
|
+ if (amsPriceForImport!=null&&amsPriceForImport.get("priceId")!=null){
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ for (BigDecimal bigDecimal : carrierIdForImport) {
|
|
|
+ amsContractTransportPrice.setCarrierId(bigDecimal);
|
|
|
+ }*/
|
|
|
+
|
|
|
+ amsContractTruckPriceMapper.updateForImport(placeId,simpleDateFormat.format(date));
|
|
|
+ if (carrierName!=null){
|
|
|
+ String[] split = carrierName.split("/");
|
|
|
+ for (String s2 : split) {
|
|
|
+ BigDecimal carrierIdForCarrierName = amsContractTruckPriceMapper.getCarrierIdForCarrierName("%" + s2 + "%");
|
|
|
+ amsContractTransportPrice.setCarrierId(carrierIdForCarrierName);
|
|
|
+ amsContractTransportPrice.setPriceId(amsContractTruckPriceMapper.selectMaxId());
|
|
|
+ amsContractTruckPriceMapper.insertSelective(amsContractTransportPrice);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ amsContractTransportPrice.setPriceId(amsContractTruckPriceMapper.selectMaxId());
|
|
|
+ amsContractTruckPriceMapper.insertSelective(amsContractTransportPrice);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (carrierName!=null){
|
|
|
+ String[] split = carrierName.split("/");
|
|
|
+ for (String s2 : split) {
|
|
|
+ BigDecimal carrierIdForCarrierName = amsContractTruckPriceMapper.getCarrierIdForCarrierName("%" + s2 + "%");
|
|
|
+ amsContractTransportPrice.setCarrierId(carrierIdForCarrierName);
|
|
|
+ amsContractTransportPrice.setPriceId(amsContractTruckPriceMapper.selectMaxId());
|
|
|
+ amsContractTruckPriceMapper.insertSelective(amsContractTransportPrice);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ amsContractTransportPrice.setPriceId(amsContractTruckPriceMapper.selectMaxId());
|
|
|
+ amsContractTruckPriceMapper.insertSelective(amsContractTransportPrice);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }*/
|
|
|
+ return success("导入成功");
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value="查询汽运单价信息")
|
|
|
@ApiImplicitParams({
|