Преглед изворни кода

阿里巴巴代码规约问题修改-3 20230115

mashengyi пре 2 година
родитељ
комит
0140f48081

+ 3 - 4
src/main/java/com/jkcredit/invoice/annotation/annotationdes/AuthenticationInterceptor.java

@@ -2,6 +2,7 @@ package com.jkcredit.invoice.annotation.annotationdes;
 
 import cn.hutool.json.JSONUtil;
 import com.jkcredit.invoice.annotation.LoginRequired;
+import com.jkcredit.invoice.common.CommonConstants;
 import com.jkcredit.invoice.model.entity.user.User;
 import com.jkcredit.invoice.service.user.UserService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,8 +16,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.lang.reflect.Method;
 
-import static com.jkcredit.invoice.common.TokenConst.TOKEN_KEY;
-
 
 /**
  * @description:
@@ -55,10 +54,10 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
                 throw new RuntimeException("无token,请重新登录");
             }
 
-            if (!redisTemplate.hasKey(TOKEN_KEY + token)) {
+            if (!redisTemplate.hasKey(CommonConstants.TOKEN_KEY + token)) {
                 throw new RuntimeException("token已过期,请重新登录");
             }
-            User user = JSONUtil.toBean(redisTemplate.opsForValue().get(TOKEN_KEY + token).toString(), User.class);
+            User user = JSONUtil.toBean(redisTemplate.opsForValue().get(CommonConstants.TOKEN_KEY + token).toString(), User.class);
             if (user == null) {
                 throw new RuntimeException("用户不存在,请重新登录");
             }

+ 57 - 0
src/main/java/com/jkcredit/invoice/mapper/binvoce/BillInvoiceMapper.java

@@ -13,25 +13,82 @@ import java.util.Map;
 
 @Repository
 public interface BillInvoiceMapper extends BaseMapper<BillInvoice>{
+    /**
+     * 分页查询所有运单发票
+     * @param page
+     * @param billInvoice
+     * @return
+     */
     IPage<List<BillInvoice>> selectAllByPage(Page page, @Param("billInvoice") BillInvoice billInvoice);
 
+    /**
+     * 条件查询所有运单发票
+     * @param record
+     * @return
+     */
     BillInvoice selectAllByPageByBillInvoice( BillInvoice record);
 
+    /**
+     * 插入发票
+     * @param record
+     * @return
+     */
     @Override
     int insert(BillInvoice record);
 
+    /**
+     * 更新发票
+     * @param record
+     * @return
+     */
     int updateByPrimaryKey(BillInvoice record);
 
+    /**
+     * 根据发票代码更新发票
+     * @param record
+     * @return
+     */
     int updateByInvoiceNum(BillInvoice record);
 
+    /**
+     * 查询发票列表
+     * @param wayBillNum
+     * @return
+     */
     List<BillInvoice> selectByBillNum(String wayBillNum);
 
+    /**
+     * 根据运单号删除发票
+     * @param wayBillNum
+     * @return
+     */
     int deleteByBillNum(String wayBillNum);
 
+    /**
+     * 根据运单号查询发票
+     * @param wayBillNum
+     * @return
+     */
     BillInvoice selectByInvoiceNum(String wayBillNum);
+
+    /**
+     * 发票统计汇总
+     * @param billInvoice
+     * @return
+     */
     Map<String,String> findInvoiceStatics(@Param("billInvoice") BillInvoice billInvoice);
 
+    /**
+     * 根据客户名称查询所有发票
+     * @param customerName
+     * @return
+     */
     List<BillInvoice> selectNoCarNoVoiceQuery(String customerName);
 
+    /**
+     * 更新计费明细
+     * @param companyVo
+     * @return
+     */
     int upDateCompany(CompanyVo companyVo);
 }

+ 103 - 1
src/main/java/com/jkcredit/invoice/mapper/customer/CustomerCarRecMapper.java

