Browse Source

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

dev
zhangsiqi 3 months ago
parent
commit
3be84440ec
  1. 14
      ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceServiceImpl.java
  2. 27
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java
  3. 10
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerMapper.java
  4. 9
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysInvoiceMapper.java
  5. 11
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java
  6. 6
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysContactsServiceImpl.java
  7. 57
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java
  8. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysShippingAddressServiceImpl.java
  9. 11
      ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml
  10. 5
      ruoyi-admin/src/main/resources/mapper/system/SysInvoiceMapper.xml
  11. 12
      ruoyi-admin/src/main/resources/templates/system/invoice/invoice.html
  12. 122
      ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceRMB.html

14
ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceServiceImpl.java

@ -10,7 +10,9 @@ import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.financial.domain.FinancialTaxInvoiceMaterial;
import com.ruoyi.financial.mapper.FinancialTaxInvoiceMaterialMapper;
import com.ruoyi.financial.service.IFinancialTaxInvoiceMaterialService;
import com.ruoyi.system.domain.SysCustomerVo;
import com.ruoyi.system.domain.SysSalesOrder;
import com.ruoyi.system.mapper.SysCustomerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.financial.mapper.FinancialTaxInvoiceMapper;
@ -37,6 +39,9 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi
@Autowired
private IFinancialTaxInvoiceMaterialService invoiceMaterialService;
@Autowired
private SysCustomerMapper sysCustomerMapper;
@Autowired
private RedisCache redisCache;
@ -164,6 +169,15 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi
financialTaxInvoice.setNoRmbSum(BigDecimal.valueOf(sysSalesOrder.getNoRmbSum()));
financialTaxInvoice.setUsdTaxSum(BigDecimal.valueOf(sysSalesOrder.getUsdTaxSum()));
financialTaxInvoice.setNoUsdSum(BigDecimal.valueOf(sysSalesOrder.getNoUsdSum()));
SysCustomerVo sysCustomerVo = sysCustomerMapper.selectSysCustomerByEnterpriseCode(sysSalesOrder.getEnterpriseCode());
financialTaxInvoice.setInvoiceCompanyCode(sysCustomerVo.getInvoicingCustomerName());
financialTaxInvoice.setInvoiceCompanyName(sysCustomerVo.getInvoicingCompanyName());
financialTaxInvoice.setBankAccount(sysCustomerVo.getBankAccount());
financialTaxInvoice.setDepositBank(sysCustomerVo.getDepositBank());
return financialTaxInvoice;
}

27
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java

@ -581,4 +581,31 @@ public class SysCustomerController extends BaseController
SysCustomer sysCustomer = sysCustomerService.selectSysCustomerByCustomerId(enterpriseCode);
return AjaxResult.success(sysCustomer);
}
/**
* 通过客户id查询开票公司信息
* */
@ResponseBody
@GetMapping("/getAllInvoiceCompanyNameByCode")
public List<SysInvoice> getAllInvoiceCompanyNameByCode(@RequestParam("enterpriseCode") String enterpriseCode ) {
List<SysInvoice> invoiceList = sysCustomerService.getInvoiceCompanyListByCode(enterpriseCode);
return invoiceList;
}
/**
* 通过开票公司名称查询开票公司信息
* */
@ResponseBody
@PostMapping("/getSysInvoiceInfoByName")
public AjaxResult getSysInvoiceInfoByName(String invoiceCompanyName) {
SysInvoice result = sysCustomerService.getSysInvoiceInfoByName(invoiceCompanyName);
if (result != null) {
return AjaxResult.success(result);
} else {
return AjaxResult.error("未找到对应的开票信息");
}
}
}

10
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerMapper.java

@ -89,4 +89,14 @@ public interface SysCustomerMapper
int cancelSysCustomerById(Long id);
SysCustomerVo selectSysCustomerByCustomer(SysCustomerVo sysCustomerVo);
/*
* 通过客户名称查询客户详情
* */
SysCustomerVo selectSysCustomerByEnterpriseName(String enterpriseName);
/*
* 通过开票公司名称名称查询客户详情
* */
SysCustomerVo selectSysCustomerByInvoiceCompanyName(String invoicingCompanyName);
}

9
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysInvoiceMapper.java

@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysInvoice;
import org.apache.ibatis.annotations.Param;
/**
* 其他开票信息Mapper接口
@ -80,4 +81,12 @@ public interface SysInvoiceMapper
* @return 结果
*/
public int restoreSysInvoiceById(Long id);
/**
* 根据客户名称查询客户信息
*
* @param invoiceCompanyName 客户名称
* @return 结果
*/
SysInvoice selectSysInvoiceByName(String invoiceCompanyName);
}

