Commit 58c219e6 authored by eddie.woo's avatar eddie.woo

modify

parent 708d8bd0
......@@ -195,14 +195,16 @@
<version>1.11</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
......
......@@ -17,6 +17,7 @@ import org.springframework.util.StringUtils;
import pwc.taxtech.atms.dao.UserMapper;
import pwc.taxtech.atms.entitiy.User;
import pwc.taxtech.atms.security.JwtUser;
@Component
public class AuthUserHelperImpl implements AuditorAware<String>, AuthUserHelper {
......@@ -56,12 +57,19 @@ public class AuthUserHelperImpl implements AuditorAware<String>, AuthUserHelper
*/
@Override
public String getCurrentUserID() {
String userName = getCurrentAuditor();
User user = userMapper.selectByUserNameIgnoreCase(userName); //todo 加缓存
if (user == null) {
SecurityContext context = SecurityContextHolder.getContext();
if (context == null) {
throw new ApplicationException("security context is null");
}
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null || !authentication.isAuthenticated()) {
throw new ApplicationException("authentication failed");
}
JwtUser jwtUser = (JwtUser) authentication.getPrincipal();
if (jwtUser == null) {
return "";
}
return user.getID();
return jwtUser.getUserid();
}
/*
......
......@@ -18,6 +18,7 @@ public class FTPClientPool {
private GenericObjectPool<FTPClient> pool;
private String ftpRootPath;
private static final String SYMBOL = "/";
private FTPClientConfig ftpClientConfig;
@Value("${ftp.host}")
private String ftpHost;
......@@ -36,6 +37,7 @@ public class FTPClientPool {
clientConfig.setPort(ftpPort);
clientConfig.setUsername(ftpUser);
clientConfig.setPassword(ftpPwd);
ftpClientConfig = clientConfig;
pool = new GenericObjectPool<>(new FtpClientFactory(clientConfig), config);
ftpRootPath = pool.borrowObject().printWorkingDirectory();
}
......@@ -129,4 +131,8 @@ public class FTPClientPool {
client.deleteFile(filePath);
}
}
public FTPClientConfig getFtpClientConfig() {
return ftpClientConfig;
}
}
package pwc.taxtech.atms.constant.task;
import java.util.HashMap;
import java.util.Map;
public class TaskListConstant {
/**
* 任务类型
*/
public enum Type {
ScanInvoice(1, "发票扫描");
private int code;
private String name;
Type(int code, String name) {
this.code = code;
this.name = name;
}
public int getCode() {
return code;
}
public String getName() {
return name;
}
}
/**
* 任务状态
*/
public enum Status {
Init(0, "初始状态"),
Processing(1, "执行中"),
Success(2, "任务成功"),
Failed(3, "任务失败");
private int code;
private String name;
public static final Map<Integer, String> MAP = new HashMap<>();
static {
for (Status status : Status.values()) {
MAP.put(status.getCode(), status.getName());
}
}
Status(int code, String name) {
this.code = code;
this.name = name;
}
public int getCode() {
return code;
}
public String getName() {
return name;
}
}
}
......@@ -4,15 +4,13 @@ import org.apache.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.github.pagehelper.PageHelper;
import io.swagger.annotations.ApiOperation;
import pwc.taxtech.atms.controller.BaseController;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.input.CamelPagingDto;
import pwc.taxtech.atms.dto.input.CamelPagingResultDto;
......@@ -131,4 +129,26 @@ public class InvoiceManageController extends BaseController {
InvoiceFilterDto invoiceFilterDto=invoiceManageService.getInvoiceFilterBasicData();
return invoiceFilterDto;
}
@ResponseBody
@RequestMapping(value = "scan", method = RequestMethod.GET)
public ApiResultDto scan() {
try {
return ApiResultDto.success(invoiceManageService.scan());
} catch (Exception e) {
logger.error(" create scan error.", e);
}
return ApiResultDto.fail("创建扫描失败");
}
@ResponseBody
@RequestMapping(value = "scanResult", method = RequestMethod.GET)
public ApiResultDto getScanResult(@RequestParam Long taskId) {
try {
return ApiResultDto.success(invoiceManageService.scan());
} catch (Exception e) {
logger.error(" create scan error.", e);
}
return ApiResultDto.fail("创建扫描失败");
}
}
package pwc.taxtech.atms.controller.vendor;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.common.ServiceException;
import pwc.taxtech.atms.controller.BaseController;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.vendor.LgItemDto;
import pwc.taxtech.atms.dto.vendor.LgVendorDto;
import pwc.taxtech.atms.service.vendor.LongiService;
import java.util.List;
@RestController
@RequestMapping("/vendor/api/v1/scan")
public class ScanController extends BaseController {
@Autowired
private LongiService longiService;
@ApiOperation(value = "批量更新扫描结果")
@RequestMapping(value = "update", method = RequestMethod.POST)
public ApiResultDto updateItems(@RequestBody List<LgItemDto> lgItemDtoList) {
try {
longiService.updateItems(lgItemDtoList);
} catch (ServiceException e) {
return ApiResultDto.fail(e.getMessage());
}
return ApiResultDto.success();
}
}
......@@ -4,11 +4,13 @@ import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.InputInvoice;
import pwc.taxtech.atms.entitiy.InputInvoiceExample;
@Mapper
@Repository
public interface InputInvoiceMapper extends MyMapper {
/**
* This method was generated by MyBatis Generator.
......
package pwc.taxtech.atms.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.TaskList;
import pwc.taxtech.atms.entitiy.TaskListExample;
@Mapper
@Repository
public interface TaskListMapper extends MyMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
long countByExample(TaskListExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
int deleteByExample(TaskListExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
int insert(TaskList record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
int insertSelective(TaskList record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
List<TaskList> selectByExampleWithRowbounds(TaskListExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
List<TaskList> selectByExample(TaskListExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
TaskList selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") TaskList record, @Param("example") TaskListExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
int updateByExample(@Param("record") TaskList record, @Param("example") TaskListExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(TaskList record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
int updateByPrimaryKey(TaskList record);
}
\ No newline at end of file
package pwc.taxtech.atms.dao.dao;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.InputDeviceMapper;
import pwc.taxtech.atms.entitiy.InputDevice;
import pwc.taxtech.atms.entitiy.InputDeviceExample;
import java.util.Optional;
@Service
public class InputDeviceDao {
@Autowired
private InputDeviceMapper mapper;
/**
* 获取扫描仪
* @return Optional
*/
public Optional<InputDevice> getScan() {
InputDeviceExample example = new InputDeviceExample();
InputDeviceExample.Criteria criteria = example.createCriteria();
criteria.andTypeEqualTo(1); //扫描仪
PageHelper.startPage(0, 1, false);
PageInfo<InputDevice> pageInfo = new PageInfo<>(mapper.selectByExample(example));
return pageInfo.getList().stream().findFirst();
}
}
package pwc.taxtech.atms.dto.input;
public class InvoiceItemDto {
private String productionName;//商品名称
private String specification;//规格
private String unit;//单位
private String quantity;//数量
private String unitPrice;//单价
private String amount;//金额
private String taxRate;//税率
private String taxAmount;//税额
private String remark;//备注
private Integer rowNo;//行号
public String getProductionName() {
return productionName;
}
public void setProductionName(String productionName) {
this.productionName = productionName;
}
public String getSpecification() {
return specification;
}
public void setSpecification(String specification) {
this.specification = specification;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
public String getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(String unitPrice) {
this.unitPrice = unitPrice;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getTaxRate() {
return taxRate;
}
public void setTaxRate(String taxRate) {
this.taxRate = taxRate;
}
public String getTaxAmount() {
return taxAmount;
}
public void setTaxAmount(String taxAmount) {
this.taxAmount = taxAmount;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Integer getRowNo() {
return rowNo;
}
public void setRowNo(Integer rowNo) {
this.rowNo = rowNo;
}
}
package pwc.taxtech.atms.dto.input;
import java.util.ArrayList;
import java.util.List;
public class InvoiceScanDto extends ScanDto {
private String invoiceCode; //发票代码
private String invoiceNumber;//发票号码
private String invoiceDate;//开票日期
private String invoiceName;//发票名称
private String buyerTaxNumber;//购货方税号
private String buyerName;//购货方名称
private String buyerAddress;//购货方地址
private String buyerPhone;//购货方电话
private String buyerBankName;//购货方银行名称
private String buyerBankAccountNumber;//购货方银行账号
private String sellerTaxNumber;//销货方税号
private String sellerName;//销货方名称
private String sellerAddress;//销货方地址
private String sellerPhone;//销货方电话
private String sellerBankName;//销货方银行名称
private String sellerBankAccountNumber;//销货方银行账号
private String amount;//金额
private String taxAmount;//税额
private String totalPriceUppercase;//加税合计大写
private String totalPriceLowercase;//加税合计小写
private String invoiceType;//发票类型
private String checkCode;//校验码
private String remark;//备注
private List<InvoiceItemDto> itemList = new ArrayList<>();
public String getInvoiceCode() {
return invoiceCode;
}
public void setInvoiceCode(String invoiceCode) {
this.invoiceCode = invoiceCode;
}
public String getInvoiceNumber() {
return invoiceNumber;
}
public void setInvoiceNumber(String invoiceNumber) {
this.invoiceNumber = invoiceNumber;
}
public String getInvoiceDate() {
return invoiceDate;
}
public void setInvoiceDate(String invoiceDate) {
this.invoiceDate = invoiceDate;
}
public String getInvoiceName() {
return invoiceName;
}
public void setInvoiceName(String invoiceName) {
this.invoiceName = invoiceName;
}
public String getBuyerTaxNumber() {
return buyerTaxNumber;
}
public void setBuyerTaxNumber(String buyerTaxNumber) {
this.buyerTaxNumber = buyerTaxNumber;
}
public String getBuyerName() {
return buyerName;
}
public void setBuyerName(String buyerName) {
this.buyerName = buyerName;
}
public String getBuyerAddress() {
return buyerAddress;
}
public void setBuyerAddress(String buyerAddress) {
this.buyerAddress = buyerAddress;
}
public String getBuyerPhone() {
return buyerPhone;
}
public void setBuyerPhone(String buyerPhone) {
this.buyerPhone = buyerPhone;
}
public String getBuyerBankName() {
return buyerBankName;
}
public void setBuyerBankName(String buyerBankName) {
this.buyerBankName = buyerBankName;
}
public String getBuyerBankAccountNumber() {
return buyerBankAccountNumber;
}
public void setBuyerBankAccountNumber(String buyerBankAccountNumber) {
this.buyerBankAccountNumber = buyerBankAccountNumber;
}
public String getSellerTaxNumber() {
return sellerTaxNumber;
}
public void setSellerTaxNumber(String sellerTaxNumber) {
this.sellerTaxNumber = sellerTaxNumber;
}
public String getSellerName() {
return sellerName;
}
public void setSellerName(String sellerName) {
this.sellerName = sellerName;
}
public String getSellerAddress() {
return sellerAddress;
}
public void setSellerAddress(String sellerAddress) {
this.sellerAddress = sellerAddress;
}
public String getSellerPhone() {
return sellerPhone;
}
public void setSellerPhone(String sellerPhone) {
this.sellerPhone = sellerPhone;
}
public String getSellerBankName() {
return sellerBankName;
}
public void setSellerBankName(String sellerBankName) {
this.sellerBankName = sellerBankName;
}
public String getSellerBankAccountNumber() {
return sellerBankAccountNumber;
}
public void setSellerBankAccountNumber(String sellerBankAccountNumber) {
this.sellerBankAccountNumber = sellerBankAccountNumber;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getTaxAmount() {
return taxAmount;
}
public void setTaxAmount(String taxAmount) {
this.taxAmount = taxAmount;
}
public String getTotalPriceUppercase() {
return totalPriceUppercase;
}
public void setTotalPriceUppercase(String totalPriceUppercase) {
this.totalPriceUppercase = totalPriceUppercase;
}
public String getTotalPriceLowercase() {
return totalPriceLowercase;
}
public void setTotalPriceLowercase(String totalPriceLowercase) {
this.totalPriceLowercase = totalPriceLowercase;
}
public String getInvoiceType() {
return invoiceType;
}
public void setInvoiceType(String invoiceType) {
this.invoiceType = invoiceType;
}
public String getCheckCode() {
return checkCode;
}
public void setCheckCode(String checkCode) {
this.checkCode = checkCode;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public List<InvoiceItemDto> getItemList() {
return itemList;
}
public void setItemList(List<InvoiceItemDto> itemList) {
this.itemList = itemList;
}
}
package pwc.taxtech.atms.dto.input;
public class ScanDto {
private String filePath;
private String fileName;
private Integer dtoType;
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Integer getDtoType() {
return dtoType;
}
public void setDtoType(Integer dtoType) {
this.dtoType = dtoType;
}
}
package pwc.taxtech.atms.dto.input;
public class ScanParamDto {
private String ftpUser;
private String ftpPwd;
private String ftpHost;
private Integer ftpPort;
private Long jobId;//任务ID
public String getFtpUser() {
return ftpUser;
}
public void setFtpUser(String ftpUser) {
this.ftpUser = ftpUser;
}
public String getFtpPwd() {
return ftpPwd;
}
public void setFtpPwd(String ftpPwd) {
this.ftpPwd = ftpPwd;
}
public String getFtpHost() {
return ftpHost;
}
public void setFtpHost(String ftpHost) {
this.ftpHost = ftpHost;
}
public Integer getFtpPort() {
return ftpPort;
}
public void setFtpPort(Integer ftpPort) {
this.ftpPort = ftpPort;
}
public Long getJobId() {
return jobId;
}
public void setJobId(Long jobId) {
this.jobId = jobId;
}
}
package pwc.taxtech.atms.dto.input;
import java.util.ArrayList;
import java.util.List;
public class ScanResultDto {
private Integer total;
private Integer error;
private List<VoucherDto> scanList = new ArrayList<>();
private List<InvoiceScanDto> manualList = new ArrayList<>();
private Long jobId;//任务ID
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public Integer getError() {
return error;
}
public void setError(Integer error) {
this.error = error;
}
public List<VoucherDto> getScanList() {
return scanList;
}
public void setScanList(List<VoucherDto> scanList) {
this.scanList = scanList;
}
public Long getJobId() {
return jobId;
}
public void setJobId(Long jobId) {
this.jobId = jobId;
}
public List<InvoiceScanDto> getManualList() {
return manualList;
}
public void setManualList(List<InvoiceScanDto> manualList) {
this.manualList = manualList;
}
}
package pwc.taxtech.atms.dto.input;
import java.util.ArrayList;
import java.util.List;
public class VoucherDto extends ScanDto {
private String voucherNo;
private List<InvoiceScanDto> invoiceList = new ArrayList<>();
public String getVoucherNo() {
return voucherNo;
}
public void setVoucherNo(String voucherNo) {
this.voucherNo = voucherNo;
}
public List<InvoiceScanDto> getInvoiceList() {
return invoiceList;
}
public void setInvoiceList(List<InvoiceScanDto> invoiceList) {
this.invoiceList = invoiceList;
}
}
......@@ -26,7 +26,7 @@ public class InputDevice extends BaseEntity {
*
* @mbg.generated
*/
private Short type;
private Integer type;
/**
* Database Column Remarks:
......@@ -71,7 +71,7 @@ public class InputDevice extends BaseEntity {
*
* @mbg.generated
*/
public Short getType() {
public Integer getType() {
return type;
}
......@@ -83,7 +83,7 @@ public class InputDevice extends BaseEntity {
*
* @mbg.generated
*/
public void setType(Short type) {
public void setType(Integer type) {
this.type = type;
}
......
......@@ -264,52 +264,52 @@ public class InputDeviceExample {
return (Criteria) this;
}
public Criteria andTypeEqualTo(Short value) {
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Short value) {
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Short value) {
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Short value) {
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Short value) {
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Short value) {
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Short> values) {
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Short> values) {
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Short value1, Short value2) {
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Short value1, Short value2) {
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
......
package pwc.taxtech.atms.entitiy;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table task_list
*
* @mbg.generated do_not_delete_during_merge
*/
public class TaskList extends BaseEntity {
/**
* Database Column Remarks:
* 任务ID
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column task_list.id
*
* @mbg.generated
*/
private Long id;
/**
* Database Column Remarks:
* 任务名称
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column task_list.name
*
* @mbg.generated
*/
private String name;
/**
* Database Column Remarks:
* 任务类型 1:扫描发票
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column task_list.type
*
* @mbg.generated
*/
private Integer type;
/**
* Database Column Remarks:
* 0:初始 1:执行中 2:成功 3:失败
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column task_list.status
*
* @mbg.generated
*/
private Integer status;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column task_list.id
*
* @return the value of task_list.id
*
* @mbg.generated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column task_list.id
*
* @param id the value for task_list.id
*
* @mbg.generated
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column task_list.name
*
* @return the value of task_list.name
*
* @mbg.generated
*/
public String getName() {
return name;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column task_list.name
*
* @param name the value for task_list.name
*
* @mbg.generated
*/
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column task_list.type
*
* @return the value of task_list.type
*
* @mbg.generated
*/
public Integer getType() {
return type;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column task_list.type
*
* @param type the value for task_list.type
*
* @mbg.generated
*/
public void setType(Integer type) {
this.type = type;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column task_list.status
*
* @return the value of task_list.status
*
* @mbg.generated
*/
public Integer getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column task_list.status
*
* @param status the value for task_list.status
*
* @mbg.generated
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", type=").append(type);
sb.append(", status=").append(status);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package pwc.taxtech.atms.entitiy;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class TaskListExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table task_list
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table task_list
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table task_list
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
public TaskListExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table task_list
*
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table task_list
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andCreateByIsNull() {
addCriterion("create_by is null");
return (Criteria) this;
}
public Criteria andCreateByIsNotNull() {
addCriterion("create_by is not null");
return (Criteria) this;
}
public Criteria andCreateByEqualTo(String value) {
addCriterion("create_by =", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByNotEqualTo(String value) {
addCriterion("create_by <>", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByGreaterThan(String value) {
addCriterion("create_by >", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByGreaterThanOrEqualTo(String value) {
addCriterion("create_by >=", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByLessThan(String value) {
addCriterion("create_by <", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByLessThanOrEqualTo(String value) {
addCriterion("create_by <=", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByLike(String value) {
addCriterion("create_by like", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByNotLike(String value) {
addCriterion("create_by not like", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByIn(List<String> values) {
addCriterion("create_by in", values, "createBy");
return (Criteria) this;
}
public Criteria andCreateByNotIn(List<String> values) {
addCriterion("create_by not in", values, "createBy");
return (Criteria) this;
}
public Criteria andCreateByBetween(String value1, String value2) {
addCriterion("create_by between", value1, value2, "createBy");
return (Criteria) this;
}
public Criteria andCreateByNotBetween(String value1, String value2) {
addCriterion("create_by not between", value1, value2, "createBy");
return (Criteria) this;
}
public Criteria andUpdateByIsNull() {
addCriterion("update_by is null");
return (Criteria) this;
}
public Criteria andUpdateByIsNotNull() {
addCriterion("update_by is not null");
return (Criteria) this;
}
public Criteria andUpdateByEqualTo(String value) {
addCriterion("update_by =", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByNotEqualTo(String value) {
addCriterion("update_by <>", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByGreaterThan(String value) {
addCriterion("update_by >", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByGreaterThanOrEqualTo(String value) {
addCriterion("update_by >=", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByLessThan(String value) {
addCriterion("update_by <", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByLessThanOrEqualTo(String value) {
addCriterion("update_by <=", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByLike(String value) {
addCriterion("update_by like", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByNotLike(String value) {
addCriterion("update_by not like", value, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByIn(List<String> values) {
addCriterion("update_by in", values, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByNotIn(List<String> values) {
addCriterion("update_by not in", values, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByBetween(String value1, String value2) {
addCriterion("update_by between", value1, value2, "updateBy");
return (Criteria) this;
}
public Criteria andUpdateByNotBetween(String value1, String value2) {
addCriterion("update_by not between", value1, value2, "updateBy");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table task_list
*
* @mbg.generated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table task_list
*
* @mbg.generated
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
package pwc.taxtech.atms.service;
import java.util.List;
import java.util.Optional;
import pwc.taxtech.atms.dto.input.CamelPagingDto;
import pwc.taxtech.atms.dto.input.CamelPagingResultDto;
......@@ -40,4 +41,10 @@ public interface InvoiceManageService {
*/
InvoiceFilterDto getInvoiceFilterBasicData();
/**
* 扫描识别
* @return task id
*/
Optional<Long> scan();
}
......@@ -3,6 +3,7 @@ package pwc.taxtech.atms.service.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.client.RestTemplate;
import pwc.taxtech.atms.common.AtmsApiSettings;
import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.common.util.BeanUtil;
......@@ -21,5 +22,7 @@ public class BaseService {
protected DistributedIDService idService;
@Autowired
protected BeanUtil beanUtil;
@Autowired
protected RestTemplate restTemplate;
}
......@@ -3,14 +3,19 @@ package pwc.taxtech.atms.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.transaction.annotation.Transactional;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.ftp.FTPClientConfig;
import pwc.taxtech.atms.common.ftp.FTPClientPool;
import pwc.taxtech.atms.constant.enums.EnumInputInvoiceEntityType;
import pwc.taxtech.atms.constant.enums.EnumInputInvoiceRefundReason;
import pwc.taxtech.atms.constant.enums.EnumInputInvoiceSourceType;
......@@ -21,13 +26,10 @@ import pwc.taxtech.atms.constant.enums.EnumIsIncludedInTaxAmountType;
import pwc.taxtech.atms.constant.enums.EnumProductionServiceType;
import pwc.taxtech.atms.constant.enums.EnumProductionType;
import pwc.taxtech.atms.dao.InputInvoiceMapper;
import pwc.taxtech.atms.dto.input.CamelPagingDto;
import pwc.taxtech.atms.dto.input.CamelPagingResultDto;
import pwc.taxtech.atms.dto.input.InputInvoiceDto;
import pwc.taxtech.atms.dto.input.InputInvoiceQuery;
import pwc.taxtech.atms.dto.input.InputInvoiceQueryDto;
import pwc.taxtech.atms.dto.input.InvoiceDictionaryDto;
import pwc.taxtech.atms.dto.input.InvoiceFilterDto;
import pwc.taxtech.atms.dao.dao.InputDeviceDao;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.input.*;
import pwc.taxtech.atms.entitiy.InputDevice;
import pwc.taxtech.atms.entitiy.InputInvoice;
import pwc.taxtech.atms.entitiy.InputInvoiceExample;
import pwc.taxtech.atms.service.InvoiceManageService;
......@@ -40,6 +42,13 @@ public class InvoiceManageServiceImpl extends BaseService implements InvoiceMana
private InputInvoiceMapper inputInvoiceMapper;
@Autowired
private UserService userService;
@Autowired
private TaskListService taskListService;
@Autowired
private InputDeviceDao inputDeviceDao;
@Autowired
private FTPClientPool ftpClientPool;
private static final String SCAN_REQUEST_URL = "api/v1/ocr/scan";
@Override
public CamelPagingResultDto<InputInvoiceDto> getInputInvoiceList(InputInvoiceQuery inputInvoiceQuery,CamelPagingDto pagingDto) {
......@@ -152,8 +161,6 @@ public class InvoiceManageServiceImpl extends BaseService implements InvoiceMana
return null;
}
@Override
public String exportInvoiceAllInfoList(InputInvoiceQueryDto inputInvoiceQueryDto, CamelPagingDto pagingDto,
String fileName) {
......@@ -161,11 +168,6 @@ public class InvoiceManageServiceImpl extends BaseService implements InvoiceMana
return null;
}
@Override
public List<InputInvoiceDto> getInputInvoiceDtoList(InputInvoiceQueryDto inputInvoiceQueryDto) {
......@@ -250,7 +252,6 @@ public class InvoiceManageServiceImpl extends BaseService implements InvoiceMana
return inputInvoiceList;
}
@Override
public InvoiceFilterDto getInvoiceFilterBasicData() {
InvoiceFilterDto invoiceFilterDto=new InvoiceFilterDto();
......@@ -343,8 +344,29 @@ public class InvoiceManageServiceImpl extends BaseService implements InvoiceMana
return invoiceFilterDto;
}
@Transactional
@Override
public Optional<Long> scan() {
Optional<InputDevice> optional = inputDeviceDao.getScan();
if (!optional.isPresent()) {
return Optional.empty();
}
InputDevice inputDevice = optional.get();
long id = taskListService.addScanTask();
ScanParamDto paramDto = new ScanParamDto();
FTPClientConfig config = ftpClientPool.getFtpClientConfig();
paramDto.setFtpHost(config.getHost());
paramDto.setFtpPort(config.getPort());
paramDto.setFtpPwd(config.getPassword());
paramDto.setFtpUser(config.getUsername());
paramDto.setJobId(id);
String url = StringUtils.appendIfMissing(inputDevice.getUrl(), "/") + SCAN_REQUEST_URL;
ApiResultDto resultDto = restTemplate.postForObject(url, paramDto, ApiResultDto.class);
if (resultDto.getCode() == ApiResultDto.FAILED) {
return Optional.empty();
}
return Optional.of(id);
}
}
package pwc.taxtech.atms.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.constant.task.TaskListConstant;
import pwc.taxtech.atms.dao.TaskListMapper;
import pwc.taxtech.atms.entitiy.TaskList;
@Service
public class TaskListService extends BaseService {
@Autowired
private TaskListMapper taskListMapper;
/**
* 创建扫描任务
*
* @return ID
*/
public Long addScanTask() {
long id = idService.nextId();
TaskList taskList = new TaskList();
taskList.setId(id);
taskList.setType(TaskListConstant.Type.ScanInvoice.getCode());
taskList.setStatus(TaskListConstant.Status.Processing.getCode());
String user = authUserHelper.getCurrentUserID();
taskList.setCreateBy(user);
taskList.setUpdateBy(user);
taskListMapper.insertSelective(taskList);
return id;
}
}
package pwc.taxtech.atms.service.vendor;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dto.input.ScanResultDto;
import pwc.taxtech.atms.service.impl.BaseService;
@Service
public class ScanService extends BaseService {
public void update(ScanResultDto resultDto){
}
}
......@@ -16,7 +16,7 @@ jwt.powerToken=xxxx
jwt.expireSecond=180000
jwt.refreshSecond=600
ftp.host=cnshaappulv004.asia.pwcinternal.com
ftp.host=cnshaappulv003.asia.pwcinternal.com
ftp.port=21
ftp.user=ftpuser
ftp.pwd=12345678
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.dao.TaskListMapper">
<resultMap id="BaseResultMap" type="pwc.taxtech.atms.entitiy.TaskList">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="type" jdbcType="SMALLINT" property="type" />
<result column="status" jdbcType="SMALLINT" property="status" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, `name`, `type`, `status`, create_by, update_by, create_time, update_time
</sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.entitiy.TaskListExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from task_list
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from task_list
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from task_list
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="pwc.taxtech.atms.entitiy.TaskListExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from task_list
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="pwc.taxtech.atms.entitiy.TaskList">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into task_list (id, `name`, `type`,
`status`, create_by, update_by,
create_time, update_time)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=SMALLINT},
#{status,jdbcType=SMALLINT}, #{createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.entitiy.TaskList">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into task_list
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
`name`,
</if>
<if test="type != null">
`type`,
</if>
<if test="status != null">
`status`,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=SMALLINT},
</if>
<if test="status != null">
#{status,jdbcType=SMALLINT},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.entitiy.TaskListExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from task_list
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update task_list
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=SMALLINT},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=SMALLINT},
</if>
<if test="record.createBy != null">
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
<if test="record.updateBy != null">
update_by = #{record.updateBy,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update task_list
set id = #{record.id,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=SMALLINT},
`status` = #{record.status,jdbcType=SMALLINT},
create_by = #{record.createBy,jdbcType=VARCHAR},
update_by = #{record.updateBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.entitiy.TaskList">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update task_list
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=SMALLINT},
</if>
<if test="status != null">
`status` = #{status,jdbcType=SMALLINT},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.entitiy.TaskList">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update task_list
set `name` = #{name,jdbcType=VARCHAR},
`type` = #{type,jdbcType=SMALLINT},
`status` = #{status,jdbcType=SMALLINT},
create_by = #{createBy,jdbcType=VARCHAR},
update_by = #{updateBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.entitiy.TaskListExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from task_list
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.entitiy.*;
......@@ -17,6 +18,7 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.sql.Connection;
@WebAppConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:applicationContext.xml" })
public abstract class CommonIT {
......
......@@ -130,6 +130,12 @@
<!--</table>-->
<table tableName="input_device" domainObjectName="InputDevice">
<property name="ignoreQualifiersAtRuntime" value="true"/>
<columnOverride column="type" javaType="java.lang.Integer"/>
</table>
<table tableName="task_list" domainObjectName="TaskList">
<property name="ignoreQualifiersAtRuntime" value="true"/>
<columnOverride column="type" javaType="java.lang.Integer"/>
<columnOverride column="status" javaType="java.lang.Integer"/>
</table>
</context>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment