| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | |
| | | }); |
| | | return R.ok("保存成功!!"); |
| | | } |
| | | |
| | | /** |
| | | * 表单明细修改 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public R updateOrderItem(AsnOrderAndItemsParams params) { |
| | | if (Objects.isNull(params.getOrders())) { |
| | | throw new CoolException("主单信息不能为空!!"); |
| | | } |
| | | if (Objects.isNull(params.getOrders().getId())) { |
| | | throw new CoolException("数据错误:单据ID不能为空!!"); |
| | | } |
| | | if (this.updateById(params.getOrders())) { |
| | | throw new CoolException("主单修改失败!!"); |
| | | } |
| | | if (Objects.isNull(params.getItems()) || params.getItems().isEmpty()) { |
| | | return R.ok("修改完成!!"); |
| | | } |
| | | List<Map<String, Object>> items = params.getItems(); |
| | | List<AsnOrderItem> asnOrderItems = JSONArray.parseArray(JSONArray.toJSONString(items), AsnOrderItem.class); |
| | | if (asnOrderItemService.saveOrUpdateBatch(asnOrderItems)) { |
| | | throw new CoolException("明细修改失败!!"); |
| | | } |
| | | return R.ok("修改完成!!"); |
| | | } |
| | | } |