@@ -13,35 +13,137 @@ import java.util.List;
 @Repository
 public interface CustomerCarRecMapper extends BaseMapper<CustomerCarRec> {
 
+    /**
+     * 客户注册信息新增
+     *
+     * @param record
+     * @return
+     */
     @Override
     int insert(CustomerCarRec record);
 
+    /**
+     * 客户注册信息按条件新增
+     * @param record
+     * @return
+     */
     int insertSelective(CustomerCarRec record);
 
-    List<CustomerCarRec>  selectByCustName(String customerName);
+    /**
+     * 根据Appkey查询客户注册信息列表
+     * @param customerName
+     * @return
+     */
+    List<CustomerCarRec> selectByCustName(String customerName);
 
+    /**
+     * 根据ect卡号查询客户列表
+     * @param etcNum
+     * @return
+     */
     CustomerCarRec selectByEtc(String etcNum);
+
+    /**
+     * 根据ect卡号查询客户列表 (防止事物问题)
+     * @param etcNum
+     * @return
+     */
     CustomerCarRec selectByEtcForLock(String etcNum);
+
+    /**
+     * 根据车牌号查询无车客户列表
+     * @param carNum
+     * @return
+     */
     List<CustomerCarRec> selectByCarNum(String carNum);
+
+    /**
+     * 根据车牌号查询自有车客户列表 只查询注册成功客户
+     * @param carNum
+     * @return
+     */
     List<CustomerCarRec> selectBySelfCarNum(String carNum);
+
+    /**
+     * 根据车牌号查询自有车客户列表
+     * @param carNum
+     * @return
+     */
     List<CustomerCarRec> selectAllEtcBySelfCarNum(String carNum);
 
+    /**
+     * 更新自有车客户信息
+     * @param record
+     * @return
+     */
     int updateByPrimaryKeySelective(CustomerCarRec record);
 
+    /**
+     * 更新客户信息
+     * @param record
+     * @return
+     */
     int updateByPrimaryKey(CustomerCarRec record);
 
+    /**
+     * 根据etc卡号更新无车客户信息
+     * @param record
+     * @return
+     */
     int updateEtcByPrimaryKeySelective(CustomerCarRec record);
 
+    /**
+     * 更新客户信息
+     * @param record
+     * @return
+     */
     int updateEtcByPrimaryKey(CustomerCarRec record);
 
+    /**
+     * 根据etc卡号更新成功过的客户信息
+     * @param record
+     * @return
+     */
     int updateWaitEtcStatus(CustomerCarRec record);
+
+    /**
+     * 查询所有客户列表
+     * @return
+     */
     List<CustomerCarRec> selectAllBindEtcNoGetInvoice();
+
+    /**
+     * 客户列表分页查询
+     * @param page
+     * @param customerCarRec
+     * @return
+     */
     IPage<List<CustomerCarRec>> selectAllByPage(Page page, @Param("query") CustomerCarRec customerCarRec);
 
+    /**
+     * 根据企业名称更新客户列表
+     * @param companyVo
+     * @return
+     */
     int upDateCompanySelf(CompanyVo companyVo);
 
+    /**
+     * 根据企业编码更新客户列表
+     * @param companyVo
+     * @return
+     */
     int upDateCompanyNo(CompanyVo companyVo);
+
+    /**
+     * 根据企业名称查询所有自有车企业列表
+     * @param companyName
+     * @return
+     */
     List<CustomerCarRec> selectAllEtcByCompany(String companyName);
 
+    /**
+     * 根据etc卡号删除客户列表
+     * @param etcNum
+     */
     void deleteByEtcCard(String etcNum);
 }

+ 0 - 30
src/main/java/com/jkcredit/invoice/service/customer/impl/CustomerRecServiceImpl.java