11
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java

@ -3,6 +3,7 @@ package com.ruoyi.system.service;
import com.ruoyi.aftersales.domain.dto.CustomerDto;
import com.ruoyi.system.domain.SysCustomer;
import com.ruoyi.system.domain.SysCustomerVo;
import com.ruoyi.system.domain.SysInvoice;
import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.transaction.annotation.Transactional;
@ -99,4 +100,14 @@ public interface ISysCustomerService
List<SysCustomer> selectSysCustomerWithComplaintNotice();
List<SysCustomer> getMatchCustomerList(String customerCode);
/**
* 通过客户id查询开票公司信息
* */
List<SysInvoice> getInvoiceCompanyListByCode(String enterpriseCode);
/**
* 通过开票公司名称查询开票公司信息
* */
SysInvoice getSysInvoiceInfoByName(String invoiceCompanyName);
}

6
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysContactsServiceImpl.java

@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -63,7 +64,8 @@ public class SysContactsServiceImpl implements ISysContactsService
public int insertSysContacts(SysContacts sysContacts)
{
String loginName = ShiroUtils.getLoginName();
sysContacts.setFirstAddTime(String.valueOf(new Date().getTime()));
sysContacts.setFirstAddTime(String.valueOf(DateUtils.getNowDate()));
sysContacts.setCreateTime(DateUtils.getNowDate());
sysContacts.setCreateBy(loginName);
int id = sysContactsMapper.insertSysContacts(sysContacts);
sysContacts.getContactid();
@ -79,6 +81,8 @@ public class SysContactsServiceImpl implements ISysContactsService
@Override
public int updateSysContacts(SysContacts sysContacts)
{
sysContacts.setUpdateBy(ShiroUtils.getLoginName());
sysContacts.setUpdateTime(DateUtils.getNowDate());
return sysContactsMapper.updateSysContacts(sysContacts);
}

57
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java

@ -14,6 +14,7 @@ import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.mapper.SysCustomerMapper;
import com.ruoyi.system.mapper.SysInvoiceMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.ISysCustomerService;
import com.ruoyi.system.service.ISysInvoiceService;
@ -43,6 +44,9 @@ public class SysCustomerServiceImpl implements ISysCustomerService
@Autowired
private SysCustomerMapper sysCustomerMapper;
@Autowired
private SysInvoiceMapper sysInvoiceMapper;
@Autowired
private RedisCache redisCache;
@ -319,6 +323,59 @@ public class SysCustomerServiceImpl implements ISysCustomerService
return sysCustomerMapper.selectSysCustomerByCustomerId(enterpriseCode);
}
/**
* 通过客户id查询开票公司信息
* */
@Override
public List<SysInvoice> getInvoiceCompanyListByCode(String enterpriseCode) {
List<SysInvoice> sysInvoices = new ArrayList<>();
//SysCustomerVo sysCustomerVo = sysCustomerMapper.selectSysCustomerByEnterpriseCode(enterpriseCode);
List<SysInvoice> invoiceList = sysInvoiceService.selectSysInvoiceByCode(enterpriseCode);
// SysInvoice sysInvoice = new SysInvoice();
// sysInvoice.setBankAccount(sysCustomerVo.getBankAccount());
// sysInvoice.setDepositBank(sysCustomerVo.getDepositBank());
// sysInvoice.setEnterpriseCode(sysCustomerVo.getEnterpriseCode());
// sysInvoice.setEnterpriseName(sysCustomerVo.getEnterpriseName());
// sysInvoice.setInvoiceCompanyCode(sysCustomerVo.getInvoicingCustomerName());
// sysInvoice.setInvoiceCompanyName(sysCustomerVo.getInvoicingCompanyName());
//
// if (sysInvoice != null){
// sysInvoices.add(sysInvoice);
// }
sysInvoices.addAll(invoiceList);
return sysInvoices;
}
/**
* 通过开票公司名称查询开票公司信息
* */
@Override
public SysInvoice getSysInvoiceInfoByName(String invoiceCompanyName) {
SysInvoice sysInvoice = sysInvoiceMapper.selectSysInvoiceByName(invoiceCompanyName);
if (sysInvoice != null){
return sysInvoice;
}else {
SysInvoice tempSysInvoice = new SysInvoice();
SysCustomerVo sysCustomerVo = sysCustomerMapper.selectSysCustomerByInvoiceCompanyName(invoiceCompanyName);
tempSysInvoice.setBankAccount(sysCustomerVo.getBankAccount());
tempSysInvoice.setDepositBank(sysCustomerVo.getDepositBank());
tempSysInvoice.setEnterpriseCode(sysCustomerVo.getEnterpriseCode());
tempSysInvoice.setEnterpriseName(sysCustomerVo.getEnterpriseName());
tempSysInvoice.setInvoiceCompanyCode(sysCustomerVo.getInvoicingCustomerName());
tempSysInvoice.setInvoiceCompanyName(sysCustomerVo.getInvoicingCompanyName());
return tempSysInvoice;
}
}
@Override
public int add(SysCustomer sysCustomer) {
return sysCustomerMapper.insertSysCustomer(sysCustomer);

4
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysShippingAddressServiceImpl.java

@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.SysShippingAddress;
import com.ruoyi.system.mapper.SysShippingAddressMapper;
@ -57,6 +58,7 @@ public class SysShippingAddressServiceImpl implements ISysShippingAddressService
{
String loginName = ShiroUtils.getLoginName();
sysShippingAddress.setCreateBy(loginName);
sysShippingAddress.setCreateTime(DateUtils.getNowDate());
int id = sysShippingAddressMapper.insertSysShippingAddress(sysShippingAddress);
sysShippingAddress.getDeliveryId();
return id;
@ -71,6 +73,8 @@ public class SysShippingAddressServiceImpl implements ISysShippingAddressService
@Override
public int updateSysShippingAddress(SysShippingAddress sysShippingAddress)
{
sysShippingAddress.setUpdateBy(ShiroUtils.getLoginName());
sysShippingAddress.setUpdateTime(DateUtils.getNowDate());
return sysShippingAddressMapper.updateSysShippingAddress(sysShippingAddress);
}

11
ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml

@ -151,6 +151,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where enterprise_code = #{enterpriseCode}
</select>
<select id="selectSysCustomerByInvoiceCompanyName" parameterType="String" resultMap="SysCustomerResult">
<include refid="selectSysCustomerVo"/>
where invoicing_company_name = #{invoicingCompanyName}
</select>
<select id="selectSysCustomerByEnterpriseName" parameterType="String" resultMap="SysCustomerResult">
<include refid="selectSysCustomerVo"/>
where enterprise_name = #{enterpriseName}
</select>
<select id="selectSysCustomerByCustomer" parameterType="SysCustomerVo" resultMap="SysCustomerResult">
<include refid="selectSysCustomerVo"/>
where enterprise_name = #{enterpriseName} and customer_purser = #{customerPurser}
@ -353,4 +363,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where use_status = '1' and use_status = '1'
and enterprise_code like concat(#{prefix}, '%') escape '\\'
</select>
</mapper>

5
ruoyi-admin/src/main/resources/mapper/system/SysInvoiceMapper.xml

@ -44,6 +44,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where enterprise_code = #{enterpriseCode}
</select>
<select id="selectSysInvoiceByName" parameterType="String" resultMap="SysInvoiceResult">
<include refid="selectSysInvoiceVo"/>
where invoice_company_name = #{invoiceCompanyName}
</select>
<insert id="insertSysInvoice" parameterType="SysInvoice" useGeneratedKeys="true" keyProperty="id">
insert into sys_invoice
<trim prefix="(" suffix=")" suffixOverrides=",">

12
ruoyi-admin/src/main/resources/templates/system/invoice/invoice.html

@ -93,6 +93,18 @@
title: '公司开户账号',
field: 'bankAccount',
},
{
title: '录入人',
field: 'createBy',
},
{
title: '录入时间',
field: 'createTime',
},
{
title: '更新时间',
field: 'updateTime',
},
{
title: '操作',
align: 'center',

122
ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceRMB.html

@ -61,31 +61,35 @@
<div class="form-group">
<label class="col-sm-5 control-label">开票公司名称:</label>
<div class="col-sm-7">
<input name="invoiceCompanyName" th:field="*{invoiceCompanyName}" class="form-control" type="text">
<select class="form-control" id="invoiceCompanyName" name="invoiceCompanyName" th:field="*{invoiceCompanyName}">
<!-- 这里动态生成开票公司名称选项 -->
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">开票公司税号:</label>
<div class="col-sm-7">
<input name="invoiceCompanyCode" th:field="*{invoiceCompanyCode}" class="form-control" type="text">
<input name="invoiceCompanyCode" th:field="*{invoiceCompanyCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">公司开户行:</label>
<div class="col-sm-7">
<input name="depositBank" th:field="*{depositBank}" class="form-control" type="text">
<input name="depositBank" th:field="*{depositBank}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">公司开户账号:</label>
<div class="col-sm-7">
<input name="bankAccount" th:field="*{bankAccount}" class="form-control" type="text">
<input name="bankAccount" th:field="*{bankAccount}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">税率:</label>
<div class="col-sm-7">
<input name="taxRate" th:field="*{taxRate}" class="form-control" type="text">
<input name="taxRate" th:field="*{taxRate}" class="form-control" type="text" readonly>
</div>
</div>
@ -120,19 +124,6 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">业务人员:</label>
<div class="col-sm-7">
<input name="businessMembers" th:field="*{businessMembers}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">申请人:</label>
<div class="col-sm-7">
<input name="applyUser" th:field="*{applyUser}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">邮箱:</label>
<div class="col-sm-7">
@ -234,6 +225,8 @@
var materialProcessMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var taxInvoice = [[${taxInvoice}]];
var prefix = ctx + "system/salesOrder"
$("#form-taxInvoice-RMBAdd").validate({
focusCleanup: true
@ -371,6 +364,99 @@
});
//获取客户发票信息
$(document).ready(function() {
// 初始化时默认加载客户编号列表
loadInvoiceCompanyNames();
// 监听开票公司名称下拉框的变化
$('#invoiceCompanyName').on('change', function() {
var selectedInvoiceCompanyName = $(this).val(); // 获取选中的开票公司名称
if (selectedInvoiceCompanyName) {
// 发起Ajax请求获取客户名称
$.ajax({
type: 'POST',
url: ctx + 'system/customer/getSysInvoiceInfoByName',
dataType: 'json', // 假设返回的数据格式是JSON
data: { invoiceCompanyName: selectedInvoiceCompanyName }, // 数据放在这里
success: function(data) {
console.log(data);
// 将获取到的客户名称填充到输入框
if (!data || !data.data) {
// 如果返回的数据有问题,可以给出提示或处理
$.modal.alertWarning('未能获取到开票公司信息!');
} else {
fillInvoiceDetails(data.data);
}
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('Error:', textStatus, errorThrown);
$.modal.alertWarning('查询开票公司名称时发生错误!');
}
});
} else {
// 如果没有选择开票公司名称,清开票信息输入框
clearInvoiceDetails();
}
});
});
// 封装填充发票详情的函数
function fillInvoiceDetails(details) {
$('input[name="invoiceCompanyCode"]').val(details.invoiceCompanyCode);
$('input[name="depositBank"]').val(details.depositBank);
$('input[name="bankAccount"]').val(details.bankAccount);
}
// 封装清空发票详情的函数
function clearInvoiceDetails() {
$('input[name="invoiceCompanyCode"]').val('');
$('input[name="depositBank"]').val('');
$('input[name="bankAccount"]').val('');
}
// 假设的加载客户编号列表函数
function loadInvoiceCompanyNames() {
var enterpriseCode = $("#enterpriseCode").val();
var url = ctx + 'system/customer/getAllInvoiceCompanyNameByCode' + '?enterpriseCode=' + enterpriseCode;
var tempInvoiceCompanyName = taxInvoice.invoiceCompanyName;
$.ajax({
type: 'GET', // 请求类型
url: url, // 后端接口URL
dataType: 'json', // 预期服务器返回的数据类型
success: function(data) {
if (data && Array.isArray(data)) {
var selectElement = $('#invoiceCompanyName'); // 获取开票公司名称下拉框元素
// 清空下拉框现有选项
selectElement.empty();
// 添加默认选项
if (tempInvoiceCompanyName) {
selectElement.append('<option value="' + tempInvoiceCompanyName + '">' + tempInvoiceCompanyName + '</option>');
}
// 遍历返回的数据,添加为下拉框的选项
$.each(data, function(index, item) {
// 假设item有invoiceCompanyName属性,代表客户名称
selectElement.append('<option value="' + item.invoiceCompanyName + '">' + item.invoiceCompanyName + '</option>');
});
// 设置默认值
if (tempInvoiceCompanyName) {
selectElement.val(tempInvoiceCompanyName);
}
} else {
$.modal.errMsg("开票公司信息为空");
}
},
});
}
</script>
</body>
</html>
Loading…
Cancel
Save