第一次提交

main
dongdingding 12 months ago
parent a8d7f52f5f
commit 8071b8069c

@ -0,0 +1,46 @@
package com.mudu.controller;
import com.mudu.base.domain.AjaxResult;
import com.mudu.entity.dto.request.ACheckRequest;
import com.mudu.entity.dto.response.ACheckResponse;
import com.mudu.service.ACheckService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import static com.mudu.base.domain.AjaxResult.success;
/**
* @author dong
* @since 2024/3/11 15:46
*/
@RestController
@RequestMapping("pharmaceuticals/aCheck")
@Api(tags = "检查点查询")
@Transactional(rollbackFor = Exception.class)
public class ACheckController {
@Autowired
private ACheckService aCheckService;
/**
*
*
* @param aCheckRequest
* @Param qymc
*/
@PostMapping("/checkData")
@ApiOperation(value = "查询所有检查点数据", response = ACheckResponse.class)
public AjaxResult selectAll(@RequestBody ACheckRequest aCheckRequest ) {
return success(aCheckService.selectAll(aCheckRequest));
}
}

@ -0,0 +1,330 @@
package com.mudu.controller;
import com.mudu.base.domain.AjaxResult;
import com.mudu.entity.*;
import com.mudu.entity.dto.request.ACheckQuatzRequest;
import com.mudu.entity.dto.request.ACheckQuatzZichaRequest;
import com.mudu.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import static com.mudu.base.domain.AjaxResult.success;
/**
* @author dong
* @since 2024/3/12 16:37
*/
@RestController
@RequestMapping("pharmaceuticals/aCheck")
@Api(tags = "新增")
@Transactional(rollbackFor = Exception.class)
public class AcheckTaskController {
/**
*
*/
@Resource
private ASafeXcrwService aSafeXcrwService;
/**
*
*/
@Resource
private ASafeXcrwjcxService aSafeXcrwjcxService;
@Resource
private ASafeXcrwjcxzgxxService aSafeXcrwjcxzgxxService;
@Resource
private ASafeYhzgxxService aSafeYhzgxxService;
@Resource
private ASafeZcrwService aSafeZcrwService;
@Resource
private ASafeZcrwjlService aSafeZcrwjlService;
/**
*
*
* @param list
* @Param qymc
*/
@PostMapping("/insert")
@ApiOperation(value = "新增创建时间为昨天且处于审批通过的工单数据")
public AjaxResult selectAll(@RequestBody List<ACheckQuatzRequest> list) {
for (ACheckQuatzRequest a : list) {
String xcrwuuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
String xcrwjcxUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
String xcrwjcxzgxxUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
String xcrwwzUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
String yhzgxxUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
//获取企业编号
String enterPriseId = a.getEnterpriseID();
//获取人员编号
String rybh = a.getRybh();
/**
* a_safe_xcrw
*/
ASafeXcrw aSafeXcrw = new ASafeXcrw();
//信息编号
aSafeXcrw.setXxbh(xcrwuuid);
//企业编号
aSafeXcrw.setQybh(enterPriseId);
//任务类型
aSafeXcrw.setRwlx("WGXC");
//巡查项
aSafeXcrw.setXcx(list.size());
//完成项
aSafeXcrw.setWcx(list.size());
//发现隐患数
aSafeXcrw.setFxyhs(list.size());
//检查时间
if (a.getReportDateTime() != null) {
aSafeXcrw.setJcsj(a.getReportDateTime());
} else {
aSafeXcrw.setJcsj(null);
}
//完成状态
aSafeXcrw.setWczt(1);
//入库人员
aSafeXcrw.setRkry(rybh);
//入库时间
aSafeXcrw.setRksj(new Date());
//更新时间
aSafeXcrw.setGxsj(new Date());
//更新人员
aSafeXcrw.setGxry(rybh);
//记录状态
aSafeXcrw.setJlzt(1);
//新增
aSafeXcrwService.save(aSafeXcrw);
/**
* a_safe_xcrwjcx
*/
ASafeXcrwjcx aSafeXcrwjcx = new ASafeXcrwjcx();
//信息编号
aSafeXcrwjcx.setXxbh(xcrwjcxUuid);
//企业编号
aSafeXcrwjcx.setQybh(enterPriseId);
//任务编号对应a_safe_xcrw的信息编号
aSafeXcrwjcx.setRwbh(xcrwuuid);
//企业风险点编号 对应a_safe_fxd的信息编号 todo
if (a.getCheckId() != null) {
aSafeXcrwjcx.setQyfxdbh(a.getCheckId());
} else {
aSafeXcrwjcx.setQyfxdbh("测试");
}
//周期编号 todo
aSafeXcrwjcx.setZqbh("测试");
//完成状态
aSafeXcrwjcx.setWczt(1);
//检查项结果
aSafeXcrwjcx.setJcxjg(String.valueOf(1));
//隐患描述
aSafeXcrwjcx.setYhms(a.getDescription());
//检查时间
if (a.getReportDateTime() != null) {
aSafeXcrwjcx.setJcsj(a.getReportDateTime());
} else {
aSafeXcrwjcx.setJcsj(null);
}
//整改时间
if (a.getReportDateTime() != null) {
aSafeXcrwjcx.setZgsj(a.getReportDateTime());
} else {
aSafeXcrwjcx.setZgsj(null);
}
//整改期限
aSafeXcrwjcx.setZgqx(a.getNeedFinalDateTime());
//整改状态
aSafeXcrwjcx.setZgzt(1);
//整改逾期
Date currentTime = new Date(); // 获取当前时间
if (currentTime.after(a.getNeedFinalDateTime())) {
// 超过截止时间,
aSafeXcrwjcx.setZgyq(1);
} else {
// 未超过截止时间,
aSafeXcrwjcx.setZgyq(0);
}
//位置编号 TODO
//巡查位置编号 TODO
//巡查风险点编号 TODO
//任务类型
aSafeXcrwjcx.setRwlx(3);
//入库人员
aSafeXcrwjcx.setRkry(rybh);
//入库时间
aSafeXcrwjcx.setRksj(new Date());
//更新人员
aSafeXcrwjcx.setGxry(rybh);
//更新时间
aSafeXcrwjcx.setGxsj(new Date());
//记录状态
aSafeXcrwjcx.setJlzt(1);
aSafeXcrwjcxService.save(aSafeXcrwjcx);
/**
* / a_safe_xcrwjcxzgxx
*/
ASafeXcrwjcxzgxx aSafeXcrwjcxzgxx = new ASafeXcrwjcxzgxx();
//信息编号
aSafeXcrwjcxzgxx.setXxbh(xcrwjcxzgxxUuid);
//任务编号对应a_safe_xcrw的信息编号
aSafeXcrwjcx.setRwbh(xcrwuuid);
//巡查检查项编号 a_safe_xcrwjcx的XXBH
aSafeXcrwjcxzgxx.setXcjcxbh(xcrwjcxUuid);
//描述 todo
aSafeXcrwjcxzgxx.setMs("测试");
//时间
aSafeXcrwjcxzgxx.setSj(a.getFinalDateTime());
//类型
aSafeXcrwjcxzgxx.setSjlx("ZG");
//是否合格
aSafeXcrwjcxzgxx.setSfhg(1);
//到期日期
aSafeXcrwjcxzgxx.setDqrq(a.getNeedFinalDateTime());
//入库人员
aSafeXcrwjcxzgxx.setRkry(rybh);
//入库时间
aSafeXcrwjcxzgxx.setRksj(new Date());
//更新人员
aSafeXcrwjcxzgxx.setGxry(rybh);
//更新时间
aSafeXcrwjcxzgxx.setGxsj(new Date());
//记录状态
aSafeXcrwjcxzgxx.setJlzt(1);
aSafeXcrwjcxzgxxService.save(aSafeXcrwjcxzgxx);
/**
* a_safe_xcrwwz
*/
//xxbh
/**
* a_safe_yhzgxx
*/
ASafeYhzgxx aSafeYhzgxx = new ASafeYhzgxx();
//信息编号
aSafeYhzgxx.setXxbh(yhzgxxUuid);
//任务编号
aSafeYhzgxx.setRwbh(xcrwuuid);
//位置编号 todo
aSafeYhzgxx.setWzbh(null);
//企业编号
aSafeYhzgxx.setQybh(enterPriseId);
//周期编号
aSafeYhzgxx.setZqbh(null);
//企业风险点编号 对应a_safe_fxd的信息编号 todo
if (a.getCheckId() != null) {
aSafeYhzgxx.setQyfxdbh(a.getCheckId());
} else {
aSafeYhzgxx.setQyfxdbh("测试");
}
//隐患来源
aSafeYhzgxx.setYhly("1");
//检查时间
if (a.getReportDateTime() != null) {
aSafeYhzgxx.setJcsj(a.getReportDateTime());
} else {
aSafeYhzgxx.setJcsj(null);
}
//整改期限
aSafeYhzgxx.setZgqx(a.getNeedFinalDateTime());
//不合格检查项a_safe_xcrwjcx中JCXJG=1的数量
aSafeYhzgxx.setBhgjcx(list.size());
//整改状态
aSafeYhzgxx.setZgzt(1);
//巡查位置编号a_safe_xcrwwz的XXBH TODO
//入库人员
aSafeYhzgxx.setRkry(rybh);
//入库时间
aSafeYhzgxx.setRksj(new Date());
//更新人员
aSafeYhzgxx.setGxry(rybh);
//更新时间
aSafeYhzgxx.setGxsj(new Date());
//记录状态
aSafeYhzgxx.setJlzt(1);
aSafeYhzgxxService.save(aSafeYhzgxx);
/**
* a_safe_rwfj
*/
//todo 少实体类
}
return success();
}
@PostMapping("/ziChainsert")
@ApiOperation(value = "自查")
public AjaxResult zicha(@RequestBody List<ACheckQuatzZichaRequest> list) {
for (ACheckQuatzZichaRequest a : list) {
/**
* a_safe_zcrw
*/
String zcrwUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
String zcrwjlUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
ASafeZcrw aSafeZcrw = new ASafeZcrw();
aSafeZcrw.setXxbh(zcrwUuid);
//企业编号
aSafeZcrw.setQybh(a.getEnterpriseID());
//自查项
aSafeZcrw.setZcx(list.size());
//完成项
aSafeZcrw.setWcx(list.size());
//发现隐患数
aSafeZcrw.setFxyhs(list.size());
//完成状态
aSafeZcrw.setWczt(1);
//入库时间
aSafeZcrw.setRksj(new Date());
//更新时间
aSafeZcrw.setGxsj(new Date());
aSafeZcrwService.save(aSafeZcrw);
/**
* a_safe_zcrwjl
*/
ASafeZcrwjl aSafeZcrwjl = new ASafeZcrwjl();
aSafeZcrwjl.setXxbh(zcrwjlUuid);
//企业编号
aSafeZcrwjl.setQybh(a.getEnterpriseID());
//任务编号
aSafeZcrwjl.setRwbh(zcrwUuid);
//企业风险点编号
aSafeZcrwjl.setQyfxdbh(a.getCheckId());
//入库时间
aSafeZcrwjl.setRksj(new Date());
//更新时间
aSafeZcrwjl.setGxsj(new Date());
aSafeZcrwjlService.save(aSafeZcrwjl);
/**
*a_safe_zcrwwz
*/
// 少表 todo
}
return success();
}
}

