Browse Source

修改任务bug, 针对破冰公司的个性化字段显示

seyason 3 years ago
parent
commit
205e6ff030

+ 18 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskController.java

@@ -78,6 +78,8 @@ public class TaskController {
     private TaskExecutorMapper taskExecutorMapper;
     @Resource
     private TaskExecutorService taskExecutorService;
+    @Resource
+    private CompanyDingdingService companyDingdingService;
 
     @RequestMapping("/save")
     @Transactional
@@ -200,6 +202,22 @@ public class TaskController {
             msgRecepientList.forEach(msgRecepient->{
                 informationService.save(new Information().setType(1).setContent(String.valueOf(task.getProjectId())).setUserId(msgRecepient));
             });
+            List<User> recpUserList = userMapper.selectList(new QueryWrapper<User>().in("id", msgRecepientList));
+            if (recpUserList.get(0).getDingdingUserid() != null) {
+                //钉钉用户
+                CompanyDingding dingding = companyDingdingService.getOne(new QueryWrapper<CompanyDingding>().eq("company_id", user.getCompanyId()));
+                LocalDate endDate = task.getEndDate();
+                String endStr = "";
+                if (endDate != null) {
+                    endStr = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(endDate);
+                }
+                companyDingdingService.sendNewTaskMsg(dingding, recpUserList.stream().map(User::getDingdingUserid).collect(Collectors.joining(",")),
+                        task.getName(), endStr);
+            } else if (recpUserList.get(0).getCorpwxUserid() != null) {
+                //企业微信用户
+
+            }
+
         }
         return msg;
     }

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/CompanyDingdingService.java

@@ -23,4 +23,6 @@ public interface CompanyDingdingService extends IService<CompanyDingding> {
     public void sendReportWaitingApplyMsg(Integer companyId, Long agentId, Long auditNum, String useridList);
 
     public void sendBusinessTripSettingMsg(Integer companyId, Long agentId, String useridList);
+
+    public void sendNewTaskMsg(CompanyDingding dingding, String userId, String title, String endDate);
 }

+ 30 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/CompanyDingdingServiceImpl.java

@@ -47,6 +47,8 @@ public class CompanyDingdingServiceImpl extends ServiceImpl<CompanyDingdingMappe
     public static final String TEMPLATE_REPORT_WAITING_APPLY = "d871e80191d14ec8aeec3986aca3ce46";
     //出差待关联
     public static final String TEMPLATE_BUSTRIP_SETTING = "68cc6f3a150f4d869449e83a2f249b65";
+    //新任务
+    public static final String TEMPLATE_NEW_TASK = "b09b32a0431a47bdb791ba286e6d82ba";
 
 
 
@@ -168,6 +170,34 @@ public class CompanyDingdingServiceImpl extends ServiceImpl<CompanyDingdingMappe
         System.out.println(rsp.getBody());
     }
 
