智慧保安后台管理-外网
Administrator
2021-08-25 0b3f78d68b3d614cb6231c26a70e2aebcf98a2d4
通知公告,附近上传,实时位置,轨迹,装备,工作汇报数据推送修改
6 files modified
242 ■■■■■ changed files
src/main/java/org/springblade/modules/desk/controller/NoticeController.java 62 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/equipage/controller/EquipageController.java 56 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/location/controller/LiveLocationController.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/resource/controller/AttachController.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/workreport/controller/WorkReportController.java 55 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/desk/controller/NoticeController.java
@@ -29,6 +29,7 @@
import org.springblade.core.tenant.annotation.TenantDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.desk.entity.Notice;
import org.springblade.modules.desk.service.INoticeService;
import org.springblade.modules.desk.vo.NoticeVO;
@@ -38,6 +39,9 @@
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
@@ -94,13 +98,6 @@
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入notice")
    public R<IPage<NoticeVO>> page(@ApiIgnore NoticeVO notice, Query query) {
        //通过deptId获取组织机构信息
//        Dept dept = iDeptService.getById(notice.getDeptId());
//        if (dept.getDeptCategory() == 1) {
//            notice.setCategory(1);
//        } else {
//            notice.setCategory(2);
//        }
        IPage<NoticeVO> pages = noticeService.selectNoticePage(Condition.getPage(query), notice);
        return R.data(pages);
    }
