|
@@ -27,11 +27,14 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.apache.ibatis.annotations.Insert;
|
|
|
import org.apache.poi.util.IOUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.constraints.NotBlank;
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
@@ -126,10 +129,7 @@ public class CustomerController {
|
|
|
@GetMapping("/findCustomerRecListExport")
|
|
|
@ApiOperation(value = "客户信息导出", notes = "客户信息导出")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
- public void findCustomerRechargeExport(String customerName, String companyName, String companyBelongName, HttpServletResponse response) throws Exception {
|
|
|
- if(!checkHasAuthRole.checkMessage(customerName,companyName,companyBelongName)){
|
|
|
- log.error("findCustomerRecListExport客户信息导出信息有误");
|
|
|
- }
|
|
|
+ public void findCustomerRechargeExport(@NotBlank(message = "客户名称不能为空")String customerName, @NotBlank(message = "公司名称不能为空")String companyName, @NotBlank(message = "主体名称不能为空")String companyBelongName, HttpServletResponse response) throws Exception {
|
|
|
CustomerRec customerRec = new CustomerRec();
|
|
|
customerRec.setCustomerName(customerName);
|
|
|
customerRec.setCompanyBelongName(companyBelongName);
|
|
@@ -174,9 +174,14 @@ public class CustomerController {
|
|
|
@LoginRequired
|
|
|
public RespR addCustomer(@RequestBody Customer customer, User user) {
|
|
|
checkHasAuthRole.checkCustomerRole(user, customer.getCustomerName());
|
|
|
- if(!checkHasAuthRole.checkMessage(customer.getCustomerName(),customer.getCompany())){
|
|
|
+ if (!checkHasAuthRole.checkMessage(customer.getCustomerName(), customer.getCompany())) {
|
|
|
return new RespR(false, "客户添加失败,请查看数据是否维护准确");
|
|
|
}
|
|
|
+ if (null == customer.getBussinessType()) {
|
|
|
+ return new RespR(false, "客户添加失败,请查看业务类型是否选择");
|
|
|
+ } else if (0 == customer.getBussinessType() && null == customer.getFee()) {
|
|
|
+ return new RespR(false, "客户添加失败,自有车业务必须添加ETC费用");
|
|
|
+ }
|
|
|
return new RespR(customerService.addCustomers(customer), "客户添加失败,请查看是否重复");
|
|
|
}
|
|
|
|
|
@@ -189,9 +194,15 @@ public class CustomerController {
|
|
|
@ApiOperation(value = "更新用户", notes = "更新用户")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
public RespR updateCustomer(@RequestBody Customer customer) {
|
|
|
- if(!checkHasAuthRole.checkMessage(customer.getCustomerName(),customer.getCompany())){
|
|
|
+ if (!checkHasAuthRole.checkMessage(customer.getCustomerName(), customer.getCompany())) {
|
|
|
return new RespR(false, "客户更新失败,请查看数据是否维护准确");
|
|
|
}
|
|
|
+ if (null == customer.getBussinessType()) {
|
|
|
+ return new RespR(false, "客户更新失败,请查看业务类型是否选择");
|
|
|
+ } else if (0 == customer.getBussinessType() && null == customer.getFee()) {
|
|
|
+ return new RespR(false, "客户更新失败,自有车业务必须添加ETC费用");
|
|
|
+ }
|
|
|
+
|
|
|
return new RespR(customerService.updateCustomer(customer));
|
|
|
}
|
|
|
|
|
@@ -204,6 +215,9 @@ public class CustomerController {
|
|
|
@ApiOperation(value = "停用备案用户", notes = "停用备案用户")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
public RespR customeRecStop(@RequestBody CustomerRec customerRec) {
|
|
|
+ if (!checkHasAuthRole.checkMessage(customerRec.getCustomerName(), customerRec.getCompanyName())) {
|
|
|
+ return new RespR(false, "停用备案用户失败,请查看数据是否维护准确");
|
|
|
+ }
|
|
|
customerRec.setRecStatus(4);
|
|
|
return customerService.updateCustomerRecStatus(customerRec);
|
|
|
}
|
|
@@ -217,6 +231,9 @@ public class CustomerController {
|
|
|
@ApiOperation(value = "启用备案用户", notes = "启用备案用户")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
public RespR customeRecStart(@RequestBody CustomerRec customerRec) {
|
|
|
+ if (!checkHasAuthRole.checkMessage(customerRec.getCustomerName(), customerRec.getCompanyName())) {
|
|
|
+ return new RespR(false, "启用备案用户失败,请查看数据是否维护准确");
|
|
|
+ }
|
|
|
customerRec.setRecStatus(1);
|
|
|
return customerService.updateCustomerRecStatus(customerRec);
|
|
|
}
|
|
@@ -229,18 +246,11 @@ public class CustomerController {
|
|
|
@PostMapping("/customerRecAdd")
|
|
|
@ApiOperation(value = "手工添加备案信息", notes = "手工添加备案信息")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
- public RespR customerRecAdd(@RequestBody CustomerRec customerRec) {
|
|
|
- if(!checkHasAuthRole.checkMessage(customerRec.getCustomerName(),customerRec.getCompanyLeader(),customerRec.getCompanyLeaderPhone(),
|
|
|
- customerRec.getCompanyName(),customerRec.getCompanyReferencenum(),
|
|
|
- customerRec.getCompanyOpenbank(),customerRec.getCompanyOpenbankAcc(),
|
|
|
- customerRec.getCompanyAdress(),customerRec.getCompanyPhone(),
|
|
|
- customerRec.getBussinessType())){
|
|
|
- return new RespR(false, "手工添加备案信息失败,请查看数据是否维护准确");
|
|
|
- }
|
|
|
-
|
|
|
+ public RespR customerRecAdd(@RequestBody @Validated CustomerRec customerRec) {
|
|
|
customerRec.setInterType(1);
|
|
|
List<CustomerRec> customerRecList = new ArrayList<>();
|
|
|
customerRecList.add(customerRec);
|
|
|
+
|
|
|
return lowerService.customeRec(customerRecList);
|
|
|
}
|
|
|
|
|
@@ -252,11 +262,7 @@ public class CustomerController {
|
|
|
@PostMapping("/customeRecQueryUpper")
|
|
|
@ApiOperation(value = "查询备案信息", notes = "手工添加备案信息")
|
|
|
@LoginRequired
|
|
|
- public RespR customeRecQueryUpper(@RequestBody CustomerRec customerRec, User user) {
|
|
|
- if(!checkHasAuthRole.checkMessage(customerRec.getCustomerName(),customerRec.getCompanyName(),customerRec.getCompanyReferencenum())){
|
|
|
- return new RespR(false, "查询备案信息失败,请查看数据是否维护准确");
|
|
|
- }
|
|
|
-
|
|
|
+ public RespR customeRecQueryUpper(@RequestBody @Validated({Insert.class}) CustomerRec customerRec, User user) {
|
|
|
checkHasAuthRole.checkCustomerRole(user, customerRec.getCustomerName());
|
|
|
RespR<List<B2bCompanyModel>> respR = customerService.customerRecQuery(customerRec);
|
|
|
|
|
@@ -300,21 +306,14 @@ public class CustomerController {
|
|
|
@PostMapping("/customRecharge")
|
|
|
@ApiOperation(value = "账号充值", notes = "账号充值")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
- public RespR customRecharge(@RequestBody CustomerRecharge customerRecharge) {
|
|
|
- if (null == customerRecharge.getRechargeMony() || "".equals(customerRecharge.getRechargeMony())) {
|
|
|
- log.error("充值失败:CustomerServiceImpl.getRechargeMony:" + customerRecharge.getRechargeMony());
|
|
|
- return new RespR(false,"充值记录为空");
|
|
|
- }
|
|
|
+ public RespR customRecharge(@RequestBody @Validated CustomerRecharge customerRecharge) {
|
|
|
return new RespR(customerService.customRecharge(customerRecharge));
|
|
|
}
|
|
|
|
|
|
@PostMapping("/customeRec")
|
|
|
@ApiOperation(value = "用户备案确认", notes = "用户备案确认")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
- public RespR customeRec(@RequestBody CustomerRec customerRec) {
|
|
|
- if(!checkHasAuthRole.checkMessage(customerRec.getCustomerName(),customerRec.getCompanyReferencenum())){
|
|
|
- return new RespR(false, "用户备案确认失败,请查看数据是否维护准确");
|
|
|
- }
|
|
|
+ public RespR customeRec(@RequestBody @Validated CustomerRec customerRec) {
|
|
|
return customerService.customeRec(customerRec);
|
|
|
}
|
|
|
|
|
@@ -322,9 +321,9 @@ public class CustomerController {
|
|
|
@ApiOperation(value = "协议上传确认", notes = "协议上传确认")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
public RespR contractAdd(@RequestBody CustomerRec customerRec) {
|
|
|
- if(!checkHasAuthRole.checkMessage(customerRec.getCompanyNum(),
|
|
|
- customerRec.getContractFileName(),customerRec.getServiceStartTime(),
|
|
|
- customerRec.getServiceEndTime())){
|
|
|
+ if (!checkHasAuthRole.checkMessage(customerRec.getCompanyNum(),
|
|
|
+ customerRec.getContractFileName(), customerRec.getServiceStartTime(),
|
|
|
+ customerRec.getServiceEndTime())) {
|
|
|
return new RespR(false, "协议上传确认失败,请查看数据是否维护准确");
|
|
|
}
|
|
|
return customerService.contractAdd(customerRec);
|
|
@@ -334,7 +333,7 @@ public class CustomerController {
|
|
|
@ApiOperation(value = "协议上传失败状态确认", notes = "协议上传失败状态确认")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
public RespR contractStatusFail(@RequestBody CustomerRec customerRec) {
|
|
|
- if(null == customerRec.getRecStatus()){
|
|
|
+ if (null == customerRec.getRecStatus()) {
|
|
|
return new RespR(false, "协议上传失败状态确认失败,请查看数据是否维护准确");
|
|
|
}
|
|
|
return customerService.contractStatusFail(customerRec);
|
|
@@ -344,7 +343,7 @@ public class CustomerController {
|
|
|
@ApiOperation(value = "协议上传成功,审批中状态确认", notes = "协议上传成功,审批中状态确认")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
public RespR contractStatusProcess(@RequestBody CustomerRec customerRec) {
|
|
|
- if(null == customerRec.getRecStatus()){
|
|
|
+ if (null == customerRec.getRecStatus()) {
|
|
|
return new RespR(false, "协议上传成功,审批中状态确认失败,请查看数据是否维护准确");
|
|
|
}
|
|
|
return customerService.contractStatusProcess(customerRec);
|
|
@@ -354,7 +353,7 @@ public class CustomerController {
|
|
|
@ApiOperation(value = "备案成功状态确认", notes = "备案成功状态确认")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
public RespR contractStatusSuccess(@RequestBody CustomerRec customerRec) {
|
|
|
- if(null == customerRec.getRecStatus()){
|
|
|
+ if (null == customerRec.getRecStatus()) {
|
|
|
return new RespR(false, "备案成功状态确认失败,请查看数据是否维护准确");
|
|
|
}
|
|
|
return customerService.contractStatusSuccess(customerRec);
|
|
@@ -363,10 +362,7 @@ public class CustomerController {
|
|
|
@GetMapping("/contractDownload")
|
|
|
@ApiOperation(value = "协议下载", notes = "协议下载")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
- public RespR contractDownload(String customerRecId, HttpServletResponse response) {
|
|
|
- if(!checkHasAuthRole.checkMessage(customerRecId)){
|
|
|
- return new RespR(false, "协议下载失败,请查看数据是否维护准确");
|
|
|
- }
|
|
|
+ public RespR contractDownload(@NotBlank(message = "企业绑定ID不能为空")String customerRecId, HttpServletResponse response) {
|
|
|
|
|
|
CustomerRec customerRec = (CustomerRec) customerService.contractDownload(customerRecId).getData();
|
|
|
String fileName = customerRec.getLowerFileName();
|
|
@@ -396,10 +392,7 @@ public class CustomerController {
|
|
|
@GetMapping("/generateWord")
|
|
|
@ApiOperation(value = "文档下载", notes = "文档下载")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
- public RespR generateWord(String customerRecId, HttpServletResponse response) {
|
|
|
- if(!checkHasAuthRole.checkMessage(customerRecId)){
|
|
|
- return new RespR(false, "文档下载失败,请查看数据是否维护准确");
|
|
|
- }
|
|
|
+ public RespR generateWord(@NotBlank(message = "企业绑定ID不能为空")String customerRecId, HttpServletResponse response) {
|
|
|
|
|
|
CustomerRec customerRec = (CustomerRec) customerService.generateWordDownload(customerRecId).getData();
|
|
|
if (null == customerRec || null == customerRec.getServiceStartTime() || null == customerRec.getServiceEndTime()) {
|
|
@@ -533,10 +526,7 @@ public class CustomerController {
|
|
|
@PostMapping("/customerChangeInfo")
|
|
|
@ApiOperation(value = "用户换卡信息查询", notes = "用户换卡信息查询")
|
|
|
@LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
|
|
|
- public RespR customerChangeInfo(String applyId) {
|
|
|
- if(!checkHasAuthRole.checkMessage(applyId)){
|
|
|
- return new RespR(false, "用户换卡信息查询失败,请查看数据是否维护准确");
|
|
|
- }
|
|
|
+ public RespR customerChangeInfo(@NotBlank(message = "申请Id不能为空") String applyId) {
|
|
|
List<Map<String, String>> cards = customerChangeInfoService.selectChangeCards(applyId);
|
|
|
return new RespR(cards);
|
|
|
}
|