+    @Override
+    public void sendNewTaskMsg(CompanyDingding dingding, String ddUserid, String title, String endDate) {
+        //异步发送
+        new Thread(){
+            public void run() {
+                DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
+                OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
+                req.setAgentId(dingding.getAgentId());
+                req.setUseridList(ddUserid);
+                req.setTemplateId(TEMPLATE_NEW_TASK);
+                JSONObject json = new JSONObject();
+                json.put("name", ""+title);
+                json.put("endDate", ""+endDate);
+                req.setData(json.toJSONString());
+
+                OapiMessageCorpconversationSendbytemplateResponse rsp = null;
+                try {
+                    rsp = client.execute(req, getCorpAccessToken(dingding));
+                } catch (ApiException e) {
+                    e.printStackTrace();
+                } catch (Exception exception) {
+                    exception.printStackTrace();
+                }
+                System.out.println(rsp.getBody());
+            }
+        }.start();
+    }
+
     private String getDDSuiteAccessToken() throws ApiException {
         if (DingDingServiceImpl.SUITE_ACCESS_TOKEN == null || DingDingServiceImpl.suiteTokenExpireTime < System.currentTimeMillis()) {
             DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/service/get_suite_token");

+ 2 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -199,8 +199,8 @@ public class TimingTask {
         }
     }
 
-    //每个月6号早上6点同步上个月的企业微信考勤考勤打卡记录
-    @Scheduled(cron = "0 0 6 6 * ?")
+    //每个月2号早上6点同步上个月的企业微信考勤考勤打卡记录
+    @Scheduled(cron = "0 0 6 2 * ?")
     private void synMonthCorpWXCardTime() {
         if (isDev) return;
         LocalDateTime lastMonth = LocalDateTime.now().minusMonths(1);

+ 1 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/resources/application.yml

@@ -14,10 +14,9 @@ spring:
       location: C:/upload/
   datasource:
     driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://47.101.180.183:3306/man_hour_manager?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
+    url: jdbc:mysql://47.101.180.183:3306/man_dev?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
     username: root
     password: HuoshiDB@2022
-
     hikari:
       maximum-pool-size: 10
       minimum-idle: 3

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/quanx/quanx.vue

@@ -286,7 +286,7 @@ export default {
         return data.label.indexOf(value) !== -1;
       },
         handleAdd(tex, tel, id) {
-          if(id.rolename == '超级管理员'){
+          if(id && id.rolename == '超级管理员'){
             this.$message('超级管理员为固定的默认角色无法编辑');
             return
           }

+ 8 - 8
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -230,7 +230,7 @@
 
         <!-- 填写日报的dialog -->
         <el-dialog :title="isBatch==0?'填写日报':'批量填报'" :visible.sync="dialogVisible" width="60%" :close-on-click-modal="false" @closed="guanbi()">
-            <el-form ref="workForm" :model="workForm" :rules="workRules" label-width="100px">
+            <el-form ref="workForm" :model="workForm" :rules="workRules" label-width="120px">
                 <el-form-item label="选择人员" v-if="isSubstitude">
                     <el-input @focus="showChooseMembTree" v-model="workForm.userNames"
                     placeholder="请选择代填人员" ></el-input>
@@ -312,9 +312,9 @@
                         </div>
                     </el-form-item>
                     
-                    <el-form-item label="投入项目" :prop="'domains.' + index + '.projectId'"
-                        :rules="{ required: true, message: '请选择投入项目', trigger: ['change','blur'] }">
-                        <el-select v-model="domain.projectId" placeholder="请选择项目" style="width:200px;" clearable="true"  filterable="true"
+                    <el-form-item :label="user.companyId==781?'工作任务':'投入项目'" :prop="'domains.' + index + '.projectId'"
+                        :rules="{ required: true, message: user.companyId==781?'请选择工作任务':'请选择投入项目', trigger: ['change','blur'] }">
+                        <el-select v-model="domain.projectId" :placeholder="user.companyId==781?'请选择工作任务':'请选择项目'" style="width:200px;" clearable="true"  filterable="true"
                         @change="selectProject(domain, index)"
                         :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
                             <el-option v-for="item in projectList" :disabled="item.status>=2" :key="item.id" :label="item.projectName" :value="item.id"></el-option>
@@ -336,7 +336,7 @@
                         <el-link type="primary" v-if="workForm.domains[index].state == 0 || workForm.domains[index].state == 2"
                             :underline="false" style="margin-left:10px;" @click="copyProject(index)">复制</el-link>
                     </el-form-item>
-                    <el-form-item label="项目描述" v-if="user.company.packageProject==0&&domain.projectId&&projectList.filter(p=>p.id == domain.projectId)[0].projectDesc">
+                    <el-form-item :label="user.companyId==781?'描述':'项目描述'" v-if="user.company.packageProject==0&&domain.projectId&&projectList.filter(p=>p.id == domain.projectId)[0].projectDesc">
                         <span>{{projectList.filter(p=>p.id == domain.projectId)[0].projectDesc}}</span>
                     </el-form-item>
 
@@ -356,7 +356,7 @@
                             <el-option v-for="item in domain.stages" :key="item.id" :label="item.stagesName" :value="item.stagesName"></el-option>
                         </el-select>
                     </el-form-item>
-                    <el-form-item label="项目审核人">
+                    <el-form-item :label="user.companyId==781?'审核人':'项目审核人'">
                         <el-select v-model="domain.projectAuditorId" :disabled="!canEdit" @change="$forceUpdate()">
                             <el-option v-for="item in domain.auditUserList" :label="item.auditorName" :value="item.auditorId" :key="item.id"></el-option>
                         </el-select>
@@ -399,8 +399,8 @@
                             <el-option v-for="item in domain.taskList" :key="item.taskId" :label="item.taskName" :value="item.taskId"></el-option>
                         </el-select>
                     </el-form-item>
-                    <el-form-item label="工作事项" :prop="'domains.' + index + '.content'" >
-                        <el-input v-model="domain.content" type="textarea" :rows="4" placeholder="请填写工作事项" clearable
+                    <el-form-item :label="user.companyId==781?'具体内容与结果':'工作事项'" :prop="'domains.' + index + '.content'" >
+                        <el-input v-model="domain.content" type="textarea" :rows="4" placeholder="请填写" clearable
                          :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"></el-input>
                     </el-form-item>
                     </div>

+ 7 - 7
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

@@ -24,14 +24,14 @@
                 
                 <van-tag v-if="index>0&&canEdit" color="#fff" 
                 @click="delPro(index)" style="border: 1px solid #ff0000;padding:5px;margin-left:10px;"
-                 icon="plus" type="default" ><span style="color:#666;padding: 0 5px;">删除项目</span></van-tag>
+                 icon="plus" type="default" ><span style="color:#666;padding: 0 5px;">删除</span></van-tag>
                 </div>
                 <!-- <van-icon v-if="index>0&&canEdit" class="form_del" name="delete" @click="delPro(index)" /> -->
 
-                <van-cell-group :title="'项目' + (index+1)">
+                <van-cell-group :title="(user.companyId==781?'任务':'项目') + (index+1)">
                     <!-- <div>请选择投入项目</div> -->
-                    <van-field  readonly  name="projectId" clickable :value="item.projectName" label="投入项目" placeholder="请选择投入项目" @click="clickPicker(index, item)"
-                    :rules="[{ required: true, message: '请选择项目' }]" />
+                    <van-field  readonly  name="projectId" clickable :value="item.projectName" :label="user.companyId==781?'工作任务':'投入项目'" :placeholder="user.companyId==781?'请选择工作任务':'请选择项目'" @click="clickPicker(index, item)"
+                    :rules="[{ required: true, message: user.companyId==781?'请选择任务':'请选择项目' }]" />
 
                    
 
@@ -61,7 +61,7 @@
                     </van-popup>
                     <!-- 审核人 -->
                     <van-field  readonly  name="projectAuditorId" v-if="item.auditUserList != null && item.auditUserList.length > 0" clickable
-                        :value="item.projectAuditorName" label="项目审核人" placeholder="请选择审核人" 
+                        :value="item.projectAuditorName" :label="user.companyId==781?'审核人':'项目审核人'" placeholder="请选择审核人" 
                     @click="clickPickAuditor(index, item)" />
                     <van-popup v-model="item.showPickerAuditor" position="bottom">
                         <van-picker show-toolbar :columns="item.auditUserList" value-key="auditorName" @confirm="choseAuditor" 
@@ -165,7 +165,7 @@
                         </template>
                     </van-cell>
                     <van-field class="form_input" :disabled = "!canEdit"
-                    v-model="item.content" name="content" type="textarea" label="工作事项" placeholder="请输入工作事项" 
+                    v-model="item.content" name="content" type="textarea" :label="user.companyId==781?'具体内容与结果':'工作事项'" placeholder="请输入" 
                     rows="3" autosize  />
                     </div>
                     
@@ -263,7 +263,7 @@
             <div style="text-align:center;" >
             <van-tag v-if="canEdit" size="large" style="text-align:center;margin:10px;padding:12px;margin-bottom:120px;border: 1px solid #20a0ff;"
                 :disabled="!canEdit" @click="addNewPro" 
-                icon="plus" color="#ffffff" ><span style="color:#999;text-align:center;padding: 0 50px;"> + 新增项目  </span></van-tag>
+                icon="plus" color="#ffffff" ><span style="color:#999;text-align:center;padding: 0 50px;"> + 新增{{user.companyId==781?'任务':'项目'}}  </span></van-tag>
             </div>  
             <div class="form_btn" style="position:fixed; bottom:0px;width:100%;">
                 <div style="padding-bottom:10px;">