Commit 6f4920f3 by 邓实川

Merge branch 'develop' of http://120.24.24.239:8082/8timerv2/8timerapiv200.git into dsc

parents 02bff1fe e98f437e
......@@ -223,7 +223,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.58</version>
<version>1.2.62</version>
</dependency>
<dependency>
......@@ -261,15 +261,15 @@
</dependency>
<!-- jackson -->
<dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
</dependency>
</dependency> -->
<dependency>
<!-- <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependency> -->
<dependency>
<groupId>com.alibaba</groupId>
......
......@@ -16,10 +16,6 @@ import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import cn.hutool.core.net.NetUtil;
@MapperScan("cn.timer.api.dao") // 扫描的mapper
......@@ -38,28 +34,6 @@ public class Application {
SpringApplication.run(Application.class, args);
}
/**
* 配置FastJson方式二
*
* @return HttpMessageConverters
*/
@Bean
public HttpMessageConverters fastJsonHttpMessageConverters() {
// 1.定义一个converters转换消息的对象
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
// 2.添加fastjson的配置信息,比如: 是否需要格式化返回的json数据
FastJsonConfig fastJsonConfig = new FastJsonConfig();
fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
// 3.在converter中添加配置信息
fastConverter.setFastJsonConfig(fastJsonConfig);
// 4.将converter赋值给HttpMessageConverter
HttpMessageConverter<?> converter = fastConverter;
// 5.返回HttpMessageConverters对象
return new HttpMessageConverters(converter);
}
// extends SpringBootServletInitializer
@Autowired
private RestTemplateBuilder restTemplateBuilder;
......
package cn.timer.api.bean.clazz;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Tang 2020-05-09
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("地区")
public class CommonArea extends Model<CommonArea> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="编号",example="1")
private Integer codeId;
@ApiModelProperty(value="父编号",example="10")
private Integer parentId;
@ApiModelProperty(value="城市名称",example="1")
private String cityName;
@ApiModelProperty(value="下级",example="1")
private List<CommonArea> commonAreas;
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import cn.timer.api.config.swagger.IgnoreSwaggerParameter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -86,4 +87,16 @@ public class SpmkApproveSummary extends Model<SpmkApproveSummary> {
@ApiModelProperty(value = "摘要 ", example = "摘要")
private String digest;
@ApiModelProperty(value = "岗位名称", example = "岗位名称")
private String gwName;
@ApiModelProperty(value = "部门id", example = "1")
private String bmId;
@ApiModelProperty(value = "部门名称", example = "部门名称")
private String bmName;
}
\ No newline at end of file
......@@ -113,6 +113,10 @@ public interface YgEnumInterface {
public static String tranTime(String index) {
//String str ="2013/11/12";
if (index == null) {
return null;
}
String p = "年|月|日|号|时|/|//-";
String result = index.replaceAll(p, "-");
String p2 = "-$";
......
package cn.timer.api.config.exception;
/**
* 自定义异常
*
* @author Tang
*/
public class CustomException extends RuntimeException
{
private static final long serialVersionUID = 1L;
private String code;
private String message;
public CustomException(String message)
{
this.message = message;
}
public CustomException(String message, String code)
{
this.message = message;
this.code = code;
}
public CustomException(String message, Throwable e)
{
super(message, e);
this.message = message;
}
@Override
public String getMessage()
{
return message;
}
public String getCode()
{
return code;
}
}
package cn.timer.api.config.exception;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import cn.hutool.core.util.StrUtil;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
/**
* 全局异常处理器
*
* @author Tang
*/
@RestControllerAdvice // @ControllerAdvice + @ResponseBody 组合注解
public class GlobalExceptionHandler {
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
@ExceptionHandler(Exception.class)
public Result<Object> handleException(Exception e) {
log.error(e.getMessage(), e);
return ResultUtil.error(e.getMessage());
}
/**
* 空指针异常
* @param e
* @return
*/
@ExceptionHandler(NullPointerException.class)
public Result<Object> nullPointerException(NullPointerException e) {
log.error(e.getMessage(), e);
return ResultUtil.error(e.getMessage());
}
/**
* 类型强制转换异常
* @param e
* @return
*/
@ExceptionHandler(ClassCastException.class)
public Result<Object> classCastException(ClassCastException e) {
log.error(e.getMessage(), e);
return ResultUtil.error(e.getMessage());
}
/**
* 业务异常
*/
@ExceptionHandler(CustomException.class)
public Result<Object> businessException(CustomException e) {
if (StrUtil.isBlank(e.getCode())) {
return ResultUtil.error(e.getMessage());
}
return ResultUtil.error(e.getCode(), e.getMessage());
}
}
package cn.timer.api.config.interceptor;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.StringHttpMessageConverter;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class MyConfiguration {
@Bean
public HttpMessageConverters customConverters() {
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
// 创建配置类
FastJsonConfig config = new FastJsonConfig();
config.setSerializerFeatures(
SerializerFeature.WriteNullListAsEmpty,
SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteNullStringAsEmpty
);
//此处是全局处理方式
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
config.setCharset(Charset.forName("UTF-8"));
fastConverter.setFastJsonConfig(config);
List<MediaType> supportedMediaTypes = new ArrayList<>();
supportedMediaTypes.add(MediaType.ALL);
fastConverter.setSupportedMediaTypes(supportedMediaTypes);
//支持text 转string
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
return new HttpMessageConverters(fastConverter, stringHttpMessageConverter);
}
}
package cn.timer.api.config.interceptor;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.annotation.Resource;
......@@ -9,11 +11,13 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.ValueFilter;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
......@@ -51,8 +55,21 @@ public class WebSecurityConfig implements WebMvcConfigurer {
// registry.addInterceptor(getSessionInterceptor()).addPathPatterns("/**").excludePathPatterns("/swagger-ui*");
}
/**
* 配置消息转换器--这里我用的是alibaba 开源的 fastjson
* @param converters
*/
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
// Iterator<HttpMessageConverter<?>> iterator = converters.iterator();
// while(iterator.hasNext()){
// HttpMessageConverter<?> converter = iterator.next();
// if(converter instanceof MappingJackson2HttpMessageConverter){
// iterator.remove();
// }
// }
// 1.需要先定义一个convert 转换消息的对象
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
// 2.添加fastJson的配置信息,比如,是否需要格式化返回的json数据
......@@ -66,10 +83,21 @@ public class WebSecurityConfig implements WebMvcConfigurer {
// WriteNullNumberAsZero 将数值类型字段的空值输出为0
// WriteNullBooleanAsFalse 将Boolean类型字段的空值输出为false
fastJsonConfig.setSerializerFeatures(
SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteDateUseDateFormat,
SerializerFeature.WriteNullStringAsEmpty);
SerializerFeature.PrettyFormat
// SerializerFeature.WriteEnumUsingToString,
// SerializerFeature.WriteNullStringAsEmpty,
// SerializerFeature.WriteMapNullValue,
// SerializerFeature.WriteDateUseDateFormat
);
// fastJsonConfig.setSerializeFilters((ValueFilter) (o, s, source) -> {
// if (source == null) {
// return "";//此处是关键,如果返回对象的变量为null,则自动变成""
// }
// if (source instanceof Date) {
// return ((Date) source).getTime();
// }
// return source;
// });
// 处理中文乱码问题
List<MediaType> fastMediaTypes = new ArrayList<>();
fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
......@@ -77,7 +105,7 @@ public class WebSecurityConfig implements WebMvcConfigurer {
// 3.在convert中添加配置信息
fastConverter.setFastJsonConfig(fastJsonConfig);
// 4.将convert添加到converters当中
converters.add(fastConverter);
converters.add(0,fastConverter);
}
......
......@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
......@@ -423,8 +424,15 @@ public class LoginController {
qyzxEmpLogin1.setPw(Md5.md5("123456"));// 密码初始化
qyzxEmpLogin1.updateById();
//员工信息 手机号修改
YgglMainEmp.builder().phone(phone).build().update(new UpdateWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, qyzxEmpLogin1.getId()));
return ResultUtil.success("修改手机号/用户名成功");
}
return ResultUtil.error("修改手机号/用户名失败");
}
......
......@@ -43,6 +43,7 @@ import cn.timer.api.bean.spmk.SpmkInitiatorConfig;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.controller.spmk.service.SpmkServiceImpl;
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
import cn.timer.api.dao.spmk.SpmkApprovalGMapper;
......@@ -72,7 +73,6 @@ import cn.timer.api.utils.router.business.SpmkAssoBusinessFactory;
import cn.timer.api.utils.router.enums.ApproveEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
@Api(tags = "3.0审批模块")
@RestController
......@@ -84,18 +84,26 @@ public class SpmkController {
@Autowired
private SpmkApprovalTemplateGMapper spmkApprovalTemplateGMapper;
@Autowired
private SpmkApprovalTemplateMapper spmkApprovalTemplateMapper;
@Autowired
private SpmkApprovalGMapper spmkApprovalGMapper;
@Autowired
private SpmkCustomApprovalMapper spmkCustomApprovalMapper;
@Autowired
private ZzglBmgwMService zzglBmgwMService;
@Autowired
private SpmkApproveSummaryMapper spmkApproveSummaryMapper;
@Autowired
private SpmkApproveDetailMapper spmkApproveDetailMapper;
@Autowired
private SpmkApproveExecuteRecordMapper spmkApproveExecuteRecordMapper;
@Autowired
private SpmkExecutorMapper spmkExecutorMapper;
@Autowired
private SpmkInitiatorConfigMapper spmkInitiatorConfigMapper;
private boolean ISFIRST = true; // 第一次启动审批流程
......@@ -108,7 +116,8 @@ public class SpmkController {
@ApiOperationSupport(order = 1)
public Result<Object> saveAtg(@RequestBody SpmkApprovalTemplateG spmkApprovalTemplateG){
return spmkApprovalTemplateG.insertOrUpdate() ? ResultUtil.data(spmkApprovalTemplateG, "操作成功!") : ResultUtil.error("操作失败!");
return spmkApprovalTemplateG.insertOrUpdate() ?
ResultUtil.data(spmkApprovalTemplateG, "操作成功!") : ResultUtil.error("操作失败!");
}
......@@ -124,7 +133,8 @@ public class SpmkController {
return ResultUtil.error("审批模板组存在 模板,不可直接删除!");
return SpmkApprovalTemplateG.builder().id(id).build().deleteById() ? ResultUtil.success("操作成功!") : ResultUtil.error("没有找到该对象");
return SpmkApprovalTemplateG.builder().id(id).build().deleteById() ?
ResultUtil.success("操作成功!") : ResultUtil.error("没有找到该对象");
}
......@@ -298,7 +308,7 @@ public class SpmkController {
@ApiOperation(value = "13.新增或编辑-自定义审批", httpMethod = "POST", notes = "新增或编辑-自定义审批")
@ApiOperationSupport(order = 13)
@Transactional(rollbackFor = Exception.class)
public Result<Object> saveCa(@Valid @RequestBody SpmkCustomApprovalDto spmkCustomApprovalDto,BindingResult bindingResult) throws Exception{
public Result<Object> saveCa(@RequestBody SpmkCustomApprovalDto spmkCustomApprovalDto) throws Exception{
Integer approvalGId = spmkCustomApprovalDto.getApprovalGId();
if (ObjectUtil.isNull(approvalGId))
return ResultUtil.error("操作失败!-1");
......@@ -396,19 +406,6 @@ public class SpmkController {
return spmkCustomApprovalMapper.updateListRandsById(list) ? ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!");
}
@Autowired
private SpmkApproveSummaryMapper spmkApproveSummaryMapper;
@Autowired
private SpmkApproveDetailMapper spmkApproveDetailMapper;
@Autowired
private SpmkApproveExecuteRecordMapper spmkApproveExecuteRecordMapper;
@Autowired
private SpmkExecutorMapper spmkExecutorMapper;
@Autowired
private SpmkInitiatorConfigMapper spmkInitiatorConfigMapper;
private boolean ISFIRST = true; // 第一次启动审批流程
// TODO 审批汇总(发起审批)
/**
* 发起审批
......@@ -454,7 +451,7 @@ public class SpmkController {
.currentApprover(currentApprover).build();
if (!as.insert()) {
return ResultUtil.error("操作失败!");
throw new CustomException("审批汇总-新增异常");
}
// 插入记录
......@@ -470,13 +467,19 @@ public class SpmkController {
ad.setFlowChildren(ObjectUtil.serialize(listFlowChildren));
if (!ad.insert())
throw new Exception();
throw new CustomException("审批详情-新增异常");
return ResultUtil.success("操作成功!");
}
//TODO 审批汇总
/**
* 审批汇总
* @param summaryQueryDto
* @return
* @throws
*/
@PostMapping(value = "/select_approve_summary")
@ApiOperation(value = "18.审批汇总", httpMethod = "POST", notes = "审批汇总")
@ApiOperationSupport(order = 18)
......@@ -533,20 +536,6 @@ public class SpmkController {
return ResultUtil.data(adD, "操作成功!");
}
//TODO 撤销审批
/**
* 撤销审批
*/
@PutMapping(value = "/revoke_approval/{id}")
@ApiOperation(value = "22.撤销审批", httpMethod = "PUT", notes = "撤销审批")
@Transactional(rollbackFor = Exception.class)
@ApiOperationSupport(order = 22)
public Result<Object> revokeApproval(@PathVariable Integer id) throws Exception {
return SpmkApproveSummary.builder().id(id).endTime(new Date()).sts(1).build().updateById() ?
ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!");
}
//TODO 审批人审批
/**
* 审批人审批
......@@ -557,8 +546,7 @@ public class SpmkController {
@ApiOperationSupport(order = 20)
// @BindingResultCtrol(title = "审批人审批")
public Result<Object> approving(@Valid @RequestBody ApprovingDto approvingDto, BindingResult bindingResult) throws Exception {
SpmkApproveDetail ad = SpmkApproveDetail.builder().build()
.selectOne(new QueryWrapper<SpmkApproveDetail>()
SpmkApproveDetail ad = SpmkApproveDetail.builder().build().selectOne(new QueryWrapper<SpmkApproveDetail>()
.lambda()
.select(SpmkApproveDetail::getId,
SpmkApproveDetail::getRequestData,
......@@ -607,9 +595,6 @@ public class SpmkController {
if (aSummary.getSts() != 3) {
SpmkApproveSummary.builder().id(approvingDto.getAsId()).endTime(new Date()).sts(2).build().updateById();
//审批完成后 业务
SpmkAssoBusiness sab = SpmkAssoBusinessFactory.createSpmkAssoType(ApproveEnum.getEnums(aSummary.getAssoType()));
if (sab != null)
......@@ -644,11 +629,56 @@ public class SpmkController {
return ResultUtil.data(pageAs, listAs, "操作成功!");
}
//TODO 撤销审批
/**
* 撤销审批
*/
@PutMapping(value = "/revoke_approval/{id}")
@ApiOperation(value = "22.撤销审批", httpMethod = "PUT", notes = "撤销审批")
@Transactional(rollbackFor = Exception.class)
@ApiOperationSupport(order = 22)
public Result<Object> revokeApproval(@PathVariable Integer id) throws Exception {
SpmkApproveSummary as = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>()
.lambda()
.select(SpmkApproveSummary::getSts)
.eq(SpmkApproveSummary::getId, id));
return as != null && as.getSts() != 2 ? (SpmkApproveSummary.builder().id(id).endTime(new Date()).sts(1).build().updateById() ?
ResultUtil.success("操作成功!") : ResultUtil.error("操作失败_1!")) : ResultUtil.error("操作失败_2!");
}
/**
* 删除-审批(发起的审批)-根据审批汇总id
*/
@DeleteMapping(value = "/delete_approval/{id}")
@ApiOperation(value = "23.删除-审批(发起的审批)-根据审批汇总id", httpMethod = "DELETE", notes = "删除-审批(发起的审批)-根据审批汇总id")
@ApiOperationSupport(order = 23)
public Result<Object> deleteApprovalData(@PathVariable Integer id){
List<SpmkApproveExecuteRecord> listAer = spmkApproveExecuteRecordMapper.selectList(new QueryWrapper<SpmkApproveExecuteRecord>()
.lambda()
.select(SpmkApproveExecuteRecord::getId)
.eq(SpmkApproveExecuteRecord::getApproveSummaryId, id));
if (listAer != null && listAer.size() > 0) {
for (SpmkApproveExecuteRecord aer : listAer) {
spmkExecutorMapper.delete(new QueryWrapper<SpmkExecutor>().lambda().eq(SpmkExecutor::getApproveExecuteRecordId, aer.getId()));
}
}
spmkApproveExecuteRecordMapper.delete(new QueryWrapper<SpmkApproveExecuteRecord>().lambda().eq(SpmkApproveExecuteRecord::getApproveSummaryId, id));
spmkApproveDetailMapper.delete(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, id));
spmkApproveSummaryMapper.delete(new QueryWrapper<SpmkApproveSummary>().lambda().eq(SpmkApproveSummary::getId, id));
return ResultUtil.data(null, "操作成功!");
}
/**
* 删除-审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据
* 删除-审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据
*/
@DeleteMapping(value = "/delete_approval_data")
@ApiOperation(value = "90.(开发使用)删除-审批数据", httpMethod = "DELETE", notes = "审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据")
@ApiOperation(value = "90.(开发使用)删除-审批数据", httpMethod = "DELETE", notes = "审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据")
@ApiOperationSupport(order = 90)
public Result<Object> deleteApprovalData(@CurrentUser UserBean userBean){
......@@ -658,7 +688,7 @@ public class SpmkController {
spmkApproveDetailMapper.delete(null);
spmkApproveExecuteRecordMapper.delete(null);
spmkExecutorMapper.delete(null);
System.out.println("删除-审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据 完成!");
System.out.println("删除-审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据 完成!");
return ResultUtil.data(null, "操作成功!");
}
......
......@@ -49,6 +49,7 @@ import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.BetweenFormater.Level;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.timer.api.bean.clazz.CommonArea;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.yggl.YgglAttaClfjb;
......@@ -70,6 +71,8 @@ import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.YgEnumInterface;
import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.controller.yggl.service.YgglService;
import cn.timer.api.dao.clazz.CommonAreaMapper;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.yggl.YgAreaDtoMapper;
import cn.timer.api.dao.yggl.YgCityDtoMapper;
......@@ -422,12 +425,20 @@ public class YgglController {
@PostMapping(value = "/updateygda")
@ApiOperation(value = "修改员工档案", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 5)
public Result<Object> updateygda(@CurrentUser UserBean userBean, @RequestBody YgglMainEmp ygglMainEmp) {
public Result<Object> updateygda(@CurrentUser UserBean userBean, @RequestBody YgglMainEmp ygglMainEmp) throws Exception{
if (ygglMainEmp.getEmpNum() != null) {
UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
updateWrapper.eq("org_code", userBean.getOrgCode()).eq("emp_num", ygglMainEmp.getEmpNum());
ygglMainEmp.update(updateWrapper);
// Integer count = qyzxEmpLoginMapper.selectCount(new QueryWrapper<QyzxEmpLogin>().lambda().eq(QyzxEmpLogin::getPhone, ygglMainEmp.getPhone()));
// if (count >= 1) {
// return ResultUtil.error("手机号已被使用!");
// }
//
// QyzxEmpLogin.builder().phone(ygglMainEmp.getPhone()).build()
// .update(new QueryWrapper<QyzxEmpLogin>().lambda().eq(QyzxEmpLogin::getId, userBean.getEmpNum()));
return ResultUtil.data(ygglMainEmp, "修改成功");
}
return ResultUtil.error("请确认该员工是否存在!");
......@@ -483,6 +494,7 @@ public class YgglController {
@ApiOperation(value = "导入威力加强版", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 7)
public Result<List<YgDrjqbDto>> ygdr(@CurrentUser UserBean userBean, @RequestBody YgDrsDto drList) {
drList.setErrorList(new ArrayList<YgDrjqbDto>());
drList.setOrgCode(userBean.getOrgCode());
YgDrsDto tofList = errorFilter(drList);// 滤嘴,过滤信息
if (tofList.getDrList().size() == 0)
......@@ -784,7 +796,7 @@ public class YgglController {
// 员工状态(最大优化)
d.setJobStatus(YgEnumInterface.jobStatus.isZhen(jobStatus));
// 入职日期(最大优化)
d.setRzTime(YgEnumInterface.rzTime.tranTime2(YgEnumInterface.rzTime.tranTime(rzTime)));
d.setRzTime(rzTime != null ? YgEnumInterface.rzTime.tranTime2(YgEnumInterface.rzTime.tranTime(rzTime)) : null);
// 试用期(最大优化)
d.setSyq(YgEnumInterface.syq.choose(syq));
}
......@@ -1521,8 +1533,11 @@ public class YgglController {
@ApiOperation(value = "添加离职计划", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 54)
public Result<YgglMainLzb> addjhlz(@CurrentUser UserBean userBean, @RequestBody LzygQueryDto lzygQueryDto) {
Integer empNum = lzygQueryDto.getEmpNum();
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<YgglMainEmp>();
queryWrapper.eq("emp_num", lzygQueryDto.getEmpNum()).eq("org_code", userBean.getOrgCode());
queryWrapper.eq("emp_num", empNum).eq("org_code", userBean.getOrgCode());
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(queryWrapper);
YgglMainLzb ygglMainLzb = YgglMainLzb.builder().empNum(lzygQueryDto.getEmpNum()).build();
// 移动员工表数据到离职表
......@@ -1530,17 +1545,13 @@ public class YgglController {
ygglMainLzb.insert();
UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
updateWrapper.eq("emp_num", lzygQueryDto.getEmpNum());
updateWrapper.eq("emp_num", empNum);
UpdateWrapper<YgglMainLzb> updateWrapper1 = new UpdateWrapper<YgglMainLzb>();
updateWrapper1.eq("emp_num", lzygQueryDto.getEmpNum());
updateWrapper1.eq("emp_num", empNum);
YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(3).build().update(updateWrapper);
YgglMainLzb.builder().jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).lzTime(lzygQueryDto.getLzTime())
.lzyy(lzygQueryDto.getLzyy()).lzbz(lzygQueryDto.getLzbz()).build().update(updateWrapper1);
// 删除员工表
// ygglMainEmp.deleteById();
// 删除员工登陆表
// QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().id(ygglMainLzb.getEmpNum()).build();
// qyzxEmpLogin.deleteById();
return ResultUtil.data(ygglMainLzb, "添加待离职员工成功");
}
......@@ -1554,22 +1565,29 @@ public class YgglController {
@ApiOperation(value = "确认离职", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 55)
public Result<Void> addlzb(@CurrentUser UserBean userBean, @RequestBody LzygQueryDto lzygQueryDto) {
Integer empNum = lzygQueryDto.getEmpNum();
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<YgglMainEmp>();
queryWrapper.eq("emp_num", lzygQueryDto.getEmpNum());
queryWrapper.eq("emp_num", empNum);
UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
updateWrapper.eq("emp_num", lzygQueryDto.getEmpNum());
updateWrapper.eq("emp_num", empNum);
UpdateWrapper<YgglMainLzb> updateWrapper1 = new UpdateWrapper<YgglMainLzb>();
updateWrapper1.eq("emp_num", lzygQueryDto.getEmpNum());
YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType())
updateWrapper1.eq("emp_num", empNum);
YgglMainEmp.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType())
.build().update(updateWrapper);
YgglMainLzb.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType())
YgglMainLzb.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType())
.sjlzTime(new Date()).build().update(updateWrapper1);
// 查询该员工的关联表
QueryWrapper<QyzxEmpEntAsso> queryWrapper1 = new QueryWrapper<QyzxEmpEntAsso>();
queryWrapper1.eq("emp_num", lzygQueryDto.getEmpNum());
queryWrapper1.eq("emp_num", empNum);
// 确认离职 删除员工关联表
QyzxEmpEntAsso qyzxEmpEntAsso = QyzxEmpEntAsso.builder().empNum(lzygQueryDto.getEmpNum()).build();
qyzxEmpEntAsso.delete(queryWrapper1);
// 初始化 部门主管
zzglBmgwMMapper.update(ZzglBmgwM.builder().leader(null).build(), new UpdateWrapper<ZzglBmgwM>()
.lambda()
.eq(ZzglBmgwM::getLeader, empNum));
return ResultUtil.success("确认离职员工成功");
}
......@@ -1646,6 +1664,25 @@ public class YgglController {
return ResultUtil.data(mz, "展示该民族");
}
@Autowired
CommonAreaMapper commonAreaMapper;
/**
* 籍贯树-Mini
*
* @param
* @return
*/
@GetMapping(value = "/native_place")
@ApiOperation(value = "籍贯树-Mini", httpMethod = "GET", notes = "籍贯树-Mini")
@ApiOperationSupport(order = 60)
public Result<List<CommonArea>> selectNativePlace() {
List<CommonArea> listCommonArea = commonAreaMapper.AllAreaForTree();
return ResultUtil.data(listCommonArea, "操作成功!");
}
/**
* 展示籍贯/展示所有籍贯
*
......
package cn.timer.api.controller.yggl.service;
import cn.timer.api.dto.yggl.LzygQueryDto;
import cn.timer.api.dto.yggl.YgzzDto;
public interface YgglService {
void applicationResignation(LzygQueryDto lzygQueryDto);
void applicationRegularization(YgzzDto ygzzDto);
}
package cn.timer.api.controller.yggl.service;
import java.util.Date;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import cn.hutool.core.bean.BeanUtil;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.yggl.YgglMainLzb;
import cn.timer.api.config.enuminterface.YgEnumInterface;
import cn.timer.api.dto.yggl.LzygQueryDto;
import cn.timer.api.dto.yggl.YgzzDto;
@Service
public class YgglServiceImpl implements YgglService {
@Override
public void applicationResignation(LzygQueryDto lzygQueryDto) {
// TODO Auto-generated method stub
Integer empNum = lzygQueryDto.getEmpNum();
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<YgglMainEmp>();
queryWrapper.eq("emp_num", empNum).eq("org_code", lzygQueryDto.getOrgCode());
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(queryWrapper);
YgglMainLzb ygglMainLzb = YgglMainLzb.builder().empNum(lzygQueryDto.getEmpNum()).build();
// 移动员工表数据到离职表
BeanUtil.copyProperties(ygglMainEmp, ygglMainLzb);
ygglMainLzb.insert();
UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
updateWrapper.eq("emp_num", empNum);
UpdateWrapper<YgglMainLzb> updateWrapper1 = new UpdateWrapper<YgglMainLzb>();
updateWrapper1.eq("emp_num", empNum);
YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).build().update(updateWrapper);
YgglMainLzb.builder().jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).lzTime(lzygQueryDto.getLzTime())
.lzyy(lzygQueryDto.getLzyy()).lzbz(lzygQueryDto.getLzbz()).build().update(updateWrapper1);
}
@Override
public void applicationRegularization(YgzzDto ygzzDto) {
// TODO Auto-generated method stub
YgglMainEmp.builder()
.jobStatus(2)
.zzTime(ygzzDto.getZzTime())
.sjzzTime(new Date())
.zzRemark(ygzzDto.getZzRemark())
.build().update(new UpdateWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, ygzzDto.getEmpNum()));
}
}
......@@ -229,19 +229,19 @@ public class ZzglController {
// zzglLogDgjlMapper.insert
return ResultUtil.success();
}
//修改/删除员工部门(供审批管理使用)
public void updatelistempdeptforspgl (Integer empNum,Integer orgCode, UpEmpDeptDto upEmpDeptDto) {
Integer dpetId = upEmpDeptDto.getDpetId();
List<Integer> empNums = new ArrayList<Integer>();
empNums.add(empNum);
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build();
// zzglLogDgjlMapper
UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
updateWrapper.set("bmgw_id", dpetId).eq("org_code", orgCode).in("emp_num", empNum);
zzglLogDgjlMapper.insertbyaddemp(empNums, empNum, dpetId, orgCode,
dpetId == null || dpetId == 0 ? "岗位删除员工" : upEmpDeptDto.getIsdg() == null ? "岗位添加员工" : "员工调岗");
ygglMainEmp.update(updateWrapper);
// zzglLogDgjlMapper.insert
}
/**
......
......@@ -2,6 +2,8 @@ package cn.timer.api.controller.zzgl.service;
import java.util.List;
import cn.timer.api.dto.zzgl.UpEmpDeptDto;
/**
* 部门岗位 服务层
*
......@@ -9,6 +11,8 @@ import java.util.List;
*/
public interface ZzglBmgwMService {
public List<Integer> empNumupGetDepts(Integer orgCode,Integer empNum);
List<Integer> empNumupGetDepts(Integer orgCode,Integer empNum);
void applicationTransferPosition(Integer empNum,Integer orgCode,UpEmpDeptDto upEmpDeptDto);
}
package cn.timer.api.controller.zzgl.service;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......@@ -7,6 +8,7 @@ import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import cn.hutool.core.collection.ListUtil;
......@@ -14,6 +16,8 @@ import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dao.zzgl.ZzglLogDgjlMapper;
import cn.timer.api.dto.zzgl.UpEmpDeptDto;
/**
* 部门岗位 服务逻辑层
......@@ -29,6 +33,9 @@ public class ZzglBmgwMServiceImpl implements ZzglBmgwMService {
@Autowired
private YgglMainEmpMapper ygglMainEmpMapper;
@Autowired
private ZzglLogDgjlMapper zzglLogDgjlMapper;
//根据传来的empNum获取该人员的岗位,以及上面所有的部门id,返回integer数组
@Override
public List<Integer> empNumupGetDepts(Integer orgCode,Integer empNum) {
......@@ -61,4 +68,22 @@ public class ZzglBmgwMServiceImpl implements ZzglBmgwMService {
return lanzi;
}
/**
* 调岗
*/
@Override
public void applicationTransferPosition(Integer empNum,Integer orgCode,UpEmpDeptDto upEmpDeptDto) {
// TODO Auto-generated method stub
Integer dpetId = upEmpDeptDto.getDpetId();
List<Integer> empNums = new ArrayList<Integer>();
empNums.add(empNum);
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build();
UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
updateWrapper.set("bmgw_id", dpetId).eq("org_code", orgCode).in("emp_num", empNum);
zzglLogDgjlMapper.insertbyaddemp(empNums, empNum, dpetId, orgCode,
dpetId == null || dpetId == 0 ? "岗位删除员工" : upEmpDeptDto.getIsdg() == null ? "岗位添加员工" : "员工调岗");
ygglMainEmp.update(updateWrapper);
}
}
package cn.timer.api.dao.clazz;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.clazz.CommonArea;
/**
* 地区
* @author Tang 2020-05-09
*/
@Repository
public interface CommonAreaMapper extends BaseMapper<CommonArea> {
List<CommonArea> AllAreaForTree();
}
package cn.timer.api.dao.spmk;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.timer.api.bean.dzht.DzhtAssoHtmb;
import cn.timer.api.bean.spmk.SpmkApproveSummary;
import cn.timer.api.dto.spmk.MySummaryQueryDto;
import cn.timer.api.dto.spmk.SummaryQueryDto;
......
......@@ -31,6 +31,9 @@ public class SpmkApproveSummaryDto{
@ApiModelProperty(value = "审批名称 ", example = "审批名称", required = true)
private String approveName;
@ApiModelProperty(value = "摘要", example = "摘要", required = true)
private String digest;
@NotBlank(message = "initiator为空")
@ApiModelProperty(value = "发起人名称 ", example = "发起人名称", required = true)
private String initiator;
......
......@@ -49,6 +49,9 @@ public class LzygQueryDto extends Page implements Serializable{
@ApiModelProperty(value="员工工号",example="666")
private Integer empNum;
@ApiModelProperty(value="企业id",example="666")
private Integer orgCode;
@ApiModelProperty(value="应离职时间",example="2019-12-12")
private Date lzTime;
}
package cn.timer.api.utils;
import java.io.Serializable;
import lombok.Data;
@Data
public class ApiReturnObject implements Serializable{
private static final long serialVersionUID = 1L;
public ApiReturnObject(String errorCode, Object errorMessage, Object returnObject) {
super();
this.errorCode = errorCode;
this.errorMessage = errorMessage;
this.returnObject = returnObject;
}
public ApiReturnObject(Object errorMessage, Object returnObject) {
super();
this.errorMessage = errorMessage;
this.returnObject = returnObject;
}
String errorCode="00";
Object errorMessage;
Object returnObject;
String pageNumber;
String pageSize;
String totalElements;
String totalPages;
public ApiReturnObject(String pageNumber,String pageSize,String totalElements,String totalPages,String errorCode, Object errorMessage, Object returnObject) {
super();
this.pageNumber = pageNumber;
this.errorCode = errorCode;
this.errorMessage = errorMessage;
this.returnObject = returnObject;
this.pageSize = pageSize;
this.totalElements = totalElements;
this.totalPages = totalPages;
}
}
package cn.timer.api.utils;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class ApiReturnUtil implements Serializable{
private static final long serialVersionUID = 1L;
public static ApiReturnObject error(Object errorMessage) {
System.out.println(errorMessage);
List<Object> object=new ArrayList<Object>();
return new ApiReturnObject("01",errorMessage,object);
}
public static ApiReturnObject error(Object errorMessage, Object returnObject) {
List<Object> object=new ArrayList<Object>();
object.add(returnObject);
return new ApiReturnObject("01",errorMessage,object);
}
public static ApiReturnObject success(Object returnObject) {
if(returnObject instanceof java.util.List){
return new ApiReturnObject("00","success",returnObject);
}else {
List<Object> object=new ArrayList<Object>();
object.add(returnObject);
return new ApiReturnObject("00","success",object);
}
}
public static ApiReturnObject success(Object errorMessage, Object returnObject) {
if(returnObject instanceof java.util.List){
return new ApiReturnObject("00",errorMessage,returnObject);
}else {
List<Object> object=new ArrayList<Object>();
object.add(returnObject);
return new ApiReturnObject("00",errorMessage,object);
}
}
public static ApiReturnObject pageManual(Integer pageNumber, Integer pageSize,Integer countNum, List<Void> returnObject) {
return new ApiReturnObject(pageNumber+"",pageSize+"",countNum+"",getTotalPages(countNum, pageSize),"00","success",returnObject);
}
public static String getTotalPages(Integer countNum, Integer pageSize) {
if((countNum%pageSize)==0) {
return ((countNum/pageSize))+"";
}else {
return ((countNum/pageSize)+1)+"";
}
}
}
package cn.timer.api.utils;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.springframework.web.multipart.MultipartFile;
public class ExcelUtil<T> {
/**
* HSSFWorkbook excel 的文档对象 HSSFSheet excel 的表单 HSSFRow excel 的行 HSSFCell excel
* 的格子单元
*/
/**
* 导出xls文件
*
* @param title sheet标题
* @param headers 第一行标题
* @param dataset 集合数据/表单内容
* @param out
* @param pattern
*/
public void exportExcel(String title, String[] headers, Collection<T> dataset, OutputStream out, String pattern) {
// 创建工作簿
// SXSSFWorkbook workbook = new SXSSFWorkbook(1000);
HSSFWorkbook workbook = new HSSFWorkbook();
// 创建SHEET页/表格页,title-表格标题
HSSFSheet sheet = (HSSFSheet) workbook.createSheet(title);
// 设置表格默认列宽度为15个字节
sheet.setDefaultColumnWidth((short) 15);
// 创建行,从0开始
HSSFRow row = (HSSFRow) sheet.createRow(0);
// 创建单元格样式对象(设置样式)
HSSFCellStyle ztStyle = workbook.createCellStyle();
// 创建字体对象
ztStyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
ztStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
ztStyle.setFillForegroundColor((short) 42);// 前景填充色
// ztStyle.setFillForegroundColor(IndexedColors.YELLOW.index);//前景填充色-黄色
ztStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);// 设置前景填充样式
// 边框
ztStyle.setBorderBottom(BorderStyle.THIN);// 下边框
ztStyle.setBorderLeft(BorderStyle.THIN);// 左边框
ztStyle.setBorderRight(BorderStyle.THIN);// 右边框
ztStyle.setBorderTop(BorderStyle.THIN); // 上边框
HSSFCellStyle namestyle = workbook.createCellStyle();
namestyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
namestyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
namestyle.setBorderBottom(BorderStyle.THIN);// 下边框
namestyle.setBorderLeft(BorderStyle.THIN);// 左边框
namestyle.setBorderRight(BorderStyle.THIN);// 右边框
namestyle.setBorderTop(BorderStyle.THIN); // 上边框
for (short i = 0; i < headers.length; i++) {
// 创建单元格
HSSFCell cell = row.createCell(i);
row.setHeightInPoints(30); // 设置行高
sheet.createFreezePane(0, 1);// 冻结第1行
cell.setCellValue(headers[i]);// 设置每一列的值
cell.setCellStyle(ztStyle);// 样式应用到该单元格上
/**
* 四个参数的含义:
*
* a表示要冻结的列数;
*
* b表示要冻结的行数;
*
* c表示右边区域[可见]的首列序号;
*
* d表示下边区域[可见]的首行序号;
*/
// sheet.createFreezePane(a,b,c,d);
}
// 遍历集合数据,产生数据行
Iterator<T> it = dataset.iterator();
int index = 0;
while (it.hasNext()) {
index++;
row = sheet.createRow(index);// 创建第 index 行
T t = it.next();
// 利用反射,根据javabean属性的先后顺序,动态调用getXxx()方法得到属性值
Field[] fields = t.getClass().getDeclaredFields();
for (short i = 0; i < fields.length; i++) {
HSSFCell cell = row.createCell(i);
Field field = fields[i];
String fieldName = field.getName();
// 动态拼接getXxx获取属性值方法 如:TUserLand类 loginname 动态获取 -》 getLoginname 这个方法名
String getMethodName = "get" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
try {
Class<? extends Object> tclass = t.getClass();
Method getMethod = tclass.getMethod(getMethodName, new Class[] {});
Object value = getMethod.invoke(t, new Object[] {});
String textValue = null;
if (value instanceof Date) {
Date date = (Date) value;
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
textValue = sdf.format(date);
} else if (fieldName.length() >= 4
&& "Time".equalsIgnoreCase(fieldName.substring(fieldName.length() - 4))) {
textValue = DateFormatUtils.getStringByTimestampAndParm((Long) value, "YYYY-MM-DD");
} else {
// 其它数据类型都当作字符串简单处理
textValue = value != null ? value.toString() : "";
}
// 如果不是图片数据,就利用正则表达式判断textValue是否全部由数字组成
if (textValue != null) {
Pattern p = Pattern.compile("^//d+(//.//d+)?$");// 正则表达式
Matcher matcher = p.matcher(textValue);
if (matcher.matches()) {
// 是数字当作double处理
cell.setCellValue(Double.parseDouble(textValue));
} else {
cell.setCellValue(textValue);
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
// 清理资源
}
row.setHeightInPoints(25);// 设置行高为25(猜测单位为px)
cell.setCellStyle(namestyle); // 渲染单元格
}
}
try {
workbook.write(out);
workbook.close();
} catch (IOException e) {
e.printStackTrace();
}
}
@SuppressWarnings("unused")
public Collection<T> importExcel(File file, Collection<T> dataset) throws Exception {
// 装载流
POIFSFileSystem fs = new POIFSFileSystem(((MultipartFile) file).getInputStream());
HSSFWorkbook hw = new HSSFWorkbook(fs);
// 获取第一个sheet页
HSSFSheet sheet = hw.getSheetAt(0);
// 创建容器
//List<Map<String, Object>> ret = new ArrayList<Map<String, Object>>();
dataset = new ArrayList<T>(sheet.getLastRowNum()-1);
Iterator<T> it = dataset.iterator();
// 遍历行 从下标第一行开始(去除标题)
for (int i = 1; i < sheet.getLastRowNum() + 1; i++) {
T t = it.next();
Field[] fields = t.getClass().getDeclaredFields();
HSSFRow row = sheet.getRow(i);
if (row != null) {
// 装载obj
for (int k = 0; k < row.getLastCellNum(); k++) {
HSSFCell cell = row.getCell(k);
Field field = fields[k];
String fieldName = field.getName();
//动态拼接getXxx获取属性值方法 如:TUserLand类 loginname 动态获取 -》 setLoginname 这个方法名
String getMethodName = "set"+ fieldName.substring(0, 1).toUpperCase()+ fieldName.substring(1);
Class<? extends Object> tclass = t.getClass();
Method getMethod = tclass.getMethod(getMethodName,new Class[] {});
getMethod.invoke(t, ExcelUtil.cellFormat(cell));
String textValue = null;
}
//ret.add(dataObj(dataset, row));
}
}
hw.close();
return dataset;
}
@SuppressWarnings("deprecation")
private static String cellFormat(HSSFCell cell){
String result = new String();
if (null != cell) {
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_NUMERIC: // 数字
String cellValue = new DecimalFormat("0").format(cell.getNumericCellValue());
if (cellValue.lastIndexOf("E") > -1) {
cell.setCellValue(new DecimalFormat("#").format(cell.getNumericCellValue()));
}
String str = String.valueOf(cell);
if (str.indexOf(".0") != -1 || str.indexOf("-") != -1) {
if (HSSFDateUtil.isCellDateFormatted(cell)) {// 处理日期格式、时间格式
SimpleDateFormat sdf = null;
if (cell.getCellStyle().getDataFormat() == HSSFDataFormat
.getBuiltinFormat("h:mm")) {
sdf = new SimpleDateFormat("HH:mm");
} else {// 日期
sdf = new SimpleDateFormat("yyyyMMdd");
}
Date date = cell.getDateCellValue();
result = sdf.format(date);
cell.setCellValue(result);
} else if (cell.getCellStyle().getDataFormat() == 176) {
// 处理自定义日期格式:m月d日(通过判断单元格的格式id解决,id的值是58)
double value = cell.getNumericCellValue();
Date date = org.apache.poi.ss.usermodel.DateUtil.getJavaDate(value);
result = DateFormatUtils.tranDate(date, "yyyyMMdd");
cell.setCellValue(result);
} else if (cell.getCellStyle().getDataFormat() == 14
|| cell.getCellStyle().getDataFormat() == 31) {
double value = cell.getNumericCellValue();
Date date = org.apache.poi.ss.usermodel.DateUtil.getJavaDate(value);
result = DateFormatUtils.tranDate(date, "yyyyMMdd");
cell.setCellValue(result);
}
System.out.println(result);
}
break;
case HSSFCell.CELL_TYPE_STRING: // 字符串
// System.out.print(cell.getStringCellValue()
// + " ");
break;
case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean
// System.out.println(cell.getBooleanCellValue()
// + " ");
break;
case HSSFCell.CELL_TYPE_FORMULA: // 公式
// System.out.print(cell.getCellFormula() + " ");
break;
case HSSFCell.CELL_TYPE_BLANK: // 空值
// System.out.println(" ");
break;
case HSSFCell.CELL_TYPE_ERROR: // 故障
// System.out.println(" ");
break;
default:
// System.out.print("未知类型 ");
break;
}
return result;
}
return null;
}
@SuppressWarnings("unused")
private static Map<String, Object> dataObj(Object obj, HSSFRow row) throws Exception {
Class<?> rowClazz = obj.getClass();
Field[] fields = FieldUtils.getAllFields(rowClazz);
if (fields == null || fields.length < 1) {
return null;
}
// 容器
Map<String, Object> map = new HashMap<String, Object>();
// 注意excel表格字段顺序要和obj字段顺序对齐 (如果有多余字段请另作特殊下标对应处理)
for (int j = 0; j < fields.length; j++) {
map.put(fields[j].getName(), getVal(row.getCell(j)));
}
return map;
}
@SuppressWarnings("deprecation")
public static String getVal(HSSFCell hssfCell) {
if (hssfCell != null) {
hssfCell.setCellType(Cell.CELL_TYPE_STRING);
return hssfCell.getStringCellValue();
} else {
return "";
}
}
}
package cn.timer.api.utils;
import java.lang.reflect.Field;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Cell;
import org.springframework.web.multipart.MultipartFile;
/**
*
* @author Tang
* @date 2019年7月26日
*
*/
public class ImportExcelUntil {
/**
* 拼装单个obj
*
* @param obj
* @param row
* @return
* @throws Exception
*/
private static Map<String, Object> dataObj(Object obj, HSSFRow row)
throws Exception {
Class<?> rowClazz = obj.getClass();
Field[] fields = FieldUtils.getAllFields(rowClazz);
if (fields == null || fields.length < 1) {
return null;
}
// 容器
Map<String, Object> map = new HashMap<String, Object>();
// 注意excel表格字段顺序要和obj字段顺序对齐 (如果有多余字段请另作特殊下标对应处理)
for (int j = 0; j < fields.length; j++) {
map.put(fields[j].getName(), getVal(row.getCell(j)));
}
return map;
}
@SuppressWarnings("deprecation")
public static List<Map<String, Object>> importExcel(MultipartFile file,Object obj) throws Exception {
// 装载流
POIFSFileSystem fs = new POIFSFileSystem(file.getInputStream());
HSSFWorkbook hw = new HSSFWorkbook(fs);
// 获取第一个sheet页
HSSFSheet sheet = hw.getSheetAt(0);
// 容器
List<Map<String, Object>> ret = new ArrayList<Map<String, Object>>();
// 遍历行 从下标第一行开始(去除标题)
for (int i = 1; i < sheet.getLastRowNum() + 1; i++) {
HSSFRow row = sheet.getRow(i);
String result = new String();
if (row != null) {
// 装载obj
for (int k = 0; k < row.getLastCellNum(); k++) {
HSSFCell cell = row.getCell(k);
if (null != cell) {
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_NUMERIC: // 数字
// System.out.print(cell.getNumericCellValue()
// + " ");
// System.out.print( new DecimalFormat("#").format(cellValue));
DecimalFormat df=new DecimalFormat("0");
String cellValue = df.format(cell.getNumericCellValue());;
if(cellValue.lastIndexOf("E")>-1){
cell.setCellValue(new DecimalFormat("#").format(cell.getNumericCellValue()));
}
String str = String.valueOf(cell);
if (str.indexOf(".0") != -1 || str.indexOf("-") != -1) {
if (HSSFDateUtil.isCellDateFormatted(cell)) {// 处理日期格式、时间格式
SimpleDateFormat sdf = null;
if (cell.getCellStyle().getDataFormat() == HSSFDataFormat.getBuiltinFormat("h:mm")) {
sdf = new SimpleDateFormat("HH:mm");
} else {// 日期
sdf = new SimpleDateFormat("yyyyMMdd");
}
Date date = cell.getDateCellValue();
result = sdf.format(date);
cell.setCellValue(result);
} else if (cell.getCellStyle().getDataFormat() == 176) {
// 处理自定义日期格式:m月d日(通过判断单元格的格式id解决,id的值是58)
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
double value = cell.getNumericCellValue();
Date date = org.apache.poi.ss.usermodel.DateUtil.getJavaDate(value);
result = sdf.format(date);
cell.setCellValue(result);
} else if(cell.getCellStyle().getDataFormat() == 14 || cell.getCellStyle().getDataFormat() == 31){
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
double value = cell.getNumericCellValue();
Date date = org.apache.poi.ss.usermodel.DateUtil.getJavaDate(value);
result = sdf.format(date);
cell.setCellValue(result);
}
System.out.println(result);
}
break;
case HSSFCell.CELL_TYPE_STRING: // 字符串
// System.out.print(cell.getStringCellValue()
// + " ");
break;
case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean
// System.out.println(cell.getBooleanCellValue()
// + " ");
break;
case HSSFCell.CELL_TYPE_FORMULA: // 公式
// System.out.print(cell.getCellFormula() + " ");
break;
case HSSFCell.CELL_TYPE_BLANK: // 空值
// System.out.println(" ");
break;
case HSSFCell.CELL_TYPE_ERROR: // 故障
// System.out.println(" ");
break;
default:
// System.out.print("未知类型 ");
break;
}
}
}
ret.add(dataObj(obj, row));
}
}
hw.close();
return ret;
}
/**
* 处理val(暂时只处理string和number,可以自己添加自己需要的val类型)
*
* @param hssfCell
* @return
*/
@SuppressWarnings("deprecation")
public static String getVal(HSSFCell hssfCell) {
if(hssfCell!=null){
hssfCell.setCellType(Cell.CELL_TYPE_STRING);
return hssfCell.getStringCellValue();
}else {
return "";
}
}
}
\ No newline at end of file
package cn.timer.api.utils;
import java.util.Calendar;
import java.util.Date;
public class LevelPriceDateFromatUtils {
/**
* 时间运算
* @param unit
* @param num
* @param time
* @return
*/
public static Long getTimestampByUnitAndNumAddTime(String unit,Long num,Long time) {
//单位 1天 2月 3季 4年 5两年
Calendar calendar = LevelPriceDateFromatUtils.getCalendarByTimestamp(time);
switch (unit) {
case "1":
calendar.add(Calendar.DATE, num.intValue());
break;
case "2":
calendar.add(Calendar.DAY_OF_MONTH, num.intValue());
break;
case "3":
calendar.add(Calendar.DAY_OF_MONTH, num.intValue()*3);//一季度等于三个月
break;
case "4":
calendar.add(Calendar.YEAR, num.intValue());
break;
case "5":
calendar.add(Calendar.YEAR, num.intValue()*2);
for (int i = 0; i < num; i++) {
calendar.add(Calendar.YEAR, 1);//买二送一
}
break;
default:
break;
}
return calendar.getTimeInMillis();
}
public static Calendar getCalendarByTimestamp(Long time) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(time);
return cal;
}
public static Long getTimestampByNow() {
Date date = new Date();
return date.getTime();
}
public static void main(String[] args) {
//System.out.println(3/2);
System.out.println(getCalendarByTimestamp(0L).get(Calendar.YEAR));
}
}
package cn.timer.api.utils;
import java.text.SimpleDateFormat;
/**
* 随机数生成
* @author Administrator
*/
public class NumberedGeneration {
public static Integer test(int l) {
String str = new SimpleDateFormat("yy-mm-dd")
.format(new java.util.Date());
long m = Long.parseLong((str));
Integer ret = (int) (m + l);
long n = l + 1;
System.out.println(n);
return ret+1000;
}
public static Integer six() {
Integer ret =(int)((Math.random()*9+1)*100000);
return ret;
}
public static Integer eight() {
Integer ret =(int)((Math.random()*9+1)*10000000);
return ret;
}
public static Integer nine() {
Integer ret =(int)((Math.random()*9+1)*100000000);
return ret;
}
public static Integer test2() {
Integer ret = (int) (Math.random()*9000+1000);
return ret;
}
public static void main(String[] args) {
//System.out.println(six());
}
}
package cn.timer.api.utils;
import java.io.Serializable;
import org.springframework.stereotype.Service;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description:Json返回结果集工具类
* @Package:org.jeese.model
* @author:wubc
* @version:1.0
* @date:2017年10月30日-下午1:51:24
* @Copyright:2017 Inc. All rights reserved.
*/
@ApiModel
@Service("responseResultnew")
public class ResponseResultNew<T> implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value="code",example="101")
private String code;
@ApiModelProperty(value="result",example="101")
private boolean result;
@ApiModelProperty(value="message",example="101")
private String message;
@ApiModelProperty(value="data",example="101")
private T data;
// private List<T> datas;
//
// private T page;
//
//
// private static final String PAGE_KEY = "page";
// private static final String NUMBER_KEY = "number";
// private static final String SIZE_KEY = "size";
// private static final String TOTALELEMENTS_KEY = "totalelements";
// private static final String TOTALPAGES_KEY = "totalpages";
// private static final String OFFSET_KEY = "offset";
private static final String MESSAGE_SUCCESS = "操作成功";
// private static final String MESSAGE_FAIL = "操作失败";
// private static final String MESSAGE_ERROR = "操作错误";
// private static final String MESSAGE_UNLOGIN = "会话超时,请重新登录";
// private static final String MESSAGE_KICKOUT = "当前账户已在其他地方登录,请重新登录";
// private static final String MESSAGE_PARAMERROR = "参数错误";
// private static final String MESSAGE_UNAUTHORIZED = "授权错误";
// private static final String MESSAGE_UNAUTHENTICATED = "认证错误";
// private static final String MESSAGE_EXCEPTION = "服务器异常";
private static final String STATUS_CODE_SUCCESS = "200";
// private static final String STATUS_CODE_FAIL = "201";
// private static final String STATUS_CODE_ERROR = "202";
// private static final String STATUS_CODE_UNLOGIN = "301";
// private static final String STATUS_CODE_KICKOUT = "302";
// private static final String STATUS_CODE_UNPARAM = "400";
// private static final String STATUS_CODE_UNAUTHORIZED = "401";
// private static final String STATUS_CODE_UNAUTHENTICATED = "405";
// private static final String STATUS_CODE_EXCEPTION = "500";
public ResponseResultNew() {
this.code = STATUS_CODE_SUCCESS;
this.result = Boolean.TRUE;
this.message = MESSAGE_SUCCESS;
this.data = null;
}
/**
* 请求成功
*
* @return
*/
@SuppressWarnings("rawtypes")
public ResponseResultNew success() {
this.code = STATUS_CODE_SUCCESS;
this.result = Boolean.TRUE;
this.message = MESSAGE_SUCCESS;
this.data = null;
return this;
}
/**
* 请求成功,并带消息
*
* @param message
* @return
*/
@SuppressWarnings("rawtypes")
public ResponseResultNew success(String message) {
this.code = STATUS_CODE_SUCCESS;
this.result = Boolean.TRUE;
this.message = message;
this.data = null;
return this;
}
@SuppressWarnings("rawtypes")
public ResponseResultNew fail(String message) {
this.code = STATUS_CODE_SUCCESS;
this.result = Boolean.TRUE;
this.message = message;
this.data = null;
return this;
}
/**
* @param obj
* @return
*/
@SuppressWarnings("rawtypes")
public ResponseResultNew successData(T data) {
this.code = STATUS_CODE_SUCCESS;
this.result = Boolean.TRUE;
this.message = MESSAGE_SUCCESS;
this.data = data;
return this;
}
}
......@@ -3,8 +3,10 @@ package cn.timer.api.utils;
import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream;
import java.util.List;
/**
* 反序列化
*
* @author Administrator
*/
public class SerializationUtils {
......
......@@ -11,8 +11,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.ConvertException;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.json.JSONObject;
import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
import cn.timer.api.bean.spmk.SpmkApproveSummary;
......@@ -44,12 +44,12 @@ public class RouterUtils {
private final static String RELATION_TYPE_DEPARTMENT = "department";
private final static String RELATION_TYPE_USERS = "users";
public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse) {
public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse) throws NumberFormatException, ConvertException, Exception {
return NextNode(listRouter, obj, isFirse, false);
}
// 执行下一个节点
public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse, boolean isAuditNext) {
public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse, boolean isAuditNext) throws NumberFormatException, ConvertException, Exception {
Router router;
if (listRouter != null && listRouter.size() != 0) {
......@@ -261,39 +261,6 @@ public class RouterUtils {
}
private static boolean stringCompare(String s1,String s2,String symbol) {
double d1;
double d2;
switch (symbol) {
case "<":
d1 = Double.parseDouble(s1);
d2 = Double.parseDouble(s2);
if (NumberUtil.compare(d1,d2) == -1) return true;
break;
case "<=":
d1 = Double.parseDouble(s1);
d2 = Double.parseDouble(s2);
if (NumberUtil.compare(d1,d2) == -1 || NumberUtil.compare(d1,d2) == 0) return true;
break;
case "=":
if (s2.equals(s1)) return true;
break;
case ">":
d1 = Double.parseDouble(s1);
d2 = Double.parseDouble(s2);
if (NumberUtil.compare(d1,d2) == 1) return true;
break;
case ">=":
d1 = Double.parseDouble(s1);
d2 = Double.parseDouble(s2);
if (NumberUtil.compare(d1,d2) == 0 || NumberUtil.compare(d1,d2) == 1) return true;
break;
}
return false;
}
public static void getIsFlowChildren(List<Router> listRouter, List<FlowChildren> listFlowChildren) {
// TODO Auto-generated method stub
Router router;
......@@ -320,7 +287,7 @@ public class RouterUtils {
// 审批执行记录 持久化
public static void insertogExecuteRecord(List<FlowChildren> listFlowChildren,Integer asId) {
public static void insertogExecuteRecord(List<FlowChildren> listFlowChildren,Integer asId) throws Exception{
for (int i = 0,m = listFlowChildren.size() ; i < m; i++) {
if (UNEXECUTED.equals(listFlowChildren.get(i).getExecute())) {
......@@ -429,7 +396,7 @@ public class RouterUtils {
* @param opinion 意见
* @param sts 状态 1执行中 2通过 3拒绝
*/
public static void approving(List<FlowChildren> listFlowChildren,Integer asId,Integer executeRecordId, Integer executorId, String opinion,Integer sts,User redeployUser ) {
public static void approving(List<FlowChildren> listFlowChildren,Integer asId,Integer executeRecordId, Integer executorId, String opinion,Integer sts,User redeployUser ) throws Exception {
boolean hasNextApprover = false;
......
package cn.timer.api.utils.router.business;
import cn.hutool.json.JSONObject;
import cn.timer.api.dto.spmk.FromData;
/**
* 外出
* @author Tang
*
*/
public class GoOutBusiness extends SpmkAssoBusiness {
@Override
public void handleApprove(JSONObject jsonObj) throws Exception {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = jsonObj.get("orgCode",FromData.class).getValue();
// 发起人id
String id = jsonObj.get("id",FromData.class).getValue();
// 发起人名称
String initiator = jsonObj.get("initiator",FromData.class).getValue();
// 开始时间
String startTime = jsonObj.get("__startTime",FromData.class).getValue();
// 结束时间
String endTime = jsonObj.get("__endTime",FromData.class).getValue();
// 时长
String longTime = jsonObj.get("__longTime",FromData.class).getValue();
// 出差事由
String businessTrip = jsonObj.get("__businessTrip",FromData.class).getValue();
// 上传文件
String UploadAttachment = jsonObj.get("UploadAttachment",FromData.class).getValue();
// 调 考勤管理 业务
}
}
package cn.timer.api.utils.router.business;
import java.text.ParseException;
import org.springframework.beans.factory.annotation.Autowired;
import cn.hutool.json.JSONObject;
import cn.timer.api.controller.yggl.service.YgglService;
import cn.timer.api.dto.spmk.FromData;
import cn.timer.api.dto.yggl.YgzzDto;
import cn.timer.api.utils.DateFormatUtils;
import lombok.Builder;
/**
......@@ -12,8 +19,11 @@ import lombok.Builder;
@Builder
public class RegularizationBusiness extends SpmkAssoBusiness {
@Autowired
private YgglService ygglService;
@Override
public void handleApprove(JSONObject jsonObj) {
public void handleApprove(JSONObject jsonObj) throws Exception {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = jsonObj.get("orgCode",FromData.class).getValue();
......@@ -32,16 +42,23 @@ public class RegularizationBusiness extends SpmkAssoBusiness {
// 发起人id
String id = jsonObj.get("id",FromData.class).getValue();
Integer id = Integer.parseInt(jsonObj.get("id",FromData.class).getValue());
// 计划转正时间
String confirmationTime = jsonObj.get("confirmationTime",FromData.class).getValue();
// 实际转正时间
String newConfirmationTime = jsonObj.get("__newConfirmationTime",FromData.class).getValue();
// 备注
String Remarks = jsonObj.get("Remarks",FromData.class).getValue();
YgzzDto ygzzDto = YgzzDto.builder()
.empNum(id)
.zzTime(DateFormatUtils.getDateByString(confirmationTime))
.sjzzTime(DateFormatUtils.getDateByString(newConfirmationTime))
.zzRemark(Remarks)
.build();
// 调 员工管理 业务
ygglService.applicationRegularization(ygzzDto);
}
}
package cn.timer.api.utils.router.business;
import java.text.ParseException;
import org.springframework.beans.factory.annotation.Autowired;import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONObject;
import cn.timer.api.controller.yggl.service.YgglService;
import cn.timer.api.dto.spmk.FromData;
import cn.timer.api.dto.yggl.LzygQueryDto;
import cn.timer.api.utils.DateFormatUtils;
import lombok.Builder;
/**
......@@ -12,13 +18,16 @@ import lombok.Builder;
@Builder
public class ResignationBusiness extends SpmkAssoBusiness {
@Autowired
private YgglService ygglService;
@Override
public void handleApprove(JSONObject jsonObj) {
public void handleApprove(JSONObject jsonObj) throws Exception {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = jsonObj.get("orgCode",FromData.class).getValue();
Integer orgCode = Integer.parseInt(jsonObj.get("orgCode",FromData.class).getValue());
// 发起人id
String id = jsonObj.get("id",FromData.class).getValue();
Integer id = Integer.parseInt(jsonObj.get("id",FromData.class).getValue());
// 发起人名称
String initiator = jsonObj.get("initiator",FromData.class).getValue();
......@@ -30,10 +39,18 @@ public class ResignationBusiness extends SpmkAssoBusiness {
String ReasonForResignation = jsonObj.get("__ReasonForResignation",FromData.class).getValue();
// 备注
String Remarks = jsonObj.get("Remarks",FromData.class).getValue();
// 上传文件
String UploadAttachment = jsonObj.get("UploadAttachment",FromData.class).getValue();
LzygQueryDto dto = LzygQueryDto.builder()
.orgCode(orgCode)
.empNum(id)
.lzTime(DateFormatUtils.getDateByString(terminationDate))
.lzyy(ReasonForResignation)
.lzbz(Remarks)
.build();
// 调 员工管理 业务
ygglService.applicationResignation(dto);
}
}
......@@ -11,6 +11,6 @@ import lombok.Data;
@Data
public abstract class SpmkAssoBusiness {
public abstract void handleApprove(JSONObject jsonObj);
public abstract void handleApprove(JSONObject jsonObj) throws Exception;
}
package cn.timer.api.utils.router.business;
import org.springframework.beans.factory.annotation.Autowired;
import cn.hutool.json.JSONObject;
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
import cn.timer.api.dto.spmk.FromData;
import cn.timer.api.dto.zzgl.UpEmpDeptDto;
import lombok.Builder;
/**
......@@ -12,13 +16,16 @@ import lombok.Builder;
@Builder
public class TransferPositionBusiness extends SpmkAssoBusiness {
@Autowired
ZzglBmgwMService zzglBmgwMService;
@Override
public void handleApprove(JSONObject jsonObj) {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = jsonObj.get("orgCode",FromData.class).getValue();
Integer orgCode = Integer.parseInt(jsonObj.get("orgCode",FromData.class).getValue());
// 发起人id
String id = jsonObj.get("id",FromData.class).getValue();
Integer id = Integer.parseInt(jsonObj.get("id",FromData.class).getValue());
// 发起人名称
String initiator = jsonObj.get("initiator",FromData.class).getValue();
......@@ -27,7 +34,7 @@ public class TransferPositionBusiness extends SpmkAssoBusiness {
// 申请原因
String ReasonForApplication = jsonObj.get("__ReasonForApplication",FromData.class).getValue();
// 调入部门
String TransferInDepartment = jsonObj.get("__TransferInDepartment",FromData.class).getValue();
Integer TransferInDepartment = Integer.parseInt(jsonObj.get("__TransferInDepartment",FromData.class).getValue());
// 调入岗位
String TransferInPosition = jsonObj.get("__TransferInPosition",FromData.class).getValue();
// 生效日期
......@@ -37,7 +44,13 @@ public class TransferPositionBusiness extends SpmkAssoBusiness {
// 上传文件
String UploadAttachment = jsonObj.get("UploadAttachment",FromData.class).getValue();
UpEmpDeptDto upEmpDeptDto = UpEmpDeptDto.builder()
.dpetId(TransferInDepartment)
.isdg(1)
.build();
// 调 员工管理 业务
zzglBmgwMService.applicationTransferPosition(id, orgCode, upEmpDeptDto);
}
}
<?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="cn.timer.api.dao.clazz.CommonAreaMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.clazz.CommonArea" >
<id column="code_id" property="codeId" />
<result column="parent_id" property="parentId" />
<result column="city_name" property="cityName" />
</resultMap>
<resultMap id="BaseResultMap_b" type="cn.timer.api.bean.clazz.CommonArea" >
<id column="code_id" property="codeId" />
<result column="parent_id" property="parentId" />
<result column="city_name" property="cityName" />
<collection column="CommonArea_c_code_id" property="commonAreas" ofType="cn.timer.api.bean.clazz.CommonArea"
resultMap="cn.timer.api.dao.clazz.CommonAreaMapper.BaseResultMap" columnPrefix="CommonArea_c_">
</collection>
</resultMap>
<resultMap id="BaseResultMap_Tree" type="cn.timer.api.bean.clazz.CommonArea" >
<id column="code_id" property="codeId" />
<result column="parent_id" property="parentId" />
<result column="city_name" property="cityName" />
<collection column="CommonArea_b_code_id" property="commonAreas" ofType="cn.timer.api.bean.clazz.CommonArea"
resultMap="cn.timer.api.dao.clazz.CommonAreaMapper.BaseResultMap_b" columnPrefix="CommonArea_b_">
</collection>
</resultMap>
<sql id="Base_Column_List">
code_id,
parent_id,
city_name
</sql>
<sql id="Base_Column_List_Alias">
code_id CommonArea_code_id,
parent_id CommonArea_parent_id,
city_name CommonArea_city_name
</sql>
<sql id="Base_Column_List_Alias_a">
a.code_id code_id,
a.parent_id parent_id,
a.city_name city_name
</sql>
<sql id="Base_Column_List_Alias_b">
b.code_id CommonArea_b_code_id,
b.parent_id CommonArea_b_parent_id,
b.city_name CommonArea_b_city_name
</sql>
<sql id="Base_Column_List_Alias_c">
c.code_id CommonArea_b_CommonArea_c_code_id,
c.parent_id CommonArea_b_CommonArea_c_parent_id,
c.city_name CommonArea_b_CommonArea_c_city_name
</sql>
<select id="AllAreaForTree" resultMap="BaseResultMap_Tree">
SELECT
<include refid="Base_Column_List_Alias_a" />,
<include refid="Base_Column_List_Alias_b" />,
<include refid="Base_Column_List_Alias_c" />
FROM common_area a
LEFT JOIN common_area b ON a.code_id = b.parent_id
LEFT JOIN common_area c ON b.code_id = c.parent_id
WHERE a.parent_id = 0
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.clazz.CommonArea">
INSERT INTO common_area
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != codeId'>
code_id,
</if>
<if test ='null != parentId'>
parent_id,
</if>
<if test ='null != cityName'>
city_name
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != codeId'>
#{codeId},
</if>
<if test ='null != parentId'>
#{parentId},
</if>
<if test ='null != cityName'>
#{cityName}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM common_area
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.clazz.CommonArea">
UPDATE common_area
<set>
<if test ='null != codeId'>code_id = #{codeId},</if>
<if test ='null != parentId'>parent_id = #{parentId},</if>
<if test ='null != cityName'>city_name = #{cityName}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM common_area
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM common_area
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM common_area
</select>
-->
</mapper>
\ No newline at end of file
......@@ -16,11 +16,33 @@
<result column="current_approver" property="currentApprover" />
<result column="history_approver" property="historyApprover" />
<result column="asso_type" property="assoType" />
<result column="digest" property="digest" />
<result column="update_time" property="updateTime" />
<result column="end_time" property="endTime" />
<result column="digest" property="digest" />
</resultMap>
<resultMap id="BaseResultMap_As" type="cn.timer.api.bean.spmk.SpmkApproveSummary" >
<id column="id" property="id" />
<result column="org_code" property="orgCode" />
<result column="emp_num" property="empNum" />
<result column="title" property="title" />
<result column="department_name" property="departmentName" />
<result column="initiator" property="initiator" />
<result column="create_time" property="createTime" />
<result column="approve_name" property="approveName" />
<result column="sts" property="sts" />
<result column="current_approver" property="currentApprover" />
<result column="history_approver" property="historyApprover" />
<result column="asso_type" property="assoType" />
<result column="update_time" property="updateTime" />
<result column="end_time" property="endTime" />
<result column="digest" property="digest" />
<result column="gw_name" property="gwName" />
<result column="bm_id" property="bmId" />
<result column="bm_name" property="bmName" />
</resultMap>
<sql id="Base_Column_List">
id,
org_code,
......@@ -75,7 +97,7 @@
digest SpmkApproveSummary_digest
</sql>
<select id="selectPageByQuery" resultMap="BaseResultMap" >
<select id="selectPageByQuery" resultMap="BaseResultMap_As" >
SELECT
<include refid="Base_Column_List_a" />,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) as gw_name,
......@@ -90,8 +112,7 @@
a.id like CONCAT(#{param.query},'%')
)
</if>
<if test="param.sts != null and param.sts != ''">
<if test="param.sts != null">
and a.sts = #{param.sts}
</if>
<if test="param.startTime != null and param.startTime != ''">
......@@ -112,7 +133,7 @@
</select>
<select id="selectPageByQueryForEmpNum" resultMap="BaseResultMap" >
<select id="selectPageByQueryForEmpNum" resultMap="BaseResultMap_As" >
SELECT
<include refid="Base_Column_List_a" />,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) as gw_name,
......@@ -133,7 +154,7 @@
and a.emp_num = #{param.empNum}
</if>
<if test="param.sts != null and param.sts != ''">
<if test="param.sts != null">
and a.sts = #{param.sts}
</if>
<if test="param.query != null and param.query != ''">
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
-->
<application generated-by="eclipse" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_1.xsd">
<classpath>
<dir name="C:/Users/Administrator/git/8timerapiv200/target/classes">
</dir>
</classpath>
</application>
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