@@ -131,8 +128,48 @@
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入notice")
    public R submit(@RequestBody Notice notice) throws Exception {
        return R.status(noticeService.saveOrUpdate(notice));
    public R submit(@RequestBody Notice notice){
        boolean status = false;
        if (null==notice.getId()) {
            //新增
            status = noticeService.save(notice);
            notice.setIsDeleted(0);
            //数据同步
            String s1 =
                "insert into blade_notice(id,title,category,release_time,content,create_user,create_dept,create_time,is_deleted,dept_id,cover_url,type) " +
                    "values(" + "'" + notice.getId() + "'" + "," +
                    "'" + notice.getTitle() + "'" + "," +
                    "'" + notice.getCategory() + "'" + "," +
                    "'" +  new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(notice.getReleaseTime()) + "'" + "," +
                    "'" + notice.getContent() + "'" + "," +
                    "'" + notice.getCreateUser() + "'" + "," +
                    "'" + notice.getCreateDept() + "'" + "," +
                    "'" + new SimpleDateFormat("yyyy-MM-dd").format(notice.getCreateTime()) + "'" + "," +
                    "'" + notice.getIsDeleted() + "'" + "," +
                    "'" + notice.getDeptId() + "'" + "," +
                    "'" + notice.getCoverUrl() + "'" + "," +
                    "'" +notice.getType() + "'" + ")";
            FtpUtil.sqlFileUpload(s1);
        }else {
            //修改
            status = noticeService.updateById(notice);
            //内网同步
            String s1 =
                "update blade_notice set title = " + "'" + notice.getTitle() + "'" +
                    ",category = " + "'" + notice.getCategory() + "'" +
                    ",release_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(notice.getReleaseTime()) + "'" +
                    ",content = " + "'" + notice.getContent() + "'" +
                    ",create_user = " + "'" + notice.getCreateUser() + "'" +
                    ",create_dept = " + "'" + notice.getCreateDept() + "'" +
                    ",create_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(notice.getCreateTime()) + "'" +
                    ",is_deleted = " + "'" + notice.getIsDeleted() + "'" +
                    ",dept_id = " + "'" + notice.getDeptId() + "'" +
                    ",cover_url = " + "'" + notice.getCoverUrl() + "'" +
                    ",type = " + "'" + notice.getType() + "'" +
                    " " +"where id = " + "'" + notice.getId() + "'";
            FtpUtil.sqlFileUpload(s1);
        }
        return R.status(status);
    }
    /**
@@ -142,6 +179,13 @@
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入notice")
    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) throws Exception {
        //内网删除
        List<Long> list = Func.toLongList(ids);
        list.forEach(id ->{
            //内网同步
            String s1 = "delete from blade_notice where id = " + "'" + id + "'";
            FtpUtil.sqlFileUpload(s1);
        });
        boolean temp = noticeService.deleteLogic(Func.toLongList(ids));
        return R.status(temp);
    }
src/main/java/org/springblade/modules/equipage/controller/EquipageController.java
@@ -10,6 +10,7 @@
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.equipage.entity.Equipage;
import org.springblade.modules.equipage.excel.EquipageExcel;
import org.springblade.modules.equipage.excel.EquipageImporter;
@@ -21,6 +22,7 @@
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -72,12 +74,46 @@
     * @param equipage 装备信息对象
     */
    @PostMapping("/submit")
    public R submit(@RequestBody Equipage equipage) throws Exception {
//        if (equipage.getId()==null){
//            arg arg = new arg();
//            arg.test01(arg.url+"/equipage/save",equipage);
//        }
        return R.status(equipageService.saveOrUpdate(equipage));
    public R submit(@RequestBody Equipage equipage){
        boolean status = false;
        if (equipage.getId()==null){
            //新增
            status = equipageService.save(equipage);
            //数据推送
            String s1 =
                "insert into sys_equipage(id,name,number,specifications,mode,dept_id,brand,date_for_production,jurisdiction,user_id,num) " +
                    "values(" + "'" + equipage.getId() + "'" + "," +
                    "'" + equipage.getName() + "'" + "," +
                    "'" + equipage.getNumber() + "'" + "," +
                    "'" + equipage.getSpecifications() + "'" + "," +
                    "'" + equipage.getMode() + "'" + "," +
                    "'" + equipage.getDeptId() + "'" + "," +
                    "'" + equipage.getBrand() + "'" + "," +
                    "'" + new SimpleDateFormat("yyyy-MM-dd").format(equipage.getDateForProduction()) + "'" + "," +
                    "'" + equipage.getJurisdiction() + "'" + "," +
                    "'" + equipage.getUserId() + "'" + "," +
                    "'" +equipage.getNum() + "'" + ")";
            FtpUtil.sqlFileUpload(s1);
        }else {
            //修改
            status = equipageService.updateById(equipage);
            //内网同步
            String s1 =
                "update sys_equipage set name = " + "'" + equipage.getName() + "'" +
                    ",number = " + "'" + equipage.getDeptId() + "'" +
                    ",specifications = " + "'" + equipage.getSpecifications() + "'" +
                    ",mode = " + "'" + equipage.getMode() + "'" +
                    ",dept_id = " + "'" + equipage.getDeptId() + "'" +
                    ",brand = " + "'" + equipage.getBrand() + "'" +
                    ",date_for_production = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(equipage.getDateForProduction()) + "'" +
                    ",jurisdiction = " + "'" + equipage.getJurisdiction() + "'" +
                    ",user_id = " + "'" + equipage.getUserId() + "'" +
                    ",num = " + "'" + equipage.getNum() + "'" +
                    " " +"where id = " + "'" + equipage.getId() + "'";
            FtpUtil.sqlFileUpload(s1);
        }
        return R.status(status);
    }
    /**
@@ -86,7 +122,13 @@
     */
    @PostMapping("/remove")
    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
        //arg.sendPostRemoveByIds(arg.url+"/equipage/remove",ids);
        //内网删除
        List<Long> list = Func.toLongList(ids);
        list.forEach(id ->{
            //内网同步
            String s1 = "delete from sys_equipage where id = " + "'" + id + "'";
            FtpUtil.sqlFileUpload(s1);
        });
        return R.status(equipageService.removeByIds(Func.toLongList(ids)));
    }
src/main/java/org/springblade/modules/location/controller/LiveLocationController.java
@@ -8,6 +8,7 @@
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.location.entity.LiveLocation;
import org.springblade.modules.location.entity.Locus;
import org.springblade.modules.location.service.LiveLocationService;
@@ -16,6 +17,7 @@
import org.springblade.modules.location.vo.LocusVo;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@@ -71,12 +73,34 @@
            //新增
            liveLocation.setRecordTime(new Date());
            status = liveLocationService.save(liveLocation);
            //数据推送
            String s1 =
                "insert into sys_live_location(id,type,worker_id,longitude,latitude,record_time,location) " +
                    "values(" + "'" + liveLocation.getId() + "'" + "," +
                    "'" + liveLocation.getType() + "'" + "," +
                    "'" + liveLocation.getWorkerId() + "'" + "," +
                    "'" + liveLocation.getLongitude() + "'" + "," +
                    "'" + liveLocation.getLatitude() + "'" + "," +
                    "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocation.getRecordTime()) + "'" + "," +
                    "'" +liveLocation.getLocation() + "'" + ")";
            FtpUtil.sqlFileUpload(s1);
        }else {
            //更新
            liveLocationInfo.setRecordTime(new Date());
            liveLocationInfo.setLongitude(liveLocation.getLongitude());
            liveLocationInfo.setLatitude(liveLocation.getLatitude());
            status = liveLocationService.updateById(liveLocationInfo);
            //内网同步
            String s1 =
                "update sys_live_location set type = " + "'" + liveLocation.getType() + "'" +
                    ",worker_id = " + "'" + liveLocation.getWorkerId() + "'" +
                    ",longitude = " + "'" + liveLocation.getLongitude() + "'" +
                    ",latitude = " + "'" + liveLocation.getLatitude() + "'" +
                    ",record_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocation.getRecordTime()) + "'" +
                    ",location = " + "'" + liveLocation.getLocation() + "'" +
                    " " +"where id = " + "'" + liveLocation.getId() + "'";
            FtpUtil.sqlFileUpload(s1);
        }
        if (status){
@@ -95,6 +119,16 @@
            locus.setRecordTime(new Date());
            //新增轨迹
            boolean save1 = locusService.save(locus);
            //数据推送
            String s2 =
                "insert into sys_locus(id,live_location_id,record_time,longitude,latitude) " +
                    "values(" + "'" + locus.getId() + "'" + "," +
                    "'" + locus.getLiveLocationId() + "'" + "," +
                    "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(locus.getRecordTime()) + "'" + "," +
                    "'" + locus.getLongitude() + "'" + "," +
                    "'" +locus.getLatitude() + "'" + ")";
            FtpUtil.sqlFileUpload(s2);
            if (save1){
                //返回数据
                return R.status(true);
src/main/java/org/springblade/modules/resource/controller/AttachController.java
@@ -30,12 +30,14 @@
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.resource.entity.Attach;
import org.springblade.modules.resource.service.IAttachService;
import org.springblade.modules.resource.vo.AttachVO;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
 * 附件表 控制器
@@ -125,6 +127,13 @@
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        //内网删除
        List<Long> list = Func.toLongList(ids);
        list.forEach(id ->{
            //内网同步
            String s1 = "delete from blade_attach where id = " + "'" + id + "'";
            FtpUtil.sqlFileUpload(s1);
        });
        return R.status(attachService.deleteLogic(Func.toLongList(ids)));
    }
src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java
@@ -42,6 +42,7 @@
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.utils.FileUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.resource.builder.oss.OssBuilder;
import org.springblade.modules.resource.entity.Attach;
import org.springblade.modules.resource.service.IAttachService;
@@ -52,6 +53,8 @@
import java.io.InputStream;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@@ -335,6 +338,29 @@
            attach.setNoticeId(noticeId);
        }
        attachService.save(attach);
        //数据同步
        String s1 =
            "insert into blade_attach(id,tenant_id,link,domain,name,original_name,extension,attach_size,create_user,create_dept," +
                "create_time,update_user,update_time,status,is_deleted,deptid,type,notice_id,cardid) " +
                "values(" + "'" + attach.getId() + "'" + "," +
                "'" + attach.getTenantId() + "'" + "," +
                "'" + attach.getLink() + "'" + "," +
                "'" + attach.getDomain() + "'" + "," +
                "'" + attach.getName() + "'" + "," +
                "'" + attach.getOriginalName() + "'" + "," +
                "'" + attach.getExtension() + "'" + "," +
                "'" + attach.getAttachSize() + "'" + "," +
                "'" + attach.getCreateUser() + "'" + "," +
                "'" + attach.getCreateDept() + "'" + "," +
                "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())  + "'" + "," +
                "'" + attach.getUpdateUser() + "'" + "," +
                "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())  + "'" + "," +
                "'" + attach.getStatus() + "'" + "," +
                "'" + attach.getIsDeleted() + "'" + "," +
                "'" + attach.getType() + "'" + "," +
                "'" + attach.getNoticeId() + "'" + "," +
                "'" +attach.getCardid() + "'" + ")";
        FtpUtil.sqlFileUpload(s1);
        return attach.getId();
    }
