From 539a56279625242c497b4b4093f2defbb9d80334 Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期四, 29 一月 2026 14:05:44 +0800
Subject: [PATCH] #i18n翻译

---
 src/main/java/com/zy/asrs/controller/MatController.java |   82 +++++++++++++++++++++++++---------------
 1 files changed, 51 insertions(+), 31 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/MatController.java b/src/main/java/com/zy/asrs/controller/MatController.java
index 53e9135..bcd5997 100644
--- a/src/main/java/com/zy/asrs/controller/MatController.java
+++ b/src/main/java/com/zy/asrs/controller/MatController.java
@@ -45,21 +45,25 @@
 
     @RequestMapping(value = "/mat/auto/matnr/auth")
     public R autoMatnr(){
-        return R.ok().add("YJ" + DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmsssss).substring(0, 16));
+        R r = R.ok();
+        r.put("data","YJ" + DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmsssss).substring(0, 16));
+        return r;
     }
 
     @RequestMapping(value = "/mat/list/pda/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "response.mat_pda_list")
     public R pdaList(@RequestParam(required = true)Long tagId){
         EntityWrapper<Mat> wrapper = new EntityWrapper<>();
         wrapper.eq("tag_id", tagId);
         wrapper.orderBy("create_time", false);
         List<Mat> mats = matService.selectList(wrapper);
-        return R.ok().add(mats);
+        R r = R.ok();
+        r.put("data",mats);
+        return r;
     }
 
     @RequestMapping(value = "/mat/search/pda/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "response.mat_pda_search")
     public R pdaSearch(@RequestParam(required = false)String condition){
         EntityWrapper<Mat> wrapper = new EntityWrapper<>();
         if (!Cools.isEmpty(condition)) {
@@ -68,23 +72,25 @@
         }
         wrapper.orderBy("create_time", false);
         List<Mat> mats = matService.selectList(wrapper);
-        return R.ok().add(mats);
+        R r = R.ok();
+        r.put("data",mats);
+        return r;
     }
 
     @RequestMapping(value = "/mat/{id}/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "response.mat_detail")
     public R get(@PathVariable("id") String id) {
         return R.ok(matService.selectById(String.valueOf(id)));
     }
 
     @RequestMapping(value = "/mat/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "response.mat_find")
     public R find(@RequestParam("matnr") String matnr) {
         return R.ok(matService.selectOne(new EntityWrapper<Mat>().eq("matnr", matnr)));
     }
 
     @RequestMapping(value = "/mat/list/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "response.mat_list")
     public R list(@RequestParam(defaultValue = "1")Integer curr,
                   @RequestParam(defaultValue = "10")Integer limit,
                   @RequestParam(required = false)String orderByField,
@@ -117,10 +123,10 @@
     }
 
     @RequestMapping(value = "/mat/add/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "response.mat_add")
     public R add(Mat mat) {
         if (null != matService.selectByMatnr(mat.getMatnr())) {
-            return R.error("缂栧彿宸插瓨鍦�");
+            return R.error("response.code_exists");
         }
         Date now = new Date();
         mat.setCreateBy(getUserId());
@@ -129,34 +135,34 @@
         mat.setUpdateTime(now);
         mat.setStatus(1);
         if (!matService.insert(mat)) {
-            throw new CoolException("娣诲姞澶辫触锛岃鑱旂郴绠$悊鍛�");
+            throw new CoolException("response.add_failed_contact_admin");
         }
-        return R.ok();
+        return R.ok("response.operation_success");
     }
 
 	@RequestMapping(value = "/mat/update/auth")
-	@ManagerAuth
-    public R update(Mat mat){
+    @ManagerAuth(memo = "response.mat_update")
+    public R update(Mat mat) {
         if (Cools.isEmpty(mat) || null==mat.getId()){
-            return R.error();
+            return R.error("response.parameter_error");
         }
         mat.setUpdateBy(getUserId());
         mat.setUpdateTime(new Date());
         matService.updateById(mat);
-        return R.ok();
+        return R.ok("response.operation_success");
     }
 
     @RequestMapping(value = "/mat/delete/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "response.mat_delete")
     public R delete(@RequestParam String param){
         List<Mat> list = JSONArray.parseArray(param, Mat.class);
         if (Cools.isEmpty(list)){
-            return R.error();
+            return R.error("response.parameter_error");
         }
         for (Mat entity : list){
             if (!matService.delete(new EntityWrapper<>(entity))) {
-                throw new CoolException("鍒犻櫎澶辫触锛岃鑱旂郴绠$悊鍛�");
-            }
+            throw new CoolException("response.delete_failed_contact_admin");
+        }
         }
         return R.ok();
     }
@@ -180,11 +186,13 @@
             map.put("desc", mat.getMatnr());
             result.add(map);
         }
-        return R.ok().add(result);
+        R r = R.ok();
+        r.put("data",result);
+        return r;
     }
 
     @RequestMapping(value = "/mat/export/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "response.mat_export")
     public R export(@RequestBody JSONObject param){
         EntityWrapper<Mat> wrapper = new EntityWrapper<>();
         List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
@@ -215,7 +223,9 @@
     public R query(@RequestBody JSONObject param) {
         Wrapper<Mat> wrapper = new EntityWrapper<Mat>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
         if (null != matService.selectOne(wrapper)){
-            return R.parse(BaseRes.REPEAT).add(getComment(Mat.class, String.valueOf(param.get("key"))));
+            R r = R.parse(BaseRes.REPEAT);
+            r.put("data", getComment(Mat.class, String.valueOf(param.get("key"))));
+            return r;
         }
         return R.ok();
     }
@@ -230,7 +240,9 @@
         OrderDetl orderDetl = new OrderDetl();
         orderDetl.sync(mat);
         orderDetl.setAnfme(0.0D);
-        return R.ok().add(orderDetl);
+        R r = R.ok();
+        r.put("data",orderDetl);
+        return r;
     }
 
     /*************************************** 鎵撳嵃鐩稿叧 ***********************************************/
@@ -260,7 +272,7 @@
 
     // 鎵撳嵃
     @RequestMapping(value = "/mat/print/auth")
-    @ManagerAuth(memo = "鍟嗗搧缂栫爜鎵撳嵃")
+    @ManagerAuth(memo = "response.mat_code_print")
     public R matCodePrint(@RequestParam(value = "param[]") String[] param) {
         if(Cools.isEmpty(param)) {
             return R.parse(CodeRes.EMPTY);
@@ -278,7 +290,9 @@
             print.setMemo(mat.getMemo());
             res.add(print);
         }
-        return R.ok().add(res);
+        R r = R.ok();
+        r.put("data", res);
+        return r;
     }
 
 
@@ -288,11 +302,13 @@
      * excel瀵煎叆妯℃澘涓嬭浇
      */
     @RequestMapping(value = "/mat/excel/import/mould")
-    public void matExcelImportMould(HttpServletResponse response) throws IOException {
+    public void matExcelImportMould(HttpServletResponse response, @RequestParam(required = false, defaultValue = "zh-cn") String lang) throws IOException {
         List<MatExcel> excels = new ArrayList<>();
         response.setContentType("application/vnd.ms-excel");
         response.setCharacterEncoding("utf-8");
-        String fileName = URLEncoder.encode("鍟嗗搧妗fExcel瀵煎叆妯℃澘", "UTF-8");
+        boolean isEn = "en".equalsIgnoreCase(lang);
+        String fileNameStr = "response.mat_excel_template_name";
+        String fileName = URLEncoder.encode(fileNameStr, "UTF-8");
         response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
         EasyExcel.write(response.getOutputStream(), MatExcel.class)
                 .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
@@ -302,12 +318,14 @@
 
     // excel瀵煎叆
     @PostMapping(value = "/mat/excel/import/auth")
-    @ManagerAuth(memo = "鍟嗗搧妗f鏁版嵁瀵煎叆")
+    @ManagerAuth(memo = "response.mat_excel_import")
     @Transactional
     public R matExcelImport(MultipartFile file) throws IOException {
         MatExcelListener listener = new MatExcelListener(getUserId());
         EasyExcel.read(file.getInputStream(), MatExcel.class, listener).sheet().doRead();
-        return R.ok("鎴愬姛鍚屾"+listener.getTotal()+"鏉″晢鍝佹暟鎹�");
+        R r = R.ok("response.sync_success_count");
+        r.put("count", listener.getTotal());
+        return r;
     }
 
     /*************************************** xm-select ***********************************************/
@@ -327,7 +345,9 @@
             vo.setValue(mat.getMatnr());
             valueVos.add(vo);
         }
-        return R.ok().add(valueVos);
+        R r = R.ok();
+        r.put("data",valueVos);
+        return r;
     }
 
 

--
Gitblit v1.9.1