zhongrj
2024-01-12 ed28663eebdcc20325474e70be42e10e91fad930
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.task.service.impl;
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.springblade.common.constant.DictConstant;
import org.springblade.common.utils.SpringUtils;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.category.entity.CategoryEntity;
import org.springblade.modules.category.service.ICategoryService;
import org.springblade.modules.grid.entity.GridWorkLogEntity;
import org.springblade.modules.grid.service.IGridWorkLogService;
import org.springblade.modules.house.service.IHouseRentalService;
import org.springblade.modules.house.service.IHouseholdService;
import org.springblade.modules.house.vo.HouseRentalTenantVO;
import org.springblade.modules.house.vo.HouseholdVO;
import org.springblade.modules.place.service.IPlaceExtService;
import org.springblade.modules.place.service.IPlaceService;
import org.springblade.modules.place.vo.PlaceVO;
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.task.entity.*;
import org.springblade.modules.task.mapper.TaskMapper;
import org.springblade.modules.task.service.*;
import org.springblade.modules.task.vo.TaskVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.*;
import java.util.stream.Collectors;
 
/**
 * 任务表 服务实现类
 *
 * @author BladeX
 * @since 2023-11-06
 */
@Service
public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> implements ITaskService {
 
     @Autowired
     private IPlaceService placeService;
 
    @Autowired
    private IHouseholdService iHouseholdService;
 
    @Autowired
    private IHouseRentalService iHouseRentalService;
 
    @Autowired
    private IDeptService deptService;
 
    @Autowired
    private ICategoryService categoryService;
 
    @Autowired
    private ITaskCampusReportingEventService taskCampusReportingEventService;
 
    @Autowired
    private ITaskLabelReportingEventService taskLabelReportingEventService;
 
    @Autowired
    private ITaskHotelReportingService taskHotelReportingService;
 
    @Autowired
    private IGridWorkLogService gridWorkLogService;
 
    @Override
    public IPage<TaskVO> selectTaskPage(IPage<TaskVO> page, TaskVO task) {
        Dept dept = deptService.getById(AuthUtil.getDeptId());
        if (null != dept) {
            task.setCommunityCode(dept.getRegionCode());
        }
        // 民警角色
        if (AuthUtil.getUserRole().equals("mj")) {
            task.setUserId(AuthUtil.getUserId());
            return page.setRecords(baseMapper.selectTaskPageBy(page, task));
        } else {
            if (AuthUtil.getUserAccount().equals("18879306957")) {
                task.setCommunityCode("361102003027");
                task.setUserId(null);
            }
            if (AuthUtil.getUserRole().equals("wgy")) {
                task.setUserId(AuthUtil.getUserId());
            }
            // 非民警角色
            List<TaskVO> taskVOS = baseMapper.selectTaskPage(page, task);
            return page.setRecords(taskVOS);
        }
    }
 
    @Override
    public IPage<TaskVO> getBailReportingPage(IPage<TaskVO> page, TaskVO task) {
        Dept dept = deptService.getById(AuthUtil.getDeptId());
        if (null != dept) {
            task.setCommunityCode(dept.getRegionCode());
        }
        // 民警角色
        if (AuthUtil.getUserRole().equals("mj")) {
            task.setUserId(AuthUtil.getUserId());
            return page.setRecords(baseMapper.selectTaskPageBy(page, task));
        } else {
            if (AuthUtil.getUserAccount().equals("18879306957")) {
                task.setCommunityCode("361102003027");
                task.setUserId(null);
            }
            if (AuthUtil.getUserRole().equals("wgy")) {
                task.setUserId(AuthUtil.getUserId());
            }
            // 非民警角色
            List<TaskVO> taskVOS = baseMapper.getBailReportingPage(page, task);
            return page.setRecords(taskVOS);
        }
    }
 
    /**
     * 新增任务
     *
     * @param type
     * @param name
     * @param frequency
     * @param remark
     * @param createUser
     * @return
     */
    @Override
    public Long saveTask(Integer type, String name, Integer frequency, String remark, Long createUser, String houseCode, Integer reportType) {
        TaskEntity taskEntity = new TaskEntity();
        taskEntity.setType(type);
        taskEntity.setName(name);
        taskEntity.setFrequency(frequency);
        taskEntity.setRemark(remark);
        taskEntity.setCreateTime(new Date());
        taskEntity.setCreateUser(createUser);
        taskEntity.setHouseCode(houseCode);
        taskEntity.setReportType(reportType);
        return baseMapper.insert(taskEntity) > 0 ? taskEntity.getId() : 0;
    }
 
    @Override
    public Long updateTask(Integer type, String name, Integer frequency, String remark, Long updateUser, Long id, Integer status) {
        TaskEntity taskEntity = new TaskEntity();
        taskEntity.setId(id);
        taskEntity.setType(type);
        taskEntity.setName(name);
        taskEntity.setFrequency(frequency);
        taskEntity.setRemark(remark);
        taskEntity.setUpdateTime(new Date());
        taskEntity.setUpdateUser(updateUser);
        taskEntity.setStatus(status);
        return baseMapper.updateById(taskEntity) > 0 ? 1L : 0;
    }
 
 
    @Override
    public Object countNumber(String houseCode, Integer status) {
        Map<String, Object> objectObjectHashMap = new HashMap<>();
        // 总数
        LambdaQueryWrapper<TaskEntity> objectQueryWrapper = new LambdaQueryWrapper<>();
        objectQueryWrapper.eq(TaskEntity::getCreateUser, AuthUtil.getUserId());
        objectQueryWrapper.isNotNull(TaskEntity::getHouseCode);
        objectQueryWrapper.eq(TaskEntity::getIsDeleted, 0);
        objectQueryWrapper.in(TaskEntity::getReportType, 2, 3, 4, 5, 6);
        if (StringUtils.isNotBlank(houseCode)) {
            objectQueryWrapper.eq(TaskEntity::getHouseCode, houseCode);
        }
        Long all = baseMapper.selectCount(objectQueryWrapper);
        objectQueryWrapper.eq(TaskEntity::getStatus, 2);
        // 已处理
        Long processed = baseMapper.selectCount(objectQueryWrapper);
        objectObjectHashMap.put("all", all);
        objectObjectHashMap.put("processed", processed);
        return objectObjectHashMap;
    }
 
    @Override
    public Object countTypeNumber(Integer roleType, String neiCode) {
        TaskVO taskVO = new TaskVO();
        Map<String, Object> objectObjectHashMap = new HashMap<>();
        taskVO.setStatus(1);
        taskVO.setUserId(roleType > 0 ? AuthUtil.getUserId() : null);
        taskVO.setNeiCode(neiCode);
        taskVO.setReportType(2);
        taskVO.setIsDeleted(0);
        // 标签事件
        Integer bqsj = baseMapper.selectTaskCount(taskVO);
        taskVO.setReportType(1);
        // 取保候审
        Integer qbhs = baseMapper.selectTaskCount(taskVO);
        // 报事报修
        Integer bsbx = SpringUtils.getBean(ITaskReportForRepairsService.class).getStatistics(roleType > 0 ? AuthUtil.getUserId() : null, neiCode);
        // 住房审核
        Integer zhsh = iHouseholdService.statistics(roleType > 0 ? AuthUtil.getUserId() : null, neiCode);
        // 出租审核
        HouseRentalTenantVO houseRentalTenantVO = new HouseRentalTenantVO();
        houseRentalTenantVO.setUserId(roleType > 0 ? AuthUtil.getUserId() : null);
        houseRentalTenantVO.setNeiCode(neiCode);
        Integer czsh = iHouseRentalService.getStatisticsCount(houseRentalTenantVO);
        // 场所审核
        Integer cssh = SpringUtils.getBean(IPlaceExtService.class).selectCount(roleType > 0 ? AuthUtil.getUserId() : null, neiCode, 1);
        objectObjectHashMap.put("qbhs", qbhs);
        objectObjectHashMap.put("bqsj", bqsj);
        objectObjectHashMap.put("bsbx", bsbx);
        objectObjectHashMap.put("zhsh", zhsh);
        objectObjectHashMap.put("czsh", czsh);
        objectObjectHashMap.put("cssh", cssh);
        return objectObjectHashMap;
    }
 
    @Override
    public Object countFrequencyNumber() {
        Map<String, Object> objectObjectHashMap = new HashMap<>();
        TaskVO taskVO = new TaskVO();
        taskVO.setUserId(AuthUtil.getUserId());
        taskVO.setFrequency(1);
        taskVO.setStatus(1);
        Integer disposable = baseMapper.selectTaskCount(taskVO);
        taskVO.setFrequency(2);
        Integer periodicity = baseMapper.selectTaskCount(taskVO);
        objectObjectHashMap.put("disposable", disposable);
        objectObjectHashMap.put("periodicity", periodicity);
        return objectObjectHashMap;
    }
 
    @Override
    public Boolean removeTask(TaskEntity task) {
 
        boolean update1 = update(Wrappers.<TaskEntity>lambdaUpdate()
            .set(TaskEntity::getIsDeleted, 1)
            .eq(TaskEntity::getId, task.getId()));
        if (update1) {
            if (task.getReportType().equals(1)) {
                ITaskBailReportingEventService bean = SpringUtils.getBean(ITaskBailReportingEventService.class);
                boolean update = bean.update(Wrappers.<TaskBailReportingEventEntity>lambdaUpdate()
                    .set(TaskBailReportingEventEntity::getIsDeleted, 1)
                    .eq(TaskBailReportingEventEntity::getTaskId, task.getId()));
                return update;
            } else if (task.getReportType().equals(2)) {
                ITaskHotelReportingService bean = SpringUtils.getBean(ITaskHotelReportingService.class);
                boolean update = bean.update(Wrappers.<TaskHotelReportingEntity>lambdaUpdate()
                    .set(TaskHotelReportingEntity::getIsDeleted, 1)
                    .eq(TaskHotelReportingEntity::getTaskId, task.getId()));
                return update;
            } else if (task.getReportType().equals(3)) {
                ITaskLabelReportingEventService bean = SpringUtils.getBean(ITaskLabelReportingEventService.class);
                boolean update = bean.update(Wrappers.<TaskLabelReportingEventEntity>lambdaUpdate()
                    .set(TaskLabelReportingEventEntity::getIsDeleted, 1)
                    .eq(TaskLabelReportingEventEntity::getTaskId, task.getId()));
                return update;
            } else if (task.getReportType().equals(4)) {
                ITaskLabelReportingEventService bean = SpringUtils.getBean(ITaskLabelReportingEventService.class);
                boolean update = bean.update(Wrappers.<TaskLabelReportingEventEntity>lambdaUpdate()
                    .set(TaskLabelReportingEventEntity::getIsDeleted, 1)
                    .eq(TaskLabelReportingEventEntity::getTaskId, task.getId()));
                return update;
            } else if (task.getReportType().equals(5)) {
                ITaskLabelReportingEventService bean = SpringUtils.getBean(ITaskLabelReportingEventService.class);
                boolean update = bean.update(Wrappers.<TaskLabelReportingEventEntity>lambdaUpdate()
                    .set(TaskLabelReportingEventEntity::getIsDeleted, 1)
                    .eq(TaskLabelReportingEventEntity::getTaskId, task.getId()));
                return update;
            } else if (task.getReportType().equals(6)) {
                ITaskCampusReportingEventService bean = SpringUtils.getBean(ITaskCampusReportingEventService.class);
                boolean update = bean.update(Wrappers.<TaskCampusReportingEventEntity>lambdaUpdate()
                    .set(TaskCampusReportingEventEntity::getIsDeleted, 1)
                    .eq(TaskCampusReportingEventEntity::getTaskId, task.getId()));
                return update;
            }
        }
 
        return update1;
    }
 
    /**
     * 根据类型创建任务
     * @param param 参数
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean createTaskJob(String param) {
        // 解析参数
        JSONObject jsonParam = JSON.parseObject(param);
//        String params = jsonParam.getString("params");
        boolean flag = false;
        // 校园安全自查任务生成
        createCampusReportingTask();
        // 打金店/二手车/二手手机任务生成
        createLabelReportingTask();
        // 旅馆安全自查任务生成
        createHotelReportingTask();
        // 人员类-肇事肇祸精神障碍患者走访任务生成
        createGridWordTask();
        // 返回
        return flag;
    }
 
 
    /**
     * 人员类-肇事肇祸精神障碍患者走访任务生成
     */
    public void createGridWordTask() {
        // 肇事肇祸精神障碍患者走访任务生成,查询标签为:1006
        List<Integer> list = new ArrayList<Integer>(){{
            add(1006);
        }};
        // 根据人员标签编号集合查询对应的住户(按颜色区分近多少天没有发过任务的住户)
        List<HouseholdVO> householdVOList = iHouseholdService.getHouseholdListByParam(list);
        // 生成任务
        for (HouseholdVO household : householdVOList) {
            // 新增走访任务
            saveGridWordTask(household);
        }
    }
 
    /**
     * 新增走访任务
     * @param household
     */
    public void saveGridWordTask(HouseholdVO household) {
        GridWorkLogEntity gridWorkLogEntity = new GridWorkLogEntity();
        gridWorkLogEntity.setHouseholdId(household.getId());
        gridWorkLogEntity.setType(2);
        gridWorkLogEntity.setPersonType(20);
        // 系统下发
        gridWorkLogEntity.setSource(2);
        // 新增
        gridWorkLogService.save(gridWorkLogEntity);
    }
 
    /**
     * 打金店/二手车/二手手机任务生成
     */
    public void createLabelReportingTask() {
        // 打金店/二手车/二手手机任务生成,标签:130808/140304/130604
        List<String> stringList = new ArrayList<String>(){{
            add("130808");
            add("140304");
            add("130604");
        }};
        String tableName = "jczz_task_label_reporting_event";
        // 根据编号集合查询对应的场所(按颜色区分近多少天没有发过任务的场所)
        List<PlaceVO> placeVOList = placeService.getPlaceListByParam(stringList,tableName);
        // 生成任务
        for (PlaceVO placeVO : placeVOList) {
            String taskName = "";
            Integer reportType = 3;
            if (placeVO.getLabel().equals("130808")){
                taskName = DictConstant.DA_JIN_DIAN;
                reportType = 3;
            }
            if (placeVO.getLabel().equals("130604")){
                taskName = DictConstant.USED_MOBILE_PHONES;
                reportType = 4;
            }
            if (placeVO.getLabel().equals("140304")){
                taskName = DictConstant.USED_CAR;
                reportType = 5;
            }
            // 新增任务
            TaskEntity taskEntity = saveTaskEntity(placeVO.getHouseCode(), 1, taskName, 2, reportType);
            // 同时新增打金店/二手车/二手手机任务
            saveGoldShop(placeVO, taskEntity,taskName,reportType);
        }
    }
 
    /**
     * 旅馆安全自查任务生成
     */
    public void createHotelReportingTask() {
        // 旅馆标签为
        List<String> stringList = new ArrayList<String>(){{
            add("120101");
            add("120102");
            add("120103");
            add("120104");
        }};
        String tableName = "jczz_task_hotel_reporting";
        // 根据编号集合查询对应的场所(按颜色区分近多少天没有发过任务的场所)
        List<PlaceVO> placeVOList = placeService.getPlaceListByParam(stringList,tableName);
        // 生成任务
        for (PlaceVO placeVO : placeVOList) {
            // 新增任务
            TaskEntity taskEntity = saveTaskEntity(placeVO.getHouseCode(), 1, DictConstant.HOTEL_SECURITY, 2, 2);
            // 同时新增校园安全检查任务
            saveHotel(placeVO, taskEntity);
        }
    }
 
    /**
     * 校园安全自查任务生成
     */
    public void createCampusReportingTask() {
        // 校园安全自查,查询标签为教育的场所 parentNo = 1601
        String parentNo = "1601";
        QueryWrapper<CategoryEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("is_deleted",0).eq("parent_no",parentNo);
        List<CategoryEntity> categoryEntityList = categoryService.list(wrapper);
        // 取出编号集合
        List<String> stringList = categoryEntityList.stream().map(categoryEntity -> categoryEntity.getCategoryNo()).collect(Collectors.toList());
        // 根据编号集合查询对应的场所(按颜色区分近多少天没有发过任务的场所)
        String tableName = "jczz_task_campus_reporting_event";
        List<PlaceVO> placeVOList = placeService.getPlaceListByParam(stringList,tableName);
        // 生成任务
        for (PlaceVO placeVO : placeVOList) {
            // 新增任务
            TaskEntity taskEntity = saveTaskEntity(placeVO.getHouseCode(), 1, DictConstant.CAMPUS_SECURITY_INSPECTION, 2, 6);
            // 同时新增校园安全检查任务
            saveCampus(placeVO, taskEntity);
        }
    }
 
    /**
     * 新增校园安全检查任务
     * @param placeVO
     * @param taskEntity
     */
    private void saveCampus(PlaceVO placeVO, TaskEntity taskEntity) {
        TaskCampusReportingEventEntity campusReportingEventEntity = new TaskCampusReportingEventEntity();
        campusReportingEventEntity.setTaskId(taskEntity.getId());
        campusReportingEventEntity.setPlaceId(placeVO.getId());
        campusReportingEventEntity.setCampusName(placeVO.getPlaceName());
        campusReportingEventEntity.setCheckUserId(placeVO.getPrincipalUserId());
        campusReportingEventEntity.setCheckUserName(placeVO.getPrincipal());
        campusReportingEventEntity.setCheckTelephone(placeVO.getPrincipalPhone());
        // 系统下发
        campusReportingEventEntity.setSource(2);
        // 待完善
        campusReportingEventEntity.setConfirmFlag("4");
        // 新增
        taskCampusReportingEventService.save(campusReportingEventEntity);
    }
 
    /**
     * 新增旅馆安全检查任务
     * @param placeVO
     * @param taskEntity
     */
    private void saveHotel(PlaceVO placeVO, TaskEntity taskEntity) {
        TaskHotelReportingEntity taskHotelReportingEntity = new TaskHotelReportingEntity();
        taskHotelReportingEntity.setTaskId(taskEntity.getId());
        taskHotelReportingEntity.setPlaceId(placeVO.getId());
        taskHotelReportingEntity.setHotelName(placeVO.getPlaceName());
        taskHotelReportingEntity.setCheckUserId(placeVO.getPrincipalUserId());
        taskHotelReportingEntity.setCheckUserName(placeVO.getPrincipal());
        taskHotelReportingEntity.setCheckTelephone(placeVO.getPrincipalPhone());
        // 系统下发
        taskHotelReportingEntity.setSource(2);
        // 待完善
        taskHotelReportingEntity.setConfirmFlag("4");
        // 新增
        taskHotelReportingService.save(taskHotelReportingEntity);
    }
 
 
    /**
     * 新增打金店/二手车/二手手机任务
     * @param placeVO
     * @param taskEntity
     * @param taskName
     * @param reportType
     */
    private void saveGoldShop(PlaceVO placeVO, TaskEntity taskEntity,String taskName,Integer reportType) {
        TaskLabelReportingEventEntity taskLabelReportingEventEntity = new TaskLabelReportingEventEntity();
        taskLabelReportingEventEntity.setTaskId(taskEntity.getId());
        taskLabelReportingEventEntity.setPlaceId(placeVO.getId());
        taskLabelReportingEventEntity.setDistrictName(placeVO.getPlaceName());
        taskLabelReportingEventEntity.setUserId(placeVO.getPrincipalUserId());
        taskLabelReportingEventEntity.setOwner(placeVO.getPrincipal());
        taskLabelReportingEventEntity.setPhoneNumber(placeVO.getPrincipalPhone());
        taskLabelReportingEventEntity.setLabelName(taskName);
        // 打金店
        if (reportType==3){
            taskLabelReportingEventEntity.setEventType("1");
        }
        // 二手车
        if (reportType==4){
            taskLabelReportingEventEntity.setEventType("3");
        }
        // 二手手机
        if (reportType==5){
            taskLabelReportingEventEntity.setEventType("2");
        }
        taskLabelReportingEventEntity.setEventType(taskName);
        // 系统下发
        taskLabelReportingEventEntity.setSource(2);
        // 待完善
        taskLabelReportingEventEntity.setConfirmFlag("4");
        // 新增
        taskLabelReportingEventService.save(taskLabelReportingEventEntity);
    }
 
    /**
     * 插入任务信息
     * @param houseCode
     * @param type
     * @param taskName
     * @param frequency
     * @param reportType
     * @return
     */
    private TaskEntity saveTaskEntity(String houseCode,
                                      Integer type,
                                      String taskName,
                                      Integer frequency,
                                      Integer reportType) {
        TaskEntity taskEntity = new TaskEntity();
        taskEntity.setType(type);
        taskEntity.setName(taskName);
        taskEntity.setFrequency(frequency);
        taskEntity.setCreateTime(new Date());
        taskEntity.setHouseCode(houseCode);
        taskEntity.setReportType(reportType);
        // 待场所负责人上报完善处理
        taskEntity.setStatus(4);
        // 新增
        save(taskEntity);
        // 返回
        return taskEntity;
    }
}