server/company/src/main/java/com/doumee/api/business/InsuranceApplyController.java
@@ -76,6 +76,13 @@ return ApiResponse.success(insuranceApplyService.findPage(pageWrap)); } @ApiOperation("å表") @PostMapping("/findListByDTO") @RequiresPermissions("business:insuranceapply:query") public ApiResponse<List<InsuranceApply>> findListByDTO (@RequestBody InsuranceApplyQueryDTO insuranceApplyQueryDTO) { return ApiResponse.success(insuranceApplyService.findListByDTO(insuranceApplyQueryDTO)); } @ApiOperation("导åºExcel") @PostMapping("/exportExcel") @RequiresPermissions("business:insuranceapply:exportExcel") server/company/src/main/java/com/doumee/api/business/TaxesController.java
@@ -3,14 +3,20 @@ import com.doumee.api.BaseController; import com.doumee.core.annotation.excel.ExcelExporter; import com.doumee.core.annotation.pr.PreventRepeat; import com.doumee.core.constants.ResponseStatus; import com.doumee.core.exception.BusinessException; import com.doumee.core.model.ApiResponse; import com.doumee.core.model.LoginUserInfo; import com.doumee.core.model.PageWrap; import com.doumee.core.model.PageData; import com.doumee.core.utils.Constants; import com.doumee.dao.business.dto.EntrustInvoicingDTO; import com.doumee.dao.business.model.Taxes; import com.doumee.service.business.TaxesService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -71,7 +77,7 @@ @PostMapping("/page") @RequiresPermissions("business:taxes:query") public ApiResponse<PageData<Taxes>> findPage (@RequestBody PageWrap<Taxes> pageWrap) { return ApiResponse.success(taxesService.findPage(pageWrap)); return ApiResponse.success(taxesService.findPageForCompany(pageWrap)); } @ApiOperation("导åºExcel") @@ -81,10 +87,22 @@ ExcelExporter.build(Taxes.class).export(taxesService.findPage(pageWrap).getRecords(), "å票信æ¯è¡¨", response); } @ApiOperation("æ ¹æ®IDæ¥è¯¢") @GetMapping("/{id}") @ApiOperation("è·åä¼ä¸ä¿¡æ¯") @GetMapping("/getCompanyDetail") @RequiresPermissions("business:taxes:query") public ApiResponse findById(@PathVariable Integer id) { return ApiResponse.success(taxesService.findById(id)); public ApiResponse getCompanyDetail() { LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); if(!loginUserInfo.getType().equals(Constants.ONE)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"éä¼ä¸ç±»ç¨æ·æ æ³è¿è¡è¯¥æä½"); } return ApiResponse.success(taxesService.findById(loginUserInfo.getCompanyId())); } @ApiOperation("æäº¤å§æææ¥å¼ç¥¨") @PostMapping("/entrustInvoicing") public ApiResponse entrustInvoicing(@RequestBody EntrustInvoicingDTO entrustInvoicingDTOs) { taxesService.entrustInvoicing(entrustInvoicingDTOs); return ApiResponse.success(null); } } server/service/src/main/java/com/doumee/dao/business/dto/EntrustInvoicingDTO.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,32 @@ package com.doumee.dao.business.dto; import com.doumee.dao.business.model.TaxDetial; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; import java.util.List; /** * Created by IntelliJ IDEA. * * @Author : Rk * @create 2024/1/23 16:01 */ @Data public class EntrustInvoicingDTO { @ApiModelProperty(value = "å¼ç¥¨éé¢") private BigDecimal invoicingMoney; @ApiModelProperty(value = "æ¥æ¶æ¹å¼ 0çµåå票 1纸质å票") private Integer type; @ApiModelProperty(value = "åç¥¨æ¥æ¶å°å") private String address; @ApiModelProperty(value = "æä¿ä¸»é®å表" ,notes = "insuranceApplyId ã fee ãapplyCode ") private List<TaxDetial> taxDetialList; } server/service/src/main/java/com/doumee/dao/business/dto/InsuranceApplyQueryDTO.java
@@ -8,8 +8,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; import java.util.List; /** * @author RenKang @@ -35,13 +37,23 @@ @ApiModelProperty(value = "åå·") private String code; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") @JsonFormat(pattern = "yyyy-MM-dd HH:mm") @ApiModelProperty(value = "æäº¤æ¥æå¼å§") private Date createTimeS; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") @JsonFormat(pattern = "yyyy-MM-dd HH:mm") @ApiModelProperty(value = "æäº¤æ¥æç»æ") private Date createTimeE; @ApiModelProperty(value = "ç¶æ 0å¾ å®¡æ ¸ 1å¹³å°éåä¿åï¼å·²éåï¼ 2å·²ä¸ä¼ 代ç¾ç³è¯·è¡¨å¾ ä¼ä¸ç¾ç« ï¼å¾ ç¾ç½²ï¼ 3å·²ç¾ç« å¾ ä¸ä¼ ä¿é©åï¼å¾ åºåï¼ 4ä¿ååºå ·å¤±è´¥éåï¼å·²éåï¼ 5å·²ä¸ä¼ ä¿åï¼ä¿éä¸ï¼6ä¼ä¸ç³è¯·éåä¸ 7å¹³å°åæéåï¼å·²éåï¼ 8ä¼ä¸å ³é ï¼å·²å ³éï¼", example = "1") private Integer status; @ApiModelProperty(value = "ç±»å 0ç´ä¿ 1å§ææä¿") private Integer type; @ApiModelProperty(value = "主é®å表") private List<Integer> ids; } server/service/src/main/java/com/doumee/dao/business/join/TaxDetailJoinMapper.java
@@ -1,5 +1,6 @@ package com.doumee.dao.business.join; import com.doumee.dao.business.model.CompanySolution; import com.doumee.dao.business.model.TaxDetial; import com.doumee.dao.business.model.Taxes; import com.github.yulichang.base.mapper.MPJJoinMapper; @@ -12,4 +13,5 @@ */ public interface TaxDetailJoinMapper extends MPJJoinMapper<TaxDetial> { void insertBatchSomeColumn(List<TaxDetial> taxDetialList); } server/service/src/main/java/com/doumee/dao/business/join/TaxesJoinMapper.java
@@ -11,5 +11,4 @@ * @date 2024/01/16 10:03 */ public interface TaxesJoinMapper extends MPJJoinMapper<Taxes> { void insertBatchSomeColumn(List<Taxes> list); } server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import com.fasterxml.jackson.annotation.JsonFormat; import org.springframework.format.annotation.DateTimeFormat; import java.math.BigDecimal; import java.util.Date; @@ -133,6 +134,17 @@ @TableField(exist = false) private Integer insureNum; @ApiModelProperty(value = "å¼ç¥¨éé¢") @TableField(exist = false) private BigDecimal taxesMoney; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") @JsonFormat(pattern = "yyyy-MM-dd HH:mm") @ApiModelProperty(value = "æå䏿¬¡å¼ç¥¨æ¶é´") @TableField(exist = false) private Date taxesLast; @ApiModelProperty(value = "æå¡å¤©æ°") @TableField(exist = false) private Integer serviceDays; server/service/src/main/java/com/doumee/dao/business/model/Taxes.java
@@ -61,7 +61,7 @@ private String remark; @ApiModelProperty(value = "ç¶æ 0å¾ å¤ç 1å·²å¼ç¥¨ 2平尿¤å 3å·²å²çº¢", example = "1") @ExcelColumn(name="ç¶æ 0å¾ å¤ç 1å·²å¼ç¥¨ 2平尿¤å3å·²å²çº¢") @ExcelColumn(name="ç¶æ 0å¾ å¤ç 1å·²å¼ç¥¨ 2平尿¤å 3å·²å²çº¢") private Integer status; @ApiModelProperty(value = "ä¼ä¸ç¼ç ï¼å ³ècompanyï¼", example = "1") @@ -121,7 +121,6 @@ @ApiModelProperty(value = "平尿¤åæ¶é´") @ExcelColumn(name="平尿¤åæ¶é´") private Date cancelDate; @ApiModelProperty(value = "æ¤å夿³¨") @@ -143,6 +142,9 @@ @ExcelColumn(name="å²çº¢æä½äººåç¼ç ") private Integer delUserId; @ApiModelProperty(value = "åæ®ç³è¯·ç¼ç ï¼å ³èinsurance_applyï¼", example = "1") @ExcelColumn(name="åæ®ç³è¯·ç¼ç ï¼å ³èinsurance_applyï¼") private Integer insuranceApplyId; @ApiModelProperty(value = "ç³è¯·äºº") @TableField(exist = false) server/service/src/main/java/com/doumee/service/business/InsuranceApplyService.java
@@ -113,5 +113,7 @@ InsuranceApply findDetailForExport(InsuranceApply model); List<InsuranceApply> findListByDTO(InsuranceApplyQueryDTO model); Integer editBaoxiandan(InsuranceApply param); } server/service/src/main/java/com/doumee/service/business/TaxesService.java
@@ -2,6 +2,7 @@ import com.doumee.core.model.PageData; import com.doumee.core.model.PageWrap; import com.doumee.dao.business.dto.EntrustInvoicingDTO; import com.doumee.dao.business.model.Taxes; import java.util.List; @@ -87,6 +88,7 @@ */ PageData<Taxes> findPage(PageWrap<Taxes> pageWrap); PageData<Taxes> findPageForCompany(PageWrap<Taxes> pageWrap); /** * æ¡ä»¶ç»è®¡ * @@ -96,5 +98,14 @@ long count(Taxes taxes); void doneApply(Taxes taxes); void backApply(Taxes taxes); /** * å§ææä¿æäº¤ * @param entrustInvoicingDTO */ void entrustInvoicing(EntrustInvoicingDTO entrustInvoicingDTO); } server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -551,6 +551,10 @@ queryWrapper.selectAll(InsuranceApply.class); queryWrapper.selectAs(Company::getName,InsuranceApply::getCompanyName); queryWrapper.selectAs(Solutions::getName,InsuranceApply::getSolutionsName); queryWrapper.select(" ( select sum(td.fee) from taxes ts inner join tax_detial td on ts.TAX_ID = ts.id where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id ) as taxesMoney"); queryWrapper.select(" ( select td.CREATE_DATE from taxes ts inner join tax_detial td on ts.TAX_ID = ts.id where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id order by td.CREATE_DATE desc limit 1 ) as taxesLast "); queryWrapper.leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId); queryWrapper.leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId); queryWrapper.eq(InsuranceApply::getIsdeleted,Constants.ZERO); //ä¼ä¸äººåæ¥çæ¬ä¼ä¸æ°æ® if(loginUserInfo.getType().equals(Constants.ONE)){ @@ -577,7 +581,9 @@ if (pageWrap.getModel().getCreateTimeE() != null) { queryWrapper.le(InsuranceApply::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateTimeE())); } if (pageWrap.getModel().getType() != null) { queryWrapper.eq(Solutions::getType, pageWrap.getModel().getType()); } if (pageWrap.getModel().getCode() != null) { queryWrapper.eq(InsuranceApply::getCode, pageWrap.getModel().getCode()); } @@ -596,6 +602,59 @@ } @Override public List<InsuranceApply> findListByDTO(InsuranceApplyQueryDTO model) { LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); MPJLambdaWrapper<InsuranceApply> queryWrapper = new MPJLambdaWrapper<>(); queryWrapper.selectAll(InsuranceApply.class); queryWrapper.selectAs(Company::getName,InsuranceApply::getCompanyName); queryWrapper.selectAs(Solutions::getName,InsuranceApply::getSolutionsName); queryWrapper.select(" ( select sum(td.fee) from taxes ts inner join tax_detial td on ts.TAX_ID = ts.id where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id ) as taxesMoney "); queryWrapper.select(" ( select td.CREATE_DATE from taxes ts inner join tax_detial td on ts.TAX_ID = ts.id where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id order by td.CREATE_DATE desc limit 1 ) as taxesLast "); queryWrapper.leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId); queryWrapper.leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId); queryWrapper.eq(InsuranceApply::getIsdeleted,Constants.ZERO); //ä¼ä¸äººåæ¥çæ¬ä¼ä¸æ°æ® if(loginUserInfo.getType().equals(Constants.ONE)){ queryWrapper.eq(InsuranceApply::getCompanyId, loginUserInfo.getCompanyId()); } if (model.getSolutionId() != null) { queryWrapper.eq(InsuranceApply::getSolutionId, model.getSolutionId()); } if (model.getEndTimeS() != null) { queryWrapper.ge(InsuranceApply::getEndTime, Utils.Date.getStart(model.getEndTimeS())); } if (model.getEndTimeE() != null) { queryWrapper.le(InsuranceApply::getEndTime, Utils.Date.getEnd(model.getEndTimeE())); } if (model.getStartTimeS() != null) { queryWrapper.ge(InsuranceApply::getStartTime, Utils.Date.getStart(model.getStartTimeS())); } if (model.getStartTimeE() != null) { queryWrapper.le(InsuranceApply::getStartTime, Utils.Date.getEnd(model.getStartTimeE())); } if (model.getCreateTimeS() != null) { queryWrapper.ge(InsuranceApply::getCreateDate, Utils.Date.getStart(model.getCreateTimeS())); } if (model.getCreateTimeE() != null) { queryWrapper.le(InsuranceApply::getCreateDate, Utils.Date.getEnd(model.getCreateTimeE())); } if (model.getType() != null) { queryWrapper.eq(Solutions::getType, model.getType()); } if (model.getCode() != null) { queryWrapper.eq(InsuranceApply::getCode, model.getCode()); } if (model.getStatus() != null) { queryWrapper.eq(InsuranceApply::getStatus, model.getStatus()); } if (CollectionUtils.isNotEmpty(model.getIds())) { queryWrapper.in(InsuranceApply::getId, model.getIds()); } List<InsuranceApply> list = insuranceApplyJoinMapper.selectJoinList(InsuranceApply.class, queryWrapper); return list; } @Override public long count(InsuranceApply insuranceApply) { server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
@@ -8,8 +8,11 @@ import com.doumee.core.model.PageWrap; import com.doumee.core.utils.Constants; import com.doumee.core.utils.Utils; import com.doumee.dao.business.CompanyMapper; import com.doumee.dao.business.TaxDetialMapper; import com.doumee.dao.business.TaxesMapper; import com.doumee.dao.business.dto.EntrustInvoicingDTO; import com.doumee.dao.business.join.InsuranceApplyJoinMapper; import com.doumee.dao.business.join.TaxDetailJoinMapper; import com.doumee.dao.business.join.TaxesJoinMapper; import com.doumee.dao.business.model.*; @@ -30,6 +33,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; /** * å票信æ¯è¡¨Serviceå®ç° @@ -49,6 +53,10 @@ private TaxDetailJoinMapper taxDetailJoinMapper; @Autowired private SystemDictDataBiz systemDictDataBiz; @Autowired private CompanyMapper companyMapper; @Autowired private InsuranceApplyJoinMapper insuranceApplyJoinMapper; @Override public Integer create(Taxes taxes) { @@ -305,4 +313,111 @@ QueryWrapper<Taxes> wrapper = new QueryWrapper<>(taxes); return taxesMapper.selectCount(wrapper); } @Override public PageData<Taxes> findPageForCompany(PageWrap<Taxes> pageWrap) { LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); IPage<Taxes> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); MPJLambdaWrapper<Taxes> queryWrapper = new MPJLambdaWrapper<>(); queryWrapper.selectAll(Taxes.class); queryWrapper.selectAs(SystemUser::getRealname,Taxes::getCreatorName); queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,Taxes::getCreator); Utils.MP.blankToNull(pageWrap.getModel()); queryWrapper.eq(Taxes::getIsdeleted, Constants.ZERO); Taxes queryModel = pageWrap.getModel(); if(!user.getType().equals(Constants.ONE)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"éä¼ä¸ç¨æ·æ æ³è¿è¡è¯¥ä¸å¡æ¥è¯¢"); } if(!Objects.isNull(queryModel)){ queryWrapper.ge(pageWrap.getModel().getStartDate() != null,Taxes::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getStartDate())); queryWrapper.le(SignRecord::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getEndDate())); queryWrapper.eq(!Objects.isNull(queryModel.getInsuranceApplyId()),Taxes::getInsuranceApplyId,queryModel.getInsuranceApplyId()); queryWrapper.eq(!Objects.isNull(queryModel.getStatus()),Taxes::getStatus,queryModel.getStatus()); } queryWrapper.orderByAsc(Taxes::getCreateDate); PageData<Taxes> result =PageData.from(taxesJoinMapper.selectJoinPage(page,Taxes.class, queryWrapper)); if(result!=null && result.getRecords()!=null){ String path =systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.TAXES_FILE).getCode(); for(Taxes t : result.getRecords()){ if(StringUtils.isNotBlank(t.getImgurl())){ t.setImgurlFull(path + t.getImgurl()); } } } return result; } @Override @Transactional(rollbackFor = {BusinessException.class,Exception.class}) public void entrustInvoicing(EntrustInvoicingDTO entrustInvoicingDTO){ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); if(Objects.isNull(entrustInvoicingDTO) || Objects.isNull(entrustInvoicingDTO.getInvoicingMoney()) || Objects.isNull(entrustInvoicingDTO.getType()) || Objects.isNull(entrustInvoicingDTO.getTaxDetialList()) || StringUtils.isNotBlank(entrustInvoicingDTO.getAddress()) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } if(!user.getType().equals(Constants.ONE)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"éä¼ä¸ç¨æ·æ æ³è¿è¡è¯¥ä¸å¡æ¥è¯¢"); } Company company = companyMapper.selectById(user.getCompanyId()); if(Objects.isNull(company)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢å°ä¼ä¸ä¿¡æ¯"); } Taxes taxes = new Taxes(); taxes.setCreator(user.getId()); taxes.setCreateDate(new Date()); taxes.setIsdeleted(Constants.ZERO); taxes.setStatus(Constants.ZERO); taxes.setCompanyId(company.getId()); taxes.setPrice(entrustInvoicingDTO.getInvoicingMoney()); taxes.setType(entrustInvoicingDTO.getType()); taxes.setTaxCode(company.getTaxCode()); taxes.setTaxAccount(company.getTaxAccount()); taxes.setTaxAddr(company.getTaxAddr()); taxes.setAddr(entrustInvoicingDTO.getAddress()); taxes.setCompanyName(company.getName()); taxes.setApplyType(Constants.ZERO); taxesMapper.insert(taxes); List<TaxDetial> taxDetialList = entrustInvoicingDTO.getTaxDetialList(); for (TaxDetial taxDetial:taxDetialList) { if(Objects.isNull(taxDetial) || Objects.isNull(taxDetial.getInsuranceApplyId()) || Objects.isNull(taxDetial.getFee()) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } //æ¥è¯¢æ¯ä¸ªä¿åä¸å¯ä»¥æä¿çéé¢ InsuranceApply insuranceApply = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class,new MPJLambdaWrapper<InsuranceApply>() .selectAll(InsuranceApply.class) .select(" ( select sum(td.fee) from taxes ts inner join tax_detial td on ts.TAX_ID = ts.id where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id ) as taxesMoney ") .eq(InsuranceApply::getId,taxDetial.getInsuranceApplyId()) ); if(Objects.isNull(insuranceApply)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"ä¿åå·ã"+taxDetial.getApplyCode()+"ãæªæ¥è¯¢å°ä¿åä¿¡æ¯"); } if(insuranceApply.getCurrentFee().subtract(insuranceApply.getTaxesMoney()).compareTo(taxDetial.getFee())!=Constants.ZERO){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"ä¿åå·ã"+taxDetial.getApplyCode()+"ã坿¥ééé¢é误ã"+insuranceApply.getCurrentFee().subtract(insuranceApply.getTaxesMoney())+"ã"); } taxDetial.setCreator(user.getId()); taxDetial.setCreateDate(new Date()); taxDetial.setIsdeleted(Constants.ZERO); taxDetial.setTaxId(taxes.getId()); taxDetial.setTotalFee(insuranceApply.getCurrentFee()); taxDetial.setType(Constants.ZERO); } taxDetailJoinMapper.insertBatchSomeColumn(taxDetialList); } }