src/main/java/org/springblade/modules/workreport/controller/WorkReportController.java
@@ -9,6 +9,7 @@
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IDeptService;
@@ -19,6 +20,7 @@
import org.springframework.web.bind.annotation.*;
import java.sql.Wrapper;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
@@ -93,16 +95,49 @@
     * @param workReport 工作汇报信息对象
     */
    @PostMapping("/submit")
    public R submit(@RequestBody WorkReport workReport) throws Exception {
    public R submit(@RequestBody WorkReport workReport){
        boolean status = false;
        if (null!=workReport.getId()){
            workReport.setReplyTime(new Date());
            workReport.setReplyDeptIds(getReplyDeptIds(workReport.getReceivedIds()));
        }else {
            workReport.setReportTime(new Date());
            workReport.setReplyDeptIds(getReplyDeptIds(workReport.getReceivedIds()));
            //新增
            status = workReportService.save(workReport);
            //数据同步
            String s1 =
                "insert into sys_work_report(id,type,content,work_desc,report_time,received_ids,dept_id,reply_dept_ids,category,user_id) " +
                    "values(" + "'" + workReport.getId() + "'" + "," +
                    "'" + workReport.getType() + "'" + "," +
                    "'" + workReport.getContent() + "'" + "," +
                    "'" + workReport.getWorkDesc() + "'" + "," +
                    "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(workReport.getReportTime()) + "'" + "," +
                    "'" + workReport.getReceivedIds() + "'" + "," +
                    "'" + workReport.getDeptId() + "'" + "," +
                    "'" + workReport.getReplyDeptIds() + "'" + "," +
                    "'" + workReport.getCategory() + "'" + "," +
                    "'" +workReport.getUserId() + "'" + ")";
            FtpUtil.sqlFileUpload(s1);
        }else {
            workReport.setReplyDeptIds(getReplyDeptIds(workReport.getReceivedIds()));
            if (null!=workReport.getReplyTime()){
                workReport.setReplyTime(new Date());
            }
            //内网同步
            String s1 =
                "update sys_work_report set type = " + "'" + workReport.getType() + "'" +
                    ",content = " + "'" + workReport.getContent() + "'" +
                    ",work_desc = " + "'" + workReport.getWorkDesc() + "'" +
                    ",received_ids = " + "'" + workReport.getReceivedIds() + "'" +
                    ",reply_content = " + "'" + workReport.getReplyContent() + "'" +
                    ",reply_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(workReport.getReplyTime()) + "'" +
                    ",dept_id = " + "'" + workReport.getDeptId() + "'" +
                    ",reply_dept_ids = " + "'" + workReport.getReplyDeptIds() + "'" +
                    ",category = " + "'" + workReport.getCategory() + "'" +
                    ",user_id = " + "'" + workReport.getUserId() + "'" +
                    " " +"where id = " + "'" + workReport.getId() + "'";
            FtpUtil.sqlFileUpload(s1);
        }
        //arg.test01(arg.url+"/workReport/submit",workReport);
        return R.status(workReportService.saveOrUpdate(workReport));
        return R.status(status);
    }
    /**
@@ -111,7 +146,13 @@
     */
    @PostMapping("/remove")
    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
        //arg.sendPostRemoveByIds(arg.url+"/workReport/remove",ids);
        //内网删除
        List<Long> list = Func.toLongList(ids);
        list.forEach(id ->{
            //内网同步
            String s1 = "delete from sys_work_report where id = " + "'" + id + "'";
            FtpUtil.sqlFileUpload(s1);
        });
        return R.status(workReportService.removeByIds(Func.toLongList(ids)));
    }