|
|
@ -4,8 +4,12 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
|
|
|
import com.glxp.api.dao.auth.AuthCompanyMapper;
|
|
|
|
import com.glxp.api.dao.thrsys.ThrProductsAddDiDao;
|
|
|
|
import com.glxp.api.dao.thrsys.ThrProductsAddDiDao;
|
|
|
|
|
|
|
|
import com.glxp.api.entity.auth.AuthCompany;
|
|
|
|
import com.glxp.api.entity.basic.ProductInfoEntity;
|
|
|
|
import com.glxp.api.entity.basic.ProductInfoEntity;
|
|
|
|
import com.glxp.api.entity.thrsys.ThrProductsAddDiEntity;
|
|
|
|
import com.glxp.api.entity.thrsys.ThrProductsAddDiEntity;
|
|
|
|
import com.glxp.api.req.thrsys.AddThrDiProductsRequest;
|
|
|
|
import com.glxp.api.req.thrsys.AddThrDiProductsRequest;
|
|
|
@ -13,8 +17,6 @@ import com.glxp.api.req.thrsys.FilterThrProductsRequest;
|
|
|
|
import com.glxp.api.res.thrsys.ThrProductsAddDiResponse;
|
|
|
|
import com.glxp.api.res.thrsys.ThrProductsAddDiResponse;
|
|
|
|
import com.glxp.api.res.thrsys.UdiInfoResponse;
|
|
|
|
import com.glxp.api.res.thrsys.UdiInfoResponse;
|
|
|
|
import com.glxp.api.service.basic.ProductInfoService;
|
|
|
|
import com.glxp.api.service.basic.ProductInfoService;
|
|
|
|
import com.glxp.api.service.thrsys.ThrProductsAddDiService;
|
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
@ -25,14 +27,14 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService {
|
|
|
|
public class ThrProductsAddDiService extends ServiceImpl<ThrProductsAddDiDao, ThrProductsAddDiEntity> {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ThrProductsAddDiDao thrProductsAddDiDao;
|
|
|
|
private ThrProductsAddDiDao thrProductsAddDiDao;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ProductInfoService productInfoService;
|
|
|
|
private ProductInfoService productInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<ThrProductsAddDiResponse> filterThrProductsList(FilterThrProductsRequest filterThrProductsRequest) {
|
|
|
|
public List<ThrProductsAddDiResponse> filterThrProductsList(FilterThrProductsRequest filterThrProductsRequest) {
|
|
|
|
if (null != filterThrProductsRequest && filterThrProductsRequest.getPage() != null) {
|
|
|
|
if (null != filterThrProductsRequest && filterThrProductsRequest.getPage() != null) {
|
|
|
|
int offset = (filterThrProductsRequest.getPage() - 1) * filterThrProductsRequest.getLimit();
|
|
|
|
int offset = (filterThrProductsRequest.getPage() - 1) * filterThrProductsRequest.getLimit();
|
|
|
@ -49,7 +51,7 @@ public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService {
|
|
|
|
return thrProductsAddDiResponses;
|
|
|
|
return thrProductsAddDiResponses;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public ThrProductsAddDiResponse selecById(Long id) {
|
|
|
|
public ThrProductsAddDiResponse selecById(Long id) {
|
|
|
|
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
|
|
|
|
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
|
|
|
|
filterThrProductsRequest.setId(id);
|
|
|
|
filterThrProductsRequest.setId(id);
|
|
|
@ -60,7 +62,7 @@ public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public ThrProductsAddDiResponse selecByUuid(String uuid) {
|
|
|
|
public ThrProductsAddDiResponse selecByUuid(String uuid) {
|
|
|
|
if (StrUtil.isEmpty(uuid)) {
|
|
|
|
if (StrUtil.isEmpty(uuid)) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
@ -74,17 +76,22 @@ public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
|
|
|
|
public boolean exits(String devKey) {
|
|
|
|
|
|
|
|
return thrProductsAddDiDao.exists(new QueryWrapper<ThrProductsAddDiEntity>().eq("deviceRecordKey", devKey));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean delThrDiProducts(Long id) {
|
|
|
|
public boolean delThrDiProducts(Long id) {
|
|
|
|
return thrProductsAddDiDao.deleteById(id);
|
|
|
|
return thrProductsAddDiDao.deleteById(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean updateDiProduct(ThrProductsAddDiEntity thrProductsAddDiEntity) {
|
|
|
|
public boolean updateDiProduct(ThrProductsAddDiEntity thrProductsAddDiEntity) {
|
|
|
|
return thrProductsAddDiDao.updateDiProduct(thrProductsAddDiEntity);
|
|
|
|
return thrProductsAddDiDao.updateDiProduct(thrProductsAddDiEntity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean addThrAddDiProducts(AddThrDiProductsRequest thrDiProductsRequest) {
|
|
|
|
public boolean addThrAddDiProducts(AddThrDiProductsRequest thrDiProductsRequest) {
|
|
|
|
|
|
|
|
|
|
|
|
List<String> uuids = thrDiProductsRequest.getUuids();
|
|
|
|
List<String> uuids = thrDiProductsRequest.getUuids();
|
|
|
@ -95,7 +102,7 @@ public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService {
|
|
|
|
ProductInfoEntity productInfoEntity = productInfoService.selectByUuid(uuid).get(0);
|
|
|
|
ProductInfoEntity productInfoEntity = productInfoService.selectByUuid(uuid).get(0);
|
|
|
|
ThrProductsAddDiEntity thrProductsAddDiEntity = new ThrProductsAddDiEntity();
|
|
|
|
ThrProductsAddDiEntity thrProductsAddDiEntity = new ThrProductsAddDiEntity();
|
|
|
|
BeanUtil.copyProperties(thrDiProductsRequest, thrProductsAddDiEntity);
|
|
|
|
BeanUtil.copyProperties(thrDiProductsRequest, thrProductsAddDiEntity);
|
|
|
|
thrProductsAddDiEntity.setCustomerId(customerId + "");
|
|
|
|
thrProductsAddDiEntity.setCustomerId(customerId);
|
|
|
|
thrProductsAddDiEntity.setUuid(uuid);
|
|
|
|
thrProductsAddDiEntity.setUuid(uuid);
|
|
|
|
thrProductsAddDiEntity.setType(1);
|
|
|
|
thrProductsAddDiEntity.setType(1);
|
|
|
|
thrProductsAddDiEntity.setYlqxzcrbarywmc(productInfoEntity.getYlqxzcrbarywmc());
|
|
|
|
thrProductsAddDiEntity.setYlqxzcrbarywmc(productInfoEntity.getYlqxzcrbarywmc());
|
|
|
@ -130,11 +137,11 @@ public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService {
|
|
|
|
return thrProductsAddDiDao.insertThrDiProducts(list);
|
|
|
|
return thrProductsAddDiDao.insertThrDiProducts(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public UdiInfoResponse getDiProductDetail(String uuid) {
|
|
|
|
public UdiInfoResponse getDiProductDetail(String uuid) {
|
|
|
|
ThrProductsAddDiEntity thrProductsAddDiEntity = thrProductsAddDiDao.filterThrProductsGetUuid(uuid);
|
|
|
|
ThrProductsAddDiEntity thrProductsAddDiEntity = thrProductsAddDiDao.filterThrProductsGetUuid(uuid);
|
|
|
|
UdiInfoResponse udiInfoResponse = thrProductsAddDiDao.getDiProductDetail(uuid);
|
|
|
|
UdiInfoResponse udiInfoResponse = thrProductsAddDiDao.getDiProductDetail(uuid);
|
|
|
|
if(udiInfoResponse!=null){
|
|
|
|
if (udiInfoResponse != null) {
|
|
|
|
udiInfoResponse.setSptm(thrProductsAddDiEntity.getSptm());
|
|
|
|
udiInfoResponse.setSptm(thrProductsAddDiEntity.getSptm());
|
|
|
|
udiInfoResponse.setYbbm(thrProductsAddDiEntity.getYbbm());
|
|
|
|
udiInfoResponse.setYbbm(thrProductsAddDiEntity.getYbbm());
|
|
|
|
udiInfoResponse.setManufactory(thrProductsAddDiEntity.getManufactory());
|
|
|
|
udiInfoResponse.setManufactory(thrProductsAddDiEntity.getManufactory());
|
|
|
@ -154,22 +161,22 @@ public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService {
|
|
|
|
return udiInfoResponse;
|
|
|
|
return udiInfoResponse;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public ThrProductsAddDiEntity filterThrProductsGetId(Integer id) {
|
|
|
|
public ThrProductsAddDiEntity filterThrProductsGetId(Integer id) {
|
|
|
|
return thrProductsAddDiDao.filterThrProductsGetId(id);
|
|
|
|
return thrProductsAddDiDao.filterThrProductsGetId(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean insertThrProducts(ThrProductsAddDiEntity thrProductsAddDiEntity) {
|
|
|
|
public int insertThrProducts(ThrProductsAddDiEntity thrProductsAddDiEntity) {
|
|
|
|
return thrProductsAddDiDao.insert(thrProductsAddDiEntity);
|
|
|
|
return thrProductsAddDiDao.insert(thrProductsAddDiEntity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<ThrProductsAddDiResponse> filterThrProductsDiList(FilterThrProductsRequest filterThrProductsRequest) {
|
|
|
|
public List<ThrProductsAddDiResponse> filterThrProductsDiList(FilterThrProductsRequest filterThrProductsRequest) {
|
|
|
|
return thrProductsAddDiDao.filterThrProductsDiList(filterThrProductsRequest);
|
|
|
|
return thrProductsAddDiDao.filterThrProductsDiList(filterThrProductsRequest);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<ThrProductsAddDiEntity> filterThrProductsDiLists(FilterThrProductsRequest filterThrProductsRequest) {
|
|
|
|
public List<ThrProductsAddDiEntity> filterThrProductsDiLists(FilterThrProductsRequest filterThrProductsRequest) {
|
|
|
|
return thrProductsAddDiDao.filterThrProductsDiLists(filterThrProductsRequest);
|
|
|
|
return thrProductsAddDiDao.filterThrProductsDiLists(filterThrProductsRequest);
|
|
|
|
}
|
|
|
|
}
|