wwh před 2 roky
rodič
revize
af1e13dccd

+ 13 - 0
admin/src/main/java/com/huimv/farm/damsubsidy/controller/BillSubsidyController.java

@@ -9,6 +9,7 @@ import com.huimv.farm.damsubsidy.entity.BillSubsidy;
 import com.huimv.farm.damsubsidy.service.IBillSubsidyService;
 import com.huimv.farm.damsubsidy.common.utils.PdfUtil;
 import com.huimv.farm.test.Print;
+import com.huimv.farm.test.Print2;
 import com.spire.xls.FileFormat;
 import com.spire.xls.Workbook;
 import com.spire.xls.Worksheet;
@@ -192,4 +193,16 @@ public class BillSubsidyController {
                           ) throws IOException {
         subsidyService.printPay2(response, startDate, endDate);
     }
+
+    //阶段性统计表
+    @GetMapping("/printAmount")
+    public void printAmount(HttpServletResponse response) throws Exception {
+        String path = "G://amount.xls";
+
+//        Print2.print();
+//        PdfUtil.returnPdfStream2(response,path,subsidy.getFarmerName());
+        //文件删除 TODO
+
+
+    }
 }

+ 6 - 2
admin/src/main/java/com/huimv/farm/damsubsidy/controller/SysUserController.java

