|
@@ -11,10 +11,15 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.pj.api.dto.GoodsDto;
|
|
|
import com.pj.api.dto.HtGoodsDto;
|
|
|
import com.pj.enummj.DeleteStatus;
|
|
|
import com.pj.enummj.Status;
|
|
|
+import com.pj.tb_goods_type.TbGoodsType;
|
|
|
+import com.pj.tb_goods_type.TbGoodsTypeMapper;
|
|
|
+import com.pj.tb_trade_area.TbTradeArea;
|
|
|
+import com.pj.tb_trade_area.TbTradeAreaService;
|
|
|
import com.pj.utils.so.SoMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
@@ -26,9 +31,9 @@ import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import com.pj.utils.sg.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.swing.filechooser.FileSystemView;
|
|
|
|
|
|
/**
|
|
@@ -42,6 +47,10 @@ public class TbGoodsService extends ServiceImpl<TbGoodsMapper, TbGoods> implemen
|
|
|
/** 底层 Mapper 对象 */
|
|
|
@Autowired
|
|
|
TbGoodsMapper tbGoodsMapper;
|
|
|
+ @Autowired
|
|
|
+ TbGoodsTypeMapper tbGoodsTypeMapper;
|
|
|
+ @Resource
|
|
|
+ private TbTradeAreaService tbTradeAreaService;
|
|
|
|
|
|
@Autowired
|
|
|
private MethodGoodsService methodGoodsService;
|
|
@@ -81,6 +90,15 @@ public class TbGoodsService extends ServiceImpl<TbGoodsMapper, TbGoods> implemen
|
|
|
|
|
|
/** 远程调用: 同步航通海关监管商品信息 */
|
|
|
public boolean goodsDto(HtGoodsDto goodsDto){
|
|
|
+ //操作类型:01 新增,02,修改,03 删除
|
|
|
+ if("03".equals(goodsDto.getOpType())) {
|
|
|
+ boolean del = update(new LambdaUpdateWrapper<TbGoods>()
|
|
|
+ .set(TbGoods::getDeleteStatus,DeleteStatus.DELETE_STATUS_OFF.getCode())
|
|
|
+ .eq(TbGoods::getCode,goodsDto.getHsCode()));
|
|
|
+ return del;
|
|
|
+ }
|
|
|
+ TbTradeArea tbTradeArea = tbTradeAreaService.updateHandler(goodsDto.getFieldCode(), "");
|
|
|
+
|
|
|
TbGoods tbGoods = new TbGoods();
|
|
|
List<TbGoods> tbGoodsList = tbGoodsMapper.selectList(new LambdaQueryWrapper<TbGoods>().eq(TbGoods::getCode, goodsDto.getHsCode()));
|
|
|
//数据库没有就是新增
|
|
@@ -90,6 +108,8 @@ public class TbGoodsService extends ServiceImpl<TbGoodsMapper, TbGoods> implemen
|
|
|
tbGoods.setName(goodsDto.getgName());
|
|
|
tbGoods.setUnit(goodsDto.getgUnit());
|
|
|
tbGoods.setCode(goodsDto.getHsCode());
|
|
|
+ tbGoods.setTradeAreaId(tbTradeArea.getId());
|
|
|
+ tbGoods.setTradeAreaName(tbTradeArea.getName());
|
|
|
tbGoods.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode()); // 默认未删除
|
|
|
tbGoods.setStatus(Status.STATUS_ONE.getCode()); // 默认可用
|
|
|
tbGoods.setCreateTime(new Date());
|
|
@@ -102,6 +122,19 @@ public class TbGoodsService extends ServiceImpl<TbGoodsMapper, TbGoods> implemen
|
|
|
BeanUtils.copyProperties(goods,tbGoods);
|
|
|
BeanUtils.copyProperties(goodsDto,tbGoods);
|
|
|
int i = tbGoodsMapper.updateById(tbGoods);
|
|
|
+
|
|
|
+ //新增商品类目表
|
|
|
+ List<TbGoodsType> typeList = tbGoodsTypeMapper.selectList(new LambdaQueryWrapper<TbGoodsType>().eq(TbGoodsType::getNo, goodsDto.getThrItemCode()));
|
|
|
+ if(typeList.size() == 0) {
|
|
|
+ TbGoodsType goodsType = new TbGoodsType();
|
|
|
+ goodsType.setNo(goodsDto.getThrItemCode());
|
|
|
+ goodsType.setName(goodsDto.getThrItemName());
|
|
|
+ goodsType.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode()); // 默认未删除
|
|
|
+ goodsType.setCreateTime(new Date());
|
|
|
+ goodsType.setCreateName("航通");
|
|
|
+ tbGoodsTypeMapper.insert(goodsType);
|
|
|
+ }
|
|
|
+
|
|
|
return i == 1;
|
|
|
}
|
|
|
|