Browse Source

无车优化,自有车接口返回

Administrator 2 years ago
parent
commit
624f4a5e20

+ 1 - 2
src/main/java/com/jkcredit/invoice/annotation/annotationdes/CurrentUserMethodArgumentResolver.java

@@ -16,8 +16,7 @@ import org.springframework.web.multipart.support.MissingServletRequestPartExcept
 public class CurrentUserMethodArgumentResolver implements HandlerMethodArgumentResolver {
     @Override
     public boolean supportsParameter(MethodParameter parameter) {
-        return parameter.getParameterType().isAssignableFrom(User.class)
-                && parameter.hasParameterAnnotation(CurrentUser.class);
+        return parameter.getParameterType().isAssignableFrom(User.class);
     }
 
     @Override

+ 4 - 1
src/main/java/com/jkcredit/invoice/config/InvoiceWebMvcConfigurer.java

@@ -55,7 +55,10 @@ public class InvoiceWebMvcConfigurer extends WebMvcConfigurationSupport {
     public CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver() {
         return new CurrentUserMethodArgumentResolver();
     }
-
+    @Override
+    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
+        resolvers.add(new CurrentUserMethodArgumentResolver());
+    }
     @Bean
     public AuthenticationInterceptor authenticationInterceptor() {
         return new AuthenticationInterceptor();

+ 1 - 0
src/main/java/com/jkcredit/invoice/controller/business/CustomerController.java

@@ -107,6 +107,7 @@ public class CustomerController {
      */
     @PostMapping("/findCustomerRechargeMoney")
     @ApiOperation(value="分页查询客户端客户充值信息", notes="分页查询客户端客户充值信息")
+    @LoginRequired
     public RespR findCustomerRechargeMoney(Page page, CustomerRecharge customerRecharge, User user) {
         checkHasAuthRole.checkCustomerRole(user,customerRecharge.getCustomerName());
         return new RespR(customerRechargeService.findAllCustomerRechargeMoney(page, customerRecharge));

+ 1 - 1
src/main/java/com/jkcredit/invoice/controller/business/NoCarController.java

@@ -92,7 +92,7 @@ public class NoCarController {
     @LoginRequired
     public RespR getCustomersByPage(Page page, CustomerCarRec customerCarRec,User user) {
         try {
-            checkHasAuthRole.checkCustomerRole(user,customerCarRec.getCompanyName());
+            checkHasAuthRole.checkCustomerRole(user,customerCarRec.getCustomerName());
             if(!StringUtils.isEmpty(customerCarRec.getStartTime()) && !"null".equals(customerCarRec.getStartTime())){
                 String [] res = customerCarRec.getStartTime().split(",");
                 customerCarRec.setStartTime(res[0]);

+ 3 - 3
src/main/java/com/jkcredit/invoice/controller/business/SelfCarController.java

@@ -185,10 +185,10 @@ public class SelfCarController {
      */
     @PostMapping("/updateTrades")
     @ApiOperation(value="更新交易id状态", notes="更新交易id状态")
-    @LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
-    public void updateTrades( String selfCarTradesStr,String companyName) {
+    @LoginRequired
+    public void updateTrades( String selfCarTradesStr,String companyName,User user) {
         try {
-
+            checkHasAuthRole.checkCompanyRole(user,companyName);
             List<SelfCarTrade>  selfCarTrades = JSON.parseArray(selfCarTradesStr,SelfCarTrade.class);
             if(selfCarTrades== null || selfCarTrades.size()==0){
                 selfCarTrades = sellCarTradeMapper.selectByStatus("2",companyName);

+ 2 - 1
src/main/java/com/jkcredit/invoice/controller/user/UserController.java

@@ -2,6 +2,7 @@ package com.jkcredit.invoice.controller.user;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jkcredit.invoice.annotation.LoginRequired;
+import com.jkcredit.invoice.annotation.annotationdes.AuthenticationInterceptor;
 import com.jkcredit.invoice.model.entity.user.User;
 import com.jkcredit.invoice.service.user.UserService;
 import com.jkcredit.invoice.util.MD5Util;
@@ -99,7 +100,7 @@ public class UserController {
      */
     @PostMapping("/page")
     @ApiOperation(value="分页查询用户", notes="分页查询用户")
-    @LoginRequired
+    @LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
     public RespR getUserPage(Page page, User user) {
         return new RespR<>(userService.getUserWithRolePage(page, user));
     }

+ 4 - 4
src/main/java/com/jkcredit/invoice/service/lowerservice/impl/CheckHasAuthRoleImpl.java

@@ -21,17 +21,17 @@ public class CheckHasAuthRoleImpl implements CheckHasAuthRole{
         customerRecPa.setCustomerName(user.getUserName());
         customerRecPa.setCompanyName(companyName);
         CustomerRec customerRec = customerRecMapper.selectByCustomerNameAndCompany(customerRecPa);
-        if(customerRec != null){
+        if(customerRec == null){
             throw new RuntimeException("非法的资源请求");
         }
     }
 
     @Override
-    public void checkCustomerRole(User user, String customerName) {
-        if(AuthenticationInterceptor.AUTH_ADMIN.equals(user.getRoleId())){
+    public void checkCustomerRole(User currentUser, String customerName) {
+        if(AuthenticationInterceptor.AUTH_ADMIN.equals(currentUser.getRoleId())){
             return ;
         }
-        if(!user.getUserName().equals(customerName)){
+        if(!currentUser.getUserName().equals(customerName)){
             throw new RuntimeException("非法的资源请求");
         }
     }

+ 2 - 1
src/main/java/com/jkcredit/invoice/service/lowerservice/impl/SelfCarServiceLImpl.java

@@ -146,7 +146,7 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
             log.info("申请开票失败SelfCarServiceLImpl.applInvoice{},msg{}",invoiceApplVo,"余额不足");
             return new RespR(false,"余额不足");
         }
-        Customer customer = customerMapper.selectByCustomerNameForLock(invoiceApplVo.getCustomerName());
+        Customer customer = customerMapper.selectByCustomerName(invoiceApplVo.getCustomerName());
         if(customer == null || customer.getAccstatus().intValue() == 1){
             log.info("申请开票失败SelfCarServiceLImpl.applInvoice{},msg{}",invoiceApplVo,"客户已经停用");
             return new RespR(false,"客户已经停用");
@@ -217,6 +217,7 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
                     calculateInforMapper.insert(carCalculateInfor);
                 }
             }
+            customer = customerMapper.selectByCustomerNameForLock(invoiceApplVo.getCustomerName());
             //客户统一扣费
             customer.setInvoiceTime(DateUtil.getCurrentDateStr());
             customer.setAccountBalance(MathUtil.sub(customer.getAccountBalance(),needFee));

+ 8 - 3
src/main/java/com/jkcredit/invoice/service/nocar/impl/NoCarRecServiceImpl.java

@@ -49,14 +49,19 @@ public class NoCarRecServiceImpl extends ServiceImpl<CustomerCarRecMapper,Custom
                                 for(CardBindQueryListToBModel cardBindQueryListToBModel:cardBindQueryListToBResponses){
                                     if(cardBindQueryListToBModel.getCardId().equals(customerCarRec1.getEtcNum())){
                                         has = true;
+                                        customerCarRec1.setCompanyName(customerCarRec.getCompanyName());
+                                        if(customerCarRec1.getCompanyNum()!=null && !customerCarRec1.getCompanyNum().equals(cardBindQueryListToBModel.getCompanyNum()))
+                                            customerCarRec1.setSuccTime(DateUtil.getCurrentDateStr());
+                                        customerCarRec1.setCompanyNum(cardBindQueryListToBModel.getCompanyNum());
+                                        customerCarRec1.setCarNum(customerCarRec.getCarNum());
+                                        customerCarRec1.setCarColor(cardBindQueryListToBModel.getPlateColor()+"");
+                                        customerCarRec1.setRecStatus(1);
+                                        customerCarRecMapper.updateETCByPrimaryKeySelective(customerCarRec1);
                                     }
                                 }
                                 if(!has){
                                     customerCarRec1.setRecStatus(2);
                                     customerCarRecMapper.updateETCByPrimaryKeySelective(customerCarRec1);
-                                }else{
-                                    customerCarRec1.setRecStatus(1);
-                                    customerCarRecMapper.updateETCByPrimaryKeySelective(customerCarRec1);
                                 }
                             });
                         }

+ 8 - 0
src/main/resources/mapper/customer/CustomerCarRecMapper.xml

@@ -207,6 +207,9 @@
       <if test="companyName != null">
         company_name = #{companyName,jdbcType=VARCHAR},
       </if>
+      <if test="companyNum != null">
+        companyNum = #{companyNum,jdbcType=VARCHAR},
+      </if>
       <if test="carNum != null">
          car_num = #{carNum,jdbcType=VARCHAR},
       </if>
@@ -243,6 +246,9 @@
       <if test="companyName != null">
         company_name = #{companyName,jdbcType=VARCHAR},
       </if>
+      <if test="companyNum != null">
+        companyNum = #{companyNum,jdbcType=VARCHAR},
+      </if>
       <if test="carNum != null">
          car_num = #{carNum,jdbcType=VARCHAR},
       </if>
@@ -277,6 +283,7 @@
     update t_customer_carRec
     set
       customer_name = #{customerName,jdbcType=VARCHAR},
+      companyNum = #{companyNum,jdbcType=VARCHAR},
       company_name = #{companyName,jdbcType=VARCHAR},
       car_num = #{carNum,jdbcType=VARCHAR},
       car_color = #{carColor,jdbcType=VARCHAR},
@@ -295,6 +302,7 @@
     set
     customer_name = #{customerName,jdbcType=VARCHAR},
     company_name = #{companyName,jdbcType=VARCHAR},
+    companyNum = #{companyNum,jdbcType=VARCHAR},
     car_num = #{carNum,jdbcType=VARCHAR},
     car_color = #{carColor,jdbcType=VARCHAR},
     cust_phone = #{custPhone,jdbcType=VARCHAR},

+ 3 - 0
src/main/resources/mapper/invoice/BillInvoiceMapper.xml

@@ -314,6 +314,9 @@
         count(DISTINCT(transactionId)) feeCount
         from t_billInvoice
         <where>
+            <if test="billInvoice.customerName != null and billInvoice.customerName != ''">
+                and  customerName = BINARY #{billInvoice.customerName}
+            </if>
             <if test="billInvoice.companyName != null and billInvoice.companyName != ''">
                 and  buyerName = BINARY #{billInvoice.companyName}
             </if>

+ 2 - 2
src/main/resources/mapper/user/UserMapper.xml

@@ -61,14 +61,14 @@
         <include refid="userSql"/>
         FROM
             t_user
-        <where>
+       <!-- <where>
             <if test="query.userName != null and query.userName != ''">
                 and  user_name = BINARY #{query.userName}
             </if>
             <if test="query.company != null and query.company != ''">
                 and  company  LIKE BINARY CONCAT('%',#{query.company},'%')
             </if>
-        </where>
+        </where>-->
         order by create_time desc
     </select>