Browse Source

Merge remote-tracking branch 'origin/dev' into dev

lazhaoqian 4 years ago
parent
commit
454bf638b5

+ 34 - 0
blade-service-api/trade-finance-api/src/main/java/com/trade/finance/dto/AccDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.trade.finance.dto;
+
+import com.trade.finance.entity.Acc;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 财务账单数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-11-23
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class AccDTO extends Acc {
+	private static final long serialVersionUID = 1L;
+
+}

+ 274 - 0
blade-service-api/trade-finance-api/src/main/java/com/trade/finance/entity/Acc.java

@@ -0,0 +1,274 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.trade.finance.entity;
+
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import java.util.Date;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 财务账单实体类
+ *
+ * @author BladeX
+ * @since 2021-11-23
+ */
+@Data
+@TableName("finance_acc")
+@ApiModel(value = "Acc对象", description = "财务账单")
+public class Acc implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 财务账单主键
+	*/
+		@ApiModelProperty(value = "财务账单主键")
+		@TableId
+		private Long id;
+	/**
+	* 系统编号
+	*/
+		@ApiModelProperty(value = "系统编号")
+		@TableField("sysNo")
+	private String sysno;
+	/**
+	* 公司id
+	*/
+		@ApiModelProperty(value = "公司id")
+		@TableField("Companyid")
+	private Long companyid;
+	/**
+	* 集团id
+	*/
+		@ApiModelProperty(value = "集团id")
+		@TableField("parent_Companyid")
+	private Long parentCompanyid;
+	/**
+	* 账单类型(结算外部账单还是公司内部账单)
+	*/
+		@ApiModelProperty(value = "账单类型(结算外部账单还是公司内部账单)")
+		@TableField("AccTypeID")
+	private Long acctypeid;
+	/**
+	* 账单日期(财务检索日期		销售订单 合同日期	采购订单 合同日期		发货单 发货日期 	收货单 收货日期
+	*/
+		@ApiModelProperty(value = "账单日期(财务检索日期		销售订单 合同日期	采购订单 合同日期		发货单 发货日期 	收货单 收货日期	")
+		@TableField("AccDate")
+	private Date accDate;
+	/**
+	* 账单单号(结算检索单号	出口,内贸	销售订单 , 对应 orderno		进口	采购订单 , 对应 orderno		出口内贸	发货单对应销售订单orderno		收货单对应采购订单orderno		进口用采购订单
+	*/
+		@ApiModelProperty(value = "账单单号(结算检索单号	出口,内贸	销售订单 , 对应 orderno		进口	采购订单 , 对应 orderno		出口内贸	发货单对应销售订单orderno		收货单对应采购订单orderno		进口用采购订单")
+		@TableField("AccSysNo")
+	private String accSysNo;
+	/**
+	* 单据类型(销售 采购 收货 发货)
+	*/
+		@ApiModelProperty(value = "单据类型(销售 采购 收货 发货)")
+		@TableField("Bill_type")
+	private String billType;
+	/**
+	* 业务数据表
+	*/
+		@ApiModelProperty(value = "业务数据表")
+		@TableField("TableName")
+	private String tablename;
+	/**
+	* 来源号(sysno )
+	*/
+		@ApiModelProperty(value = "来源号(sysno )")
+		@TableField("Src_SysNo")
+	private String srcSysno;
+	/**
+	* 来源(业务模块id )
+	*/
+		@ApiModelProperty(value = "来源(业务模块id )")
+		@TableField("Src_id")
+	private Long srcId;
+	/**
+	* 来源主表(业务模块 主表 id)
+	*/
+		@ApiModelProperty(value = "来源主表(业务模块 主表 id)")
+		@TableField("Src_parent_id")
+	private Long srcParentId;
+	/**
+	* 来源业务日期(业务模块的日 订单日期 和发货单日期 收货单日期模块 )
+	*/
+		@ApiModelProperty(value = "来源业务日期(业务模块的日 订单日期 和发货单日期 收货单日期模块 )")
+		@TableField("Src_date")
+	private Date srcDate;
+	/**
+	* 参考号 (出口 内贸 销售合同号 进口 采购合同号)
+	*/
+		@ApiModelProperty(value = "参考号 (出口 内贸 销售合同号 进口 采购合同号)	")
+		@TableField("Src_refno")
+	private String srcRefno;
+	/**
+	* 参考号 (进口和出口 主提单号)
+	*/
+		@ApiModelProperty(value = "参考号 (进口和出口 主提单号)")
+		@TableField("Src_Bill_NO")
+	private String srcBillNo;
+	/**
+	* 收款 还是 付款
+	*/
+		@ApiModelProperty(value = "收款 还是 付款")
+		@TableField("DC")
+	private String dc;
+	/**
+	* 供应商
+	*/
+		@ApiModelProperty(value = "供应商")
+		@TableField("Corpid")
+	private Long corpId;
+	/**
+	* 数量
+	*/
+		@ApiModelProperty(value = "数量")
+		private BigDecimal quantity;
+	/**
+	* 计量单位
+	*/
+		@ApiModelProperty(value = "计量单位")
+		@TableField("Unit")
+	private String unit;
+	/**
+	* 单价
+	*/
+		@ApiModelProperty(value = "单价")
+		@TableField("Price")
+	private BigDecimal price;
+	/**
+	* 币别
+	*/
+		@ApiModelProperty(value = "币别")
+		@TableField("Currency")
+	private String currency;
+	/**
+	* 汇率
+	*/
+		@ApiModelProperty(value = "汇率")
+		@TableField("Exchange_rate")
+	private BigDecimal exchangeRate;
+	/**
+	* 金额
+	*/
+		@ApiModelProperty(value = "金额")
+		@TableField("Amount")
+	private BigDecimal amount;
+	/**
+	* 开票金额
+	*/
+		@ApiModelProperty(value = "开票金额")
+		@TableField("Invoice_Amount")
+	private BigDecimal invoiceAmount;
+	/**
+	* 结算金额
+	*/
+		@ApiModelProperty(value = "结算金额")
+		@TableField("Settlement_Amount")
+	private BigDecimal settlementAmount;
+	/**
+	* 清核金额
+	*/
+		@ApiModelProperty(value = "清核金额")
+		@TableField("Apply_Amount")
+	private BigDecimal applyAmount;
+	/**
+	* 对账金额
+	*/
+		@ApiModelProperty(value = "对账金额")
+		@TableField("Check_Amount")
+	private BigDecimal checkAmount;
+	/**
+	* 是否含税
+	*/
+		@ApiModelProperty(value = "是否含税")
+		@TableField("IFTAX")
+	private String iftax;
+	/**
+	* 税率
+	*/
+		@ApiModelProperty(value = "税率")
+		@TableField("Tax_rate")
+	private BigDecimal taxRate;
+	/**
+	* 备注
+	*/
+		@ApiModelProperty(value = "备注")
+		private String remarks;
+	/**
+	* 版本
+	*/
+		@ApiModelProperty(value = "版本")
+		private String version;
+	/**
+	* 创建人
+	*/
+		@ApiModelProperty(value = "创建人")
+		private Long createUser;
+	/**
+	* 创建部门
+	*/
+		@ApiModelProperty(value = "创建部门")
+		private Long createDept;
+	/**
+	* 创建时间
+	*/
+		@ApiModelProperty(value = "创建时间")
+		private Date createTime;
+	/**
+	* 修改人
+	*/
+		@ApiModelProperty(value = "修改人")
+		private Long updateUser;
+	/**
+	* 修改时间
+	*/
+		@ApiModelProperty(value = "修改时间")
+		private Date updateTime;
+	/**
+	* 状态(0 正常 1停用)
+	*/
+		@ApiModelProperty(value = "状态(0 正常 1停用)")
+		private Integer status;
+	/**
+	* 是否已删除(0 否 1是)
+	*/
+		@ApiModelProperty(value = "是否已删除(0 否 1是)")
+		@TableLogic
+		private Integer isDeleted;
+
+	    @ApiModelProperty(value = "租户id")
+		private String tenantId;
+
+		@ApiModelProperty(value = "费用名称")
+	    private String costType;
+
+
+}