@ -0,0 +1,70 @@
package com.mudu.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
* @author dong
* @since 2024/3/12 14:18
*/
@Data
@ApiModel("定时任务实体类")
public class ACheckQuatzEntity {
/**
* id
*/
@ApiModelProperty(value = "归属地")
private String locationName;
/**
*
*/
@ApiModelProperty(value = "企业名称")
private String enterpriseName;
/**
* (-2,-1,0,1)
*/
@ApiModelProperty(value = "整改是否完成(-2专家拒绝,-1是需要专家复查未完成,0未成,1全部完成)")
private String isFinal;
/**
*
*/
@ApiModelProperty("上报时间(如果巡查一起提交,获取巡查的巡查日期")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime ReportDateTime;
/**
*
*/
@ApiModelProperty(value = "上报人")
private String ReportPersonName;
/**
*
*/
@ApiModelProperty(value = "隐患内容")
private String Description;
/**
*
*/
@ApiModelProperty(value = "现场图片")
private String RelativePath;
}

@ -0,0 +1,109 @@
package com.mudu.entity.dto.request;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author dong
* @since 2024/3/12 14:18
*/
@Data
@ApiModel("定时任务请求类")
public class ACheckQuatzRequest {
/**
* id
*/
@ApiModelProperty(value = "工单id")
private String id;
/**
*
*/
@ApiModelProperty(value = "归属地")
private String locationName;
/**
*
*/
@ApiModelProperty(value = "企业名称")
private String enterpriseName;
/**
*
*/
@ApiModelProperty(value = "企业编号")
private String enterpriseID;
/**
*
*/
@ApiModelProperty(value = "人员编号")
private String rybh;
/**
* (-2,-1,0,1)
*/
@ApiModelProperty(value = "整改是否完成(-2专家拒绝,-1是需要专家复查未完成,0未成,1全部完成)")
private String isFinal;
/**
*
*/
@ApiModelProperty("上报时间(如果巡查一起提交,获取巡查的巡查日期")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date ReportDateTime;
/**
*
*/
@ApiModelProperty(value = "上报人")
private String ReportPersonName;
/**
*
*/
@ApiModelProperty(value = "隐患内容")
private String Description;
/**
*
*/
@ApiModelProperty(value = "现场图片")
private String RelativePath;
/**
* id
*/
@ApiModelProperty(value = "风险点id")
private String checkId;
/**
*
*/
@ApiModelProperty("整改完成日期")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date FinalDateTime;
/**
*
*/
@ApiModelProperty("整改要求完成日期")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date NeedFinalDateTime;
}

