chore(backend): 落地 ADS 治理体系、升级日志并收录后端模板基线代码

This commit is contained in:
zhoulei
2026-08-19 14:39:18 +08:00
parent 1f84456421
commit 54c21876e4
113 changed files with 19953 additions and 0 deletions
@@ -0,0 +1,58 @@
package abacus.springboot.example;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.HttpClientBuilder;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
import abacus.commons.responsebody.wrapper.ResultResponseBodyWrapper;
@SpringBootApplication
@EnableDiscoveryClient
// @EnableHystrix
// 配置扫描
@ComponentScan(basePackages = { "abacus.springboot.example", "abacus.springboot.example.*" })
// 指定加载的repository 否则不能加载外部的repository
@EnableJpaRepositories(basePackages = { "abacus.springboot.example.*", })
// 指定加载的外部entity 否则不能加载外部的entity
@EntityScan(basePackages = { "abacus.springboot.example.*", "com.abacus.pms.*", "com.abacus.xpos.foundation.dao" })
//指定加载外部Feign
@EnableFeignClients("abacus.springboot.example.feign")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public ResultResponseBodyWrapper getResultResponseBodyWrapper() {
return new ResultResponseBodyWrapper();
}
@Bean
public RestTemplate getRestTemplate() {
RequestConfig config = RequestConfig.custom().setConnectTimeout(5000).setSocketTimeout(5000).build();
HttpClient httpClient = HttpClientBuilder.create().setDefaultRequestConfig(config).build();
ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
// SimpleClientHttpRequestFactory re = new
// SimpleClientHttpRequestFactory();
// re.setConnectTimeout(5000);
// re.setReadTimeout(5000);
return new RestTemplate(requestFactory);
}
}
@@ -0,0 +1,390 @@
package abacus.springboot.example.api.view;
import java.util.List;
import abacus.springboot.example.dao.JcBillPhoto;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "回购主单" , name = "ApiBillHg")
public class ApiBillHg {
@Schema(description="回购单单号", required = false, example="HG202411180001")
private String id;
@Schema(description = "稽查单号", required = false, example = "JC202411180001")
private String billid;
@Schema(description="状态", required = false, pattern = "待提交:1,待付款:2,待分仓(已付款):3,已分仓(待出库):4,已出库:5", example = "1")
private int status;
@Schema(description = "订单来源", required = false, example = "掌上华致")
private String source;
@Schema(description = "客户编码", required = false, example = "20200089")
private String account;
@Schema(description = "客户名称", required = false, example = "广东众之品酒有限公司")
private String accountname;
@Schema(description = "总数量", required = false, example = "6")
private double quantity;
@Schema(description = "总金额", required = false, example = "4800")
private double subtotal;
@Schema(description = "运费", required = false, example = "50")
private double freight;
@Schema(description = "运营经理编码", required = false, example = "zhangsan")
private String manager;
@Schema(description = "运营经理名称", required = false, example = "张三")
private String managername;
@Schema(description = "收货人姓名", required = false, example = "李四")
private String consignee;
@Schema(description = "收货人电话", required = false, example = "1888888888")
private String consigneephone;
@Schema(description = "", required = false, example = "10001")
private String province;
@Schema(description = "", required = false, example = "广东")
private String provincename;
@Schema(description = "", required = false, example = "1000101")
private String city;
@Schema(description = "", required = false, example = "广州")
private String cityname;
@Schema(description = "", required = false, example = "100010101")
private String area;
@Schema(description = "", required = false, example = "越秀区")
private String areaname;
@Schema(description = "详细地址", required = false, example = "东风24路")
private String address;
@Schema(description = "收货方式", required = false, example = "送货上门")
private String receiveway;
@Schema(description = "订单备注", required = false, example = "订单备注~~~")
private String remark;
@Schema(description = "运营备注", required = false, example = "运营备注~~~")
private String remark1;
@Schema(description = "物流公司名称", required = false, example = "京东快递")
private String logisticsname;
@Schema(description = "物流公司代码", required = false, example = "JD")
private String logisticscode;
@Schema(description = "物流方式", required = false, example = "")
private String logisticstype;
@Schema(description = "物流单号", required = false, example = "JD00001")
private String logisticsno;
@Schema(description="回购明细", required = false, example="")
private List<ApiBillHgItem> items;
@Schema(description="回购支付明细", required = false, example="")
private List<ApiBillHgPayment> payments;
@Schema(description="回购通知函", required = false, example="")
private List<JcBillPhoto> tzhUrl;
@Schema(description="违规回购通知函", required = false, example="")
private List<JcBillPhoto> wgtzhUrl;
@Schema(description="支付凭证", required = false, example="")
private List<JcBillPhoto> zfpzUrl;
@Schema(description="回购通知函", required = false, example="")
private String tzhUrls;
//
// @Schema(description="违规回购通知函", required = false, example="")
// private String wgtzhUrl;
//
// @Schema(description="支付凭证", required = false, example="")
// private List<String> zfpzUrl;
public String getId() {
return id;
}
public String getTzhUrls() {
return tzhUrls;
}
public void setTzhUrls(String tzhUrls) {
this.tzhUrls = tzhUrls;
}
public List<JcBillPhoto> getTzhUrl() {
return tzhUrl;
}
public void setTzhUrl(List<JcBillPhoto> tzhUrl) {
this.tzhUrl = tzhUrl;
}
public List<JcBillPhoto> getWgtzhUrl() {
return wgtzhUrl;
}
public void setWgtzhUrl(List<JcBillPhoto> wgtzhUrl) {
this.wgtzhUrl = wgtzhUrl;
}
public List<JcBillPhoto> getZfpzUrl() {
return zfpzUrl;
}
public void setZfpzUrl(List<JcBillPhoto> zfpzUrl) {
this.zfpzUrl = zfpzUrl;
}
public void setId(String id) {
this.id = id;
}
public String getBillid() {
return billid;
}
public void setBillid(String billid) {
this.billid = billid;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getAccountname() {
return accountname;
}
public void setAccountname(String accountname) {
this.accountname = accountname;
}
public double getQuantity() {
return quantity;
}
public void setQuantity(double quantity) {
this.quantity = quantity;
}
public double getSubtotal() {
return subtotal;
}
public void setSubtotal(double subtotal) {
this.subtotal = subtotal;
}
public double getFreight() {
return freight;
}
public void setFreight(double freight) {
this.freight = freight;
}
public String getManager() {
return manager;
}
public void setManager(String manager) {
this.manager = manager;
}
public String getManagername() {
return managername;
}
public void setManagername(String managername) {
this.managername = managername;
}
public String getConsignee() {
return consignee;
}
public void setConsignee(String consignee) {
this.consignee = consignee;
}
public String getConsigneephone() {
return consigneephone;
}
public void setConsigneephone(String consigneephone) {
this.consigneephone = consigneephone;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getProvincename() {
return provincename;
}
public void setProvincename(String provincename) {
this.provincename = provincename;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCityname() {
return cityname;
}
public void setCityname(String cityname) {
this.cityname = cityname;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getAreaname() {
return areaname;
}
public void setAreaname(String areaname) {
this.areaname = areaname;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getReceiveway() {
return receiveway;
}
public void setReceiveway(String receiveway) {
this.receiveway = receiveway;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getRemark1() {
return remark1;
}
public void setRemark1(String remark1) {
this.remark1 = remark1;
}
public String getLogisticsname() {
return logisticsname;
}
public void setLogisticsname(String logisticsname) {
this.logisticsname = logisticsname;
}
public String getLogisticscode() {
return logisticscode;
}
public void setLogisticscode(String logisticscode) {
this.logisticscode = logisticscode;
}
public String getLogisticstype() {
return logisticstype;
}
public void setLogisticstype(String logisticstype) {
this.logisticstype = logisticstype;
}
public String getLogisticsno() {
return logisticsno;
}
public void setLogisticsno(String logisticsno) {
this.logisticsno = logisticsno;
}
public List<ApiBillHgItem> getItems() {
return items;
}
public void setItems(List<ApiBillHgItem> items) {
this.items = items;
}
public List<ApiBillHgPayment> getPayments() {
return payments;
}
public void setPayments(List<ApiBillHgPayment> payments) {
this.payments = payments;
}
}
@@ -0,0 +1,26 @@
package abacus.springboot.example.api.view;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "回购Id列表" , name = "ApiBillHgId")
public class ApiBillHgId {
@Schema(description="回购单单号", required = false, example="HG202411180001")
private String id;
public ApiBillHgId() {
super();
}
public ApiBillHgId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
@@ -0,0 +1,130 @@
package abacus.springboot.example.api.view;
import com.alibaba.fastjson.JSONObject;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "回购明细" , name = "ApiBillHgItem")
public class ApiBillHgItem {
@Schema(description = "明细序号", required = false, hidden = true, example = "2")
private Long id;
@Schema(description = "状态", required = false, pattern = "终止:-1,待通知回购:1,已通知回购:2", example = "2")
private int status;
@Schema(description = "商品编码", required = false, example = "00001")
private String product;
@Schema(description = "商品名称", required = false, example = "钓鱼台")
private String productname;
@Schema(description = "商品规格", required = false, example = "500ml*6")
private String spec;
@Schema(description = "商品图片地址", required = false, example = "")
private JSONObject productphoto;
@Schema(description = "收货单价", required = false, example = "10")
private double price;
@Schema(description = "入库数量", required = false, example = "1")
private double quantity;
@Schema(description = "入库件数", required = false, example = "1")
private double numbers;
@Schema(description = "回购单价", required = false, example = "100")
private double hgprice;
@Schema(description = "回购金额", required = false, example = "100")
private double hgamount;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public JSONObject getProductphoto() {
return productphoto;
}
public void setProductphoto(JSONObject productphoto) {
this.productphoto = productphoto;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public String getProductname() {
return productname;
}
public void setProductname(String productname) {
this.productname = productname;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getQuantity() {
return quantity;
}
public void setQuantity(double quantity) {
this.quantity = quantity;
}
public double getNumbers() {
return numbers;
}
public void setNumbers(double numbers) {
this.numbers = numbers;
}
public double getHgprice() {
return hgprice;
}
public void setHgprice(double hgprice) {
this.hgprice = hgprice;
}
public double getHgamount() {
return hgamount;
}
public void setHgamount(double hgamount) {
this.hgamount = hgamount;
}
}
@@ -0,0 +1,74 @@
package abacus.springboot.example.api.view;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "回购支付明细" , name = "ApiBillHgPayment")
public class ApiBillHgPayment {
@Schema(description = "回购单号", required = false, example = "线下支付")
private String billhg;
@Schema(description = "支付方式", required = false, example = "线下支付")
private String payment;
@Schema(description = "支付金额", required = false, example = "1000")
private Double amount;
@Schema(description = "账号名称", required = false, example = "张三")
private String zhmc;
@Schema(description = "开发银行", required = false, example = "工商银行")
private String khyh;
@Schema(description = "银行账号", required = false, example = "10102010201201021020101")
private String yhzh;
public String getBillhg() {
return billhg;
}
public void setBillhg(String billhg) {
this.billhg = billhg;
}
public String getPayment() {
return payment;
}
public void setPayment(String payment) {
this.payment = payment;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public String getZhmc() {
return zhmc;
}
public void setZhmc(String zhmc) {
this.zhmc = zhmc;
}
public String getKhyh() {
return khyh;
}
public void setKhyh(String khyh) {
this.khyh = khyh;
}
public String getYhzh() {
return yhzh;
}
public void setYhzh(String yhzh) {
this.yhzh = yhzh;
}
}
@@ -0,0 +1,142 @@
package abacus.springboot.example.api.view;
import java.util.Date;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "稽查收货主单" , name = "ApiJcBill")
public class ApiJcBill {
@Schema(description="稽查单号", required = false, example="JC202411180001")
private String id;
@Schema(description="状态", required = false, pattern = "溯源驳回:-2,待提交:0,系统溯源验证通过:1,待溯源:2,待入库:3,入库待审核:4,已入库:5 ,部分回购:6,回购完成:7", example = "1")
private int status;
@Schema(description = "收货产品", required = false, example = "钓鱼台")
private String goods;
@Schema(description = "收货仓库编码", required = false, example = "9090025")
private String warehouse;
@Schema(description = "收货仓库名称", required = false, example = "精品广州库")
private String warehousename;
@Schema(description = "收货日期", required = false, example = "2024-11-11")
private String receivedt;
@Schema(description = "收货数量", required = false, example = "10")
private double quantity;
@Schema(description = "收货总金额", required = false, example = "9609")
private double subtotal;
@Schema(description = "申请人编码", required = false, example = "zhangsan")
private String applicant;
@Schema(description = "申请人名称", required = false, example = "张三")
private String applicantname;
@Schema(description = "申请人时间", required = false, example = "2024-11-11 00:00:00")
private Date applicantdt;
@Schema(description="稽查收货明细", required = false, example="")
private List<ApiJcBillItem> items;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getGoods() {
return goods;
}
public void setGoods(String goods) {
this.goods = goods;
}
public String getWarehouse() {
return warehouse;
}
public void setWarehouse(String warehouse) {
this.warehouse = warehouse;
}
public String getWarehousename() {
return warehousename;
}
public void setWarehousename(String warehousename) {
this.warehousename = warehousename;
}
public String getReceivedt() {
return receivedt;
}
public void setReceivedt(String receivedt) {
this.receivedt = receivedt;
}
public double getQuantity() {
return quantity;
}
public void setQuantity(double quantity) {
this.quantity = quantity;
}
public double getSubtotal() {
return subtotal;
}
public void setSubtotal(double subtotal) {
this.subtotal = subtotal;
}
public String getApplicant() {
return applicant;
}
public void setApplicant(String applicant) {
this.applicant = applicant;
}
public String getApplicantname() {
return applicantname;
}
public void setApplicantname(String applicantname) {
this.applicantname = applicantname;
}
public Date getApplicantdt() {
return applicantdt;
}
public void setApplicantdt(Date applicantdt) {
this.applicantdt = applicantdt;
}
public List<ApiJcBillItem> getItems() {
return items;
}
public void setItems(List<ApiJcBillItem> items) {
this.items = items;
}
}
@@ -0,0 +1,42 @@
package abacus.springboot.example.api.view;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "分页对象" , name = "ApiJcBillCollect")
public class ApiJcBillCollect {
@Schema(description="总数", required = false, example="100")
private long total;
@Schema(description="总页数", required = false, example="10")
private int totalPages;
@Schema(description="稽查收货列表", required = false, example="")
private List<ApiJcBillSearch> bills;
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public int getTotalPages() {
return totalPages;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public List<ApiJcBillSearch> getBills() {
return bills;
}
public void setBills(List<ApiJcBillSearch> bills) {
this.bills = bills;
}
}
@@ -0,0 +1,75 @@
package abacus.springboot.example.api.view;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "货品图片" , name = "ApiJcBillGoodsPhoto")
public class ApiJcBillGoodsPhoto {
@Schema(description = "明细序号", required = false, hidden = true, example = "2")
private Long id;
@Schema(description = "状态", required = false, pattern = "人工朔源驳回:-2,系统朔源验证未通过(无结果):-1,系统溯源未验证:0,系统朔源验证通过:1,人工朔源待确认:2,人工朔源已确认:3", example = "2")
private int status;
@Schema(description = "货品编号", required = false, example = "B20181118-001")
private String goodsid;
@Schema(description = "物流码", required = false, example = "HTTPS://M.DIAOYUTAIJI")
private String logisticsid;
@Schema(description = "驳回原因", required = true, example = "")
private String reason;
@Schema(description = "货品图片", required = false, pattern = "这是个JSON数组,不是JSONArray对象", example = "[\"44444\",\"aaaaa\"]")
private List<String> goodsPhotos;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getLogisticsid() {
return logisticsid;
}
public void setLogisticsid(String logisticsid) {
this.logisticsid = logisticsid;
}
public String getGoodsid() {
return goodsid;
}
public void setGoodsid(String goodsid) {
this.goodsid = goodsid;
}
public List<String> getGoodsPhotos() {
return goodsPhotos;
}
public void setGoodsPhotos(List<String> goodsPhotos) {
this.goodsPhotos = goodsPhotos;
}
}
@@ -0,0 +1,42 @@
package abacus.springboot.example.api.view;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "分页对象" , name = "ApiJcBillHgSearch")
public class ApiJcBillHgSearch {
@Schema(description="总数", required = false, example="100")
private long total;
@Schema(description="总页数", required = false, example="10")
private int totalPages;
@Schema(description="回购订单列表", required = false, example="")
private List<ApiJcBillHgSearchItem> items;
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public int getTotalPages() {
return totalPages;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public List<ApiJcBillHgSearchItem> getItems() {
return items;
}
public void setItems(List<ApiJcBillHgSearchItem> items) {
this.items = items;
}
}
@@ -0,0 +1,176 @@
package abacus.springboot.example.api.view;
import java.util.List;
import abacus.springboot.example.dao.JcBillPhoto;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "回购订单列表" , name = "ApiJcBillHgSearchItem")
public class ApiJcBillHgSearchItem {
@Schema(description="回购订单号", required = false, example="HG202412080001")
private String billHg;
@Schema(description="状态", required = false, pattern = "待提交:1,待付款:2,待分仓(已付款):3,已分仓(待出库):4,已出库:5", example = "1")
private int status;
@Schema(description="客户编码", required = false, example="2020089")
private String account;
@Schema(description="回购订单号", required = false, example="广东众之品酒有限公司")
private String accountname;
@Schema(description="运营经理编码", required = false, example="zhangsan")
private String manager;
@Schema(description="运营经理名称", required = false, example="张三")
private String managername;
@Schema(description="品种个数", required = false, example="1")
private int breednum;
@Schema(description="件数", required = false, example="2")
private int numbers;
@Schema(description = "物流公司名称", required = false, example = "京东")
private String logisticsname;
@Schema(description = "物流单号", required = false, example = "JD20240000001")
private String logisticsno;
@Schema(description = "金额", required = false, example = "1000")
private double subtotal;
@Schema(description="回购通知函", required = false, example="")
private String tzhUrl;
@Schema(description="违规回购通知函", required = false, example="")
private List<JcBillPhoto> wgtzhUrl;
@Schema(description="支付凭证", required = false, example="")
private List<JcBillPhoto> zfpzUrl;
@Schema(description="支付方式", required = false, example="")
private List<ApiBillHgPayment> payments;
public double getSubtotal() {
return subtotal;
}
public void setSubtotal(double subtotal) {
this.subtotal = subtotal;
}
public List<ApiBillHgPayment> getPayments() {
return payments;
}
public void setPayments(List<ApiBillHgPayment> payments) {
this.payments = payments;
}
public String getTzhUrl() {
return tzhUrl;
}
public void setTzhUrl(String tzhUrl) {
this.tzhUrl = tzhUrl;
}
public List<JcBillPhoto> getWgtzhUrl() {
return wgtzhUrl;
}
public void setWgtzhUrl(List<JcBillPhoto> wgtzhUrl) {
this.wgtzhUrl = wgtzhUrl;
}
public List<JcBillPhoto> getZfpzUrl() {
return zfpzUrl;
}
public void setZfpzUrl(List<JcBillPhoto> zfpzUrl) {
this.zfpzUrl = zfpzUrl;
}
public String getBillHg() {
return billHg;
}
public void setBillHg(String billHg) {
this.billHg = billHg;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getAccountname() {
return accountname;
}
public void setAccountname(String accountname) {
this.accountname = accountname;
}
public String getManager() {
return manager;
}
public void setManager(String manager) {
this.manager = manager;
}
public String getManagername() {
return managername;
}
public void setManagername(String managername) {
this.managername = managername;
}
public int getBreednum() {
return breednum;
}
public void setBreednum(int breednum) {
this.breednum = breednum;
}
public int getNumbers() {
return numbers;
}
public void setNumbers(int numbers) {
this.numbers = numbers;
}
public String getLogisticsname() {
return logisticsname;
}
public void setLogisticsname(String logisticsname) {
this.logisticsname = logisticsname;
}
public String getLogisticsno() {
return logisticsno;
}
public void setLogisticsno(String logisticsno) {
this.logisticsno = logisticsno;
}
}
@@ -0,0 +1,130 @@
package abacus.springboot.example.api.view;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "稽查收货明细" , name = "ApiJcBillItem")
public class ApiJcBillItem {
@Schema(description = "明细序号", required = false, hidden = true, example = "2")
private Long id;
@Schema(description = "行号", required = false, pattern = "修改时必填", example = "2")
private int indexno;
@Schema(description = "收货来源", required = false, example = "掌上华致")
private String recsource;
@Schema(description = "收货渠道", required = false, example = "线下")
private String channel;
@Schema(description = "收货平台", required = true, example = "")
private String recplatform;
@Schema(description = "收货单价", required = false, example = "100")
private double price;
@Schema(description = "收货数量", required = false, example = "10")
private double quantity;
@Schema(description = "收货件数", required = false, example = "1")
private double numbers;
@Schema(description = "收货金额", required = false, example = "1000")
private double subtotal;
@Schema(description = "付款图片", required = false, pattern = "这是个JSON数组,不是JSONArray对象", example = "[\"44444\",\"aaaaa\"]")
private List<String> paymentPhoto;
@Schema(description = "货品图片", required = false, pattern = "", example = "")
private List<ApiJcBillGoodsPhoto> goodsPhotos;
public String getRecplatform() {
return recplatform;
}
public void setRecplatform(String recplatform) {
this.recplatform = recplatform;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getRecsource() {
return recsource;
}
public void setRecsource(String recsource) {
this.recsource = recsource;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getQuantity() {
return quantity;
}
public void setQuantity(double quantity) {
this.quantity = quantity;
}
public double getNumbers() {
return numbers;
}
public void setNumbers(double numbers) {
this.numbers = numbers;
}
public double getSubtotal() {
return subtotal;
}
public void setSubtotal(double subtotal) {
this.subtotal = subtotal;
}
public List<String> getPaymentPhoto() {
return paymentPhoto;
}
public void setPaymentPhoto(List<String> paymentPhoto) {
this.paymentPhoto = paymentPhoto;
}
public int getIndexno() {
return indexno;
}
public void setIndexno(int indexno) {
this.indexno = indexno;
}
public List<ApiJcBillGoodsPhoto> getGoodsPhotos() {
return goodsPhotos;
}
public void setGoodsPhotos(List<ApiJcBillGoodsPhoto> goodsPhotos) {
this.goodsPhotos = goodsPhotos;
}
}
@@ -0,0 +1,73 @@
package abacus.springboot.example.api.view;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "稽查收货列表" , name = "ApiJcBillSearch")
public class ApiJcBillSearch {
@Schema(description="稽查单号", required = false, example="JC202411180001")
private String billid;
@Schema(description = "收货日期", required = false, example = "2024-11-11")
private String receivedt;
@Schema(description = "收货产品", required = false, example = "荷花")
private String goods;
@Schema(description = "收货数量", required = false, example = "6")
private double quantity;
@Schema(description="状态", required = false, pattern = "溯源驳回:-2,待提交:0,系统溯源验证通过:1,待溯源:2,待入库:3,入库待审核:4,已入库:5 ,部分回购:6,回购完成:7", example = "1")
private int status;
@Schema(hidden = true)
private int hgstatus;
public int getHgstatus() {
return hgstatus;
}
public void setHgstatus(int hgstatus) {
this.hgstatus = hgstatus;
}
public String getBillid() {
return billid;
}
public void setBillid(String billid) {
this.billid = billid;
}
public String getReceivedt() {
return receivedt;
}
public void setReceivedt(String receivedt) {
this.receivedt = receivedt;
}
public String getGoods() {
return goods;
}
public void setGoods(String goods) {
this.goods = goods;
}
public double getQuantity() {
return quantity;
}
public void setQuantity(double quantity) {
this.quantity = quantity;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
@@ -0,0 +1,97 @@
package abacus.springboot.example.api.view;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "稽查收货主单" , name = "ApiReqJcBill")
public class ApiReqJcBill {
@Schema(description="稽查单号", required = false, pattern = "修改时必填", example="JC202411180001")
private String id;
@Schema(description = "收货产品", required = false, example = "钓鱼台")
private String goods;
@Schema(description = "收货日期", required = false, example = "2024-11-11")
private String receivedt;
@Schema(description = "收货仓库编码", required = false, example = "9090025")
private String warehouse;
@Schema(description = "收货仓库名称", required = false, example = "精品广州库")
private String warehousename;
@Schema(description = "申请人编码", required = true, example = "zhangsan")
private String applicant;
@Schema(description = "申请人名称", required = true, example = "张三")
private String applicantname;
@Schema(description="稽查收货明细", required = false, example="")
private List<ApiReqJcBillItem> items;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getGoods() {
return goods;
}
public void setGoods(String goods) {
this.goods = goods;
}
public String getReceivedt() {
return receivedt;
}
public void setReceivedt(String receivedt) {
this.receivedt = receivedt;
}
public String getWarehouse() {
return warehouse;
}
public void setWarehouse(String warehouse) {
this.warehouse = warehouse;
}
public String getWarehousename() {
return warehousename;
}
public void setWarehousename(String warehousename) {
this.warehousename = warehousename;
}
public String getApplicant() {
return applicant;
}
public void setApplicant(String applicant) {
this.applicant = applicant;
}
public String getApplicantname() {
return applicantname;
}
public void setApplicantname(String applicantname) {
this.applicantname = applicantname;
}
public List<ApiReqJcBillItem> getItems() {
return items;
}
public void setItems(List<ApiReqJcBillItem> items) {
this.items = items;
}
}
@@ -0,0 +1,42 @@
package abacus.springboot.example.api.view;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "货品图片" , name = "ApiReqJcBillGoodsPhoto")
public class ApiReqJcBillGoodsPhoto {
@Schema(description = "货品编号", required = false, example = "B20181118-001")
private String goodsid;
@Schema(description = "物流码", required = false, example = "HTTPS://M.DIAOYUTAIJI")
private String logisticsid;
@Schema(description = "货品图片", required = false, pattern = "这是个JSON数组,不是JSONArray对象", example = "[\"44444\",\"aaaaa\"]")
private List<String> goodsPhotos;
public String getLogisticsid() {
return logisticsid;
}
public void setLogisticsid(String logisticsid) {
this.logisticsid = logisticsid;
}
public String getGoodsid() {
return goodsid;
}
public void setGoodsid(String goodsid) {
this.goodsid = goodsid;
}
public List<String> getGoodsPhotos() {
return goodsPhotos;
}
public void setGoodsPhotos(List<String> goodsPhotos) {
this.goodsPhotos = goodsPhotos;
}
}
@@ -0,0 +1,196 @@
package abacus.springboot.example.api.view;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "回购单主单" , name = "ApiReqJcBillHg")
public class ApiReqJcBillHg {
@Schema(description="回购单单号", required = true, example="HG202411180001")
private String id;
@Schema(description = "商品总金额", required = false, example = "4800")
private Double subtotal;
@Schema(description = "运费", required = true, example = "50")
private Double freight;
@Schema(description = "收货人姓名", required = true, example = "李四")
private String consignee;
@Schema(description = "收货人电话", required = true, example = "1888888888")
private String consigneephone;
@Schema(description = "", required = false, example = "10001")
private String province;
@Schema(description = "", required = true, example = "广东")
private String provincename;
@Schema(description = "", required = false, example = "1000101")
private String city;
@Schema(description = "", required = true, example = "广州")
private String cityname;
@Schema(description = "", required = false, example = "100010101")
private String area;
@Schema(description = "", required = true, example = "越秀区")
private String areaname;
@Schema(description = "详细地址", required = true, example = "东风24路")
private String address;
@Schema(description = "订单备注", required = false, example = "订单备注~~~")
private String remark;
@Schema(description = "运营备注", required = false, example = "运营备注~~~")
private String remark1;
@Schema(description = "提交人编码", required = true, example = "zhangsan")
private String submit;
@Schema(description = "提交人名称", required = true, example = "张三")
private String submitname;
@Schema(description = "回购支付明细", required = true, example = "")
private List<ApiReqJcBillPayment> payments;
public List<ApiReqJcBillPayment> getPayments() {
return payments;
}
public void setPayments(List<ApiReqJcBillPayment> payments) {
this.payments = payments;
}
public String getSubmit() {
return submit;
}
public void setSubmit(String submit) {
this.submit = submit;
}
public String getSubmitname() {
return submitname;
}
public void setSubmitname(String submitname) {
this.submitname = submitname;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Double getSubtotal() {
return subtotal;
}
public void setSubtotal(Double subtotal) {
this.subtotal = subtotal;
}
public Double getFreight() {
return freight;
}
public void setFreight(Double freight) {
this.freight = freight;
}
public String getConsignee() {
return consignee;
}
public void setConsignee(String consignee) {
this.consignee = consignee;
}
public String getConsigneephone() {
return consigneephone;
}
public void setConsigneephone(String consigneephone) {
this.consigneephone = consigneephone;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getProvincename() {
return provincename;
}
public void setProvincename(String provincename) {
this.provincename = provincename;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCityname() {
return cityname;
}
public void setCityname(String cityname) {
this.cityname = cityname;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getAreaname() {
return areaname;
}
public void setAreaname(String areaname) {
this.areaname = areaname;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getRemark1() {
return remark1;
}
public void setRemark1(String remark1) {
this.remark1 = remark1;
}
}
@@ -0,0 +1,130 @@
package abacus.springboot.example.api.view;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "稽查收货明细" , name = "ApiReqJcBillItem")
public class ApiReqJcBillItem {
@Schema(description = "明细序号", required = false, pattern = "修改时必填", example = "2")
private Long id;
@Schema(description = "行号", required = false, pattern = "修改时必填", example = "2")
private int indexno;
@Schema(description = "收货来源", required = false, example = "线下")
private String recsource;
@Schema(description = "收货平台", required = false, example = "")
private String recplatform;
@Schema(description = "收货渠道", required = false, example = "XXX烟酒店")
private String channel;
@Schema(description = "收货单价", required = false, example = "100")
private Double price;
@Schema(description = "收货数量", required = false, example = "10")
private Double quantity;
@Schema(description = "收货件数", required = false, example = "1")
private Double numbers;
@Schema(description = "收货金额", required = false, example = "1000")
private Double subtotal;
@Schema(description = "付款图片", required = false, pattern = "这是个JSON数组,不是JSONArray对象", example = "[\"44444\",\"aaaaa\"]")
private List<String> paymentPhoto;
@Schema(description = "货品图片", required = false, pattern = "", example = "")
private List<ApiReqJcBillGoodsPhoto> goodsPhotos;
public List<ApiReqJcBillGoodsPhoto> getGoodsPhotos() {
return goodsPhotos;
}
public void setGoodsPhotos(List<ApiReqJcBillGoodsPhoto> goodsPhotos) {
this.goodsPhotos = goodsPhotos;
}
public int getIndexno() {
return indexno;
}
public void setIndexno(int indexno) {
this.indexno = indexno;
}
public String getRecplatform() {
return recplatform;
}
public void setRecplatform(String recplatform) {
this.recplatform = recplatform;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getRecsource() {
return recsource;
}
public void setRecsource(String recsource) {
this.recsource = recsource;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public Double getQuantity() {
return quantity;
}
public void setQuantity(Double quantity) {
this.quantity = quantity;
}
public Double getNumbers() {
return numbers;
}
public void setNumbers(Double numbers) {
this.numbers = numbers;
}
public Double getSubtotal() {
return subtotal;
}
public void setSubtotal(Double subtotal) {
this.subtotal = subtotal;
}
public List<String> getPaymentPhoto() {
return paymentPhoto;
}
public void setPaymentPhoto(List<String> paymentPhoto) {
this.paymentPhoto = paymentPhoto;
}
}
@@ -0,0 +1,62 @@
package abacus.springboot.example.api.view;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "回购支付明细" , name = "ApiReqJcBillPayment")
public class ApiReqJcBillPayment {
@Schema(description = "支付方式", required = true, example = "线下付款")
private String payment;
@Schema(description = "支付金额", required = true, example = "4820")
private Double amount;
@Schema(description = "账号名称", required = true, example = "张三")
private String zhmc;
@Schema(description = "开发银行", required = true, example = "工商银行")
private String khyh;
@Schema(description = "银行账号", required = true, example = "0101020102102010210201")
private String yhzh;
public String getPayment() {
return payment;
}
public void setPayment(String payment) {
this.payment = payment;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public String getZhmc() {
return zhmc;
}
public void setZhmc(String zhmc) {
this.zhmc = zhmc;
}
public String getKhyh() {
return khyh;
}
public void setKhyh(String khyh) {
this.khyh = khyh;
}
public String getYhzh() {
return yhzh;
}
public void setYhzh(String yhzh) {
this.yhzh = yhzh;
}
}
@@ -0,0 +1,29 @@
package abacus.springboot.example.api.view;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "图片对象" , name = "ApiReqJcBillPhoto")
public class ApiReqJcBillPhoto {
@Schema(description = "回购单号、溯源入库单号", pattern="type=1时,为溯源入库单号,type=2时,为回购单号",required = true, example = "HG202411180001")
private String id;
@Schema(description = "图片明细", required = true, example = "")
private List<ApiReqJcBillPhotoItem> items;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public List<ApiReqJcBillPhotoItem> getItems() {
return items;
}
public void setItems(List<ApiReqJcBillPhotoItem> items) {
this.items = items;
}
}
@@ -0,0 +1,32 @@
package abacus.springboot.example.api.view;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "图片明细" , name = "ApiReqJcBillPhotoItem")
public class ApiReqJcBillPhotoItem {
@Schema(description = "货品编号", pattern="type=1时,必填",required = false, example = "HG202411180001")
private String id;
@Schema(description = "图片类型", required = true, pattern = "回购违规通知函、回购支付凭证、稽查付款截图、稽查货品图", example = "回购违规通知函")
private String typePhoto;
@Schema(description = "图片地址", required = true, example = "http:ip/1.jpg")
private String urlPhoto;
public String getTypePhoto() {
return typePhoto;
}
public void setTypePhoto(String typePhoto) {
this.typePhoto = typePhoto;
}
public String getUrlPhoto() {
return urlPhoto;
}
public void setUrlPhoto(String urlPhoto) {
this.urlPhoto = urlPhoto;
}
}
@@ -0,0 +1,51 @@
package abacus.springboot.example.api.view;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "回购支付方式" , name = "ApiRespBillHgPay")
public class ApiRespBillHgPay {
@Schema(description = "支付方式", required = false, example = "线下支付")
private String payment;
@Schema(description = "账号名称", required = false, example = "张三")
private String zhmc;
@Schema(description = "开发银行", required = false, example = "工商银行")
private String khyh;
@Schema(description = "银行账号", required = false, example = "10021020120102102012010")
private String yhzh;
public String getPayment() {
return payment;
}
public void setPayment(String payment) {
this.payment = payment;
}
public String getZhmc() {
return zhmc;
}
public void setZhmc(String zhmc) {
this.zhmc = zhmc;
}
public String getKhyh() {
return khyh;
}
public void setKhyh(String khyh) {
this.khyh = khyh;
}
public String getYhzh() {
return yhzh;
}
public void setYhzh(String yhzh) {
this.yhzh = yhzh;
}
}
@@ -0,0 +1,64 @@
package abacus.springboot.example.api.view;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "稽查货品" , name = "ApiRespJcPorduct")
public class ApiRespJcPorduct {
@Schema(description="稽查单号", required = false, example="JC202501090002")
private String billId;
@Schema(description="入库单号", required = false, example="WDT2292992992")
private String stockInId;
@Schema(description="回购单号", required = false, example="HG202501090002")
private String hgId;
@Schema(description="出库单号", required = false, example="WDTCK202501090001")
private String stockOutId;
@Schema(description="客户信息", required = false, example="")
private List<ApiRespJcPorductAcount> accounts;
public String getBillId() {
return billId;
}
public void setBillId(String billId) {
this.billId = billId;
}
public String getStockInId() {
return stockInId;
}
public void setStockInId(String stockInId) {
this.stockInId = stockInId;
}
public String getHgId() {
return hgId;
}
public void setHgId(String hgId) {
this.hgId = hgId;
}
public String getStockOutId() {
return stockOutId;
}
public void setStockOutId(String stockOutId) {
this.stockOutId = stockOutId;
}
public List<ApiRespJcPorductAcount> getAccounts() {
return accounts;
}
public void setAccounts(List<ApiRespJcPorductAcount> accounts) {
this.accounts = accounts;
}
}
@@ -0,0 +1,42 @@
package abacus.springboot.example.api.view;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "稽查货品-客户信息" , name = "ApiRespJcPorductAcount")
public class ApiRespJcPorductAcount {
@Schema(description="客户编码", required = false, example="1050000322")
private String account;
@Schema(description="客户名称", required = false, example="四川有限公司")
private String accountName;
@Schema(description="商品信息", required = false, example="")
private List<ApiRespJcPorductProduct> products;
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public List<ApiRespJcPorductProduct> getProducts() {
return products;
}
public void setProducts(List<ApiRespJcPorductProduct> products) {
this.products = products;
}
}
@@ -0,0 +1,31 @@
package abacus.springboot.example.api.view;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "稽查货品-货品信息" , name = "ApiRespJcPorductItem")
public class ApiRespJcPorductItem {
@Schema(description = "货品图片", required = true, example = "")
private List<String> photos;
@Schema(description = "货品编号", required = true, example = "")
private String goodsId;
public List<String> getPhotos() {
return photos;
}
public void setPhotos(List<String> photos) {
this.photos = photos;
}
public String getGoodsId() {
return goodsId;
}
public void setGoodsId(String goodsId) {
this.goodsId = goodsId;
}
}
@@ -0,0 +1,53 @@
package abacus.springboot.example.api.view;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "稽查货品-商品信息" , name = "ApiRespJcPorductProduct")
public class ApiRespJcPorductProduct {
@Schema(description="商品编码", required = false, example="1010400021")
private String product;
@Schema(description="商品名称", required = false, example="52度500ml五粮液")
private String productName;
@Schema(description="数量", required = false, example="12瓶/2件")
private String quantity;
@Schema(description="货品信息", required = false, example="")
private List<ApiRespJcPorductItem> items;
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
public List<ApiRespJcPorductItem> getItems() {
return items;
}
public void setItems(List<ApiRespJcPorductItem> items) {
this.items = items;
}
}
@@ -0,0 +1,40 @@
package abacus.springboot.example.api.view;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "收货信息" , name = "ApiRespReceiveGoods")
public class ApiRespReceiveGoods {
@Schema(description = "稽查单号", required = false, example = "JC202411180001")
private String billid;
@Schema(description = "物流码", required = true, example = "")
private String logisticsid;
@Schema(description = "出库单号", required = true, example = "")
private String billout;
public String getBillid() {
return billid;
}
public void setBillid(String billid) {
this.billid = billid;
}
public String getLogisticsid() {
return logisticsid;
}
public void setLogisticsid(String logisticsid) {
this.logisticsid = logisticsid;
}
public String getBillout() {
return billout;
}
public void setBillout(String billout) {
this.billout = billout;
}
}
@@ -0,0 +1,26 @@
package abacus.springboot.example.api.view;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "收货仓库" , name = "ApiRespWarehouse")
public class ApiRespWarehouse {
@Schema(description = "收货仓库编码", required = false, example = "0001")
private String code;
@Schema(description = "收货仓库名称", required = false, example = "四川仓")
private String name;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
@@ -0,0 +1,123 @@
package abacus.springboot.example.api.view;
/**
* <p>Title:EdgBcsCode</p>
<p>Description:睿治物流码溯源查询接口-返回参数</p>
@author chuanZeng
@date 2024年12月11日
*/
public class EdgBcsCode {
private String code;// 物流码字符串
private String ck_id;// 出库单号字符串
private String dccw_id;// 出库仓编码字符串
private String dccw_name;// 出库仓名称字符串
private String cdt;// 出库⽇期字符串
private String productid;// 商品编码字符串
private String productname;// 商品名称字符串
private String customerid;// 客户编码字符串
private String customername;// 客户名称字符串
private String employeeid;// 业务员编码字符串
private String employeename;// 业务员名称字符串
private String group_id;// 业务组编码字符串
private String group_name;// 业务组名称字符串
private String departmentid;// 分销区域编码字符串
private String departmentname;// 分销区域名称字符串
private String data_source;// 数据源来源字符串
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getCk_id() {
return ck_id;
}
public void setCk_id(String ck_id) {
this.ck_id = ck_id;
}
public String getDccw_id() {
return dccw_id;
}
public void setDccw_id(String dccw_id) {
this.dccw_id = dccw_id;
}
public String getDccw_name() {
return dccw_name;
}
public void setDccw_name(String dccw_name) {
this.dccw_name = dccw_name;
}
public String getCdt() {
return cdt;
}
public void setCdt(String cdt) {
this.cdt = cdt;
}
public String getProductid() {
return productid;
}
public void setProductid(String productid) {
this.productid = productid;
}
public String getProductname() {
return productname;
}
public void setProductname(String productname) {
this.productname = productname;
}
public String getCustomerid() {
return customerid;
}
public void setCustomerid(String customerid) {
this.customerid = customerid;
}
public String getCustomername() {
return customername;
}
public void setCustomername(String customername) {
this.customername = customername;
}
public String getEmployeeid() {
return employeeid;
}
public void setEmployeeid(String employeeid) {
this.employeeid = employeeid;
}
public String getEmployeename() {
return employeename;
}
public void setEmployeename(String employeename) {
this.employeename = employeename;
}
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
public String getGroup_name() {
return group_name;
}
public void setGroup_name(String group_name) {
this.group_name = group_name;
}
public String getDepartmentid() {
return departmentid;
}
public void setDepartmentid(String departmentid) {
this.departmentid = departmentid;
}
public String getDepartmentname() {
return departmentname;
}
public void setDepartmentname(String departmentname) {
this.departmentname = departmentname;
}
public String getData_source() {
return data_source;
}
public void setData_source(String data_source) {
this.data_source = data_source;
}
}
@@ -0,0 +1,25 @@
package abacus.springboot.example.api.view;
public class JcBillCount {
private String id;// 回购单号
private int breednum;// 品种个数
private int numbers;// 件数
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getBreednum() {
return breednum;
}
public void setBreednum(int breednum) {
this.breednum = breednum;
}
public int getNumbers() {
return numbers;
}
public void setNumbers(int numbers) {
this.numbers = numbers;
}
}
@@ -0,0 +1,123 @@
package abacus.springboot.example.api.view;
/**
* <p>Title:JcCodeFlow</p>
<p>Description: 根据物流码查询出的</p>
@author chuanZeng
@date 2024年12月11日
*/
public class JcCodeFlow {
private String id;// 出库单号
private String deposit;// 出库仓编码
private String depositname;// 出库仓名称
private String tdate;// 出库⽇期
private String orderid;// 销售订单号
private String customerid;// 客户编码
private String customername;// 客户名称
private String aprssalemanid;// 业务员编码
private String aprssalemanname;// 业务员名称
private String bizgroupid;// 业务组编码
private String bizgroupname;// 业务组名称
private String wsareaid;// 分销区域编码
private String wsareaname;// 分销区域名称
private String code;// 物流码
private String productid;// 商品
private String productname;// 商品名称
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDeposit() {
return deposit;
}
public void setDeposit(String deposit) {
this.deposit = deposit;
}
public String getDepositname() {
return depositname;
}
public void setDepositname(String depositname) {
this.depositname = depositname;
}
public String getTdate() {
return tdate;
}
public void setTdate(String tdate) {
this.tdate = tdate;
}
public String getOrderid() {
return orderid;
}
public void setOrderid(String orderid) {
this.orderid = orderid;
}
public String getCustomerid() {
return customerid;
}
public void setCustomerid(String customerid) {
this.customerid = customerid;
}
public String getCustomername() {
return customername;
}
public void setCustomername(String customername) {
this.customername = customername;
}
public String getAprssalemanid() {
return aprssalemanid;
}
public void setAprssalemanid(String aprssalemanid) {
this.aprssalemanid = aprssalemanid;
}
public String getAprssalemanname() {
return aprssalemanname;
}
public void setAprssalemanname(String aprssalemanname) {
this.aprssalemanname = aprssalemanname;
}
public String getBizgroupid() {
return bizgroupid;
}
public void setBizgroupid(String bizgroupid) {
this.bizgroupid = bizgroupid;
}
public String getBizgroupname() {
return bizgroupname;
}
public void setBizgroupname(String bizgroupname) {
this.bizgroupname = bizgroupname;
}
public String getWsareaid() {
return wsareaid;
}
public void setWsareaid(String wsareaid) {
this.wsareaid = wsareaid;
}
public String getWsareaname() {
return wsareaname;
}
public void setWsareaname(String wsareaname) {
this.wsareaname = wsareaname;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getProductid() {
return productid;
}
public void setProductid(String productid) {
this.productid = productid;
}
public String getProductname() {
return productname;
}
public void setProductname(String productname) {
this.productname = productname;
}
}
@@ -0,0 +1,84 @@
package abacus.springboot.example.api.view;
// 货品查询
public class JcProduct {
private String billid;
private String billin;
private String billhg;
private String account;
private String accountname;
private String product;
private String productname;
private String wdtbillout;
private int quantity;
private int numbers;
private String goodsid;
public String getGoodsid() {
return goodsid;
}
public void setGoodsid(String goodsid) {
this.goodsid = goodsid;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public int getNumbers() {
return numbers;
}
public void setNumbers(int numbers) {
this.numbers = numbers;
}
public String getBillid() {
return billid;
}
public void setBillid(String billid) {
this.billid = billid;
}
public String getBillin() {
return billin;
}
public void setBillin(String billin) {
this.billin = billin;
}
public String getBillhg() {
return billhg;
}
public void setBillhg(String billhg) {
this.billhg = billhg;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getAccountname() {
return accountname;
}
public void setAccountname(String accountname) {
this.accountname = accountname;
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public String getProductname() {
return productname;
}
public void setProductname(String productname) {
this.productname = productname;
}
public String getWdtbillout() {
return wdtbillout;
}
public void setWdtbillout(String wdtbillout) {
this.wdtbillout = wdtbillout;
}
}
@@ -0,0 +1,41 @@
package abacus.springboot.example.api.view;
public class JcProductBillSouce {
private String indexno;
private String billid;
private String account;
private String product;
private String goodsid;
public String getIndexno() {
return indexno;
}
public void setIndexno(String indexno) {
this.indexno = indexno;
}
public String getBillid() {
return billid;
}
public void setBillid(String billid) {
this.billid = billid;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public String getGoodsid() {
return goodsid;
}
public void setGoodsid(String goodsid) {
this.goodsid = goodsid;
}
}
@@ -0,0 +1,37 @@
package abacus.springboot.example.config;
/**
* <p>Title:JcConfigKey</p>
<p>Description: 配置key的值</p>
@author chuanZeng
@date 2026年8月18日
*/
public class JcConfigKey {
/** keyGroup:系统号*/
public static final String KEY_GROUP = "jc";
/** 二维码域名*/
public static final String KEY_JC_SCAN_SOURCE = "jc.scan.source";
/** 固定店铺编码*/
public static final String KEY_JC_WDT_DEPT = "jc.wdt.dept";
/** 是否自动分仓*/
public static final String KEY_JC_WDT_FCFLAGE = "jc.wdt.fcFlage";
/** ERP-url*/
public static final String KEY_JC_ERP_URL = "jc.erp.url";
/** set:线下支付*/
public static final String KEY_JC_PAYMENT_OFFLINE = "jc.payment.offline";
/** jc.payment.offline:账号名称*/
public static final String KEY_JC_ZHMC = "zhmc";
/** jc.payment.offline:开户银行*/
public static final String KEY_JC_KHYH = "khyh";
/** jc.payment.offline:银行账号*/
public static final String KEY_JC_YHZH = "yhzh";
/** set:稽查收货仓库*/
public static final String KEY_JC_WAREHOUSE = "jc.warehouse";
}
@@ -0,0 +1,175 @@
package abacus.springboot.example.config;
import java.util.ArrayList;
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import abacus.config.dao.AbacusConfig;
import abacus.config.dao.AbacusConfigItem;
import abacus.config.wso.AbacusConfigNote;
/**
* <p>Title:JcConfiguration</p>
<p>Description: 系统配置定义</p>
@author chuanZeng
@date 2024年12月9日
*/
@Configuration
public class JcConfiguration {
@Bean
public AbacusConfigNote key_jc_scan_source() {
AbacusConfigNote abacusConfigNote = new AbacusConfigNote();
AbacusConfig abacusConfig = new AbacusConfig();
abacusConfig.setKeyGroup(JcConfigKey.KEY_GROUP);
abacusConfig.setKey(JcConfigKey.KEY_JC_SCAN_SOURCE);
abacusConfig.setValueType(AbacusConfig._Value);
abacusConfig.setValuees("http://c.ztyxkj.com/,https://scan.vatsliquor.com/logistic/,https://scan.vats.com.cn/scan/");
abacusConfig.setProcedures("API");
abacusConfig.setInsulate(null);
abacusConfig.setDescribe("溯源:二维码域名IP");
abacusConfigNote.setAbacusConfig(abacusConfig);
return abacusConfigNote;
}
@Bean
public AbacusConfigNote key_jc_payment_offline() {
AbacusConfigNote abacusConfigNote = new AbacusConfigNote();
AbacusConfig abacusConfig = new AbacusConfig();
abacusConfig.setKeyGroup(JcConfigKey.KEY_GROUP);
abacusConfig.setKey(JcConfigKey.KEY_JC_PAYMENT_OFFLINE);
abacusConfig.setValueType(AbacusConfig._Set);
abacusConfig.setValuees(null);
abacusConfig.setProcedures("API");
abacusConfig.setInsulate(null);
abacusConfig.setDescribe("支付方式:线下支付");
List<AbacusConfigItem> abacusConfigItems = new ArrayList<AbacusConfigItem>();
AbacusConfigItem aci = new AbacusConfigItem();
aci.setKeyGroup(JcConfigKey.KEY_GROUP);
aci.setKey(JcConfigKey.KEY_JC_PAYMENT_OFFLINE);
aci.setCode(JcConfigKey.KEY_JC_ZHMC);
aci.setName("张三");
aci.setInsulate(null);
aci.setDescribe("账户名称");
abacusConfigItems.add(aci);
AbacusConfigItem aci1 = new AbacusConfigItem();
aci1.setKeyGroup(JcConfigKey.KEY_GROUP);
aci1.setKey(JcConfigKey.KEY_JC_PAYMENT_OFFLINE);
aci1.setCode(JcConfigKey.KEY_JC_KHYH);
aci1.setName("工商银行");
aci1.setInsulate(null);
aci1.setDescribe("开户银行");
abacusConfigItems.add(aci1);
AbacusConfigItem aci2 = new AbacusConfigItem();
aci2.setKeyGroup(JcConfigKey.KEY_GROUP);
aci2.setKey(JcConfigKey.KEY_JC_PAYMENT_OFFLINE);
aci2.setCode(JcConfigKey.KEY_JC_YHZH);
aci2.setName("0101010020023090");
aci2.setInsulate(null);
aci2.setDescribe("银行账户");
abacusConfigItems.add(aci2);
abacusConfigNote.setAbacusConfig(abacusConfig);
abacusConfigNote.setAbacusConfigItems(abacusConfigItems);
return abacusConfigNote;
}
@Bean
public AbacusConfigNote key_jc_wdt_dept() {
AbacusConfigNote abacusConfigNote = new AbacusConfigNote();
AbacusConfig abacusConfig = new AbacusConfig();
abacusConfig.setKeyGroup(JcConfigKey.KEY_GROUP);
abacusConfig.setKey(JcConfigKey.KEY_JC_WDT_DEPT);
abacusConfig.setValueType(AbacusConfig._Value);
abacusConfig.setValuees("0001");
abacusConfig.setProcedures("旺店通固定店铺编码");
abacusConfig.setInsulate(null);
abacusConfig.setDescribe("旺店通固定店铺编码");
abacusConfigNote.setAbacusConfig(abacusConfig);
return abacusConfigNote;
}
@Bean
public AbacusConfigNote key_jc_wdt_fcflage() {
AbacusConfigNote abacusConfigNote = new AbacusConfigNote();
AbacusConfig abacusConfig = new AbacusConfig();
abacusConfig.setKeyGroup(JcConfigKey.KEY_GROUP);
abacusConfig.setKey(JcConfigKey.KEY_JC_WDT_FCFLAGE);
abacusConfig.setValueType(AbacusConfig._Value);
abacusConfig.setValuees("true");
abacusConfig.setProcedures("是否自动分仓");
abacusConfig.setInsulate(null);
abacusConfig.setDescribe("是否自动分仓");
abacusConfigNote.setAbacusConfig(abacusConfig);
return abacusConfigNote;
}
@Bean
public AbacusConfigNote key_jc_erp_url() {
AbacusConfigNote abacusConfigNote = new AbacusConfigNote();
AbacusConfig abacusConfig = new AbacusConfig();
abacusConfig.setKeyGroup(JcConfigKey.KEY_GROUP);
abacusConfig.setKey(JcConfigKey.KEY_JC_ERP_URL);
abacusConfig.setValueType(AbacusConfig._Value);
abacusConfig.setValuees("http://");
abacusConfig.setProcedures("erp的IP");
abacusConfig.setInsulate(null);
abacusConfig.setDescribe("erp的IP");
abacusConfigNote.setAbacusConfig(abacusConfig);
return abacusConfigNote;
}
@Bean
public AbacusConfigNote key_jc_warehouse() {
AbacusConfigNote abacusConfigNote = new AbacusConfigNote();
AbacusConfig abacusConfig = new AbacusConfig();
abacusConfig.setKeyGroup(JcConfigKey.KEY_GROUP);
abacusConfig.setKey(JcConfigKey.KEY_JC_WAREHOUSE);
abacusConfig.setValueType(AbacusConfig._Set);
abacusConfig.setValuees(null);
abacusConfig.setProcedures("API");
abacusConfig.setInsulate(null);
abacusConfig.setDescribe("稽查收货仓库");
// List<AbacusConfigItem> abacusConfigItems = new ArrayList<AbacusConfigItem>();
//
// AbacusConfigItem aci = new AbacusConfigItem();
// aci.setKeyGroup(JcConfigKey.KEY_GROUP);
// aci.setKey(JcConfigKey.KEY_JC_WAREHOUSE);
// aci.setCode("237881");
// aci.setName("江苏致众盐城仓库");
// aci.setInsulate(null);
// aci.setDescribe("稽查收货仓库");
// abacusConfigItems.add(aci);
//
// AbacusConfigItem aci1 = new AbacusConfigItem();
// aci1.setKeyGroup(JcConfigKey.KEY_GROUP);
// aci1.setKey(JcConfigKey.KEY_JC_WAREHOUSE);
// aci1.setCode("288381");
// aci1.setName("上海一区");
// aci1.setInsulate(null);
// aci1.setDescribe("稽查收货仓库");
// abacusConfigItems.add(aci1);
abacusConfigNote.setAbacusConfig(abacusConfig);
// abacusConfigNote.setAbacusConfigItems(abacusConfigItems);
return abacusConfigNote;
}
}
@@ -0,0 +1,50 @@
package abacus.springboot.example.config;
import javax.persistence.EntityManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.abacus.xpos.foundation.pubs.DaoIdGenerator;
/**
* <p>Title:JcIdGeneratorConfig</p>
<p>Description: ID生成器</p>
@author chuanZeng
@date 2024年12月5日
*/
@Configuration
public class JcIdGeneratorConfig {
@Autowired
private EntityManager entityManager;
@Bean(name="jcBillIdGenerator")
public DaoIdGenerator jcBillIdGenerator() {
DaoIdGenerator daoIdGenerator = new DaoIdGenerator();
daoIdGenerator.setTargetTableName("jc_bill");
daoIdGenerator.setPrefix("JC");
daoIdGenerator.setTargetIdColumnName("id");
daoIdGenerator.setSerialLength(4);
daoIdGenerator.setUseDAOId(false);
daoIdGenerator.setUseDateFormat(true);
//年月日
daoIdGenerator.setDateFormat("yyyyMMdd");
return daoIdGenerator;
}
@Bean(name="jcBillHgIdGenerator")
public DaoIdGenerator jcBillHgIdGenerator() {
DaoIdGenerator daoIdGenerator = new DaoIdGenerator();
daoIdGenerator.setTargetTableName("jc_billhg");
daoIdGenerator.setPrefix("HG");
daoIdGenerator.setTargetIdColumnName("id");
daoIdGenerator.setSerialLength(4);
daoIdGenerator.setUseDAOId(false);
daoIdGenerator.setUseDateFormat(true);
//年月日
daoIdGenerator.setDateFormat("yyyyMMdd");
return daoIdGenerator;
}
}
@@ -0,0 +1,168 @@
package abacus.springboot.example.controller;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.abacus.xpos.foundation.dao.Dept;
import com.abacus.xpos.foundation.dao.Employee;
import abacus.config.dao.AbacusConfigItem;
import abacus.springboot.example.config.JcConfigKey;
import abacus.springboot.example.dao.JcBill;
import abacus.springboot.example.pi.AutoCompleteAccessIF;
/**
* <p>
* Title:AutoCompleteController
* </p>
* <p>
* Description: 前端检索查询-api
* </p>
*
* @author chuanZeng
* @date 2022年4月26日
*/
@RestController()
@RequestMapping(value = "/autoComplete")
public class AutoCompleteController extends BaseServlet {
private static final Logger LOG = LoggerFactory.getLogger(AutoCompleteController.class);
@Autowired
private AutoCompleteAccessIF autoCompleteAccess;
/**
* 检索:收货仓库
*
* @param request
* @param response
* @return
* @throws Throwable
*/
@RequestMapping(value = "abacusConfigItemGroupAutoComplete", method = RequestMethod.POST)
public List<AbacusConfigItem> abacusConfigItemGroupAutoComplete(@RequestParam(required = false) String keyCode) throws Throwable {
try {
List<AbacusConfigItem> objs = this.autoCompleteAccess.abacusConfigItemGroupAutoComplete(keyCode, JcConfigKey.KEY_GROUP, JcConfigKey.KEY_JC_WAREHOUSE);
return objs;
} catch (Throwable e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* 检索:稽查
*
* @param request
* @param response
* @return
* @throws Throwable
*/
@RequestMapping(value = "jcBillAutoComplete", method = RequestMethod.POST)
public List<JcBill> jcBillAutoComplete(@RequestParam(required = false) String keyCode) throws Throwable {
try {
List<JcBill> objs = this.autoCompleteAccess.jcBillAutoComplete(keyCode);
return objs;
} catch (Throwable e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* 检索:门店
*
* @param request
* @param response
* @return
* @throws Throwable
*/
@RequestMapping(value = "deptAutoComplete", method = RequestMethod.POST)
public List<Dept> deptAutoComplete(@RequestParam(required = false) String keyCode,
@RequestParam(required = false) String type) throws Throwable {
try {
List<Dept> objs = this.autoCompleteAccess.deptAutoComplete(keyCode, type);
return objs;
} catch (Throwable e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* 检索:分销门店
*
* @param request
* @param response
* @return
* @throws Throwable
*/
@RequestMapping(value = "deptFxAutoComplete", method = RequestMethod.POST)
public List<Dept> deptFxAutoComplete(@RequestParam(required = false) String keyCode) throws Throwable {
try {
List<Dept> objs = this.autoCompleteAccess.deptAutoComplete(keyCode, "17");
return objs;
} catch (Throwable e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* 检索:员工
*
* @param request
* @param response
* @return
* @throws Throwable
*/
@RequestMapping(value = "employeeAutoComplete", method = RequestMethod.POST)
public List<Employee> employeeAutoComplete(@RequestParam(required = false) String keyCode) throws Throwable {
try {
List<Employee> objs = this.autoCompleteAccess.employeeAutoComplete(keyCode);
return objs;
} catch (Throwable e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
}
@@ -0,0 +1,222 @@
package abacus.springboot.example.controller;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.abacus.xpos.foundation.pubs.UserContext;
import abacus.commons.exception.BusinessException;
import abacus.config.ext.AbacusExtConfig;
/**
* <p>Title:BaseServlet</p>
<p>Description: 基础控制器</p>
@author chuanZeng
@date 2026年8月18日
*/
public class BaseServlet{
@Autowired
private AbacusExtConfig abacusExtConfig;
/**
* value-获取配置参数
* @param configKey
* @return
* @throws WebserviceException
*/
protected String getConfigValue(String configKey) throws BusinessException {
String configValueStr = abacusExtConfig.getAbacusConfigValue(configKey);
if (StringUtils.isBlank(configValueStr)) {
throw new BusinessException("配置参数[" + configKey + "]值不存在!");
}
return configValueStr;
}
/**
* set-获取配置参数
* @param configKey
* @return
* @throws WebserviceException
*/
protected Map<String, String> getConfigSet(String keyGroup, String configKey) throws BusinessException {
Map<String, String> configValueStr = abacusExtConfig.getAbacusConfigSetByKeyGroupByKey(keyGroup, configKey);
if (configValueStr.isEmpty()) {
throw new BusinessException("系统[" + keyGroup + "]配置参数[" + configKey + "]值不存在!");
}
return configValueStr;
}
/**
* 获取登陆用户id
* @return
* @throws Exception
*/
protected String getUserId() throws BusinessException {
String operatorId = UserContext.getUserId();
if (StringUtils.isBlank(operatorId)){
throw new BusinessException("操作员不存在,请重新登录!");
}
return operatorId;
}
/**
* 获取登陆用户姓名
* @return
*/
protected String getUserName() throws BusinessException{
String operatorName = UserContext.getUserName();
if (StringUtils.isBlank(operatorName)){
throw new BusinessException("操作员不存在,请重新登录!");
}
return operatorName;
}
/**
* 获取登陆用户所属部门id
* @return
*/
protected String getDeptId() throws BusinessException{
String deptId = UserContext.getDeptId();
if (StringUtils.isBlank(deptId)){
throw new BusinessException("操作员所属部门不存在,请重新登录!");
}
return deptId;
}
/**
* 获取登陆用户所属部门名称
* @return
*/
protected String getDeptName() throws BusinessException{
String deptName = UserContext.getDeptName();
if (StringUtils.isBlank(deptName)){
throw new BusinessException("操作员所属部门不存在,请重新登录!");
}
return deptName;
}
/**
*
* 获取double型的参数
*
* @param request
* @param paramName
* @return
*/
protected Double getDoubleParameter(HttpServletRequest request, String paramName) {
//
String paramValue = request.getParameter(paramName);
if (StringUtils.isBlank(paramValue)) {
return null;
}
return Double.valueOf(paramValue);
}
/**
*
* 获取long型的参数
*
* @param request
* @param paramName
* @return
*/
protected Long getLongParameter(HttpServletRequest request, String paramName) {
//
String paramValue = request.getParameter(paramName);
if (StringUtils.isBlank(paramValue)) {
return null;
}
return Long.valueOf(paramValue);
}
/**
*
* 获取int型的参数
*
* @param request
* @param paramName
* @return
*/
protected Integer getIntegerParameter(HttpServletRequest request, String paramName) {
//
String paramValue = request.getParameter(paramName);
if (StringUtils.isBlank(paramValue)) {
return null;
}
return Integer.valueOf(paramValue);
}
/**
*
* 获取Boolean型的参数
*
* @param request
* @param paramName
* @return
*/
protected Boolean getBooleanParameter(HttpServletRequest request, String paramName) {
//
String paramValue = request.getParameter(paramName);
if ("true".equalsIgnoreCase(paramValue)) {
return true;
}else if ("false".equalsIgnoreCase(paramValue)) {
return false;
}else {
return null;
}
}
/**
* 正则表达式校验手机号码
*
* @return false 则手机号码不合法,true 则手机号码校验通过
*/
protected Boolean validatePhoneNumber(String phoneNumber) {
if (phoneNumber.length() != 11) {
System.out.print("手机号应为11位数 ");
return false;
} else {
String regPattern = "^(1)\\d{10}$";
Pattern pattern = Pattern.compile(regPattern);
Matcher matcher = pattern.matcher(phoneNumber);
boolean isMatch = matcher.matches();
if (!isMatch) {
System.out.print("请填入正确的手机号 ");
}
return isMatch;
}
}
/**
* 良友-crm回调函数
*/
protected Map<String, Object> crmReturn(int code, String message, String content) {
Map<String, Object> map = new LinkedHashMap<String, Object>();
map.put("code", code);
map.put("message", message);
map.put("content", content);
return map;
}
}
@@ -0,0 +1,751 @@
package abacus.springboot.example.controller;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.abacus.pms.dao.Account;
import com.abacus.pms.wsi.AccountServiceIF;
import com.abacus.pms.wsi.ProductServiceIF;
import com.abacus.xpos.foundation.pubs.DaoIdGenerator;
import com.abacus.xpos.foundation.wsi.EmployeeServiceIF;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import abacus.commons.exception.BusinessException;
import abacus.springboot.example.config.JcConfigKey;
import abacus.springboot.example.dao.JcBill;
import abacus.springboot.example.dao.JcBillHg;
import abacus.springboot.example.dao.JcBillInItem;
import abacus.springboot.example.dao.JcBillPhoto;
import abacus.springboot.example.dao.JcBillSourceItem;
import abacus.springboot.example.util.DateToUpperChinese;
import abacus.springboot.example.util.DateUtil;
import abacus.springboot.example.vo.SiDepositlocation;
import abacus.springboot.example.wsi.JcBillServiceIF;
/**
* <p>Title:JcBillHgController</p>
<p>Description: 前端相关-api</p>
@author chuanZeng
@date 2026年8月18日
*/
@RestController
@RequestMapping(value = "/jc/billHg")
public class JcBillHgController extends BaseServlet{
private static final Logger LOG = LoggerFactory.getLogger(JcBillHgController.class);
@Autowired
private JcBillServiceIF jcBillService;
@Autowired
private AccountServiceIF accountService;
@Autowired
private ProductServiceIF productService;
@Autowired
private DaoIdGenerator jcBillHgIdGenerator;
@Autowired
private EmployeeServiceIF employeeService;
/**
* TODO 稽查入库(回购通知)明细
* @param billId
* @return
* @throws Throwable
*/
@RequestMapping(value = "queryJcBillInItems", method = RequestMethod.POST)
public JSONObject queryJcBillInItems(
@RequestParam(required = true) String billId
)
throws Throwable {
try {
List<JcBillInItem> items = jcBillService.queryJcBillInItemByBillId(billId);
if(items == null) throw new BusinessException("回购明细不存在!");
List<JcBillInItem> oneList = new ArrayList<JcBillInItem>();
List<JcBillInItem> twoList = new ArrayList<JcBillInItem>();
for(JcBillInItem item : items) {
if(JcBillInItem.STATUS_TWO != item.getStatus()) {
Account account = accountService.getAccount(item.getAccount());
if(account != null) {
item.setOperator(account.getOperator().getId());
item.setOperatorname(account.getOperator().getName());
item.setSalearea(account.getSalearea());
} else {
item.setSalearea("");
item.setSaleareaname("");
item.setGroupid("");
item.setGroupname("");
}
}
}
jcBillService.saveJcBillInItem(items);
// 分出,已通知或未通知
for(JcBillInItem item : items) {
if(JcBillInItem.STATUS_MINUS_ONE == item.getStatus() || JcBillInItem.STATUS_ONE == item.getStatus()) {
// item.setPrice(new BigDecimal(String.valueOf(item.getPrice())).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
oneList.add(item);
} else {
// item.setPrice(new BigDecimal(String.valueOf(item.getPrice())).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
twoList.add(item);
}
}
JSONObject obj = new JSONObject();
obj.put("oneList", oneList);
obj.put("twoList", twoList);
obj.put("threeList", items);
return obj;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 查询回购明细对应的溯源信息
* @param id
* @return
* @throws Throwable
*/
@RequestMapping(value = "queryHgSourceItems", method = RequestMethod.POST)
public List<JcBillSourceItem> queryHgSourceItems(
@RequestParam(required = true) String id
)
throws Throwable {
try {
JcBillInItem inItem = jcBillService.queryJcBillInItemById(Long.parseLong(id));
if(inItem == null) throw new BusinessException("回购明细不存在!");
List<JcBillSourceItem> billItems = jcBillService.queryJcBillSourceItemByBillId(inItem.getBillid());
if(billItems == null) throw new BusinessException("溯源信息不存在!");
// 按客户编码+商品编码+收货单价分组
Map<String, List<JcBillSourceItem>> mapItems = billItems.stream()
.collect(Collectors.groupingBy(e -> {
return e.getAccount() + "#" + e.getProduct() + "#" + String.valueOf(e.getPrice());
},
Collectors.collectingAndThen(Collectors.toList(), value -> value)
));
Map<String, List<JcBillPhoto>> mapPhoto = jcBillService.queryJcBillPhoto(inItem.getBillid());
// 找出对应的来源明细
List<JcBillSourceItem> tempItems = mapItems.get(inItem.getAccount() + "#" + inItem.getProduct() + "#" + String.valueOf(inItem.getPrice()));
for(JcBillSourceItem item : tempItems) {
// 稽查付款截图
List<JcBillPhoto> fkts = mapPhoto.get(JcBillPhoto.JC_FK + "#" + String.valueOf(item.getIndexno()));
if(fkts != null && fkts.size() >= 1) {
List<String> fkList = new ArrayList<String>();
for(JcBillPhoto fkt : fkts) {
fkList.add(fkt.getUrlphoto());
}
item.setPaymentPhoto(fkList);
}
// 货品图
List<JcBillPhoto> hpts = mapPhoto.get(JcBillPhoto.JC_HP + "#" + String.valueOf(item.getIndexno()) + "#" + item.getGoodsid());
if(hpts != null && hpts.size() >= 1) {
List<String> hpList = new ArrayList<String>();
for(JcBillPhoto hpt : hpts) {
hpList.add(hpt.getUrlphoto());
}
item.setGoodsPhotos(hpList);
item.setHpts(hpts);
}
}
return tempItems;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 终止回购
* @param id
* @return
* @throws Throwable
*/
@RequestMapping(value = "terminateHgInItem", method = RequestMethod.POST)
public void terminateHgInItem(
@RequestParam(required = true) String id
)
throws Throwable {
try {
JcBillInItem inItem = jcBillService.queryJcBillInItemById(Long.parseLong(id));
if(inItem == null) throw new BusinessException("回购明细不存在!");
inItem.setStatus(JcBillInItem.STATUS_MINUS_ONE);
jcBillService.saveTerminateHgInItem(inItem);
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 修改回购价格
* @param id
* @return
* @throws Throwable
*/
@RequestMapping(value = "updateHgprice", method = RequestMethod.POST)
public JcBillInItem updateHgprice(
@RequestParam(required = true) String id,
@RequestParam(required = true) String hgprice
)
throws Throwable {
try {
JcBillInItem inItem = jcBillService.queryJcBillInItemById(Long.parseLong(id));
if(inItem == null) throw new BusinessException("回购明细不存在!");
inItem.setOldhgprice(inItem.getHgprice());
BigDecimal bigHgprice = new BigDecimal(hgprice);
BigDecimal bigAmount = bigHgprice.multiply(new BigDecimal(String.valueOf(inItem.getQuantity())));
inItem.setHgprice(bigHgprice.doubleValue());
inItem.setHgamount(bigAmount.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
jcBillService.updateHgprice(inItem);
return inItem;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 回购查询
* @param id
* @return
* @throws Throwable
*/
@RequestMapping(value = "queryHg", method = RequestMethod.POST)
public JSONObject queryHg(
@RequestParam(required = false) String from,
@RequestParam(required = false) String thru,
@RequestParam(required = false) String account,
@RequestParam(required = false) String salearea,
@RequestParam(required = false) String id,
@RequestParam(required = false) String billId,
@RequestParam(required = false) String status,
@RequestParam(required = false) String product,
@RequestParam(required = false) String manager,
@RequestParam(required = true) int typ,
@RequestParam(required = true) int page,
@RequestParam(required = true) int size
)
throws Throwable {
try {
// 创建起始时间
String fromDate = null;
if (StringUtils.isNotBlank(from)) {
fromDate = DateUtil.formatDateTime(DateUtil.getFromDate(DateUtil.toDate(from)));
}
// 创建截止时间
String thruDate = null;
if (StringUtils.isNotBlank(thru)) {
thruDate = DateUtil.formatDateTime(DateUtil.getThruDate(DateUtil.toDate(thru)));
}
// 当前页
// int pageNumber = page/size + 1;
Pageable pageable = PageRequest.of(page - 1, size);
Page<JcBillHg> pages = jcBillService.queryJcBillHg(fromDate, thruDate, account, salearea, id, billId,
status, product, manager, typ, pageable);
for(JcBillHg hg : pages.getContent()) {
hg.setAmount(hg.getSubtotal() + hg.getFreight());
}
JSONObject obj = new JSONObject();
obj.put("list", pages.getContent());
obj.put("total", pages.getTotalElements());
return obj;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 回购-驳回
* 待提交-->回购通知节点
* 待付款-->待提交,
* 已付款-->待付款
* 待分仓-->已付款
* @param billId
* @param typ 1-回购认款,2-回购分仓
* @return
*/
@RequestMapping(value = "rejectBillHg", method = RequestMethod.POST)
public JcBillHg rejectBillHg(
@RequestParam(required = false) String billHgId,
@RequestParam(required = false) int status,
@RequestParam(required = true) int typ
)
throws Throwable {
try {
JcBillHg billHg = jcBillService.queryJcBillHg(billHgId);
if(billHg == null) throw new BusinessException("回购订单不存在!");
List<JcBillInItem> inItems = null;
JcBill jcBill = null;
if(JcBillHg.STATUS_ONE == status) {
inItems = jcBillService.queryJcBillInItemByBillId(billHg.getBillid());
if(inItems == null) throw new BusinessException("回购明细不存在!");
// 设置明细状态和回购单号为空
// 是否部分回购
boolean informFlag = false;
for(JcBillInItem item : inItems) {
if(billHgId.equals(item.getBillhg())) {
item.setStatus(JcBillInItem.STATUS_ONE);
item.setBillhg(null);
}
if(item.getStatus() == JcBillInItem.STATUS_TWO) {
informFlag = true;
}
}
jcBill = jcBillService.queryJcBillById(billHg.getBillid());
if(jcBill == null) throw new BusinessException("收货记录不存在!");
// 稽查收货记录修改状态
// if(informFlag) jcBill.setStatus(JcBill.STATUS_SIX);
// else jcBill.setStatus(JcBill.STATUS_FIVE);
if(informFlag) jcBill.setHgstatus(JcBill.HGSTATUS_ONE);
else jcBill.setStatus(JcBill.STATUS_FIVE);
billHg.setStatus(JcBillHg.STATUS_MINUS_ONE);
} else if(JcBillHg.STATUS_TWO == status) {
billHg.setStatus(JcBillHg.STATUS_ONE);
} else if(JcBillHg.STATUS_THREE == status || JcBillHg.STATUS_FOUR == status) {
billHg.setStatus(JcBillHg.STATUS_TWO);
} else if(JcBillHg.STATUS_FIVE == status) {
SiDepositlocation sd = jcBillService.querySiDepositlocationHGfc(billHg.getId());
if(sd == null) {// WDT
throw new BusinessException("该单据需要通知仓库在旺店通删除入库单,并联系信息部撤回。");
} else {
if(sd.getPush() == 1) {// WMS
JSONObject obj = jcBillService.gwisSubCancelOrder(billHg.getId(), "B2BCK");
if(obj.getBooleanValue("success")) {
billHg.setStatus(JcBillHg.STATUS_FOUR);
} else {
throw new BusinessException(obj.getString("body"));
}
} else {
throw new BusinessException("该单据需要通知仓库在旺店通删除入库单,并联系信息部撤回。");
}
}
} else {
throw new BusinessException("未知状态不能驳回!");
}
jcBillService.saveRejectBillHg(status, typ, jcBill, billHg, inItems);
billHg.setAmount(billHg.getSubtotal() + billHg.getFreight());
return billHg;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 确认收款
* @param billId
* @return
*/
@RequestMapping(value = "querenSk", method = RequestMethod.POST)
public JcBillHg querenSk(
@RequestParam(required = false) String billHgId
)
throws Throwable {
try {
JcBillHg billHg = jcBillService.queryJcBillHg(billHgId);
if(billHg == null) throw new BusinessException("回购订单不存在!");
String key_jc_wdt_fcflage = getConfigValue(JcConfigKey.KEY_JC_WDT_FCFLAGE);
boolean fcFlag = Boolean.parseBoolean(key_jc_wdt_fcflage);
if(fcFlag) billHg.setStatus(JcBillHg.STATUS_FIVE);
else billHg.setStatus(JcBillHg.STATUS_FOUR);
jcBillService.saveQuerenSk(billHg, fcFlag);
billHg.setAmount(billHg.getSubtotal() + billHg.getFreight());
return billHg;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 分仓
* @param billId
* @return
*/
@RequestMapping(value = "createFc", method = RequestMethod.POST)
public JcBillHg createFc(
@RequestParam(required = false) String billHgId
)
throws Throwable {
try {
JcBillHg billHg = jcBillService.queryJcBillHg(billHgId);
if(billHg == null) throw new BusinessException("回购订单不存在!");
billHg.setStatus(JcBillHg.STATUS_FIVE);
jcBillService.savecreateFc(billHg);
billHg.setAmount(billHg.getSubtotal() + billHg.getFreight());
return billHg;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 修改分仓仓库
* @param billId
* @return
*/
@RequestMapping(value = "updateFcWarehouse", method = RequestMethod.POST)
public JcBillHg updateFcWarehouse(
@RequestParam(required = true) String billHgId,
@RequestParam(required = true) String warehouse,
@RequestParam(required = true) String warehouseName
)
throws Throwable {
try {
JcBillHg billHg = jcBillService.queryJcBillHg(billHgId);
if(billHg == null) throw new BusinessException("回购订单不存在!");
// 老对象保存为JSONString
String oldJsonStr = JSON.toJSONString(billHg);
billHg.setFhwarehouse(warehouse);
billHg.setFhwarehousename(warehouseName);
jcBillService.updateFcWarehouse(oldJsonStr, billHg);
billHg.setAmount(billHg.getSubtotal() + billHg.getFreight());
return billHg;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 修改运营备注
* @param billId
* @return
*/
@RequestMapping(value = "updateRemark1", method = RequestMethod.POST)
public JcBillHg updateRemark1(
@RequestParam(required = true) String billHgId,
@RequestParam(required = true) String remark
)
throws Throwable {
try {
JcBillHg billHg = jcBillService.queryJcBillHg(billHgId);
if(billHg == null) throw new BusinessException("回购订单不存在!");
// 老对象保存为JSONString
String oldJsonStr = JSON.toJSONString(billHg);
billHg.setRemark1(remark);
jcBillService.updateFcWarehouse(oldJsonStr, billHg);
billHg.setAmount(billHg.getSubtotal() + billHg.getFreight());
return billHg;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 修改收货地址
* @param billId
* @return
*/
@RequestMapping(value = "updatePac", method = RequestMethod.POST)
public JcBillHg updatePac(
@RequestParam(required = true) String billHgId,
@RequestParam(required = true) String provincename,
@RequestParam(required = true) String cityname,
@RequestParam(required = true) String areaname,
@RequestParam(required = true) String address,
@RequestParam(required = true) String consignee,
@RequestParam(required = true) String consigneephone
)
throws Throwable {
try {
JcBillHg billHg = jcBillService.queryJcBillHg(billHgId);
if(billHg == null) throw new BusinessException("回购订单不存在!");
// 老对象保存为JSONString
String oldJsonStr = JSON.toJSONString(billHg);
billHg.setProvincename(provincename);
billHg.setCityname(cityname);
billHg.setAreaname(areaname);
billHg.setAddress(address);
billHg.setConsignee(consignee);
billHg.setConsigneephone(consigneephone);
jcBillService.updatePac(oldJsonStr, billHg);
billHg.setAmount(billHg.getSubtotal() + billHg.getFreight());
return billHg;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
// TODO 创建通知函文章
@RequestMapping(value="createTzh", method = RequestMethod.POST)
public JSONObject createTzh(
@RequestParam(required = true) String inItems,
@RequestParam(required = false) String bzj
) throws Exception {
try {
if(StringUtils.isBlank(inItems)) throw new BusinessException("未勾选!");
List<JcBillInItem> items = JSON.parseArray(inItems, JcBillInItem.class);
List<JcBillSourceItem> billItems = jcBillService.queryJcBillSourceItemByBillId(items.get(0).getBillid());
if(billItems == null) throw new BusinessException("稽查明细不存在!");
if(StringUtils.isBlank(bzj)) bzj = "2、在接到本通知函后一周内,缴纳1万元市场管理保证金,汇入我司对公账户。";
return creatTzhObj(items, billItems.get(0), bzj);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* 生成通知函个节点
* @param item
* @return
* @throws Exception
*/
private JSONObject creatTzhObj(List<JcBillInItem> items, JcBillSourceItem billItem, String bzj) throws Exception{
try {
JcBillInItem inItem = items.get(0);
JSONObject obj = new JSONObject();
// 客户
obj.put("account", inItem.getAccount() + inItem.getAccountname());
// 回购单价
obj.put("hgprice", String.valueOf(inItem.getHgprice()).replace("\\.0*$", ""));
// 年月日
obj.put("dataz", DateToUpperChinese.getUpperDate(new Date()));
// 收货门店
Map<String, String> mapChannel = items.stream()
.collect(Collectors.groupingBy(e -> {
return e.getChannel();
},
Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0).getChannel())
));
String channelStr = "";
for(String key : mapChannel.keySet()) {
if("线上".equals(billItem.getRecsource())) {
channelStr += billItem.getRecplatform() + key + "";
} else {
channelStr += key + "";
}
}
obj.put("channel", channelStr.toString().substring(0, channelStr.length() - 1));
// 商品
Map<String, JcBillInItem> mapPorduct = items.stream()
.collect(Collectors.groupingBy(e -> {
return e.getProduct() + String.valueOf(e.getPrice());
},
Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))
));
double numbers = 0;
StringBuffer productStr = new StringBuffer();
for(String key : mapPorduct.keySet()) {
JcBillInItem productItem = mapPorduct.get(key);
BigDecimal price = new BigDecimal(String.valueOf(productItem.getPrice()));
// BigDecimal amount = price.multiply(new BigDecimal(String.valueOf(productItem.getQuantity()))).setScale(2, BigDecimal.ROUND_HALF_UP);
//
// BigDecimal numPrice = amount.divide(new BigDecimal(String.valueOf(productItem.getNumbers())), 4, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
//
// LOG.info(removeZeros(String.valueOf(numPrice.doubleValue())));
// productStr.append("收货价格" + removeZeros(String.valueOf(price.doubleValue())) + "元/瓶、");
// numbers += productItem.getNumbers();
numbers += productItem.getQuantity();
}
obj.put("product", inItem.getProductname());
// obj.put("product", inItem.getProductname() + "" + productStr.toString().substring(0, productStr.length() - 1));
// 件数
obj.put("numbers", numbers);
// 支付方式-打款信息
Map<String, String> offlineMaps = getConfigSet(JcConfigKey.KEY_GROUP, JcConfigKey.KEY_JC_PAYMENT_OFFLINE);
obj.put("dkxx", offlineMaps.get("zhmc") + "" + offlineMaps.get("khyh") + "" + offlineMaps.get("yhzh"));
// 保证金
obj.put("bzj", bzj);
return obj;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* 去掉小数位0的数字
* @param str
* @return
*/
private String removeZeros(String str) {
if(str.indexOf(".") > 0) {
str = str.replace("0+?$", "");// 删除掉尾数为0的字符
str = str.replace("[.]$", "");// 结尾如果是小数点,则去掉
}
return str;
}
}
@@ -0,0 +1,595 @@
package abacus.springboot.example.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.abacus.pms.wsi.AccountServiceIF;
import com.abacus.pms.wsi.ProductServiceIF;
import com.abacus.xpos.foundation.wsi.EmployeeServiceIF;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import abacus.commons.exception.BusinessException;
import abacus.springboot.example.dao.JcBill;
import abacus.springboot.example.dao.JcBillInItem;
import abacus.springboot.example.dao.JcBillPhoto;
import abacus.springboot.example.dao.JcBillSourceItem;
import abacus.springboot.example.dao.JcSourceItem;
import abacus.springboot.example.util.DateUtil;
import abacus.springboot.example.vo.SiDepositlocation;
import abacus.springboot.example.wsi.JcBillServiceIF;
/**
* <p>Title:JcBillInController</p>
<p>Description: 前端相关-api</p>
@author chuanZeng
@date 2026年8月18日
*/
@RestController
@RequestMapping(value = "/jc")
public class JcBillInController extends BaseServlet{
private static final Logger LOG = LoggerFactory.getLogger(JcBillInController.class);
@Autowired
private JcBillServiceIF jcBillService;
@Autowired
private EmployeeServiceIF employeeService;
@Autowired
private ProductServiceIF productService;
@Autowired
private AccountServiceIF accountService;
/**
* TODO (溯源入库-回购通知)--页面查询
* @param typ 1-溯源入库 2-回购通知
* @return
* @throws Throwable
*/
@RequestMapping(value = "queryJcBillPage", method = RequestMethod.POST)
public JSONObject queryJcBillPage(
@RequestParam(required = false) String from,
@RequestParam(required = false) String thru,
@RequestParam(required = false) String applicant,
@RequestParam(required = false) String goods,
@RequestParam(required = false) String id,
@RequestParam(required = false) String billin,
@RequestParam(required = false) String goodsid,
@RequestParam(required = false) String product,
@RequestParam(required = false) String status,
@RequestParam(required = true) int typ,
@RequestParam(required = true) int page,
@RequestParam(required = true) int size
)
throws Throwable {
try {
// 申请起始时间
String fromDate = null;
if (StringUtils.isNotBlank(from)) {
fromDate = DateUtil.formatDateTime(DateUtil.getFromDate(DateUtil.toDate(from)));
}
// 申请截止时间
String thruDate = null;
if (StringUtils.isNotBlank(thru)) {
thruDate = DateUtil.formatDateTime(DateUtil.getThruDate(DateUtil.toDate(thru)));
}
// 当前页
// int pageNumber = page/size + 1;
Pageable pageable = PageRequest.of(page - 1, size);
Page<JcBill> pages = jcBillService.queryJcBill(fromDate, thruDate, id, applicant,
goods, billin, goodsid, product, status, typ, pageable);
// 获取稽查单号集合
List<String> billIds = pages.getContent().stream()
.map(JcBill::getId)
.collect(Collectors.toList());
List<JcBillSourceItem> items = jcBillService.queryJcBillSourceItemInBillId(billIds);
Map<String, JcBillSourceItem> mapItem = items.stream()
.collect(Collectors.groupingBy(e -> {
return e.getBillid();
},
Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))
));
for(JcBill jcBill : pages.getContent()) {
JcBillSourceItem item = mapItem.get(jcBill.getId());
if(item != null) {
jcBill.setRecsource(item.getRecsource());
jcBill.setRecplatform(item.getRecplatform());
jcBill.setChannel(item.getChannel());
}
}
JSONObject obj = new JSONObject();
obj.put("list", pages.getContent());
obj.put("total", pages.getTotalElements());
return obj;
}catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 查询溯源详情
* @param billId
* @return
*/
@RequestMapping(value = "queryJcBillSourceItems", method = RequestMethod.POST)
public List<JcBillSourceItem> queryJcBillSourceItems(
@RequestParam(required = false) String billId
)
throws Throwable {
try {
List<JcBillSourceItem> items = jcBillService.queryJcBillSourceItemByBillId(billId);
if(items == null) throw new BusinessException("溯源信息不存在!");
Map<String, List<JcBillPhoto>> mapPhoto = jcBillService.queryJcBillPhoto(billId);
for(JcBillSourceItem item : items) {
// 稽查付款截图
List<JcBillPhoto> fkts = mapPhoto.get(JcBillPhoto.JC_FK + "#" + String.valueOf(item.getIndexno()));
if(fkts != null && fkts.size() >= 1) {
List<String> fkList = new ArrayList<String>();
for(JcBillPhoto fkt : fkts) {
fkList.add(fkt.getUrlphoto());
}
item.setPaymentPhoto(fkList);
}
// 货品图
List<JcBillPhoto> hpts = mapPhoto.get(JcBillPhoto.JC_HP + "#" + String.valueOf(item.getIndexno()) + "#" + item.getGoodsid());
if(hpts != null && hpts.size() >= 1) {
List<String> hpList = new ArrayList<String>();
for(JcBillPhoto hpt : hpts) {
hpList.add(hpt.getUrlphoto());
}
item.setGoodsPhotos(hpList);
item.setHpts(hpts);
}
}
return items;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 查询溯源明细
* @param billId
* @return
*/
@RequestMapping(value = "queryJcSourceItems", method = RequestMethod.POST)
public List<JcSourceItem> queryJcSourceItems(
@RequestParam(required = true) String billId,
@RequestParam(required = true) String srcItemId
)
throws Throwable {
try {
List<JcSourceItem> items = jcBillService.queryJcSourceItemByBillId(billId, srcItemId);
return items;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 确认溯源
* @param billId
* @param srcItemId
* @return
* @throws Throwable
*/
@RequestMapping(value = "querenSourceItems", method = RequestMethod.POST)
public void querenSourceItems(
@RequestParam(required = true) String billId,
@RequestParam(required = true) String srcItemId,
@RequestParam(required = true) String sourceItemId
)
throws Throwable {
try {
// JcBill jcBill = jcBillService.queryJcBillById(billId);
// if(jcBill == null) throw new BusinessException("收货记录不存在!");
JcBillSourceItem billItem = jcBillService.queryJcBillSourceItemById(Long.parseLong(srcItemId));
if(billItem == null) throw new BusinessException("溯源信息不存在!");
JcSourceItem sourceItem = jcBillService.queryJcSourceItemById(Long.parseLong(sourceItemId));
if(sourceItem == null) throw new BusinessException("溯源明细不存在!");
// 稽查收入记录
// 溯源信息更新
billItem.setStatus(JcBillSourceItem.STATUS_THREE);
billItem.setLogisticsid(sourceItem.getLogisticsid());
billItem.setBillout(sourceItem.getBillout());
billItem.setBilloutdt(sourceItem.getBilloutdt());
billItem.setBilloutwh(sourceItem.getBilloutwh());
billItem.setBilloutwhname(sourceItem.getBilloutwhname());
billItem.setProduct(sourceItem.getProduct());
billItem.setProductname(sourceItem.getProductname());
billItem.setAccount(sourceItem.getAccount());
billItem.setAccountname(sourceItem.getAccountname());
billItem.setOperator(sourceItem.getOperator());
billItem.setOperatorname(sourceItem.getOperatorname());
billItem.setGroupid(sourceItem.getGroupid());
billItem.setGroupname(sourceItem.getGroupname());
billItem.setSalearea(sourceItem.getSalearea());
billItem.setSaleareaname(sourceItem.getSaleareaname());
billItem.setSource(sourceItem.getSource());
// 确认溯源明细
sourceItem.setStatus(JcSourceItem.STATUS_ONE);
jcBillService.saveQuerenBillSourceItem(billItem, sourceItem);
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 新增溯源明细信息
* @param billId
* @param srcItemId
* @return
* @throws Throwable
*/
@RequestMapping(value = "saveSourceItems", method = RequestMethod.POST)
public JcSourceItem saveSourceItems(
@RequestParam(required = true) String billid,
@RequestParam(required = true) String srcitemid,
@RequestParam(required = true) String goodsid,
@RequestParam(required = true) String logisticsid,
@RequestParam(required = true) String billout,
@RequestParam(required = true) String billoutdt,
@RequestParam(required = true) String billoutwh,
@RequestParam(required = true) String billoutwhname,
@RequestParam(required = true) String product,
@RequestParam(required = true) String productname,
@RequestParam(required = true) String account,
@RequestParam(required = true) String accountname,
@RequestParam(required = true) String operator,
@RequestParam(required = true) String operatorname,
@RequestParam(required = true) String groupid,
@RequestParam(required = true) String groupname,
@RequestParam(required = true) String salearea,
@RequestParam(required = true) String saleareaname,
@RequestParam(required = true) String source
)
throws Throwable {
try {
JcSourceItem sourceItem = new JcSourceItem();
sourceItem.setStatus(JcSourceItem.STATUS_ZERO);
sourceItem.setBillid(billid);
sourceItem.setSrcitemid(srcitemid);
sourceItem.setGoodsid(goodsid);
sourceItem.setLogisticsid(logisticsid);
sourceItem.setBillout(billout);
sourceItem.setBilloutdt(DateUtil.toDate(billoutdt));
sourceItem.setBilloutwh(billoutwh);
sourceItem.setBilloutwhname(billoutwhname);
sourceItem.setProduct(product);
sourceItem.setProductname(productname);
sourceItem.setAccount(account);
sourceItem.setAccountname(accountname);
sourceItem.setOperator(operator);
sourceItem.setOperatorname(operatorname);
sourceItem.setGroupid(groupid);
sourceItem.setGroupname(groupname);
sourceItem.setSalearea(salearea);
sourceItem.setSaleareaname(saleareaname);
sourceItem.setSource(source);
JcSourceItem tempItem = jcBillService.saveJcSourceItem(sourceItem);
return tempItem;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 删除溯源明细信息
* @param billId
* @param srcItemId
* @return
* @throws Throwable
*/
@RequestMapping(value = "deleteSourceItem", method = RequestMethod.POST)
public void deleteSourceItem(
@RequestParam(required = true) String codes
)
throws Throwable {
try {
if (StringUtils.isEmpty(codes)) {
throw new BusinessException("溯源明细信息编码不能为空");
}
List<Long> ids = JSON.parseArray(codes, Long.class);
jcBillService.deleteJcSourceItem(ids);
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 溯源信息驳回
* @param billId
* @return
*/
@RequestMapping(value = "rejectJcSourceItems", method = RequestMethod.POST)
public void rejectJcSourceItems(
@RequestParam(required = true) String billId,
@RequestParam(required = true) String srcItemId,
@RequestParam(required = true) String reason
)
throws Throwable {
try {
JcBill jcBill = jcBillService.queryJcBillById(billId);
if(jcBill == null) throw new BusinessException("收货记录不存在!");
JcBillSourceItem billItem = jcBillService.queryJcBillSourceItemById(Long.parseLong(srcItemId));
if(billItem == null) throw new BusinessException("溯源信息不存在!");
jcBill.setStatus(JcBill.STATUS_MINUS_TWO);
billItem.setStatus(JcBillSourceItem.STATUS_MINUS_TWO);
billItem.setReason(reason);
jcBillService.saveRejectJcSourceItems(billItem, jcBill);
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 修改收货仓库
* @param billId
* @return
*/
@RequestMapping(value = "updateWarehouse", method = RequestMethod.POST)
public JcBill updateWarehouse(
@RequestParam(required = true) String billId,
@RequestParam(required = true) String warehouse,
@RequestParam(required = true) String warehouseName
)
throws Throwable {
try {
JcBill jcBill = jcBillService.queryJcBillById(billId);
if(jcBill == null) throw new BusinessException("收货记录不存在!");
// 老对象保存为JSONString
jcBill.setOldJson(JSON.toJSONString(jcBill));
jcBill.setWarehouse(warehouse);
jcBill.setWarehousename(warehouseName);
jcBillService.updateWarehouse(jcBill);
return jcBill;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 生成入库单
* @param billId
* @return
*/
@RequestMapping(value = "createStockIn", method = RequestMethod.POST)
public JcBill createStockIn(
@RequestParam(required = true) String billId
)
throws Throwable {
try {
JcBill jcBill = jcBillService.queryJcBillById(billId);
if(jcBill == null) throw new BusinessException("收货记录不存在!");
jcBill.setStatus(JcBill.STATUS_FOUR);
jcBillService.createStockIn(jcBill);
return jcBill;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 撤回
* @param billId
* @return
*/
@RequestMapping(value = "rejectBill", method = RequestMethod.POST)
public JcBill rejectBill(
@RequestParam(required = false) String billId,
@RequestParam(required = false) int status
)
throws Throwable {
try {
JcBill jcBill = jcBillService.queryJcBillById(billId);
if(jcBill == null) throw new BusinessException("收货记录不存在!");
List<JcBillInItem> inItems = jcBillService.queryJcBillInItemByBillId(billId);
List<JcBillSourceItem> sourceItems = jcBillService.queryJcBillSourceItemByBillId(billId);
if(sourceItems == null) throw new BusinessException("收货明细不存在!");
if(JcBill.STATUS_FOUR == status) {// 入库待审核 进行撤回(事件生成—进行事件删除)
SiDepositlocation sd = jcBillService.querySiDepositlocation(jcBill.getId());
if(sd == null) {// WDT
throw new BusinessException("该单据需要通知仓库在旺店通删除入库单,并联系信息部撤回。");
} else {
if(sd.getPush() == 1) {// WMS
JSONObject obj = jcBillService.gwisSubCancelOrder(jcBill.getId(), "QTRK");
if(obj.getBooleanValue("success")) {
jcBill.setStatus(JcBill.STATUS_THREE);
} else {
throw new BusinessException(obj.getString("body"));
}
} else {
throw new BusinessException("该单据需要通知仓库在旺店通删除入库单,并联系信息部撤回。");
}
}
} else {// 待入库撤回
jcBill.setStatus(JcBill.STATUS_TWO);
for(JcBillSourceItem item : sourceItems) {
item.setStatus(JcBillSourceItem.STATUS_TWO);
}
}
jcBillService.saveRejectBill(status, jcBill, inItems, sourceItems);
return jcBill;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* TODO 查询溯源明细-已确认
* @param billId
* @return
*/
@RequestMapping(value = "queryJcSourceItemsQue", method = RequestMethod.POST)
public List<JcSourceItem> queryJcSourceItemsQue(
@RequestParam(required = true) String billId,
@RequestParam(required = true) String srcItemId
)
throws Throwable {
try {
List<JcSourceItem> items = jcBillService.queryJcSourceItemByBillId(billId, srcItemId, 1);
return items;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
}
@@ -0,0 +1,316 @@
package abacus.springboot.example.dao;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.persistence.Version;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Entity
@Table(name = "jc_bill")
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = "稽查主单")
public class JcBill implements Serializable {
private static final long serialVersionUID = 7089440541784316919L;
/**唯一标识:订单号*/
@Id
@Schema(description="稽查单号", required=true, example="JC202411180001")
private String id;
@Version
@Schema(description = "版本号", required = true, example = "1")
private Integer version = 1;
@Schema(description="状态", required=true, pattern="-3:取消,-2:溯源驳回,0:待提交,1:系统溯源验证通过,2:待溯源,3:待入库,4:入库待审核,5:已入库,6:部分回购,7:回购完成", example = "1")
private int status = 1;
/** 取消*/
public final static int STATUS_MINUS_THREE = -3;
/** 溯源驳回*/
public final static int STATUS_MINUS_TWO = -2;
/** 待提交*/
public final static int STATUS_ZERO = 0;
/** 系统溯源验证通过*/
public final static int STATUS_ONE = 1;
/** 待溯源*/
public final static int STATUS_TWO = 2;
/** 待入库*/
public final static int STATUS_THREE = 3;
/** 入库待审核 */
public final static int STATUS_FOUR = 4;
/** 已入库 */
public final static int STATUS_FIVE = 5;
/** 部分回购 */
public final static int STATUS_SIX = 6;
/** 回购完成*/
public final static int STATUS_SEVEN = 7;
/** 部分出库-不保存到系统,前端使用*/
public final static int STATUS_EIGHT = 8;
/** 已出库-不保存到系统,前端使用*/
public final static int STATUS_NINE = 9;
@Schema(description="状态", required=true, pattern="0:待回购,1:部分回购,2:回购完成", example = "0")
private int hgstatus = 0;
/** 待回购*/
public final static int HGSTATUS_ZERO = 0;
/** 部分回购*/
public final static int HGSTATUS_ONE = 1;
/** 回购完成*/
public final static int HGSTATUS_TWO = 2;
@Schema(description = "收货产品", required = true, example = "")
private String goods;
@Schema(description = "收货仓库编码", required = true, example = "")
private String warehouse;
@Schema(description = "收货仓库名称", required = true, example = "")
private String warehousename;
@Schema(description = "收货日期", required = true, example = "2024-11-11")
private String receivedt;
@Schema(description = "收货数量", required = true, example = "")
private double quantity;
@Schema(description = "收货总金额", required = true, example = "")
private double subtotal;
@Schema(description = "入库单号", required = true, example = "")
private String billin;
@Temporal(TemporalType.TIMESTAMP)
@Schema(description = "入库单时间", required = true, example = "")
private Date billindt;
@Schema(description = "申请人编码", required = true, example = "")
private String applicant;
@Schema(description = "申请人名称", required = true, example = "")
private String applicantname;
@Temporal(TemporalType.TIMESTAMP)
@Schema(description = "申请人时间", required = true, example = "")
private Date applicantdt;
@Schema(description = "部门编码", required = true, example = "")
private String dept;
@Temporal(TemporalType.TIMESTAMP)
@Schema(description = "时间戳", required = true, example = "")
private Date dt = new Date();
@Transient
@Schema(description = "收货来源", hidden = true,required = true, example = "")
private String recsource;
@Transient
@Schema(description = "收货平台", hidden = true,required = true, example = "")
private String recplatform;
@Transient
@Schema(description = "收货渠道", hidden = true,required = true, example = "")
private String channel;
@Transient
@JsonBackReference
@Schema(description = "历史对象JSONString", required = false, hidden = true, pattern = "", example = "")
private String oldJson;
public String getRecsource() {
return recsource;
}
public void setRecsource(String recsource) {
this.recsource = recsource;
}
public String getRecplatform() {
return recplatform;
}
public void setRecplatform(String recplatform) {
this.recplatform = recplatform;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public int getHgstatus() {
return hgstatus;
}
public void setHgstatus(int hgstatus) {
this.hgstatus = hgstatus;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public String getOldJson() {
return oldJson;
}
public void setOldJson(String oldJson) {
this.oldJson = oldJson;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getGoods() {
return goods;
}
public void setGoods(String goods) {
this.goods = goods;
}
public String getWarehouse() {
return warehouse;
}
public void setWarehouse(String warehouse) {
this.warehouse = warehouse;
}
public String getWarehousename() {
return warehousename;
}
public void setWarehousename(String warehousename) {
this.warehousename = warehousename;
}
public String getReceivedt() {
return receivedt;
}
public void setReceivedt(String receivedt) {
this.receivedt = receivedt;
}
public double getQuantity() {
return quantity;
}
public void setQuantity(double quantity) {
this.quantity = quantity;
}
public double getSubtotal() {
return subtotal;
}
public void setSubtotal(double subtotal) {
this.subtotal = subtotal;
}
public String getBillin() {
return billin;
}
public void setBillin(String billin) {
this.billin = billin;
}
public Date getBillindt() {
return billindt;
}
public void setBillindt(Date billindt) {
this.billindt = billindt;
}
public String getApplicant() {
return applicant;
}
public void setApplicant(String applicant) {
this.applicant = applicant;
}
public String getApplicantname() {
return applicantname;
}
public void setApplicantname(String applicantname) {
this.applicantname = applicantname;
}
public Date getApplicantdt() {
return applicantdt;
}
public void setApplicantdt(Date applicantdt) {
this.applicantdt = applicantdt;
}
public Date getDt() {
return dt;
}
public void setDt(Date dt) {
this.dt = dt;
}
}
@@ -0,0 +1,671 @@
package abacus.springboot.example.dao;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Version;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Entity
@Table(name = "jc_billhg")
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = "回购单主单")
public class JcBillHg implements Serializable {
private static final long serialVersionUID = -4735685141695682399L;
/**唯一标识:订单号*/
@Id
@Schema(description="回购单单号", required=true, example="HG202411180001")
private String id;
@Version
@Schema(description = "版本号", required = true, example = "1")
private Integer version = 1;
@Schema(description = "稽查单号", required = true, example = "")
private String billid;
@Schema(description = "状态", required = true, pattern="-1:作废,1:待提交,2:待付款,3:已付款,4:(确认收款转待分仓)待分仓,5:已分仓-待出库,6:已出库", example = "")
private int status = 1;
/** 作废*/
public final static int STATUS_MINUS_ONE = -1;
/** 待提交 */
public final static int STATUS_ONE = 1;
/** 待付款 */
public final static int STATUS_TWO = 2;
/** 已付款 */
public final static int STATUS_THREE = 3;
/** (确认收款转待分仓)待分仓 */
public final static int STATUS_FOUR = 4;
/** 已分仓-待出库 */
public final static int STATUS_FIVE = 5;
/** 已出库 */
public final static int STATUS_SIX = 6;
// /** 回购完成*/
// public final static int STATUS_SEVEN = 7;
// @Schema(description = "分仓状态", required = false, example = "")
// private int fcstatus = 1;
// public final static int FCSTATUS_ONE = 1;// 待分仓
// public final static int FCSTATUS_TWO = 2;// 已分仓-待出库
// public final static int FCSTATUS_THREE = 3;// 已出库
@Schema(description = "订单来源:掌上华致", required = true, example = "")
private String source;
@Schema(description = "客户编码", required = true, example = "")
private String account;
@Schema(description = "客户名称", required = true, example = "")
private String accountname;
@Schema(description = "商品总数量", required = true, example = "")
private double quantity;
@Schema(description = "商品总金额", required = true, example = "")
private double subtotal;
@Schema(description = "运费", required = true, example = "")
private double freight;
@Schema(description = "运营经理编码", required = true, example = "")
private String manager;
@Schema(description = "运营经理名称", required = true, example = "")
private String managername;
@Schema(description = "收货人姓名", required = true, example = "")
private String consignee;
@Schema(description = "收货人电话", required = true, example = "")
private String consigneephone;
@Schema(description = "", required = true, example = "")
private String province;
@Schema(description = "", required = true, example = "")
private String provincename;
@Schema(description = "", required = true, example = "")
private String city;
@Schema(description = "", required = true, example = "")
private String cityname;
@Schema(description = "", required = true, example = "")
private String area;
@Schema(description = "", required = true, example = "")
private String areaname;
@Schema(description = "详细地址", required = true, example = "")
private String address;
@Schema(description = "收货方式", pattern = "0:送货上门1:仓库自提2:货站自提3:空运自提", required = true, example = "")
private String receiveway;
/** 送货上门 */
public final static String RECEIVEWAY_ZERO = "0";
/** 仓库自提 */
public final static String RECEIVEWAY_ONE = "1";
/** 货站自提 */
public final static String RECEIVEWAY_TWO = "2";
/** 空运自提 */
public final static String RECEIVEWAY_THREE = "3";
@Schema(description = "订单备注", required = true, example = "")
private String remark;
@Schema(description = "运营备注", required = true, example = "")
private String remark1;
@Schema(description = "分销区域编码", required = true, example = "")
private String salearea;
@Schema(description = "分销区域名称", required = true, example = "")
private String saleareaname;
@Schema(description = "业务组编码", required = true, example = "")
private String groupid;
@Schema(description = "业务组名称", required = true, example = "")
private String groupname;
@Schema(description = "创建人", required = true, example = "")
private String found;
@Schema(description = "创建人编码", required = true, example = "")
private String foundname;
@Schema(description = "创建时间", required = true, example = "")
private Date founddt;
@Schema(description = "提交人编码", required = true, example = "")
private String submit;
@Schema(description = "提交人名称", required = true, example = "")
private String submitname;
@Schema(description = "提交人时间", required = true, example = "")
private Date submitdt;
@Schema(description = "审核人编码", required = true, example = "")
private String audit;
@Schema(description = "审核人名称", required = true, example = "")
private String auditname;
@Schema(description = "审核人时间", required = true, example = "")
private Date auditdt;
@Schema(description = "分货仓库编码", required = true, example = "")
private String fhwarehouse;
@Schema(description = "分货仓库名称", required = true, example = "")
private String fhwarehousename;
@Schema(description = "物流公司名称", required = true, example = "")
private String logisticsname;
@Schema(description = "物流公司代码", required = true, example = "")
private String logisticscode;
@Schema(description = "物流方式", required = true, example = "")
private String logisticstype;
@Schema(description = "物流单号", required = true, example = "")
private String logisticsno;
@Schema(description = "旺店通单号", required = true, example = "")
private String wdtorder;
@Schema(description = "旺店通出库单号", required = true, example = "")
private String wdtbillout;
@Schema(description = "旺店通出库状态", required = true, example = "")
private String wdtbillouttyp;
@Schema(description = "旺店通出库时间", required = true, example = "")
private Date wdtoutdt;
@Schema(description = "旺店通入库时间", required = true, example = "")
private Date wdtindt;
@Schema(description = "传输旺店通时间", required = true, example = "")
private Date wdtdt;
@Schema(description = "回款客户名称", required = true, example = "")
private String proofaccountname;
@Schema(description = "凭证上传时间", required = true, example = "")
private Date proofdt;
@Schema(description = "时间戳", required = true, example = "")
private Date dt = new Date();
// 合计金额=商品总金额+运费
@Transient
private double amount;
// 稽查单状态
@Transient
private int jcstatus;
// public int getFcstatus() {
// return fcstatus;
// }
//
// public void setFcstatus(int fcstatus) {
// this.fcstatus = fcstatus;
// }
public double getAmount() {
return amount;
}
public int getJcstatus() {
return jcstatus;
}
public void setJcstatus(int jcstatus) {
this.jcstatus = jcstatus;
}
public Date getWdtoutdt() {
return wdtoutdt;
}
public void setWdtoutdt(Date wdtoutdt) {
this.wdtoutdt = wdtoutdt;
}
public Date getWdtindt() {
return wdtindt;
}
public void setWdtindt(Date wdtindt) {
this.wdtindt = wdtindt;
}
public String getProofaccountname() {
return proofaccountname;
}
public void setProofaccountname(String proofaccountname) {
this.proofaccountname = proofaccountname;
}
public Date getProofdt() {
return proofdt;
}
public void setProofdt(Date proofdt) {
this.proofdt = proofdt;
}
public String getWdtorder() {
return wdtorder;
}
public void setWdtorder(String wdtorder) {
this.wdtorder = wdtorder;
}
public String getWdtbillout() {
return wdtbillout;
}
public void setWdtbillout(String wdtbillout) {
this.wdtbillout = wdtbillout;
}
public String getWdtbillouttyp() {
return wdtbillouttyp;
}
public void setWdtbillouttyp(String wdtbillouttyp) {
this.wdtbillouttyp = wdtbillouttyp;
}
public Date getWdtdt() {
return wdtdt;
}
public void setWdtdt(Date wdtdt) {
this.wdtdt = wdtdt;
}
public void setAmount(double amount) {
this.amount = amount;
}
public String getFhwarehouse() {
return fhwarehouse;
}
public void setFhwarehouse(String fhwarehouse) {
this.fhwarehouse = fhwarehouse;
}
public String getFhwarehousename() {
return fhwarehousename;
}
public void setFhwarehousename(String fhwarehousename) {
this.fhwarehousename = fhwarehousename;
}
public String getLogisticsname() {
return logisticsname;
}
public void setLogisticsname(String logisticsname) {
this.logisticsname = logisticsname;
}
public String getLogisticscode() {
return logisticscode;
}
public void setLogisticscode(String logisticscode) {
this.logisticscode = logisticscode;
}
public String getLogisticstype() {
return logisticstype;
}
public void setLogisticstype(String logisticstype) {
this.logisticstype = logisticstype;
}
public String getLogisticsno() {
return logisticsno;
}
public void setLogisticsno(String logisticsno) {
this.logisticsno = logisticsno;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public String getBillid() {
return billid;
}
public void setBillid(String billid) {
this.billid = billid;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getAccountname() {
return accountname;
}
public void setAccountname(String accountname) {
this.accountname = accountname;
}
public double getQuantity() {
return quantity;
}
public void setQuantity(double quantity) {
this.quantity = quantity;
}
public double getSubtotal() {
return subtotal;
}
public void setSubtotal(double subtotal) {
this.subtotal = subtotal;
}
public double getFreight() {
return freight;
}
public void setFreight(double freight) {
this.freight = freight;
}
public String getManager() {
return manager;
}
public void setManager(String manager) {
this.manager = manager;
}
public String getManagername() {
return managername;
}
public void setManagername(String managername) {
this.managername = managername;
}
public String getConsignee() {
return consignee;
}
public void setConsignee(String consignee) {
this.consignee = consignee;
}
public String getConsigneephone() {
return consigneephone;
}
public void setConsigneephone(String consigneephone) {
this.consigneephone = consigneephone;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getProvincename() {
return provincename;
}
public void setProvincename(String provincename) {
this.provincename = provincename;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCityname() {
return cityname;
}
public void setCityname(String cityname) {
this.cityname = cityname;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getAreaname() {
return areaname;
}
public void setAreaname(String areaname) {
this.areaname = areaname;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getReceiveway() {
return receiveway;
}
public void setReceiveway(String receiveway) {
this.receiveway = receiveway;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getRemark1() {
return remark1;
}
public void setRemark1(String remark1) {
this.remark1 = remark1;
}
public String getSalearea() {
return salearea;
}
public void setSalearea(String salearea) {
this.salearea = salearea;
}
public String getSaleareaname() {
return saleareaname;
}
public void setSaleareaname(String saleareaname) {
this.saleareaname = saleareaname;
}
public String getGroupid() {
return groupid;
}
public void setGroupid(String groupid) {
this.groupid = groupid;
}
public String getGroupname() {
return groupname;
}
public void setGroupname(String groupname) {
this.groupname = groupname;
}
public String getFound() {
return found;
}
public void setFound(String found) {
this.found = found;
}
public String getFoundname() {
return foundname;
}
public void setFoundname(String foundname) {
this.foundname = foundname;
}
public Date getFounddt() {
return founddt;
}
public void setFounddt(Date founddt) {
this.founddt = founddt;
}
public String getSubmit() {
return submit;
}
public void setSubmit(String submit) {
this.submit = submit;
}
public String getSubmitname() {
return submitname;
}
public void setSubmitname(String submitname) {
this.submitname = submitname;
}
public Date getSubmitdt() {
return submitdt;
}
public void setSubmitdt(Date submitdt) {
this.submitdt = submitdt;
}
public String getAudit() {
return audit;
}
public void setAudit(String audit) {
this.audit = audit;
}
public String getAuditname() {
return auditname;
}
public void setAuditname(String auditname) {
this.auditname = auditname;
}
public Date getAuditdt() {
return auditdt;
}
public void setAuditdt(Date auditdt) {
this.auditdt = auditdt;
}
public Date getDt() {
return dt;
}
public void setDt(Date dt) {
this.dt = dt;
}
}
@@ -0,0 +1,150 @@
package abacus.springboot.example.dao;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Entity
@Table(name = "jc_billhg_pay")
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = "回购支付明细")
public class JcBillHgPay implements Serializable {
private static final long serialVersionUID = 7782628530648454397L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Schema(description = "自增长编码", required = true, example = "10")
private Long id;
@Version
@Schema(description = "版本号", required = true, example = "1")
private Integer version;
@Schema(description = "稽查单号", required = true, example = "")
private String billid;
@Schema(description = "回购单号", required = true, example = "")
private String billhg;
@Schema(description = "支付方式", required = true, example = "")
private String payment;
@Schema(description = "支付金额", required = true, example = "")
private double amount;
@Schema(description = "账号名称", required = true, example = "")
private String zhmc;
@Schema(description = "开发银行", required = true, example = "")
private String khyh;
@Schema(description = "银行账号", required = true, example = "")
private String yhzh;
@Schema(description = "时间戳", required = true, example = "")
private Date dt = new Date();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public String getBillid() {
return billid;
}
public void setBillid(String billid) {
this.billid = billid;
}
public String getBillhg() {
return billhg;
}
public void setBillhg(String billhg) {
this.billhg = billhg;
}
public String getPayment() {
return payment;
}
public void setPayment(String payment) {
this.payment = payment;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public String getZhmc() {
return zhmc;
}
public void setZhmc(String zhmc) {
this.zhmc = zhmc;
}
public String getKhyh() {
return khyh;
}
public void setKhyh(String khyh) {
this.khyh = khyh;
}
public String getYhzh() {
return yhzh;
}
public void setYhzh(String yhzh) {
this.yhzh = yhzh;
}
public Date getDt() {
return dt;
}
public void setDt(Date dt) {
this.dt = dt;
}
}
@@ -0,0 +1,486 @@
package abacus.springboot.example.dao;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Version;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Entity
@Table(name = "jc_billin_item")
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = "稽查入库(回购通知)明细")
public class JcBillInItem implements Serializable {
private static final long serialVersionUID = -3841490251161254597L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Schema(description = "自增长编码", required = true, example = "10")
private Long id;
@Version
@Schema(description = "版本号", required = true, example = "1")
private Integer version;
@Schema(description = "稽查单号", required = true, example = "")
private String billid;
@Schema(description = "入库单号", required = true, example = "")
private String billin;
@Schema(description = "回购单号", required = true, example = "")
private String billhg;
@Schema(description = "状态", required = true, pattern="-1:终止,1:待通知回购,2:已通知回购", example = "")
private int status = 1;
/** 终止*/
public final static int STATUS_MINUS_ONE = -1;
/** 待通知回购*/
public final static int STATUS_ONE = 1;
/** 已通知回购*/
public final static int STATUS_TWO = 2;
@Schema(description = "收货渠道-收货门店", required = true, example = "")
private String channel;
@Schema(description = "客户编码", required = true, example = "")
private String account;
@Schema(description = "客户名称", required = true, example = "")
private String accountname;
@Schema(description = "商品编码", required = true, example = "")
private String product;
@Schema(description = "商品名称", required = true, example = "")
private String productname;
@Schema(description = "收货单价", required = true, example = "")
private double price;
@Schema(description = "入库数量", required = true, example = "")
private double quantity;
@Schema(description = "入库件数", required = true, example = "")
private double numbers;
@Schema(description = "回购单价", required = true, example = "")
private Double hgprice;
@Schema(description = "回购金额", required = true, example = "")
private Double hgamount;
@Schema(description = "业务员编码", required = true, example = "")
private String operator;
@Schema(description = "业务员名称", required = true, example = "")
private String operatorname;
@Schema(description = "业务组编码", required = true, example = "")
private String groupid;
@Schema(description = "业务组名称", required = true, example = "")
private String groupname;
@Schema(description = "分销区域编码", required = true, example = "")
private String salearea;
@Schema(description = "分销区域名称", required = true, example = "")
private String saleareaname;
@Schema(description = "分货数量", required = true, example = "")
private double fhquantity;
@Schema(description = "分货件数", required = true, example = "")
private double fhnumbers;
@Schema(description = "分货仓库编码", required = true, hidden = true, example = "")
private String fhwarehouse;
@Schema(description = "分货仓库名称", required = true, hidden = true, example = "")
private String fhwarehousename;
@Schema(description = "旺店通单号", required = true, hidden = true, example = "")
private String wdtorder;
@Schema(description = "旺店通出库单号", required = true, hidden = true, example = "")
private String wdtbillout;
@Schema(description = "旺店通出库状态", required = true, hidden = true, example = "")
private String wdtbillouttyp;
@Schema(description = "旺店通出库时间", required = true, hidden = true, example = "")
private Date wdtoutdt;
@Schema(description = "旺店通入库时间", required = true, hidden = true, example = "")
private Date wdtindt;
@Schema(description = "传输旺店通时间", required = true, hidden = true, example = "")
private Date wdtdt;
@Schema(description = "时间戳", required = true, example = "")
private Date dt = new Date();
@Transient
@Schema(description = "规格", hidden = true, required = false, example = "")
private String spec;
@Transient
@Schema(description = "计量单位", hidden = true, required = false, example = "")
private String measure;
@Transient
@Schema(description = "采购包装单位", hidden = true, required = false, example = "false")
private String purunit;
@Transient
@Schema(description = "采购包装量", hidden = true, required = true, example = "1")
private double purpkg = 1.0;
@Transient
@Schema(description = "历史价格", hidden = true, required = true, example = "1")
private Double oldhgprice;
@Transient
@Schema(description = "物流公司名称", hidden = true, required = true, example = "")
private String logisticsname;
@Transient
@Schema(description = "物流单号", hidden = true, required = true, example = "")
private String logisticsno;
public String getLogisticsname() {
return logisticsname;
}
public void setLogisticsname(String logisticsname) {
this.logisticsname = logisticsname;
}
public String getLogisticsno() {
return logisticsno;
}
public void setLogisticsno(String logisticsno) {
this.logisticsno = logisticsno;
}
public Date getWdtoutdt() {
return wdtoutdt;
}
public void setWdtoutdt(Date wdtoutdt) {
this.wdtoutdt = wdtoutdt;
}
public Date getWdtindt() {
return wdtindt;
}
public void setWdtindt(Date wdtindt) {
this.wdtindt = wdtindt;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public Double getOldhgprice() {
return oldhgprice;
}
public void setOldhgprice(Double oldhgprice) {
this.oldhgprice = oldhgprice;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
public String getMeasure() {
return measure;
}
public void setMeasure(String measure) {
this.measure = measure;
}
public String getPurunit() {
return purunit;
}
public void setPurunit(String purunit) {
this.purunit = purunit;
}
public double getPurpkg() {
return purpkg;
}
public void setPurpkg(double purpkg) {
this.purpkg = purpkg;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public String getBillid() {
return billid;
}
public void setBillid(String billid) {
this.billid = billid;
}
public String getBillin() {
return billin;
}
public void setBillin(String billin) {
this.billin = billin;
}
public String getBillhg() {
return billhg;
}
public void setBillhg(String billhg) {
this.billhg = billhg;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getAccountname() {
return accountname;
}
public void setAccountname(String accountname) {
this.accountname = accountname;
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public String getProductname() {
return productname;
}
public void setProductname(String productname) {
this.productname = productname;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getQuantity() {
return quantity;
}
public void setQuantity(double quantity) {
this.quantity = quantity;
}
public double getNumbers() {
return numbers;
}
public void setNumbers(double numbers) {
this.numbers = numbers;
}
public Double getHgprice() {
return hgprice;
}
public void setHgprice(Double hgprice) {
this.hgprice = hgprice;
}
public Double getHgamount() {
return hgamount;
}
public void setHgamount(Double hgamount) {
this.hgamount = hgamount;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public String getOperatorname() {
return operatorname;
}
public void setOperatorname(String operatorname) {
this.operatorname = operatorname;
}
public String getGroupid() {
return groupid;
}
public void setGroupid(String groupid) {
this.groupid = groupid;
}
public String getGroupname() {
return groupname;
}
public void setGroupname(String groupname) {
this.groupname = groupname;
}
public String getSalearea() {
return salearea;
}
public void setSalearea(String salearea) {
this.salearea = salearea;
}
public String getSaleareaname() {
return saleareaname;
}
public void setSaleareaname(String saleareaname) {
this.saleareaname = saleareaname;
}
public double getFhquantity() {
return fhquantity;
}
public void setFhquantity(double fhquantity) {
this.fhquantity = fhquantity;
}
public double getFhnumbers() {
return fhnumbers;
}
public void setFhnumbers(double fhnumbers) {
this.fhnumbers = fhnumbers;
}
public String getFhwarehouse() {
return fhwarehouse;
}
public void setFhwarehouse(String fhwarehouse) {
this.fhwarehouse = fhwarehouse;
}
public String getFhwarehousename() {
return fhwarehousename;
}
public void setFhwarehousename(String fhwarehousename) {
this.fhwarehousename = fhwarehousename;
}
public String getWdtorder() {
return wdtorder;
}
public void setWdtorder(String wdtorder) {
this.wdtorder = wdtorder;
}
public String getWdtbillout() {
return wdtbillout;
}
public void setWdtbillout(String wdtbillout) {
this.wdtbillout = wdtbillout;
}
public String getWdtbillouttyp() {
return wdtbillouttyp;
}
public void setWdtbillouttyp(String wdtbillouttyp) {
this.wdtbillouttyp = wdtbillouttyp;
}
public Date getWdtdt() {
return wdtdt;
}
public void setWdtdt(Date wdtdt) {
this.wdtdt = wdtdt;
}
public Date getDt() {
return dt;
}
public void setDt(Date dt) {
this.dt = dt;
}
}
@@ -0,0 +1,120 @@
package abacus.springboot.example.dao;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Entity
@Table(name = "jc_bill_photo")
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = "稽查图片")
public class JcBillPhoto implements Serializable {
private static final long serialVersionUID = -5561468051239492839L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Schema(description = "自增长编码", required = true, example = "10")
private Long id;
@Version
@Schema(description = "版本号", required = true, example = "1")
private Integer version;
@Schema(description = "来源单号", required = true, example = "1")
private String srcid;
@Schema(description = "来源明细", required = true, example = "1")
private String srcitemid;
@Schema(description = "图片类型", required = true, pattern="稽查付款截图,稽查货品图,回购通知函,回购违规通知函,回购支付凭证", example = "1")
private String typephoto;
public final static String JC_FK = "稽查付款截图";
public final static String JC_HP = "稽查货品图";
public final static String HG_TZH = "回购通知函";
public final static String HG_WGTZH = "回购违规通知函";
public final static String HG_ZFPZ = "回购支付凭证";
@Schema(description = "url地址", required = true, example = "1")
private String urlphoto;
@Schema(description = "时间戳", required = true, example = "1")
private Date dt = new Date();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public String getSrcid() {
return srcid;
}
public void setSrcid(String srcid) {
this.srcid = srcid;
}
public String getSrcitemid() {
return srcitemid;
}
public void setSrcitemid(String srcitemid) {
this.srcitemid = srcitemid;
}
public String getTypephoto() {
return typephoto;
}
public void setTypephoto(String typephoto) {
this.typephoto = typephoto;
}
public String getUrlphoto() {
return urlphoto;
}
public void setUrlphoto(String urlphoto) {
this.urlphoto = urlphoto;
}
public Date getDt() {
return dt;
}
public void setDt(Date dt) {
this.dt = dt;
}
}
@@ -0,0 +1,434 @@
package abacus.springboot.example.dao;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.persistence.Version;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Entity
@Table(name = "jc_billsource_item")
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = "稽查收货明细")
public class JcBillSourceItem implements Serializable {
private static final long serialVersionUID = 8819914697371518608L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Schema(description = "自增长编码", required = true, example = "10")
private Long id;
@Version
@Schema(description = "版本号", required = true, example = "1")
private Integer version = 1;
@Schema(description = "行号", required = false, example = "2")
private int indexno;
@Schema(description = "稽查单号", required = true, example = "")
private String billid;
@Schema(description = "状态", required = true, pattern="-2:人工朔源驳回,-1:系统朔源验证未通过,0:系统溯源未验证,1:系统朔源验证通过,2:人工朔源待确认,3:人工朔源已确认", example = "")
private int status = 0;
/** 人工朔源驳回*/
public final static int STATUS_MINUS_TWO = -2;
/** 系统朔源验证未通过*/
public final static int STATUS_MINUS_ONE = -1;
/** 系统溯源未验证*/
public final static int STATUS_ZERO = 0;
/** 系统朔源验证通过*/
public final static int STATUS_ONE = 1;
/** 人工朔源待确认*/
public final static int STATUS_TWO = 2;
/** 人工朔源已确认*/
public final static int STATUS_THREE = 3;
@Schema(description = "收货来源", required = true, example = "")
private String recsource;
@Schema(description = "收货平台", required = true, example = "")
private String recplatform;
@Schema(description = "收货渠道", required = true, example = "")
private String channel;
@Schema(description = "收货单价", required = true, example = "")
private double price;
@Schema(description = "收货数量", required = true, example = "")
private double quantity;
@Schema(description = "收货件数", required = true, example = "")
private double numbers;
@Schema(description = "收货金额", required = true, example = "")
private double subtotal;
@Schema(description = "货品编号", required = true, example = "")
private String goodsid;
@Schema(description = "物流码", required = true, example = "")
private String logisticsid;
@Schema(description = "出库单号", required = true, example = "")
private String billout;
@Temporal(TemporalType.TIMESTAMP)
@Schema(description = "出库日期", required = true, example = "")
private Date billoutdt;
@Schema(description = "出库仓库编码", required = true, example = "")
private String billoutwh;
@Schema(description = "出库仓库名称", required = true, example = "")
private String billoutwhname;
@Schema(description = "商品编码", required = true, example = "")
private String product;
@Schema(description = "商品名称", required = true, example = "")
private String productname;
@Schema(description = "客户编码", required = true, example = "")
private String account;
@Schema(description = "客户名称", required = true, example = "")
private String accountname;
@Schema(description = "考核业务员编码", required = true, example = "")
private String operator;
@Schema(description = "考核业务员名称", required = true, example = "")
private String operatorname;
@Schema(description = "业务组编码", required = true, example = "")
private String groupid;
@Schema(description = "业务组名称", required = true, example = "")
private String groupname;
@Schema(description = "分销区域编码", required = true, example = "")
private String salearea;
@Schema(description = "分销区域名称", required = true, example = "")
private String saleareaname;
@Schema(description = "比对来源", required = true, example = "")
private String source;
public static final String SOURCE_ERP = "业务中台";
public static final String SOURCE_EWM = "二维码";
public static final String SOURCE_XX = "线下";
@Schema(description = "驳回原因", required = true, example = "")
private String reason;
@Temporal(TemporalType.TIMESTAMP)
@Schema(description = "时间戳", required = true, example = "")
private Date dt = new Date();
@Transient
@Schema(description = "付款图片", required = false, hidden = true, pattern = "这是个JSON数组,不是JSONArray对象", example = "[\"44444\",\"aaaaa\"]")
private List<String> paymentPhoto;
@Transient
@Schema(description = "货品图片", required = false, hidden = true, pattern = "这是个JSON数组,不是JSONArray对象", example = "[\"44444\",\"aaaaa\"]")
private List<String> goodsPhotos;
@Transient
@Schema(description = "货品图片", required = false, hidden = true, pattern = "这是个JSON数组,不是JSONArray对象", example = "[\"44444\",\"aaaaa\"]")
private List<JcBillPhoto> hpts;
public List<JcBillPhoto> getHpts() {
return hpts;
}
public void setHpts(List<JcBillPhoto> hpts) {
this.hpts = hpts;
}
public List<String> getPaymentPhoto() {
return paymentPhoto;
}
public void setPaymentPhoto(List<String> paymentPhoto) {
this.paymentPhoto = paymentPhoto;
}
public List<String> getGoodsPhotos() {
return goodsPhotos;
}
public void setGoodsPhotos(List<String> goodsPhotos) {
this.goodsPhotos = goodsPhotos;
}
public int getIndexno() {
return indexno;
}
public void setIndexno(int indexno) {
this.indexno = indexno;
}
public String getRecplatform() {
return recplatform;
}
public void setRecplatform(String recplatform) {
this.recplatform = recplatform;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public String getBillid() {
return billid;
}
public void setBillid(String billid) {
this.billid = billid;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getRecsource() {
return recsource;
}
public void setRecsource(String recsource) {
this.recsource = recsource;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getQuantity() {
return quantity;
}
public void setQuantity(double quantity) {
this.quantity = quantity;
}
public double getNumbers() {
return numbers;
}
public void setNumbers(double numbers) {
this.numbers = numbers;
}
public double getSubtotal() {
return subtotal;
}
public void setSubtotal(double subtotal) {
this.subtotal = subtotal;
}
public String getGoodsid() {
return goodsid;
}
public void setGoodsid(String goodsid) {
this.goodsid = goodsid;
}
public String getLogisticsid() {
return logisticsid;
}
public void setLogisticsid(String logisticsid) {
this.logisticsid = logisticsid;
}
public String getBillout() {
return billout;
}
public void setBillout(String billout) {
this.billout = billout;
}
public Date getBilloutdt() {
return billoutdt;
}
public void setBilloutdt(Date billoutdt) {
this.billoutdt = billoutdt;
}
public String getBilloutwh() {
return billoutwh;
}
public void setBilloutwh(String billoutwh) {
this.billoutwh = billoutwh;
}
public String getBilloutwhname() {
return billoutwhname;
}
public void setBilloutwhname(String billoutwhname) {
this.billoutwhname = billoutwhname;
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public String getProductname() {
return productname;
}
public void setProductname(String productname) {
this.productname = productname;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getAccountname() {
return accountname;
}
public void setAccountname(String accountname) {
this.accountname = accountname;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public String getOperatorname() {
return operatorname;
}
public void setOperatorname(String operatorname) {
this.operatorname = operatorname;
}
public String getGroupid() {
return groupid;
}
public void setGroupid(String groupid) {
this.groupid = groupid;
}
public String getGroupname() {
return groupname;
}
public void setGroupname(String groupname) {
this.groupname = groupname;
}
public String getSalearea() {
return salearea;
}
public void setSalearea(String salearea) {
this.salearea = salearea;
}
public String getSaleareaname() {
return saleareaname;
}
public void setSaleareaname(String saleareaname) {
this.saleareaname = saleareaname;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public Date getDt() {
return dt;
}
public void setDt(Date dt) {
this.dt = dt;
}
}
@@ -0,0 +1,298 @@
package abacus.springboot.example.dao;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.persistence.Version;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Entity
@Table(name = "jc_source_item")
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = "稽查溯源明细")
public class JcSourceItem implements Serializable {
private static final long serialVersionUID = -2272967075701112300L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Schema(description = "自增长编码", required = true, example = "10")
private Long id;
@Version
@Schema(description = "版本号", required = true, example = "1")
private Integer version = 1;
@Schema(description = "稽查单号", required = true, example = "")
private String billid;
@Schema(description = "明细Id", required = true, example = "")
private String srcitemid;
@Schema(description = "状态", required = true, pattern="0:待确认,1:已确认", example = "")
private int status = 0;
/** 待确认*/
public final static int STATUS_ZERO = 0;
/** 已确认*/
public final static int STATUS_ONE = 1;
@Schema(description = "货品编号", required = true, example = "")
private String goodsid;
@Schema(description = "物流码", required = true, example = "")
private String logisticsid;
@Schema(description = "出库单号", required = true, example = "")
private String billout;
@Temporal(TemporalType.TIMESTAMP)
@Schema(description = "出库日期", required = true, example = "")
private Date billoutdt;
@Schema(description = "出库仓库编码", required = true, example = "")
private String billoutwh;
@Schema(description = "出库仓库名称", required = true, example = "")
private String billoutwhname;
@Schema(description = "商品编码", required = true, example = "")
private String product;
@Schema(description = "商品名称", required = true, example = "")
private String productname;
@Schema(description = "客户编码", required = true, example = "")
private String account;
@Schema(description = "客户名称", required = true, example = "")
private String accountname;
@Schema(description = "考核业务员编码", required = true, example = "")
private String operator;
@Schema(description = "考核业务员名称", required = true, example = "")
private String operatorname;
@Schema(description = "业务组编码", required = true, example = "")
private String groupid;
@Schema(description = "业务组名称", required = true, example = "")
private String groupname;
@Schema(description = "分销区域编码", required = true, example = "")
private String salearea;
@Schema(description = "分销区域名称", required = true, example = "")
private String saleareaname;
@Schema(description = "比对来源", required = true, pattern="业务中台,二维码,线下", example = "")
private String source;
@Temporal(TemporalType.TIMESTAMP)
@Schema(description = "时间戳", required = true, example = "")
private Date dt = new Date();
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public String getBillid() {
return billid;
}
public void setBillid(String billid) {
this.billid = billid;
}
public String getSrcitemid() {
return srcitemid;
}
public void setSrcitemid(String srcitemid) {
this.srcitemid = srcitemid;
}
public String getGoodsid() {
return goodsid;
}
public void setGoodsid(String goodsid) {
this.goodsid = goodsid;
}
public String getLogisticsid() {
return logisticsid;
}
public void setLogisticsid(String logisticsid) {
this.logisticsid = logisticsid;
}
public String getBillout() {
return billout;
}
public void setBillout(String billout) {
this.billout = billout;
}
public Date getBilloutdt() {
return billoutdt;
}
public void setBilloutdt(Date billoutdt) {
this.billoutdt = billoutdt;
}
public String getBilloutwh() {
return billoutwh;
}
public void setBilloutwh(String billoutwh) {
this.billoutwh = billoutwh;
}
public String getBilloutwhname() {
return billoutwhname;
}
public void setBilloutwhname(String billoutwhname) {
this.billoutwhname = billoutwhname;
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public String getProductname() {
return productname;
}
public void setProductname(String productname) {
this.productname = productname;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getAccountname() {
return accountname;
}
public void setAccountname(String accountname) {
this.accountname = accountname;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public String getOperatorname() {
return operatorname;
}
public void setOperatorname(String operatorname) {
this.operatorname = operatorname;
}
public String getGroupid() {
return groupid;
}
public void setGroupid(String groupid) {
this.groupid = groupid;
}
public String getGroupname() {
return groupname;
}
public void setGroupname(String groupname) {
this.groupname = groupname;
}
public String getSalearea() {
return salearea;
}
public void setSalearea(String salearea) {
this.salearea = salearea;
}
public String getSaleareaname() {
return saleareaname;
}
public void setSaleareaname(String saleareaname) {
this.saleareaname = saleareaname;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public Date getDt() {
return dt;
}
public void setDt(Date dt) {
this.dt = dt;
}
}
@@ -0,0 +1,835 @@
package abacus.springboot.example.esb;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import abacus.springboot.example.api.view.ApiBillHg;
import abacus.springboot.example.api.view.ApiBillHgItem;
import abacus.springboot.example.api.view.ApiBillHgPayment;
import abacus.springboot.example.api.view.ApiJcBill;
import abacus.springboot.example.api.view.ApiJcBillHgSearchItem;
import abacus.springboot.example.api.view.ApiJcBillItem;
import abacus.springboot.example.api.view.ApiJcBillSearch;
import abacus.springboot.example.api.view.ApiReqJcBill;
import abacus.springboot.example.api.view.ApiReqJcBillGoodsPhoto;
import abacus.springboot.example.api.view.ApiReqJcBillItem;
import abacus.springboot.example.api.view.JcBillCount;
import abacus.springboot.example.api.view.JcCodeFlow;
import abacus.springboot.example.api.view.JcProduct;
import abacus.springboot.example.api.view.JcProductBillSouce;
import abacus.springboot.example.dao.JcBill;
import abacus.springboot.example.dao.JcBillHg;
import abacus.springboot.example.dao.JcBillHgPay;
import abacus.springboot.example.dao.JcBillInItem;
import abacus.springboot.example.dao.JcBillPhoto;
import abacus.springboot.example.dao.JcBillSourceItem;
import abacus.springboot.example.dao.JcSourceItem;
import abacus.springboot.example.pi.ApiJcBillAccessIF;
import abacus.springboot.example.pi.JcBillAccessIF;
import abacus.springboot.example.repository.JcBillHgPayRepository;
import abacus.springboot.example.repository.JcBillHgRepository;
import abacus.springboot.example.repository.JcBillInItemRepository;
import abacus.springboot.example.repository.JcBillPhotoRepository;
import abacus.springboot.example.repository.JcBillRepository;
import abacus.springboot.example.repository.JcBillSourceItemRepository;
import abacus.springboot.example.repository.JcSourceItemRepository;
import abacus.springboot.example.wsi.ApiJcBillServiceIF;
@Service
public class ApiJcBillService implements ApiJcBillServiceIF {
private static final Logger LOG = LoggerFactory.getLogger(ApiJcBillService.class);
@Autowired
private ApiJcBillAccessIF apiJcBillAccess;
@Autowired
private JcBillAccessIF jcBillAccess;
@Autowired
private JcBillRepository jcBillRepository;
@Autowired
private JcBillSourceItemRepository jcBillSourceItemRepository;
@Autowired
private JcBillPhotoRepository jcBillPhotoRepository;
@Autowired
private JcBillHgRepository jcBillHgRepository;
@Autowired
private JcBillHgPayRepository jcBillHgPayRepository;
@Autowired
private JcSourceItemRepository jcSourceItemRepository;
@Autowired
private JcBillInItemRepository jcBillInItemRepository;
@Override
public Page<ApiJcBillSearch> queryApiJcBillSearch(String keyword, String employee, String status, Pageable pageable)
throws RuntimeException {
try {
return this.apiJcBillAccess.queryApiJcBillSearch(keyword, employee, status, pageable);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public ApiJcBill queryApiJcBillById(String id) throws RuntimeException {
try {
return this.apiJcBillAccess.queryApiJcBillById(id);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<ApiJcBillItem> queryApiJcBillItemByBIllId(String billId) throws RuntimeException {
try {
return this.apiJcBillAccess.queryApiJcBillItemByBIllId(billId);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public Map<String, List<JcBillPhoto>> queryJcBillPhoto(String srcid) throws RuntimeException {
try {
List<JcBillPhoto> billPhotos = jcBillAccess.queryJcBillPhoto(srcid, null, null);
if(billPhotos == null) return new HashMap<String, List<JcBillPhoto>>();
Map<String, List<JcBillPhoto>> map = billPhotos.stream()
.collect(Collectors.groupingBy(e -> {
return e.getTypephoto() + "#" + e.getSrcitemid();
},
Collectors.collectingAndThen(Collectors.toList(), value -> value)
));
return map;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public Map<String, List<JcBillPhoto>> queryJcBillPhotoIn(List<String> srcids) throws RuntimeException {
try {
List<JcBillPhoto> billPhotos = jcBillAccess.queryJcBillPhotoIn(srcids);
if(billPhotos == null) return new HashMap<String, List<JcBillPhoto>>();
Map<String, List<JcBillPhoto>> map = billPhotos.stream()
.collect(Collectors.groupingBy(e -> {
return e.getTypephoto() + "#" + e.getSrcitemid();
},
Collectors.collectingAndThen(Collectors.toList(), value -> value)
));
return map;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public ApiReqJcBill saveApiReqJcBill(ApiReqJcBill reqJcBill, JcBill jcBill, List<JcBillSourceItem> createItems)
throws RuntimeException {
try {
List<JcBillSourceItem> tempItems = jcBillSourceItemRepository.saveAll(createItems);
// Map<String, JcBillSourceItem> map = tempItems.stream()
// .collect(Collectors.groupingBy(e -> {
// return String.valueOf(e.getIndexno()) + e.getGoodsid();
// },
// Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))
// ));
// 新增
List<JcBillPhoto> createPhoto = new ArrayList<JcBillPhoto>();
if(reqJcBill.getItems() != null && reqJcBill.getItems().size() >= 1) {
JcBillPhoto fkPhoto = null;
JcBillPhoto hpPhoto = null;
for(ApiReqJcBillItem item : reqJcBill.getItems()) {
// 付款图
if(item.getPaymentPhoto() != null && item.getPaymentPhoto().size() >= 1) {
for(String urlphoto : item.getPaymentPhoto()) {
fkPhoto = new JcBillPhoto();
fkPhoto.setSrcid(jcBill.getId());
fkPhoto.setSrcitemid(String.valueOf(item.getIndexno()));
fkPhoto.setTypephoto(JcBillPhoto.JC_FK);
fkPhoto.setUrlphoto(urlphoto);
createPhoto.add(fkPhoto);
}
}
for(ApiReqJcBillGoodsPhoto photo : item.getGoodsPhotos()) {
// 货品图
if(item.getGoodsPhotos() != null && item.getGoodsPhotos().size() >= 1) {
for(String urlphoto : photo.getGoodsPhotos()) {
hpPhoto = new JcBillPhoto();
hpPhoto.setSrcid(jcBill.getId());
hpPhoto.setSrcitemid(String.valueOf(item.getIndexno()) + "#" + photo.getGoodsid());
hpPhoto.setTypephoto(JcBillPhoto.JC_HP);
hpPhoto.setUrlphoto(urlphoto);
createPhoto.add(hpPhoto);
}
}
}
}
}
// 删除图片
jcBillAccess.deleteJcBillPhoto(jcBill.getId(), null, JcBillPhoto.JC_FK);
jcBillAccess.deleteJcBillPhoto(jcBill.getId(), null, JcBillPhoto.JC_HP);
jcBillPhotoRepository.saveAll(createPhoto);
jcBillRepository.save(jcBill);
return reqJcBill;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public ApiReqJcBill updateApiReqJcBill(ApiReqJcBill reqJcBill, JcBill jcBill, List<JcBillSourceItem> createItems,
List<JcBillSourceItem> updateItems) throws RuntimeException {
try {
// Map<String, JcBillSourceItem> map = tempItems.stream()
// .collect(Collectors.groupingBy(e -> {
// return String.valueOf(e.getIndexno()) + e.getGoodsid();
// },
// Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))
// ));
// 新增
List<JcBillPhoto> createPhoto = new ArrayList<JcBillPhoto>();
if(reqJcBill.getItems() != null && reqJcBill.getItems().size() >= 1) {
JcBillPhoto fkPhoto = null;
JcBillPhoto hpPhoto = null;
for(ApiReqJcBillItem item : reqJcBill.getItems()) {
// 付款图
if(item.getPaymentPhoto() != null && item.getPaymentPhoto().size() >= 1) {
for(String urlphoto : item.getPaymentPhoto()) {
fkPhoto = new JcBillPhoto();
fkPhoto.setSrcid(jcBill.getId());
fkPhoto.setSrcitemid(String.valueOf(item.getIndexno()));
fkPhoto.setTypephoto(JcBillPhoto.JC_FK);
fkPhoto.setUrlphoto(urlphoto);
createPhoto.add(fkPhoto);
}
}
for(ApiReqJcBillGoodsPhoto photo : item.getGoodsPhotos()) {
// 货品图
if(item.getGoodsPhotos() != null && item.getGoodsPhotos().size() >= 1) {
for(String urlphoto : photo.getGoodsPhotos()) {
hpPhoto = new JcBillPhoto();
hpPhoto.setSrcid(jcBill.getId());
hpPhoto.setSrcitemid(String.valueOf(item.getIndexno()) + "#" + photo.getGoodsid());
hpPhoto.setTypephoto(JcBillPhoto.JC_HP);
hpPhoto.setUrlphoto(urlphoto);
createPhoto.add(hpPhoto);
}
}
}
}
}
// 删除图片
jcBillAccess.deleteJcBillPhoto(jcBill.getId(), null, JcBillPhoto.JC_FK);
jcBillAccess.deleteJcBillPhoto(jcBill.getId(), null, JcBillPhoto.JC_HP);
jcBillSourceItemRepository.deleteByBillid(jcBill.getId());
jcBillRepository.deleteById(jcBill.getId());
List<JcBillSourceItem> tempItems = jcBillSourceItemRepository.saveAll(createItems);
jcBillPhotoRepository.saveAll(createPhoto);
jcBillRepository.save(jcBill);
return reqJcBill;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
/*@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public ApiReqJcBill updateApiReqJcBill(ApiReqJcBill reqJcBill, JcBill jcBill, List<JcBillSourceItem> createItems,
List<JcBillSourceItem> updateItems) throws RuntimeException {
try {
List<JcBillSourceItem> tempItems = jcBillSourceItemRepository.saveAll(createItems);
// Map<String, JcBillSourceItem> map = tempItems.stream()
// .collect(Collectors.groupingBy(e -> {
// return String.valueOf(e.getIndexno());
// },
// Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))
// ));
// 新增
List<JcBillPhoto> createPhoto = new ArrayList<JcBillPhoto>();
// 修改
List<JcBillPhoto> updatePhoto = new ArrayList<JcBillPhoto>();
if(reqJcBill.getItems() != null && reqJcBill.getItems().size() >= 1) {
JcBillPhoto fkPhoto = null;
JcBillPhoto hpPhoto = null;
for(ApiReqJcBillItem item : reqJcBill.getItems()) {
// 付款图
if(item.getPaymentPhoto() != null && item.getPaymentPhoto().size() >= 1) {
for(String urlphoto : item.getPaymentPhoto()) {
fkPhoto = new JcBillPhoto();
fkPhoto.setSrcid(jcBill.getId());
fkPhoto.setSrcitemid(String.valueOf(item.getIndexno()));
fkPhoto.setTypephoto(JcBillPhoto.JC_FK);
fkPhoto.setUrlphoto(urlphoto);
createPhoto.add(fkPhoto);
}
}
for(ApiReqJcBillGoodsPhoto photo : item.getGoodsPhotos()) {
// 货品图
if(item.getGoodsPhotos() != null && item.getGoodsPhotos().size() >= 1) {
for(String urlphoto : photo.getGoodsPhotos()) {
hpPhoto = new JcBillPhoto();
hpPhoto.setSrcid(jcBill.getId());
hpPhoto.setSrcitemid(String.valueOf(item.getIndexno()) + "#" + photo.getGoodsid());
hpPhoto.setTypephoto(JcBillPhoto.JC_HP);
hpPhoto.setUrlphoto(urlphoto);
createPhoto.add(hpPhoto);
}
}
}
}
}
// 删除图片
// for(JcBillPhoto photo : createPhoto) {
// jcBillAccess.deleteJcBillPhoto(photo.getSrcid(), photo.getSrcitemid(), photo.getTypephoto());
// }
jcBillAccess.deleteJcBillPhoto(jcBill.getId(), null, JcBillPhoto.JC_FK);
jcBillAccess.deleteJcBillPhoto(jcBill.getId(), null, JcBillPhoto.JC_HP);
jcBillPhotoRepository.saveAll(createPhoto);
jcBillAccess.updateJcBill(jcBill);
jcBillAccess.updateJcBillSourceItem(updateItems);
List<JcBillSourceItem> itemsLogs = new ArrayList<JcBillSourceItem>();
itemsLogs.addAll(tempItems);
itemsLogs.addAll(updateItems);
List<JcBillPhoto> photoLogs = new ArrayList<JcBillPhoto>();
photoLogs.addAll(createPhoto);
photoLogs.addAll(updatePhoto);
操作日志
OperationLog log = new OperationLog("api_jc_bill", jcBill.getId(), "更新", "", "",
JSONObject.toJSONString(jcBill) + JSONArray.toJSONString(itemsLogs) + JSONArray.toJSONString(photoLogs));
log.setOperator(jcBill.getApplicant());
log.setOperatorName(jcBill.getApplicantname());
BusinessESUtil.checkService(this.operationLogService).saveOperationLog(log);
return reqJcBill;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}*/
@Override
public int countJcBillItemIndexno(String billId) throws RuntimeException {
try {
return jcBillAccess.countJcBillItemIndexno(billId);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public JcBill queryJcBillById(String billId) throws RuntimeException {
try {
Optional<JcBill> optional = jcBillRepository.findById(billId);
return optional.isPresent() ? optional.get() : null;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcBillSourceItem> queryJcBillSourceItemByBillId(String billId) throws RuntimeException {
try {
List<JcBillSourceItem> list = jcBillSourceItemRepository.findByBillid(billId);
return (list != null && list.size() >= 1) ? list : null;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public JcBillSourceItem queryJcBillSourceItembyId(Long id) throws RuntimeException {
try {
Optional<JcBillSourceItem> optional = jcBillSourceItemRepository.findById(id);
return optional.isPresent() ? optional.get() : new JcBillSourceItem();
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void updateStatusJcBill(JcBill jcBill, int oldStatus) throws RuntimeException {
try {
jcBillRepository.save(jcBill);
// jcBillSourceItemRepository.saveAll(sourceItems);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public Page<ApiJcBillHgSearchItem> queryApiJcBillHgSearchItem(String keyword, String employee, String status, Pageable pageable)
throws RuntimeException {
try {
return this.apiJcBillAccess.queryApiJcBillHgSearchItem(keyword, employee, status, pageable);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public Map<String, JcBillCount> queryJcBillCount(List<String> ids) throws RuntimeException {
try {
if(ids != null && ids.size() >= 1) {
List<JcBillCount> counts = apiJcBillAccess.queryJcBillCount(ids);
if(counts == null) return new HashMap<String, JcBillCount>();
Map<String, JcBillCount> map = counts.stream()
.collect(Collectors.groupingBy(e -> {
return e.getId();
},
Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))
));
return map;
} else {
return new HashMap<String, JcBillCount>();
}
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public ApiBillHg queryApiBillHgById(String hgId) throws RuntimeException {
try {
return this.apiJcBillAccess.queryApiBillHgById(hgId);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<ApiBillHgItem> queryApiBillHgItemByHgId(String hgId) throws RuntimeException {
try {
return this.apiJcBillAccess.queryApiBillHgItemByHgId(hgId);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<ApiBillHgPayment> queryApiBillHgPaymentByHgId(String hgId) throws RuntimeException {
try {
return this.apiJcBillAccess.queryApiBillHgPaymentByHgId(hgId);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public JcBillHg queryJcBillHg(String billHg) throws RuntimeException {
try {
Optional<JcBillHg> optional = jcBillHgRepository.findById(billHg);
return optional.isPresent() ? optional.get() : null;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void updateJcBillHg(JcBillHg entity, List<JcBillHgPay> pays) throws RuntimeException {
try {
jcBillHgRepository.save(entity);
jcBillHgPayRepository.saveAll(pays);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public JcBillPhoto queryJcBillPhoto(String srcid, String srcitemid, String typephoto) throws RuntimeException {
try {
return jcBillPhotoRepository.findBySrcidAndSrcitemidAndTypephoto(srcid, srcitemid, typephoto);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcBillPhoto> queryJcBillPhoto(String srcid, String typephoto) throws RuntimeException {
try {
return jcBillAccess.queryJcBillPhoto(srcid, null, typephoto);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void saveAndDeletePhoto(List<JcBillPhoto> photos, JcBillHg billHg) throws RuntimeException {
try {
for(JcBillPhoto photo : photos) {
jcBillPhotoRepository.deleteBySrcidAndSrcitemidAndTypephoto(photo.getSrcid(), photo.getSrcitemid(), photo.getTypephoto());
}
jcBillPhotoRepository.saveAll(photos);
jcBillHgRepository.save(billHg);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void saveAndDeletePhoto(List<JcBillPhoto> photos, String billId) throws RuntimeException {
try {
jcBillPhotoRepository.saveAll(photos);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public String lastBillHgId() throws RuntimeException {
try {
return jcBillAccess.lastBillHgId();
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcCodeFlow> queryJcCodeFlow(List<String> codes) throws RuntimeException {
try {
List<JcCodeFlow> flows = apiJcBillAccess.queryJcCodeFlow(codes);
if(flows == null) return null;
// Map<String, JcCodeFlow> map = flows.stream()
// .collect(Collectors.groupingBy(e -> {
// return e.getCode();
// },
// Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))
// ));
return flows;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcSourceItem> queryJcSourceItemByBillId(String billId) throws RuntimeException {
try {
return jcBillAccess.queryJcSourceItemByBillId(billId);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void saveJcSourceItem(List<JcBillSourceItem> items, List<JcSourceItem> sourceItems, JcBill jcBill) throws RuntimeException {
try {
jcBillAccess.deleteJcSourceItemBySource(jcBill.getId());
if(sourceItems != null && sourceItems.size() >= 1) jcSourceItemRepository.saveAll(sourceItems);
jcBillSourceItemRepository.saveAll(items);
boolean flag = true;
for(JcBillSourceItem item : items) {
if(item.getStatus() == 0 && item.getStatus() == -2) flag = false;
}
if(flag)jcBill.setStatus(JcBill.STATUS_ONE);
jcBillRepository.save(jcBill);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public JcBillPhoto queryJcBillPhotoById(String id) throws RuntimeException {
try {
Optional<JcBillPhoto> optional = jcBillPhotoRepository.findById(Long.parseLong(id));
return optional.isPresent() ? optional.get() : null;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void deleteJcBillPhotoById(JcBillPhoto entity) throws RuntimeException {
try {
jcBillPhotoRepository.delete(entity);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void deleteJcSourceItem(String billid, String itemid) throws RuntimeException {
try {
Optional<JcBillSourceItem> optional = jcBillSourceItemRepository.findById(Long.parseLong(itemid));
if(optional.isPresent()) {
JcBillSourceItem item = optional.get();
jcBillAccess.deleteJcBillPhoto(billid, String.valueOf(item.getIndexno()), JcBillPhoto.JC_FK);
jcBillAccess.deleteJcBillPhoto(billid, item.getIndexno() + "#" + item.getGoodsid(), JcBillPhoto.JC_HP);
jcBillSourceItemRepository.delete(item);
}
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException(e);
}
}
@Override
public List<ApiBillHgPayment> queryApiBillHgPaymentByHgId(List<String> hgIds) throws RuntimeException {
try {
return this.apiJcBillAccess.queryApiBillHgPaymentByHgId(hgIds);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public String getBaiduToken() throws RuntimeException {
return jcBillAccess.getBaiduToken();
}
@Override
public List<JcProduct> queryJcProduct(String product, String stockInId, String hgId) throws RuntimeException {
try {
return this.apiJcBillAccess.queryJcProduct(product, stockInId, hgId);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public Map<String, List<JcProductBillSouce>> queryJcProductBillSouce(List<String> billIds) throws RuntimeException {
try {
List<JcProductBillSouce> billPhotos = apiJcBillAccess.queryJcProductBillSouce(billIds);
if(billPhotos == null) return new HashMap<String, List<JcProductBillSouce>>();
Map<String, List<JcProductBillSouce>> map = billPhotos.stream()
.collect(Collectors.groupingBy(e -> {
return e.getBillid() + e.getAccount() + e.getProduct();
},
Collectors.collectingAndThen(Collectors.toList(), value -> value)
));
return map;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcProduct> queryJcProduct(String product, String stockInId) throws RuntimeException {
try {
return this.apiJcBillAccess.queryJcProduct(product, stockInId);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public void updateStatusByJcBill(JcBill jcBill, int status) throws RuntimeException {
try {
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcBillHg> qeryJcBillHgs(List<String> billids) throws RuntimeException {
try {
return apiJcBillAccess.qeryJcBillHgs(billids);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public JcBillInItem queryJcBillInItemById(Long id) throws RuntimeException {
try {
Optional<JcBillInItem> optional = jcBillInItemRepository.findById(id);
return optional.isPresent() ? optional.get() : new JcBillInItem();
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
}
@@ -0,0 +1,547 @@
package abacus.springboot.example.esb;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.abacus.xpos.foundation.dao.Employee;
import com.abacus.xpos.foundation.pubs.DaoIdGenerator;
import com.abacus.xpos.foundation.wsi.EmployeeServiceIF;
import com.alibaba.fastjson.JSON;
import abacus.commons.exception.BusinessException;
import abacus.springboot.example.api.view.ApiReqJcBill;
import abacus.springboot.example.api.view.ApiReqJcBillGoodsPhoto;
import abacus.springboot.example.api.view.ApiReqJcBillItem;
import abacus.springboot.example.api.view.ApiRespJcPorduct;
import abacus.springboot.example.api.view.ApiRespJcPorductAcount;
import abacus.springboot.example.api.view.ApiRespJcPorductItem;
import abacus.springboot.example.api.view.ApiRespJcPorductProduct;
import abacus.springboot.example.api.view.JcProduct;
import abacus.springboot.example.api.view.JcProductBillSouce;
import abacus.springboot.example.dao.JcBill;
import abacus.springboot.example.dao.JcBillPhoto;
import abacus.springboot.example.dao.JcBillSourceItem;
import abacus.springboot.example.wsi.ApiJcBillServiceIF;
/**
* <p>Title:JcBillBizService</p>
<p>Description: 稽查单业务编排(原内聚于 Controller 的私有方法,按 5 层 DAG 下沉到 esb</p>
@author chuanZeng
@date 2026年8月18日
*/
@Service
public class JcBillBizService {
private static final Logger LOG = LoggerFactory.getLogger(JcBillBizService.class);
@Autowired
private ApiJcBillServiceIF apiJcBillService;
@Autowired
private DaoIdGenerator jcBillIdGenerator;
@Autowired
private EmployeeServiceIF employeeService;
/**
* 稽查收货主单保存逻辑
* @param reqJcBill
* @throws Exception
*/
public void saveJcBill(ApiReqJcBill reqJcBill) throws Exception{
try {
// 稽查单号
String billId = jcBillIdGenerator.takeDaoId(null);
reqJcBill.setId(billId);
// 明细
List<ApiReqJcBillItem> items = reqJcBill.getItems();
// 解析明细
// 新增明细
List<JcBillSourceItem> createItems = new ArrayList<JcBillSourceItem>();
// 汇总数量
BigDecimal quantityBig = new BigDecimal("0");
// 汇总金额
BigDecimal subtotalBig = new BigDecimal("0");
if(items != null && items.size() >= 1) {
int indexno = 0;
for(ApiReqJcBillItem item : items) {
Double quantity = item.getQuantity();
if(quantity == null) throw new BusinessException("收货数量为空!");
if(quantity <= 0) throw new BusinessException("收货数量不能小于等于0");
Double numbers = item.getNumbers();
if(numbers == null) throw new BusinessException("收货件数为空!");
if(numbers <= 0) throw new BusinessException("收货件数不能小于等于0");
Double price = item.getPrice();
if(price == null) throw new BusinessException("价格为空!");
if(price <= 0) throw new BusinessException("价格不能小于等于0");
Double subtotal = item.getSubtotal();
if(subtotal == null) throw new BusinessException("金额为空!");
if(subtotal <= 0) throw new BusinessException("金额不能小于等于0");
item.setIndexno(++indexno);
createItems.addAll(saveJcBillItem(billId, item));
if(item.getQuantity() != null ) quantityBig = quantityBig.add(new BigDecimal(String.valueOf(item.getQuantity())));
if(item.getSubtotal() != null ) subtotalBig = subtotalBig.add(new BigDecimal(String.valueOf(item.getSubtotal())));
}
}
Employee emp = employeeService.getEmployee(reqJcBill.getApplicant());
if(emp == null) throw new BusinessException("申请人不存在!");
// 主单对象
JcBill jcBill = new JcBill();
jcBill.setId(billId);
jcBill.setStatus(JcBill.STATUS_ZERO);
jcBill.setGoods(reqJcBill.getGoods());
jcBill.setWarehouse(reqJcBill.getWarehouse());
jcBill.setWarehousename(reqJcBill.getWarehousename());
jcBill.setReceivedt(reqJcBill.getReceivedt());
jcBill.setQuantity(quantityBig.doubleValue());
jcBill.setSubtotal(subtotalBig.doubleValue());
jcBill.setApplicant(reqJcBill.getApplicant());
jcBill.setApplicantname(reqJcBill.getApplicantname());
jcBill.setDept(emp.getDept().getId());
jcBill.setApplicantdt(new Date());
apiJcBillService.saveApiReqJcBill(reqJcBill, jcBill, createItems);
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* 稽查收货明细保存逻辑
* @param item
* @return
* @throws Exception
*/
public List<JcBillSourceItem> saveJcBillItem(String billId, ApiReqJcBillItem item) throws Exception{
try {
BigDecimal numbersBig = new BigDecimal(String.valueOf(item.getNumbers()));
BigDecimal qunantiyBig = new BigDecimal(String.valueOf(item.getQuantity()));
BigDecimal bigprice = new BigDecimal(String.valueOf(item.getPrice()));
// 余数
double yus = item.getQuantity() % item.getNumbers();
// 瓶数
BigDecimal qunantiyInt = qunantiyBig.divide(numbersBig, BigDecimal.ROUND_DOWN).setScale(0, BigDecimal.ROUND_DOWN);
// 金额
BigDecimal bigAmount = bigprice.multiply(new BigDecimal(String.valueOf(item.getQuantity())));
double subtotal = bigAmount.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
List<JcBillSourceItem> sourceItems = new ArrayList<JcBillSourceItem>();
JcBillSourceItem sourceItem = null;
for(int i = 0; i < item.getGoodsPhotos().size(); i++) {
ApiReqJcBillGoodsPhoto photo = item.getGoodsPhotos().get(i);
sourceItem = new JcBillSourceItem();
sourceItem.setBillid(billId);
sourceItem.setIndexno(item.getIndexno());
sourceItem.setStatus(0);
sourceItem.setRecsource(item.getRecsource());
sourceItem.setRecplatform(item.getRecplatform());
sourceItem.setChannel(item.getChannel());
sourceItem.setPrice(item.getPrice());
if(i == (item.getGoodsPhotos().size() - 1)) {
sourceItem.setQuantity(qunantiyInt.doubleValue() + yus);
} else {
sourceItem.setQuantity(qunantiyInt.doubleValue());
}
sourceItem.setNumbers(1);
sourceItem.setSubtotal(subtotal);
sourceItem.setGoodsid(photo.getGoodsid());
sourceItem.setLogisticsid(photo.getLogisticsid());
sourceItems.add(sourceItem);
}
return sourceItems;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* 稽查收货主单修改逻辑
* @param reqJcBill
* @throws Exception
*/
public void updateJcbill(ApiReqJcBill reqJcBill) throws Exception{
try {
// 稽查单号
String billId = reqJcBill.getId();
// 明细
List<ApiReqJcBillItem> items = reqJcBill.getItems();
// 解析明细
// 新增明细
List<JcBillSourceItem> createItems = new ArrayList<JcBillSourceItem>();
// 修改明细
List<JcBillSourceItem> updateItems = new ArrayList<JcBillSourceItem>();
// 汇总数量
BigDecimal quantityBig = new BigDecimal("0");
// 汇总金额
BigDecimal subtotalBig = new BigDecimal("0");
/*if(items != null && items.size() >= 1) {
int indexno = apiJcBillService.countJcBillItemIndexno(billId);
for(ApiReqJcBillItem item : items) {
if(item.getId() == null) {
item.setIndexno(++indexno);
createItems.addAll(saveJcBillItem(billId, item));
} else {
updateItems.addAll(updateJcbillItem(billId, item));
}
if(item.getQuantity() != null ) quantityBig = quantityBig.add(new BigDecimal(String.valueOf(item.getQuantity())));
if(item.getSubtotal() != null ) subtotalBig = subtotalBig.add(new BigDecimal(String.valueOf(item.getSubtotal())));
}
}*/
if(items != null && items.size() >= 1) {
int indexno = 0;
for(ApiReqJcBillItem item : items) {
Double quantity = item.getQuantity();
if(quantity == null) throw new BusinessException("收货数量为空!");
if(quantity <= 0) throw new BusinessException("收货数量不能小于等于0");
Double numbers = item.getNumbers();
if(numbers == null) throw new BusinessException("收货件数为空!");
if(numbers <= 0) throw new BusinessException("收货件数不能小于等于0");
Double price = item.getPrice();
if(price == null) throw new BusinessException("价格为空!");
if(price <= 0) throw new BusinessException("价格不能小于等于0");
Double subtotal = item.getSubtotal();
if(subtotal == null) throw new BusinessException("金额为空!");
if(subtotal <= 0) throw new BusinessException("金额不能小于等于0");
item.setIndexno(++indexno);
createItems.addAll(saveJcBillItem(billId, item));
if(item.getQuantity() != null ) quantityBig = quantityBig.add(new BigDecimal(String.valueOf(item.getQuantity())));
if(item.getSubtotal() != null ) subtotalBig = subtotalBig.add(new BigDecimal(String.valueOf(item.getSubtotal())));
}
}
Employee emp = employeeService.getEmployee(reqJcBill.getApplicant());
if(emp == null) throw new BusinessException("申请人不存在!");
// 主单对象
JcBill jcBill = new JcBill();
jcBill.setId(reqJcBill.getId());
jcBill.setStatus(JcBill.STATUS_ZERO);
jcBill.setGoods(reqJcBill.getGoods());
jcBill.setWarehouse(reqJcBill.getWarehouse());
jcBill.setWarehousename(reqJcBill.getWarehousename());
jcBill.setReceivedt(reqJcBill.getReceivedt());
jcBill.setQuantity(quantityBig.doubleValue());
jcBill.setSubtotal(subtotalBig.doubleValue());
jcBill.setApplicant(reqJcBill.getApplicant());
jcBill.setApplicantname(reqJcBill.getApplicantname());
jcBill.setDept(emp.getDept().getId());
jcBill.setApplicantdt(new Date());
apiJcBillService.updateApiReqJcBill(reqJcBill, jcBill, createItems, updateItems);
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* 稽查收货明细修改逻辑
* @param item
* @return
* @throws Exception
*/
public List<JcBillSourceItem> updateJcbillItem(String billId, ApiReqJcBillItem item) throws Exception{
try {
BigDecimal numbersBig = new BigDecimal(String.valueOf(item.getNumbers()));
BigDecimal qunantiyBig = new BigDecimal(String.valueOf(item.getQuantity()));
BigDecimal bigprice = new BigDecimal(String.valueOf(item.getPrice()));
// 余数
double yus = item.getQuantity() % item.getNumbers();
// 瓶数
BigDecimal qunantiyInt = qunantiyBig.divide(numbersBig, BigDecimal.ROUND_DOWN).setScale(0, BigDecimal.ROUND_DOWN);
// 金额
BigDecimal bigAmount = bigprice.multiply(new BigDecimal(String.valueOf(item.getQuantity())));
double subtotal = bigAmount.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
List<JcBillSourceItem> sourceItems = new ArrayList<JcBillSourceItem>();
JcBillSourceItem sourceItem = null;
for(int i = 0; i < item.getGoodsPhotos().size(); i++) {
ApiReqJcBillGoodsPhoto photo = item.getGoodsPhotos().get(i);
sourceItem = new JcBillSourceItem();
sourceItem.setId(item.getId());
sourceItem.setBillid(billId);
sourceItem.setIndexno(item.getIndexno());
sourceItem.setStatus(0);
sourceItem.setRecsource(item.getRecsource());
sourceItem.setRecplatform(item.getRecplatform());
sourceItem.setChannel(item.getChannel());
sourceItem.setPrice(item.getPrice());
if(i == (item.getGoodsPhotos().size() - 1)) {
sourceItem.setQuantity(qunantiyInt.doubleValue() + yus);
} else {
sourceItem.setQuantity(qunantiyInt.doubleValue());
}
sourceItem.setNumbers(1);
sourceItem.setSubtotal(subtotal);
sourceItem.setGoodsid(photo.getGoodsid());
sourceItem.setLogisticsid(photo.getLogisticsid());
sourceItems.add(sourceItem);
}
return sourceItems;
// JcBillSourceItem sourceItem = new JcBillSourceItem();
// sourceItem.setId(item.getId());
// sourceItem.setBillid(billId);
// sourceItem.setIndexno(item.getIndexno());
// sourceItem.setStatus(1);
// sourceItem.setRecsource(sourceItem.getRecsource());
// sourceItem.setRecplatform(sourceItem.getRecplatform());
// sourceItem.setChannel(sourceItem.getChannel());
// sourceItem.setPrice(sourceItem.getPrice());
// sourceItem.setQuantity(sourceItem.getQuantity());
// sourceItem.setNumbers(sourceItem.getNumbers());
// sourceItem.setSubtotal(sourceItem.getSubtotal());
// sourceItem.setGoodsid(sourceItem.getGoodsid());
// sourceItem.setLogisticsid(sourceItem.getLogisticsid());
//
// return sourceItem;
} catch(Throwable e){
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
/**
* 回购单号是按回购单显示明细,以回购单号为主,解析
* @param product
* @param stockInId
* @param hgId
* @return
* @throws Exception
*/
public List<ApiRespJcPorduct> hgAnalyze(String product, String stockInId, String hgId) throws Exception {
try {
long time1 = System.currentTimeMillis();
List<JcProduct> jcProducts = apiJcBillService.queryJcProduct(product, stockInId, hgId);
LOG.info("稽查货品查询>>>回购单逻辑>>>queryJcProduct耗时>>>{}", (System.currentTimeMillis() - time1));
// 获取稽查单号集合
List<String> billIds = jcProducts.stream()
.map(JcProduct::getBillid)
.collect(Collectors.toList());
long time2 = System.currentTimeMillis();
Map<String, List<JcProductBillSouce>> mapGoods = apiJcBillService.queryJcProductBillSouce(billIds);
LOG.info("稽查货品查询>>>回购单逻辑>>>queryJcProductBillSouce耗时>>>{}", (System.currentTimeMillis() - time2));
LOG.info("稽查货品查询>>>回购单逻辑>>>按稽查单号+客户编码+商品编码,分组数据>>>{}", JSON.toJSONString(mapGoods));
long time3 = System.currentTimeMillis();
Map<String, List<JcBillPhoto>> mapPhoto = apiJcBillService.queryJcBillPhotoIn(billIds);
LOG.info("稽查货品查询>>>回购单逻辑>>>queryJcBillPhotoIn查询耗时>>>{}", (System.currentTimeMillis() - time3));
// 按稽查单号+入库单号+回购单号+出库单号,分组
Map<String, List<JcProduct>> mapProducts = jcProducts.stream()
.collect(Collectors.groupingBy(e -> {
return e.getBillid() + e.getBillin() + e.getBillhg() + e.getWdtbillout();
},
Collectors.collectingAndThen(Collectors.toList(), value -> value)
));
LOG.info("稽查货品查询>>>回购单逻辑>>>按稽查单号+入库单号+回购单号+出库单号,分组数据>>>{}", JSON.toJSONString(mapProducts));
// 客户编码汇总,同一个客户下的商品
Map<String, List<JcProduct>> mapAccProducts = jcProducts.stream()
.collect(Collectors.groupingBy(e -> {
return e.getBillid() + e.getBillin() + e.getBillhg()+ e.getAccount();
},
Collectors.collectingAndThen(Collectors.toList(), value -> value)
));
LOG.info("稽查货品查询>>>回购单逻辑>>>按稽查单号+入库单号+回购单号+客户编码,分组数据>>>{}", JSON.toJSONString(mapAccProducts));
long time4 = System.currentTimeMillis();
List<ApiRespJcPorduct> respJcProducts = new ArrayList<ApiRespJcPorduct>();
ApiRespJcPorduct respJcProduct = null;
for(String key : mapProducts.keySet()) {
List<JcProduct> tempJcProducts = mapProducts.get(key);
JcProduct jcProduct = tempJcProducts.get(0);
respJcProduct = new ApiRespJcPorduct();
if(jcProduct.getBillid() != null) respJcProduct.setBillId(jcProduct.getBillid());
if(jcProduct.getBillin() != null) respJcProduct.setStockInId(jcProduct.getBillin());
if(jcProduct.getBillhg() != null) respJcProduct.setHgId(jcProduct.getBillhg());
if(jcProduct.getWdtbillout() != null) respJcProduct.setStockOutId(jcProduct.getWdtbillout());
List<ApiRespJcPorductAcount> accounts = new ArrayList<ApiRespJcPorductAcount>();
ApiRespJcPorductAcount account = null;
for(JcProduct tempJcProduct : tempJcProducts) {
account = new ApiRespJcPorductAcount();
account.setAccount(tempJcProduct.getAccount());
account.setAccountName(tempJcProduct.getAccountname());
String keyAccount = tempJcProduct.getBillid() + tempJcProduct.getBillin() + tempJcProduct.getBillhg() +tempJcProduct.getAccount();
List<JcProduct> accTempJcProducts = mapAccProducts.get(keyAccount);
LOG.info("稽查货品查询>>>回购单逻辑>>>按稽查单号+入库单号+回购单号+客户编码({}),汇总同一客户数据>>>{}", keyAccount, JSON.toJSONString(accTempJcProducts));
List<ApiRespJcPorductProduct> products = new ArrayList<ApiRespJcPorductProduct>();
ApiRespJcPorductProduct ajproduct = null;
for(JcProduct accJcProduct : accTempJcProducts) {
ajproduct = new ApiRespJcPorductProduct();
ajproduct.setProduct(tempJcProduct.getProduct());
ajproduct.setProductName(tempJcProduct.getProductname());
ajproduct.setQuantity(tempJcProduct.getQuantity() + "瓶/" + tempJcProduct.getNumbers() + "");
String keyGoods = accJcProduct.getBillid() + accJcProduct.getAccount() + accJcProduct.getProduct();
List<JcProductBillSouce> tempGoods = mapGoods.get(keyGoods);
LOG.info("稽查货品查询>>>回购单逻辑>>>按稽查单号+客户编码+商品编码({}),分组数据>>>{}", keyGoods, JSON.toJSONString(tempGoods));
List<ApiRespJcPorductItem> items = new ArrayList<ApiRespJcPorductItem>();
ApiRespJcPorductItem item = null;
for(JcProductBillSouce tempGood : tempGoods) {
item = new ApiRespJcPorductItem();
item.setGoodsId(tempGood.getGoodsid());
List<JcBillPhoto> hpts = mapPhoto.get(JcBillPhoto.JC_HP + "#" + String.valueOf(tempGood.getIndexno()) + "#" + String.valueOf(tempGood.getGoodsid()));
List<String> hptList = new ArrayList<String>();
if(hpts != null && hpts.size() >= 1) {
for(JcBillPhoto hpt : hpts) {
if(tempGood.getBillid().equals(hpt.getSrcid())) {
hptList.add(hpt.getUrlphoto());
}
}
}
item.setPhotos(hptList);
items.add(item);
/*if(StringUtils.isBlank(product)) {
item = new ApiRespJcPorductItem();
item.setGoodsId(tempGood.getGoodsid());
List<JcBillPhoto> hpts = mapPhoto.get(JcBillPhoto.JC_HP + "#" + String.valueOf(tempGood.getIndexno()) + "#" + String.valueOf(tempGood.getGoodsid()));
List<String> hptList = new ArrayList<String>();
if(hpts != null && hpts.size() >= 1) {
for(JcBillPhoto hpt : hpts) {
hptList.add(hpt.getUrlphoto());
}
}
item.setPhotos(hptList);
items.add(item);
} else {
if(product.equals(tempGood.getGoodsid())) {
item = new ApiRespJcPorductItem();
item.setGoodsId(tempGood.getGoodsid());
List<JcBillPhoto> hpts = mapPhoto.get(JcBillPhoto.JC_HP + "#" + String.valueOf(tempGood.getIndexno()) + "#" + String.valueOf(tempGood.getGoodsid()));
List<String> hptList = new ArrayList<String>();
if(hpts != null && hpts.size() >= 1) {
for(JcBillPhoto hpt : hpts) {
hptList.add(hpt.getUrlphoto());
}
}
item.setPhotos(hptList);
items.add(item);
}
}*/
}
if(items.size() >= 1) {
ajproduct.setItems(items);
products.add(ajproduct);
}
}
if(products.size() >= 1) {
account.setProducts(products);
accounts.add(account);
}
}
if(accounts.size() >= 1) {
respJcProduct.setAccounts(accounts);
respJcProducts.add(respJcProduct);
}
}
LOG.info("稽查货品查询>>>回购单逻辑>>>数据封装耗时>>>{}", (System.currentTimeMillis() - time4));
return respJcProducts;
} catch (Exception e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw e;
}
}
}
@@ -0,0 +1,719 @@
package abacus.springboot.example.esb;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONObject;
import abacus.commons.context.interceptor.UserContext;
import abacus.commons.exception.BusinessException;
import abacus.config.ext.AbacusExtConfig;
import abacus.springboot.example.dao.JcBill;
import abacus.springboot.example.dao.JcBillHg;
import abacus.springboot.example.dao.JcBillInItem;
import abacus.springboot.example.dao.JcBillPhoto;
import abacus.springboot.example.dao.JcBillSourceItem;
import abacus.springboot.example.dao.JcSourceItem;
import abacus.springboot.example.pi.JcBillAccessIF;
import abacus.springboot.example.repository.JcBillHgRepository;
import abacus.springboot.example.repository.JcBillInItemRepository;
import abacus.springboot.example.repository.JcBillPhotoRepository;
import abacus.springboot.example.repository.JcBillRepository;
import abacus.springboot.example.repository.JcBillSourceItemRepository;
import abacus.springboot.example.repository.JcSourceItemRepository;
import abacus.springboot.example.util.RequestUtil;
import abacus.springboot.example.vo.PMSConfigKey;
import abacus.springboot.example.vo.SiDepositlocation;
import abacus.springboot.example.wsi.JcBillServiceIF;
@Repository
public class JcBillService implements JcBillServiceIF{
private static final Logger LOG = LoggerFactory.getLogger(JcBillService.class);
@Autowired
private JcBillAccessIF jcBillAccess;
@Autowired
private JcBillRepository jcBillRepository;
@Autowired
private JcBillSourceItemRepository jcBillSourceItemRepository;
@Autowired
private JcBillHgRepository jcBillHgRepository;
@Autowired
private JcSourceItemRepository jcSourceItemRepository;
@Autowired
private JcBillInItemRepository jcBillInItemRepository;
@Autowired
private JcBillPhotoRepository jcBillPhotoRepository;
@Autowired
private AbacusExtConfig abacusExtConfig;
@Override
public Page<JcBill> queryJcBill(String fromDate, String thruDate, String id, String applicant, String goods,
String billin, String goodsid, String product, String status, int typ, Pageable pageable) throws RuntimeException {
try {
return this.jcBillAccess.queryJcBill(fromDate, thruDate, applicant, goods, id, billin, goodsid, product, status, typ, pageable);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public JcBill queryJcBillById(String billId) throws RuntimeException {
try {
Optional<JcBill> optional = jcBillRepository.findById(billId);
return optional.isPresent() ? optional.get() : null;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcBillSourceItem> queryJcBillSourceItemByBillId(String billId) throws RuntimeException {
try {
List<JcBillSourceItem> list = jcBillSourceItemRepository.findByBillid(billId);
return (list != null && list.size() >= 1) ? list : null;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public JcBillHg queryJcBillHg(String billHg) throws RuntimeException {
try {
Optional<JcBillHg> optional = jcBillHgRepository.findById(billHg);
return optional.isPresent() ? optional.get() : null;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcSourceItem> queryJcSourceItemByBillId(String billId) throws RuntimeException {
try {
return jcBillAccess.queryJcSourceItemByBillId(billId);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public Map<String, List<JcBillPhoto>> queryJcBillPhoto(String srcid) throws RuntimeException {
try {
List<JcBillPhoto> billPhotos = jcBillAccess.queryJcBillPhoto(srcid, null, null);
if(billPhotos == null) return new HashMap<String, List<JcBillPhoto>>();
Map<String, List<JcBillPhoto>> map = billPhotos.stream()
.collect(Collectors.groupingBy(e -> {
return e.getTypephoto() + "#" + e.getSrcitemid();
},
Collectors.collectingAndThen(Collectors.toList(), value -> value)
));
return map;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcSourceItem> queryJcSourceItemByBillId(String billId, String srcitemid) throws RuntimeException {
try {
return jcSourceItemRepository.findByBillidAndSrcitemid(billId, srcitemid);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public JcBillSourceItem queryJcBillSourceItemById(Long id) throws RuntimeException {
try {
Optional<JcBillSourceItem> optional = jcBillSourceItemRepository.findById(id);
return optional.isPresent() ? optional.get() : null;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public JcSourceItem queryJcSourceItemById(Long id) throws RuntimeException {
try {
Optional<JcSourceItem> optional = jcSourceItemRepository.findById(id);
return optional.isPresent() ? optional.get() : null;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void saveQuerenBillSourceItem(JcBillSourceItem billItem, JcSourceItem sourceItem) throws RuntimeException {
try {
jcBillSourceItemRepository.save(billItem);
jcSourceItemRepository.save(sourceItem);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void saveRejectJcSourceItems(JcBillSourceItem billItem, JcBill jcBill) throws RuntimeException {
try {
jcBillSourceItemRepository.save(billItem);
jcBillRepository.save(jcBill);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void saveCompleteJcBill(List<JcBillInItem> inItems, JcBill jcBill) throws RuntimeException {
try {
jcBillInItemRepository.saveAll(inItems);
jcBillRepository.save(jcBill);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void updateWarehouse(JcBill jcBill) throws RuntimeException {
try {
jcBillRepository.save(jcBill);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcBillInItem> queryJcBillInItemByBillId(String billId, int status) throws RuntimeException {
try {
List<JcBillInItem> list = jcBillInItemRepository.findByBillidAndStatus(billId, status);
return (list != null && list.size() >= 1) ? list : null;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcBillInItem> queryJcBillInItemByBillId(String billId) throws RuntimeException {
try {
List<JcBillInItem> list = jcBillInItemRepository.findByBillid(billId);
return (list != null && list.size() >= 1) ? list : null;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void createStockIn(JcBill jcBill) throws RuntimeException {
try {
jcBillRepository.save(jcBill);
jcBillAccess.saveEvent(jcBill.getId(), "稽查收货", "其他入库");
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public JcBillInItem queryJcBillInItemById(Long id) {
try {
Optional<JcBillInItem> optional = jcBillInItemRepository.findById(id);
return optional.isPresent() ? optional.get() : null;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void saveTerminateHgInItem(JcBillInItem inItem) throws RuntimeException {
try {
jcBillInItemRepository.save(inItem);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcBillInItem> findAllById(List<Long> ids) throws RuntimeException {
try {
return jcBillInItemRepository.findAllById(ids);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void saveInformHg(List<JcBillInItem> inItems, JcBill jcBill, JcBillHg jcBillHg, String photoUrl) throws RuntimeException {
try {
JcBillPhoto photo = new JcBillPhoto();
photo.setSrcid(jcBillHg.getId());
photo.setSrcitemid(jcBillHg.getId());
photo.setTypephoto(JcBillPhoto.HG_TZH);
photo.setUrlphoto(photoUrl);
jcBillPhotoRepository.save(photo);
jcBillInItemRepository.saveAll(inItems);
jcBillRepository.save(jcBill);
jcBillHgRepository.save(jcBillHg);
jcBillAccess.saveEvent(jcBillHg.getId(), "回购订单", "回购通知");
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public Page<JcBillHg> queryJcBillHg(String fromDate, String thruDate, String account, String salearea, String id,
String billId, String status, String product, String manager, int typ, Pageable pageable)
throws RuntimeException {
try {
return jcBillAccess.queryJcBillHg(fromDate, thruDate, account, salearea, id, billId, status, product, manager, typ, pageable);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcBillInItem> queryJcBillInItemByBillHg(String billHgId) throws RuntimeException {
try {
List<JcBillInItem> list = jcBillInItemRepository.findByBillhg(billHgId);
return (list != null && list.size() >= 1) ? list : null;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void saveRejectBillHg(int status, int typ, JcBill jcBill, JcBillHg billHg, List<JcBillInItem> inItems) throws RuntimeException {
try {
if(JcBillHg.STATUS_ONE == status) {
jcBillRepository.save(jcBill);
jcBillHgRepository.save(billHg);
jcBillInItemRepository.saveAll(inItems);
} else if(JcBillHg.STATUS_TWO == status) {
jcBillHgRepository.save(billHg);
} else if(JcBillHg.STATUS_THREE == status || JcBillHg.STATUS_FOUR == status) {
jcBillHgRepository.save(billHg);
} else if (JcBillHg.STATUS_FIVE == status){
// 删除对应的事件
jcBillAccess.deleteEvent(billHg.getId(), "回购分仓", "回购分仓");
} else {
throw new BusinessException("未知状态不能驳回!");
}
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void saveQuerenSk(JcBillHg billHg, boolean fcFlag) throws RuntimeException {
try {
billHg.setAudit(UserContext.getUserId());
billHg.setAuditname(UserContext.getUserName());
billHg.setAuditdt(new Date());
jcBillHgRepository.save(billHg);
if(fcFlag) {
jcBillAccess.saveEvent(billHg.getId(), "回购分仓", "回购分仓");
}
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void savecreateFc(JcBillHg billHg) throws RuntimeException {
try {
jcBillHgRepository.save(billHg);
jcBillAccess.saveEvent(billHg.getId(), "回购分仓", "回购分仓");
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void updateFcWarehouse(String oldJsonStr, JcBillHg billHg) throws RuntimeException {
try {
jcBillHgRepository.save(billHg);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public JcSourceItem saveJcSourceItem(JcSourceItem item) throws RuntimeException {
try {
JcSourceItem tempItem = jcSourceItemRepository.save(item);
return tempItem;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void deleteJcSourceItem(List<Long> ids) throws RuntimeException {
try {
jcBillAccess.deleteJcSourceItem(ids);
// /*操作日志*/
// OperationLog log = new OperationLog("jc_bill", item.getBillid(), "删除溯源确认信息", "", "", JSON.toJSONString(item));
// log.setOperator(UserContext.getUserId());
// log.setOperatorName(UserContext.getUserName());
// BusinessESUtil.checkService(this.operationLogService).saveOperationLog(log);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void updateHgprice(JcBillInItem inItem) throws RuntimeException {
try {
jcBillInItemRepository.save(inItem);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void updateRemark(String oldJsonStr, JcBillHg billHg) throws RuntimeException {
try {
jcBillHgRepository.save(billHg);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void updatePac(String oldJsonStr, JcBillHg billHg) throws RuntimeException {
try {
jcBillHgRepository.save(billHg);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void updateOperatorname(JcBillInItem inItem, String oldStr) throws RuntimeException {
try {
jcBillInItemRepository.save(inItem);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public void saveJcBillInItem(List<JcBillInItem> items) throws RuntimeException {
jcBillInItemRepository.saveAll(items);
}
@Override
public List<JcBillSourceItem> queryJcBillSourceItemInBillId(List<String> billIds) throws RuntimeException {
try {
return jcBillAccess.queryJcBillSourceItemInBillId(billIds);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void saveRejectBill(int status, JcBill jcBill, List<JcBillInItem> inItems, List<JcBillSourceItem> sourceItems) throws RuntimeException {
try {
jcBillRepository.save(jcBill);
jcBillSourceItemRepository.saveAll(sourceItems);
if(inItems != null) jcBillInItemRepository.deleteAll(inItems);
if(JcBill.STATUS_FOUR == status) {// 入库待审核 进行撤回
// 进行事件删除
jcBillAccess.deleteEvent(jcBill.getId(), "稽查收货", "其他入库");
}
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public List<JcSourceItem> queryJcSourceItemByBillId(String billId, String srcitemid, int status)
throws RuntimeException {
try {
return jcSourceItemRepository.findByBillidAndSrcitemidAndStatus(billId, srcitemid, status);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override
public void updateSourceItemAccount(String sourceItemLogJson, String billSourceItemLogJson, String billSourceItemNewLogJson,
JcSourceItem sourceItem, List<JcBillSourceItem> billSourceItems,
List<JcBillInItem> oldInItems, List<JcBillInItem> inItems) throws RuntimeException {
try {
String biillId = sourceItem.getBillid();
jcSourceItemRepository.save(sourceItem);
jcBillSourceItemRepository.saveAll(billSourceItems);
jcBillInItemRepository.deleteAll(oldInItems);
jcBillInItemRepository.saveAll(inItems);
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("服务异常", e.getMessage());
throw new RuntimeException("服务异常:", e);
}
}
@Override
public SiDepositlocation querySiDepositlocation(String srcid) throws Exception {
return jcBillAccess.querySiDepositlocation(srcid);
}
@Override
public SiDepositlocation querySiDepositlocationHGfc(String srcid) throws Exception {
return jcBillAccess.querySiDepositlocationHGfc(srcid);
}
@Override
public JSONObject gwisSubCancelOrder(String orderCode, String orderType) throws Exception {
try {
Map<String, String> configValues = this.abacusExtConfig.getAbacusConfigSetByKeyGroupByKey(
PMSConfigKey.KEY_GROUP, PMSConfigKey.PMS_WMSCONF);
if (configValues == null || configValues.isEmpty())
throw new Exception(PMSConfigKey.PMS_WMSCONF + "为空!");
// 判断key是否存在
if (!configValues.containsKey(PMSConfigKey.PMS_WMSCONF_URL))
throw new Exception(PMSConfigKey.PMS_WMSCONF + "配置中" + PMSConfigKey.PMS_WMSCONF_URL + "不存在!");
if (!configValues.containsKey(PMSConfigKey.PMS_WMSCONF_APPKEY))
throw new Exception(PMSConfigKey.PMS_WMSCONF + "配置中" + PMSConfigKey.PMS_WMSCONF_APPKEY + "不存在!");
if (!configValues.containsKey(PMSConfigKey.PMS_WMSCONF_SESSIONKEY))
throw new Exception(PMSConfigKey.PMS_WMSCONF + "配置中" + PMSConfigKey.PMS_WMSCONF_SESSIONKEY + "不存在!");
// 判断值是否为空
String url = configValues.get(PMSConfigKey.PMS_WMSCONF_URL);
if (StringUtils.isBlank(url))
throw new Exception(PMSConfigKey.PMS_WMSCONF + "配置中" + PMSConfigKey.PMS_WMSCONF_URL + "为空!");
String appkey = configValues.get(PMSConfigKey.PMS_WMSCONF_APPKEY);
if (StringUtils.isBlank(appkey))
throw new Exception(PMSConfigKey.PMS_WMSCONF + "配置中" + PMSConfigKey.PMS_WMSCONF_APPKEY + "为空!");
String sessionKey = configValues.get(PMSConfigKey.PMS_WMSCONF_SESSIONKEY);
if (StringUtils.isBlank(sessionKey))
throw new Exception(PMSConfigKey.PMS_WMSCONF + "配置中" + PMSConfigKey.PMS_WMSCONF_SESSIONKEY + "为空!");
String goodsOwner = configValues.get(PMSConfigKey.PMS_WMSCONF_GOODSOWNER);
if (StringUtils.isBlank(goodsOwner))
throw new Exception(PMSConfigKey.PMS_WMSCONF + "配置中" + PMSConfigKey.PMS_WMSCONF_GOODSOWNER + "为空!");
JSONObject head = new JSONObject();
head.put("orderCode", orderCode); // 唯一订单号
head.put("orderType", orderType);
head.put("goodsOwner", goodsOwner);
// 2. 计算签名 secret = MD5(contentJson + sessionKey)
String secret = md5(head.toJSONString() + sessionKey);
// 3. 拼接完整URL(带上method、appkey、secret
String fullUrl = url
+ "?method=gwisSubCancelOrder"
+ "&appkey=" + appkey
+ "&secret=" + secret;
LOG.info("WMS取消订单>>>orderCode>>>{}>>>orderType>>>{}>>>请求参数>>>{}", orderCode, orderType, head.toJSONString());
String returnJson = RequestUtil.send(fullUrl, head.toJSONString(), orderCode);
LOG.info("WMS取消订单>>>orderCode>>>{}>>>orderType>>>{}>>>响应参数>>>{}", orderCode, orderType, returnJson);
JSONObject jsonObj = JSONObject.parseObject(returnJson);
return jsonObj;
} catch (RuntimeException e) {
e.printStackTrace();
LOG.error("WMS取消订单接口服务异常", e.getMessage());
throw new RuntimeException("WMS取消订单接口服务异常:", e);
}
}
private static String md5(String input) {
try {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes("UTF-8"));
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02X", b)); // 大写十六进制
}
return sb.toString();
} catch (Exception e) {
throw new RuntimeException("MD5计算失败", e);
}
}
}
@@ -0,0 +1,593 @@
package abacus.springboot.example.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import abacus.springboot.example.api.view.ApiBillHg;
import abacus.springboot.example.api.view.ApiBillHgItem;
import abacus.springboot.example.api.view.ApiBillHgPayment;
import abacus.springboot.example.api.view.ApiJcBill;
import abacus.springboot.example.api.view.ApiJcBillHgSearchItem;
import abacus.springboot.example.api.view.ApiJcBillItem;
import abacus.springboot.example.api.view.ApiJcBillSearch;
import abacus.springboot.example.api.view.JcBillCount;
import abacus.springboot.example.api.view.JcCodeFlow;
import abacus.springboot.example.api.view.JcProduct;
import abacus.springboot.example.api.view.JcProductBillSouce;
import abacus.springboot.example.dao.JcBillHg;
import abacus.springboot.example.pi.ApiJcBillAccessIF;
/**
* <p>Title:ApiJcBillAccess</p>
<p>Description: 底层实现</p>
@author chuanZeng
@date 2026年8月18日
*/
@Repository
public class ApiJcBillAccess implements ApiJcBillAccessIF {
private static final Logger LOG = LoggerFactory.getLogger(ApiJcBillAccess.class);
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public Page<ApiJcBillSearch> queryApiJcBillSearch(String keyword, String employee, String status, Pageable pageable)
throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer("");
if(StringUtils.isNotBlank(keyword)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" (a.id like '%" + keyword + "%' ");
sb.append(" or a.goods like '%" + keyword + "%'");
sb.append(" or a.id in (select b.billid from jc_billsource_item b where b.goodsid like'%" + keyword + "%'))");
params.put("id", "%"+keyword+"%");
}
if(StringUtils.isNotBlank(employee)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" (a.dept in (");
sb.append(" select deptid from (");
sb.append(" select dataid as deptid from distributionmapping where erid ='" + employee + "' and rtype = 1 and ftype = 1 and dtype = 1");
sb.append(" union");
sb.append(" select a.dataid as deptid from distributionmapping a ,acas_assign b where a.erid =b.rolez and a.rtype = 0 and a.ftype = 1 and a.dtype = 1 and b.userz ='" + employee + "'");
sb.append(" ) adept)");
sb.append(" or");
sb.append(" a.applicant in (");
sb.append(" select dataid from (");
sb.append(" select dataid from distributionmapping where erid ='" + employee + "' and rtype = 1 and ftype = 1 and dtype = 2");
sb.append(" union");
sb.append(" select dataid from distributionmapping a ,acas_assign b where a.erid =b.rolez and a.rtype = 0 and a.ftype = 1 and a.dtype = 2 and b.userz ='" + employee + "'");
sb.append(" union");
sb.append(" select '" + employee + "'");
sb.append(" ) adept )");
sb.append(" )");
params.put("employee", employee);
// sb.append(" a.dept in (");
// sb.append(" select deptid from (");
// sb.append(" select dataid as deptid from distributionmapping where erid ='" + employee + "' and rtype = 1 and ftype = 1 and dtype = 1");
// sb.append(" union ");
// sb.append(" select a.dataid as deptid from distributionmapping a ,acas_assign b where a.erid =b.rolez and a.rtype = 0 and a.ftype = 1 and a.dtype = 1 and b.userz ='" + employee + "'");
// sb.append(" union ");
// sb.append("select (select dept as deptid from employee e where e.id = dataid) as deptid from distributionmapping where erid ='" + employee + "' and rtype = 1 and ftype = 1 and dtype = 2");
// sb.append(" union ");
// sb.append("select (select dept as deptid from employee e where e.id = a.dataid) as deptid from distributionmapping a ,acas_assign b where a.erid =b.rolez and a.rtype = 0 and a.ftype = 1 and a.dtype = 2 and b.userz ='" + employee + "'");
// sb.append(" union ");
// sb.append("select dept as deptid from employee e where e.id = '" + employee + "'");
// sb.append(" ) adept");
// sb.append(" )");
// params.put("employee", employee);
}
if(StringUtils.isNotBlank(status)) {
sb.append(params.size() > 0 ?" and ":" where ");
int statusInt = Integer.parseInt(status);
if(statusInt == 0) {// 待提交:已录入或者录入完成提交验证
sb.append(" a.status in(0, 1) ");
params.put("status", statusInt);
} else if(statusInt == 2) {// 待溯源
sb.append(" a.status = 2 ");
params.put("status", statusInt);
} else if(statusInt == -2) {// 人工溯源驳回
sb.append(" a.status = -2 ");
params.put("status", statusInt);
} else if(statusInt == 3) {// 待入库,待入库审核
sb.append(" a.status in(3, 4) ");
params.put("status", statusInt);
} else if(statusInt == 5) {// 已入库
sb.append(" a.status = 5 ");
params.put("status", statusInt);
} else if(statusInt == 6 || statusInt == 8) {// 部分回购,回购完成
sb.append(" a.hgstatus in(1, 2) ");
params.put("status", statusInt);
}
} else {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.status in(-2, 0, 1, 2, 3, 4, 5) ");
params.put("status", 1);
}
StringBuffer orderBy = new StringBuffer("");
orderBy.append(" order by dt desc ");
orderBy.append(" offset "+ (pageable.getPageNumber() * pageable.getPageSize()) + " rows fetch next "+ pageable.getPageSize() + " rows only ");
String sql = " select a.id as billid, receivedt as receivedt, a.goods as goods, "
+ " a.quantity as quantity, a.status as status, a.hgstatus as hgstatus from jc_bill a "
+ sb.toString() + orderBy.toString();
LOG.info("queryApiJcBillSearch>>>SQLgetPageNumber>>>{}", pageable.getPageNumber());
LOG.info("queryApiJcBillSearch>>>SQLgetPageSize>>>{}", pageable.getPageSize());
LOG.info("queryApiJcBillSearch>>>SQL>>>{}", sql);
List<ApiJcBillSearch> lists = jdbcTemplate.query(sql, new BeanPropertyRowMapper<ApiJcBillSearch>(ApiJcBillSearch.class));
Long count = jdbcTemplate.queryForObject("select count(a.id) from jc_bill a " + sb.toString(), Long.class);
Page<ApiJcBillSearch> scorePage = new PageImpl<ApiJcBillSearch>(lists, pageable, count);
return scorePage;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public ApiJcBill queryApiJcBillById(String id) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer(" select a.id, a.status, a.goods, a.warehouse, a.warehousename, a.receivedt,");
sb.append(" a.quantity, a.subtotal, a.applicant, a.applicantname, a.applicantdt");
sb.append(" from jc_bill a");
if(StringUtils.isNotBlank(id)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.id = '" + id + "' ");
params.put("id", id);
}
LOG.info("queryApiJcBillById>>>SQL>>>{}", sb.toString());
List<ApiJcBill> lsit = jdbcTemplate.query(sb.toString(), new BeanPropertyRowMapper<ApiJcBill>(ApiJcBill.class));
return (lsit != null && lsit.size() >= 1) ? lsit.get(0) : null;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public List<ApiJcBillItem> queryApiJcBillItemByBIllId(String billId) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer("select a.id,a.status,a.recsource,a.channel,a.price,a.quantity,");
sb.append(" a.numbers,a.subtotal,a.goodsid,a.logisticsid ");
sb.append(" from jc_billsource_item a ");
if(StringUtils.isNotBlank(billId)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.billid = '" + billId + "' ");
params.put("billId", billId);
}
LOG.info("queryApiJcBillItemByBIllId>>>SQL>>>{}", sb.toString());
List<ApiJcBillItem> lsit = jdbcTemplate.query(sb.toString(), new BeanPropertyRowMapper<ApiJcBillItem>(ApiJcBillItem.class));
return lsit;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public Page<ApiJcBillHgSearchItem> queryApiJcBillHgSearchItem(String keyword, String employee, String status, Pageable pageable)
throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer("");
if(StringUtils.isNotBlank(keyword)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" (a.id like '%" + keyword + "%' ");
sb.append(" or a.account like '%" + keyword + "%'");
sb.append(" or a.accountname like '%" + keyword + "%'");
sb.append(" or a.consigneephone like '%" + keyword + "%'");
sb.append(" or a.id in (select b.billhg from jc_billin_item b where b.product like '%" + keyword + "%' and b.productname like'%" + keyword + "%'))");
params.put("id", "%"+keyword+"%");
}
if(StringUtils.isNotBlank(employee)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" (");
sb.append(" a.account in (");
sb.append(" select sa.id from sams_account sa where sa.groupid in (select pc.id from pms_customergroup pc where pc.grouperid='" + employee + "' or ',' + groupempid + ',' like '%," + employee + ",%')");
sb.append(" )");
sb.append(" or ");
sb.append(" a.account in (");
sb.append(" select customerid from ws_wsempmgcustomer where wsempid ='" + employee + "' ");
sb.append(" )");
sb.append(" )");
// sb.append(" a.account in (select sa.id from sams_account sa where sa.groupid in (select pc.id from pms_customergroup pc where pc.grouperid='" + employee + "' or ',' + groupempid + ',' like '%," + employee + ",%')) ");
params.put("employee", employee);
}
if(StringUtils.isNotBlank(status)) {
sb.append(params.size() > 0 ?" and ":" where ");
int statusInt = Integer.parseInt(status);
if(statusInt == 1) {// 待提交
sb.append(" a.status = 1 ");
params.put("status", statusInt);
} else if(statusInt == 2) {// 待付款
sb.append(" a.status = 2 ");
params.put("status", statusInt);
} else if(statusInt == 3) {// 待分仓
sb.append(" a.status in(3, 4) ");
params.put("status", statusInt);
} else if(statusInt == 5) {// 待出库
sb.append(" a.status = 5 ");
params.put("status", statusInt);
} else if(statusInt == 6) {// 已出库
sb.append(" a.status = 6 ");
params.put("status", statusInt);
}
}
StringBuffer orderBy = new StringBuffer("");
orderBy.append(" order by dt desc ");
orderBy.append(" offset "+ (pageable.getPageNumber() * pageable.getPageSize()) + " rows fetch next "+ pageable.getPageSize() + " rows only ");
String sql = " select a.id as billHg, a.account, a.accountname, a.manager, a.managername, a.status, "
+ " a.logisticsname, a.logisticsno, (a.subtotal+a.freight) as subtotal from jc_billhg a "
+ sb.toString() + orderBy.toString();
LOG.info("queryApiJcBillHgSearchItem>>>SQL>>>{}", sql);
List<ApiJcBillHgSearchItem> lists = jdbcTemplate.query(sql, new BeanPropertyRowMapper<ApiJcBillHgSearchItem>(ApiJcBillHgSearchItem.class));
Long count = jdbcTemplate.queryForObject("select count(a.id) from jc_billhg a " + sb.toString(), Long.class);
Page<ApiJcBillHgSearchItem> scorePage = new PageImpl<ApiJcBillHgSearchItem>(lists, pageable, count);
return scorePage;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public List<JcBillCount> queryJcBillCount(List<String> ids) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer("select billhg as id, count(product) as breednum, sum(numbers) as numbers ");
sb.append(" from jc_billin_item a ");
if(ids != null && ids.size() >= 1) {
StringBuffer idIn = new StringBuffer();
for(String key : ids){
idIn.append("'" + key + "',");
}
String idIns = idIn.toString().substring(0, idIn.length() - 1);
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.billhg in (" + idIns + ") ");
params.put("billhg", idIn);
}
sb.append(" group by billhg");
LOG.info("queryJcBillCount>>>SQL>>>{}", sb.toString());
List<JcBillCount> lsit = jdbcTemplate.query(sb.toString(), new BeanPropertyRowMapper<JcBillCount>(JcBillCount.class));
return lsit;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public ApiBillHg queryApiBillHgById(String hgId) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer(" select a.id, a.billid, a.status, a.source, a.account,");
sb.append(" a.accountname, a.quantity, a.subtotal, a.freight, a.manager,");
sb.append(" a.managername, a.consignee, a.consigneephone, a.province, a.provincename,");
sb.append(" a.city, a.cityname, a.area, a.areaname, a.address,");
sb.append(" a.receiveway, a.remark, a.remark1, a.logisticsname, a.logisticscode,");
sb.append(" a.logisticstype, a.logisticsno");
sb.append(" from jc_billhg a");
if(StringUtils.isNotBlank(hgId)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.id = '" + hgId + "' ");
params.put("id", hgId);
}
LOG.info("queryApiBillHgById>>>SQL>>>{}", sb.toString());
List<ApiBillHg> lsit = jdbcTemplate.query(sb.toString(), new BeanPropertyRowMapper<ApiBillHg>(ApiBillHg.class));
return (lsit != null && lsit.size() >= 1) ? lsit.get(0) : null;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public List<ApiBillHgItem> queryApiBillHgItemByHgId(String hgId) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer("select a.id, a.status, a.product, a.productname, b.spec, a.price, ");
sb.append(" a.quantity, a.numbers, a.hgprice, a.hgamount");
sb.append(" from jc_billin_item a");
sb.append(" left join pms_product b on a.product = b.id");
if(StringUtils.isNotBlank(hgId)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.billhg = '" + hgId + "' ");
params.put("billhg", hgId);
}
LOG.info("queryApiBillHgItemByHgId>>>SQL>>>{}", sb.toString());
List<ApiBillHgItem> lsit = jdbcTemplate.query(sb.toString(), new BeanPropertyRowMapper<ApiBillHgItem>(ApiBillHgItem.class));
return lsit;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public List<ApiBillHgPayment> queryApiBillHgPaymentByHgId(String hgId) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer(" select a.billhg, a.payment, a.amount, a.zhmc, a.khyh, a.yhzh from jc_billhg_pay a ");
if(StringUtils.isNotBlank(hgId)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.billhg = '" + hgId + "' ");
params.put("billhg", hgId);
}
LOG.info("queryApiBillHgPaymentByHgId>>>SQL>>>{}", sb.toString());
List<ApiBillHgPayment> lsit = jdbcTemplate.query(sb.toString(), new BeanPropertyRowMapper<ApiBillHgPayment>(ApiBillHgPayment.class));
return lsit;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public List<JcCodeFlow> queryJcCodeFlow(List<String> codes) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer("select b.id, b.deposit, b.depositname, b.dt as tdate, b.orderid,");
sb.append(" c.customerid, c.customername, c.aprssalemanid, c.aprssalemanname, c.bizgroupid,");
sb.append(" c.bizgroupname, c.wsareaid, c.wsareaname,");
sb.append(" a.code, a.productid, a.productname");
sb.append(" from bcs_codeflow a");
sb.append(" left join wmsn_despatch b on b.id = a.srcid ");
sb.append(" left join ws_wholesalebill c on c.id = b.orderid");
if(codes != null && codes.size() >= 1) {
StringBuffer idIn = new StringBuffer();
for(String key : codes){
idIn.append("'" + key + "',");
}
String idIns = idIn.toString().substring(0, idIn.length() - 1);
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.code in (" + idIns + ") ");
params.put("id", idIn);
}
LOG.info("queryJcCodeFlow>>>SQL>>>{}", sb.toString());
List<JcCodeFlow> lsit = jdbcTemplate.query(sb.toString(), new BeanPropertyRowMapper<JcCodeFlow>(JcCodeFlow.class));
return lsit;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public List<ApiBillHgPayment> queryApiBillHgPaymentByHgId(List<String> hgIds) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer(" select a.billhg, a.payment, a.amount, a.zhmc, a.khyh, a.yhzh from jc_billhg_pay a ");
if(hgIds != null && hgIds.size() >= 1) {
StringBuffer idIn = new StringBuffer();
for(String key : hgIds){
idIn.append("'" + key + "',");
}
String idIns = idIn.toString().substring(0, idIn.length() - 1);
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.billhg in (" + idIns + ") ");
params.put("id", idIn);
}
LOG.info("queryApiBillHgPaymentByHgId>>>SQL>>>{}", sb.toString());
List<ApiBillHgPayment> lsit = jdbcTemplate.query(sb.toString(), new BeanPropertyRowMapper<ApiBillHgPayment>(ApiBillHgPayment.class));
return lsit;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public List<JcProduct> queryJcProduct(String product, String stockInId, String hgId) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer(" select a.billid,a.billin,a.billhg,a.account,a.accountname,a.product,a.productname,");
sb.append(" sum(a.quantity) as quantity ,sum(a.numbers) as numbers,");
sb.append(" (select h.wdtbillout from jc_billhg h where h.billid = a.billid and h.id = a.billhg) as wdtbillout");
sb.append(" from jc_billin_item a");
if(StringUtils.isNotBlank(product)) {
sb.append(params.size() > 0 ?" and ":" where ");
// sb.append(" a.product ='" + product + "' ");
sb.append(" a.billid in (select jbi.billid from jc_billsource_item jbi where jbi.goodsid ='" + product + "' and jbi.status = 3) ");
params.put("product", product);
}
if(StringUtils.isNotBlank(stockInId)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.billin ='" + stockInId + "' ");
params.put("billin", stockInId);
}
if(StringUtils.isNotBlank(hgId)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.billhg ='" + hgId + "' ");
params.put("billhg", hgId);
}
sb.append(" group by a.billid,a.billin,a.billhg,a.account,a.accountname,a.product,a.productname");
LOG.info("queryJcProduct>>>SQL>>>{}", sb.toString());
List<JcProduct> lsit = jdbcTemplate.query(sb.toString(), new BeanPropertyRowMapper<JcProduct>(JcProduct.class));
return lsit;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public List<JcProductBillSouce> queryJcProductBillSouce(List<String> billIds) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer(" select indexno,billid,account,product,goodsid from jc_billsource_item a ");
if(billIds != null && billIds.size() >= 1) {
StringBuffer idIn = new StringBuffer();
for(String key : billIds){
idIn.append("'" + key + "',");
}
String idIns = idIn.toString().substring(0, idIn.length() - 1);
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.billid in (" + idIns + ") ");
params.put("id", idIn);
}
LOG.info("queryJcProductBillSouce>>>SQL>>>{}", sb.toString());
List<JcProductBillSouce> lsit = jdbcTemplate.query(sb.toString(), new BeanPropertyRowMapper<JcProductBillSouce>(JcProductBillSouce.class));
return lsit;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public List<JcProduct> queryJcProduct(String product, String stockInId) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer(" select a.billid,a.billin,a.billhg,a.account,a.accountname,a.product,a.productname,");
sb.append(" sum(a.quantity) as quantity ,sum(a.numbers) as numbers,b.goodsid,");
sb.append(" (select h.wdtbillout from jc_billhg h where h.billid = a.billid and h.id = a.billhg) as wdtbillout");
sb.append(" from jc_billin_item a");
sb.append(" left join jc_billsource_item b on a.billid = b.billid and a.account = b.account and a.product = b.product ");
if(StringUtils.isNotBlank(product)) {
sb.append(params.size() > 0 ?" and ":" where ");
// sb.append(" a.product ='" + product + "' ");
sb.append(" a.billid in (select jbi.billid from jc_billsource_item jbi where jbi.goodsid ='" + product + "' and jbi.status = 3) ");
params.put("product", product);
}
if(StringUtils.isNotBlank(stockInId)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.billin ='" + stockInId + "' ");
params.put("billin", stockInId);
}
sb.append(" group by a.billid,a.billin,a.billhg,a.account,a.accountname,a.product,a.productname,b.goodsid");
LOG.info("queryJcProduct>>>SQL>>>{}", sb.toString());
List<JcProduct> lsit = jdbcTemplate.query(sb.toString(), new BeanPropertyRowMapper<JcProduct>(JcProduct.class));
return lsit;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public List<JcBillHg> qeryJcBillHgs(List<String> billids) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sql = new StringBuffer("select id, version, billid, status, source,");
sql.append(" account, accountname, quantity, subtotal, freight,");
sql.append(" manager, managername, consignee, consigneephone, province,");
sql.append(" provincename, city, cityname, area, areaname,");
sql.append(" address, receiveway, remark, remark1, salearea,");
sql.append(" saleareaname, groupid, groupname, logisticsname, logisticscode,");
sql.append(" logisticstype, logisticsno, found, foundname,");
sql.append(" founddt, submit, submitname, submitdt, audit,");
sql.append(" auditname, auditdt, dt, fhwarehouse, fhwarehousename,");
sql.append(" wdtorder, wdtbillout, wdtbillouttyp");
sql.append(" from jc_billhg a");
if(billids != null && billids.size() >= 1) {
StringBuffer idIn = new StringBuffer();
for(String key : billids){
idIn.append("'" + key + "',");
}
String idIns = idIn.toString().substring(0, idIn.length() - 1);
sql.append(params.size() > 0 ?" and ":" where ");
sql.append(" a.billid in (" + idIns + ") ");
params.put("billid", idIn);
}
LOG.info("qeryJcBillHgs>>>SQL>>>{}", sql.toString());
List<JcBillHg> lsit = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<JcBillHg>(JcBillHg.class));
return lsit;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
}
@@ -0,0 +1,416 @@
package abacus.springboot.example.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import com.abacus.pms.dao.Account;
import com.abacus.pms.dao.Brand;
import com.abacus.pms.dao.MoreCategory;
import com.abacus.pms.dao.Product;
import com.abacus.pms.dao.Spec;
import com.abacus.xpos.foundation.dao.BaseArea;
import com.abacus.xpos.foundation.dao.Dept;
import com.abacus.xpos.foundation.dao.Employee;
import abacus.config.dao.AbacusConfigItem;
import abacus.springboot.example.dao.JcBill;
import abacus.springboot.example.pi.AutoCompleteAccessIF;
/**
* <p>Title:ApiJcBillAccess</p>
<p>Description: 底层实现</p>
@author chuanZeng
@date 2026年8月18日
*/
@Repository("autoCompleteAccess")
public class AutoCompleteAccess extends MyJpaUtils implements AutoCompleteAccessIF {
private final static Log LOG = LogFactory.getLog(AutoCompleteAccess.class);
@PersistenceContext
private EntityManager entityManager;
@Autowired
private JdbcTemplate jdbcTemplate;
@SuppressWarnings("unchecked")
public List<Product> prductAutoComplete(String keyCode, List<String> areaIds) throws Exception {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sql = new StringBuffer("from Product ");
if(StringUtils.isNotBlank(keyCode)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" (lower(name) like lower('%" + keyCode.replaceAll("'", "") + "%')");
sql.append(" or lower(id) like lower('%" + keyCode.replaceAll("'", "") + "%')");
sql.append(" or lower(shortstring) like lower('%" + keyCode.replaceAll("'", "") + "%'))");
params.put("id", keyCode);
}
// if(!areaIds.isEmpty()){
// sql.append(params.size() > 0 ? " and " : " where ");
// sql.append(" areaid in (:areaid) ");
// params.put("areaid", areaIds);
// }
Query query = this.entityManager.createQuery(sql.toString(), Product.class);
// setParameters(query, params);
List<Product> products = query.getResultList();
return products;
} catch (Exception e) {
e.printStackTrace();
LOG.error(e.getMessage(), e);
throw new Exception(e.getMessage());
}
}
@SuppressWarnings("unchecked")
@Override
public List<Dept> deptAutoComplete(String keyCode, String type) throws Exception {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sql = new StringBuffer("from Dept");
if(StringUtils.isNotBlank(keyCode)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" (lower(name) like lower(:name)");
sql.append(" or lower(id) like lower(:id)");
sql.append(" or lower(shortString) like lower(:shortstring))");
params.put("name","%"+keyCode+"%");
params.put("id","%"+keyCode+"%");
params.put("shortstring","%"+keyCode+"%");
}
if(StringUtils.isNotBlank(type)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" typ = :typ ");
params.put("typ", Integer.parseInt(type));
}
Query query = this.entityManager.createQuery(sql.toString(), Dept.class);
setParameters(query, params);
return new ArrayList<Dept>(query.getResultList());
} catch (Exception e) {
e.printStackTrace();
LOG.error(e.getMessage(), e);
throw new Exception(e.getMessage());
}
}
@SuppressWarnings("unchecked")
@Override
public List<MoreCategory> moreCategoryAutoComplete(String keyCode, String areaid, String levels, String lastlevel)
throws Exception {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sql = new StringBuffer("from MoreCategory");
if(StringUtils.isNotBlank(keyCode)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" (lower(name) like lower(:name)");
sql.append(" or lower(id) like lower(:id))");
params.put("name","%"+keyCode+"%");
params.put("id","%"+keyCode+"%");
}
if(StringUtils.isNotBlank(areaid)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" areaid = :areaid ");
params.put("areaid", areaid);
}
if(StringUtils.isNotBlank(levels)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" levels = :levels ");
params.put("levels", Integer.parseInt(levels));
}
if(StringUtils.isNotBlank(lastlevel)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" lastlevel = :lastlevel ");
params.put("lastlevel", Integer.parseInt(lastlevel));
}
Query query = this.entityManager.createQuery(sql.toString(), MoreCategory.class);
setParameters(query, params);
return new ArrayList<MoreCategory>(query.getResultList());
} catch (Exception e) {
e.printStackTrace();
LOG.error(e.getMessage(), e);
throw new Exception(e.getMessage());
}
}
@SuppressWarnings("unchecked")
@Override
public List<Brand> brandAutoComplete(String keyCode, String areaid, String levels, String lastlevel)
throws Exception {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sql = new StringBuffer("from Brand");
if(StringUtils.isNotBlank(keyCode)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" (lower(name) like lower(:name)");
sql.append(" or lower(id) like lower(:id))");
params.put("name","%"+keyCode+"%");
params.put("id","%"+keyCode+"%");
}
if(StringUtils.isNotBlank(areaid)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" areaid = :areaid ");
params.put("areaid", areaid);
}
if(StringUtils.isNotBlank(levels)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" levels = :levels ");
params.put("levels", Integer.parseInt(levels));
}
if(StringUtils.isNotBlank(lastlevel)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" lastlevel = :lastlevel ");
params.put("lastlevel", Integer.parseInt(lastlevel));
}
Query query = this.entityManager.createQuery(sql.toString(), Brand.class);
setParameters(query, params);
return new ArrayList<Brand>(query.getResultList());
} catch (Exception e) {
e.printStackTrace();
LOG.error(e.getMessage(), e);
throw new Exception(e.getMessage());
}
}
@SuppressWarnings("unchecked")
@Override
public List<Spec> specAutoComplete(String keyCode, String areaid) throws Exception {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sql = new StringBuffer("from Spec ");
if(StringUtils.isNotBlank(keyCode)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" (lower(name) like lower('%" + keyCode.replaceAll("'", "") + "%')");
sql.append(" or lower(id) like lower('%" + keyCode.replaceAll("'", "") + "%'))");
}
if(StringUtils.isNotBlank(areaid)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" areaid = :areaid ");
params.put("areaid", areaid);
}
Query query = this.entityManager.createQuery(sql.toString(), Spec.class);
setParameters(query, params);
return new ArrayList<Spec>(query.getResultList());
} catch (Exception e) {
e.printStackTrace();
LOG.error(e.getMessage(), e);
throw new Exception(e.getMessage());
}
}
@SuppressWarnings("unchecked")
@Override
public List<Account> accountAutoComplete(String keyCode, String areaid) throws Exception {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sql = new StringBuffer("from Account");
if(StringUtils.isNotBlank(keyCode)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" (lower(name) like lower(:name)");
sql.append(" or lower(id) like lower(:id)");
sql.append(" or lower(shortString) like lower(:shortstring))");
params.put("name","%"+keyCode+"%");
params.put("id","%"+keyCode+"%");
params.put("shortstring","%"+keyCode+"%");
}
if(StringUtils.isNotBlank(areaid)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" areaid = :areaid ");
params.put("areaid", areaid);
}
Query query = this.entityManager.createQuery(sql.toString(), Account.class);
setParameters(query, params);
return new ArrayList<Account>(query.getResultList());
} catch (Exception e) {
e.printStackTrace();
LOG.error(e.getMessage(), e);
throw new Exception(e.getMessage());
}
}
@SuppressWarnings("unchecked")
@Override
public List<Employee> employeeAutoComplete(String keyCode) throws Exception {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sql = new StringBuffer("from Employee");
if(StringUtils.isNotBlank(keyCode)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" (lower(name) like lower(:name)");
sql.append(" or lower(id) like lower(:id)");
sql.append(" or lower(shortString) like lower(:shortstring))");
params.put("name","%"+keyCode+"%");
params.put("id","%"+keyCode+"%");
params.put("shortstring","%"+keyCode+"%");
}
Query query = this.entityManager.createQuery(sql.toString(), Employee.class);
setParameters(query, params);
return new ArrayList<Employee>(query.getResultList());
} catch (Exception e) {
e.printStackTrace();
LOG.error(e.getMessage(), e);
throw new Exception(e.getMessage());
}
}
@SuppressWarnings("unchecked")
@Override
public List<JcBill> jcBillAutoComplete(String keyCode) throws Exception {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sql = new StringBuffer("from JcBill ");
if(StringUtils.isNotBlank(keyCode)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" lower(id) like lower('%" + keyCode.replaceAll("'", "") + "%')");
params.put("id", keyCode);
}
Query query = this.entityManager.createQuery(sql.toString(), JcBill.class);
List<JcBill> products = query.getResultList();
return products;
} catch (Exception e) {
e.printStackTrace();
LOG.error(e.getMessage(), e);
throw new Exception(e.getMessage());
}
}
@SuppressWarnings("unchecked")
@Override
public List<AbacusConfigItem> abacusConfigItemGroupAutoComplete(String keyCode, String keyGroup, String key) throws Exception {
try {
Map<String,Object> params = new HashMap<String, Object>();
StringBuffer sql = new StringBuffer("from AbacusConfigItem");
if(StringUtils.isNotBlank(keyCode)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" (lower(code) like lower(:code)");
sql.append(" or lower(name) like lower(:name))");
params.put("code","%"+keyCode+"%");
params.put("name","%"+keyCode+"%");
}
if(StringUtils.isNotBlank(keyGroup)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" keyGroup = :keyGroup ");
params.put("keyGroup", keyGroup);
}
if(StringUtils.isNotBlank(key)){
sql.append(params.size() > 0 ? " and " : " where ");
sql.append(" key = :key ");
params.put("key", key);
}
Query query = this.entityManager.createQuery(sql.toString(), AbacusConfigItem.class);
setParameters(query, params);
return new ArrayList<AbacusConfigItem>(query.getResultList());
} catch (Exception e) {
e.printStackTrace();
LOG.error(e.getMessage(), e);
throw new Exception(e.getMessage());
}
}
@Override
public Map<String, Map<String, String>> getGovbs() throws Exception {
try {
Map<String, Map<String, String>> map = new HashMap<String, Map<String, String>>();
String sql = "select city, id, name from basearea order by id desc offset 0 rows fetch next 3000 rows only ";
List<BaseArea> lists = jdbcTemplate.query(sql, new BeanPropertyRowMapper<BaseArea>(BaseArea.class));
if(lists!=null&&!lists.isEmpty()){
for(BaseArea obj:lists){
Map<String, String> mapb = map.get(obj.getCity());
if(mapb==null){
mapb = new HashMap<String, String>();
map.put(obj.getCity(), mapb);
}
mapb.put(obj.getId(), obj.getName());
}
}
return map;
} catch (Exception e) {
e.printStackTrace();
LOG.error(e.getMessage(), e);
throw new Exception(e.getMessage());
}
}
}
@@ -0,0 +1,670 @@
package abacus.springboot.example.impl;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import abacus.springboot.example.dao.JcBill;
import abacus.springboot.example.dao.JcBillHg;
import abacus.springboot.example.dao.JcBillPhoto;
import abacus.springboot.example.dao.JcBillSourceItem;
import abacus.springboot.example.dao.JcSourceItem;
import abacus.springboot.example.pi.JcBillAccessIF;
import abacus.springboot.example.util.DateUtil;
import abacus.springboot.example.vo.BaiduToken;
import abacus.springboot.example.vo.SiDepositlocation;
/**
* <p>Title:ApiJcBillAccess</p>
<p>Description: 底层实现</p>
@author chuanZeng
@date 2026年8月18日
*/
@Repository
public class JcBillAccess extends MyJpaUtils implements JcBillAccessIF {
private static final Logger LOG = LoggerFactory.getLogger(JcBillAccess.class);
@Autowired
private JdbcTemplate jdbcTemplate;
@PersistenceContext
private EntityManager em;
@Override
public List<JcBillPhoto> queryJcBillPhoto(String srcid, String srcitemid, String typephoto)
throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
List<Object> args = new ArrayList<Object>();
StringBuffer sb = new StringBuffer("select id, version, srcid, srcitemid, typephoto, urlphoto, dt from jc_bill_photo a");
if(StringUtils.isNotBlank(srcid)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.srcid = ? ");
args.add(srcid);
params.put("srcid", srcid);
}
if(StringUtils.isNotBlank(srcitemid)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.srcitemid = ? ");
args.add(srcitemid);
params.put("srcitemid", srcitemid);
}
if(StringUtils.isNotBlank(typephoto)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.typephoto = ? ");
args.add(typephoto);
params.put("typephoto", typephoto);
}
LOG.info("queryJcBillPhoto>>>SQL>>>{}", sb.toString());
List<JcBillPhoto> lists = jdbcTemplate.query( sb.toString(), args.toArray(), new BeanPropertyRowMapper<JcBillPhoto>(JcBillPhoto.class));
return lists;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
public List<JcBillPhoto> queryJcBillPhotoIn(List<String> srcids) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
List<Object> args = new ArrayList<Object>();
StringBuffer sb = new StringBuffer("select id, version, srcid, srcitemid, typephoto, urlphoto, dt from jc_bill_photo a");
if(srcids != null && srcids.size() >= 1) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.srcid in (");
for(int i = 0; i < srcids.size(); i++){
if(i > 0) sb.append(",");
sb.append("?");
args.add(srcids.get(i));
}
sb.append(") ");
}
LOG.info("queryJcBillPhotoIn>>>SQL>>>{}", sb.toString());
List<JcBillPhoto> lists = jdbcTemplate.query( sb.toString(), args.toArray(), new BeanPropertyRowMapper<JcBillPhoto>(JcBillPhoto.class));
return lists;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public void updateJcBill(JcBill bill) throws RuntimeException {
try {
List<Object> args = new ArrayList<Object>();
StringBuffer sql = new StringBuffer(" update jc_bill ");
sql.append(" set status = ?,");
sql.append(" warehouse = ?,");
sql.append(" warehousename = ?,");
sql.append(" receivedt = ?,");
sql.append(" quantity = ?,");
sql.append(" subtotal = ?,");
sql.append(" applicant = ?,");
sql.append(" applicantname = ?,");
sql.append(" applicantdt = ?");
sql.append(" where id = ?");
args.add(bill.getStatus());
args.add(bill.getWarehouse());
args.add(bill.getWarehousename());
args.add(bill.getReceivedt());
args.add(bill.getQuantity());
args.add(bill.getSubtotal());
args.add(bill.getApplicant());
args.add(bill.getApplicantname());
args.add(DateUtil.formatDateTime(bill.getApplicantdt()));
args.add(bill.getId());
this.jdbcTemplate.update(sql.toString(), args.toArray());
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public void updateJcBillSourceItem(List<JcBillSourceItem> items) throws RuntimeException {
try {
String sql = "update jc_billsource_item set recsource = ?, recplatform = ?, channel = ?, price = ?, quantity = ?,"
+ " numbers = ?, subtotal = ?, goodsid = ?, logisticsid = ?"
+ " where id = ?";
this.jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
public void setValues(PreparedStatement ps, int i) throws SQLException {
JcBillSourceItem item = items.get(i);
ps.setString(1, item.getRecsource());
ps.setString(2, item.getRecplatform());
ps.setString(3, item.getChannel());
ps.setDouble(4, item.getPrice());
ps.setDouble(5, item.getQuantity());
ps.setDouble(6, item.getNumbers());
ps.setDouble(7, item.getSubtotal());
ps.setString(8, item.getGoodsid());
ps.setString(9, item.getLogisticsid());
ps.setLong(10, item.getId());
}
public int getBatchSize() {
return items.size();
}
});
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public void updateJcBillPhoto(List<JcBillPhoto> photos) throws RuntimeException {
try {
String sql = "update jc_bill_photo set urlphoto = ?, dt = ? where srcid = ? and srcitemid = ? and typephoto = ?";
this.jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
public void setValues(PreparedStatement ps, int i) throws SQLException {
JcBillPhoto item = photos.get(i);
ps.setString(1, item.getUrlphoto());
ps.setDate(2, new java.sql.Date(item.getDt().getTime()));
ps.setString(3, item.getSrcid());
ps.setString(4, item.getSrcitemid());
ps.setString(5, item.getTypephoto());
}
public int getBatchSize() {
return photos.size();
}
});
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public int countJcBillItemIndexno(String billId) throws RuntimeException {
try {
StringBuffer sb = new StringBuffer(" select max(indexno) from jc_billsource_item a where a.billid = ?");
Query q = this.em.createNativeQuery(sb.toString()).setParameter(1, billId);
return q.getSingleResult() == null ? 0 : Integer.valueOf(q.getSingleResult().toString());
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public String lastBillHgId() throws RuntimeException {
try {
StringBuffer sb = new StringBuffer(" select top 1 id from jc_billhg a where a.status = 1 order by founddt asc ");
List<JcBill> lists = jdbcTemplate.query(sb.toString(), new BeanPropertyRowMapper<JcBill>(JcBill.class));
return (lists != null && lists.size() >= 1) ? lists.get(0).getId() : "";
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public List<JcSourceItem> queryJcSourceItemByBillId(String billId) {
try {
Map<String,Object> params = new HashMap<String, Object>();
List<Object> args = new ArrayList<Object>();
StringBuffer sb = new StringBuffer("select id, version, indexno, billid, srcitemid,");
sb.append(" goodsid, logisticsid, billout, billoutdt, billoutwh,");
sb.append(" billoutwhname, product, productname, account, accountname,");
sb.append(" operator, operatorname, groupid, groupname, salearea,");
sb.append(" saleareaname, source, dt");
sb.append(" from jc_source_item a");
if(StringUtils.isNotBlank(billId)) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.billid = ? ");
args.add(billId);
params.put("billId", billId);
}
LOG.info("queryJcSourceItemByBillId>>>SQL>>>{}", sb.toString());
List<JcSourceItem> lists = jdbcTemplate.query( sb.toString(), args.toArray(), new BeanPropertyRowMapper<JcSourceItem>(JcSourceItem.class));
return lists;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public void deleteJcSourceItemBySource(String billId) throws RuntimeException {
try {
StringBuffer sb = new StringBuffer(" delete from jc_source_item where billid = ? and source in ('业务中台', '二维码')");
LOG.info("deleteJcSourceItemBySource>>>SQL>>>{}", sb.toString());
jdbcTemplate.update(sb.toString(), billId);
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public Page<JcBill> queryJcBill(String fromDate, String thruDate, String applicant, String goods, String id,
String billin, String goodsid, String product, String status, int typ, Pageable pageable) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
List<Object> args = new ArrayList<Object>();
StringBuffer sb = new StringBuffer("");
if(StringUtils.isNotBlank(fromDate)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.applicantdt >= ? ");
args.add(fromDate);
params.put("fromDate", fromDate);
}
if(StringUtils.isNotBlank(thruDate)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.applicantdt <= ? ");
args.add(thruDate);
params.put("thruDate", thruDate);
}
if(StringUtils.isNotBlank(applicant)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.applicant = ? ");
args.add(applicant);
params.put("applicant", applicant);
}
if(StringUtils.isNotBlank(goods)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.goods = ? ");
args.add(goods);
params.put("goods", goods);
}
if(StringUtils.isNotBlank(id)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.id = ? ");
args.add(id);
params.put("id", id);
}
if(StringUtils.isNotBlank(billin)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.billin = ? ");
args.add(billin);
params.put("billin", billin);
}
if(StringUtils.isNotBlank(status)) {
if(typ == 1) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.status = ? ");
args.add(Integer.parseInt(status));
params.put("status", Integer.parseInt(status));
} else {
if("1".equals(status) || "2".equals(status)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.hgstatus = ? ");
args.add(Integer.parseInt(status));
params.put("hgstatus", Integer.parseInt(status));
} else {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.status = ? ");
args.add(Integer.parseInt(status));
params.put("status", Integer.parseInt(status));
}
}
}else {
if(typ == 1) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.status in (-3, -2, 2, 3, 4, 5) ");
params.put("status", status);
} else {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" (a.status in (3, 4, 5) or a.hgstatus in (1, 2))");
params.put("status", status);
}
}
if(StringUtils.isNotBlank(goodsid)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.id in (select b.billid from jc_billsource_item b where b.goods like ? ) ");
args.add("%" + goodsid + "%");
params.put("goodsid", goodsid);
}
if(StringUtils.isNotBlank(product)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.id in (select b.billid from jc_billsource_item b where b.product = ? ) ");
args.add(product);
params.put("product", product);
}
StringBuffer orderBy = new StringBuffer("");
orderBy.append(" order by dt desc ");
orderBy.append(" offset "+ (pageable.getPageNumber() * pageable.getPageSize()) + " rows fetch next "+ pageable.getPageSize() + " rows only ");
StringBuffer sql = new StringBuffer("select id, version, status, hgstatus, goods, warehouse, warehousename,");
sql.append(" receivedt, quantity, subtotal, billin, billindt, applicant, applicantname, applicantdt, dt");
sql.append(" from jc_bill a ");
sql.append(sb.toString());
sql.append(orderBy.toString());
LOG.info("queryJcBill>>>SQL>>>{}", sql.toString());
List<JcBill> lists = jdbcTemplate.query(sql.toString(), args.toArray(), new BeanPropertyRowMapper<JcBill>(JcBill.class));
Long count = jdbcTemplate.queryForObject("select count(a.id) from jc_bill a " + sb.toString(), args.toArray(), Long.class);
Page<JcBill> scorePage = new PageImpl<JcBill>(lists, pageable, count);
return scorePage;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public void saveEvent(String srcid, String typ, String billtyp) throws RuntimeException {
try {
String sql="insert into si_siwdevent(srcid, typ, billtyp, deptid, stauts,"
+ " node, remake, dt, inputdate)"
+ " values (?, ?, ?, ?, ?,"
+ " ?, ?, ?, ?) ";
Query query = em.createNativeQuery(sql);
query.setParameter(1, srcid);
query.setParameter(2, typ);
query.setParameter(3, billtyp);
query.setParameter(4, "");
query.setParameter(5, 0);
query.setParameter(6, 0);
query.setParameter(7, "");
query.setParameter(8, new Date());
query.setParameter(9, new Date());
query.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public Page<JcBillHg> queryJcBillHg(String fromDate, String thruDate, String account, String salearea, String id,
String billId, String status, String product, String manager, int typ, Pageable pageable)
throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
List<Object> args = new ArrayList<Object>();
StringBuffer sb = new StringBuffer("");
if(StringUtils.isNotBlank(fromDate)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.founddt >= ? ");
args.add(fromDate);
params.put("fromDate", fromDate);
}
if(StringUtils.isNotBlank(thruDate)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.founddt <= ? ");
args.add(thruDate);
params.put("thruDate", thruDate);
}
if(StringUtils.isNotBlank(account)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.account = ? ");
args.add(account);
params.put("account", account);
}
if(StringUtils.isNotBlank(salearea)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.salearea = ? ");
args.add(salearea);
params.put("salearea", salearea);
}
if(StringUtils.isNotBlank(id)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.id = ? ");
args.add(id);
params.put("id", id);
}
if(StringUtils.isNotBlank(billId)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.billid = ? ");
args.add(billId);
params.put("billId", billId);
}
if(StringUtils.isNotBlank(status)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.status = ? ");
args.add(Integer.parseInt(status));
params.put("status", Integer.parseInt(status));
} else {
if(typ == 1) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.status in (1, 2, 3) ");
params.put("status", status);
} else {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.status in (4, 5, 6) ");
params.put("status", status);
}
}
if(StringUtils.isNotBlank(product)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.id in (select b.billhg from jc_billin_item b where b.product = ? ) ");
args.add(product);
params.put("product", product);
}
if(StringUtils.isNotBlank(manager)) {
sb.append(params.size() > 0 ? " and ":" where ");
sb.append(" a.manager = ? ");
args.add(manager);
params.put("manager", manager);
}
StringBuffer orderBy = new StringBuffer("");
orderBy.append(" order by founddt desc ");
orderBy.append(" offset "+ (pageable.getPageNumber() * pageable.getPageSize()) + " rows fetch next "+ pageable.getPageSize() + " rows only ");
StringBuffer sql = new StringBuffer("select id, version, billid, status, source,");
sql.append(" account, accountname, quantity, subtotal, freight,");
sql.append(" manager, managername, consignee, consigneephone, province,");
sql.append(" provincename, city, cityname, area, areaname,");
sql.append(" address, receiveway, remark, remark1, salearea,");
sql.append(" saleareaname, groupid, groupname, logisticsname, logisticscode,");
sql.append(" logisticstype, logisticsno, found, foundname,");
sql.append(" founddt, submit, submitname, submitdt, audit,");
sql.append(" auditname, auditdt, dt, fhwarehouse, fhwarehousename,");
sql.append(" wdtorder, wdtbillout, wdtbillouttyp");
sql.append(" ,(select b.status from jc_bill b where b.id = a.billid ) as jcstatus");
sql.append(" from jc_billhg a");
sql.append(sb.toString());
sql.append(orderBy.toString());
LOG.info("queryJcBillHg>>>SQL>>>{}", sb.toString());
List<JcBillHg> lists = jdbcTemplate.query(sql.toString(), args.toArray(), new BeanPropertyRowMapper<JcBillHg>(JcBillHg.class));
Long count = jdbcTemplate.queryForObject("select count(a.id) from jc_billhg a " + sb.toString(), args.toArray(), Long.class);
Page<JcBillHg> scorePage = new PageImpl<JcBillHg>(lists, pageable, count);
return scorePage;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public void deleteJcSourceItem(List<Long> ids) throws RuntimeException {
if(ids==null||ids.isEmpty()) return;
for(int i=0;i<ids.size();i+=500){
int end=(i+500)>ids.size()?ids.size():(i+500);
em.createNativeQuery("delete from jc_source_item where id in (:ids) ").setParameter("ids", ids.subList(i, end)).executeUpdate();
}
}
@Override
public void deleteJcBillPhoto(String srcid, String srcitemid, String type) throws RuntimeException {
try {
StringBuffer sb = new StringBuffer(" delete from jc_bill_photo where"
+ " srcid = ?"
// + " and srcitemid = ?"
+ " and typephoto = ?");
LOG.info("deleteJcBillPhoto>>>SQL>>>{}", sb.toString());
jdbcTemplate.update(sb.toString(), srcid, type);
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public String getBaiduToken() throws RuntimeException {
try {
StringBuffer sb = new StringBuffer("select token from si_baidu_token");
List<BaiduToken> lists = jdbcTemplate.query(sb.toString(), new BeanPropertyRowMapper<BaiduToken>(BaiduToken.class));
return (lists != null && lists.size() >= 1) ? lists.get(0).getToken() : "";
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public List<JcBillSourceItem> queryJcBillSourceItemInBillId(List<String> billIds) throws RuntimeException {
try {
Map<String,Object> params = new HashMap<String, Object>();
List<Object> args = new ArrayList<Object>();
StringBuffer sb = new StringBuffer(" select billid, status, recsource, recplatform, channel ");
sb.append(" from jc_billsource_item a ");
if(billIds != null && billIds.size() >= 1) {
sb.append(params.size() > 0 ?" and ":" where ");
sb.append(" a.billid in (");
for(int i = 0; i < billIds.size(); i++){
if(i > 0) sb.append(",");
sb.append("?");
args.add(billIds.get(i));
}
sb.append(") ");
}
LOG.info("queryJcBillSourceItemInBillId>>>SQL>>>{}", sb.toString());
List<JcBillSourceItem> lsit = jdbcTemplate.query(sb.toString(), args.toArray(), new BeanPropertyRowMapper<JcBillSourceItem>(JcBillSourceItem.class));
return lsit;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public SiDepositlocation querySiDepositlocation(String srcid) throws Exception {
try {
List<Object> args = new ArrayList<Object>();
StringBuffer sb = new StringBuffer("select a.id, a.push from wms_depositlocation a");
sb.append(" where a.id in (select d.physicaldept from dept d where d.id in");
sb.append(" (select c.warehouse from jc_bill c where c.id = ?))");
args.add(srcid);
LOG.info("querySiDepositlocation>>>SQL>>>{}", sb.toString());
List<SiDepositlocation> lists = jdbcTemplate.query( sb.toString(), args.toArray(), new BeanPropertyRowMapper<SiDepositlocation>(SiDepositlocation.class));
return (lists != null && lists.size() >= 1) ? lists.get(0) : null;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public SiDepositlocation querySiDepositlocationHGfc(String srcid) throws Exception {
try {
List<Object> args = new ArrayList<Object>();
StringBuffer sb = new StringBuffer("select a.id, a.push from wms_depositlocation a");
sb.append(" where a.id in (select d.physicaldept from dept d where d.id in");
sb.append(" (select c.fhwarehouse from jc_billhg c where c.id = ?))");
args.add(srcid);
LOG.info("querySiDepositlocationHGfc>>>SQL>>>{}", sb.toString());
List<SiDepositlocation> lists = jdbcTemplate.query( sb.toString(), args.toArray(), new BeanPropertyRowMapper<SiDepositlocation>(SiDepositlocation.class));
return (lists != null && lists.size() >= 1) ? lists.get(0) : null;
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
@Override
public void deleteEvent(String srcid, String typ, String billtyp) throws RuntimeException {
try {
String sql="delete from si_siwdevent where srcid = ? and typ = ? and billtyp = ?";
Query query = em.createNativeQuery(sql);
query.setParameter(1, srcid);
query.setParameter(2, typ);
query.setParameter(3, billtyp);
query.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
}
@@ -0,0 +1,22 @@
package abacus.springboot.example.impl;
import java.util.Map;
import javax.persistence.Query;
public class MyJpaUtils {
/**
* 给hql参数设置值
*
* @param query 查询
* @param params 参数
*/
public void setParameters(Query query, Map<String, Object> params) {
for (Map.Entry<String, Object> entry : params.entrySet()) {
query.setParameter(entry.getKey(), entry.getValue());
}
}
}
@@ -0,0 +1,200 @@
package abacus.springboot.example.pi;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import abacus.springboot.example.api.view.ApiBillHg;
import abacus.springboot.example.api.view.ApiBillHgItem;
import abacus.springboot.example.api.view.ApiBillHgPayment;
import abacus.springboot.example.api.view.ApiJcBill;
import abacus.springboot.example.api.view.ApiJcBillHgSearchItem;
import abacus.springboot.example.api.view.ApiJcBillItem;
import abacus.springboot.example.api.view.ApiJcBillSearch;
import abacus.springboot.example.api.view.JcBillCount;
import abacus.springboot.example.api.view.JcCodeFlow;
import abacus.springboot.example.api.view.JcProduct;
import abacus.springboot.example.api.view.JcProductBillSouce;
import abacus.springboot.example.dao.JcBillHg;
/**
* <p>Title:ApiJcBillAccess</p>
<p>Description: 底层实现-interface</p>
@author chuanZeng
@date 2026年8月18日
*/
public interface ApiJcBillAccessIF {
/**
* 稽查收货查询
* @param keyword
* @param status
* @param pageable
* @return
* @throws RuntimeException
*/
public Page<ApiJcBillSearch> queryApiJcBillSearch(String keyword, String employee, String status, Pageable pageable) throws RuntimeException;
/**
* 稽查收货主单查询
* @param id
* @return
* @throws RuntimeException
*/
public ApiJcBill queryApiJcBillById(String id) throws RuntimeException;
/**
* 稽查收货明细
* @param billId
* @return
* @throws RuntimeException
*/
public List<ApiJcBillItem> queryApiJcBillItemByBIllId(String billId) throws RuntimeException;
/**
* 回购列表查询
* @param keyword
* @param status
* @param pageable
* @return
* @throws RuntimeException
*/
public Page<ApiJcBillHgSearchItem> queryApiJcBillHgSearchItem(String keyword, String employee, String status, Pageable pageable) throws RuntimeException;
/**
* 回购;查询品种和件数汇总
* @param ids
* @return
* @throws RuntimeException
*/
public List<JcBillCount> queryJcBillCount(List<String> ids) throws RuntimeException;
/**
* 回购:主单查询
* @param id
* @return
* @throws RuntimeException
*/
public ApiBillHg queryApiBillHgById(String hgId) throws RuntimeException;
/**
* 回购:明细查询
* @param billId
* @return
* @throws RuntimeException
*/
public List<ApiBillHgItem> queryApiBillHgItemByHgId(String hgId) throws RuntimeException;
/**
* 回购:支付明细查询
* @param billId
* @return
* @throws RuntimeException
*/
public List<ApiBillHgPayment> queryApiBillHgPaymentByHgId(String hgId) throws RuntimeException;
public List<ApiBillHgPayment> queryApiBillHgPaymentByHgId(List<String> hgIds) throws RuntimeException;
/**
* 根据物流码,查询出库相关信息
* @param code
* @return
* @throws RuntimeException
*/
public List<JcCodeFlow> queryJcCodeFlow(List<String> codes) throws RuntimeException;
/**
* 稽查货品查询-单号查询
* @param product
* @param stockInId
* @param hgId
* @return
* @throws RuntimeException
*/
public List<JcProduct> queryJcProduct(String product, String stockInId, String hgId) throws RuntimeException;
/**
* 稽查货品查询-单号查询
* @param product
* @param stockInId
* @param hgId
* @return
* @throws RuntimeException
*/
public List<JcProduct> queryJcProduct(String product, String stockInId) throws RuntimeException;
/**
* 根据稽查单号,查询对应的货品编号
* @param billIds
* @return
* @throws RuntimeException
*/
public List<JcProductBillSouce> queryJcProductBillSouce(List<String> billIds)throws RuntimeException;
public List<JcBillHg> qeryJcBillHgs(List<String> billids) throws RuntimeException;
}
@@ -0,0 +1,121 @@
package abacus.springboot.example.pi;
import java.util.List;
import java.util.Map;
import com.abacus.pms.dao.Account;
import com.abacus.pms.dao.Brand;
import com.abacus.pms.dao.MoreCategory;
import com.abacus.pms.dao.Product;
import com.abacus.pms.dao.Spec;
import com.abacus.xpos.foundation.dao.Dept;
import com.abacus.xpos.foundation.dao.Employee;
import abacus.config.dao.AbacusConfigItem;
import abacus.springboot.example.dao.JcBill;
/**
* <p>Title:ApiJcBillAccess</p>
<p>Description: 底层实现-interface</p>
@author chuanZeng
@date 2026年8月18日
*/
public interface AutoCompleteAccessIF {
/**
* 检索:商品
* @param keyCode
* @return
* @throws Exception
*/
public List<Product> prductAutoComplete(String keyCode, List<String> areaIds) throws Exception;
/**
* 检索:门店
* @param keycode
* @param type
* @return
* @throws Exception
*/
public List<Dept> deptAutoComplete(String keyCode, String type) throws Exception;
/**
* 检索:分类
* @param keycode
* @param type
* @return
* @throws Exception
*/
public List<MoreCategory> moreCategoryAutoComplete(String keyCode, String areaid, String levels, String lastlevel) throws Exception;
/**
* 检索:品牌
* @return
* @throws Exception
*/
public List<Brand> brandAutoComplete(String keyCode, String areaid, String levels, String lastlevel) throws Exception;
/**
* 检索:商品标签
* @param keyCode
* @param areaid
* @param lastlevel
* @return
* @throws Exception
*/
public List<Spec> specAutoComplete(String keyCode, String areaid) throws Exception;
/**
* 检索:客户
* @param keyCode
* @param areaid
* @return
* @throws Exception
*/
public List<Account> accountAutoComplete(String keyCode, String areaid) throws Exception;
/**
* 检索:员工
* @param keyCode
* @param areaid
* @return
* @throws Exception
*/
public List<Employee> employeeAutoComplete(String keyCode) throws Exception;
/**
* 检索:稽查单号
* @param keyCode
* @param areaid
* @return
* @throws Exception
*/
public List<JcBill> jcBillAutoComplete(String keyCode) throws Exception;
/**
* 检索:收货仓库
* @param keyCode
* @return
* @throws Exception
*/
public List<AbacusConfigItem> abacusConfigItemGroupAutoComplete(String keyCode, String keyGroup, String key) throws Exception;
/** 查询区域 */
public Map<String,Map<String,String>> getGovbs() throws Exception;
}
@@ -0,0 +1,268 @@
package abacus.springboot.example.pi;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import abacus.springboot.example.dao.JcBill;
import abacus.springboot.example.dao.JcBillHg;
import abacus.springboot.example.dao.JcBillPhoto;
import abacus.springboot.example.dao.JcBillSourceItem;
import abacus.springboot.example.dao.JcSourceItem;
import abacus.springboot.example.vo.SiDepositlocation;
/**
* <p>Title:ApiJcBillAccess</p>
<p>Description: 底层实现-interface</p>
@author chuanZeng
@date 2026年8月18日
*/
public interface JcBillAccessIF {
/**
* 根据条件查询图片
* @param srcid
* @param srcitemid
* @param typephoto
* @return
* @throws RuntimeException
*/
public List<JcBillPhoto> queryJcBillPhoto(String srcid, String srcitemid, String typephoto) throws RuntimeException;
public List<JcBillPhoto> queryJcBillPhotoIn(List<String> srcids) throws RuntimeException;
/**
* 修改
* @throws RuntimeException
*/
public void updateJcBill(JcBill bill) throws RuntimeException;
/**
* 修改
* @throws RuntimeException
*/
public void updateJcBillSourceItem(List<JcBillSourceItem> items) throws RuntimeException;
/**
* 修改
* @param photos
* @throws RuntimeException
*/
public void updateJcBillPhoto(List<JcBillPhoto> photos) throws RuntimeException;
/**
* 当前明细行号
* @param billId
* @return
* @throws RuntimeException
*/
public int countJcBillItemIndexno(String billId) throws RuntimeException;
/**
* 查询:下一单待提交的回购单号
* @return
* @throws RuntimeException
*/
public String lastBillHgId() throws RuntimeException;
/**
* 查询朔源明细
* @param billId
* @return
*/
public List<JcSourceItem> queryJcSourceItemByBillId(String billId);
/**
* 删除特定的来源
* @param billId
* @throws RuntimeException
*/
public void deleteJcSourceItemBySource(String billId) throws RuntimeException;
/**
* 界面查询
* @param fromDate
* @param thruDate
* @param applicant
* @param goods
* @param id
* @param billin
* @param goodsid
* @param product
* @param status
* @param pageable
* @return
* @throws RuntimeException
*/
public Page<JcBill> queryJcBill(String fromDate, String thruDate, String applicant,
String goods, String id, String billin, String goodsid, String product, String status,
int typ, Pageable pageable) throws RuntimeException;
/**
* 保存事件
* @return
* @throws RuntimeException
*/
public void saveEvent(String srcid, String typ, String billtyp) throws RuntimeException;
/**
* 分页查询 回购订单
* @param typ 1-回购认款,2-回购分仓
* @return
* @throws RuntimeException
*/
public Page<JcBillHg> queryJcBillHg(String fromDate, String thruDate, String account,
String salearea, String id, String billId, String status, String product,
String manager,
int typ, Pageable pageable) throws RuntimeException;
/**
* 删除溯源明细信息
* @param ids
* @throws RuntimeException
*/
public void deleteJcSourceItem(List<Long> ids) throws RuntimeException;
/**
* 删除溯源明细图片
* @param ids
* @throws RuntimeException
*/
public void deleteJcBillPhoto(String srcid, String srcitemid, String type) throws RuntimeException;
/**
* 获取百度token
* @return
* @throws RuntimeException
*/
public String getBaiduToken() throws RuntimeException;
public List<JcBillSourceItem> queryJcBillSourceItemInBillId(List<String> billIds) throws RuntimeException;
/**
* 稽查:根据稽查单号,稽查单关联物理仓管理策略
* @param dept
* @return
* @throws Exception
*/
public SiDepositlocation querySiDepositlocation(String srcid) throws Exception;
/**
* 回购:根据回购单号,回购单关联物理仓管理策略
* @param dept
* @return
* @throws Exception
*/
public SiDepositlocation querySiDepositlocationHGfc(String srcid) throws Exception;
/**
* 删除事件
* @param srcid
* @param typ
* @param billtyp
* @throws RuntimeException
*/
public void deleteEvent(String srcid, String typ, String billtyp) throws RuntimeException;
}
@@ -0,0 +1,20 @@
package abacus.springboot.example.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import abacus.springboot.example.dao.JcBillHgPay;
/**
* <p>Title:ApiJcBillAccess</p>
<p>Description: Repository</p>
@author chuanZeng
@date 2026年8月18日
*/
public interface JcBillHgPayRepository extends JpaRepository<JcBillHgPay, Long>,JpaSpecificationExecutor<JcBillHgPay> {
List<JcBillHgPay> findByBillhg(String billhg);
}
@@ -0,0 +1,14 @@
package abacus.springboot.example.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import abacus.springboot.example.dao.JcBillHg;
public interface JcBillHgRepository extends JpaRepository<JcBillHg, String>,JpaSpecificationExecutor<JcBillHg> {
List<JcBillHg> findByBillid(String billid);
}
@@ -0,0 +1,18 @@
package abacus.springboot.example.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import abacus.springboot.example.dao.JcBillInItem;
public interface JcBillInItemRepository extends JpaRepository<JcBillInItem, Long>,JpaSpecificationExecutor<JcBillInItem> {
List<JcBillInItem> findByBillid(String billid);
List<JcBillInItem> findByBillidAndStatus(String billid, int status);
List<JcBillInItem> findByBillhg(String billhg);
}
@@ -0,0 +1,16 @@
package abacus.springboot.example.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import abacus.springboot.example.dao.JcBillPhoto;
public interface JcBillPhotoRepository extends JpaRepository<JcBillPhoto, Long>,JpaSpecificationExecutor<JcBillPhoto> {
JcBillPhoto findBySrcidAndSrcitemidAndTypephoto(String srcid, String srcitemid, String typephoto);
void deleteBySrcidAndSrcitemid(String srcid, String srcitemid);
void deleteBySrcidAndTypephoto(String srcid, String typephoto);
void deleteBySrcidAndSrcitemidAndTypephoto(String srcid, String srcitemid, String typephoto);
}
@@ -0,0 +1,11 @@
package abacus.springboot.example.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import abacus.springboot.example.dao.JcBill;
public interface JcBillRepository extends JpaRepository<JcBill, String>,JpaSpecificationExecutor<JcBill> {
}
@@ -0,0 +1,15 @@
package abacus.springboot.example.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import abacus.springboot.example.dao.JcBillSourceItem;
public interface JcBillSourceItemRepository extends JpaRepository<JcBillSourceItem, Long>,JpaSpecificationExecutor<JcBillSourceItem> {
List<JcBillSourceItem> findByBillid(String billid);
void deleteByBillid(String billid);
}
@@ -0,0 +1,15 @@
package abacus.springboot.example.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import abacus.springboot.example.dao.JcSourceItem;
public interface JcSourceItemRepository extends JpaRepository<JcSourceItem, Long>,JpaSpecificationExecutor<JcSourceItem> {
List<JcSourceItem> findByBillidAndSrcitemid(String billid, String srcitemid);
List<JcSourceItem> findByBillidAndSrcitemidAndStatus(String billid, String srcitemid, int status);
}
@@ -0,0 +1,143 @@
package abacus.springboot.example.util;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* <p>Title:DateToUpperChinese</p>
<p>Description: 日期转成中文大写形式</p>
@author chuanZeng
@date 2026年8月18日
*/
public class DateToUpperChinese {
private static final String[] NUMBERS = {"", "", "", "", "", "",
"", "", "", ""};
/**
* 通过 yyyy-MM-dd 得到中文大写格式 yyyy MM dd 日期
*/
public static synchronized String toChinese(String str) {
StringBuffer sb = new StringBuffer();
sb.append(getSplitDateStr(str, 0)).append(" ").append(
getSplitDateStr(str, 1)).append(" ").append(
getSplitDateStr(str, 2));
return sb.toString();
}
/**
* 分别得到年月日的大写 默认分割符 "-"
*/
public static String getSplitDateStr(String str, int unit) {
// unit是单位 0=年 1=月 2日
String[] DateStr = str.split("-");
if (unit > DateStr.length)
unit = 0;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < DateStr[unit].length(); i++) {
if ((unit == 1 || unit == 2) && Integer.valueOf(DateStr[unit]) > 9) {
sb.append(convertNum(DateStr[unit].substring(0, 1)))
.append("").append(
convertNum(DateStr[unit].substring(1, 2)));
break;
} else {
sb.append(convertNum(DateStr[unit].substring(i, i + 1)));
}
}
if (unit == 1 || unit == 2) {
return sb.toString().replaceAll("^壹", "").replace("", "");
}
return sb.toString();
}
/**
* 转换数字为大写
*/
private static String convertNum(String str) {
return NUMBERS[Integer.valueOf(str)];
}
public final static char[] upper = "零一二三四五六七八九十".toCharArray();
/**
* 根据小写数字格式的日期转换成大写格式的日期
* @param date
* @return
*/
public static String getUpperDate(Date datez) {
//支持yyyy-MM-dd、yyyy/MM/dd、yyyyMMdd等格式
if(datez == null) return null;
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.format(datez);
//非数字的都去掉
date = date.replaceAll("\\D", "");
if(date.length() != 8) return null;
StringBuilder sb = new StringBuilder();
for (int i=0;i<4;i++) {//年
sb.append(upper[Integer.parseInt(date.substring(i, i+1))]);
}
sb.append("");//拼接年
int month = Integer.parseInt(date.substring(4, 6));
if(month <= 10) {
sb.append(upper[month]);
} else {
sb.append("").append(upper[month%10]);
}
sb.append("");//拼接月
int day = Integer.parseInt(date.substring(6));
if (day <= 10) {
sb.append(upper[day]);
} else if(day < 20) {
sb.append("").append(upper[day % 10]);
} else {
sb.append(upper[day / 10]).append("");
int tmp = day % 10;
if (tmp != 0) sb.append(upper[tmp]);
}
sb.append("");//拼接日
return sb.toString();
}
/**
* 判断是否是零或正整数
*/
public static boolean isNumeric(String str) {
Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(str);
if (!isNum.matches()) {
return false;
}
return true;
}
public static void main(String args[]) {
System.out.println(getUpperDate(new Date()));
double d = 1000.0000;
String str = String.valueOf(d);
if(str.indexOf(".") > 0) {
str = str.replace("0+?$", "");// 删除掉尾数为0的字符
str = str.replace("[.]$", "");// 结尾如果是小数点,则去掉
}
System.out.println(str);
// System.out.println(dStr.replace("\\.0*$", ""));
}
}
@@ -0,0 +1,883 @@
package abacus.springboot.example.util;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import com.alibaba.fastjson.JSON;
/**
* Title: 日期时间 Description: 工具类
*
* @author xuelin chen
* @version 1.0
*/
public class DateUtil {
/** 本地化 */
private static Locale locale = Locale.SIMPLIFIED_CHINESE;
/** 缺省的DateFormat对象,可以将一个java.util.Date格式化成 yyyy-mm-dd 输出 */
private static DateFormat dateDF = new SimpleDateFormat("yyyy-MM-dd");
/** 缺省的DateFormat对象,可以将一个java.util.Date格式化成 HH:SS:MM 输出 */
private static DateFormat timeDF = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale);
/** 缺省的DateFormat对象,可以将一个java.util.Date格式化成 yyyy-mm-dd HH:SS:MM 输出 */
// private static DateFormat datetimeDF = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, locale);
private static DateFormat datetimeDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static DateFormat fdt = new SimpleDateFormat("yyyyMMddHHmmss");
private static DateFormat fdtsss = new SimpleDateFormat("yyyyMMddHHmmssSSS");
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
/**
* 私有构造函数,表示不可实例化
*/
private DateUtil() {
}
/**
* 将任意时间生成为当天的第一秒 如:2013-10-23 0:12:12 生成为 2013-10-23 00:00:00
* @param from 时间对象
* @return
*/
public static Date getFromDate(Date from) {
if (from == null) {
return null;
}
Calendar cal = Calendar.getInstance();
cal.clear();
cal.setTime(new Date(from.getTime()));
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTime();
}
/**
* 将任意时间生成为当天的最后一秒 如:2013-10-23 0:12:12 生成为 2013-10-23 23:59:59
* @param thru 时间对象
* @return
*/
public static Date getThruDate(Date thru) {
if (thru == null) {
return null;
}
Calendar cal = Calendar.getInstance();
cal.clear();
cal.setTime(new Date(thru.getTime()));
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
cal.set(Calendar.MILLISECOND, 998);
return cal.getTime();
}
/**
* 时间减去几个小时
* @param dateStart
* @param num
* @return dateStart-num
*/
public static java.util.Date nowDateMinusHour(java.util.Date dateStart, int num) {
try {
Calendar cal = Calendar.getInstance();
cal.setTime(dateStart);
cal.add(Calendar.HOUR_OF_DAY, -num);
return cal.getTime();
} catch (Exception ex) {
return null;
}
}
/**
* 时间减几分钟
* @param dateStart
* @param num
* @return
*/
public static java.util.Date nowDateMinusTime(java.util.Date dateStart, int num) {
try {
Calendar cal = Calendar.getInstance();
cal.setTime(dateStart);
cal.add(Calendar.MINUTE, -num);
return cal.getTime();
} catch (Exception ex) {
return null;
}
}
/** 返回当前日期格式 yyyyMMddHHmmss*/
public static String getDateFormat(Date date) {
if (date == null)
date = new Date();
return fdt.format(date);
}
public static String getDateFormatsss(Date date) {
if (date == null)
date = new Date();
return fdtsss.format(date);
}
/**
* 返回一个当前的时间,并按格式转换为字符串 例:17:27:03
*
* @return String
*/
public static String getTime() {
GregorianCalendar gcNow = new GregorianCalendar();
java.util.Date dNow = gcNow.getTime();
return timeDF.format(dNow);
}
/**
* 返回一个当前日期,并按格式转换为字符串 例:2009-12-12
*
* @return String
*/
public static String getDate() {
GregorianCalendar gcNow = new GregorianCalendar();
java.util.Date dNow = gcNow.getTime();
return dateDF.format(dNow);
}
/**
* 返回一个当前日期和时间,并按格式转换为字符串 例:2009-12-08 14:27:03
*
* @return String
*/
public static String getDateTime() {
GregorianCalendar gcNow = new GregorianCalendar();
java.util.Date dNow = gcNow.getTime();
return datetimeDF.format(dNow);
}
/**
* 返回当前年的年号
*
* @return int
*/
public static int getYear() {
GregorianCalendar gcNow = new GregorianCalendar();
return gcNow.get(GregorianCalendar.YEAR);
}
/**
* 返回本月月号:从 0 开始
*
* @return int
*/
public static int getMonth() {
GregorianCalendar gcNow = new GregorianCalendar();
return gcNow.get(GregorianCalendar.MONTH);
}
/**
* 返回今天是本月的第几天
*
* @return int 从1开始
*/
public static int getToDayOfMonth() {
GregorianCalendar gcNow = new GregorianCalendar();
return gcNow.get(GregorianCalendar.DAY_OF_MONTH);
}
/**
* 返回本月的第一天
*
*/
/**
* 返回一格式化的日期
*
* @param date
* java.util.Date
* @return String yyyy-mm-dd 格式
*/
public static String formatDate(java.util.Date date) {
return dateDF.format(date);
}
/**
* 返回一格式化的日期
*
* @param date
* @return
*/
public static String formatDate(long date) {
return formatDate(new java.util.Date(date));
}
/**
* 返回一格式化的时间
*
* @param date
* Date
* @return String hh:ss:mm 格式
*/
public static String formatTime(java.util.Date date) {
return timeDF.format(date);
}
/**
* 返回一格式化的时间
*
* @param date
* @return
*/
public static String formatTime(long date) {
return formatTime(new java.util.Date(date));
}
/**
* 返回一格式化的日期时间
*
* @param date
* Date
* @return String yyyy-mm-dd hh:ss:mm 格式
*/
public static String formatDateTime(java.util.Date date) {
return datetimeDF.format(date);
}
/**
* 返回一格式化的日期时间
*
* @param date
* @return
*/
public static String formatDateTime(long date) {
return formatDateTime(new java.util.Date(date));
}
/**
* 将字串转成日期和时间,字串格式: yyyy-MM-dd HH:mm:ss
*
* @param string
* String
* @return Date
*/
public static java.util.Date toDateTime(String string) {
try {
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return (java.util.Date) formatter.parse(string);
} catch (Exception ex) {
return null;
}
}
/**
* 将字串转成日期,字串格式: yyyy-MM-dd
*
* @param string
* String
* @return Date
*/
public static java.util.Date toDate(String string) {
try {
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
return (java.util.Date) formatter.parse(string);
} catch (Exception ex) {
return null;
}
}
/**
* 将字串转成日期,字串格式: yyyyMMdd 转换成 yyyy-MM-dd
*
* @param string
* String
* @return Date
*/
public static String toDateyymmdd(String string) {
try {
DateFormat formatter = new SimpleDateFormat("yyyyMMdd");
return dateDF.format((java.util.Date)formatter.parse(string));
} catch (Exception ex) {
return null;
}
}
/**
* 取值:某日期的年号
*
* @param date
* 格式: yyyy-MM-dd
* @return
*/
public static int getYear(String date) {
java.util.Date d = toDate(date);
if (d == null)
return 0;
Calendar calendar = Calendar.getInstance(locale);
calendar.setTime(d);
return calendar.get(Calendar.YEAR);
}
/**
* 取值:某日期的月号
*
* @param date
* 格式: yyyy-MM-dd
* @return 从0开始
*/
public static int getMonth(String date) {
java.util.Date d = toDate(date);
if (d == null)
return 0;
Calendar calendar = Calendar.getInstance(locale);
calendar.setTime(d);
return calendar.get(Calendar.MONTH);
}
/**
* 取值:某日期的日号
*
* @param date
* 格式: yyyy-MM-dd
* @return 从1开始
*/
public static int getDayOfMonth(String date) {
java.util.Date d = toDate(date);
if (d == null)
return 0;
Calendar calendar = Calendar.getInstance(locale);
calendar.setTime(d);
return calendar.get(Calendar.DAY_OF_MONTH);
}
/**
* 计算两个日期的年数差
*
* @param one
* 格式: yyyy-MM-dd
* @param two
* 格式: yyyy-MM-dd
* @return
*/
public static int compareYear(String one, String two) {
return getYear(one) - getYear(two);
}
/**
* 计算岁数
*
* @param date
* 格式: yyyy-MM-dd
* @return
*/
public static int compareYear(String date) {
return getYear() - getYear(date);
}
/**
* 使用format格式化Date对象为字符串
*
* @param date
* date
* @return String
*/
public static String getDateString(Date date) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
return format.format(date);
}
public static String getyyyyMMdd(Date date) {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
return format.format(date);
}
public static String getHHmmss(Date date) {
SimpleDateFormat format = new SimpleDateFormat("HHmmss");
return format.format(date);
}
/**
* 使用format格式化Date对象为字符串,获取年份
*
* @param date
* date
* @return String
*/
static public String getYear(Date date) {
SimpleDateFormat format = new SimpleDateFormat("yyyy");
return format.format(date);
}
/**
* 使用format格式化Date对象为字符串,获取月份
*
* @param date
* date
* @return String
*/
static public String getMonth(Date date) {
SimpleDateFormat format = new SimpleDateFormat("MM");
return format.format(date);
}
/**
* 使用format格式化Date对象为字符串,获取日份
*
* @param date
* date
* @return String
*/
static public String getDay(Date date) {
SimpleDateFormat format = new SimpleDateFormat("dd");
return format.format(date);
}
/**
* 使用format格式化Date对象为字符串,获取中文表示的年月日
*
* @param date
* date
* @return String 2009年12月08日
*/
static public String getDateStrC(Date date) {
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日");
return format.format(date);
}
/**
* 使用format格式化Date对象为字符串,获取年份
*
* @param date
* date
* @return String 20091208
*/
static public String getDateStrMonth(Date date) {
if (date == null)
return "";
SimpleDateFormat format = new SimpleDateFormat("yyyyMM");
String str = format.format(date);
return str;
}
/**
* 使用format格式化Date对象为字符串,获取年份
*
* @param date
* date
* @return String 20091208
*/
static public String getDateStrCompact(Date date) {
if (date == null)
return "";
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String str = format.format(date);
return str;
}
/**
* 使用format格式化Date对象为字符串,获取年月日和时间
*
* @param date
* date
* @return String 2009年12月8日 14时03分10秒
*/
static public String getDateTimeStrC(Date date) {
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
return format.format(date);
}
/**
* 获取指定日期当前小时起始时间
*/
static public Date getCurrentHoursFirstSecound(java.util.Date date) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH");
String dateStr = format.format(date);
return toDateTime(dateStr + ":00:00");
}
/**
* 获取指定日期当前下一个小时时间
*/
static public Date getCurrentNextHours(java.util.Date date) {
Calendar scalendar = new GregorianCalendar();
scalendar.setTime(date);
scalendar.add(Calendar.HOUR, 1);
return new Date(scalendar.getTime().getTime());
}
/**
* 获取指定日期后下一个月的第一天
*
* @param java.sql.Date
* date
* @return java.sql.Date
*/
static public java.sql.Date getNextMonthFirstDate(java.util.Date date) throws ParseException {
Calendar scalendar = new GregorianCalendar();
scalendar.setTime(date);
scalendar.add(Calendar.MONTH, 1);
scalendar.set(Calendar.DATE, 1);
return new java.sql.Date(scalendar.getTime().getTime());
}
static public java.sql.Date getNextMonthDate(java.util.Date date) {
Calendar scalendar = new GregorianCalendar();
scalendar.setTime(date);
scalendar.add(Calendar.MONTH, 1);
return new java.sql.Date(scalendar.getTime().getTime());
}
/** 上一个月 */
public static Date getLastMonthFirstDate(Date date, int month) {
if (date == null)
return date;
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(Calendar.MONTH, month);
date = calendar.getTime();
return date;
}
/**
* 获取指定日期的前面几天
*
* @param java.sql.Date
* date
* @param dayCount
* 表示前几天
* @return java.sql.Date
*/
static public java.sql.Date getFrontDateByDayCount(java.sql.Date date, int dayCount) throws ParseException {
Calendar scalendar = new GregorianCalendar();
scalendar.setTime(date);
scalendar.add(Calendar.DATE, -dayCount);
return new java.sql.Date(scalendar.getTime().getTime());
}
/**
* 取得指定年份和月份的第一天
*
* @param year
* 年
* @param month
* 月
* @return Date
*/
static public Date getFirstDay(String year, String month) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
return format.parse(year + "-" + month + "-1");
}
/**
* 取得指定年份和月份的第一天
*
* @param year
* 年
* @param month
* 月
* @return Date
*/
static public Date getFirstDay(int year, int month) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
return format.parse(year + "-" + month + "-1");
}
/**
* 取得指定年份和月份的最后一天
*
* @param year
* 年
* @param month
* 月
* @return Date
*/
static public Date getLastDay(String year, String month) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date date = format.parse(year + "-" + month + "-1");
Calendar scalendar = new GregorianCalendar();
scalendar.setTime(date);
scalendar.add(Calendar.MONTH, 1);
scalendar.add(Calendar.DATE, -1);
date = scalendar.getTime();
return date;
}
/**
* 取得指定年份和月份的最后一天
*
* @param year
* 年
* @param month
* 月
* @return Date
*/
static public Date getLastDay(int year, int month) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date date = format.parse(year + "-" + month + "-1");
Calendar scalendar = new GregorianCalendar();
scalendar.setTime(date);
scalendar.add(Calendar.MONTH, 1);
scalendar.add(Calendar.DATE, -1);
date = scalendar.getTime();
return date;
}
/**
* 取得指定年份之间的相隔月数
*
* @param year
* 年
* @param month
* 月
* @return Date
*/
static public long getDistinceMonth(String beforedate, String afterdate) throws ParseException {
SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd");
long monthCount = 0;
try {
java.util.Date before = d.parse(beforedate);
java.util.Date after = d.parse(afterdate);
monthCount = (Integer.parseInt(DateUtil.getYear(after)) - Integer.parseInt(DateUtil.getYear(before))) * 12
+ DateUtil.getMonth(afterdate) - DateUtil.getMonth(beforedate);
} catch (ParseException e) {
System.out.println("Date parse error!");
}
return monthCount;
}
/**
* 取得指定年份之间的相隔天数
*
* @param year
* 年
* @param month
* 月
* @return Date
*/
static public long getDistinceDay(String beforedate, String afterdate) throws ParseException {
SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd");
long dayCount = 0;
try {
java.util.Date d1 = d.parse(beforedate);
java.util.Date d2 = d.parse(afterdate);
dayCount = (d2.getTime() - d1.getTime()) / (24 * 60 * 60 * 1000);
} catch (ParseException e) {
System.out.println("Date parse error!");
// throw e;
}
return dayCount;
}
/**
* 指定日期加一天
*
* @param date
* @param day
* @return
*/
static public Date getDaytoDay(Date date, int day) {
if (date == null)
return date;
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(Calendar.DATE, day);
date = calendar.getTime();
return date;
}
static public Date getMonthtoMonth(Date date, int day) {
if (date == null)
return date;
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(Calendar.MONTH, day);
date = calendar.getTime();
return date;
}
// 获取上一年或者下一年
static public Date getYeartoYaer(Date date, int year) {
if (date == null)
return date;
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(Calendar.YEAR, year);
date = calendar.getTime();
return date;
}
// 指定日期的最开始时间
public static Date getDateStartTime(Date date) {
if (date == null)
return null;
try {
String strDate = formatDate(date);
return toDateTime(strDate + " 00:00:00");
} catch (Exception localException) {
}
return null;
}
static public Date getDateLastTime(Date date) {
if (date == null)
return null;
try {
String strDate = formatDate(date);
return toDateTime(strDate + " 23:59:59");
} catch (Exception localException) {
}
return null;
}
// 单位秒
static public long getDistinceFen(String beforedate, String afterdate) throws ParseException {
SimpleDateFormat d = new SimpleDateFormat(DATE_TIME_FORMAT);
long dayCount = 0;
try {
java.util.Date d1 = d.parse(beforedate);
java.util.Date d2 = d.parse(afterdate);
dayCount = (d2.getTime() - d1.getTime()) / (1000);
} catch (ParseException e) {
System.out.println("Date parse error!");
// throw e;
}
return dayCount;
}
static public Date getMINUTE(Date date, int day) {
if (date == null)
return date;
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(Calendar.MINUTE, day);
date = calendar.getTime();
return date;
}
static public String CalTimeDifference(String fromTime, int overTime) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try {
date = dateFormat.parse(fromTime);
} catch (ParseException e) {
e.printStackTrace();
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR, overTime);//这里是分钟,如果需要,可以更换为day,moth
Date date1 = calendar.getTime();
Timestamp overQTimeKey = new Timestamp(calendar.getTime().getTime());
SimpleDateFormat overQTimeDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return overQTimeDateFormat.format(overQTimeKey);
}
/**
* 10位时间戳
* @return
*/
static public String tenBitTime() {
return String.valueOf(Calendar.getInstance().getTimeInMillis()/1000);
}
/**
* 使用format格式化Date对象为字符串
*
* @param date
* date
* @return String
*/
public static String getDatetoUpperCaseString() {
// 获取当前日期
Calendar calendar = Calendar.getInstance();
// 转换成大写
String year = toUpperCase(String.valueOf(calendar.get(Calendar.YEAR)));
String month = toUpperCase(String.valueOf(calendar.get(Calendar.MONTH) + 1));
String day = toUpperCase(String.valueOf(calendar.get(Calendar.DAY_OF_MONTH)));
// 组合成大写格式
String dateInChinese = year + "" + month + "" + day + "";
return dateInChinese;
}
// 将数字字符串转换成大写
private static String toUpperCase(String str) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
switch (c) {
case '0': sb.append('零'); break;
case '1': sb.append('一'); break;
case '2': sb.append('二'); break;
case '3': sb.append('三'); break;
case '4': sb.append('四'); break;
case '5': sb.append('五'); break;
case '6': sb.append('六'); break;
case '7': sb.append('七'); break;
case '8': sb.append('八'); break;
case '9': sb.append('九'); break;
default: sb.append(c);
}
}
return sb.toString();
}
public static void main(String[] args) throws ParseException {
// System.out.println(getDateStrC(getDaytoDay(new Date(),-7)));
// System.out.println(getDateFormat(null));
// getDistinceFen
// SimpleDateFormat format = new SimpleDateFormat("yyMMddHHmmss");
String code = "";
String[] codearray = code.split("/");
System.out.println(JSON.toJSONString(codearray));
System.out.println(codearray[codearray.length - 1]);
System.out.println(getDatetoUpperCaseString());
// System.out.println(formatDateTime(nowDateMinusTime(toDateTime("2023-19-27 00:00:00"), -10)));
// System.out.println(new Date().getTime());
// System.out.println(1614849936503L - new Date().getTime());
// DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
// 第一个当前日期 第二个证照有效的日期
// Long s = DateUtil.getDistinceDay(DateUtil.getDate(), DateUtil.toDates("20190228"));
// System.out.println(s);
// System.out.println(DateUtil.toDateyymmdd("20180817"));
// TODO Auto-generated catch block
/*
* try { System.out.println(getDateFormat(null)); } catch
* (ParseException e) { // TODO Auto-generated catch block
* e.printStackTrace(); }
*/
}
}
@@ -0,0 +1,94 @@
package abacus.springboot.example.util;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
/**
* <p>Title:JsonStringRemoveRepetUtil</p>
<p>Description:json字符串-对比</p>
@author chuanZeng
@date 2026年8月18日
*/
public class JsonStringRemoveRepetUtil {
public String[] removeRepet(String oldStr,String newStr){
if(StringUtils.isEmpty(oldStr)||StringUtils.isEmpty(newStr)) return new String[]{oldStr,newStr};
try{
JSONObject oldjo=JSONObject.parseObject(oldStr);
JSONObject newjo=JSONObject.parseObject(newStr);
if(oldjo==null||newjo==null) return new String[]{oldStr,newStr};
List<String> rkeys=new ArrayList<String>();
List<String> akeys=new ArrayList<String>();
for(String key:oldjo.keySet()){
if(oldjo.getString(key)==null&&newjo.getString(key)==null){
rkeys.add(key);
}else if(oldjo.getString(key)==null&&newjo.getString(key)!=null||oldjo.getString(key)!=null&&newjo.getString(key)==null){
}else if(oldjo.getString(key).startsWith("{")){//对象
if(oldjo.getJSONObject(key).getString("id").equals(newjo.getJSONObject(key).getString("id"))){
rkeys.add(key);
}
}else if(oldjo.getString(key).startsWith("[")){//数组
if(oldjo.getString(key).equals(newjo.getString(key)))
rkeys.add(key);
else
akeys.add(key);
}else if(oldjo.getString(key).equals(newjo.getString(key))){
rkeys.add(key);
}
}
if(!rkeys.isEmpty()){
for(String key:rkeys){
oldjo.remove(key);
newjo.remove(key);
}
}
if(!akeys.isEmpty()){
for(String key:akeys){
JSONArray oldja= oldjo.getJSONArray(key);
JSONArray newja= newjo.getJSONArray(key);
if(oldja.isEmpty()||newja.isEmpty()) continue;
List<String> oldli=new ArrayList<String>();
for(Object obj:oldja){
JSONObject jo=(JSONObject) obj;
oldli.add(jo.toJSONString());
}
List<String> newli=new ArrayList<String>();
for(Object obj:newja){
JSONObject jo=(JSONObject) obj;
newli.add(jo.toJSONString());
}
oldli.retainAll(newli);
if(!oldli.isEmpty()){
String olds=oldjo.getString(key);
String news=newjo.getString(key);
for(String str:oldli){
olds=olds.replace(str, "").replace(",,", ",");
news=news.replace(str, "").replace(",,", ",");
}
olds=olds.replace("[,", "[").replace(",]", "]");
news=news.replace("[,", "[").replace(",]", "]");
if(olds.equals("[]"))
oldjo.remove(key);
else
oldjo.put(key, olds);
if(news.equals("[]"))
newjo.remove(key);
else
newjo.put(key, news);
}
}
}
oldStr=oldjo.toJSONString();
newStr=newjo.toJSONString();
}catch(Exception e){
e.printStackTrace();
}
return new String[]{oldStr,newStr};
}
}
@@ -0,0 +1,112 @@
package abacus.springboot.example.util;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.SocketFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.httpclient.ConnectTimeoutException;
import org.apache.commons.httpclient.params.HttpConnectionParams;
import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
/**
* 调过证书
*
* created at 2010-7-26 上午09:29:33
*/
public class MySSLProtocolSocketFactory implements ProtocolSocketFactory {
private SSLContext sslcontext = null;
private SSLContext createSSLContext() {
SSLContext sslcontext=null;
try {
sslcontext = SSLContext.getInstance("SSL");
sslcontext.init(null, new TrustManager[]{new TrustAnyTrustManager()}, new java.security.SecureRandom());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
e.printStackTrace();
}
return sslcontext;
}
private SSLContext getSSLContext() {
if (this.sslcontext == null) {
this.sslcontext = createSSLContext();
}
return this.sslcontext;
}
public Socket createSocket(Socket socket, String host, int port, boolean autoClose)
throws IOException, UnknownHostException {
return getSSLContext().getSocketFactory().createSocket(
socket,
host,
port,
autoClose
);
}
public Socket createSocket(String host, int port) throws IOException,
UnknownHostException {
return getSSLContext().getSocketFactory().createSocket(
host,
port
);
}
public Socket createSocket(String host, int port, InetAddress clientHost, int clientPort)
throws IOException, UnknownHostException {
return getSSLContext().getSocketFactory().createSocket(host, port, clientHost, clientPort);
}
public Socket createSocket(String host, int port, InetAddress localAddress,
int localPort, HttpConnectionParams params) throws IOException,
UnknownHostException, ConnectTimeoutException {
if (params == null) {
throw new IllegalArgumentException("Parameters may not be null");
}
int timeout = params.getConnectionTimeout();
SocketFactory socketfactory = getSSLContext().getSocketFactory();
if (timeout == 0) {
return socketfactory.createSocket(host, port, localAddress, localPort);
} else {
Socket socket = socketfactory.createSocket();
SocketAddress localaddr = new InetSocketAddress(localAddress, localPort);
SocketAddress remoteaddr = new InetSocketAddress(host, port);
socket.bind(localaddr);
socket.connect(remoteaddr, timeout);
return socket;
}
}
//自定义私有类
private static class TrustAnyTrustManager implements X509TrustManager {
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[]{};
}
}
}
@@ -0,0 +1,295 @@
package abacus.springboot.example.util;
import java.io.IOException;
import java.util.Map;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.SimpleHttpConnectionManager;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.commons.httpclient.params.HttpClientParams;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.apache.commons.httpclient.protocol.Protocol;
import com.abacus.xpos.foundation.pubs.WebserviceException;
import com.alibaba.fastjson.JSONObject;
/**
* <p>Title:RequestUtil</p>
<p>Description: http-工具</p>
@author chuanZeng
@date 2026年8月18日
*/
public class RequestUtil {
private static final int connectTimeout = 5000; // 连接超时时间
private static final int connectionRequestTimeout = 5000; // 请求超时时间
private static final int socketTimeout = 5000; // 套接字连接超时(读取超时时间)
public static final String charset = "utf-8"; // 编码方式
/**
* post Json提交
* @param url
* @param jsonStr
* @return
* @throws WebserviceException
*/
public static String send(String url ,String jsonStr, String id) throws WebserviceException{
HttpClientParams params = new HttpClientParams();
params.setContentCharset("UTF-8");
HttpClient hc = new HttpClient(params,new SimpleHttpConnectionManager(true));
hc.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
hc.getHttpConnectionManager().getParams().setSoTimeout(5000);
PostMethod hm = new PostMethod(url);
hm.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
try {
System.out.println(DateUtil.getDateTime()+"-"+ id + "-url:"+url);
hm.setRequestEntity(new StringRequestEntity(jsonStr, "application/json", "utf-8"));
System.out.println(DateUtil.getDateTime()+"-"+ id + "-send报文:" + jsonStr.toString());
int status = hc.executeMethod(hm);
if(status == HttpStatus.SC_OK) {
String temp = hm.getResponseBodyAsString();
System.out.println(DateUtil.getDateTime()+"-"+ id + "-resp data:"+temp);
return temp ;
}else{
throw new WebserviceException("请求出错!");
}
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
throw new WebserviceException(e.getMessage());
}finally {
hm.releaseConnection();
}
}
/**
* POST 键值对提交
* @param url
* @param paramsMap
* @return
* @throws WebserviceException
*/
public static String sendParams(String url ,Map<String,Object> paramsMap, String id) throws WebserviceException{
HttpClientParams params = new HttpClientParams();
params.setContentCharset("UTF-8");
HttpClient hc = new HttpClient(params,new SimpleHttpConnectionManager(true));
hc.getHttpConnectionManager().getParams().setConnectionTimeout(10000);
hc.getHttpConnectionManager().getParams().setSoTimeout(10000);
PostMethod hm = new PostMethod(url);
// GetMethod gm = new GetMethod(url);
hm.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
Protocol myhttps = new Protocol("https", new MySSLProtocolSocketFactory(), 443);
Protocol.registerProtocol("https", myhttps);
try {
for(String key : paramsMap.keySet()){
hm.addParameter(key, paramsMap.get(key).toString());
}
System.out.println(DateUtil.getDateTime()+">>>" + id + ">>>url>>>" + url
+ ">>>sendParams报文>>>" + paramsMap.toString());
int status = hc.executeMethod(hm);
if(status == HttpStatus.SC_OK) {
String temp = hm.getResponseBodyAsString();
System.out.println(DateUtil.getDateTime()+">>>" + id + ">>>resp data>>>"+ JSONObject.parseObject(temp));
return temp ;
}else{
throw new WebserviceException("请求出错!"+status);
}
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
throw new WebserviceException(e.getMessage());
}finally {
hm.releaseConnection();
}
}
public static String sendGet(String url) throws WebserviceException{
HttpClientParams params = new HttpClientParams();
params.setContentCharset("UTF-8");
HttpClient hc = new HttpClient(params,new SimpleHttpConnectionManager(true));
hc.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
hc.getHttpConnectionManager().getParams().setSoTimeout(5000);
GetMethod getMethod = new GetMethod(url);
getMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
try {
System.out.println("url:"+url);
int status = hc.executeMethod(getMethod);
if(status == HttpStatus.SC_OK) {
String temp = getMethod.getResponseBodyAsString();
System.out.println("resp data:"+temp);
return temp ;
}else{
throw new WebserviceException("请求出错!");
}
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
throw new WebserviceException(e.getMessage());
}finally {
getMethod.releaseConnection();
}
}
public static String postHttp(String urls, NameValuePair[] nvp) throws Exception {
try {
String result = "";
// 定义http客户端对象--httpClient
HttpClient httpClient = new HttpClient();
// 定义并实例化客户端链接对象-postMethod
PostMethod postMethod = new PostMethod(urls);
httpClient.setConnectionTimeout(5000);
try {
postMethod.setRequestHeader("application/json", "UTF-8");
postMethod.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "utf-8");
// 将表单的值放入postMethod中
postMethod.addParameters(nvp);
// 定义访问地址的链接状态
int statusCode = 0;
try {
// 客户端请求url数据
statusCode = httpClient.executeMethod(postMethod);
} catch (Exception e) {
e.printStackTrace();
}
// 请求成功状态-200
if (statusCode == HttpStatus.SC_OK) {
try {
result = postMethod.getResponseBodyAsString();
} catch (IOException e) {
e.printStackTrace();
}
} else {
}
} catch (Exception e) {
} finally {
// 释放链接
postMethod.releaseConnection();
httpClient.getHttpConnectionManager().closeIdleConnections(0);
}
return result;
} catch (Exception e) {
throw new Exception(e.getMessage());
}
}
public static String getHttp(String urls, NameValuePair[] nvp) throws Exception {
try {
String result = "";
// 定义http客户端对象--httpClient
HttpClient httpClient = new HttpClient();
// 定义并实例化客户端链接对象-postMethod
GetMethod getMethod = new GetMethod(urls);
try {
// 设置http的头
// (1)、这里可以设置自己想要的编码格式
getMethod.getParams().setContentCharset("utf-8");
// (2)、对于get方法也可以这样设置
getMethod.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "utf-8");
// 3)、还可以如下这样设置
getMethod.addRequestHeader("Content-Type", "text/html; charset=UTF-8");
getMethod.setQueryString(nvp);
// 定义访问地址的链接状态
int statusCode = 0;
try {
// 客户端请求url数据
statusCode = httpClient.executeMethod(getMethod);
} catch (Exception e) {
e.printStackTrace();
}
// 请求成功状态-200
if (statusCode == HttpStatus.SC_OK) {
try {
result = getMethod.getResponseBodyAsString();
} catch (IOException e) {
e.printStackTrace();
}
} else {
}
} catch (Exception e) {
} finally {
// 释放链接
getMethod.releaseConnection();
httpClient.getHttpConnectionManager().closeIdleConnections(0);
}
return result;
} catch (Exception e) {
throw new Exception(e.getMessage());
}
}
public static void main(String[] args) {
// 验证设备唯一码,验证设备分配账户号
// Map<String, Object> paramsMap = new HashMap<String, Object>();
// paramsMap.put("error_code","1");
// paramsMap.put("msg","TRUE1");
// paramsMap.put("data","{\"Result\":{\"ResponseStatus\":{\"ErrorCode\":500,\"IsSuccess\":false,\"Errors\":[{\"FieldName\":null,\"Message\":\"插件取消了保存操作,可能因为数据不合法。\",\"DIndex\":0}],\"SuccessEntitys\":[],\"SuccessMessages\":[],\"MsgCode\":0},\"Id\":\"\",\"NeedReturnData\":[{}]}}");
//
// List<Map<String, Object>> mapl = new ArrayList<Map<String, Object>>();
// mapl.add(paramsMap);
//
// String str = JSONObject.toJSONString(mapl);
// System.out.println(str);
//
//// JSONObject jsonObject = JSONObject.parseObject(str);
// JSONArray jsonObject = JSONArray.parseArray(str);
//
// System.out.println(jsonObject.getJSONObject(0).getString("data"));
//
// JSONObject jsonObjects = JSONObject.parseObject(jsonObject.getJSONObject(0).getString("data")).getJSONObject("Result").getJSONObject("ResponseStatus");
//
// String message = jsonObjects.getInteger("ErrorCode") + ":" + jsonObjects.getJSONArray("Errors").getJSONObject(0).getString("Message");
// String FieldName = jsonObjects.getInteger("ErrorCode") + ":" + jsonObjects.getJSONArray("Errors").getJSONObject(0).getString("FieldName");
//
// System.out.println(message);
// System.out.println(FieldName);
// String context = "{\"type\":1,\"batchNub\":\"\",\"qctype\":2,\"prodNumber\":\"10401000006\",\"qrcode\":[\"https%3a%2f%2fbetascan.vats.com.cn%2fscan%2f3%2f001f3618fd5d4d1d84125c04d5c2ebe6\",\"https://betascan.vats.com.cn/scan/3/002f3618fd5d4d1d84125c04d5c2ebe6\",\"https://betascan.vats.com.cn/scan/3/003f3618fd5d4d1d84125c04d5c2ebe6\"],\"operateUser\":\"47\",\"companyCode\":\"25\"}";
// try {
//// String map1 = new RequestUtil().send("https://apistest.vatsliquor.com/hzztlgs/addProductQrcode?token=aHp6dC0xNTY2Mjc4OTcwMTE5LXZhdHM_", context);
//
//// System.out.println(map1);
// } catch (WebserviceException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
//
// if("1".equals(jsonObject.get("error_code")) || "TRUE".equals(jsonObject.get("msg"))) {
// System.out.println(jsonObject.get("data"));
// }
}
}
@@ -0,0 +1,48 @@
package abacus.springboot.example.vo;
import java.util.Date;
/**
* <p>Title:BaiduToken</p>
<p>Description: BaiduToken-临时对象</p>
@author chuanZeng
@date 2026年8月18日
*/
public class BaiduToken {
private long id;
private int version;
private String token;
private String expirydate;
private Date dt;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getExpirydate() {
return expirydate;
}
public void setExpirydate(String expirydate) {
this.expirydate = expirydate;
}
public Date getDt() {
return dt;
}
public void setDt(Date dt) {
this.dt = dt;
}
}
@@ -0,0 +1,39 @@
package abacus.springboot.example.vo;
/**
* <p>Title:PMSConfigKey</p>
<p>Description:配置-key-全局设定</p>
@author chuanZeng
@date 2026年8月18日
*/
public interface PMSConfigKey {
/** keyGroup:系统号*/
public static final String KEY_GROUP = "pms";
/** setWMS接口对接参数配置*/
public static final String PMS_WMSCONF = "pms.wmsconf";
/** pms.wmsconf:访问地址*/
public static final String PMS_WMSCONF_URL = "url";
/** pms.wmsconfappkey*/
public static final String PMS_WMSCONF_APPKEY = "appkey";
/** pms.wmsconfsessionKey*/
public static final String PMS_WMSCONF_SESSIONKEY = "sessionKey";
/** pms.wmsconfgoodsOwner*/
public static final String PMS_WMSCONF_GOODSOWNER = "goodsOwner";
public static final String PMS_WMSCONF_SHOPCODE = "shopCode";
public static final String PMS_WMSCONF_SHOPNAME = "shopName";
}
@@ -0,0 +1,28 @@
package abacus.springboot.example.vo;
/**
* <p>Title:SiDepositlocation</p>
<p>Description: JDBC-数据返回-临时存储对象</p>
@author chuanZeng
@date 2026年8月18日
*/
public class SiDepositlocation {
// 仓库编码
private String id;
// 是否推送WMS1-WMS0-WDT
private int push;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getPush() {
return push;
}
public void setPush(int push) {
this.push = push;
}
}
@@ -0,0 +1,357 @@
package abacus.springboot.example.wsi;
import java.util.List;
import java.util.Map;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import abacus.springboot.example.api.view.ApiBillHg;
import abacus.springboot.example.api.view.ApiBillHgItem;
import abacus.springboot.example.api.view.ApiBillHgPayment;
import abacus.springboot.example.api.view.ApiJcBill;
import abacus.springboot.example.api.view.ApiJcBillHgSearchItem;
import abacus.springboot.example.api.view.ApiJcBillItem;
import abacus.springboot.example.api.view.ApiJcBillSearch;
import abacus.springboot.example.api.view.ApiReqJcBill;
import abacus.springboot.example.api.view.JcBillCount;
import abacus.springboot.example.api.view.JcCodeFlow;
import abacus.springboot.example.api.view.JcProduct;
import abacus.springboot.example.api.view.JcProductBillSouce;
import abacus.springboot.example.dao.JcBill;
import abacus.springboot.example.dao.JcBillHg;
import abacus.springboot.example.dao.JcBillHgPay;
import abacus.springboot.example.dao.JcBillInItem;
import abacus.springboot.example.dao.JcBillPhoto;
import abacus.springboot.example.dao.JcBillSourceItem;
import abacus.springboot.example.dao.JcSourceItem;
/**
* <p>Title:ApiJcBillServiceIF</p>
<p>Description: 对外接口service服务</p>
@author chuanZeng
@date 2026年8月18日
*/
public interface ApiJcBillServiceIF {
/**
* 稽查收货查询
* @param keyword
* @param status
* @param pageable
* @return
* @throws RuntimeException
*/
public Page<ApiJcBillSearch> queryApiJcBillSearch(String keyword, String employee, String status, Pageable pageable) throws RuntimeException;
/**
* 稽查收货主单查询
* @param id
* @return
* @throws RuntimeException
*/
public ApiJcBill queryApiJcBillById(String id) throws RuntimeException;
/**
* 稽查收货明细
* @param billId
* @return
* @throws RuntimeException
*/
public List<ApiJcBillItem> queryApiJcBillItemByBIllId(String billId) throws RuntimeException;
/**
* 根据条件查询图片
* @param srcid
* @param srcitemid
* @param typephoto
* @return
* @throws RuntimeException
*/
public Map<String, List<JcBillPhoto>> queryJcBillPhoto(String srcid) throws RuntimeException;
/**
* 根据条件查询图片
* @param srcid
* @param srcitemid
* @param typephoto
* @return
* @throws RuntimeException
*/
public Map<String, List<JcBillPhoto>> queryJcBillPhotoIn(List<String> srcids) throws RuntimeException;
/**
* 保存
* @param reqJcBill
* @param jcBill
* @param createItems
* @return
* @throws RuntimeException
*/
public ApiReqJcBill saveApiReqJcBill(ApiReqJcBill reqJcBill, JcBill jcBill, List<JcBillSourceItem> createItems) throws RuntimeException;
/**
* 修改
* @param reqJcBill
* @param jcBill
* @param createItems
* @param updateItems
* @return
* @throws RuntimeException
*/
public ApiReqJcBill updateApiReqJcBill(ApiReqJcBill reqJcBill, JcBill jcBill, List<JcBillSourceItem> createItems, List<JcBillSourceItem> updateItems) throws RuntimeException;
/**
* 当前明细行号
* @param billId
* @return
* @throws RuntimeException
*/
public int countJcBillItemIndexno(String billId) throws RuntimeException;
/**
* 查询
* @param billId
* @return
* @throws RuntimeException
*/
public JcBill queryJcBillById(String billId) throws RuntimeException;
/**
* 查询
* @param billId
* @return
* @throws RuntimeException
*/
public List<JcBillSourceItem> queryJcBillSourceItemByBillId(String billId) throws RuntimeException;
/**
* 查询
* @param id
* @return
* @throws RuntimeException
*/
public JcBillSourceItem queryJcBillSourceItembyId(Long id) throws RuntimeException;
/**
* 查询o
* @param id
* @return
* @throws RuntimeException
*/
public JcBillInItem queryJcBillInItemById(Long id) throws RuntimeException;
/**
* 修改状态:待提交>>>待溯源
* @param jcBill
* @throws RuntimeException
*/
public void updateStatusJcBill(JcBill jcBill, int oldStatus) throws RuntimeException;
/**
* 回购列表查询
* @param keyword
* @param status
* @param pageable
* @return
* @throws RuntimeException
*/
public Page<ApiJcBillHgSearchItem> queryApiJcBillHgSearchItem(String keyword, String employee, String status, Pageable pageable) throws RuntimeException;
/**
* 回购;查询品种和件数汇总
* @param ids
* @return
* @throws RuntimeException
*/
public Map<String, JcBillCount> queryJcBillCount(List<String> ids) throws RuntimeException;
/**
* 回购:主单查询
* @param id
* @return
* @throws RuntimeException
*/
public ApiBillHg queryApiBillHgById(String hgId) throws RuntimeException;
/**
* 回购:明细查询
* @param billId
* @return
* @throws RuntimeException
*/
public List<ApiBillHgItem> queryApiBillHgItemByHgId(String hgId) throws RuntimeException;
/**
* 回购:支付明细查询
* @param billId
* @return
* @throws RuntimeException
*/
public List<ApiBillHgPayment> queryApiBillHgPaymentByHgId(String hgId) throws RuntimeException;
public List<ApiBillHgPayment> queryApiBillHgPaymentByHgId(List<String> hgIds) throws RuntimeException;
/**
* 查询
* @param billHg
* @return
* @throws RuntimeException
*/
public JcBillHg queryJcBillHg(String billHg) throws RuntimeException;
/**
* 修改
* @param bill
* @throws RuntimeException
*/
public void updateJcBillHg(JcBillHg entity, List<JcBillHgPay> pays) throws RuntimeException;
/**
* 查询图片
* @param srcid
* @param srcitemid
* @param typephoto
* @return
* @throws RuntimeException
*/
public JcBillPhoto queryJcBillPhoto(String srcid, String srcitemid, String typephoto) throws RuntimeException;
/**
* 查询图片
* @param srcid
* @param srcitemid
* @param typephoto
* @return
* @throws RuntimeException
*/
public List<JcBillPhoto> queryJcBillPhoto(String srcid, String typephoto) throws RuntimeException;
/**
* 删除或保存图片
* @param photos
* @param billHg
* @throws RuntimeException
*/
public void saveAndDeletePhoto(List<JcBillPhoto> photos, JcBillHg billHg) throws RuntimeException;
/**
* 删除或保存图片
* @param photos
* @param billHg
* @throws RuntimeException
*/
public void saveAndDeletePhoto(List<JcBillPhoto> photos, String billId) throws RuntimeException;
/**
* 查询:下一单待提交的回购单号
* @return
* @throws RuntimeException
*/
public String lastBillHgId() throws RuntimeException;
/**
* 根据物流码,查询出库相关信息
* @param code
* @return
* @throws RuntimeException
*/
public List<JcCodeFlow> queryJcCodeFlow(List<String> codes) throws RuntimeException;
/**
* 查询朔源明细
* @param billId
* @return
*/
public List<JcSourceItem> queryJcSourceItemByBillId(String billId) throws RuntimeException;
/**
* 更新收货明细,以及保存溯源明细
* @param items
* @param sourceItems
* @throws RuntimeException
*/
public void saveJcSourceItem(List<JcBillSourceItem> items, List<JcSourceItem> sourceItems, JcBill jcBill) throws RuntimeException;
/**
* 查询图片
* @param srcid
* @param srcitemid
* @param typephoto
* @return
* @throws RuntimeException
*/
public JcBillPhoto queryJcBillPhotoById(String id) throws RuntimeException;
/**
* 删除图片
* @param entity
* @throws RuntimeException
*/
public void deleteJcBillPhotoById(JcBillPhoto entity) throws RuntimeException;
/**
* 删除订单详情以及对应的图片
* @param billid
* @param itemid
* @throws RuntimeException
*/
public void deleteJcSourceItem(String billid, String itemid) throws RuntimeException;
/**
* 获取百度token
* @return
* @throws RuntimeException
*/
public String getBaiduToken() throws RuntimeException;
/**
* 稽查货品查询-单号查询
* @param product
* @param stockInId
* @param hgId
* @return
* @throws RuntimeException
*/
public List<JcProduct> queryJcProduct(String product, String stockInId, String hgId) throws RuntimeException;
/**
* 稽查货品查询-单号查询
* @param product
* @param stockInId
* @param hgId
* @return
* @throws RuntimeException
*/
public List<JcProduct> queryJcProduct(String product, String stockInId) throws RuntimeException;
/**
* 根据稽查单号,查询对应的货品编号
* @param billIds
* @return
* @throws RuntimeException
*/
public Map<String, List<JcProductBillSouce>> queryJcProductBillSouce(List<String> billIds)throws RuntimeException;
/**
* 修改状态
* @param jcBill
* @throws RuntimeException
*/
public void updateStatusByJcBill(JcBill jcBill, int status) throws RuntimeException;
public List<JcBillHg> qeryJcBillHgs(List<String> billids) throws RuntimeException;
}
@@ -0,0 +1,341 @@
package abacus.springboot.example.wsi;
import java.util.List;
import java.util.Map;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.alibaba.fastjson.JSONObject;
import abacus.springboot.example.dao.JcBill;
import abacus.springboot.example.dao.JcBillHg;
import abacus.springboot.example.dao.JcBillInItem;
import abacus.springboot.example.dao.JcBillPhoto;
import abacus.springboot.example.dao.JcBillSourceItem;
import abacus.springboot.example.dao.JcSourceItem;
import abacus.springboot.example.vo.SiDepositlocation;
/**
* <p>Title:JcBillServiceIF</p>
<p>Description: service服务</p>
@author chuanZeng
@date 2026年8月18日
*/
public interface JcBillServiceIF {
/**
* 稽查收货查询
* @param fromDate
* @param thruDate
* @param id
* @param applicant
* @param goods
* @param billin
* @param goodsid
* @param product
* @param status
* @param pageable
* @param typ 1-溯源入库 2-回购通知
* @return
* @throws RuntimeException
*/
public Page<JcBill> queryJcBill(String fromDate, String thruDate, String id,
String applicant, String goods, String billin, String goodsid, String product,
String status, int typ, Pageable pageable) throws RuntimeException;
/**
* 查询
* @param billId
* @return
* @throws RuntimeException
*/
public JcBill queryJcBillById(String billId) throws RuntimeException;
/**
* 查询
* @param billId
* @return
* @throws RuntimeException
*/
public List<JcBillSourceItem> queryJcBillSourceItemByBillId(String billId) throws RuntimeException;
/**
* 查询
* @param billHg
* @return
* @throws RuntimeException
*/
public JcBillHg queryJcBillHg(String billHg) throws RuntimeException;
/**
* 查询朔源明细
* @param billId
* @return
*/
public List<JcSourceItem> queryJcSourceItemByBillId(String billId) throws RuntimeException;
/**
* 查询朔源明细
* @param billId
* @return
*/
public List<JcSourceItem> queryJcSourceItemByBillId(String billId, String srcitemid) throws RuntimeException;
/**
* 查询朔源明细
* @param billId
* @return
*/
public List<JcSourceItem> queryJcSourceItemByBillId(String billId, String srcitemid, int status) throws RuntimeException;
/**
* 根据条件查询图片
* @param srcid
* @param srcitemid
* @param typephoto
* @return
* @throws RuntimeException
*/
public Map<String, List<JcBillPhoto>> queryJcBillPhoto(String srcid) throws RuntimeException;
/**
* 查询稽查收货明细
* @param id
* @return
* @throws RuntimeException
*/
public JcBillSourceItem queryJcBillSourceItemById(Long id) throws RuntimeException;
/**
* 稽查溯源明细
* @param id
* @return
* @throws RuntimeException
*/
public JcSourceItem queryJcSourceItemById(Long id) throws RuntimeException;
/**
* 确认溯源
* @param billItem
* @param sourceItem
* @throws RuntimeException
*/
public void saveQuerenBillSourceItem(JcBillSourceItem billItem, JcSourceItem sourceItem) throws RuntimeException;
/**
* 溯源信息驳回
* @param billItem
* @param sourceItem
* @throws RuntimeException
*/
public void saveRejectJcSourceItems(JcBillSourceItem billItem, JcBill jcBill) throws RuntimeException;
/**
* 溯源完成
* @param billItem
* @param sourceItem
* @throws RuntimeException
*/
public void saveCompleteJcBill(List<JcBillInItem> inItems, JcBill jcBill) throws RuntimeException;
/**
* 稽查收货:仓库修改
* @param jcBill
* @throws RuntimeException
*/
public void updateWarehouse(JcBill jcBill) throws RuntimeException;
/**
*
* @param billId
* @return
* @throws RuntimeException
*/
public List<JcBillInItem> queryJcBillInItemByBillId(String billId) throws RuntimeException;
public List<JcBillInItem> queryJcBillInItemByBillId(String billId, int status) throws RuntimeException;
/**
* 稽查收货:生成入库单
* @param jcBill
* @throws RuntimeException
*/
public void createStockIn(JcBill jcBill) throws RuntimeException;
/**
* 查询回购单明细
* @param id
* @return
*/
public JcBillInItem queryJcBillInItemById(Long id) throws RuntimeException;
/**
* 终止回购
* @param inItem
* @throws RuntimeException
*/
public void saveTerminateHgInItem(JcBillInItem inItem) throws RuntimeException;
/**
* 批量查询回购单明细
* @param ids
* @return
* @throws RuntimeException
*/
public List<JcBillInItem> findAllById(List<Long> ids) throws RuntimeException;
/**
* 确定通知
* @param inItems
* @throws RuntimeException
*/
public void saveInformHg(List<JcBillInItem> inItems, JcBill jcBill, JcBillHg jcBillHg, String photoUrl) throws RuntimeException;
/**
* 分页查询 回购订单
* @param typ 1-回购认款,2-回购分仓
* @return
* @throws RuntimeException
*/
public Page<JcBillHg> queryJcBillHg(String fromDate, String thruDate, String account,
String salearea, String id, String billId, String status, String product,
String manager,
int typ, Pageable pageable) throws RuntimeException;
/**
*
* @param billId
* @return
* @throws RuntimeException
*/
public List<JcBillInItem> queryJcBillInItemByBillHg(String billHgId) throws RuntimeException;
/**
* 回购驳回
* @throws RuntimeException
*/
public void saveRejectBillHg(int status, int typ, JcBill jcBill, JcBillHg billHg, List<JcBillInItem> inItems) throws RuntimeException;
/**
* 确认收款
* @param billHg
* @throws RuntimeException
*/
public void saveQuerenSk(JcBillHg billHg, boolean fcFlag) throws RuntimeException;
/**
* 分仓
* @param billHg
* @param fcFlag
* @throws RuntimeException
*/
public void savecreateFc(JcBillHg billHg) throws RuntimeException;
/**
* 修改分仓仓库
* @param oldJsonStr
* @param billHg
* @throws RuntimeException
*/
public void updateFcWarehouse(String oldJsonStr, JcBillHg billHg) throws RuntimeException;
/**
* 修改运营备注
* @param oldJsonStr
* @param billHg
* @throws RuntimeException
*/
public void updateRemark(String oldJsonStr, JcBillHg billHg) throws RuntimeException;
/**
* 修改收货地址
* @param oldJsonStr
* @param billHg
* @throws RuntimeException
*/
public void updatePac(String oldJsonStr, JcBillHg billHg) throws RuntimeException;
/**
* 保存溯源明细信息
* @param item
* @throws RuntimeException
*/
public JcSourceItem saveJcSourceItem(JcSourceItem item) throws RuntimeException;
/**
* 删除溯源明细信息
* @param ids
* @throws RuntimeException
*/
public void deleteJcSourceItem(List<Long> ids) throws RuntimeException;
/**
* 修改回购单价
* @param inItem
* @throws RuntimeException
*/
public void updateHgprice(JcBillInItem inItem)throws RuntimeException;
/**
* 修改回购单价
* @param inItem
* @throws RuntimeException
*/
public void updateOperatorname(JcBillInItem inItem, String oldStr)throws RuntimeException;
public void saveJcBillInItem(List<JcBillInItem> items)throws RuntimeException;
public List<JcBillSourceItem> queryJcBillSourceItemInBillId(List<String> billIds) throws RuntimeException;
/**
* 待入库撤回
* @throws RuntimeException
*/
public void saveRejectBill(int status, JcBill jcBill, List<JcBillInItem> inItems, List<JcBillSourceItem> sourceItems) throws RuntimeException;
/**
* 修改溯源信息客户
* @param inItems
* @throws RuntimeException
*/
public void updateSourceItemAccount(String sourceItemLogJson, String billSourceItemLogJson, String billSourceItemNewLogJson, JcSourceItem sourceItem, List<JcBillSourceItem> billSourceItems,
List<JcBillInItem> oldInItems, List<JcBillInItem> inItems)throws RuntimeException;
/**
* 稽查:根据稽查单号,稽查单关联物理仓管理策略
* @param dept
* @return
* @throws Exception
*/
public SiDepositlocation querySiDepositlocation(String srcid) throws Exception;
/**
* 回购:根据回购单号,回购单关联物理仓管理策略
* @param dept
* @return
* @throws Exception
*/
public SiDepositlocation querySiDepositlocationHGfc(String srcid) throws Exception;
/**
* WMS取消订单接口
* @param orderCode
* @param orderType
* @return
* @throws Exception
*/
public JSONObject gwisSubCancelOrder(String orderCode, String orderType) throws Exception;
}