+ 5 - 2
blade-service-api/trade-finance-api/src/main/java/com/trade/finance/entity/Items.java

@@ -169,8 +169,11 @@ public class Items implements Serializable {
 		@ApiModelProperty(value = "修改人姓名")
 		private String updateUserName;
 
-	@ApiModelProperty(value = "租户id")
-	private String tenantId;
+		@ApiModelProperty(value = "租户id")
+		private String tenantId;
 
 
+		@ApiModelProperty(value = "参考号(进口和出口 主提单号)")
+		private String srcBillNO;
+
 }

+ 36 - 0
blade-service-api/trade-finance-api/src/main/java/com/trade/finance/vo/AccVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.trade.finance.vo;
+
+import com.trade.finance.entity.Acc;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 财务账单视图实体类
+ *
+ * @author BladeX
+ * @since 2021-11-23
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "AccVO对象", description = "财务账单")
+public class AccVO extends Acc {
+	private static final long serialVersionUID = 1L;
+
+}

+ 22 - 4
blade-service/store-goods/src/main/java/com/store/goods/controller/GoodsDescController.java

@@ -78,12 +78,21 @@ public class GoodsDescController extends BladeController {
 			BigDecimal lowPrice = itemsList.stream()
 				.filter(o -> o.getPrice().compareTo(BigDecimal.ZERO) == 1)
 				.map(GoodsItems::getPrice).distinct().min(BigDecimal::compareTo).get();
-			detail.setLowPrice(lowPrice);
+
 			//最高价
 			BigDecimal highPrice = itemsList.stream()
 				.filter(o -> o.getPrice().compareTo(BigDecimal.ZERO) == 1)
 				.map(GoodsItems::getPrice).distinct().max(BigDecimal::compareTo).get();
-			detail.setHighPrice(highPrice);
+
+			if(lowPrice.compareTo(highPrice)==0)
+			{
+				detail.setLowPrice(lowPrice);
+			}
+			else
+			{
+				detail.setLowPrice(lowPrice);
+				detail.setHighPrice(highPrice);
+			}
 		}
 
 		detail.setItemsList(itemsList);
