package com.xjrsoft.module.erpModel.caseErpCustomer.controller; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.lang.TypeReference; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.xjrsoft.common.annotation.XjrLog; import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.model.result.R; import com.xjrsoft.common.utils.RedisUtil; import com.xjrsoft.module.erpModel.caseErpCustomer.dto.AddCaseErpCustomerGatherDto; import com.xjrsoft.module.erpModel.caseErpCustomer.dto.CaseErpCustomerGatherDto; import com.xjrsoft.module.erpModel.caseErpCustomer.dto.UpdateCaseErpCustomerGatherDto; import com.xjrsoft.module.erpModel.caseErpCustomer.entity.CaseErpCustomer; import com.xjrsoft.module.erpModel.caseErpCustomer.entity.CaseErpCustomerGather; import com.xjrsoft.module.erpModel.caseErpCustomer.service.ICaseErpCustomerGatherService; import com.xjrsoft.module.erpModel.caseErpCustomer.service.ICaseErpCustomerService; import com.xjrsoft.module.organization.entity.User; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.math.BigDecimal; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; /** *
* 客户回款【case_erp_customer_gather】 前端控制器 *
* * @author hnyyzy * @since 2023-07-12 */ @RestController @RequestMapping(GlobalConstant.CASE_ERP_CUSTOMER +"/caseErpCustomerGather") @Api(value = GlobalConstant.CASE_ERP_CUSTOMER +"/caseErpCustomerGather", tags = "客户回款") @AllArgsConstructor public class CaseErpCustomerGatherController { private ICaseErpCustomerGatherService caseErpCustomerGatherService; private ICaseErpCustomerService caseErpCustomerService; private RedisUtil redisUtil; @GetMapping(value = "/page") @ApiOperation("客户回款分页") public R page(CaseErpCustomerGatherDto dto) { return R.ok(caseErpCustomerGatherService.getPageList(dto)); } @PostMapping @ApiOperation(value = "新增客户回款信息") public R add(@Valid @RequestBody AddCaseErpCustomerGatherDto dto) { CaseErpCustomerGather caseErpCustomerGather = BeanUtil.toBean(dto, CaseErpCustomerGather.class); CaseErpCustomer byId = caseErpCustomerService.getById(dto.getCustomerId()); if (StrUtil.isNotBlank(byId.getName())){ caseErpCustomerGather.setName(byId.getName()); } caseErpCustomerGather.setAlreadyAmount(BigDecimal.ZERO); caseErpCustomerGather.setUnpaidAmount(dto.getWaitAmount()); List