@ -0,0 +1,34 @@
package com.mudu.entity.dto.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author dong
* @since 2024/3/14 13:21
*/
@Data
@ApiModel("定时任务自查实体类")
public class ACheckQuatzZichaRequest {
/**
* id
*/
@ApiModelProperty(value = "企业id")
private String EnterpriseID;
/**
* id
*/
@ApiModelProperty(value = "工单id")
private String taskId;
/**
* id
*/
@ApiModelProperty(value = "风险点id")
private String checkId;
}

@ -0,0 +1,29 @@
package com.mudu.entity.dto.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author dong
* @since 2024/3/11 16:23
*/
@Data
@ApiModel(value = "检查点请求类")
public class ACheckRequest implements Serializable {
/**
*
*/
@ApiModelProperty(value = "企业编号")
private String qybh;
/**
*
*/
@ApiModelProperty(value = "企业名称")
private String qymc;
}

@ -0,0 +1,27 @@
package com.mudu.entity.dto.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author dong
* @since 2024/3/11 16:48
*/
@Data
@ApiModel(value = "检查点响应类")
public class ACheckResponse {
/**
*
*/
@ApiModelProperty(value = "风险点")
private String fxd;
/**
*
*/
@ApiModelProperty(value = "信息编号")
private String xxbh;
}