@@ -119,12 +128,21 @@ public class GoodsDescController extends BladeController {
 					BigDecimal lowPrice = itemsList.stream()
 						.filter(o -> o.getPrice().compareTo(BigDecimal.ZERO) == 1)
 						.map(GoodsItems::getPrice).distinct().min(BigDecimal::compareTo).get();
-					e.setLowPrice(lowPrice);
+
 					//最高价
 					BigDecimal highPrice = itemsList.stream()
 						.filter(o -> o.getPrice().compareTo(BigDecimal.ZERO) == 1)
 						.map(GoodsItems::getPrice).distinct().max(BigDecimal::compareTo).get();
-					e.setHighPrice(highPrice);
+
+					if(lowPrice.compareTo(highPrice)==0)
+					{
+						e.setLowPrice(lowPrice);
+					}
+					else
+					{
+						e.setLowPrice(lowPrice);
+						e.setHighPrice(highPrice);
+					}
 				}
 
 			});

+ 148 - 0
blade-service/trade-finance/src/main/java/com/trade/finance/controller/AccController.java

@@ -0,0 +1,148 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.trade.finance.controller;
+
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.trade.finance.vo.AccVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.trade.finance.entity.Acc;
+
+import com.trade.finance.service.IAccService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+import java.util.List;
+
+/**
+ * 财务账单 控制器
+ *
+ * @author BladeX
+ * @since 2021-11-23
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/acc")
+@Api(value = "财务账单", tags = "财务账单接口")
+public class AccController extends BladeController {
+
+	private final IAccService accService;
+
+
+	/**
+	 * 财务账单添加
+	 * */
+	@PostMapping("/createAcc")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "生成财务账单", notes = "传入acc")
+	public R createAcc(@RequestBody  List<Acc> acc)
+	{
+		if(CollectionUtils.isEmpty(acc))
+		{
+			throw new SecurityException("传入数据为空");
+		}
+		accService.submit(acc);
+		return R.success("操作成功");
+	}
+
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入acc")
+	public R<Acc> detail(Acc acc) {
+		Acc detail = accService.getOne(Condition.getQueryWrapper(acc));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 财务账单
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入acc")
+	public R<IPage<Acc>> list(Acc acc, Query query) {
+		IPage<Acc> pages = accService.page(Condition.getPage(query), Condition.getQueryWrapper(acc));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 财务账单
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入acc")
+	public R<IPage<AccVO>> page(AccVO acc, Query query) {
+		IPage<AccVO> pages = accService.selectAccPage(Condition.getPage(query), acc);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 财务账单
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入acc")
+	public R save(@Valid @RequestBody Acc acc) {
+		return R.status(accService.save(acc));
+	}
+
+	/**
+	 * 修改 财务账单
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入acc")
+	public R update(@Valid @RequestBody Acc acc) {
+		return R.status(accService.updateById(acc));
+	}
+
+	/**
+	 * 新增或修改 财务账单
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入acc")
+	public R submit(@Valid @RequestBody Acc acc) {
+		return R.status(accService.saveOrUpdate(acc));
+	}
+
+
+	/**
+	 * 删除 财务账单
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(accService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}

+ 44 - 0
blade-service/trade-finance/src/main/java/com/trade/finance/mapper/AccMapper.java

@@ -0,0 +1,44 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.trade.finance.mapper;
+
+import com.trade.finance.entity.Acc;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.trade.finance.vo.AccVO;
+
+import java.util.List;
+
+/**
+ * 财务账单 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-11-23
+ */
+public interface AccMapper extends BaseMapper<Acc> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param acc
+	 * @return
+	 */
+	List<AccVO> selectAccPage(IPage page, AccVO acc);
+
+}

+ 52 - 0
blade-service/trade-finance/src/main/java/com/trade/finance/mapper/AccMapper.xml

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.trade.finance.mapper.AccMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="accResultMap" type="com.trade.finance.entity.Acc">
+        <id column="id" property="id"/>
+        <result column="sysNo" property="sysno"/>
+        <result column="Companyid" property="companyid"/>
+        <result column="parent_Companyid" property="parentCompanyid"/>
+        <result column="AccTypeID" property="acctypeid"/>
+        <result column="AccDate" property="accdate"/>
+        <result column="AccSysNo" property="accsysno"/>
+        <result column="Bill_type" property="billType"/>
+        <result column="TableName" property="tablename"/>
+        <result column="Src_SysNo" property="srcSysno"/>
+        <result column="Src_id" property="srcId"/>
+        <result column="Src_parent_id" property="srcParentId"/>
+        <result column="Src_date" property="srcDate"/>
+        <result column="Src_refno" property="srcRefno"/>
+        <result column="Src_Bill_NO" property="srcBillNo"/>
+        <result column="DC" property="dc"/>
+        <result column="Corpid" property="corpid"/>
+        <result column="quantity" property="quantity"/>
+        <result column="Unit" property="unit"/>
+        <result column="Price" property="price"/>
+        <result column="Currency" property="currency"/>
+        <result column="Exchange_rate" property="exchangeRate"/>
+        <result column="Amount" property="amount"/>
+        <result column="Invoice_Amount" property="invoiceAmount"/>
+        <result column="Settlement_Amount" property="settlementAmount"/>
+        <result column="Apply_Amount" property="applyAmount"/>
+        <result column="Check_Amount" property="checkAmount"/>
+        <result column="IFTAX" property="iftax"/>
+        <result column="Tax_rate" property="taxRate"/>
+        <result column="remarks" property="remarks"/>
+        <result column="version" property="version"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+    </resultMap>
+
+
+    <select id="selectAccPage" resultMap="accResultMap">
+        select * from finance_acc where is_deleted = 0
+    </select>
+
+</mapper>

+ 45 - 0
blade-service/trade-finance/src/main/java/com/trade/finance/service/IAccService.java

@@ -0,0 +1,45 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.trade.finance.service;
+
+import com.trade.finance.entity.Acc;
+import com.trade.finance.vo.AccVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.util.List;
+
+/**
+ * 财务账单 服务类
+ *
+ * @author BladeX
+ * @since 2021-11-23
+ */
+public interface IAccService extends IService<Acc> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param acc
+	 * @return
+	 */
+	IPage<AccVO> selectAccPage(IPage<AccVO> page, AccVO acc);
+
+	void submit(List<Acc> acc);
+
+}

+ 121 - 0
blade-service/trade-finance/src/main/java/com/trade/finance/service/impl/AccServiceImpl.java

@@ -0,0 +1,121 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.trade.finance.service.impl;
+
+import com.trade.finance.entity.Acc;
+import com.trade.finance.entity.Items;
+import com.trade.finance.entity.Settlement;
+import com.trade.finance.mapper.ItemsMapper;
+import com.trade.finance.mapper.SettlementMapper;
+
+import com.trade.finance.mapper.AccMapper;
+import com.trade.finance.service.IAccService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.trade.finance.vo.AccVO;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 财务账单 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-11-23
+ */
+@Service
+public class AccServiceImpl extends ServiceImpl<AccMapper, Acc> implements IAccService
+{
+	@Autowired
+	private SettlementMapper settlementMapper;
+	@Autowired
+	private ItemsMapper itemsMapper;
+
+	@Override
+	public IPage<AccVO> selectAccPage(IPage<AccVO> page, AccVO acc) {
+		return page.setRecords(baseMapper.selectAccPage(page, acc));
+	}
+
+	@Override
+	@Transactional
+	public void submit(List<Acc> acc)
+	{
+		//生成账单
+		acc.forEach(e->
+		{
+			e.setStatus(0);
+			e.setTenantId(AuthUtil.getTenantId());
+			e.setIsDeleted(0);
+			e.setCreateTime(new Date());
+			e.setUpdateUser(AuthUtil.getUserId());
+			e.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
+			baseMapper.insert(e);
+		});
+
+		//生成结算单
+		Settlement settlement=new Settlement();
+		if(acc.get(0).getBillType().equals("CG"))
+		{
+			settlement.setBillType("付费");
+		}
+		else if(acc.get(0).getBillType().equals("XS"))
+		{
+			settlement.setBillType("收费");
+		}
+		settlement.setSrcOrderno(acc.get(0).getAccSysNo());
+		settlement.setCorpId(acc.get(0).getCorpId());
+		settlement.setTenantId(AuthUtil.getTenantId());
+		settlement.setIsDeleted(0);
+		settlement.setCreateTime(new Date());
+		settlement.setUpdateUser(AuthUtil.getUserId());
+		settlement.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
+		settlementMapper.insert(settlement);
+		//生成结算单子表
+		acc.forEach(k->
+		{
+			//生成结算单子表
+			Items items=new Items();
+			items.setPid(settlement.getId());
+			items.setItemId(k.getSrcId());
+			items.setCorpId(k.getCorpId());
+			items.setQuantity(k.getQuantity());
+			items.setUnit(k.getUnit());
+			items.setPrice(k.getPrice());
+			items.setCurrency(k.getCurrency());
+			items.setExchangeRate(k.getExchangeRate());
+			items.setAmount(k.getAmount());
+			items.setSrcOrderno(k.getAccSysNo());
+			items.setSrcBillNO(k.getSrcBillNo());
+			items.setTaxRate(k.getTaxRate());
+			/*items.setSettlmentAmount(k.getSettlementAmount());*///核销金额
+
+			items.setTenantId(AuthUtil.getTenantId());
+			items.setIsDeleted(0);
+			items.setCreateTime(new Date());
+			items.setUpdateUser(AuthUtil.getUserId());
+			items.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
+			itemsMapper.insert(items);
+		});
+
+
+	}
+
+}