yuansh před 1 dnem
rodič
revize
180469f135

+ 36 - 1
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActBusinessController.java

@@ -486,6 +486,30 @@ public class ActBusinessController {
             String msg_content1 = busiData.get("meeting_content").toString();
             String create_by = busiData.get("create_by").toString();
 
+            String company = busiData.get("company") == null || busiData.get("company") == "" ? "" : busiData.get("company").toString();
+            if("1".equals(company)){
+                company = "宁波森语";
+            }else if("2".equals(company)){
+                company = "马菲羊";
+            }else{
+                company = "无";
+            }
+            String meeting_host = busiData.get("meeting_host") == null || busiData.get("meeting_host") == "" ? "" : busiData.get("meeting_host").toString();
+            String meeting_date = busiData.get("meeting_date") == null || busiData.get("meeting_date") == "" ? "" : busiData.get("meeting_date").toString();
+            String meeting_location = busiData.get("meeting_location") == null || busiData.get("meeting_location") == "" ? "" : busiData.get("meeting_location").toString();
+            String meeting_note_taker = busiData.get("meeting_note_taker") == null || busiData.get("meeting_note_taker") == "" ? "" : busiData.get("meeting_note_taker").toString();
+            String meeting_personnel = busiData.get("meeting_personnel") == null || busiData.get("meeting_personnel") == "" ? "" : busiData.get("meeting_personnel").toString();
+
+            // 移除首尾的方括号
+            String cleaned = meeting_personnel.substring(1, meeting_personnel.length() - 1);
+
+            // 按逗号分割并移除每个元素的双引号
+            String[] array = cleaned.split(",");
+            for (int i = 0; i < array.length; i++) {
+                array[i] = array[i].replace("\"", "").trim();
+            }
+
+            List<String> result = sysBaseAPI.queryTableDictByKeys("sys_user","realname","username",array);
             String msg_content12 = msg_content1.replace("\n","<br>");
 
             String dmf = msg_user1.replace("[","");
@@ -501,13 +525,24 @@ public class ActBusinessController {
             System.out.println("线程为"+t.getName());//线程名:main 这是系统自己为主线程定义的名
 
             //创建一个线程并初始化
+            String finalCompanyName = company;
             Thread thread=new Thread(){
                 //具体的业务代码
                 @Override
                 public  void run(){
                     //发送消息
                     for (String o:userList){
-                        sysBaseAPI.sendSysAnnouncement(loginUser,create_by,o,"会议纪要","<h2>会议主题:"+msg_title1+"</h2><br> <h3>会议内容:<br>"+msg_content12+"</h3>", CommonConstant.MSG_CATEGORY_2,taskParam);
+                        sysBaseAPI.sendSysAnnouncement(loginUser,create_by,o,"会议纪要",
+                                "<h2>会议主题:"+msg_title1+"</h2>" +
+                                        "<br> <h3>所属公司:"+ finalCompanyName +"</h3>"+
+                                        "<br> <h3>会议主持:"+ meeting_host +"</h3>"+
+                                        "<br> <h3>会议日期/时间:"+ meeting_date +"</h3>"+
+                                        "<br> <h3>会议地点:"+ meeting_location +"</h3>"+
+                                        "<br> <h3>会议记录人:"+ meeting_note_taker +"</h3>"+
+                                        "<br> <h3>会议参与人员:<br>"+ result +"</h3>"+
+                                        "<br> <h3>会议内容:<br>"+ msg_content12 +"</h3>",
+
+                        CommonConstant.MSG_CATEGORY_2,taskParam);
                     }
 
                     actBusiness.setStatus(2);

+ 4 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/oa/controller/IncidentTicketController.java

@@ -513,6 +513,7 @@ public class IncidentTicketController {
 
 			incidentTicket.setState("4");
 			incidentTicket.setPushFlag("1");
+			incidentTicket.setMsgTime(new Date());
 			incidentTicketService.updateById(incidentTicket);
 			return Result.ok("执行成功(该单据无需推送U8,请直接执行下一步操作)");
 		}
@@ -602,6 +603,7 @@ public class IncidentTicketController {
 			}
 			if(fnl){
 				incidentTicket.setState("4");
+				incidentTicket.setMsgTime(new Date());
 				incidentTicketService.updateById(incidentTicket);
 			}
 			return Result.ok("同步成功");
@@ -633,6 +635,7 @@ public class IncidentTicketController {
 		if(incidentTicket.getState().equals("3") || incidentTicket.getState().equals("4")){//1未处理 2已通知 3通知已反馈 4已推送 5已完结(提交) 6已完结
 			incidentTicket.setState("5");
 			incidentTicket.setStateText("已提交");
+			incidentTicket.setMsgTime(new Date());
 //			LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 //			incidentTicket.setUpdateBy(sysUser.getUsername());
 //			incidentTicket.setUpdateTime(new Date());
@@ -669,6 +672,7 @@ public class IncidentTicketController {
 		if(incidentTicket.getState().equals("5")){//1未处理 2已通知 3通知已反馈 4已推送 5已完结(提交) 6已完结(完结)
 			incidentTicket.setState("6");
 			incidentTicket.setStateText("已完结");
+			incidentTicket.setMsgTime(new Date());
 //			LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 //			incidentTicket.setUpdateBy(sysUser.getUsername());
 //			incidentTicket.setUpdateTime(new Date());

+ 8 - 2
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/oa/entity/IncidentTicket.java

@@ -57,6 +57,12 @@ public class IncidentTicket implements Serializable {
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "更新日期")
     private Date updateTime;
+
+	/**提醒时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "提醒时间")
+    private Date msgTime;
 	/**所属部门*/
 	@Excel(name = "所属部门", width = 15)
     @ApiModelProperty(value = "所属部门")
@@ -232,8 +238,8 @@ public class IncidentTicket implements Serializable {
     @ApiModelProperty(value = "子表控件")
     private String tableNameChildren;
 	/**1未处理 2已通知 3通知已反馈 4已推送 5已完结(提交) 6已完结*/
-	@Excel(name = "1未处理 2已通知 3通知已反馈 4已推送 5已完结", width = 15)
-    @ApiModelProperty(value = "1未处理 2已通知 3通知已反馈 4已推送 5已完结")
+	@Excel(name = "1未处理 2已通知 3通知已反馈 4已推送 5已提交 6已完结", width = 15)
+    @ApiModelProperty(value = "1未处理 2已通知 3通知已反馈 4已推送 5已提交 6已完结")
     private String state;
 	//未处理、已完结
     private String stateText;

+ 10 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/oa/mapper/IncidentTicketMapper.java

@@ -35,4 +35,14 @@ public interface IncidentTicketMapper extends BaseMapper<IncidentTicket> {
      * @return
      */
     Map<String,Object> getVendor(String name);
+
+    /**
+     * 消息通知 使用sql
+     * @return
+     */
+    List<Map<String,Object>> selectConfigList();
+    List<String> selectTicketList(@Param("frequency")int frequency,@Param("stateText")String stateText,@Param("minute")int minute);
+    int setMsgLog(@Param("order_status")String order_status,@Param("user_id")String user_id,@Param("user_name")String user_name,
+                  @Param("minute")int minute,@Param("frequency")int frequency,@Param("demo")String demo);
+    int updateIncidentInfo(@Param("id") List<String> id);
 }

+ 44 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/oa/mapper/xml/IncidentTicketMapper.xml

@@ -2,6 +2,50 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.jeecg.modules.oa.mapper.IncidentTicketMapper">
 
+    <select id="selectTicketList" resultType="String">
+        select a.accident_number from incident_ticket a
+        left join act_z_business b on a.id = b.table_id and b.table_name='incident_ticket'
+
+        where b.result = 2 and a.frequency &lt; ${frequency} and a.state_text = #{stateText}
+        and TIMESTAMPDIFF(MINUTE,IFNULL(a.msg_time,DATE_ADD(b.update_time, INTERVAL 8 HOUR)), NOW()) > ${minute}
+
+    </select>
+
+    <select id="selectConfigList" resultType="Map">
+        select * from incident_ticket_config where status ='启用'
+    </select>
+
+    <insert id="setMsgLog">
+
+           insert into incident_ticket_config_msg(
+               order_status,
+               user_id,
+               user_name,
+               minute,
+               frequency,
+               demo,
+               msg_time
+           )
+           VALUES(
+                 #{order_status},
+                 #{user_id},
+                 #{user_name},
+                 #{minute},
+                 #{frequency},
+                 #{demo},
+                  now()
+          )
+
+    </insert>
+
+    <update id="updateIncidentInfo">
+        update incident_ticket set frequency = frequency+1 ,msg_time = now() where accident_number in
+        <foreach item="key" collection="id" open="(" separator="," close=")">
+            #{key}
+        </foreach>
+    </update>
+
+
     <update id="updateVoucherHistoryCNumber" >
         update VoucherHistory set cNumber=#{cNumber} where CardNumber=#{cardNumber}
     </update>

+ 8 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/oa/service/IIncidentTicketService.java

@@ -1,9 +1,12 @@
 package org.jeecg.modules.oa.service;
 
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.oa.entity.IncidentTicketChildren;
 import org.jeecg.modules.oa.entity.IncidentTicket;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.springframework.transaction.annotation.Transactional;
+
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.List;
@@ -46,4 +49,9 @@ public interface IIncidentTicketService extends IService<IncidentTicket> {
 	public Map<String,Object> propellingOne(IncidentTicket incidentTicket, IncidentTicketChildren children);
 	public Map<String,Object> propellingTwo(IncidentTicket incidentTicket, IncidentTicketChildren children);
 	public Map<String,Object> propellingThree(IncidentTicket incidentTicket, IncidentTicketChildren children);
+
+	public List<Map<String,Object>> selectConfigList();
+	public List<String> selectTicketList(int frequency,String stateText,int minute);
+	public int setMsgLog(String order_status,String user_id,String user_name, int minute,int frequency,String demo);
+	public int updateIncidentInfo(List<String> id);
 }

+ 25 - 1
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/oa/service/impl/IncidentTicketServiceImpl.java

@@ -3,6 +3,7 @@ package org.jeecg.modules.oa.service.impl;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.apache.commons.lang.StringUtils;
+import org.apache.ibatis.annotations.Param;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CommonConstant;
@@ -768,6 +769,7 @@ public class IncidentTicketServiceImpl extends ServiceImpl<IncidentTicketMapper,
 		incidentTicketEntity.setState("2");//1未处理 2已通知 3通知已反馈 4已推送 5已完结
 		incidentTicketEntity.setUpdateBy(sysUser.getUsername());
 		incidentTicketEntity.setUpdateTime(new Date());
+		incidentTicketEntity.setMsgTime(new Date());
 		incidentTicketMapper.updateById(incidentTicketEntity);
 //		this.save(incidentTicketEntity);
 		return Result.ok("已通知");
@@ -839,6 +841,7 @@ public class IncidentTicketServiceImpl extends ServiceImpl<IncidentTicketMapper,
 			incidentTicketEntity.setState("3");//1未处理 2已通知 3通知已反馈 4已推送 5已完结
 			incidentTicketEntity.setUpdateBy(sysUser.getUsername());
 			incidentTicketEntity.setUpdateTime(new Date());
+			incidentTicketEntity.setMsgTime(new Date());
 			incidentTicketMapper.updateById(incidentTicketEntity);
 //			this.save(incidentTicketEntity);
 //		}
@@ -918,5 +921,26 @@ public class IncidentTicketServiceImpl extends ServiceImpl<IncidentTicketMapper,
 			incidentTicketMapper.deleteById(id);
 		}
 	}
-	
+
+	@Override
+	public List<Map<String,Object>> selectConfigList() {
+		return incidentTicketMapper.selectConfigList();
+	}
+	@Override
+	public List<String> selectTicketList(int frequency,String stateText,int minute){
+		return incidentTicketMapper.selectTicketList(frequency,stateText,minute);
+	}
+	@Override
+	@Transactional
+	public int setMsgLog(String order_status,String user_id,String user_name,
+						int minute,int frequency,String demo) {
+		return incidentTicketMapper.setMsgLog(order_status,user_id,user_name,
+		minute,frequency,demo);
+	}
+
+	@Override
+	@Transactional
+	public int updateIncidentInfo(@Param("id") List<String> id) {
+		return incidentTicketMapper.updateIncidentInfo(id);
+	}
 }

+ 109 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/quartz/job/IncidentTicketJob.java

@@ -0,0 +1,109 @@
+package org.jeecg.modules.quartz.job;
+
+import io.micrometer.core.instrument.util.StringUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.constant.CommonConstant;
+import org.jeecg.common.system.api.ISysBaseAPI;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.oa.entity.CdSchedule;
+import org.jeecg.modules.oa.mapper.CdScheduleMapper;
+import org.jeecg.modules.oa.service.IIncidentTicketService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.text.SimpleDateFormat;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 日程计划提醒
+ */
+@Slf4j
+public class IncidentTicketJob implements Job {
+
+    @Autowired
+    private IIncidentTicketService incidentTicketService;
+    @Autowired
+    private ISysBaseAPI sysBaseAPI;
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+		try {
+
+		    //获取质量配置表
+            //遍历配置表
+                //查询 包含配置内数据 质量事故单:状态,发送次数<配置次数,上次发送时间(初始时间)与 当前时间 相差分钟数 > 配置分钟
+                //根据配置人员 发送消息
+                //更新发送时间,更新发送次数
+            //结束
+
+            List<Map<String,Object>> mapList = incidentTicketService.selectConfigList();
+            if(mapList.size() == 0){
+                return;
+            }
+            LoginUser loginUser = sysBaseAPI.getUserByName("admin");
+
+            for(Map<String,Object> m:mapList){
+
+                if(m.get("order_status")==null||m.get("order_status")=="" ||
+                m.get("user_id")==null||m.get("user_id")=="" ||
+                m.get("minute")==null||m.get("minute")=="" ||
+                m.get("frequency")==null||m.get("frequency")==""){
+                    continue;
+                }
+
+                String order_status = m.get("order_status").toString();//订单状态 //1未处理 2已通知 3通知已反馈 4已推送 5已提交 6已完结
+                if(order_status.equals("未处理")){
+                    order_status = "1";
+                }else if(order_status.equals("已通知")){
+                    order_status = "2";
+                }else if(order_status.equals("通知已反馈")){
+                    order_status = "3";
+                }else if(order_status.equals("已推送")){
+                    order_status = "4";
+                }else if(order_status.equals("已提交")){
+                    order_status = "5";
+                }else if(order_status.equals("已完结")){
+                    order_status = "6";
+                }else{
+                    continue;
+                }
+
+                String user_id = m.get("user_id").toString();//用户
+                int minute = (int) m.get("minute");//提醒时间(分钟)
+                int frequency = (int) m.get("frequency");//提醒次数
+
+                List<String> ticketList = incidentTicketService.selectTicketList(frequency,order_status,minute);
+
+                if(ticketList.size() == 0){
+                    continue;
+                }
+
+                String result = String.join(",", ticketList);
+
+                for(String userId:user_id.split(",")){
+
+                    String msgContent = "<h3>您有"+ticketList.size()+"条("+order_status+")的事故单需要处理,请查看</h3><br> <h4><br>"+result+"</h4>";
+
+                    sysBaseAPI.sendSysAnnouncement(loginUser,"admin",userId,"事故处理单提醒",
+                            msgContent,
+                            CommonConstant.MSG_CATEGORY_2,new HashMap<>());
+
+                    incidentTicketService.setMsgLog(order_status,userId,null,minute,frequency,msgContent);
+
+                }
+
+                incidentTicketService.updateIncidentInfo(ticketList);
+            }
+
+
+		}catch (Exception e){
+			System.out.println("消息发送失败:"+e.getMessage());
+		}
+
+    }
+
+}

+ 18 - 3
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/salary/controller/SalaryAttendanceController.java

@@ -4,6 +4,7 @@ import java.io.UnsupportedEncodingException;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.net.URLDecoder;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -106,10 +107,14 @@ public class SalaryAttendanceController {
         if (org.apache.commons.lang.StringUtils.isEmpty(salaryManagement.getType())) {
             return Result.error("参数异常:类型为空!!");
         }
-        salaryManagement.setYearWithMonth(DateUtils.date_ym());
+
+        if(StringUtils.isEmpty(salaryManagement.getYearWithMonth())){
+
+            salaryManagement.setYearWithMonth(DateUtils.date_ym());
+        }
 //        salaryManagement.setYearWithMonth("2024-12");
 
-        if (org.apache.commons.lang.StringUtils.isEmpty(salaryManagement.getId()) || "false".equals(salaryManagement.getId())) {
+        if (StringUtils.isEmpty(salaryManagement.getId()) || "false".equals(salaryManagement.getId())) {
 
             QueryWrapper<SalaryManagement> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("del_flag", "0");
@@ -134,12 +139,22 @@ public class SalaryAttendanceController {
                 return Result.error("系统中" + salaryManagement.getYearWithMonth() + salaryManagement.getType() + "已计算(" + list1.get(0).getCalculateDate() + "),无法覆盖!");
             }
 
+            QueryWrapper<SalaryManagement> queryWrapper3 = new QueryWrapper<>();
+            queryWrapper3.eq("del_flag", "0");
+            queryWrapper3.eq("year_with_month", salaryManagement.getYearWithMonth());
+            queryWrapper3.eq("type", "月度工资单");
+            List<SalaryManagement> list3 = salaryManagementService.list(queryWrapper3);
+            if (list3.size() > 0) {
+                return Result.error("本月月度工资单以生成,无法再导入本月福利现金!!");
+            }
+
             //如果当年12月份工资已计算,则当年12月福利现金不能导入
             if(DateUtils.formatDate("MM").equals("12")){
 
                 QueryWrapper<SalaryManagement> queryWrapper2 = new QueryWrapper<>();
                 queryWrapper2.eq("del_flag", "0");
-                queryWrapper2.eq("year_with_month", salaryManagement.getYearWithMonth());
+//                queryWrapper2.eq("year_with_month", salaryManagement.getYearWithMonth());
+                queryWrapper2.eq("year_with_month",DateUtils.formatDate("YYYY-MM") );
                 queryWrapper2.eq("type", "月度工资单");
                 List<SalaryManagement> list = salaryManagementService.list(queryWrapper2);
                 if (list.size() > 0) {