@@ -59,21 +59,6 @@ public class CustomerRecServiceImpl extends ServiceImpl<CustomerRecMapper,Custom
     @Override
     public synchronized CustomerRec selectByCustomerNameAndCompanyReference(CustomerRec record) {
         CustomerRec customerRec = customerRecMapper.selectByCustomerNameAndCompanyReference(record);
-
-        /*if(customerRec == null){
-            //根据税号查询企业,若业务类型一致自动挂到当前客户下
-           List<CustomerRec> customerRecs = customerRecMapper.selectByCompanyReference(customerRec.getCompanyReferencenum());
-           if(customerRecs!=null && customerRecs.size()>0){
-               for(CustomerRec customerRec1:customerRecs){
-                   if(customerRec1.getBussinessType().equals(customerRec.getBussinessType())){
-                       customerRec1.setCustomerName(customerRec.getCustomerName());
-                       customerRec = customerRec1;
-                       customerRecMapper.insert(customerRec);
-                       break;
-                   }
-               }
-           }
-        }*/
         if(customerRec == null || customerRec.getRecStatus()!=1){customerRec = null;}
         return customerRec;
     }
@@ -86,21 +71,6 @@ public class CustomerRecServiceImpl extends ServiceImpl<CustomerRecMapper,Custom
     @Override
     public synchronized CustomerRec selectByCustomerNameAndCompanyNum(CustomerRec record) {
         CustomerRec customerRec = customerRecMapper.selectByCustomerNameAndCompanyNum(record);
-        /*if(customerRec == null){
-            //根据税号查询企业,若业务类型一致自动挂到当前客户下
-            List<CustomerRec> customerRecs = customerRecMapper.selectByCompanyNum(customerRec);
-            if(customerRecs!=null && customerRecs.size()>0){
-                for(CustomerRec customerRec1:customerRecs){
-                    if(customerRec1.getBussinessType().equals(customerRec.getBussinessType())){
-                        customerRec1.setCustomerName(customerRec.getCustomerName());
-                        customerRec = customerRec1;
-                        customerRecMapper.insert(customerRec);
-                        break;
-                    }
-                }
-            }
-        }
-        if(customerRec == null || customerRec.getRecStatus()!=1){customerRec = null;}*/
         if(customerRec == null || customerRec.getRecStatus()!=1){customerRec = null;}
         return customerRec;
     }

+ 0 - 1
src/main/java/com/jkcredit/invoice/service/customer/impl/CustomerServiceImpl.java

@@ -112,7 +112,6 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,Customer> im
             log.info("协议上传失败:CustomerServiceImpl.contractAdd{}---msg{}",customerRec,responseRespR.getMsg());
             //解决下游客户传递企业注册信息未传递协议信息时,备案文档无法下载问题,可以由业务人员在协议信息中补填协议信息,进行备案文档下载
             //失败后不再更新数据库信息
