wwh 2 лет назад
Родитель
Сommit
eba9fca7d6

+ 66 - 45
admin/src/main/java/com/huimv/farm/damsubsidy/controller/BillSubsidyController.java

@@ -13,6 +13,7 @@ import com.huimv.farm.damsubsidy.entity.SysUser;
 import com.huimv.farm.damsubsidy.service.IAreaAllService;
 import com.huimv.farm.damsubsidy.service.IBillSubsidyService;
 import com.huimv.farm.damsubsidy.common.utils.PdfUtil;
+import com.huimv.farm.damsubsidy.service.ISysUserService;
 import com.huimv.farm.damsubsidy.test.QrCodeExcelPrinter;
 import com.huimv.farm.test.Print;
 import com.huimv.farm.test.Print2;
@@ -44,15 +45,17 @@ public class BillSubsidyController {
     private IBillSubsidyService iBillSubsidyService;
     @Autowired
     private IAreaAllService iAreaAllService;
+    @Autowired
+    private ISysUserService iSysUserService;
 
     @PostMapping("/addApplication")
-    public Result addApplication(HttpServletRequest httpServletRequest, @RequestBody BillSubsidy billSubsidy){
-        return iBillSubsidyService.addApplication(httpServletRequest,billSubsidy);
+    public Result addApplication(HttpServletRequest httpServletRequest, @RequestBody BillSubsidy billSubsidy) {
+        return iBillSubsidyService.addApplication(httpServletRequest, billSubsidy);
     }
 
     @PostMapping("/saveApplication")
-    public Result saveApplication(HttpServletRequest httpServletRequest, @RequestBody BillSubsidy billSubsidy){
-        return iBillSubsidyService.saveApplication(httpServletRequest,billSubsidy);
+    public Result saveApplication(HttpServletRequest httpServletRequest, @RequestBody BillSubsidy billSubsidy) {
+        return iBillSubsidyService.saveApplication(httpServletRequest, billSubsidy);
     }
 
     @Autowired
@@ -72,6 +75,7 @@ public class BillSubsidyController {
     public Result edit(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> paramsMap) {
         return subsidyService.edit(httpServletRequest, paramsMap);
     }
+
     @RequestMapping("/edit2")
     public Result edit2(HttpServletRequest httpServletRequest,
                         @RequestParam("workImg") MultipartFile workImg,
@@ -109,39 +113,39 @@ public class BillSubsidyController {
     }
 
 
-
     @RequestMapping("/appeal")
     public Result appeal(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> paramsMap) {
         return subsidyService.appeal(httpServletRequest, paramsMap);
     }
+
     @PostMapping("/editApplication")
-    public Result editApplication(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> parasMap){
-        return iBillSubsidyService.editApplication(httpServletRequest,parasMap);
+    public Result editApplication(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> parasMap) {
+        return iBillSubsidyService.editApplication(httpServletRequest, parasMap);
     }
 
     @PostMapping("/listApplication")
-    public Result listApplication(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> parasMap){
-        return iBillSubsidyService.listApplication(httpServletRequest,parasMap);
+    public Result listApplication(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> parasMap) {
+        return iBillSubsidyService.listApplication(httpServletRequest, parasMap);
     }
 
     @PostMapping("/getLast")
-    public Result getLast(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> parasMap){
-        return iBillSubsidyService.getLast(httpServletRequest,parasMap);
+    public Result getLast(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> parasMap) {
+        return iBillSubsidyService.getLast(httpServletRequest, parasMap);
     }
 
     @PostMapping("/listPcSub")
-    public Result listPcSub(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> parasMap){
-        return subsidyService.listPcSub(httpServletRequest,parasMap);
+    public Result listPcSub(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> parasMap) {
+        return subsidyService.listPcSub(httpServletRequest, parasMap);
     }
 
     @PostMapping("/listFlow")
-    public Result listFlow(@RequestBody Map<String, String> parasMap){
+    public Result listFlow(@RequestBody Map<String, String> parasMap) {
         return iBillSubsidyService.listFlow(parasMap);
     }
 
     //打印
     @GetMapping("/print")
-    public void print(HttpServletResponse response, HttpServletRequest httpServletRequest,@RequestParam(name = "id", required = true) Integer id) throws Exception {
+    public void print(HttpServletResponse response, HttpServletRequest httpServletRequest, @RequestParam(name = "id", required = true) Integer id) throws Exception {
 //        Integer id=Integer.parseInt(parasMap.get("id"));
         BillSubsidy subsidy = subsidyService.getById(id);
         QrCodeExcelPrinter codeExcelPrinter = new QrCodeExcelPrinter();
@@ -155,7 +159,7 @@ public class BillSubsidyController {
         wb.loadFromFile(path);
         Worksheet sheet = wb.getWorksheets().get(0);
         //添加图片
-        ExcelPicture picture = sheet.getPictures().add(37,10,"/opt/subsidy/a.png");
+        ExcelPicture picture = sheet.getPictures().add(37, 10, "/opt/subsidy/a.png");
         picture.setHeight(70);//设置图片高度
         picture.setWidth(75);//设置图片宽度
 
@@ -166,12 +170,12 @@ public class BillSubsidyController {
         worksheet.getRange().get("C18").getStyle().setWrapText(true);//耳标号
 
         //调用方法保存为PDF格式
-       String pdfPath = "/opt/subsidy/"+subsidy.getFarmerName()+".pdf";
+        String pdfPath = "/opt/subsidy/" + subsidy.getFarmerName() + ".pdf";
         wb.saveToFile(pdfPath, FileFormat.PDF);
         wb.dispose();
 
 
-        PdfUtil.returnPdfStream2(response,pdfPath,subsidy.getFarmerName());
+        PdfUtil.returnPdfStream2(response, pdfPath, subsidy.getFarmerName());
         //文件删除 TODO
         File file = new File(pdfPath);
 //
@@ -180,10 +184,10 @@ public class BillSubsidyController {
     }
 
     @PostMapping("/updatePayStatus")
-    public Result updatePayStatus(@RequestBody Map<String, String> paramsMap ) {
+    public Result updatePayStatus(@RequestBody Map<String, String> paramsMap) {
         String ids = paramsMap.get("ids");
         String[] split = ids.split(",");
-        List list= new ArrayList();
+        List list = new ArrayList();
         for (String s : split) {
 
             BillSubsidy billSubsidy = new BillSubsidy();
@@ -192,37 +196,37 @@ public class BillSubsidyController {
             list.add(billSubsidy);
         }
         subsidyService.updateBatchById(list);
-        return new Result(10000,"批量修改成功",true);
+        return new Result(10000, "批量修改成功", true);
     }
 
 
     @PostMapping("/printPay2")
-    public Result printPay(HttpServletResponse response,@RequestBody Map<String, String> paramsMap ) throws IOException {
-      return subsidyService.printPay(response,paramsMap);
+    public Result printPay(HttpServletResponse response, @RequestBody Map<String, String> paramsMap) throws IOException {
+        return subsidyService.printPay(response, paramsMap);
     }
 
     @GetMapping("/printPay")
-    public void printPay2(HttpServletResponse response,@RequestParam(name = "startDate", required = false) String startDate,
+    public void printPay2(HttpServletResponse response, @RequestParam(name = "startDate", required = false) String startDate,
                           @RequestParam(name = "endDate", required = false) String endDate
-                          ) throws IOException {
+    ) throws IOException {
         subsidyService.printPay2(response, startDate, endDate);
     }
 
     //阶段性统计表
     @GetMapping("/printAmount")
-    public void printAmount(HttpServletResponse response,HttpServletRequest httpServletRequest, @RequestParam(name = "country", required = false) String country
-            , @RequestParam(name = "startDate", required = true) String startDate, @RequestParam(name = "endDate", required = true) String endDate) throws Exception {
-
+    public void printAmount(HttpServletResponse response, HttpServletRequest httpServletRequest, @RequestParam(name = "country", required = false) String country
+            , @RequestParam(name = "startDate", required = true) String startDate, @RequestParam(name = "endDate", required = true) String endDate,
+                            @RequestParam(name = "type", required = true) Integer type, @RequestParam(name = "id", required = false) String id
+    ) throws Exception {
 
-        Integer userType = TokenSign.getUserType(httpServletRequest);
-        if (userType == 0) {
+        if (type == 0) {
             //畜牧中心
             if (country == null || "".equals(country)) {
                 //打印县
                 Map<String, String> map = new HashMap<>();
                 map.put("start", startDate);
                 map.put("end", endDate);
-                map.put("code","1");
+                map.put("code", "1");
                 iBillSubsidyService.printAmount(response, map);
                 String path = "/opt/subsidy/xian.xls";
                 PdfUtil.returnPdfStream2(response, path, "县阶段性统计表");
@@ -231,15 +235,16 @@ public class BillSubsidyController {
                 Map<String, String> map = new HashMap<>();
                 map.put("start", startDate);
                 map.put("end", endDate);
-                map.put("code",country);
+                map.put("code", country);
                 iBillSubsidyService.printAmount(response, map);
                 String path = "/opt/subsidy/amount.xls";
                 PdfUtil.returnPdfStream2(response, path, "镇阶段性统计表");
             }
 
-        }else {
+        } else {
             //专干
-            country = TokenSign.getAddressCode(httpServletRequest);//镇的编码
+            SysUser user = iSysUserService.getById(id);
+            country = user.getDetailedAdressCode();//镇的编码
             Map<String, String> map = new HashMap<>();
             map.put("start", startDate);
             map.put("end", endDate);
@@ -253,28 +258,44 @@ public class BillSubsidyController {
 
     //阶段性待支付统计表
     @GetMapping("/printWaitPay")
-    public void printWaitPay(HttpServletResponse response, @RequestParam(name = "country", required = true) String country
-            , @RequestParam(name = "startDate", required = true) String startDate, @RequestParam(name = "endDate", required = true) String endDate) throws Exception {
-        Map<String, String> map = new HashMap<>();
-        map.put("start", startDate);
-        map.put("end", endDate);
-        map.put("code", country);
-        iBillSubsidyService.printWaitPay(response, map);
+    public void printWaitPay(HttpServletResponse response, @RequestParam(name = "country", required = false) String country
+            , @RequestParam(name = "startDate", required = true) String startDate, @RequestParam(name = "endDate", required = true) String endDate,
+                             @RequestParam(name = "id", required = false) String id, @RequestParam(name = "endDate", required = true) Integer type
+    ) throws Exception {
+
+        if (type == 0) {
+            //畜牧中心
+            Map<String, String> map = new HashMap<>();
+            map.put("start", startDate);
+            map.put("end", endDate);
+            map.put("code", country);
+            iBillSubsidyService.printWaitPay(response, map);
+            String path = "/opt/subsidy/pay.xls";
+            PdfUtil.returnPdfStream2(response, path, "待支付表");
+        } else {
+            //专干
+            SysUser byId = iSysUserService.getById(id);
+            Map<String, String> map = new HashMap<>();
+            map.put("start", startDate);
+            map.put("end", endDate);
+            map.put("code", byId.getDetailedAdressCode());
+            iBillSubsidyService.printWaitPay(response, map);
+            String path = "/opt/subsidy/pay.xls";
+            PdfUtil.returnPdfStream2(response, path, "待支付表");
+        }
 
-        String path = "/opt/subsidy/pay.xls";
-        PdfUtil.returnPdfStream2(response,path,"待支付表");
         //文件删除 TODO
     }
 
     //阶段性统计表展示
     @PostMapping("/listCount")
-    public Result listCount(HttpServletRequest httpServletRequest,@RequestBody Map<String, String> parasMap){
+    public Result listCount(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> parasMap) {
         return iBillSubsidyService.countState(httpServletRequest, parasMap);
     }
 
     //阶段性待支付统计表展示
     @PostMapping("/listCountPay")
-    public Result listCountPay(HttpServletRequest httpServletRequest,@RequestBody Map<String, String> parasMap){
+    public Result listCountPay(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> parasMap) {
         return iBillSubsidyService.countPay(httpServletRequest, parasMap);
     }
 }

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

@@ -358,7 +358,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         user.setAccoutType(accoutType);
         userMapper.updateById(user);
         AccountGroup accountGroup = new AccountGroup();
-        accountGroup.setAccountId(user.getId().intValue());
+        accountGroup.setAccountId((long) user.getId().intValue());
         accountGroup.setGroupId(36);
         accountGroupMapper.insert(accountGroup);