parent
71f9584fcf
commit
be2309ff7c
@ -0,0 +1,34 @@ |
|||||||
|
package com.jianshui.web.controller.platform; |
||||||
|
|
||||||
|
import com.jianshui.common.core.domain.AjaxResult; |
||||||
|
import com.jianshui.platform.dto.TaxSwitchingDTO; |
||||||
|
import com.jianshui.platform.service.TaxSwitchingService; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: kane |
||||||
|
* @Description: 含税不含税切换控制类 |
||||||
|
* @CreateTime: 2023-06-07 12:01 |
||||||
|
* @Version: 1.0 |
||||||
|
**/ |
||||||
|
@Api(tags = "含税不含税切换",value = "含税不含税切换") |
||||||
|
@RestController |
||||||
|
@RequestMapping("/platForm/taxSwitching") |
||||||
|
public class TaxSwitchingController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private TaxSwitchingService taxSwitchingService; |
||||||
|
|
||||||
|
@ApiOperation("含税不含税切换") |
||||||
|
@PostMapping("/switching") |
||||||
|
public AjaxResult taxSwitching(@RequestBody TaxSwitchingDTO dto){ |
||||||
|
return taxSwitchingService.taxswitching(dto); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package com.jianshui.platform.dto; |
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.math.BigDecimal; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: kane |
||||||
|
* @Description: 含税不含税转换传输类 |
||||||
|
* @CreateTime: 2023-06-07 13:46 |
||||||
|
* @Version: 1.0 |
||||||
|
**/ |
||||||
|
@ApiModel("含税不含税转换") |
||||||
|
@Data |
||||||
|
public class TaxSwitchingDTO { |
||||||
|
@ApiModelProperty("货物或应税劳务、服务名称") |
||||||
|
private String taxName; |
||||||
|
@ApiModelProperty("规格型号") |
||||||
|
private String specification; |
||||||
|
@ApiModelProperty("单位") |
||||||
|
private String unit; |
||||||
|
@ApiModelProperty("数量") |
||||||
|
private BigDecimal number; |
||||||
|
@ApiModelProperty("单价") |
||||||
|
private BigDecimal unitPrice; |
||||||
|
@ApiModelProperty("金额") |
||||||
|
private BigDecimal money; |
||||||
|
@ApiModelProperty("税率") |
||||||
|
private BigDecimal taxRate; |
||||||
|
@ApiModelProperty("税额") |
||||||
|
private BigDecimal taxMoney; |
||||||
|
@ApiModelProperty("状态0-含税,1-不含税") |
||||||
|
private String status; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.jianshui.platform.service; |
||||||
|
|
||||||
|
import com.jianshui.common.core.domain.AjaxResult; |
||||||
|
import com.jianshui.platform.dto.TaxSwitchingDTO; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: kane |
||||||
|
* @Description: 含税不含税切换业务层 |
||||||
|
* @CreateTime: 2023-06-07 13:40 |
||||||
|
* @Version: 1.0 |
||||||
|
**/ |
||||||
|
public interface TaxSwitchingService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 功能描述: 含税不含税切换计算 |
||||||
|
* @param dto |
||||||
|
* @return : com.jianshui.common.core.domain.AjaxResult |
||||||
|
*/ |
||||||
|
AjaxResult taxswitching(TaxSwitchingDTO dto); |
||||||
|
} |
@ -0,0 +1,53 @@ |
|||||||
|
package com.jianshui.platform.service.impl; |
||||||
|
|
||||||
|
import com.jianshui.common.core.domain.AjaxResult; |
||||||
|
import com.jianshui.common.utils.bean.BeanUtils; |
||||||
|
import com.jianshui.platform.dto.TaxSwitchingDTO; |
||||||
|
import com.jianshui.platform.service.TaxSwitchingService; |
||||||
|
import com.jianshui.platform.vo.TaxSwitchingVO; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.math.BigDecimal; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: kane |
||||||
|
* @Description: 含税不含税业务层 |
||||||
|
* @CreateTime: 2023-06-07 13:40 |
||||||
|
* @Version: 1.0 |
||||||
|
**/ |
||||||
|
@Service |
||||||
|
public class TaxSwitchingServiceImpl implements TaxSwitchingService { |
||||||
|
/** |
||||||
|
* 功能描述: 含税不含税切换计算 |
||||||
|
* @param dto |
||||||
|
* @return : com.jianshui.common.core.domain.AjaxResult |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public AjaxResult taxswitching(TaxSwitchingDTO dto) { |
||||||
|
//判空
|
||||||
|
if (dto == null){ |
||||||
|
return AjaxResult.error("未传入发票相关信息,请检查!"); |
||||||
|
} |
||||||
|
//实体类转换
|
||||||
|
TaxSwitchingVO taxSwitchingVO = new TaxSwitchingVO(); |
||||||
|
BeanUtils.copyProperties(dto,taxSwitchingVO); |
||||||
|
//判断是否为含税
|
||||||
|
if ("0".equals(dto.getStatus())){ |
||||||
|
//含税改为非含税返回
|
||||||
|
taxSwitchingVO.setStatus("1"); |
||||||
|
//单个商品税额
|
||||||
|
BigDecimal taxMoney = dto.getTaxMoney().divide(dto.getNumber()); |
||||||
|
taxSwitchingVO.setUnitPrice(dto.getUnitPrice().subtract(taxMoney)); |
||||||
|
taxSwitchingVO.setMoney(dto.getMoney().subtract(dto.getTaxMoney())); |
||||||
|
return AjaxResult.success(taxSwitchingVO); |
||||||
|
}else { |
||||||
|
//非含税改为含税返回
|
||||||
|
taxSwitchingVO.setStatus("0"); |
||||||
|
//单个商品税额
|
||||||
|
BigDecimal taxMoney = dto.getTaxMoney().divide(dto.getNumber()); |
||||||
|
taxSwitchingVO.setUnitPrice(dto.getUnitPrice().add(taxMoney)); |
||||||
|
taxSwitchingVO.setMoney(dto.getMoney().add(dto.getTaxMoney())); |
||||||
|
return AjaxResult.success(taxSwitchingVO); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package com.jianshui.platform.vo; |
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.math.BigDecimal; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: kane |
||||||
|
* @Description: 含税不含税转换 |
||||||
|
* @CreateTime: 2023-06-07 13:46 |
||||||
|
* @Version: 1.0 |
||||||
|
**/ |
||||||
|
@ApiModel("含税不含税转换") |
||||||
|
@Data |
||||||
|
public class TaxSwitchingVO { |
||||||
|
@ApiModelProperty("货物或应税劳务、服务名称") |
||||||
|
private String taxName; |
||||||
|
@ApiModelProperty("规格型号") |
||||||
|
private String specification; |
||||||
|
@ApiModelProperty("单位") |
||||||
|
private String unit; |
||||||
|
@ApiModelProperty("数量") |
||||||
|
private BigDecimal number; |
||||||
|
@ApiModelProperty("单价") |
||||||
|
private BigDecimal unitPrice; |
||||||
|
@ApiModelProperty("金额") |
||||||
|
private BigDecimal money; |
||||||
|
@ApiModelProperty("税率") |
||||||
|
private BigDecimal taxRate; |
||||||
|
@ApiModelProperty("税额") |
||||||
|
private BigDecimal taxMoney; |
||||||
|
@ApiModelProperty("状态") |
||||||
|
private String status; |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue