|
|
|
@ -12,7 +12,12 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.TransactionDefinition; |
|
|
|
import org.springframework.transaction.TransactionStatus; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.support.DefaultTransactionDefinition; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
@ -37,6 +42,8 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
private OrderGoodsSourceMapper orderGoodsSourceMapper; |
|
|
|
@Autowired |
|
|
|
private GoodsSourceMapper goodsSourceMapper; |
|
|
|
@Autowired |
|
|
|
private GoodsMapper goodsMapper; |
|
|
|
|
|
|
|
//分账相关
|
|
|
|
@Autowired |
|
|
|
@ -44,6 +51,10 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
@Autowired |
|
|
|
private AccountRatioDetailMapper accountRatioDetailMapper; |
|
|
|
|
|
|
|
// 声明式事物\
|
|
|
|
@Autowired |
|
|
|
private DataSourceTransactionManager transactionManager; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Order> getAllOrderList(int page) { |
|
|
|
|
|
|
|
@ -454,10 +465,34 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public int shutOrder(String batchcode) { |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Map<String,Object> shutOrder(String batchcode) { |
|
|
|
Map retmap =new HashMap(); |
|
|
|
String msg="订单关闭不成功"; |
|
|
|
int code=400; |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
String now = sdf.format(new Date()); |
|
|
|
return orderMapper.shutOrder(batchcode,now); |
|
|
|
|
|
|
|
int ret=0; |
|
|
|
ret = orderMapper.shutOrder(batchcode,now); |
|
|
|
// 设置商品信息
|
|
|
|
List<OrderDetailVo> odlist = orderGoodsDetailMapper.getOrderDetailVo(batchcode); |
|
|
|
if(odlist!=null){ |
|
|
|
for(OrderDetailVo odv:odlist){ |
|
|
|
if("1".equals(odv.getGoods_entrust()) ){ // 判断状态商品委托类型
|
|
|
|
// 更新产品专题
|
|
|
|
goodsMapper.updateGoodsField("goods_status","1",odv.getGoods_islicode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(ret==0){ |
|
|
|
msg="订单关闭成功"; |
|
|
|
code=200; |
|
|
|
} |
|
|
|
//
|
|
|
|
retmap.put("msg",msg); |
|
|
|
retmap.put("code",code); |
|
|
|
return retmap; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|