Commit 98512f44 authored by 廖旭伟's avatar 廖旭伟

事项申请,事项审批

parent 2e0ae969
...@@ -20,9 +20,7 @@ ...@@ -20,9 +20,7 @@
<profiles> <profiles>
<profile> <profile>
<id>develop</id> <id>develop</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties> <properties>
<profiles.active>develop</profiles.active> <profiles.active>develop</profiles.active>
<profiles.server.path>/kb</profiles.server.path> <profiles.server.path>/kb</profiles.server.path>
...@@ -54,6 +52,9 @@ ...@@ -54,6 +52,9 @@
<profile> <profile>
<id>product</id> <id>product</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties> <properties>
<profiles.active>product</profiles.active> <profiles.active>product</profiles.active>
<profiles.server.path>/kb</profiles.server.path> <profiles.server.path>/kb</profiles.server.path>
......
-- ----------------------------
-- 单事项审批人员表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_sys_approver`;
CREATE TABLE mortals_sys_approver(
`id` bigint(20) AUTO_INCREMENT COMMENT '序号,主键,自增长',
`siteId` bigint(20) COMMENT '站点id',
`fullName` varchar(64) NOT NULL COMMENT '工作人员姓名',
`phoneNumber` varchar(128) NOT NULL COMMENT '联系电话',
`loginName` varchar(128) COMMENT '登录用户名',
`loginPwd` varchar(128) COMMENT '登录密码',
`deptId` bigint(20) COMMENT '所属部门',
`deptCode` varchar(128) COMMENT '所属部门编码',
`deptName` varchar(128) COMMENT '所属部门名称',
`remarks` varchar(255) COMMENT '备注',
`createUserId` bigint(20) COMMENT '创建用户',
`createTime` datetime COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='单事项审批人员';
-- ----------------------------
-- 单事项申报表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_sys_matter_apply`;
CREATE TABLE mortals_sys_matter_apply(
`id` bigint(20) AUTO_INCREMENT COMMENT '序号,主键,自增长',
`siteId` bigint(20) COMMENT '站点id',
`singleMatterId` bigint(20) COMMENT '单事项id',
`matterId` bigint(20) COMMENT '基础事项id',
`deptCode` varchar(128) COMMENT '部门编码',
`matterName` varchar(128) NOT NULL COMMENT '单事项名称',
`applyPerson` varchar(128) COMMENT '申请人姓名',
`sexual` tinyint(2) DEFAULT '1' COMMENT '申请人性别',
`phoneNum` varchar(128) COMMENT '申请人电话',
`idCard` varchar(128) COMMENT '申请人身份证号码',
`address` varchar(128) COMMENT '地点',
`applyType` tinyint(2) DEFAULT '1' COMMENT '申请方式1移动端2后台',
`applyTime` datetime COMMENT '申请时间',
`applyState` tinyint(2) DEFAULT '0' COMMENT '审批状态0审批中1通过2不通过',
`advisement` varchar(255) COMMENT '审批意见',
`remarks` varchar(255) COMMENT '备注',
`openId` varchar(128) COMMENT '微信openId',
`createUserId` bigint(20) COMMENT '创建用户',
`createTime` datetime COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='单事项申报';
-- ----------------------------
-- 事项申报材料表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_sys_matter_apply_datum`;
CREATE TABLE mortals_sys_matter_apply_datum(
`id` bigint(20) AUTO_INCREMENT COMMENT '序号,主键,自增长',
`siteId` bigint(20) COMMENT '站点id',
`applyId` bigint(20) COMMENT '用户申报id',
`singleMatterId` bigint(20) COMMENT '单事项id',
`matterId` bigint(20) COMMENT '基础事项id',
`datumId` bigint(20) COMMENT '材料id',
`materialName` varchar(1024) COMMENT '材料名称',
`fileName` varchar(128) COMMENT '附件文件名称',
`fileUrl` varchar(255) COMMENT '附件文件地址',
`createUserId` bigint(20) COMMENT '创建用户',
`createTime` datetime COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='事项申报材料';
INSERT INTO `mortals_xhx_param` (`name`, `firstOrganize`, `secondOrganize`, `paramKey`, `paramValue`, `validStatus`, `modStatus`, `displayType`, `remark`, `createTime`, `createUserId`, `createUserName`) VALUES ('申请方式', 'MatterApply', 'applyType', '1', '移动端', '1', '4', '0', 'applyType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` (`name`, `firstOrganize`, `secondOrganize`, `paramKey`, `paramValue`, `validStatus`, `modStatus`, `displayType`, `remark`, `createTime`, `createUserId`, `createUserName`) VALUES ('申请方式', 'MatterApply', 'applyType', '2', '后台', '1', '4', '0', 'applyType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` (`name`, `firstOrganize`, `secondOrganize`, `paramKey`, `paramValue`, `validStatus`, `modStatus`, `displayType`, `remark`, `createTime`, `createUserId`, `createUserName`) VALUES ('审批状态', 'MatterApply', 'applyState', '0', '审批中', '1', '4', '0', 'applyState', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` (`name`, `firstOrganize`, `secondOrganize`, `paramKey`, `paramValue`, `validStatus`, `modStatus`, `displayType`, `remark`, `createTime`, `createUserId`, `createUserName`) VALUES ('审批状态', 'MatterApply', 'applyState', '1', '通过', '1', '4', '0', 'applyState', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` (`name`, `firstOrganize`, `secondOrganize`, `paramKey`, `paramValue`, `validStatus`, `modStatus`, `displayType`, `remark`, `createTime`, `createUserId`, `createUserName`) VALUES ('审批状态', 'MatterApply', 'applyState', '2', '不通过', '1', '4', '0', 'applyState', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` (`name`, `firstOrganize`, `secondOrganize`, `paramKey`, `paramValue`, `validStatus`, `modStatus`, `displayType`, `remark`, `createTime`, `createUserId`, `createUserName`) VALUES ('性别', 'MatterApply', 'sexual', '1', '男', '1', '4', '0', 'sexual', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` (`name`, `firstOrganize`, `secondOrganize`, `paramKey`, `paramValue`, `validStatus`, `modStatus`, `displayType`, `remark`, `createTime`, `createUserId`, `createUserName`) VALUES ('性别', 'MatterApply', 'sexual', '2', '女', '1', '4', '0', 'sexual', NULL, NULL, NULL);
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
</profile> </profile>
<profile> <profile>
<id>product</id> <id>product</id>
<properties> <properties>
<profiles.active>product</profiles.active> <profiles.active>product</profiles.active>
<profiles.server.path>/sm</profiles.server.path> <profiles.server.path>/sm</profiles.server.path>
......
...@@ -11,6 +11,7 @@ import com.mortals.framework.service.ITaskExcuteService; ...@@ -11,6 +11,7 @@ import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.HttpUtil; import com.mortals.framework.util.HttpUtil;
import com.mortals.xhx.base.system.user.service.UserService; import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.pdu.user.UserPhpPdu; import com.mortals.xhx.common.pdu.user.UserPhpPdu;
import com.mortals.xhx.module.apply.service.ApproverService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -29,6 +30,8 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -29,6 +30,8 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private UserService userService; private UserService userService;
@Autowired
private ApproverService approverService;
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
...@@ -43,6 +46,7 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -43,6 +46,7 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
Rest<List<JSONObject>> list = JSON.parseObject(resp,Rest.class); Rest<List<JSONObject>> list = JSON.parseObject(resp,Rest.class);
List<UserPhpPdu> upp = JSONArray.parseArray(JSONObject.toJSONString(list.getData()),UserPhpPdu.class); List<UserPhpPdu> upp = JSONArray.parseArray(JSONObject.toJSONString(list.getData()),UserPhpPdu.class);
userService.updateUserList(upp); userService.updateUserList(upp);
approverService.updateUserList(upp);
} catch (Exception e) { } catch (Exception e) {
log.error("同步用户发生异常",e); log.error("同步用户发生异常",e);
} }
......
package com.mortals.xhx.module.apply.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.apply.model.ApproverEntity;
import java.util.List;
/**
* 单事项审批人员Dao
* 单事项审批人员 DAO接口
*
* @author zxfei
* @date 2023-05-23
*/
public interface ApproverDao extends ICRUDDao<ApproverEntity,Long>{
}
package com.mortals.xhx.module.apply.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.apply.model.MatterApplyEntity;
import java.util.List;
/**
* 单事项申报Dao
* 单事项申报 DAO接口
*
* @author zxfei
* @date 2023-05-23
*/
public interface MatterApplyDao extends ICRUDDao<MatterApplyEntity,Long>{
}
package com.mortals.xhx.module.apply.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.apply.model.MatterApplyDatumEntity;
import java.util.List;
/**
* 事项申报材料Dao
* 事项申报材料 DAO接口
*
* @author zxfei
* @date 2023-05-23
*/
public interface MatterApplyDatumDao extends ICRUDDao<MatterApplyDatumEntity,Long>{
}
package com.mortals.xhx.module.apply.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.apply.dao.ApproverDao;
import com.mortals.xhx.module.apply.model.ApproverEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 单事项审批人员DaoImpl DAO接口
*
* @author zxfei
* @date 2023-05-23
*/
@Repository("approverDao")
public class ApproverDaoImpl extends BaseCRUDDaoMybatis<ApproverEntity,Long> implements ApproverDao {
}
package com.mortals.xhx.module.apply.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.apply.dao.MatterApplyDao;
import com.mortals.xhx.module.apply.model.MatterApplyEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 单事项申报DaoImpl DAO接口
*
* @author zxfei
* @date 2023-05-23
*/
@Repository("matterApplyDao")
public class MatterApplyDaoImpl extends BaseCRUDDaoMybatis<MatterApplyEntity,Long> implements MatterApplyDao {
}
package com.mortals.xhx.module.apply.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.apply.dao.MatterApplyDatumDao;
import com.mortals.xhx.module.apply.model.MatterApplyDatumEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 事项申报材料DaoImpl DAO接口
*
* @author zxfei
* @date 2023-05-23
*/
@Repository("matterApplyDatumDao")
public class MatterApplyDatumDaoImpl extends BaseCRUDDaoMybatis<MatterApplyDatumEntity,Long> implements MatterApplyDatumDao {
}
package com.mortals.xhx.module.apply.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.apply.model.vo.ApproverVo;
import lombok.Data;
/**
* 单事项审批人员实体对象
*
* @author zxfei
* @date 2023-05-23
*/
@Data
public class ApproverEntity extends ApproverVo {
private static final long serialVersionUID = 1L;
/**
* 站点id
*/
private Long siteId;
/**
* 工作人员姓名
*/
private String fullName;
/**
* 联系电话
*/
private String phoneNumber;
/**
* 登录用户名
*/
private String loginName;
/**
* 登录密码
*/
private String loginPwd;
/**
* 所属部门
*/
private Long deptId;
/**
* 所属部门编码
*/
private String deptCode;
/**
* 所属部门名称
*/
private String deptName;
/**
* 备注
*/
private String remarks;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof ApproverEntity) {
ApproverEntity tmp = (ApproverEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.siteId = -1L;
this.fullName = "";
this.phoneNumber = "";
this.loginName = "";
this.loginPwd = "";
this.deptId = -1L;
this.deptCode = "";
this.deptName = "";
this.remarks = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.apply.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.apply.model.vo.MatterApplyDatumVo;
import lombok.Data;
/**
* 事项申报材料实体对象
*
* @author zxfei
* @date 2023-05-23
*/
@Data
public class MatterApplyDatumEntity extends MatterApplyDatumVo {
private static final long serialVersionUID = 1L;
/**
* 站点id
*/
private Long siteId;
/**
* 用户申报id
*/
private Long applyId;
/**
* 单事项id
*/
private Long singleMatterId;
/**
* 基础事项id
*/
private Long matterId;
/**
* 材料id
*/
private Long datumId;
/**
* 材料名称
*/
private String materialName;
/**
* 附件文件名称
*/
private String fileName;
/**
* 附件文件地址
*/
private String fileUrl;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof MatterApplyDatumEntity) {
MatterApplyDatumEntity tmp = (MatterApplyDatumEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.siteId = -1L;
this.applyId = -1L;
this.singleMatterId = -1L;
this.matterId = -1L;
this.datumId = -1L;
this.materialName = "";
this.fileName = "";
this.fileUrl = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.apply.model;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.apply.model.vo.MatterApplyVo;
import lombok.Data;
/**
* 单事项申报实体对象
*
* @author zxfei
* @date 2023-05-27
*/
@Data
public class MatterApplyEntity extends MatterApplyVo {
private static final long serialVersionUID = 1L;
/**
* 站点id
*/
private Long siteId;
/**
* 单事项id
*/
private Long singleMatterId;
/**
* 基础事项id
*/
private Long matterId;
/**
* 部门编码
*/
private String deptCode;
/**
* 单事项名称
*/
private String matterName;
/**
* 申请人姓名
*/
private String applyPerson;
/**
* 申请人性别
*/
private Integer sexual;
/**
* 申请人电话
*/
private String phoneNum;
/**
* 申请人身份证号码
*/
private String idCard;
/**
* 地点
*/
private String address;
/**
* 申请方式1移动端2后台
*/
private Integer applyType;
/**
* 申请时间
*/
private Date applyTime;
/**
* 审批状态0审批中1通过2不通过
*/
private Integer applyState;
/**
* 审批意见
*/
private String advisement;
/**
* 备注
*/
private String remarks;
/**
* 微信openId
*/
private String openId;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof MatterApplyEntity) {
MatterApplyEntity tmp = (MatterApplyEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.siteId = -1L;
this.singleMatterId = -1L;
this.matterId = -1L;
this.deptCode = "";
this.matterName = "";
this.applyPerson = "";
this.sexual = 1;
this.phoneNum = "";
this.idCard = "";
this.address = "";
this.applyType = 1;
this.applyTime = null;
this.applyState = 0;
this.advisement = "";
this.remarks = "";
this.openId = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.apply.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.apply.model.ApproverEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 单事项审批人员视图对象
*
* @author zxfei
* @date 2023-05-23
*/
@Data
public class ApproverVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.apply.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.apply.model.MatterApplyDatumEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 事项申报材料视图对象
*
* @author zxfei
* @date 2023-05-23
*/
@Data
public class MatterApplyDatumVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.apply.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.apply.model.MatterApplyDatumEntity;
import com.mortals.xhx.module.apply.model.MatterApplyEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 单事项申报视图对象
*
* @author zxfei
* @date 2023-05-23
*/
@Data
public class MatterApplyVo extends BaseEntityLong {
/** 申请材料 */
private List<MatterApplyDatumEntity> applyDatumList;
}
\ No newline at end of file
package com.mortals.xhx.module.apply.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.common.pdu.user.UserPhpPdu;
import com.mortals.xhx.module.apply.model.ApproverEntity;
import com.mortals.xhx.module.apply.dao.ApproverDao;
import java.util.List;
/**
* ApproverService
*
* 单事项审批人员 service接口
*
* @author zxfei
* @date 2023-05-23
*/
public interface ApproverService extends ICRUDService<ApproverEntity,Long>{
ApproverDao getDao();
void updateUserList(List<UserPhpPdu> list);
}
\ No newline at end of file
package com.mortals.xhx.module.apply.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.apply.model.MatterApplyDatumEntity;
import com.mortals.xhx.module.apply.dao.MatterApplyDatumDao;
/**
* MatterApplyDatumService
*
* 事项申报材料 service接口
*
* @author zxfei
* @date 2023-05-23
*/
public interface MatterApplyDatumService extends ICRUDService<MatterApplyDatumEntity,Long>{
MatterApplyDatumDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.apply.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.apply.model.MatterApplyEntity;
import com.mortals.xhx.module.apply.dao.MatterApplyDao;
/**
* MatterApplyService
*
* 单事项申报 service接口
*
* @author zxfei
* @date 2023-05-23
*/
public interface MatterApplyService extends ICRUDService<MatterApplyEntity,Long>{
MatterApplyDao getDao();
/**
* 申请审批
* @param entity
* @throws AppException
*/
void applyExamine(MatterApplyEntity entity, Context context) throws AppException;
/**
* 重新申请
* @param entity
* @param context
* @throws AppException
*/
void reApply(MatterApplyEntity entity, Context context) throws AppException;
}
\ No newline at end of file
package com.mortals.xhx.module.apply.service.impl;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.SecurityUtil;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.common.pdu.user.UserPhpPdu;
import com.mortals.xhx.module.apply.model.ApproverQuery;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.apply.dao.ApproverDao;
import com.mortals.xhx.module.apply.model.ApproverEntity;
import com.mortals.xhx.module.apply.service.ApproverService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.util.List;
/**
* ApproverService
* 单事项审批人员 service实现
*
* @author zxfei
* @date 2023-05-23
*/
@Service("approverService")
@Slf4j
public class ApproverServiceImpl extends AbstractCRUDServiceImpl<ApproverDao, ApproverEntity, Long> implements ApproverService {
@Override
public void updateUserList(List<UserPhpPdu> list) {
if(!CollectionUtils.isEmpty(list)){
for(UserPhpPdu phpPdu:list){
if(!phpPdu.getType().equals("2")){
continue;
}
ApproverEntity tempUser = this.selectOne(new ApproverQuery().loginName(phpPdu.getAccount()));
if (ObjectUtils.isEmpty(tempUser)) {
//新增
ApproverEntity approverEntity = new ApproverEntity();
approverEntity.initAttrValue();
approverEntity.setFullName(phpPdu.getUser_name());
approverEntity.setLoginName(phpPdu.getAccount());
try {
approverEntity.setLoginPwd(SecurityUtil.md5DoubleEncoding(phpPdu.getPassword()));
} catch (Exception e) {
throw new AppException("密码转换异常!", e);
}
approverEntity.setPhoneNumber(phpPdu.getMobile());
approverEntity.setSiteId(1l);
dao.insert(approverEntity);
} else {
//更新
ApproverEntity approverEntity = new ApproverEntity();
approverEntity.setId(tempUser.getId());
approverEntity.initAttrValue();
approverEntity.setFullName(phpPdu.getUser_name());
approverEntity.setLoginName(phpPdu.getAccount());
try {
approverEntity.setLoginPwd(SecurityUtil.md5DoubleEncoding(phpPdu.getPassword()));
} catch (Exception e) {
throw new AppException("密码转换异常!", e);
}
approverEntity.setPhoneNumber(phpPdu.getMobile());
dao.update(approverEntity);
}
}
}
}
}
\ No newline at end of file
package com.mortals.xhx.module.apply.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.apply.dao.MatterApplyDatumDao;
import com.mortals.xhx.module.apply.model.MatterApplyDatumEntity;
import com.mortals.xhx.module.apply.service.MatterApplyDatumService;
import lombok.extern.slf4j.Slf4j;
/**
* MatterApplyDatumService
* 事项申报材料 service实现
*
* @author zxfei
* @date 2023-05-23
*/
@Service("matterApplyDatumService")
@Slf4j
public class MatterApplyDatumServiceImpl extends AbstractCRUDServiceImpl<MatterApplyDatumDao, MatterApplyDatumEntity, Long> implements MatterApplyDatumService {
}
\ No newline at end of file
package com.mortals.xhx.module.apply.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.apply.dao.MatterApplyDao;
import com.mortals.xhx.module.apply.model.MatterApplyDatumEntity;
import com.mortals.xhx.module.apply.model.MatterApplyDatumQuery;
import com.mortals.xhx.module.apply.model.MatterApplyEntity;
import com.mortals.xhx.module.apply.service.MatterApplyDatumService;
import com.mortals.xhx.module.apply.service.MatterApplyService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* MatterApplyService
* 单事项申报 service实现
*
* @author zxfei
* @date 2023-05-23
*/
@Service("matterApplyService")
@Slf4j
public class MatterApplyServiceImpl extends AbstractCRUDServiceImpl<MatterApplyDao, MatterApplyEntity, Long> implements MatterApplyService {
@Autowired
private MatterApplyDatumService matterApplyDatumService;
@Override
protected void saveBefore(MatterApplyEntity entity, Context context) throws AppException {
entity.setSiteId(1l);
entity.setApplyTime(entity.getCreateTime());
entity.setApplyState(0);
}
@Override
protected void saveAfter(MatterApplyEntity entity, Context context) throws AppException {
if(CollectionUtils.isNotEmpty(entity.getApplyDatumList())){
for (MatterApplyDatumEntity item:entity.getApplyDatumList()){
item.setSiteId(entity.getSiteId());
item.setSingleMatterId(entity.getSingleMatterId());
item.setMatterId(entity.getMatterId());
item.setApplyId(entity.getId());
item.setCreateTime(entity.getCreateTime());
item.setCreateUserId(entity.getCreateUserId());
}
matterApplyDatumService.save(entity.getApplyDatumList(),context);
}
}
@Override
protected void updateBefore(MatterApplyEntity entity, Context context) throws AppException {
entity.setApplyTime(new Date());
entity.setAdvisement("");
entity.setApplyState(0);
}
@Override
protected void updateAfter(MatterApplyEntity entity, Context context) throws AppException {
if(CollectionUtils.isNotEmpty(entity.getApplyDatumList())){
matterApplyDatumService.update(entity.getApplyDatumList());
}
}
@Override
protected void findAfter(MatterApplyEntity params, Context context, List<MatterApplyEntity> list) throws AppException {
if(CollectionUtils.isNotEmpty(list)){
for (MatterApplyEntity entity:list){
List<MatterApplyDatumEntity> datumEntities = matterApplyDatumService.find(new MatterApplyDatumQuery().applyId(entity.getId()));
entity.setApplyDatumList(datumEntities);
}
}
}
@Override
protected void findAfter(MatterApplyEntity params, PageInfo pageInfo, Context context, List<MatterApplyEntity> list) throws AppException {
if(CollectionUtils.isNotEmpty(list)){
for (MatterApplyEntity entity:list){
List<MatterApplyDatumEntity> datumEntities = matterApplyDatumService.find(new MatterApplyDatumQuery().applyId(entity.getId()));
entity.setApplyDatumList(datumEntities);
}
}
}
@Override
public void applyExamine(MatterApplyEntity entity, Context context) throws AppException {
if(entity.getId()==null){
throw new AppException("申报id不能为空");
}
if(entity.getApplyState()==null){
throw new AppException("审批状态不能为空");
}
MatterApplyEntity update = new MatterApplyEntity();
update.setId(entity.getId());
update.setApplyState(entity.getApplyState());
update.setAdvisement(entity.getAdvisement());
if(context!=null && context.getUser()!=null){
update.setUpdateUserId(context.getUser().getId());
}
update.setUpdateTime(new Date());
dao.update(update);
}
@Override
public void reApply(MatterApplyEntity entity, Context context) throws AppException {
if(entity.getId()==null){
throw new AppException("申报id不能为空");
}
entity.setApplyState(0);
entity.setAdvisement("");
this.update(entity,context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.apply.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.apply.model.ApproverEntity;
import com.mortals.xhx.module.apply.service.ApproverService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 单事项审批人员
*
* @author zxfei
* @date 2023-05-23
*/
@RestController
@RequestMapping("approver")
public class ApproverController extends BaseCRUDJsonBodyMappingController<ApproverService,ApproverEntity,Long> {
@Autowired
private ParamService paramService;
public ApproverController(){
super.setModuleDesc( "单事项审批人员");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.apply.web;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.model.BaseEntity;
import com.mortals.framework.service.IUser;
import com.mortals.framework.utils.BeanUtil;
import com.mortals.framework.utils.ReflectUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.apply.model.MatterApplyEntity;
import com.mortals.xhx.module.apply.service.MatterApplyService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 单事项申报
*
* @author zxfei
* @date 2023-05-23
*/
@RestController
@RequestMapping("matter/apply")
public class MatterApplyController extends BaseCRUDJsonBodyMappingController<MatterApplyService,MatterApplyEntity,Long> {
@Autowired
private ParamService paramService;
public MatterApplyController(){
super.setModuleDesc( "单事项申报");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "applyType", paramService.getParamBySecondOrganize("MatterApply","applyType"));
this.addDict(model, "applyState", paramService.getParamBySecondOrganize("MatterApply","applyState"));
this.addDict(model, "sexual", paramService.getParamBySecondOrganize("MatterApply","sexual"));
super.init(model, context);
}
@PostMapping({"save"})
@RepeatSubmit
@UnAuth
public String save(@RequestBody MatterApplyEntity entity) {
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "保存" + this.getModuleDesc();
int code;
try {
this.saveBefore(entity, model, context);
if (entity.newEntity()) {
Class<MatterApplyEntity> tClass = ReflectUtils.getClassGenricType(this.getClass(), 1);
MatterApplyEntity initEntity = (MatterApplyEntity)tClass.newInstance();
initEntity.initAttrValue();
BeanUtils.copyProperties(entity, initEntity, BeanUtil.getNullPropertyNames(entity));
entity = initEntity;
busiDesc = "新增" + this.getModuleDesc();
initEntity.setCreateTime(new Date());
initEntity.setUpdateTime(initEntity.getCreateTime());
IUser user = this.getCurUser();
if (user != null) {
initEntity.setCreateUserId(user.getId());
initEntity.setCreateUser(user.getLoginName());
initEntity.setCreateUserName(user.getRealName());
initEntity.setCreateUserDeptId(user.getDeptId());
initEntity.setCreateUserDeptName(user.getDeptName());
initEntity.setUpdateUserId(user.getId());
initEntity.setUpdateUser(user.getLoginName());
initEntity.setUpdateUserName(user.getRealName());
initEntity.setUpdateUserDeptId(user.getDeptId());
initEntity.setUpdateUserDeptName(user.getDeptName());
}
this.service.save(initEntity, context);
} else {
busiDesc = "修改" + this.getModuleDesc();
entity.setUpdateTime(new Date());
IUser user = this.getCurUser();
if (user != null) {
entity.setUpdateUserId(user.getId());
entity.setUpdateUser(user.getLoginName());
entity.setUpdateUserName(user.getRealName());
entity.setUpdateUserDeptId(user.getDeptId());
entity.setUpdateUserDeptName(user.getDeptName());
}
this.service.update(entity, context);
}
model.put("id", entity.getId());
code = this.saveAfter(entity, model, context);
model.put("entity", entity);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + entity.getId() + "]");
} catch (Exception var9) {
this.doException(this.request, busiDesc, model, var9);
model.put("entity", entity);
this.init(model, context);
code = this.saveException(entity, model, context, var9);
}
this.init(model, context);
JSONObject ret = new JSONObject();
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
/**
* 审批
* @param entity
* @return
*/
@PostMapping({"examine"})
public String applyExamine(@RequestBody MatterApplyEntity entity) {
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "审批" + this.getModuleDesc();
int code;
try {
this.service.applyExamine(entity,context);
model.put("id", entity.getId());
code = this.saveAfter(entity, model, context);
model.put("entity", entity);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + entity.getId() + "]");
} catch (Exception var9) {
this.doException(this.request, busiDesc, model, var9);
model.put("entity", entity);
this.init(model, context);
code = this.saveException(entity, model, context, var9);
}
this.init(model, context);
JSONObject ret = new JSONObject();
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
/**
* 重新申请
* @param entity
* @return
*/
@PostMapping({"reApply"})
@RepeatSubmit
@UnAuth
public String reApply(@RequestBody MatterApplyEntity entity) {
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "重新申请" + this.getModuleDesc();
int code;
try {
this.service.reApply(entity,context);
model.put("id", entity.getId());
code = this.saveAfter(entity, model, context);
model.put("entity", entity);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + entity.getId() + "]");
} catch (Exception var9) {
this.doException(this.request, busiDesc, model, var9);
model.put("entity", entity);
this.init(model, context);
code = this.saveException(entity, model, context, var9);
}
this.init(model, context);
JSONObject ret = new JSONObject();
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
}
\ No newline at end of file
package com.mortals.xhx.module.apply.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.apply.model.MatterApplyDatumEntity;
import com.mortals.xhx.module.apply.service.MatterApplyDatumService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 事项申报材料
*
* @author zxfei
* @date 2023-05-23
*/
@RestController
@RequestMapping("matter/apply/datum")
public class MatterApplyDatumController extends BaseCRUDJsonBodyMappingController<MatterApplyDatumService,MatterApplyDatumEntity,Long> {
@Autowired
private ParamService paramService;
public MatterApplyDatumController(){
super.setModuleDesc( "事项申报材料");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment