| | |
| | |
|
| | | /** 父部门名称 */
|
| | | private String parentName;
|
| | |
|
| | | /** 部门编号 */
|
| | | private String deptNick;
|
| | |
|
| | | /** 子部门 */
|
| | | private List<SysDept> children = new ArrayList<SysDept>();
|
| | |
| | | this.children = children;
|
| | | }
|
| | |
|
| | | public String getDeptNick() {
|
| | | return deptNick;
|
| | | }
|
| | |
|
| | | public void setDeptNick(String deptNick) {
|
| | | this.deptNick = deptNick;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String toString() {
|
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.mapper.ProductMapper; |
| | |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | |
| | | public int addOrEditPurchase(PurchaseLedgerDto purchaseLedgerDto) throws IOException { |
| | | |
| | | SalesLedger salesLedger = salesLedgerMapper.selectById(purchaseLedgerDto.getSalesLedgerId()); |
| | | |
| | | if (salesLedger == null) { |
| | | throw new BaseException("销售台账不存在"); |
| | | } |
| | | //录入人 |
| | | SysUser sysUser = userMapper.selectUserById(purchaseLedgerDto.getRecorderId()); |
| | | |
| | |
| | | // DTO转Entity |
| | | PurchaseLedger purchaseLedger = new PurchaseLedger(); |
| | | BeanUtils.copyProperties(purchaseLedgerDto, purchaseLedger); |
| | | purchaseLedger.setTenantId(salesLedger.getTenantId()); |
| | | purchaseLedger.setSalesContractNo(salesLedger.getSalesContractNo()); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | if(ObjectUtils.isNotEmpty(loginUser) && null != loginUser.getTenantId()) { |
| | | purchaseLedger.setTenantId(loginUser.getTenantId().longValue()); |
| | | } |
| | | purchaseLedger.setSalesContractNo(ObjectUtils.isNotEmpty(salesLedger) ? salesLedger.getSalesContractNo() : null); |
| | | purchaseLedger.setSupplierName(supplierManage.getSupplierName()); |
| | | purchaseLedger.setRecorderId(purchaseLedgerDto.getRecorderId()); |
| | | purchaseLedger.setRecorderName(sysUser.getNickName()); |
| | |
| | | package com.ruoyi.sales.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | |
| | | * 查询销售台账列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SalesLedgerDto salesLedgerDto) { |
| | | public TableDataInfo list(Page page, SalesLedgerDto salesLedgerDto) { |
| | | startPage(); |
| | | List<SalesLedger> list = salesLedgerService.selectSalesLedgerList(salesLedgerDto); |
| | | // 计算已开票金额/未开票金额(已填写发票金额为准) |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.sales.dto.MonthlyAmountDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.mapper.*; |
| | |
| | | private final InvoiceLedgerMapper invoiceLedgerMapper; |
| | | |
| | | @Autowired |
| | | private InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; |
| | | private SysDeptMapper sysDeptMapper; |
| | | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | |
| | | throw new RuntimeException("获取合同编号生成锁失败:超时"); |
| | | } |
| | | |
| | | // 2. 查询当天已存在的序列号(与原逻辑一致) |
| | | // 2. 查询当天/公司已存在的序列号(与原逻辑一致) |
| | | Integer tenantId = SecurityUtils.getLoginUser().getTenantId(); |
| | | if(null != tenantId){ |
| | | //获取公司编号 |
| | | SysDept sysDept = sysDeptMapper.selectDeptById(tenantId.longValue()); |
| | | if(!ObjectUtils.isEmpty(sysDept)){ |
| | | datePart = (StringUtils.isEmpty(sysDept.getDeptNick()) ? "" : sysDept.getDeptNick()) + datePart; |
| | | } |
| | | } |
| | | List<Integer> existingSequences = salesLedgerMapper.selectSequencesByDate(datePart); |
| | | int nextSequence = findFirstMissingSequence(existingSequences); |
| | | |
| | |
| | | <mapper namespace="com.ruoyi.sales.mapper.SalesLedgerMapper"> |
| | | |
| | | <select id="selectSequencesByDate" resultType="java.lang.Integer"> |
| | | SELECT CAST(SUBSTR(sales_contract_no, 9, 3) AS SIGNED) |
| | | SELECT CAST(SUBSTR(sales_contract_no,LENGTH(#{datePart})+1 , 3) AS SIGNED) |
| | | FROM sales_ledger |
| | | WHERE SUBSTR(sales_contract_no, 1, 8) = #{datePart} |
| | | WHERE sales_contract_no LIKE CONCAT('%',#{datePart},'%') |
| | | </select> |
| | | <select id="getSalesNo" resultType="com.ruoyi.sales.pojo.SalesLedger"> |
| | | |
| | |
| | | |
| | | <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult"> |
| | | select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, |
| | | (select dept_name from sys_dept where dept_id = d.parent_id) parent_name |
| | | (select dept_name from sys_dept where dept_id = d.parent_id) parent_name, |
| | | d.dept_nick |
| | | from sys_dept d |
| | | where d.dept_id = #{deptId} |
| | | </select> |
| | |
| | | <if test="leader != null and leader != ''">leader,</if> |
| | | <if test="phone != null and phone != ''">phone,</if> |
| | | <if test="email != null and email != ''">email,</if> |
| | | <if test="deptNick != null and deptNick != ''">dept_nick,</if> |
| | | <if test="status != null">status,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | create_time |
| | |
| | | <if test="leader != null and leader != ''">#{leader},</if> |
| | | <if test="phone != null and phone != ''">#{phone},</if> |
| | | <if test="email != null and email != ''">#{email},</if> |
| | | <if test="deptNick != null and deptNick != '' ">#{deptNick},</if> |
| | | <if test="status != null">#{status},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | |
| | | <if test="leader != null">leader = #{leader},</if> |
| | | <if test="phone != null">phone = #{phone},</if> |
| | | <if test="email != null">email = #{email},</if> |
| | | <if test="deptNick != null and deptNick != '' ">dept_nick = #{deptNick},</if> |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |