From f65443d8abeaedc9d102324565e8368e7c9d90c8 Mon Sep 17 00:00:00 2001
From: 郑永安 <zyazyz250@sina.com>
Date: 星期一, 19 六月 2023 14:41:54 +0800
Subject: [PATCH] commit

---
 src/main/java/com/gk/firework/Service/ServiceImpl/StandardEducationLegerServiceImpl.java |  121 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 121 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/gk/firework/Service/ServiceImpl/StandardEducationLegerServiceImpl.java b/src/main/java/com/gk/firework/Service/ServiceImpl/StandardEducationLegerServiceImpl.java
new file mode 100644
index 0000000..b6a9a99
--- /dev/null
+++ b/src/main/java/com/gk/firework/Service/ServiceImpl/StandardEducationLegerServiceImpl.java
@@ -0,0 +1,121 @@
+package com.gk.firework.Service.ServiceImpl;
+
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gk.firework.Domain.Exception.BusinessException;
+import com.gk.firework.Domain.StandardEducationLeger;
+import com.gk.firework.Domain.StandardLawList;
+import com.gk.firework.Domain.UserInfo;
+import com.gk.firework.Domain.Utils.Properties;
+import com.gk.firework.Domain.Utils.UploadUtil;
+import com.gk.firework.Mapper.StandardEducationLegerMapper;
+import com.gk.firework.Service.StandardEducationLegerService;
+import com.gk.firework.Service.UserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service("standardEducationLegerService")
+public class StandardEducationLegerServiceImpl  extends ServiceImpl<StandardEducationLegerMapper, StandardEducationLeger> implements StandardEducationLegerService {
+
+    @Autowired
+    private UserService userService;
+    @Autowired
+    private StandardEducationLegerMapper standardEducationLegerMapper;
+
+    /**
+    * @Description: 查询从业人员教育培训台账
+    * @date 2021/5/8 16:33
+    */
+    @Override
+    public IPage selectPage(Page<StandardEducationLeger> page, Map filter, UserInfo userInfo) {
+
+
+        UserInfo user = userService.getById(userInfo.getId());
+        Map<String, Object> params = new HashMap<>();
+        //菜单
+        //可视权限
+        {
+            params.put("enterprisenumber", user.getCompanynumber());
+            params.put("province", user.getProvince());
+            params.put("city", user.getCity());
+            params.put("district", user.getArea());
+            params.put("street", user.getTown());
+            params.put("committee", user.getCommunity());
+        }
+
+        params.put("filterProvince", filter.get("province"));
+        params.put("filterCity", filter.get("city"));
+        params.put("filterDistrict", filter.get("district"));
+        params.put("filterStreet", filter.get("street"));
+        params.put("filterCommittee", filter.get("committee"));
+        params.put("safetysupervision", filter.get("safetysupervision"));
+        params.put("enterprisename", filter.get("enterprisename"));
+        List<StandardEducationLeger> list =  standardEducationLegerMapper.selectPages(page,params);
+        return page.setRecords(list);
+    }
+
+    @Override
+    public void addStandardEducationLeger(StandardEducationLeger standardEducationLeger, UserInfo userInfo) {
+        if (standardEducationLeger.getFile() == null) {
+            throw new BusinessException("需要上传文件");
+        }
+
+        UserInfo user = userService.getById(userInfo.getId());
+        standardEducationLeger.setCreateby(user.getId());
+        standardEducationLeger.setCreatebyname(user.getUsername());
+        standardEducationLeger.setCreatetime(new Date());
+        standardEducationLeger.setValidflag(true);
+        standardEducationLeger.setEnterprisenumber(user.getUsername());
+        standardEducationLeger.setEnterprisename(user.getUsername());
+
+        assert standardEducationLeger.getFile() != null;
+        try {
+            String name = UploadUtil.uploadFile(standardEducationLeger.getFile(), Properties.standardPath);
+            standardEducationLeger.setFilename(standardEducationLeger.getFile().getOriginalFilename());
+            standardEducationLeger.setUrl(Properties.standard + name);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new BusinessException("上传文件失败");
+        }
+        this.save(standardEducationLeger);
+    }
+
+
+
+    @Override
+    public void modStandardEducationLeger(StandardEducationLeger standardEducationLeger, UserInfo user) {
+        standardEducationLeger.setUpdateby(user.getId());
+        standardEducationLeger.setUpdatebyname(user.getUsername());
+        standardEducationLeger.setUpdatetime(new Date());
+
+        try {
+            if (standardEducationLeger.getFile() != null) {
+                String name = UploadUtil.uploadFile(standardEducationLeger.getFile(), Properties.standardPath);
+                standardEducationLeger.setFilename(standardEducationLeger.getFile().getOriginalFilename());
+                standardEducationLeger.setUrl(Properties.standard + name);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new BusinessException("上传文件失败");
+        }
+        this.updateById(standardEducationLeger);
+    }
+
+    @Override
+    public void delStandardEducationLeger(Long id, UserInfo user) {
+        LambdaUpdateWrapper<StandardEducationLeger> updateWrapper = new LambdaUpdateWrapper<>();
+        updateWrapper.set(StandardEducationLeger::getValidflag, false)
+                .set(StandardEducationLeger::getUpdatetime, new Date())
+                .set(StandardEducationLeger::getUpdateby, user.getId())
+                .set(StandardEducationLeger::getUpdatebyname,user.getUsername())
+                .eq(StandardEducationLeger::getId, id);
+        this.update(updateWrapper);
+    }
+}

--
Gitblit v1.9.2