@@ -139,14 +139,16 @@ public class SysUserController {
 
     @PostMapping(value = "/add")
     public Result add(HttpServletRequest req,@RequestParam(name = "idCordFrontUrl") MultipartFile idCordFrontUrl,
-                      @RequestParam(name = "idCordBackUrl") MultipartFile idCordBackUrl,
+                      @RequestParam("idCordBackUrl") MultipartFile idCordBackUrl,
                       @RequestParam("type") String type,
                       @RequestParam("userName") String userName,
                       @RequestParam("idCord") String idCord,
                       @RequestParam("phone") String phone,
                       @RequestParam(name = "farmName",required = false) String farmName,
                       @RequestParam(name = "veterId",required = false) String veterId,
-                      @RequestParam(name = "detailedAdressCode",required = false) String detailedAdressCode
+                      @RequestParam(name = "address") String address,//身份证地址
+                      @RequestParam(name = "detailedAddress") String detailedAddress,//详细地址
+                      @RequestParam(name = "detailedAdressCode") String detailedAdressCode//地址行政码
     ) throws UnsupportedEncodingException {
         req.setCharacterEncoding("UTF-8");
         System.out.println(userName);
@@ -205,6 +207,8 @@ public class SysUserController {
         map.put("veterId", veterId);
         map.put("detailedAdressCode", detailedAdressCode);
         map.put("farmName", farmName);
+        map.put("address", address);
+        map.put("detailedAddress", detailedAddress);
 
         Result result = iSysUserService.add(req, map);
         if (result.getCode() == 10000) {

+ 8 - 0
admin/src/main/java/com/huimv/farm/damsubsidy/entity/BillSubsidy.java

@@ -212,4 +212,12 @@ public class BillSubsidy extends BaseEntity implements Serializable {
      * 是否再次申诉0为第一次,1为第二次
      * */
     private Integer isShensu;
+
+    private String detailedAdress;
+
+    private String detailedAdressCode;
+
+    private String briefAddress;
+
+    private String briefAddressCode;
 }

+ 53 - 0
admin/src/main/java/com/huimv/farm/damsubsidy/entity/Vo/BillSubsidyVo.java

@@ -0,0 +1,53 @@
+package com.huimv.farm.damsubsidy.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.huimv.farm.damsubsidy.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Date;
+
+/**
+ * <p>
+ * 补贴信息表
+ * </p>
+ *
+ * @author author
+ * @since 2023-04-26
+ */
+@Data
+public class BillSubsidyVo extends BaseEntity implements Serializable {
+
+
+    private Integer id;
+
+    private String name;
+
+    private String type1;
+    private String type2;
+    private String type3;
+
+    private Integer count;
+    private Integer number;
+    private Integer money;
+    private Integer count1;
+    private Integer number1;
+    private Integer money1;
+    private Integer count2;
+    private Integer number2;
+    private Integer money2;
+    private Integer count3;
+    private Integer number3;
+    private Integer money3;
+    private Integer count4;
+    private Integer number4;
+    private Integer money4;
+    private Integer moneycount;
+}

+ 2 - 0
admin/src/main/java/com/huimv/farm/damsubsidy/service/IBillSubsidyService.java

@@ -48,4 +48,6 @@ public interface IBillSubsidyService extends IService<BillSubsidy> {
     Result printPay(HttpServletResponse response, Map<String, String> paramsMap) throws IOException;
 
     void printPay2(HttpServletResponse response,String startDate,String endDate) throws IOException;
+
+//    void printAmount(HttpServletResponse httpServletResponse);
 }

+ 5 - 0
admin/src/main/java/com/huimv/farm/damsubsidy/service/impl/BillSubsidyServiceImpl.java

@@ -732,4 +732,9 @@ public class BillSubsidyServiceImpl extends ServiceImpl<BillSubsidyMapper, BillS
             outputStream.close();
         }
     }
+
+//    @Override
+//    public void printAmount(HttpServletResponse httpServletResponse) {
+//
+//    }
 }

+ 6 - 5
admin/src/main/java/com/huimv/farm/damsubsidy/service/impl/SysUserServiceImpl.java

@@ -193,11 +193,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         user.setPhone(paramsMap.get("phone"));
         user.setIdCardFrontUrl(paramsMap.get("idCordFrontUrl"));
         user.setIdCardBackUrl(paramsMap.get("idCordBackUrl"));
+        user.setAddress(paramsMap.get("address"));
+        user.setDetailedAdress(paramsMap.get("detailedAdress"));
+        user.setDetailedAdressCode(paramsMap.get("detailedAdressCode"));
         user.setCreateTime(new Date());
-//        user.setCreateUser(paramsMap.get("userName"));
-        if (ObjectUtil.isNotEmpty(paramsMap.get("detailedAdressCode"))) {
-            user.setDetailedAdressCode(paramsMap.get("detailedAdressCode"));
-        }
+
         if (Integer.parseInt(paramsMap.get("type")) == 1) {
             System.out.println(paramsMap.get("veterId"));
             user.setVeterId((paramsMap.get("veterId")));
@@ -216,8 +216,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
             user.setDetailedAdress(paramsMap.get("detailedAdressCode"));
             user.setFarmName(paramsMap.get("farmName"));
         }
-        if (Integer.parseInt(paramsMap.get("type")) == 2 ||Integer.parseInt(paramsMap.get("type")) == 3) {
 
+
+        if (Integer.parseInt(paramsMap.get("type")) == 2 ||Integer.parseInt(paramsMap.get("type")) == 3) {
             user.setAccoutType(1);
             user.setIsRealName(1);
             QueryWrapper<SysUser> queryWrapper1 = new QueryWrapper<>();

+ 109 - 0
admin/src/main/java/com/huimv/farm/test/Print2.java

@@ -0,0 +1,109 @@
+package com.huimv.farm.test;
+
+import com.huimv.farm.damsubsidy.entity.BillSubsidy;
+import com.huimv.farm.damsubsidy.entity.vo.BillSubsidyVo;
+import org.jxls.common.Context;
+import org.jxls.util.JxlsHelper;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Print2 {
+    /**
+     * 打印方法  不插入图片
+     * @throws Exception
+     * @return
+     */
+    public  static void print(List<BillSubsidy> subsidies) throws Exception {
+        //准备数据
+        String path ="G://mount.xls";
+        //获取模板文件,你自己当前模板的位置  我这里为当前项目下
+        //如果为系统路径 为: InputStream is = new FileInputStream("F://student.xlsx");
+        InputStream is = new FileInputStream("G://amount.xlsx");
+//        InputStream is = Print.class.getClassLoader().getResourceAsStream("student.xlsx");
+//        InputStream is = Print.class.getClassLoader().getResourceAsStream("order_contract.xls");
+        //根据模板生成的文件保存路径  我这里保存在本地D盘
+        OutputStream os = new FileOutputStream(path);
+        //绑定数据
+        List<BillSubsidy> list = new ArrayList<>();
+        Context context = new Context();
+        //涉及太多只写了一个单独的
+        for (int i = 0; i < subsidies.size(); i++) {
+            BillSubsidyVo subsidyVo = new BillSubsidyVo();
+            subsidyVo.setId(i);
+            subsidyVo.setName(subsidies.get(i).getBriefAddress());
+            if (subsidies.get(i).getFarmerType()==0) {
+                subsidyVo.setType1("1");
+            } else if (subsidies.get(i).getFarmerType()==1) {
+                subsidyVo.setType2("2");
+            } else {
+                subsidyVo.setType3("2");
+            }
+            if (subsidies.get(i).getRewardType() == 0) {
+
+
+                subsidyVo.setNumber(subsidies.get(i).getRewardNum());
+
+            } else if (subsidies.get(i).getRewardType() == 1) {
+
+            } else if (subsidies.get(i).getRewardType() == 2) {
+
+            } else if (subsidies.get(i).getRewardType() == 3){
+
+            } else if (subsidies.get(i).getRewardType() == 4) {
+
+            } else {
+
+            }
+        }
+//        context.putVar("orderTime", new Date());
+
+        //生成
+        JxlsHelper.getInstance().processTemplate(is, os, context);
+//        String path = String.valueOf(os);
+
+    }
+
+
+//    /**
+//     * 打印方法  不插入图片
+//     *
+//     * 模板文件为student1.xlsx
+//     * 注意事项:模板文件新加入了一行,所以整体范围也就有所改变,大家注意一下批注中的结束范围
+//     * 图片所占用的范围为B2到C2
+//     *
+//     *
+//     * @throws Exception
+//     */
+//    public static void print1() throws Exception {
+//        //准备数据
+//
+//        //获取模板文件,你自己当前模板的位置  我这里为当前项目下
+//        //如果为系统路径 为: InputStream is = new FileInputStream("F://student.xlsx");
+//        InputStream is = Print.class.getClassLoader().getResourceAsStream("student1.xlsx");
+//        //根据模板生成的文件保存路径  我这里保存在本地D盘
+//        OutputStream os = new FileOutputStream("D://student1.xlsx");
+//
+//        //图片路径
+//        InputStream imageInputStream =Print.class.getClassLoader().getResourceAsStream("a.png");
+//        //转为字节码,插入的图片只能是字节码格式
+//        byte[] imageBytes = Util.toByteArray(imageInputStream);
+//        //绑定数据
+//        Context context = new Context();
+//        context.putVar("imageBytes", imageBytes);
+//        context.putVar("title", "学上统计表");
+////        context.putVar("list", list);
+//        //生成
+//        JxlsHelper.getInstance().processTemplate(is, os, context);
+//    }
+//
+//    public static void main(String[] args) throws Exception {
+//        print();
+////        print1();
+//    }
+
+}