Merge remote-tracking branch 'origin/dev-shanao' into pet
# Conflicts: # src/main/java/com/zcloud/controller/accident/AccidentRecordsController.java # src/main/java/com/zcloud/controller/messages/MessagesController.java # src/main/java/com/zcloud/entity/messages/PushRecords.java # src/main/java/com/zcloud/mapper/datasource/messages/MessagesMapper.java # src/main/java/com/zcloud/service/messages/impl/MessagesServiceImpl.java # src/main/resources/mybatis/datasource/inspection/SafetyEnvironmentalMapper.xml # src/main/resources/mybatis/datasource/messages/MessagesMapper.xmlpet
commit
877b518e5d
|
@ -1,11 +1,11 @@
|
||||||
package com.zcloud.controller.accident;
|
package com.zcloud.controller.accident;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.zcloud.controller.base.BaseController;
|
import com.zcloud.controller.base.BaseController;
|
||||||
import com.zcloud.entity.Page;
|
import com.zcloud.entity.Page;
|
||||||
import com.zcloud.entity.PageData;
|
import com.zcloud.entity.PageData;
|
||||||
|
import com.zcloud.entity.accident.AccidentRecords;
|
||||||
import com.zcloud.service.accident.AccidentRecordsService;
|
import com.zcloud.service.accident.AccidentRecordsService;
|
||||||
import com.zcloud.util.ObjectExcelView;
|
import com.zcloud.util.ObjectExcelView;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
@ -74,8 +74,7 @@ public class AccidentRecordsController extends BaseController {
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
public Map<String, Object> save(HttpServletRequest request) {
|
public Map<String, Object> save(HttpServletRequest request) {
|
||||||
AccidentRecords accidentRecords = BeanUtil.mapToBean(new PageData(request), AccidentRecords.class, true);
|
accidentRecordsService.save(new AccidentRecords(new PageData(request)));
|
||||||
accidentRecordsService.save(accidentRecords);
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
result.put("result", "success");
|
result.put("result", "success");
|
||||||
return result;
|
return result;
|
||||||
|
@ -90,9 +89,10 @@ public class AccidentRecordsController extends BaseController {
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping("/update")
|
@RequestMapping("/update")
|
||||||
public Map<String, Object> update(HttpServletRequest request) {
|
public Map<String, Object> update(HttpServletRequest request) {
|
||||||
PageData pageData = new PageData(request);
|
AccidentRecords accidentRecords = new AccidentRecords(new PageData(request));
|
||||||
AccidentRecords accidentRecords = BeanUtil.mapToBean(pageData, AccidentRecords.class, true);
|
if (StrUtil.isEmpty(accidentRecords.getId())) {
|
||||||
accidentRecords.setId(Optional.of(accidentRecords.getId()).orElseThrow(() -> new RuntimeException("id不能为空")));
|
throw new RuntimeException("id不能为空");
|
||||||
|
}
|
||||||
accidentRecordsService.update(accidentRecords);
|
accidentRecordsService.update(accidentRecords);
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
result.put("result", "success");
|
result.put("result", "success");
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.zcloud.controller.app.inspection;
|
||||||
import com.zcloud.controller.base.BaseController;
|
import com.zcloud.controller.base.BaseController;
|
||||||
import com.zcloud.entity.Page;
|
import com.zcloud.entity.Page;
|
||||||
import com.zcloud.entity.PageData;
|
import com.zcloud.entity.PageData;
|
||||||
import com.zcloud.entity.hotWorkApplication.Node;
|
|
||||||
import com.zcloud.entity.hotWorkApplication.NodeApp;
|
import com.zcloud.entity.hotWorkApplication.NodeApp;
|
||||||
import com.zcloud.entity.hotWorkApplication.Overseer;
|
import com.zcloud.entity.hotWorkApplication.Overseer;
|
||||||
import com.zcloud.service.bus.HiddenService;
|
import com.zcloud.service.bus.HiddenService;
|
||||||
|
@ -14,7 +13,6 @@ import com.zcloud.service.inspection.SafetyEnvironmentalInspectorService;
|
||||||
import com.zcloud.service.inspection.SafetyEnvironmentalService;
|
import com.zcloud.service.inspection.SafetyEnvironmentalService;
|
||||||
import com.zcloud.service.system.DepartmentService;
|
import com.zcloud.service.system.DepartmentService;
|
||||||
import com.zcloud.util.*;
|
import com.zcloud.util.*;
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -26,9 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.File;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 说明:安全环保检查
|
* 说明:安全环保检查
|
||||||
|
@ -58,7 +54,9 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
private NoticeCorpUtil noticeCorpUtil;
|
private NoticeCorpUtil noticeCorpUtil;
|
||||||
|
|
||||||
|
|
||||||
/**列表
|
/**
|
||||||
|
* 列表
|
||||||
|
*
|
||||||
* @param page
|
* @param page
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -79,7 +77,9 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**新增
|
/**
|
||||||
|
* 新增
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -121,7 +121,9 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**去修改页面获取数据
|
/**
|
||||||
|
* 去修改页面获取数据
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -139,7 +141,9 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**去修改页面获取数据
|
/**
|
||||||
|
* 去修改页面获取数据
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -157,7 +161,9 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**修改
|
/**
|
||||||
|
* 修改
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -194,7 +200,9 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**修改
|
/**
|
||||||
|
* 修改
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -230,7 +238,9 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**删除
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -248,7 +258,9 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**批量删除
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -275,7 +287,9 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**导出到excel
|
/**
|
||||||
|
* 导出到excel
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -335,7 +349,9 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**安全环保检查待办作业数统计
|
/**
|
||||||
|
* 安全环保检查待办作业数统计
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -371,7 +387,9 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**一公司app首页安全环保检查统计
|
/**
|
||||||
|
* 一公司app首页安全环保检查统计
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -388,7 +406,9 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**列表
|
/**
|
||||||
|
* 列表
|
||||||
|
*
|
||||||
* @param page
|
* @param page
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -410,8 +430,10 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**列表
|
/**
|
||||||
|
* 列表
|
||||||
* 规则: 如果当前人是,被检查人,检查人,参与人则可以查询到此条数据
|
* 规则: 如果当前人是,被检查人,检查人,参与人则可以查询到此条数据
|
||||||
|
*
|
||||||
* @param page
|
* @param page
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -424,6 +446,7 @@ public class AppSafetyEnvironmentalController extends BaseController {
|
||||||
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
|
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
|
||||||
if (Tools.notEmpty(KEYWORDS)) pd.put("KEYWORDS", KEYWORDS.trim());
|
if (Tools.notEmpty(KEYWORDS)) pd.put("KEYWORDS", KEYWORDS.trim());
|
||||||
pd.put("waffle", pd.getString("ARCHIVE_USER_ID"));
|
pd.put("waffle", pd.getString("ARCHIVE_USER_ID"));
|
||||||
|
pd.put("loginUserId", Jurisdiction.getUSER_ID());
|
||||||
page.setPd(pd);
|
page.setPd(pd);
|
||||||
List<PageData> varList = safetyenvironmentalService.checkList(page); //列出SafetyEnvironmental列表
|
List<PageData> varList = safetyenvironmentalService.checkList(page); //列出SafetyEnvironmental列表
|
||||||
/* 针对验收部分特殊处理 */
|
/* 针对验收部分特殊处理 */
|
||||||
|
|
|
@ -737,31 +737,35 @@ public class SafetyEnvironmentalController extends BaseController {
|
||||||
pd.put("loginUserId", Jurisdiction.getUSER_ID());
|
pd.put("loginUserId", Jurisdiction.getUSER_ID());
|
||||||
List<PageData> varList = safetyenvironmentalService.checkList(page); //列出SafetyEnvironmental列表
|
List<PageData> varList = safetyenvironmentalService.checkList(page); //列出SafetyEnvironmental列表
|
||||||
/* 针对验收部分特殊处理 */
|
/* 针对验收部分特殊处理 */
|
||||||
for (PageData vector : varList) {
|
// for (PageData vector : varList) {
|
||||||
if (StringUtils.isNotBlank(vector.getString("INSPECTION_STATUS")) &&
|
// if (StringUtils.isNotBlank(vector.getString("INSPECTION_STATUS")) &&
|
||||||
("6".equals(vector.getString("INSPECTION_STATUS"))
|
// ("6".equals(vector.getString("INSPECTION_STATUS"))
|
||||||
|| "5".equals(vector.getString("INSPECTION_STATUS"))
|
// || "5".equals(vector.getString("INSPECTION_STATUS"))
|
||||||
// || "7".equals(vector.getString("INSPECTION_STATUS"))
|
//// || "7".equals(vector.getString("INSPECTION_STATUS"))
|
||||||
)
|
// )
|
||||||
) {
|
// ) {
|
||||||
PageData condition = new PageData();
|
// PageData condition = new PageData();
|
||||||
condition.put("FOREIGN_ID", vector.getString("INSPECTION_ID"));
|
// condition.put("FOREIGN_ID", vector.getString("INSPECTION_ID"));
|
||||||
List<PageData> waffle = hiddenService.findByKey(condition);
|
// List<PageData> waffle = hiddenService.findByKey(condition);
|
||||||
if (waffle == null || waffle.isEmpty()) {
|
// if (waffle == null || waffle.isEmpty()) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
Long number = waffle.stream()
|
// Long number = waffle.stream()
|
||||||
.filter(n ->
|
// .filter(n -> Jurisdiction.getUSER_ID().equals(n.getString("CREATOR")) &&
|
||||||
Jurisdiction.getUSER_ID().equals(n.getString("CREATOR")) &&
|
// (StringUtils.isNotBlank(n.getString("STATE")) &&
|
||||||
(StringUtils.isNotBlank(n.getString("STATE")) && ("4".equals(n.getString("STATE")) || "8".equals(n.getString("STATE")))) &&
|
// ("4".equals(n.getString("STATE")) ||
|
||||||
(StringUtils.isBlank(n.getString("FINAL_CHECK")) || "2".equals(n.getString("FINAL_CHECK")))
|
// "8".equals(n.getString("STATE")))) &&
|
||||||
)
|
// (StringUtils.isBlank(n.getString("FINAL_CHECK")) ||
|
||||||
.count();
|
// "2".equals(n.getString("FINAL_CHECK")))
|
||||||
if (number > 0) {
|
// )
|
||||||
vector.put("checkout", 1);
|
// .count();
|
||||||
}
|
// if (number > 0) {
|
||||||
}
|
// vector.put("checkout", 1);
|
||||||
}
|
// } else {
|
||||||
|
// vector.put("checkout", 0);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
map.put("varList", varList);
|
map.put("varList", varList);
|
||||||
map.put("page", page);
|
map.put("page", page);
|
||||||
map.put("result", errInfo);
|
map.put("result", errInfo);
|
||||||
|
|
|
@ -37,7 +37,9 @@ public class SafetyEnvironmentalInspectorController extends BaseController {
|
||||||
private DepartmentService departmentService;
|
private DepartmentService departmentService;
|
||||||
|
|
||||||
|
|
||||||
/**列表
|
/**
|
||||||
|
* 列表
|
||||||
|
*
|
||||||
* @param page
|
* @param page
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -59,7 +61,7 @@ public class SafetyEnvironmentalInspectorController extends BaseController {
|
||||||
pd.put("roleLevel", loginUser.getRoleLevel());
|
pd.put("roleLevel", loginUser.getRoleLevel());
|
||||||
pd.put("loginUserId", loginUser.getUSER_ID());
|
pd.put("loginUserId", loginUser.getUSER_ID());
|
||||||
}
|
}
|
||||||
|
pd.put("loginUserId", Jurisdiction.getUSER_ID());
|
||||||
page.setPd(pd);
|
page.setPd(pd);
|
||||||
List<PageData> varList = safetyenvironmentalinspectorService.list(page); //列出SafetyEnvironmentalInspector列表
|
List<PageData> varList = safetyenvironmentalinspectorService.list(page); //列出SafetyEnvironmentalInspector列表
|
||||||
for (PageData vector : varList) {
|
for (PageData vector : varList) {
|
||||||
|
@ -80,7 +82,9 @@ public class SafetyEnvironmentalInspectorController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**检查人核实
|
/**
|
||||||
|
* 检查人核实
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -122,16 +126,9 @@ public class SafetyEnvironmentalInspectorController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**新增
|
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -156,7 +153,9 @@ public class SafetyEnvironmentalInspectorController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**删除
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -175,7 +174,9 @@ public class SafetyEnvironmentalInspectorController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**修改
|
/**
|
||||||
|
* 修改
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -195,7 +196,9 @@ public class SafetyEnvironmentalInspectorController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**去修改页面获取数据
|
/**
|
||||||
|
* 去修改页面获取数据
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -213,7 +216,9 @@ public class SafetyEnvironmentalInspectorController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**批量删除
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -240,7 +245,9 @@ public class SafetyEnvironmentalInspectorController extends BaseController {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**导出到excel
|
/**
|
||||||
|
* 导出到excel
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class MessagesController {
|
||||||
if (body == null || !body.containsKey("key") || !body.containsKey("value")) {
|
if (body == null || !body.containsKey("key") || !body.containsKey("value")) {
|
||||||
throw new RuntimeException("参数为空");
|
throw new RuntimeException("参数为空");
|
||||||
}
|
}
|
||||||
PushRecords pushRecords = JSON.parseObject(decrypt(body, privateKey), PushRecords.class);
|
PushRecords pushRecords = JSON.parseObject(decrypt(body), PushRecords.class);
|
||||||
Set<ConstraintViolation<PushRecords>> validate = validator.validate(pushRecords);
|
Set<ConstraintViolation<PushRecords>> validate = validator.validate(pushRecords);
|
||||||
if (!validate.isEmpty()) {
|
if (!validate.isEmpty()) {
|
||||||
throw new ConstraintViolationException(validate);
|
throw new ConstraintViolationException(validate);
|
||||||
|
@ -62,9 +62,9 @@ public class MessagesController {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String decrypt(Map<String, Object> body, String privateKey) {
|
private String decrypt(Map<String, Object> body) {
|
||||||
try {
|
try {
|
||||||
RSA rsa = new RSA(privateKey, null);
|
RSA rsa = new RSA(MessagesController.privateKey, null);
|
||||||
byte[] aesKey = rsa.decrypt(Convert.toStr(body.get("key")), KeyType.PrivateKey);
|
byte[] aesKey = rsa.decrypt(Convert.toStr(body.get("key")), KeyType.PrivateKey);
|
||||||
SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, aesKey);
|
SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, aesKey);
|
||||||
return aes.decryptStr(Convert.toStr(body.get("value")), StandardCharsets.UTF_8);
|
return aes.decryptStr(Convert.toStr(body.get("value")), StandardCharsets.UTF_8);
|
||||||
|
|
|
@ -32,4 +32,6 @@ public class PushRecords implements Serializable {
|
||||||
|
|
||||||
@NotBlank(message = "发送时间不能为空")
|
@NotBlank(message = "发送时间不能为空")
|
||||||
private String sendTime;
|
private String sendTime;
|
||||||
|
|
||||||
|
private Integer state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,4 +7,6 @@ public interface MessagesMapper {
|
||||||
void install(PushRecords pushRecords);
|
void install(PushRecords pushRecords);
|
||||||
|
|
||||||
String findUserIdByPhone(@Param("phone") String phone);
|
String findUserIdByPhone(@Param("phone") String phone);
|
||||||
|
|
||||||
|
void updateById(PushRecords pushRecords);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.zcloud.service.messages;
|
||||||
|
|
||||||
|
import com.zcloud.entity.messages.PushRecords;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送消息接口
|
||||||
|
*/
|
||||||
|
public interface PushMessages {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送消息
|
||||||
|
*
|
||||||
|
* @param pushRecords 消息实体
|
||||||
|
* @param userId 用户id
|
||||||
|
*/
|
||||||
|
void push(PushRecords pushRecords, String userId) throws Exception;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.zcloud.service.messages.impl;
|
||||||
|
|
||||||
|
import com.zcloud.entity.messages.PushRecords;
|
||||||
|
import com.zcloud.service.messages.PushMessages;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送站内信
|
||||||
|
*/
|
||||||
|
@Component("messages3")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AllMessagesImpl implements PushMessages {
|
||||||
|
|
||||||
|
private final InsideMessagesImpl insideMessages;
|
||||||
|
private final SmsMessagesImpl smsMessages;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void push(PushRecords pushRecords, String userId) throws Exception {
|
||||||
|
insideMessages.push(pushRecords, userId);
|
||||||
|
smsMessages.push(pushRecords, userId);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.zcloud.service.messages.impl;
|
||||||
|
|
||||||
|
import com.zcloud.entity.PageData;
|
||||||
|
import com.zcloud.entity.messages.PushRecords;
|
||||||
|
import com.zcloud.service.bus.NoticeCorpService;
|
||||||
|
import com.zcloud.service.messages.PushMessages;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送站内信
|
||||||
|
*/
|
||||||
|
@Component("messages2")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class InsideMessagesImpl implements PushMessages {
|
||||||
|
|
||||||
|
private final NoticeCorpService noticeCorpService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void push(PushRecords pushRecords, String userId) throws Exception {
|
||||||
|
PageData mes = new PageData();
|
||||||
|
mes.put("BIANMA", "PUSH_RECORDS");
|
||||||
|
mes.put("SENDER_ID", "九公司应急管理");
|
||||||
|
mes.put("SENDER_NAME", "九公司应急管理");
|
||||||
|
mes.put("SYNOPSIS", pushRecords.getMessageTitle());
|
||||||
|
mes.put("CORPINFO_ID", "48a8ca9815814c979814ddcf041c5cd5");
|
||||||
|
mes.put("RECEIVER_ID", userId);
|
||||||
|
PageData content = new PageData();
|
||||||
|
content.put("msg", pushRecords.getMessageContent());
|
||||||
|
mes.put("CONTENT", content);// 站内信内容
|
||||||
|
noticeCorpService.sendNotice(mes);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,17 +1,17 @@
|
||||||
package com.zcloud.service.messages.impl;
|
package com.zcloud.service.messages.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.zcloud.entity.PageData;
|
|
||||||
import com.zcloud.entity.messages.PushRecords;
|
import com.zcloud.entity.messages.PushRecords;
|
||||||
import com.zcloud.mapper.datasource.messages.MessagesMapper;
|
import com.zcloud.mapper.datasource.messages.MessagesMapper;
|
||||||
import com.zcloud.service.bus.NoticeCorpService;
|
|
||||||
import com.zcloud.service.messages.MessagesService;
|
import com.zcloud.service.messages.MessagesService;
|
||||||
|
import com.zcloud.service.messages.PushMessages;
|
||||||
import com.zcloud.util.DateUtil;
|
import com.zcloud.util.DateUtil;
|
||||||
import com.zcloud.util.UuidUtil;
|
import com.zcloud.util.UuidUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
|
@ -19,67 +19,26 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
public class MessagesServiceImpl implements MessagesService {
|
public class MessagesServiceImpl implements MessagesService {
|
||||||
|
|
||||||
private final MessagesMapper mapper;
|
private final MessagesMapper mapper;
|
||||||
private final NoticeCorpService noticeCorpService;
|
private final Map<String, PushMessages> messages;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void push(PushRecords pushRecords) throws Exception {
|
public void push(PushRecords pushRecords) throws Exception {
|
||||||
// 先记录数据
|
// 先记录数据
|
||||||
pushRecords.setId(UuidUtil.get32UUID());
|
pushRecords.setId(UuidUtil.get32UUID());
|
||||||
pushRecords.setSendTime(DateUtil.getTime());
|
pushRecords.setSendTime(DateUtil.getTime());
|
||||||
|
pushRecords.setState(1);
|
||||||
mapper.install(pushRecords);
|
mapper.install(pushRecords);
|
||||||
// 根据手机号查找用户id
|
// 根据手机号查找用户id
|
||||||
String userId = mapper.findUserIdByPhone(pushRecords.getPhone());
|
String userId = mapper.findUserIdByPhone(pushRecords.getPhone());
|
||||||
if (StrUtil.isEmpty(userId)) {
|
if (StrUtil.isEmpty(userId)) {
|
||||||
throw new RuntimeException("该用户不存在");
|
throw new RuntimeException("该用户不存在");
|
||||||
}
|
}
|
||||||
|
// 调用对应消息推送实现
|
||||||
Integer type = pushRecords.getMessageType();
|
Integer type = pushRecords.getMessageType();
|
||||||
// 1-短信 2-平台信息 3-全发
|
PushMessages pushMessages = messages.get("messages" + type);
|
||||||
if (type == 1) {
|
pushMessages.push(pushRecords, userId);
|
||||||
pushSms(pushRecords);
|
// 修改状态
|
||||||
} else if (type == 2) {
|
pushRecords.setState(2);
|
||||||
PageData data = pushInfo(pushRecords, userId);
|
mapper.updateById(pushRecords);
|
||||||
noticeCorpService.sendNotice(data);
|
|
||||||
} else if (type == 3) {
|
|
||||||
pushSms(pushRecords);
|
|
||||||
PageData data = pushInfo(pushRecords, userId);
|
|
||||||
noticeCorpService.sendNotice(data);
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("消息类型:【" + type + "】错误");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 推送平台信息(站内信)
|
|
||||||
* 注意 不能再此方法中调用数据库 再类中直接调用 会导致事务失效 private 也会导致事务失效
|
|
||||||
*
|
|
||||||
* @param pushRecords 消息
|
|
||||||
* @param userId 接收人id
|
|
||||||
*/
|
|
||||||
private PageData pushInfo(PushRecords pushRecords, String userId) throws Exception {
|
|
||||||
PageData mes = new PageData();
|
|
||||||
mes.put("BIANMA", "PUSH_RECORDS");
|
|
||||||
mes.put("SENDER_ID", "九公司应急管理"); // 发送人员ID
|
|
||||||
mes.put("SENDER_NAME", "九公司应急管理"); // 发送人员姓名
|
|
||||||
mes.put("SYNOPSIS", pushRecords.getMessageTitle()); // 站内信标题
|
|
||||||
//mes.put("WORKURL", "/pages/application/high-risk-work/limited-space/gas-analysis/list?NameLikes=" + pd.getString("WORK_PERMIT_NUMBER")); // 操作链接
|
|
||||||
mes.put("CORPINFO_ID", "48a8ca9815814c979814ddcf041c5cd5");// 企业id
|
|
||||||
mes.put("RECEIVER_ID", userId); // 接收人员ID
|
|
||||||
PageData content = new PageData();
|
|
||||||
content.put("msg", pushRecords.getMessageContent());// 作业编号
|
|
||||||
mes.put("CONTENT", content);// 站内信内容
|
|
||||||
return mes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 推送平台信息(站内信)
|
|
||||||
* 注意 不能再此方法中调用数据库 再类中直接调用 会导致事务失效 private 也会导致事务失效
|
|
||||||
*
|
|
||||||
* @param pushRecords 消息
|
|
||||||
*/
|
|
||||||
private void pushSms(PushRecords pushRecords) {
|
|
||||||
// todo
|
|
||||||
log.error("===================>推送短信信息");
|
|
||||||
log.error("消息内容:{}", pushRecords);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.zcloud.service.messages.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.zcloud.entity.messages.PushRecords;
|
||||||
|
import com.zcloud.service.messages.PushMessages;
|
||||||
|
import com.zcloud.util.SendSmsUtil;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送短信
|
||||||
|
*/
|
||||||
|
@Component("messages1")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SmsMessagesImpl implements PushMessages {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void push(PushRecords pushRecords, String userId) throws ParseException {
|
||||||
|
JSONObject object = new JSONObject();
|
||||||
|
object.put("messageContent", pushRecords.getMessageContent());
|
||||||
|
// todo 应该是短信模版tpId 没有 别的OK了
|
||||||
|
if (!SendSmsUtil.sendSms(null, object, pushRecords.getSendTime(), pushRecords.getPhone())) {
|
||||||
|
throw new RuntimeException("系统故障:短信发送失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -117,9 +117,33 @@ public class AliSmsToolUtil {
|
||||||
//发短信
|
//发短信
|
||||||
Map<String,Object> map = new HashMap<String,Object>();
|
Map<String,Object> map = new HashMap<String,Object>();
|
||||||
map.put("infoDetail", "阿斯顿发");
|
map.put("infoDetail", "阿斯顿发");
|
||||||
map.put("phone", "18630363710");
|
map.put("phone", "18630387571");
|
||||||
map.put("infoType", "阿三地方");
|
map.put("infoType", "阿三地方");
|
||||||
|
map.put("templateCode", "SMS_227260789");
|
||||||
List<PageData> paramsList = new ArrayList<PageData>();
|
List<PageData> paramsList = new ArrayList<PageData>();
|
||||||
|
PageData params1 = new PageData();
|
||||||
|
// 第1个参数
|
||||||
|
params1.put("name", "number");// 存入短信模板中的参数名称
|
||||||
|
params1.put("value", 2);// 存入上面参数名称所传递的值
|
||||||
|
paramsList.add(params1);
|
||||||
|
|
||||||
|
PageData params2 = new PageData();
|
||||||
|
// 第2个参数
|
||||||
|
params2.put("name", "params1");// 存入短信模板中的参数名称
|
||||||
|
params2.put("value", "盲板作业");// 存入上面参数名称所传递的值
|
||||||
|
paramsList.add(params2);
|
||||||
|
|
||||||
|
PageData params3 = new PageData();
|
||||||
|
// 第3个参数
|
||||||
|
params3.put("name", "params2");// 存入短信模板中的参数名称
|
||||||
|
params3.put("value", "生产部门意见");// 存入上面参数名称所传递的值
|
||||||
|
paramsList.add(params3);
|
||||||
|
|
||||||
|
PageData params4 = new PageData();
|
||||||
|
// 第4个参数
|
||||||
|
params4.put("name", "params3");// 存入短信模板中的参数名称
|
||||||
|
params4.put("value", "审核");// 存入上面参数名称所传递的值
|
||||||
|
paramsList.add(params4);
|
||||||
SendSmsResponse response = sendSms(map,paramsList);
|
SendSmsResponse response = sendSms(map,paramsList);
|
||||||
System.out.println("短信接口返回的数据----------------");
|
System.out.println("短信接口返回的数据----------------");
|
||||||
System.out.println("Code=" + response.getCode());
|
System.out.println("Code=" + response.getCode());
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package com.zcloud.util;
|
package com.zcloud.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.ObjectUtils;
|
import org.apache.commons.lang.ObjectUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
@ -14,6 +18,7 @@ import java.util.Date;
|
||||||
/**
|
/**
|
||||||
* 重点工程发送短信工具类
|
* 重点工程发送短信工具类
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
public class SendSmsUtil {
|
public class SendSmsUtil {
|
||||||
|
|
||||||
private static String USERNAME = "qhdzyhy";
|
private static String USERNAME = "qhdzyhy";
|
||||||
|
@ -27,6 +32,7 @@ public class SendSmsUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送短信
|
* 发送短信
|
||||||
|
*
|
||||||
* @param records
|
* @param records
|
||||||
* @param time 发送时间 为空或小于当前时间则立即发送
|
* @param time 发送时间 为空或小于当前时间则立即发送
|
||||||
* records格式实例 records是 JSONArray 里边的内容通过调用下方方法getRecords获取 JSONObject 定义一个JSONArray后 put进去即可
|
* records格式实例 records是 JSONArray 里边的内容通过调用下方方法getRecords获取 JSONObject 定义一个JSONArray后 put进去即可
|
||||||
|
@ -71,13 +77,39 @@ public class SendSmsUtil {
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// {"msg":"template error","tpId":"null","code":4014,"msgId":"172950016144709288961"}
|
||||||
|
// {"msg":"success","tpId":"121487","code":200,"msgId":"172950025828957168641","invalidList":[]}
|
||||||
|
public static boolean sendSms(String tpId, JSONObject records, String time, String phone) throws ParseException {
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("username", USERNAME);
|
||||||
|
json.put("tKey", System.currentTimeMillis() / 1000);
|
||||||
|
json.put("password", MD5.md5(PASSWORD + json.getLong("tKey")));
|
||||||
|
json.put("signature", SIGNATURE);
|
||||||
|
json.put("tpId", tpId);
|
||||||
|
if (StringUtils.isNotBlank(time) && DateUtil.parseDateTime(time).after(new Date())) {
|
||||||
|
json.put("time", time);
|
||||||
|
}
|
||||||
|
JSONArray array = new JSONArray();
|
||||||
|
array.add(getRecords(phone, records));
|
||||||
|
json.put("records", array);
|
||||||
|
HttpRequest request = HttpRequest.post(URL)
|
||||||
|
.timeout(60000)
|
||||||
|
.body(json.toJSONString(), MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||||
|
try (HttpResponse response = request.execute()) {
|
||||||
|
return JSON.parseObject(response.body()).getInteger("code") == 200;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("发送短信异常", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 封装要发送的电话以及要替换的内容
|
* 封装要发送的电话以及要替换的内容
|
||||||
|
*
|
||||||
* @param mobile 手机号
|
* @param mobile 手机号
|
||||||
* @param tpContent 替换内容
|
* @param tpContent 替换内容
|
||||||
* @return
|
* @return 格式实例 var1表示要替换的内容 与要替换的内容保持一致即可 变量1表示替换的内容
|
||||||
* 格式实例 var1表示要替换的内容 与要替换的内容保持一致即可 变量1表示替换的内容
|
|
||||||
* {
|
* {
|
||||||
* "mobile":"138****0000",
|
* "mobile":"138****0000",
|
||||||
* "tpContent":{
|
* "tpContent":{
|
||||||
|
@ -97,19 +129,12 @@ public class SendSmsUtil {
|
||||||
}//d22f8a5d4a35b3761dc9525186e652a0
|
}//d22f8a5d4a35b3761dc9525186e652a0
|
||||||
|
|
||||||
//测试接口
|
//测试接口
|
||||||
public static void main(String[] args) throws ParseException {
|
// public static void main(String[] args) throws ParseException {
|
||||||
JSONArray jsonArray = new JSONArray();
|
// //定义替换参数
|
||||||
|
|
||||||
//接受返回结果
|
|
||||||
JSONObject records = new JSONObject();
|
|
||||||
//定义替换参数
|
|
||||||
// JSONObject tpContent = new JSONObject();
|
// JSONObject tpContent = new JSONObject();
|
||||||
//tpContent.put("userName","卓云企业");
|
// tpContent.put("HIDDENDESCR", "卓云企业测试");
|
||||||
//tpContent.put("time","2023-09-21 15:56:20");
|
// JSONObject object = sendSms("121487", tpContent, DateUtil.formatDateTime(new Date()), "18630387571");
|
||||||
//records = getRecords("18617456701",tpContent);
|
// System.out.println(object.toJSONString());
|
||||||
jsonArray.add(records);
|
// }
|
||||||
|
|
||||||
sendSms("null",jsonArray,null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,11 @@
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
GROUP BY f.INSPECTION_ID
|
GROUP BY f.INSPECTION_ID
|
||||||
ORDER BY FIELD (se.INSPECTION_STATUS , '0','1','2','3','4','5','6','7','8','-1','-2') asc, se.INSPECTION_TIME_START DESC , se.INSPECTION_TIME_END DESC
|
ORDER BY
|
||||||
|
FIELD(if(f.INSPECTION_USER_SIGN_TIME is not null,'2','1'), '1','2'),
|
||||||
|
FIELD(if(se.INSPECTED_SITEUSER_ID = #{pd.loginUserId},#{pd.loginUserId},'1'), #{pd.loginUserId}, '1'),
|
||||||
|
FIELD (se.INSPECTION_STATUS , '0','1','2','3','4','5','6','7','8','-1','-2') ,
|
||||||
|
se.INSPECTION_TIME_START DESC , se.INSPECTION_TIME_END DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 列表(全部) -->
|
<!-- 列表(全部) -->
|
||||||
|
|
|
@ -339,16 +339,6 @@
|
||||||
OR iod.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
OR iod.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<!-- 2021/10/9 同步监管端搜索字段 -->
|
|
||||||
<if test="pd.INSPECTION_USER_NAME != null and pd.INSPECTION_USER_NAME != ''">
|
|
||||||
and REPLACE(siu.NAME,'/',',') LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_USER_NAME}),'%')
|
|
||||||
</if>
|
|
||||||
<if test="pd.INSPECTION_USER_PHONE != null and pd.INSPECTION_USER_PHONE != ''">
|
|
||||||
and REPLACE(siu.PHONE,'/',',') LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_USER_PHONE}),'%')
|
|
||||||
</if>
|
|
||||||
<if test="pd.INSPECTION_CASE != null and pd.INSPECTION_CASE != ''"><!-- 检查情况 -->
|
|
||||||
and biss.SITUATION like CONCAT('%', #{pd.INSPECTION_CASE}, '%')
|
|
||||||
</if>
|
|
||||||
GROUP BY f.INSPECTION_ID
|
GROUP BY f.INSPECTION_ID
|
||||||
ORDER BY f.CREATTIME DESC
|
ORDER BY f.CREATTIME DESC
|
||||||
</select>
|
</select>
|
||||||
|
@ -649,61 +639,85 @@
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<select id="checklistPage" parameterType="page" resultType="pd">
|
<select id="checklistPage" parameterType="page" resultType="pd">
|
||||||
select
|
select iou.NAME INSPECTION_ORIGINATOR_NAME,
|
||||||
iou.NAME INSPECTION_ORIGINATOR_NAME,
|
|
||||||
ild.NAME INSPECTION_LEADDEPARTMENT_NAME,
|
ild.NAME INSPECTION_LEADDEPARTMENT_NAME,
|
||||||
iod.NAME INSPECTION_DEPARTMENT_NAME,
|
iod.NAME INSPECTION_DEPARTMENT_NAME,
|
||||||
isd.NAME INSPECTED_DEPARTMENT_NAME,
|
isd.NAME INSPECTED_DEPARTMENT_NAME,
|
||||||
isu.NAME INSPECTED_SITEUSER_NAME,
|
isu.NAME INSPECTED_SITEUSER_NAME,
|
||||||
|
if(h.`count` > 0, 1, null) as checkout,
|
||||||
IFNULL(GROUP_CONCAT(REPLACE(siu.USER_ID, '/', ',')), '') AS INSPECTION_USER_ID,
|
IFNULL(GROUP_CONCAT(REPLACE(siu.USER_ID, '/', ',')), '') AS INSPECTION_USER_ID,
|
||||||
IFNULL(GROUP_CONCAT(REPLACE(siu.NAME, '/', ',')), '') AS INSPECTION_USER_NAME,
|
IFNULL(GROUP_CONCAT(REPLACE(siu.NAME, '/', ',')), '') AS INSPECTION_USER_NAME,
|
||||||
CASE WHEN IFNULL(f.INSPECTION_TYPE_OTHER, '') = '' THEN d.NAME ELSE f.INSPECTION_TYPE_OTHER END INSPECTION_TYPE_NAME,
|
CASE
|
||||||
<include refid="Field"></include>
|
WHEN IFNULL(f.INSPECTION_TYPE_OTHER, '') = '' THEN d.NAME
|
||||||
|
ELSE f.INSPECTION_TYPE_OTHER END INSPECTION_TYPE_NAME,
|
||||||
|
<include refid="Field">
|
||||||
|
</include>
|
||||||
from
|
from
|
||||||
<include refid="tableName"></include> f
|
<include refid="tableName">
|
||||||
|
</include>
|
||||||
|
f
|
||||||
LEFT JOIN vi_user_all iou ON iou.USER_ID = f.INSPECTION_ORIGINATOR_ID
|
LEFT JOIN vi_user_all iou ON iou.USER_ID = f.INSPECTION_ORIGINATOR_ID
|
||||||
LEFT JOIN OA_DEPARTMENT ild ON ild.DEPARTMENT_ID = f.INSPECTION_LEADDEPARTMENT_ID
|
LEFT JOIN OA_DEPARTMENT ild ON ild.DEPARTMENT_ID = f.INSPECTION_LEADDEPARTMENT_ID
|
||||||
LEFT JOIN vi_department_all iod ON iod.DEPARTMENT_ID = iou.DEPARTMENT_ID
|
LEFT JOIN vi_department_all iod ON iod.DEPARTMENT_ID = iou.DEPARTMENT_ID
|
||||||
LEFT JOIN OA_DEPARTMENT isd ON isd.DEPARTMENT_ID = f.INSPECTED_DEPARTMENT_ID
|
LEFT JOIN OA_DEPARTMENT isd ON isd.DEPARTMENT_ID = f.INSPECTED_DEPARTMENT_ID
|
||||||
LEFT JOIN SYS_USER isu ON isu.USER_ID = f.INSPECTED_SITEUSER_ID
|
LEFT JOIN SYS_USER isu ON isu.USER_ID = f.INSPECTED_SITEUSER_ID
|
||||||
LEFT JOIN bus_inspection_safetyenvironmental_inspector si ON si.INSPECTION_ID = f.INSPECTION_ID and si.ISDELETE = '0'
|
LEFT JOIN bus_inspection_safetyenvironmental_inspector si
|
||||||
|
ON si.INSPECTION_ID = f.INSPECTION_ID and si.ISDELETE = '0'
|
||||||
LEFT JOIN vi_user_all siu ON siu.USER_ID = si.INSPECTION_USER_ID
|
LEFT JOIN vi_user_all siu ON siu.USER_ID = si.INSPECTION_USER_ID
|
||||||
LEFT JOIN sys_dictionaries d ON d.BIANMA = f.INSPECTION_TYPE
|
LEFT JOIN sys_dictionaries d ON d.BIANMA = f.INSPECTION_TYPE
|
||||||
|
LEFT JOIN (select h.FOREIGN_ID, count(h.HIDDEN_ID) as `count`
|
||||||
|
from BUS_HIDDEN h
|
||||||
|
where h.ISDELETE = 0
|
||||||
|
and h.CREATOR = #{pd.loginUserId}
|
||||||
|
and h.STATE in ('4', '8')
|
||||||
|
and (h.FINAL_CHECK is null or h.FINAL_CHECK = '2')
|
||||||
|
group by h.FOREIGN_ID) h on h.FOREIGN_ID = f.INSPECTION_ID AND f.INSPECTION_STATUS in ('5', '6')
|
||||||
where f.ISDELETE = '0'
|
where f.ISDELETE = '0'
|
||||||
<if test="pd.INSPECTION_ORIGINATOR_ID != null and pd.INSPECTION_ORIGINATOR_ID != ''"><!-- 检查发起人 -->
|
<if test="pd.INSPECTION_ORIGINATOR_ID != null and pd.INSPECTION_ORIGINATOR_ID != ''">
|
||||||
|
<!-- 检查发起人 -->
|
||||||
and f.INSPECTION_ORIGINATOR_ID = #{pd.INSPECTION_ORIGINATOR_ID}
|
and f.INSPECTION_ORIGINATOR_ID = #{pd.INSPECTION_ORIGINATOR_ID}
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.ARCHIVE_USER_ID != null and pd.ARCHIVE_USER_ID != ''">
|
<if test="pd.ARCHIVE_USER_ID != null and pd.ARCHIVE_USER_ID != ''">
|
||||||
and (
|
and (
|
||||||
f.INSPECTION_ORIGINATOR_ID = #{pd.ARCHIVE_USER_ID}
|
f.INSPECTION_ORIGINATOR_ID = #{pd.ARCHIVE_USER_ID}
|
||||||
OR f.INSPECTED_SITEUSER_ID = #{pd.ARCHIVE_USER_ID}
|
OR f.INSPECTED_SITEUSER_ID = #{pd.ARCHIVE_USER_ID}
|
||||||
OR EXISTS(select 1 from bus_inspection_safetyenvironmental_inspector sii where sii.INSPECTION_USER_ID = #{pd.ARCHIVE_USER_ID}
|
OR EXISTS(select 1
|
||||||
|
from bus_inspection_safetyenvironmental_inspector sii
|
||||||
|
where sii.INSPECTION_USER_ID = #{pd.ARCHIVE_USER_ID}
|
||||||
and sii.INSPECTION_ID = f.INSPECTION_ID)
|
and sii.INSPECTION_ID = f.INSPECTION_ID)
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="pd.INSPECTED_DEPARTMENT_NAME != null and pd.INSPECTED_DEPARTMENT_NAME != ''"><!-- 被检查单位 -->
|
<if test="pd.INSPECTED_DEPARTMENT_NAME != null and pd.INSPECTED_DEPARTMENT_NAME != ''">
|
||||||
|
<!-- 被检查单位 -->
|
||||||
and isd.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTED_DEPARTMENT_NAME}), '%')
|
and isd.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTED_DEPARTMENT_NAME}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_DEPARTMENT_NAME != null and pd.INSPECTION_DEPARTMENT_NAME != ''"><!-- 检查部门 -->
|
<if test="pd.INSPECTION_DEPARTMENT_NAME != null and pd.INSPECTION_DEPARTMENT_NAME != ''">
|
||||||
|
<!-- 检查部门 -->
|
||||||
and iod.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_DEPARTMENT_NAME}), '%')
|
and iod.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_DEPARTMENT_NAME}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_ORIGINATOR_NAME != null and pd.INSPECTION_ORIGINATOR_NAME != ''"><!-- 检查发起人 -->
|
<if test="pd.INSPECTION_ORIGINATOR_NAME != null and pd.INSPECTION_ORIGINATOR_NAME != ''">
|
||||||
|
<!-- 检查发起人 -->
|
||||||
and iou.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_ORIGINATOR_NAME}), '%')
|
and iou.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_ORIGINATOR_NAME}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_TYPE != null and pd.INSPECTION_TYPE != ''"><!-- 检查类型 -->
|
<if test="pd.INSPECTION_TYPE != null and pd.INSPECTION_TYPE != ''">
|
||||||
|
<!-- 检查类型 -->
|
||||||
and f.INSPECTION_TYPE = #{pd.INSPECTION_TYPE}
|
and f.INSPECTION_TYPE = #{pd.INSPECTION_TYPE}
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_SUBJECT != null and pd.INSPECTION_SUBJECT != ''"><!-- 检查题目 -->
|
<if test="pd.INSPECTION_SUBJECT != null and pd.INSPECTION_SUBJECT != ''">
|
||||||
|
<!-- 检查题目 -->
|
||||||
and f.INSPECTION_SUBJECT = #{pd.INSPECTION_SUBJECT,jdbcType=VARCHAR}
|
and f.INSPECTION_SUBJECT = #{pd.INSPECTION_SUBJECT,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_TIME_START != null and pd.INSPECTION_TIME_START != ''"><!-- 检查时间 -->
|
<if test="pd.INSPECTION_TIME_START != null and pd.INSPECTION_TIME_START != ''">
|
||||||
|
<!-- 检查时间 -->
|
||||||
and f.INSPECTION_TIME_START >= CONCAT(#{pd.INSPECTION_TIME_START}, ' 00:00')
|
and f.INSPECTION_TIME_START >= CONCAT(#{pd.INSPECTION_TIME_START}, ' 00:00')
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_TIME_END != null and pd.INSPECTION_TIME_END != ''"><!-- 检查时间 -->
|
<if test="pd.INSPECTION_TIME_END != null and pd.INSPECTION_TIME_END != ''">
|
||||||
|
<!-- 检查时间 -->
|
||||||
and f.INSPECTION_TIME_END <= CONCAT(#{pd.INSPECTION_TIME_END}, ' 23:59')
|
and f.INSPECTION_TIME_END <= CONCAT(#{pd.INSPECTION_TIME_END}, ' 23:59')
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_STATUS != null and pd.INSPECTION_STATUS != ''"><!-- 检查状态 -->
|
<if test="pd.INSPECTION_STATUS != null and pd.INSPECTION_STATUS != ''">
|
||||||
|
<!-- 检查状态 -->
|
||||||
<choose>
|
<choose>
|
||||||
<when test="pd.INSPECTION_STATUS == '3-7'">
|
<when test="pd.INSPECTION_STATUS == '3-7'">
|
||||||
and f.INSPECTION_STATUS in ('3', '4', '5', '6', '7', '8')
|
and f.INSPECTION_STATUS in ('3', '4', '5', '6', '7', '8')
|
||||||
|
@ -714,15 +728,20 @@
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 被检查单位 -->
|
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''">
|
||||||
|
<!-- 被检查单位 -->
|
||||||
and (
|
and (
|
||||||
isd.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}), '%')
|
isd.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}), '%')
|
||||||
OR iod.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}), '%')
|
OR iod.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}), '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
GROUP BY f.INSPECTION_ID
|
GROUP BY f.INSPECTION_ID
|
||||||
ORDER BY FIELD(if(f.INSPECTED_SITEUSER_ID = #{pd.loginUserId},f.INSPECTED_SITEUSER_ID,'1'), f.INSPECTED_SITEUSER_ID, '1'),
|
ORDER BY CASE
|
||||||
field(f.INSPECTION_STATUS , '3','4','6','7','5','0','1','2','8','-1','-2'),
|
WHEN f.INSPECTION_STATUS IN ('3', '4') AND f.INSPECTED_SITEUSER_ID = #{pd.loginUserId} THEN 1
|
||||||
|
WHEN f.INSPECTION_STATUS IN ('5', '6', '7') AND checkout = 1 THEN 2
|
||||||
|
ELSE 3
|
||||||
|
END,
|
||||||
|
field(f.INSPECTION_STATUS, '3', '6', '4', '7', '5', '0', '1', '2', '8', '-1', '-2'),
|
||||||
f.INSPECTION_TIME_END DESC
|
f.INSPECTION_TIME_END DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
<if test="sendTime != null and sendTime != ''">
|
<if test="sendTime != null and sendTime != ''">
|
||||||
SEND_TIME,
|
SEND_TIME,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="state != null">
|
||||||
|
STATE,
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
values
|
values
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
@ -44,10 +47,38 @@
|
||||||
<if test="sendTime != null and sendTime != ''">
|
<if test="sendTime != null and sendTime != ''">
|
||||||
#{sendTime},
|
#{sendTime},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="state != null">
|
||||||
|
#{state},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findUserIdByPhone" resultType="java.lang.String">
|
<select id="findUserIdByPhone" resultType="java.lang.String">
|
||||||
select USER_ID from sys_user where USERNAME = #{phone} and ISDELETE = 0 limit 1
|
select USER_ID from sys_user where USERNAME = #{phone} and ISDELETE = 0 limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="updateById">
|
||||||
|
update push_records
|
||||||
|
<set>
|
||||||
|
<if test="phone != null and phone != ''">
|
||||||
|
PHONE = #{phone},
|
||||||
|
</if>
|
||||||
|
<if test="messageTitle != null and messageTitle != ''">
|
||||||
|
MESSAGE_TITLE = #{messageTitle},
|
||||||
|
</if>
|
||||||
|
<if test="messageContent != null and messageContent != ''">
|
||||||
|
MESSAGE_CONTENT = #{messageContent},
|
||||||
|
</if>
|
||||||
|
<if test="messageType != null">
|
||||||
|
MESSAGE_TYPE = #{messageType},
|
||||||
|
</if>
|
||||||
|
<if test="sendTime != null and sendTime != ''">
|
||||||
|
SEND_TIME = #{sendTime},
|
||||||
|
</if>
|
||||||
|
<if test="state != null">
|
||||||
|
STATE = #{state},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where ID = #{id}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue