| | |
| | | import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.utils.CommonUtil; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate; |
| | |
| | | import com.vincent.rsf.server.manager.mapper.AsnOrderMapper; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.system.entity.Fields; |
| | | import com.vincent.rsf.server.system.entity.FieldsItem; |
| | | import com.vincent.rsf.server.system.service.FieldsItemService; |
| | | import com.vincent.rsf.server.system.service.FieldsService; |
| | | import com.vincent.rsf.server.system.utils.ExtendFieldsUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Autowired |
| | | private FieldsService fieldsService; |
| | | |
| | | @Autowired |
| | | private FieldsItemService fieldsItemService; |
| | | |
| | |
| | | |
| | | @Override |
| | | public boolean fieldsSave(Map<String, Object> params) { |
| | | List<Fields> fields = fieldsService.list(new LambdaQueryWrapper<Fields>().eq(Fields::getStatus, 1).eq(Fields::getFlagEnable, 1)); |
| | | List<FieldsItem> fieldsItems = new ArrayList<>(); |
| | | if (!fields.isEmpty()) { |
| | | String uuid16 = CommonUtil.randomUUID16(); |
| | | for (Fields obj : fields) { |
| | | if (!Objects.isNull(params.get(obj.getFields()))) { |
| | | FieldsItem item = new FieldsItem(); |
| | | item.setUuid(uuid16) |
| | | .setValue(params.get(obj.getFields()).toString()) |
| | | .setMatnrId(Long.parseLong(params.get("matnrId").toString())) |
| | | .setFieldsId(obj.getId()); |
| | | fieldsItems.add(item); |
| | | } |
| | | } |
| | | if (!fieldsItemService.saveBatch(fieldsItems)) { |
| | | throw new CoolException("单据明细扩展字段保存失败!!"); |
| | | } |
| | | } |
| | | //保存扩展字段 |
| | | ExtendFieldsUtils.saveFields(params); |
| | | AsnOrderItem asnOrderItem = JSONObject.parseObject(JSONObject.toJSONString(params), AsnOrderItem.class); |
| | | if (!this.save(asnOrderItem)) { |
| | | if (!this.saveOrUpdate(asnOrderItem)) { |
| | | throw new CoolException("收货通知单明细保存失败!!"); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<Map<String, Object>> listByAsnId(PageParam<AsnOrderItem, BaseParam> pageParam, QueryWrapper<AsnOrderItem> buildWrapper) { |
| | | IPage<Map<String, Object>> hsahMap = this.baseMapper.resultForMap(pageParam, buildWrapper); |
| | | if (hsahMap.getRecords().isEmpty()) { |
| | | return hsahMap.setRecords(new ArrayList<>()); |
| | | } |
| | | hsahMap.setRecords(ExtendFieldsUtils.getExtendFields(hsahMap.getRecords())); |
| | | return hsahMap; |
| | | |
| | | } |
| | | } |