Compare commits
No commits in common. '2324c280978f1657cc8c5923f3ceb5799c954c69' and 'd31dc80ec8dcd9690eab84a79d8ffa04f1951837' have entirely different histories.
2324c28097
...
d31dc80ec8
@ -1,64 +0,0 @@ |
|||||||
package com.bweb.excel.listener; |
|
||||||
|
|
||||||
import com.alibaba.excel.context.AnalysisContext; |
|
||||||
import com.alibaba.excel.event.AnalysisEventListener; |
|
||||||
import com.bweb.excel.model.ImportCompleteGasOrderReceiptModel; |
|
||||||
import com.hfkj.entity.BsGasOrderReceipt; |
|
||||||
import com.hfkj.service.gas.BsGasOrderReceiptService; |
|
||||||
import com.hfkj.sysenum.gas.GasOrderReceiptStatusEnum; |
|
||||||
import org.apache.commons.lang3.StringUtils; |
|
||||||
|
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @Auther: 胡锐 |
|
||||||
* @Description: 导入监听器 |
|
||||||
* @Date: 2021/3/20 21:03 |
|
||||||
*/ |
|
||||||
public class ImportCompleteGasOrderReceiptListener extends AnalysisEventListener<ImportCompleteGasOrderReceiptModel> { |
|
||||||
List<ImportCompleteGasOrderReceiptModel> errorData = new ArrayList<>(); |
|
||||||
List<BsGasOrderReceipt> successData = new ArrayList<>(); |
|
||||||
private BsGasOrderReceiptService gasOrderReceiptService; |
|
||||||
|
|
||||||
/** |
|
||||||
* @Author 胡锐 |
|
||||||
* @Description 解析到的每一条数据都会调用此方法 |
|
||||||
* @Date 2021/3/20 21:08 |
|
||||||
**/ |
|
||||||
@Override |
|
||||||
public void invoke(ImportCompleteGasOrderReceiptModel model, AnalysisContext analysisContext) { |
|
||||||
if (StringUtils.isNotBlank(model.getOrderNo())) { |
|
||||||
// 订单开票
|
|
||||||
BsGasOrderReceipt receipt = gasOrderReceiptService.getDetailByOrderNo(model.getOrderNo().trim(),GasOrderReceiptStatusEnum.status1); |
|
||||||
if (receipt == null) { |
|
||||||
//model.setErrorMessage("未找到交易单号开票申请数据");
|
|
||||||
//errorData.add(model);
|
|
||||||
return; |
|
||||||
} |
|
||||||
receipt.setStatus(GasOrderReceiptStatusEnum.status2.getStatus()); |
|
||||||
successData.add(receipt); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @Author 胡锐 |
|
||||||
* @Description 所有数据解析完成了 都会来调用此方法 |
|
||||||
* @Date 2021/3/20 21:08 |
|
||||||
**/ |
|
||||||
@Override |
|
||||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
|
||||||
if (!successData.isEmpty()) { |
|
||||||
gasOrderReceiptService.batchUpdate(successData); |
|
||||||
} |
|
||||||
this.successData.clear(); |
|
||||||
} |
|
||||||
|
|
||||||
public List<ImportCompleteGasOrderReceiptModel> getErrorData() { |
|
||||||
return errorData; |
|
||||||
} |
|
||||||
|
|
||||||
public void initData(BsGasOrderReceiptService gasOrderReceiptService) { |
|
||||||
this.gasOrderReceiptService = gasOrderReceiptService; |
|
||||||
} |
|
||||||
} |
|
@ -1,20 +0,0 @@ |
|||||||
package com.bweb.excel.model; |
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty; |
|
||||||
import lombok.Data; |
|
||||||
|
|
||||||
/** |
|
||||||
* 导入完成开票订单模型 |
|
||||||
* @author hurui |
|
||||||
*/ |
|
||||||
@Data |
|
||||||
public class ImportCompleteGasOrderReceiptModel { |
|
||||||
|
|
||||||
@ExcelProperty("交易单号") |
|
||||||
private String orderNo; |
|
||||||
/** |
|
||||||
* 错误消息 |
|
||||||
*/ |
|
||||||
private String errorMessage; |
|
||||||
|
|
||||||
} |
|
@ -1,48 +1,7 @@ |
|||||||
package com.hfkj.dao; |
package com.hfkj.dao; |
||||||
|
|
||||||
import com.hfkj.entity.BsGasOrderReceipt; |
|
||||||
import org.apache.ibatis.annotations.Insert; |
|
||||||
import org.apache.ibatis.annotations.Options; |
|
||||||
import org.apache.ibatis.annotations.Param; |
|
||||||
import org.apache.ibatis.annotations.Update; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
/** |
||||||
* mapper扩展类 |
* mapper扩展类 |
||||||
*/ |
*/ |
||||||
public interface BsGasOrderReceiptMapperExt { |
public interface BsGasOrderReceiptMapperExt { |
||||||
|
} |
||||||
@Update({ |
|
||||||
"<script>" + |
|
||||||
"<foreach collection='list' item='item' separator=';'>", |
|
||||||
" update bs_gas_order_receipt", |
|
||||||
" set apply_no = #{item.applyNo,jdbcType=VARCHAR},", |
|
||||||
" user_receipt_id = #{item.userReceiptId,jdbcType=BIGINT},", |
|
||||||
" company_name = #{item.companyName,jdbcType=VARCHAR},", |
|
||||||
" tax_no = #{item.taxNo,jdbcType=VARCHAR},", |
|
||||||
" contacts_phone = #{item.contactsPhone,jdbcType=VARCHAR},", |
|
||||||
" email = #{item.email,jdbcType=VARCHAR},", |
|
||||||
" agent_id = #{item.agentId,jdbcType=BIGINT},", |
|
||||||
" agent_name = #{item.agentName,jdbcType=VARCHAR},", |
|
||||||
" agent_staff_id = #{item.agentStaffId,jdbcType=BIGINT},", |
|
||||||
" agent_staff_name = #{item.agentStaffName,jdbcType=VARCHAR},", |
|
||||||
" mer_no = #{item.merNo,jdbcType=VARCHAR},", |
|
||||||
" mer_name = #{item.merName,jdbcType=VARCHAR},", |
|
||||||
" order_no = #{item.orderNo,jdbcType=VARCHAR},", |
|
||||||
" order_child_no = #{item.orderChildNo,jdbcType=VARCHAR},", |
|
||||||
" oil_no = #{item.oilNo,jdbcType=VARCHAR},", |
|
||||||
" amount = #{item.amount,jdbcType=DECIMAL},", |
|
||||||
" `status` = #{item.status,jdbcType=INTEGER},", |
|
||||||
" fail_remark = #{item.failRemark,jdbcType=VARCHAR},", |
|
||||||
" create_time = #{item.createTime,jdbcType=TIMESTAMP},", |
|
||||||
" update_time = #{item.updateTime,jdbcType=TIMESTAMP},", |
|
||||||
" ext_1 = #{item.ext1,jdbcType=VARCHAR},", |
|
||||||
" ext_2 = #{item.ext2,jdbcType=VARCHAR},", |
|
||||||
" ext_3 = #{item.ext3,jdbcType=VARCHAR}", |
|
||||||
" where id = #{item.id,jdbcType=BIGINT}", |
|
||||||
"</foreach>", |
|
||||||
"</script>" |
|
||||||
}) |
|
||||||
void batchUpdate(@Param("list") List<BsGasOrderReceipt> data); |
|
||||||
} |
|
Loading…
Reference in new issue