-            //customerRecMapper.updateByPrimaryKeySelective(customerRec);
             return new RespR(false,responseRespR.getMsg());
         }else{
             log.info("协议上传成功:CustomerServiceImpl.contractAdd");

+ 11 - 0
src/main/java/com/jkcredit/invoice/service/lowerservice/CheckHasAuthRole.java

@@ -3,7 +3,18 @@ package com.jkcredit.invoice.service.lowerservice;
 import com.jkcredit.invoice.model.entity.user.User;
 
 public interface CheckHasAuthRole {
+
+    /**
+     * 公司角色校验
+     * @param user
+     * @param company
+     */
     public void checkCompanyRole(User user,String company);
 
+    /**
+     * 客户角色校验
+     * @param user
+     * @param customerName
+     */
     public void checkCustomerRole(User user,String customerName);
 }

+ 5 - 1
src/main/java/com/jkcredit/invoice/service/lowerservice/CustomeLowerService.java

@@ -31,7 +31,11 @@ public interface CustomeLowerService {
     RespR customeRecQuery(CustomerRec customerRec);
 
 
-    //协议上传 上传到本地库
+    /**
+     * 协议上传 上传到本地库
+     * @param customerRecs
+     * @return
+     */
     RespR customeRecUpload(List<CustomerRec> customerRecs);
 
 

+ 0 - 11
src/main/java/com/jkcredit/invoice/service/lowerservice/impl/SelfCarServiceLImpl.java

@@ -73,10 +73,6 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
             log.info("获取交易失败SelfCarServiceLImpl.getTradeList{},msg{}",tradeRequestVo,"时间为空");
             return new RespR(false,"时间为空");
         }
-       /* if(DateUtil.getDistanceDays(tradeRequestVo.getEndTime(),tradeRequestVo.getStartTime())>90){
-            log.info("获取交易失败SelfCarServiceLImpl.getTradeList{},msg{}",tradeRequestVo,"不能查询大于90天的交易");
-            return new RespR(false,"不能查询大于90天的交易");
-        }*/
         CustomerRec customerRec = new CustomerRec();
         customerRec.setCustomerName(tradeRequestVo.getCustomerName());
         customerRec.setCompanyName(tradeRequestVo.getCompanyName());
@@ -336,13 +332,6 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
         list.setPlateNum(etcQueryVo.getPlateNum());//车牌号,非必输
         list.setPalteColor(etcQueryVo.getPlateColor());//车牌颜色.非必输
         RespR<CardBindQueryListToBResponse> respR = selfCarInterface.cardBindQueryListToB(list);
-
-        /*if(customerRec.getInterType() == 0){
-            if(respR.getCode() == 0 && (respR.getData().getResult()==null||respR.getData().getResult().size()<=0)){
-                respR.setCode(2);
-            }
-            return respR;
-        }*/
         if(respR.getCode() == 1){
             log.info("获取etc信息失败:SelfCarServiceLImpl.getEtcInfo{},msg{}",etcQueryVo,respR.getMsg());
             return new RespR(false,respR.getMsg());

+ 0 - 13
src/main/java/com/jkcredit/invoice/service/upservice/impl/SelfCarInterfaceImpl.java

@@ -311,19 +311,6 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             log.info("SelfCarInterfaceImpl.queryApplyQueryByTradeId上游请求参数:{}", tradeApplyQueryRequest.toString());
             //(4)指定协议的响应模型(IssuerUploadResponse),调用upload 发送数据
             TradeApplyQueryResponse response=ETCCommHelper.upload(fileName, tradeApplyQueryRequest, TradeApplyQueryResponse.class);
-
-            //TradeApplyQueryResponse response= new TradeApplyQueryResponse();
-            //response.setInfo("成功");
-            //response.setReceiveTime("2022-12-20T17:02:05");
-            //response.setCardId("43012101239418084384");
-            //response.setApplyId("afa5d7888ec246118134e2c06e950374");
-            //response.setTradeCount(65);
-            //response.setInvoiceCount(45);
-            //response.setInvoiceAmount((long) 1235);
-            //response.setTaxAmount((long) 1199);
-            //response.setInvoicedCount(78);
-            //response.setInvoicedAmount((long) 36);
-            //response.setApplyStatus(3);
             log.info("SelfCarInterfaceImpl.queryApplyQueryByTradeId上游接口返回:{},请求参数:{},cost={}ms", response.toString(), tradeApplyQueryRequest.toString(),System.currentTimeMillis()-startTime);
             return new RespR<>(response);
         } catch (IOException e) {

+ 9 - 0
src/main/java/com/jkcredit/invoice/service/user/AuthenticationService.java

@@ -11,7 +11,16 @@ import com.jkcredit.invoice.model.entity.user.User;
 
 public interface AuthenticationService {
 
+    /**
+     * 获取token
+     * @param user
+     * @return
+     */
     String getToken(User user);
 
+    /**
+     * 删除token
+     * @param token
+     */
     void deleteToken(String token);
 }

+ 0 - 6
src/main/java/com/jkcredit/invoice/service/user/impl/UserServiceImpl.java

@@ -60,12 +60,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 
     @Override
     public RespR<Boolean> updateUserInfo(User user){
-       /* if(user.getRoleId()!=null){
-            //根据角色ID查询角色信息
-            Role role =roleService.getById(user.getRoleId());
-            //设置角色名称
-            user.setRoleName(role.getRoleName());
-        }*/
         //更新客户企业主体
         Customer customer = customerMapper.selectByCustomerName(user.getUserName());
         customer.setCompany(user.getCompany());

+ 0 - 3
src/main/java/com/jkcredit/invoice/util/Base64Util.java

@@ -131,7 +131,6 @@ public class Base64Util {
             fin.close();
             bin.close();
             //关闭 ByteArrayOutputStream 无效。此类中的方法在关闭此流后仍可被调用,而不会产生任何 IOException
-            //baos.close();
             bout.close();
         } catch (IOException e) {
             e.printStackTrace();
@@ -160,8 +159,6 @@ public class Base64Util {
         //将base64编码的字符串解码成字节数组
         byte[] bytes = new sun.misc.BASE64Decoder().decodeBuffer(base64sString);
             //apache公司的API
-            //byte[] bytes = Base64.decodeBase64(base64sString);
-            //创建一个将bytes作为其缓冲区的ByteArrayInputStream对象
             ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
             //创建从底层输入流中读取数据的缓冲输入流对象
             bin = new BufferedInputStream(bais);

+ 0 - 1
src/main/java/com/jkcredit/invoice/util/DateUtil.java

@@ -390,7 +390,6 @@ public class DateUtil {
             format.setLenient(false);
             format.parse(str);
         } catch (ParseException e) {
-            // e.printStackTrace();
             // 如果throw java.text.ParseException或者NullPointerException,就说明格式不对
             convertSuccess=false;
         }

+ 0 - 3
src/main/java/com/jkcredit/invoice/util/WebFileDownLoadUtils.java

@@ -50,17 +50,14 @@ public class WebFileDownLoadUtils {
      * @param targetDir
      */
     public void downloadLittleFileToPath(String url, String targetDir, Map<String, String> params, SearchInvoiceResultVo searchInvoiceResult, String batchNumber) {
-//        Instant now = Instant.now();
         String completeUrl = addGetQueryParam(url, params);
         ResponseEntity<byte[]> rsp = httpClientTemplate.getForEntity(completeUrl, byte[].class);
-//        log.info("[下载文件] [状态码] code:{}", rsp.getStatusCode());
         try {
             String path = getAndCreateDownloadDir(targetDir, searchInvoiceResult, batchNumber);
             Files.write(Paths.get(path), Objects.requireNonNull(rsp.getBody(), "未获取到下载文件"));
         } catch (IOException e) {
             log.error("[下载文件] 写入失败:", e);
         }
-//        log.info("[下载文件] 完成,耗时:{}", ChronoUnit.MILLIS.between(now, Instant.now()));
     }
 
 

+ 0 - 4
src/main/java/com/jkcredit/invoice/util/WordUtil.java

@@ -11,17 +11,13 @@ public class WordUtil {
     public static void exportSimpleWord(Map<String,String> dataMap, String path, OutputStream outputStream) throws Exception {
         Configuration configuration = new Configuration();
         configuration.setDefaultEncoding("utf-8");
-
         /*
          * 以下是两种指定ftl文件所在目录路径的方式, 注意这两种方式都是 指定ftl文件所在目录的路径,而不是ftl文件的路径
          */
         // 指定路径的第一种方式(根据某个类的相对路径指定)
         configuration.setClassForTemplateLoading(WordUtil.class,path);
-        // 指定路径的第二种方式,我的路径是C:/a.ftl
-        //configuration.setDirectoryForTemplateLoading(new File("D:\\workspace\\manage_invoice\\src\\main\\resources\\static\\templates\\excel\\"));
         // 输出文档路径及名称
         File outFile = new File("e:/test.doc");
-
         // 以utf-8的编码读取ftl文件
         Template t = configuration.getTemplate("word.ftl", "utf-8");
         Writer out = new BufferedWriter(new OutputStreamWriter(