|
|
@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.fin.api.finvehicleinvoice.*; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
@ -11,6 +12,7 @@ import com.yxt.common.core.vo.PagerVo; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -28,6 +30,9 @@ import java.util.List; |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class FinVehicleInvoiceService extends MybatisBaseService<FinVehicleInvoiceMapper, FinVehicleInvoice> { |
|
|
|
@Resource |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
|
|
|
|
public PagerVo<FinVehicleInvoice> listPage(PagerQuery<FinVehicleInvoiceQuery> pq) { |
|
|
|
FinVehicleInvoiceQuery query = pq.getParams(); |
|
|
|
QueryWrapper<FinVehicleInvoice> qw = createQueryWrapper(query); |
|
|
@ -183,4 +188,51 @@ public class FinVehicleInvoiceService extends MybatisBaseService<FinVehicleInvoi |
|
|
|
return vo; |
|
|
|
} |
|
|
|
|
|
|
|
public int myUpdateBySid(FinVehicleInvoiceDto dto, String sid) { |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|
|
|
if (null != dto.getFilePaths()) { |
|
|
|
for (String filePath : dto.getFilePaths()) { |
|
|
|
String[] split = filePath.split(urlPrefix); |
|
|
|
String s = split[1]; |
|
|
|
sb.append(s).append(","); |
|
|
|
} |
|
|
|
sb.delete(sb.length() - 1, sb.length()); |
|
|
|
dto.setFilePath(sb.toString()); |
|
|
|
} |
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getFilePath())) { |
|
|
|
dto.setBillingStateKey("002"); |
|
|
|
dto.setBillingState("已开票"); |
|
|
|
} |
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotEmpty(dto.getVinNo())) { |
|
|
|
String VIN = dto.getVinNo(); |
|
|
|
dto.setVIN(VIN); |
|
|
|
} |
|
|
|
return updateBySid(dto,sid); |
|
|
|
} |
|
|
|
|
|
|
|
public boolean mySave(FinVehicleInvoiceDto dto) { |
|
|
|
FinVehicleInvoice finVehicleInvoice = new FinVehicleInvoice(); |
|
|
|
String sidAdd = finVehicleInvoice.getSid(); |
|
|
|
BeanUtil.copyProperties(dto, finVehicleInvoice); |
|
|
|
finVehicleInvoice.setSid(sidAdd); |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|
|
|
if (null != dto.getFilePaths()) { |
|
|
|
for (String filePath : dto.getFilePaths()) { |
|
|
|
String[] split = filePath.split(urlPrefix); |
|
|
|
String s = split[1]; |
|
|
|
sb.append(s).append(","); |
|
|
|
} |
|
|
|
sb.delete(sb.length() - 1, sb.length()); |
|
|
|
finVehicleInvoice.setFilePath(sb.toString()); |
|
|
|
finVehicleInvoice.setBillingStateKey("002"); |
|
|
|
finVehicleInvoice.setBillingState("已开票"); |
|
|
|
} |
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotEmpty(dto.getVinNo())) { |
|
|
|
String VIN = dto.getVinNo(); |
|
|
|
finVehicleInvoice.setVIN(VIN); |
|
|
|
} |
|
|
|
return save(finVehicleInvoice); |
|
|
|
} |
|
|
|
} |