@ -0,0 +1,26 @@
package com.mudu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mudu.entity.ASafeFxd;
import com.mudu.entity.dto.request.ACheckRequest;
import com.mudu.entity.dto.response.ACheckResponse;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*
* @author dong
* @since 2024/3/11 16:29
*/
public interface ACheckMapper extends BaseMapper<ASafeFxd> {
/**
*
*
* @param req
* @return
*/
List<ACheckResponse> selectAll(@Param("req") ACheckRequest req);
}

@ -0,0 +1,26 @@
package com.mudu.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mudu.entity.ASafeFxd;
import com.mudu.entity.dto.request.ACheckRequest;
import com.mudu.entity.dto.response.ACheckResponse;
import java.util.List;
/**
*
*
* @author dong
* @since 2024/3/11 16:24
*/
public interface ACheckService extends IService<ASafeFxd> {
/**
*
*
* @param aCheckRequest
* @return
*/
List<ACheckResponse> selectAll(ACheckRequest aCheckRequest);
}

@ -0,0 +1,28 @@
package com.mudu.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mudu.entity.ASafeFxd;
import com.mudu.entity.dto.request.ACheckRequest;
import com.mudu.entity.dto.response.ACheckResponse;
import com.mudu.mapper.ACheckMapper;
import com.mudu.service.ACheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author dong
* @since 2024/3/11 16:25
*/
@Service("aCheckService")
public class ACheckServiceImpl extends ServiceImpl<ACheckMapper, ASafeFxd> implements ACheckService {
@Autowired
private ACheckMapper aCheckMapper;
@Override
public List<ACheckResponse> selectAll(ACheckRequest aCheckRequest) {
return aCheckMapper.selectAll(aCheckRequest);
}
}

@ -4,9 +4,9 @@ server:
# DataSource Config # DataSource Config
spring: spring:
datasource: datasource:
url: jdbc:mysql://localhost:3306/wzawb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:3306/db_jiangning_umale?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: 123456 password: adminadmin
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
# 日志配置 # 日志配置

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mudu.mapper.ACheckMapper">
<select id="selectAll" resultType="com.mudu.entity.dto.response.ACheckResponse">
SELECT a.fxd,a.xxbh FROM `a_safe_fxd` a left join a_safe_qyjcxx b on a.QYBH=b.XXBH
<where>
<if test="req.qymc != null and req.qymc != ''">
b.qymc=#{req.qymc}
</if>
<if test="req.qybh != null and req.qybh != ''">
b.tyshxybm=#{req.qybh}
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save