|
@@ -4,12 +4,14 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.steerinfo.dil.mapper.RulesMapper;
|
|
|
import com.steerinfo.dil.mapper.TmstruckMeasureCommissionMapper;
|
|
|
+import com.steerinfo.dil.mapper.UtilsMapper;
|
|
|
import com.steerinfo.dil.model.TmstruckMeasureCommission;
|
|
|
import com.steerinfo.dil.service.ITmstruckMeasureCommissionService;
|
|
|
import com.steerinfo.dil.util.DataChange;
|
|
|
import com.steerinfo.dil.util.HTTPRequestUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
@@ -36,6 +38,10 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
|
|
|
@Autowired
|
|
|
private RulesMapper rulesMapper;
|
|
|
+ @Autowired
|
|
|
+ UtilsMapper utilsMapper;
|
|
|
+ @Autowired
|
|
|
+ private RulesServiceImpl rulesService;
|
|
|
|
|
|
* 查询计量委托 0 :计皮 1:计毛
|
|
|
* @param map orderTypee 订单类型 type 是计皮还是计毛
|
|
@@ -87,6 +93,9 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
|
|
|
|
|
|
Integer receiveId = 0 ;
|
|
|
+ if (DataChange.dataToBigDecimal(map.get("orderTypee")).intValue() == 11){
|
|
|
+ i += sendMeasureCommissionMes(map);
|
|
|
+ }
|
|
|
if(DataChange.dataToBigDecimal(map.get("orderTypee")).intValue() == 10){
|
|
|
receiveId = tmstruckMeasureCommissionMapper.getReceiveIdByRequirementOrderId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
}else{
|
|
@@ -101,22 +110,38 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
|
|
|
i += sendDXMeasureCommissionMes(map);
|
|
|
}
|
|
|
+
|
|
|
return i;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int sendMeasureCommssion(Map<String, Object> map) {
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public int sendMeasureCommssion(Map<String, Object> map) throws Exception {
|
|
|
+ int i=0;
|
|
|
|
|
|
- Integer orderType = (Integer) map.get("orderTypee");
|
|
|
+ BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
|
|
|
+ BigDecimal orderType = utilsMapper.getOrderTypeByOrderId(orderId);
|
|
|
+
|
|
|
switch (orderType.intValue()){
|
|
|
- case 1:
|
|
|
+ case 1:
|
|
|
+ List<Map<String, Object>> mapList = rulesService.judgeLastMaterial(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
+ map.put("materialId", mapList.get(0).get("materialId"));
|
|
|
+ i+=addXSMeasureCommission(map);
|
|
|
case 2:
|
|
|
- case 3:addXSMeasureCommission(map);
|
|
|
- break;
|
|
|
+ case 3:
|
|
|
+ List<Integer> materialIdList = utilsMapper.getMaterialIdByOrderId(orderId);
|
|
|
+ map.put("materialId", materialIdList.get(0));
|
|
|
+ i+=addXSMeasureCommission(map);
|
|
|
+ break;
|
|
|
case 12:
|
|
|
case 13:
|
|
|
case 15:
|
|
|
- case 16:addLXMeasureCommission(map);
|
|
|
+ case 20:
|
|
|
+ case 16:
|
|
|
+
|
|
|
+ Integer materialId = utilsMapper.getLxFirstMaterialId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
+ map.put("materialId", materialId);
|
|
|
+ i+=addLXMeasureCommission(map);
|
|
|
break;
|
|
|
case 5:
|
|
|
case 6:
|
|
@@ -124,10 +149,20 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
case 8:
|
|
|
case 9:
|
|
|
case 17:
|
|
|
- case 18:
|
|
|
+ case 18:
|
|
|
+ List<Integer> materialIds = utilsMapper.getMaterialIdByOrderId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
+ map.put("materialId", materialIds.get(0));
|
|
|
+ i+=addMaoMeasureCommission(map);
|
|
|
+ break;
|
|
|
+ case 10:
|
|
|
+ case 11:
|
|
|
+ i+=addMaoMeasureCommission(map);
|
|
|
|
|
|
}
|
|
|
- return 0;
|
|
|
+ if (i==0){
|
|
|
+ throw new Exception("委托发送失败");
|
|
|
+ }
|
|
|
+ return i;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -266,6 +301,8 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
measureCommission.put("IsAssembly", false);
|
|
|
measureCommission.put("deliveryMethod", "磅重交货");
|
|
|
measureCommission.put("packagesNum", 0);
|
|
|
+ measureCommission.put("ReceivUnit","四川省达州钢铁集团有限责任公司");
|
|
|
+ measureCommission.put("sendUnit","四川省达州钢铁集团有限责任公司");
|
|
|
break;
|
|
|
case 4:
|
|
|
break;
|