From e34cef3ad36c9e27d6bd9743f6c1e18d4bfc0820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E5=9B=BD=E4=B8=9C?= Date: Tue, 27 Sep 2022 18:02:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/rzyc/bean/ent/CertificatesAddDto.java | 76 ++ .../rzyc/bean/ent/CertificatesPageDto.java | 50 ++ .../rzyc/mapper/EntCertificatesMapper.java | 23 + .../java/com/rzyc/model/EntCertificates.java | 153 ++++ .../mapper/EntCertificatesMapper.xml | 31 + .../main/resources/mapper/OATaskMapper.xml | 2 +- .../com/rzyc/controller/BaseController.java | 8 + .../rzyc/controller/PcCompanyController.java | 654 +++++++++++++++++- .../src/main/resources/application.yml | 2 +- .../com/rzyc/controller/BaseController.java | 4 + .../rzyc/controller/PcPersonalController.java | 2 +- 11 files changed, 998 insertions(+), 7 deletions(-) create mode 100644 inventory-dao/src/main/java/com/rzyc/bean/ent/CertificatesAddDto.java create mode 100644 inventory-dao/src/main/java/com/rzyc/bean/ent/CertificatesPageDto.java create mode 100644 inventory-dao/src/main/java/com/rzyc/mapper/EntCertificatesMapper.java create mode 100644 inventory-dao/src/main/java/com/rzyc/model/EntCertificates.java create mode 100644 inventory-dao/src/main/resources/mapper/EntCertificatesMapper.xml diff --git a/inventory-dao/src/main/java/com/rzyc/bean/ent/CertificatesAddDto.java b/inventory-dao/src/main/java/com/rzyc/bean/ent/CertificatesAddDto.java new file mode 100644 index 0000000..fee34d1 --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/bean/ent/CertificatesAddDto.java @@ -0,0 +1,76 @@ +package com.rzyc.bean.ent; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + * @author dong + * @date 2022-09-27 14:58 + * @Version V1.0 + */ +public class CertificatesAddDto { + + @NotNull(message = "证照不能为空") + @ApiModelProperty(value = "证照id") + private String certificatesId; + + @NotNull(message = "企业不能为空") + @ApiModelProperty(value = "企业id") + private String enterpriseId; + + @NotNull(message = "证照名不能为空") + @ApiModelProperty(value = "证照名") + private String name; + + @NotNull(message = "证照图片不能为空") + @ApiModelProperty(value = "文件地址") + private String filePath; + + @NotNull(message = "证照到期时间不能为空") + @ApiModelProperty(value = "证照到期时间") + private Date expireTime; + + public String getCertificatesId() { + return certificatesId; + } + + public void setCertificatesId(String certificatesId) { + this.certificatesId = certificatesId; + } + + public String getEnterpriseId() { + return enterpriseId; + } + + public void setEnterpriseId(String enterpriseId) { + this.enterpriseId = enterpriseId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public Date getExpireTime() { + return expireTime; + } + + public void setExpireTime(Date expireTime) { + this.expireTime = expireTime; + } +} diff --git a/inventory-dao/src/main/java/com/rzyc/bean/ent/CertificatesPageDto.java b/inventory-dao/src/main/java/com/rzyc/bean/ent/CertificatesPageDto.java new file mode 100644 index 0000000..8e29e7b --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/bean/ent/CertificatesPageDto.java @@ -0,0 +1,50 @@ +package com.rzyc.bean.ent; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; + +/** + * @author dong + * @date 2022-09-27 14:52 + * @Version V1.0 + */ +public class CertificatesPageDto { + + @NotNull(message = "企业不能为空") + @ApiModelProperty(value = "企业id",required = true) + private String enterpriseId; + + @NotNull(message = "页码不能为空") + @ApiModelProperty(value = "页码",required = true,example = "1") + private Integer page;//当前页 + + @NotNull(message = "每页条数不能为空") + @ApiModelProperty(value = "每页条数",required = true,example = "10") + private Integer pageSize;//每页显示多少条 + + public String getEnterpriseId() { + return enterpriseId; + } + + public void setEnterpriseId(String enterpriseId) { + this.enterpriseId = enterpriseId; + } + + public Integer getPage() { + return page; + } + + public void setPage(Integer page) { + this.page = page; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } +} diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/EntCertificatesMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/EntCertificatesMapper.java new file mode 100644 index 0000000..311e40a --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/mapper/EntCertificatesMapper.java @@ -0,0 +1,23 @@ +package com.rzyc.mapper; + +import com.rzyc.model.EntCertificates; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author + * @since 2022-09-27 + */ +@Repository +public interface EntCertificatesMapper extends BaseMapper { + + /*证件列表*/ + List certificatesList(@Param("enterpriseId") String enterpriseId); +} diff --git a/inventory-dao/src/main/java/com/rzyc/model/EntCertificates.java b/inventory-dao/src/main/java/com/rzyc/model/EntCertificates.java new file mode 100644 index 0000000..539fadd --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/model/EntCertificates.java @@ -0,0 +1,153 @@ +package com.rzyc.model; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + *

+ * + *

+ * + * @author + * @since 2022-09-27 + */ +@TableName("ent_certificates") +@ApiModel(value="EntCertificates对象", description="") +public class EntCertificates implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "证照id") + @TableId("certificates_id") + private String certificatesId; + + @ApiModelProperty(value = "企业id") + @TableField("enterprise_id") + private String enterpriseId; + + @ApiModelProperty(value = "证照名") + @TableField("name") + private String name; + + @ApiModelProperty(value = "文件地址") + @TableField("file_path") + private String filePath; + + @ApiModelProperty(value = "证照到期时间") + @TableField("expire_time") + private Date expireTime; + + @ApiModelProperty(value = "证件状态 1、正常 2、即将到期 3、已到期") + @TableField("state") + private Integer state; + + @ApiModelProperty(value = "创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty(value = "创建时间") + @TableField("create_time") + private Date createTime; + + @ApiModelProperty(value = "修改时间") + @TableField("modify_time") + private Date modifyTime; + + @ApiModelProperty(value = "修改人") + @TableField("modify_by") + private String modifyBy; + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + public String getCertificatesId() { + return certificatesId; + } + + public void setCertificatesId(String certificatesId) { + this.certificatesId = certificatesId; + } + + public String getEnterpriseId() { + return enterpriseId; + } + + public void setEnterpriseId(String enterpriseId) { + this.enterpriseId = enterpriseId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + public Date getExpireTime() { + return expireTime; + } + + public void setExpireTime(Date expireTime) { + this.expireTime = expireTime; + } + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + public Date getModifyTime() { + return modifyTime; + } + + public void setModifyTime(Date modifyTime) { + this.modifyTime = modifyTime; + } + public String getModifyBy() { + return modifyBy; + } + + public void setModifyBy(String modifyBy) { + this.modifyBy = modifyBy; + } + + @Override + public String toString() { + return "EntCertificates{" + + "certificatesId=" + certificatesId + + ", enterpriseId=" + enterpriseId + + ", name=" + name + + ", filePath=" + filePath + + ", expireTime=" + expireTime + + ", createBy=" + createBy + + ", createTime=" + createTime + + ", modifyTime=" + modifyTime + + ", modifyBy=" + modifyBy + + "}"; + } +} diff --git a/inventory-dao/src/main/resources/mapper/EntCertificatesMapper.xml b/inventory-dao/src/main/resources/mapper/EntCertificatesMapper.xml new file mode 100644 index 0000000..8046dcb --- /dev/null +++ b/inventory-dao/src/main/resources/mapper/EntCertificatesMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + certificates_id, enterprise_id, name, file_path, expire_time, state,create_by, create_time, modify_time, modify_by + + + + + + diff --git a/inventory-dao/src/main/resources/mapper/OATaskMapper.xml b/inventory-dao/src/main/resources/mapper/OATaskMapper.xml index ef5f84c..b0bf47f 100644 --- a/inventory-dao/src/main/resources/mapper/OATaskMapper.xml +++ b/inventory-dao/src/main/resources/mapper/OATaskMapper.xml @@ -272,7 +272,7 @@ AppStatus, title,Subject,Frequency, IsFinish, del_state, CreatedOn, CreatedBy, - ModifiedOn, ModifiedBy, DocBody + ModifiedOn, ModifiedBy ) values diff --git a/inventory-ent/src/main/java/com/rzyc/controller/BaseController.java b/inventory-ent/src/main/java/com/rzyc/controller/BaseController.java index 3225327..fb289f6 100644 --- a/inventory-ent/src/main/java/com/rzyc/controller/BaseController.java +++ b/inventory-ent/src/main/java/com/rzyc/controller/BaseController.java @@ -444,6 +444,10 @@ public class BaseController { @Autowired protected SysDocumenttempMapper sysDocumenttempMapper; + //企业证照 + @Autowired + protected EntCertificatesMapper entCertificatesMapper; + /** * 岗位不需要的字符串 */ @@ -2260,6 +2264,7 @@ public class BaseController { Date end = DateUtils.parseString2Date(taskTime.getEndTime(),Constants.DATA); oaTask.setStartdate(start); oaTask.setPlanenddate(end); + oaTask.setDelState(DelState.NOT_DEL.getState()); oaTask.setCreatedby(sysUser.getChinaname()); oaTask.setCreatedon(new Date()); oaTask.setModifiedby(sysUser.getChinaname()); @@ -2294,6 +2299,7 @@ public class BaseController { Date end = DateUtils.parseString2Date(taskTime.getEndTime(),Constants.DATA); oaTask.setStartdate(start); oaTask.setPlanenddate(end); + oaTask.setDelState(DelState.NOT_DEL.getState()); oaTask.setCreatedby(sysUser.getChinaname()); oaTask.setCreatedon(new Date()); oaTask.setModifiedby(sysUser.getChinaname()); @@ -2327,6 +2333,7 @@ public class BaseController { Date end = DateUtils.parseString2Date(endTime,Constants.DATA); oaTask.setStartdate(start); oaTask.setPlanenddate(end); + oaTask.setDelState(DelState.NOT_DEL.getState()); oaTask.setCreatedby(sysUser.getChinaname()); oaTask.setCreatedon(new Date()); oaTask.setModifiedby(sysUser.getChinaname()); @@ -2358,6 +2365,7 @@ public class BaseController { Date end = DateUtils.parseString2Date(taskTime.getEndTime(),Constants.DATA); oaTask.setStartdate(start); oaTask.setPlanenddate(end); + oaTask.setDelState(DelState.NOT_DEL.getState()); oaTask.setCreatedby(sysUser.getChinaname()); oaTask.setCreatedon(new Date()); oaTask.setModifiedby(sysUser.getChinaname()); diff --git a/inventory-ent/src/main/java/com/rzyc/controller/PcCompanyController.java b/inventory-ent/src/main/java/com/rzyc/controller/PcCompanyController.java index 1e2fe72..b30c14d 100644 --- a/inventory-ent/src/main/java/com/rzyc/controller/PcCompanyController.java +++ b/inventory-ent/src/main/java/com/rzyc/controller/PcCompanyController.java @@ -1,13 +1,29 @@ package com.rzyc.controller; import com.alibaba.fastjson.JSONArray; +import com.common.utils.DateUtils; +import com.common.utils.RandomNumber; import com.common.utils.StringUtils; +import com.common.utils.TypeConversion; import com.common.utils.encryption.PasswdFactory; +import com.common.utils.excel.ExcelUtils; import com.common.utils.jwt.JwtUtil; import com.common.utils.model.Code; import com.common.utils.model.Message; +import com.common.utils.model.Pager; import com.common.utils.model.SingleResult; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import com.rzyc.advice.LoginAuth; +import com.rzyc.bean.SysEnterpriseDo; +import com.rzyc.bean.check.dto.LawAddDto; +import com.rzyc.bean.check.dto.TalkAddDto; +import com.rzyc.bean.ent.*; import com.rzyc.bean.user.dto.LoginDto; +import com.rzyc.model.Accident; +import com.rzyc.model.EntCertificates; +import com.rzyc.model.check.*; +import com.rzyc.model.ent.EntBillCon; import com.rzyc.model.ent.SysEnterprise; import com.rzyc.model.user.SysUnit; import com.rzyc.model.user.SysUser; @@ -15,15 +31,22 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.beanutils.ConvertUtils; +import org.apache.commons.beanutils.converters.DateConverter; import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; import java.util.List; /** @@ -168,4 +191,627 @@ public class PcCompanyController extends BaseController{ return result; } + + /** + * PC企业详细检查信息 + * */ + @ApiOperation(value = "PC企业详细检查信息", notes = "PC企业详细检查信息") + @ApiImplicitParams({ + @ApiImplicitParam(name = "SysEnterpriseId", value = "公司id", required = true, dataType = "string"), + @ApiImplicitParam(name = "page", value = "页数", required = true, dataType = "int"), + @ApiImplicitParam(name = "pageSize", value = "条数", required = true, dataType = "int") + }) + @PostMapping("/companyDetailCheck") + @ResponseBody + public SingleResult> companyDetailCheck(String SysEnterpriseId, Integer page, Integer pageSize)throws Exception { + SingleResult singleResult = new SingleResult(); + Pager pager = new Pager<>(); + PageHelper.startPage(page, pageSize); + Page bookEntChecks = (Page)bookEntCheckMapper.companyDetailCheck(SysEnterpriseId); + getDatePage(pager,bookEntChecks); + if (bookEntChecks != null){ + singleResult.setMessage(Message.SUCCESS); + singleResult.setData(pager); + singleResult.setCode(Code.SUCCESS.getCode()); + }else { + singleResult.setMessage(Message.ERROR); + singleResult.setCode(Code.ERROR.getCode()); + } + return singleResult; + } + + /** + * PC企业详细事故管理 + * */ + @ApiOperation(value = "PC企业详细事故管理", notes = "PC企业详细事故管理") + @ApiImplicitParams({ + @ApiImplicitParam(name = "SysEnterpriseId", value = "公司id", required = true, dataType = "string"), + @ApiImplicitParam(name = "page", value = "页数", required = true, dataType = "int"), + @ApiImplicitParam(name = "pageSize", value = "条数", required = true, dataType = "int") + }) + @PostMapping("/companyDetailAccident") + @ResponseBody + public SingleResult> companyDetailAccident(String SysEnterpriseId, Integer page, Integer pageSize)throws Exception { + SingleResult singleResult = new SingleResult(); + Pager pager = new Pager<>(); + PageHelper.startPage(page, pageSize); + Listaccidents = accidentMapper.accidentDetailByCompanyId(SysEnterpriseId); + PageaccidentPage =(Page) accidents; + getDatePage(pager,accidentPage); + if (accidents != null){ + singleResult.setMessage(Message.SUCCESS); + singleResult.setData(pager); + singleResult.setCode(Code.SUCCESS.getCode()); + }else { + singleResult.setMessage(Message.ERROR); + singleResult.setCode(Code.ERROR.getCode()); + } + return singleResult; + } + + /** + * PC企业详细隐患管理 + * */ + @ApiOperation(value = "PC企业详细隐患管理", notes = "PC企业详细隐患管理") + @ApiImplicitParams({ + @ApiImplicitParam(name = "SysEnterpriseId", value = "公司id", required = true, dataType = "string"), + @ApiImplicitParam(name = "page", value = "页数", required = true, dataType = "int"), + @ApiImplicitParam(name = "pageSize", value = "条数", required = true, dataType = "int") + }) + @PostMapping("/companyDetailDanger") + @ResponseBody + public SingleResult> companyDetailDanger(String SysEnterpriseId, Integer page, Integer pageSize)throws Exception { + SingleResult singleResult = new SingleResult(); + Pager pager = new Pager<>(); + PageHelper.startPage(page, pageSize); + ListbookEntHTS = bookEntHTMapper.dangerDetailByCompanyId(SysEnterpriseId); + PagebookEnt =(Page) bookEntHTS; + getDatePage(pager,bookEnt); + if (bookEntHTS != null){ + singleResult.setMessage(Message.SUCCESS); + singleResult.setData(pager); + singleResult.setCode(Code.SUCCESS.getCode()); + }else { + singleResult.setMessage(Message.ERROR); + singleResult.setCode(Code.ERROR.getCode()); + } + return singleResult; + } + + /** + * PC企业详细执法记录 + * */ + @ApiOperation(value = "PC企业详细执法记录", notes = "PC企业详细执法记录") + @ApiImplicitParams({ + @ApiImplicitParam(name = "SysEnterpriseId", value = "公司id", required = true, dataType = "string"), + @ApiImplicitParam(name = "page", value = "页数", required = true, dataType = "int"), + @ApiImplicitParam(name = "bookenthtid", value = "隐患id"), + @ApiImplicitParam(name = "pageSize", value = "条数", required = true, dataType = "int") + }) + @PostMapping("/companyDetailLawEnforcement") + @ResponseBody + public SingleResult> companyDetailLawEnforcement(String SysEnterpriseId, String bookenthtid, + Integer page, Integer pageSize)throws Exception { + SingleResult singleResult = new SingleResult(); + Pager pager = new Pager<>(); + PageHelper.startPage(page, pageSize); + ListbookLaws = bookLawMapper.lawEnforcementDetailByCompanyId(SysEnterpriseId,bookenthtid); + Pagelaws =(Page) bookLaws; + getDatePage(pager,laws); + if (bookLaws != null){ + singleResult.setMessage(Message.SUCCESS); + singleResult.setData(pager); + singleResult.setCode(Code.SUCCESS.getCode()); + }else { + singleResult.setMessage(Message.ERROR); + singleResult.setCode(Code.ERROR.getCode()); + } + return singleResult; + } + + /** + * PC企业详细约谈记录 + * */ + @ApiOperation(value = "PC企业详细约谈记录", notes = "PC企业详细约谈记录") + @ApiImplicitParams({ + @ApiImplicitParam(name = "SysEnterpriseId", value = "公司id", required = true, dataType = "string"), + @ApiImplicitParam(name = "bookenthtid", value = "隐患id"), + @ApiImplicitParam(name = "page", value = "页数", required = true, dataType = "int"), + @ApiImplicitParam(name = "pageSize", value = "条数", required = true, dataType = "int") + }) + @PostMapping("/companyDetailInterview") + @ResponseBody + public SingleResult> companyDetailInterview(String SysEnterpriseId, + String bookenthtid, Integer page, Integer pageSize)throws Exception { + SingleResult singleResult = new SingleResult(); + Pager pager = new Pager<>(); + PageHelper.startPage(page, pageSize); + ListbookTalks = bookTalkMapper.interviewDetailByCompanyId(SysEnterpriseId,bookenthtid); + Pagebk =(Page) bookTalks; + getDatePage(pager,bk); + if (bookTalks != null){ + singleResult.setMessage(Message.SUCCESS); + singleResult.setData(pager); + singleResult.setCode(Code.SUCCESS.getCode()); + }else { + singleResult.setMessage(Message.ERROR); + singleResult.setCode(Code.ERROR.getCode()); + } + return singleResult; + } + + /** + * PC企业新增约谈 + * */ + @ApiOperation(value = "PC企业新增约谈", notes = "PC企业新增约谈") + + @PostMapping("/companyAddInterview") + @ResponseBody + public SingleResult companyAddInterview(@Valid TalkAddDto talkAddDto)throws Exception { + SingleResult singleResult = new SingleResult(); + BookTalkWithBLOBs bookTalkWithBLOBs = new BookTalkWithBLOBs(); + bookTalkWithBLOBs.setSysenterpriseid(talkAddDto.getSysenterpriseid()); + bookTalkWithBLOBs.setTalktime(DateUtils.parseString2Date(talkAddDto.getTalktime(),"yyyy-MM-dd")); + bookTalkWithBLOBs.setTalkcontent(talkAddDto.getTalkcontent()); + bookTalkWithBLOBs.setRemake(talkAddDto.getRemake()); + bookTalkWithBLOBs.setBookenthtid(talkAddDto.getBookenthtid()); + String userId = getUserId(); + bookTalkWithBLOBs.setCreatedby(userId); + bookTalkWithBLOBs.setModifiedby(userId); + bookTalkWithBLOBs.setCreatedon(new Date()); + bookTalkWithBLOBs.setModifiedon(new Date()); + bookTalkWithBLOBs.setBooktalkid(talkAddDto.getBooktalkid()); + bookTalkMapper.insert(bookTalkWithBLOBs); + return singleResult; + } + + /** + * PC企业新增执法 + * */ + @ApiOperation(value = "PC企业新增执法", notes = "PC企业新增执法") + @PostMapping("/companyAddBookLaw") + @ResponseBody + public SingleResult companyAddBookLaw(@Valid LawAddDto lawAddDto)throws Exception { + SingleResult singleResult = new SingleResult(); + BookLawWithBLOBs bookLawWithBLOBs = new BookLawWithBLOBs(); + bookLawWithBLOBs.setLawcontent(lawAddDto.getLawcontent()); + bookLawWithBLOBs.setSysenterpriseid(lawAddDto.getSysenterpriseid()); + bookLawWithBLOBs.setLawtime(DateUtils.parseString2Date(lawAddDto.getLawtime(),"yyyy-MM-dd")); + bookLawWithBLOBs.setRemake(lawAddDto.getRemake()); + String userId = getUserId(); + bookLawWithBLOBs.setCreatedon(new Date()); + bookLawWithBLOBs.setModifiedon(new Date()); + bookLawWithBLOBs.setCreatedby(userId); + bookLawWithBLOBs.setModifiedby(userId); + bookLawWithBLOBs.setBooklawid(lawAddDto.getBooklawid()); + bookLawWithBLOBs.setBookenthtid(lawAddDto.getBookenthtid()); + bookLawMapper.insert(bookLawWithBLOBs); + return singleResult; + } + + + /** + * PC企业重新生成清单 + * */ + @ApiOperation(value = "PC企业重新生成清单/需要配合前端测试", notes = "PC企业重新生成清单/需要配合前端测试") + @PostMapping("/resetBills") + @ResponseBody + @Transactional + public SingleResult resetBills(@Valid @RequestBody SysEnterprise sysEnterprise, HttpServletRequest servletRequest)throws Exception { + SingleResult singleResult = new SingleResult(); + //查询唯一的一个日常检查 + ChkGovBill chkGovBill = chkGovBillMapper.selectByCompanyId(sysEnterprise.getSysenterpriseid()); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + String token = servletRequest.getHeader("userToken"); + String userId = JwtUtil.getTokenMsg(token); + SysUser sysUser = super.getUser(userId); + if (chkGovBill == null){ + /** + * 先判断是否有日常没有就创建,然后替换基础清单信息, + * 然后删除清单下所有对应的检查项(自己公司的) + * ,然后重新根据安全类别找出对应的检查项 + * 放入企业对应的清单下 + * */ + chkGovBill = new ChkGovBill(); + chkGovBill.setBaseinclassid(sysEnterprise.getBaseinclassid()); + chkGovBill.setBasesafeclassid(sysEnterprise.getBasesafeclassid()); + chkGovBill.setChkbillname(sysEnterprise.getEntname() + "日常检查"); + chkGovBill.setSysEnterpriseId(sysEnterprise.getSysenterpriseid()); + chkGovBill.setChkbillno(simpleDateFormat.format(new Date())); + chkGovBill.setChkbilldate(new Timestamp(System.currentTimeMillis())); + chkGovBill.setCreatedby(sysUser.getChinaname()); + chkGovBill.setCreatedon(new Date()); + chkGovBill.setSysUnitId(sysEnterprise.getManagerDept()); + String uid = RandomNumber.getUUid(); + chkGovBill.setChkgovbillid(uid); + chkGovBill.setDelState(1); + chkGovBillMapper.insertByPc(chkGovBill); + EntBillCon entcon = new EntBillCon(); + entcon.setEntbillconid(RandomNumber.getUUid()); + entcon.setSysenterpriseid(chkGovBill.getSysEnterpriseId()); + entcon.setChkgovbillid(uid); + entcon.setCreatedby(sysUser.getChinaname()); + entcon.setCreatedon(new Date()); + entcon.setModifiedby(sysUser.getChinaname()); + entcon.setModifiedon(new Date()); + entBillConMapper.insert(entcon); + }else { + chkGovBill.setDelState(1); + chkGovBill.setBaseinclassid(sysEnterprise.getBaseinclassid()); + chkGovBill.setBasesafeclassid(sysEnterprise.getBasesafeclassid()); + chkGovBill.setChkbillname(sysEnterprise.getEntname() + "日常检查"); + chkGovBill.setSysEnterpriseId(sysEnterprise.getSysenterpriseid()); + chkGovBill.setChkbillno(simpleDateFormat.format(new Date())); + chkGovBill.setModifiedby(sysUser.getChinaname()); + chkGovBill.setModifiedon(new Date()); + chkGovBill.setSysUnitId(sysEnterprise.getManagerDept()); + chkGovBillMapper.updateByPrimaryKey(chkGovBill); + entBillConMapper.deleteByChkGovBill(chkGovBill.getChkgovbillid()); + chkGovBillDetailMapper.deleteByChkGovBillId(chkGovBill.getChkgovbillid()); + /**插入关联表*/ + EntBillCon con = new EntBillCon(); + con.setEntbillconid(RandomNumber.getUUid()); + con.setChkgovbillid(chkGovBill.getChkgovbillid()); + con.setSysenterpriseid(chkGovBill.getSysEnterpriseId()); + con.setCreatedon(new Date()); + con.setCreatedby(sysUser.getChinaname()); + con.setModifiedon(new Date()); + con.setModifiedby(sysUser.getChinaname()); + entBillConMapper.insert(con); + } + /**查询检查项*/ + String [] safe = sysEnterprise.getBasesafeclassid().split(","); + List list = Arrays.asList(safe); + List billDetails = chkBillDetailMapper.entChkBillPC(sysEnterprise.getBaseinclassid(),list); + if (null != billDetails && billDetails.size()==0){ + singleResult.setMessage(Message.NO_CHECKITEMS); + singleResult.setCode(Code.SUCCESS.getCode()); + return singleResult; + } + List govBillDetails = new ArrayList(); + Integer checkItemNo = 1000; + for (ChkBillDetailWithBLOBs chkBillDetailWithBLOBs : billDetails){ + ChkGovBillDetailWithBLOBs govBillDetail = new ChkGovBillDetailWithBLOBs(); + govBillDetail.setChkgovbilldetailid(RandomNumber.randomUUidPK()); + govBillDetail.setChkgovbillid(chkGovBill.getChkgovbillid()); + govBillDetail.setChkbilldetailid(chkBillDetailWithBLOBs.getChkbilldetailid()); + govBillDetail.setBasekpiid(chkBillDetailWithBLOBs.getBasekpiid()); + govBillDetail.setBaseinclassid(chkBillDetailWithBLOBs.getBaseinclassid()); + govBillDetail.setBasesafeclassid(chkBillDetailWithBLOBs.getBasesafeclassid()); + govBillDetail.setCheckitemno(""+checkItemNo++); + govBillDetail.setCheckobjectname(chkBillDetailWithBLOBs.getCheckobjectname()); + govBillDetail.setCheckmethod(chkBillDetailWithBLOBs.getCheckmethod()); + govBillDetail.setCheckbasis(chkBillDetailWithBLOBs.getCheckbasis()); + govBillDetail.setCreatedby(sysUser.getChinaname()); + govBillDetail.setCreatedon(new Date()); + govBillDetail.setModifiedby(sysUser.getChinaname()); + govBillDetail.setModifiedon(new Date()); + govBillDetails.add(govBillDetail); + } + chkGovBillDetailMapper.insertList(govBillDetails); + return singleResult; + } + + + + + + /** + * PC新增企业或者修改 + * */ + @ApiOperation(value = "PC新增企业或者修改/需要调试", notes = "PC新增企业或者修改/需要调试") + @PostMapping("/addOrUpdateCompany") + @ResponseBody + @Transactional + public SingleResult addCompany(@Valid @RequestBody SysEnterpriseDo sysEnterpriseDo, HttpServletRequest servletRequest)throws Exception { + SingleResult singleResult = new SingleResult(); + SysEnterprise sysEnterprise = new SysEnterprise(); + /** + * 一.异常出现原因 + * 使用 BeanUtils.copyProperties(model,bo),数据源对象model有一个参数是java.util.Date类型,由于导入的是org.apache.commons.beanutils.BeanUtils 没有初始化值,导致调用BeanUtils.copyProperties方法时, + * 报错No value specified for Date + * */ + ConvertUtils.register(new DateConverter(null), Date.class); + BeanUtils.copyProperties(sysEnterprise,sysEnterpriseDo); + String token = servletRequest.getHeader("userToken"); + String userId = JwtUtil.getTokenMsg(token); + if (StringUtils.isBlank(userId)){ + userId = sysEnterpriseDo.getUserId(); + } + SysUser sysUser = super.getUser(userId); + sysEnterprise.setCreatedby(sysUser.getChinaname()); + sysEnterprise.setModifiedby(sysUser.getChinaname()); + int result = 0; + if (null == sysEnterpriseDo.getSysenterpriseid()){ + SysEnterprise verifyEnterprise = sysEnterpriseMapper.selectByName(sysEnterpriseDo.getEntname(),null); + if (null != verifyEnterprise){ + singleResult.setMessage(Message.HAS_ENT); + singleResult.setCode(Code.ERROR.getCode()); + return singleResult; + } + sysEnterprise.setCreatedon(new Date()); + sysEnterprise.setModifiedon(new Date()); + sysEnterprise.setSysenterpriseid(RandomNumber.getUUid()); + sysEnterprise.setDynamicRiskLevel("100");//新建企业默认100分数 + sysEnterprise.setQrCode(entQrCode(sysEnterprise.getSysenterpriseid())); + result = sysEnterpriseMapper.insert(sysEnterprise); + + }else { + SysEnterprise verifyEnterprise = sysEnterpriseMapper.selectByName(sysEnterpriseDo.getEntname(),sysEnterpriseDo.getSysenterpriseid()); + if (null != verifyEnterprise){ + singleResult.setMessage(Message.HAS_ENT); + singleResult.setCode(Code.ERROR.getCode()); + return singleResult; + } + + //如果二维码为空 则生成新的二维码 + SysEnterprise enterprise = sysEnterpriseMapper.selectByPrimaryKey(sysEnterprise.getSysenterpriseid()); + if(StringUtils.isBlank(enterprise.getQrCode())){ + sysEnterprise.setQrCode(entQrCode(sysEnterprise.getSysenterpriseid())); + } + + sysEnterprise.setModifiedon(new Date()); + result = sysEnterpriseMapper.updateByPrimaryKey(sysEnterprise); + + } + + //生成最小工作单元 + saveEntWork(sysEnterprise.getSysenterpriseid()); + + //创建或者修改企业用户 + createEntUser(sysEnterprise,sysUser.getChinaname(),sysUser); + + if (result > 0){ + singleResult.setMessage(Message.SUCCESS); + singleResult.setCode(Code.SUCCESS.getCode()); + }else { + singleResult.setMessage(Message.ERROR); + singleResult.setCode(Code.ERROR.getCode()); + } + + return singleResult; + } + + + + + + /** + * PC企业EXCEL + * */ + @ApiOperation(value = "PC企业EXCEL", notes = "PC企业EXCEL") + @GetMapping("/companiesExcel") + @ResponseBody + public void companiesExcel(@Valid CompaniesExcelDto companiesExcelDto, HttpServletResponse response)throws Exception { + + + String userId = companiesExcelDto.getUserId(); + + //是否为管理员账号 1:是 2:否 + Integer isAdmin = 1; + + String areaCode = companiesExcelDto.getOrgCode(); + if(StringUtils.isBlank(areaCode)){ + areaCode = getUserArea(userId); + } + + List inherentRisks = new ArrayList<>(); + + //风险等级 + if(StringUtils.isNotBlank(companiesExcelDto.getInherentRiskStr())){ + for (String str : companiesExcelDto.getInherentRiskStr().split(",")){ + inherentRisks.add(TypeConversion.StringToInteger(str)); + } + } + + + + List sysEnterprises = sysEnterpriseMapper.selectPCList(areaCode,companiesExcelDto.getEntName(),companiesExcelDto.getRiskLevel(),isAdmin,companiesExcelDto.getBaseinclassid(),inherentRisks); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); + String date = simpleDateFormat.format(new Date()); + if(null != sysEnterprises && sysEnterprises.size() > 0){ + ExcelUtils.writeExcel(response, "企业信息-"+date+".xlsx",sysEnterprises, SysEnterprise.class); + } + } + + /** + * 约谈列表 + * @return + * @throws Exception + */ + @LoginAuth + @ApiOperation(value = "约谈分页", notes = "约谈分页") + @GetMapping("/talkPage") + @ResponseBody + public SingleResult> talkPage(@Valid TalkPageDto talkPageDto)throws Exception{ + SingleResult> result = new SingleResult<>(); + String condition = TypeConversion.getCondition(talkPageDto.getCondition()); + PageHelper.startPage(talkPageDto.getPage(), talkPageDto.getPageSize()); + Page page = (Page)bookTalkMapper.talkPage(condition,talkPageDto.getBookenthtid()); + if(page.getTotal() > 0){ + Pager pager = new Pager<>(); + getDatePage(pager,page); + result.setData(pager); + }else{ + result.setCode(Code.NO_DATA.getCode()); + result.setMessage(Message.NO_DATA); + } + return result; + } + + /** + * 新增修改约谈 + * @param changeTalkDto + * @return + * @throws Exception + */ + @LoginAuth + @ApiOperation(value = "新增修改约谈", notes = "新增修改约谈") + @PostMapping("/changeTalk") + @ResponseBody + public SingleResult changeTalk(@Valid ChangeTalkDto changeTalkDto)throws Exception{ + SingleResult result = new SingleResult<>(); + BookTalkWithBLOBs bookTalk = new BookTalkWithBLOBs(); + BeanUtils.copyProperties(bookTalk,changeTalkDto); + + //操作人 + String chinaName = getChinaName(); + System.out.println("chinaName -> "+chinaName); + bookTalk.setCreatedby(chinaName); + bookTalk.setModifiedby(chinaName); + bookTalk.setModifiedon(new Date()); + bookTalk.setCreatedon(new Date()); + + //约谈时间 + bookTalk.setTalktime(DateUtils.parseString2Date(changeTalkDto.getTime(),"yyyy-MM-dd")); + + if(StringUtils.isNotBlank(bookTalk.getBooktalkid())){ + bookTalkMapper.changeTalk(bookTalk); + }else{ + bookTalk.setBooktalkid(RandomNumber.getUUid()); + bookTalkMapper.insert(bookTalk); + } + + return result; + } + + /** + * 执法分页 + * @return + * @throws Exception + */ + @LoginAuth + @ApiOperation(value = "执法分页", notes = "执法分页") + @GetMapping("/lawPage") + @ResponseBody + public SingleResult> lawPage(@Valid TalkPageDto talkPageDto)throws Exception{ + SingleResult> result = new SingleResult<>(); + String condition = TypeConversion.getCondition(talkPageDto.getCondition()); + PageHelper.startPage(talkPageDto.getPage(), talkPageDto.getPageSize()); + Page page = (Page)bookLawMapper.lawPage(condition,talkPageDto.getBookenthtid()); + if(page.getTotal() > 0){ + Pager pager = new Pager<>(); + getDatePage(pager,page); + result.setData(pager); + }else{ + result.setCode(Code.NO_DATA.getCode()); + result.setMessage(Message.NO_DATA); + } + return result; + } + + /** + * 修改新增执法 + * @return + * @throws Exception + */ + @LoginAuth + @ApiOperation(value = "修改新增执法", notes = "修改新增执法") + @PostMapping("/changeLaw") + @ResponseBody + public SingleResult changeLaw(@Valid ChangeLawDto changeLawDto)throws Exception{ + SingleResult result = new SingleResult<>(); + BookLawWithBLOBs bookLaw = new BookLawWithBLOBs(); + BeanUtils.copyProperties(bookLaw,changeLawDto); + + //操作人 + String chinaName = getChinaName(); + System.out.println("chinaName -> "+chinaName); + bookLaw.setCreatedby(chinaName); + bookLaw.setModifiedby(chinaName); + bookLaw.setModifiedon(new Date()); + bookLaw.setCreatedon(new Date()); + //约谈时间 + bookLaw.setLawtime(DateUtils.parseString2Date(changeLawDto.getTime(),"yyyy-MM-dd")); + if(StringUtils.isNotBlank(bookLaw.getBooklawid())){ + bookLawMapper.changeLaw(bookLaw); + }else{ + bookLaw.setBooklawid(RandomNumber.getUUid()); + bookLawMapper.insert(bookLaw); + } + return result; + } + + /** + * 证照分页 + * @version v1.0 + * @author dong + * @date 2022/9/27 14:45 + */ + @ApiOperation(value = "证照分页", notes = "证照分页") + @GetMapping("/certificatesPage") + @ResponseBody + public SingleResult> certificatesPage(@Valid CertificatesPageDto certificatesPageDto)throws Exception{ + SingleResult> result = new SingleResult<>(); + PageHelper.startPage(certificatesPageDto.getPage(), certificatesPageDto.getPageSize()); + Page page = (Page)entCertificatesMapper.certificatesList(certificatesPageDto.getEnterpriseId()); + Pager pager = new Pager<>(); + getDatePage(pager,page); + result.setData(pager); + return result; + } + + /** + * 证照分页新增或者修改 + * @version v1.0 + * @author dong + * @date 2022/9/27 15:13 + */ + @ApiOperation(value = "证照分页新增或者修改", notes = "证照分页新增或者修改") + @PostMapping("/certificatesAdd") + @ResponseBody + public SingleResult certificatesAdd(@Valid CertificatesAddDto certificatesAddDto)throws Exception{ + SingleResult result = new SingleResult<>(); + + String userId = getUserId(); + + EntCertificates entCertificates = new EntCertificates(); + BeanUtils.copyProperties(entCertificates,certificatesAddDto); + entCertificates.setModifyTime(new Date()); + entCertificates.setCreateBy(userId); + + EntCertificates certificates = entCertificatesMapper.selectById(entCertificates.getCertificatesId()); + if(null != certificates){ + entCertificatesMapper.updateById(entCertificates); + }else{ + entCertificates.setCreateTime(new Date()); + entCertificates.setCreateBy(userId); + entCertificates.setState(1); + entCertificatesMapper.insert(entCertificates); + } + + return result; + } + + /** + * 检查记录详细 + * @version v1.0 + * @author dong + * @date 2022/9/27 15:22 + */ + @ApiOperation(value = "检查记录详细", notes = "检查记录详细") + @GetMapping("/getCompanyCheckDetail") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "检查id", required = true, dataType = "string"), + }) + @ResponseBody + public SingleResult getCompanyCheckDetail(String id)throws Exception { + SingleResult singleResult = new SingleResult(); + BookEntCheck bookEntCheck = bookEntCheckMapper.selectCheckDetail(id); + if (null != bookEntCheck){ + + + //处理数据,第二个参数是给小程序用的判断isSign + handleCheckDetail(bookEntCheck,"simProgram"); + + singleResult.setData(bookEntCheck); + singleResult.setMessage(Message.SUCCESS); + singleResult.setCode(Code.SUCCESS.getCode()); + }else { + singleResult.setMessage(Message.ERROR); + singleResult.setCode(Code.ERROR.getCode()); + } + return singleResult; + } + } diff --git a/inventory-ent/src/main/resources/application.yml b/inventory-ent/src/main/resources/application.yml index a6560f0..a703748 100644 --- a/inventory-ent/src/main/resources/application.yml +++ b/inventory-ent/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - active: dev #设定打包配置文件 + active: prod #设定打包配置文件 diff --git a/inventory-gov/src/main/java/com/rzyc/controller/BaseController.java b/inventory-gov/src/main/java/com/rzyc/controller/BaseController.java index 8c0a075..59a783b 100644 --- a/inventory-gov/src/main/java/com/rzyc/controller/BaseController.java +++ b/inventory-gov/src/main/java/com/rzyc/controller/BaseController.java @@ -2274,6 +2274,7 @@ public class BaseController { Date end = DateUtils.parseString2Date(taskTime.getEndTime(),Constants.DATA); oaTask.setStartdate(start); oaTask.setPlanenddate(end); + oaTask.setDelState(DelState.NOT_DEL.getState()); oaTask.setCreatedby(sysUser.getChinaname()); oaTask.setCreatedon(new Date()); oaTask.setModifiedby(sysUser.getChinaname()); @@ -2308,6 +2309,7 @@ public class BaseController { Date end = DateUtils.parseString2Date(taskTime.getEndTime(),Constants.DATA); oaTask.setStartdate(start); oaTask.setPlanenddate(end); + oaTask.setDelState(DelState.NOT_DEL.getState()); oaTask.setCreatedby(sysUser.getChinaname()); oaTask.setCreatedon(new Date()); oaTask.setModifiedby(sysUser.getChinaname()); @@ -2341,6 +2343,7 @@ public class BaseController { Date end = DateUtils.parseString2Date(endTime,Constants.DATA); oaTask.setStartdate(start); oaTask.setPlanenddate(end); + oaTask.setDelState(DelState.NOT_DEL.getState()); oaTask.setCreatedby(sysUser.getChinaname()); oaTask.setCreatedon(new Date()); oaTask.setModifiedby(sysUser.getChinaname()); @@ -2372,6 +2375,7 @@ public class BaseController { Date end = DateUtils.parseString2Date(taskTime.getEndTime(),Constants.DATA); oaTask.setStartdate(start); oaTask.setPlanenddate(end); + oaTask.setDelState(DelState.NOT_DEL.getState()); oaTask.setCreatedby(sysUser.getChinaname()); oaTask.setCreatedon(new Date()); oaTask.setModifiedby(sysUser.getChinaname()); diff --git a/inventory-gov/src/main/java/com/rzyc/controller/PcPersonalController.java b/inventory-gov/src/main/java/com/rzyc/controller/PcPersonalController.java index c6e7c44..75a0387 100644 --- a/inventory-gov/src/main/java/com/rzyc/controller/PcPersonalController.java +++ b/inventory-gov/src/main/java/com/rzyc/controller/PcPersonalController.java @@ -284,7 +284,7 @@ public class PcPersonalController extends com.rzyc.controller.BaseController { //如果选择未完成任务 处理一下 if(TaskCompleteState.STAYCOMPLETE.getState() == stayMatterDto.getCompleteState()){ - tasks = stayTask(tasks); +// tasks = stayTask(tasks); } //处理结束时间