Merge remote-tracking branch 'origin/wb' into qa
# Conflicts:
# screen-api/pom.xml
79 files added
19 files modified
| | |
| | | <artifactId>poi-tl</artifactId> |
| | | <version>1.5.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-validation</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>net.coobird</groupId> |
| | | <artifactId>thumbnailator</artifactId> |
| | | <version>0.4.8</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | <version>5.3.0</version> |
| | |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.service.*; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spi.service.contexts.SecurityContext; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Configuration |
| | |
| | | @Bean |
| | | public Docket petApi() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .securityContexts(Arrays.asList(SecurityContext.builder() |
| | | .securityReferences(Arrays.asList(SecurityReference.builder() |
| | | .reference("token") |
| | | .scopes(new AuthorizationScope[]{new AuthorizationScope("global", "accessEverything")}) |
| | | .build())) |
| | | .build())) |
| | | .securitySchemes(Arrays.asList(new ApiKey("token", "token", "header"))) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .apis(RequestHandlerSelectors.basePackage("com.moral.api")) |
| | |
| | | .build(); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.config.Interceptor; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.moral.api.pojo.vo.user.QxUser; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import com.moral.api.utils.StringUtils; |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import com.moral.exception.TokenException; |
| | | import com.moral.util.TokenUtils; |
| | | import net.sf.cglib.beans.BeanMap; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Qualifier; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @ClassName UserHelper |
| | | * @Description TODO |
| | | * @Author @cjl |
| | | * @Date 2023-09-21 15:47 |
| | | * @Version 1.0 |
| | | */ |
| | | |
| | | public class UserHelper { |
| | | public static QxUser getCurrentUser(){ |
| | | Map<String, Object> userInfo = new HashMap<>(); |
| | | try { |
| | | userInfo = (Map<String, Object>) TokenUtils.getUserInfo(); |
| | | }catch (Exception e){ |
| | | } |
| | | if (Objects.isNull(userInfo)||Objects.isNull(userInfo.get("userId"))) { |
| | | return null; |
| | | } |
| | | try { |
| | | String s = JSON.toJSONString(userInfo); |
| | | return JSON.parseObject(s, QxUser.class); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | import java.util.*; |
| | | |
| | | |
| | | @Configuration |
| | | /*@Configuration*/ |
| | | public class MybatisPlusConfig { |
| | | |
| | | public static ThreadLocal<String> tableName = new ThreadLocal<>(); |
New file |
| | |
| | | package com.moral.api.config.mybatis; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import com.baomidou.mybatisplus.core.injector.AbstractMethod; |
| | | import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector; |
| | | import com.baomidou.mybatisplus.extension.injector.methods.LogicDeleteByIdWithFill; |
| | | import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; |
| | | import com.moral.api.config.Interceptor.UserHelper; |
| | | import com.moral.api.pojo.enums.YesOrNo; |
| | | import com.moral.api.pojo.vo.user.QxUser; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName PlusConfig |
| | | * @Description TODO |
| | | * @Author @cjl |
| | | * @Date 2023-09-25 10:28 |
| | | * @Version 1.0 |
| | | */ |
| | | @Configuration |
| | | @MapperScan(basePackages = {"com.moral.*.mapper"}) |
| | | public class PlusConfig { |
| | | @Bean |
| | | public PaginationInterceptor paginationInterceptor() { |
| | | return new PaginationInterceptor(); |
| | | } |
| | | |
| | | @Bean |
| | | public OptimisticLockerInterceptor optimisticLockerInterceptor() { |
| | | return new OptimisticLockerInterceptor(); |
| | | } |
| | | |
| | | |
| | | @Bean |
| | | public DefaultSqlInjector logicSqlInjector() { |
| | | return new DefaultSqlInjector() { |
| | | @Override |
| | | public List<AbstractMethod> getMethodList(Class<?> mapperClass) { |
| | | List<AbstractMethod> methodList = super.getMethodList(mapperClass); |
| | | methodList.add(new LogicDeleteByIdWithFill()); |
| | | return methodList; |
| | | } |
| | | }; |
| | | } |
| | | |
| | | @Bean |
| | | public MetaObjectHandler metaObjectHandler() { |
| | | return new MetaObjectHandler() { |
| | | |
| | | private final static String IS_DEL = "isDel"; |
| | | private final static String IS_INVALID = "isInvalid"; |
| | | private final static String CREATOR_ID = "createId"; |
| | | private final static String CREATOR_NAME = "createName"; |
| | | private final static String CREATE_TIME = "createTime"; |
| | | private final static String LAST_MODIFY_ID = "updateId"; |
| | | private final static String LAST_MODIFY_NAME = "updateName"; |
| | | private final static String LAST_MODIFY_TIME = "updateTime"; |
| | | |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | if (metaObject.hasSetter(IS_DEL)) { |
| | | this.setFieldValByName(IS_DEL, 0, metaObject); |
| | | } |
| | | if (metaObject.hasSetter(IS_INVALID)) { |
| | | this.setFieldValByName(IS_INVALID, 0, metaObject); |
| | | } |
| | | creatorHandler(metaObject); |
| | | lastModifyHandler(metaObject); |
| | | } |
| | | |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | lastModifyHandler(metaObject); |
| | | } |
| | | |
| | | private void creatorHandler(MetaObject metaObject) { |
| | | QxUser currentUser = UserHelper.getCurrentUser(); |
| | | Integer userId = currentUser == null ? 0 : currentUser.getUserId()==null?null:currentUser.getUserId().intValue(); |
| | | String userName = currentUser == null ? "admin" : currentUser.getUserName(); |
| | | if (metaObject.hasSetter(IS_INVALID)) { |
| | | this.strictInsertFill(metaObject, IS_INVALID, Integer.class, YesOrNo.NO.getValue()); |
| | | } |
| | | if (metaObject.hasSetter(IS_DEL)) { |
| | | this.strictInsertFill(metaObject, IS_DEL, Integer.class, YesOrNo.NO.getValue()); |
| | | } |
| | | |
| | | if (metaObject.hasSetter(CREATOR_ID)) { |
| | | this.strictInsertFill(metaObject, CREATOR_ID, Integer.class, userId); |
| | | } |
| | | if (metaObject.hasSetter(CREATOR_NAME)) { |
| | | this.strictInsertFill(metaObject, CREATOR_NAME, String.class, userName); |
| | | } |
| | | if (metaObject.hasSetter(CREATE_TIME)) { |
| | | this.strictInsertFill(metaObject, CREATE_TIME, Date.class, new Date()); |
| | | } |
| | | } |
| | | |
| | | private void lastModifyHandler(MetaObject metaObject) { |
| | | QxUser currentUser = UserHelper.getCurrentUser(); |
| | | Integer userId = currentUser == null ? 0 : currentUser.getUserId()==null?null:currentUser.getUserId().intValue(); |
| | | String userName = currentUser == null ? "admin" : currentUser.getUserName(); |
| | | if (metaObject.hasSetter(LAST_MODIFY_ID)) { |
| | | this.strictUpdateFill(metaObject, LAST_MODIFY_ID, Integer.class, userId); |
| | | } |
| | | if (metaObject.hasSetter(LAST_MODIFY_NAME)) { |
| | | this.strictUpdateFill(metaObject, LAST_MODIFY_NAME, String.class, userName); |
| | | } |
| | | if (metaObject.hasSetter(LAST_MODIFY_TIME)) { |
| | | this.strictUpdateFill(metaObject, LAST_MODIFY_TIME, Date.class, new Date()); |
| | | } |
| | | } |
| | | |
| | | |
| | | }; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.controller; |
| | | |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.aspectj.apache.bcel.generic.RET; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.moral.api.pojo.ext.allocation.AllocationExt; |
| | | import com.moral.api.pojo.ext.allocation.AllocationPageExt; |
| | | import com.moral.api.pojo.query.allocation.*; |
| | | import com.moral.api.pojo.query.allocationextension.AllocationExtensionAddCond; |
| | | import com.moral.api.pojo.vo.allocation.AllocationPageVo; |
| | | import com.moral.api.pojo.vo.allocation.AllocationVo; |
| | | import com.moral.constant.PageResult; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.moral.api.entity.Allocation; |
| | | import com.moral.api.entity.ResponsibilityUnit; |
| | | import com.moral.api.pojo.dto.allocation.AllocationUnitViewDto; |
| | | import com.moral.api.service.AllocationService; |
| | | import com.moral.api.utils.EasyExcelUtils; |
| | | import com.moral.api.utils.NoModelWriteData; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.constant.ResultMessage; |
| | | import com.moral.util.WebUtils; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | |
| | | @Api(tags = {"立行立改"}) |
| | | @RestController |
| | | @RequestMapping("allocation") |
| | | public class AllocationController { |
| | | |
| | | @Autowired |
| | | private AllocationService allocationService; |
| | | |
| | | |
| | | @ApiOperation(value = "污染类型", notes = "污染类型") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "contaminate", method = RequestMethod.GET) |
| | | public ResultMessage contaminate() { |
| | | List<Map<String, Object>> professions = allocationService.sysDictData(Constants.WU_RAN_LEI_XING); |
| | | return ResultMessage.ok(professions); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "责任单位", notes = "责任单位") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "unit", method = RequestMethod.GET) |
| | | public ResultMessage unit() { |
| | | List<ResponsibilityUnit> responsibilityUnits = allocationService.seleteUnit(); |
| | | return ResultMessage.ok(responsibilityUnits); |
| | | } |
| | | |
| | | /** |
| | | * 添加交办单 |
| | | * @return |
| | | */ |
| | | @PostMapping("insert") |
| | | @ApiOperation("新增") |
| | | public ResultMessage insert(@Valid @RequestBody AllocationAddCond allocation){ |
| | | allocationService.insertAllocation(allocation); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查看交办单 |
| | | * @return |
| | | */ |
| | | /* @GetMapping("check") |
| | | public ResultMessage check(Integer id){ |
| | | allocationService.check(id); |
| | | return ResultMessage.ok(); |
| | | }*/ |
| | | |
| | | /** |
| | | * 修改表单 |
| | | * @param allocationUpdateCond |
| | | * @return |
| | | * |
| | | * |
| | | */ |
| | | @PostMapping("update") |
| | | @ApiOperation("修改") |
| | | public ResultMessage update(@Valid @RequestBody AllocationUpdateCond allocationUpdateCond){ |
| | | allocationService.updateAll(allocationUpdateCond); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | @PostMapping("change") |
| | | @ApiOperation("整改") |
| | | public ResultMessage changeAllocation(@Valid @RequestBody AllocationChangeCond changeCond){ |
| | | allocationService.changeAllocation(changeCond); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | @PostMapping("check") |
| | | @ApiOperation("审批") |
| | | public ResultMessage checkAllocation(@Valid @RequestBody AllocationCheckCond checkCond){ |
| | | allocationService.checkAllocation(checkCond); |
| | | return ResultMessage.ok(); |
| | | } |
| | | /** |
| | | * 根据条件查询 |
| | | * @return |
| | | */ |
| | | @GetMapping("selectAll") |
| | | public ResultMessage selectAll(Map<String,Object> map){ |
| | | allocationService.selectAll(map); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | @PostMapping("/page") |
| | | @ApiOperation("分页") |
| | | public ResultMessage<PageResult<AllocationPageVo>> page(@Valid @RequestBody AllocationPageCond allocationPageCond) { |
| | | Page<AllocationPageExt> page = allocationService.extPage(allocationPageCond); |
| | | PageResult<AllocationPageVo> result = new PageResult<>(page); |
| | | result.setList(AllocationPageVo.convert(page.getRecords())); |
| | | return ResultMessage.ok(result); |
| | | } |
| | | @GetMapping("/detail") |
| | | @ApiOperation("详情") |
| | | public ResultMessage<AllocationVo> get(Integer id) { |
| | | AllocationExt allocationext = allocationService.extOne(id); |
| | | AllocationVo allocationVo = AllocationVo.convert(allocationext); |
| | | allocationVo.setFileBaseList(allocationext.getFileBaseList()); |
| | | allocationVo.setFileChangeList(allocationext.getFileChangeList()); |
| | | allocationVo.setFileApproveList(allocationext.getFileApproveList()); |
| | | allocationVo.setApproveList(allocationext.getApproveList()); |
| | | return ResultMessage.ok(allocationVo); |
| | | } |
| | | @GetMapping("remove") |
| | | @ApiOperation("删除") |
| | | public ResultMessage removeById(Integer id){ |
| | | allocationService.removeById(id); |
| | | return ResultMessage.ok(); |
| | | } |
| | | @GetMapping("invalid") |
| | | @ApiOperation("作废") |
| | | public ResultMessage invalidResult(@RequestParam @ApiParam(value = "id",name = "主键id") Integer id, |
| | | @RequestParam @ApiParam(value = "invalidReason",name = "作废理由") String invalidReason){ |
| | | allocationService.invalidResult(id,invalidReason); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | @PostMapping("/applyfor") |
| | | @ApiOperation("申请延期") |
| | | public ResultMessage applyFor(@Valid @RequestBody AllocationExtensionAddCond allocationExtensionAddCond) { |
| | | return allocationService.applyFor(allocationExtensionAddCond) ? ResultMessage.ok() : ResultMessage.fail(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询表单总览 |
| | | * @return |
| | | */ |
| | | @GetMapping("selectUnitView") |
| | | public ResultMessage selectUnitView(HttpServletRequest request){ |
| | | Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); |
| | | Map<String, Object> map1 = allocationService.selectUnitView(params); |
| | | return ResultMessage.ok(map1); |
| | | } |
| | | |
| | | |
| | | @GetMapping("unitExel") |
| | | public void unitExel(HttpServletResponse response,HttpServletRequest request){ |
| | | Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); |
| | | //数据集合 |
| | | Map<String, Object> map1 = allocationService.selectUnitView(params); |
| | | List<AllocationUnitViewDto> unitView = (List<AllocationUnitViewDto>) map1.get("unitView"); |
| | | |
| | | |
| | | ArrayList<Map<String, Object>> mapArrayList = new ArrayList<>(); |
| | | for (AllocationUnitViewDto allocationUnitViewDto : unitView) { |
| | | Map<String, Object> map = entityToMap(allocationUnitViewDto); |
| | | mapArrayList.add(map); |
| | | } |
| | | if (CollectionUtils.isEmpty(mapArrayList)) { |
| | | return; |
| | | } |
| | | Map<String, Object> map = mapArrayList.get(0); |
| | | List<String> list = new ArrayList<>(); |
| | | for (String key : map.keySet()) { |
| | | list.add(key); |
| | | } |
| | | String[] s2 = new String[list.size()]; |
| | | list.toArray(s2); |
| | | NoModelWriteData d = new NoModelWriteData(); |
| | | d.setFileName("数据导出"); |
| | | d.setHeadMap(s2); |
| | | d.setDataStrMap(s2); |
| | | d.setDataList(mapArrayList); |
| | | try { |
| | | EasyExcelUtils easyExcelUtils = new EasyExcelUtils(); |
| | | easyExcelUtils.noModleWrite(d, response); |
| | | } catch (Exception e) { |
| | | int i = 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | 实体类转Map |
| | | */ |
| | | public static Map<String, Object> entityToMap(Object object) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | for (Field field : object.getClass().getDeclaredFields()) { |
| | | try { |
| | | boolean flag = field.isAccessible(); |
| | | field.setAccessible(true); |
| | | Object o = field.get(object); |
| | | map.put(field.getName(), o); |
| | | field.setAccessible(flag); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.moral.api.pojo.ext.allocationextension.AllocationExtensionExt; |
| | | import com.moral.api.pojo.ext.allocationextension.AllocationExtensionPageExt; |
| | | import com.moral.api.pojo.query.allocationextension.AllocationExtensionAddCond; |
| | | import com.moral.api.pojo.query.allocationextension.AllocationExtensionPageCond; |
| | | import com.moral.api.pojo.vo.allocationextension.AllocationExtensionPageVo; |
| | | import com.moral.api.pojo.vo.allocationextension.AllocationExtensionVo; |
| | | import com.moral.api.service.AllocationExtensionService; |
| | | import com.moral.constant.PageResult; |
| | | import com.moral.constant.ResultMessage; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 前端控制器 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/allocationExtension") |
| | | @Api(tags = {"延期申请"}) |
| | | public class AllocationExtensionController { |
| | | |
| | | private final AllocationExtensionService allocationExtensionService; |
| | | |
| | | public AllocationExtensionController(AllocationExtensionService allocationExtensionService) { |
| | | this.allocationExtensionService = allocationExtensionService; |
| | | } |
| | | |
| | | @GetMapping("/detail") |
| | | @ApiOperation("详情") |
| | | public ResultMessage<AllocationExtensionVo> get(Integer id) { |
| | | AllocationExtensionExt allocationExtensionext = allocationExtensionService.extOne(id); |
| | | return ResultMessage.ok(allocationExtensionext == null ? null : AllocationExtensionVo.convert(allocationExtensionext)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/page") |
| | | @ApiOperation("分页") |
| | | public ResultMessage<PageResult<AllocationExtensionPageVo>> page(@Valid @RequestBody AllocationExtensionPageCond allocationExtensionPageCond) { |
| | | Page<AllocationExtensionPageExt> page = allocationExtensionService.extPage(allocationExtensionPageCond); |
| | | PageResult<AllocationExtensionPageVo> result = new PageResult<>(page); |
| | | result.setList(AllocationExtensionPageVo.convert(page.getRecords())); |
| | | return ResultMessage.ok(result); |
| | | } |
| | | |
| | | @GetMapping("check") |
| | | @ApiOperation("审批") |
| | | public ResultMessage check(@RequestParam @ApiParam(value = "id",name = "主键id") Integer id, |
| | | @RequestParam @ApiParam(value = "state",name = "状态") Integer state){ |
| | | allocationExtensionService.check(id,state); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.moral.api.controller; |
| | | |
| | | import com.moral.api.entity.CityConfigAqi; |
| | | import com.moral.api.pojo.enums.ChangeEnum; |
| | | import com.moral.api.pojo.enums.InvestigationEnum; |
| | | import com.moral.api.pojo.enums.StateEnum; |
| | | import com.moral.api.pojo.enums.YesOrNo; |
| | | import com.moral.api.pojo.enums.*; |
| | | import com.moral.api.pojo.vo.DictionaryVo; |
| | | import com.moral.constant.ResultMessage; |
| | | import io.swagger.annotations.Api; |
| | |
| | | .setChangeEnum(ChangeEnum.values()) |
| | | .setInvestigationEnum(InvestigationEnum.values()) |
| | | .setYesOrNo(YesOrNo.values()) |
| | | .setFileTableEnum(FileTableEnum.values()) |
| | | .setAllocationApproveEnum(AllocationApproveEnum.values()) |
| | | .setAllocationExtensionApproveEnum(AllocationExtensionApproveEnum.values()) |
| | | ; |
| | | return ResultMessage.ok(dictionaryVo); |
| | | } |
New file |
| | |
| | | package com.moral.api.controller; |
| | | |
| | | |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import com.moral.api.service.FileTableService; |
| | | import com.moral.constant.ResultMessage; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 附件表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author moral |
| | | * @since 2023-09-21 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/file") |
| | | @Api(tags = {"附件"}) |
| | | public class FileTableController { |
| | | |
| | | private final FileTableService fileTableService; |
| | | |
| | | public FileTableController(FileTableService fileTableService) { |
| | | this.fileTableService = fileTableService; |
| | | } |
| | | |
| | | |
| | | @PostMapping("/upload") |
| | | @ApiOperation("文件上传") |
| | | public ResultMessage<FileVo> upload(@RequestParam("file") @ApiParam(name = "file", value = "上传文件") MultipartFile file, |
| | | @RequestParam("sysCode") @ApiParam(name = "sysCode", value = "系统代码") Integer sysCode){ |
| | | return ResultMessage.ok(fileTableService.upload(file,sysCode)); |
| | | } |
| | | |
| | | @PostMapping("/multipleUpload") |
| | | @ApiOperation("多文件批量上传") |
| | | public ResultMessage<List<FileVo>> upload(@RequestParam("file") @ApiParam(name = "file", value = "上传文件") List<MultipartFile> file, |
| | | @RequestParam("sysCode") @ApiParam(name = "sysCode", value = "系统代码") Integer sysCode){ |
| | | return ResultMessage.ok(fileTableService.upload(file,sysCode)); |
| | | } |
| | | |
| | | @GetMapping("/preview/{id}") |
| | | @ApiOperation("文件预览") |
| | | public void preview(@PathVariable("id") Integer id, HttpServletRequest request, HttpServletResponse response) { |
| | | fileTableService.preview(id, request, response); |
| | | } |
| | | |
| | | @GetMapping("/preview/cover/{id}") |
| | | @ApiOperation("封面图片预览") |
| | | public void coverPreview(@PathVariable("id") Integer id, HttpServletRequest request, HttpServletResponse response) { |
| | | fileTableService.coverPreview(id, request, response); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.entity; |
| | | |
| | | |
| | | import com.moral.api.pojo.bean.BaseInvalidEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class Allocation extends BaseInvalidEntity<Allocation> { |
| | | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value = "allocation_id", type = IdType.AUTO) |
| | | private Integer allocationId; |
| | | |
| | | /** |
| | | *交办单号 |
| | | */ |
| | | private String allocationNum; |
| | | |
| | | /** |
| | | * 自查or核查 |
| | | */ |
| | | private Integer escalationType; |
| | | |
| | | /** |
| | | * 上报时间 |
| | | */ |
| | | private Date escalationTime; |
| | | |
| | | /** |
| | | * 污染位置 |
| | | */ |
| | | private String pollutePosition; |
| | | |
| | | /** |
| | | * 责任单位id |
| | | */ |
| | | private Integer unitId; |
| | | |
| | | /** |
| | | * 污染分类id |
| | | */ |
| | | private Integer polluteType; |
| | | |
| | | /** |
| | | * 整改类型id |
| | | */ |
| | | private Integer changeType; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 期限天数 |
| | | */ |
| | | private Integer changeDay; |
| | | |
| | | /** |
| | | * 上报单位id |
| | | */ |
| | | private Integer escalationUnitId; |
| | | |
| | | /** |
| | | * 上报人 |
| | | */ |
| | | private String escalationName; |
| | | |
| | | /** |
| | | * 排查方式id |
| | | */ |
| | | private Integer investigationType; |
| | | |
| | | /** |
| | | * 问题描述 |
| | | */ |
| | | private String problemDescribe; |
| | | |
| | | /** |
| | | * 是否整改 |
| | | */ |
| | | private Integer isChange; |
| | | |
| | | /** |
| | | * 整改反馈 |
| | | */ |
| | | private String changeDescribe; |
| | | /** |
| | | * 整改人性名 |
| | | */ |
| | | private String changeName; |
| | | |
| | | /** |
| | | * 整改时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date changeTime; |
| | | |
| | | /** |
| | | * 考核分值 |
| | | */ |
| | | private Integer checkScore; |
| | | /** |
| | | * 考核理由 |
| | | */ |
| | | private String checkDescribe; |
| | | /** |
| | | * 考核人 |
| | | */ |
| | | private String checkName; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 考核时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date checkTime; |
| | | /** |
| | | * 状态 0 创建 1 整改 2审核 3 拒绝 4 通过 |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 作废理由 |
| | | */ |
| | | private String invalidReason; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.moral.api.pojo.bean.BaseInvalidEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | public class AllocationExtension extends BaseInvalidEntity<AllocationExtension> { |
| | | |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 交办单id |
| | | */ |
| | | private Integer allocationId; |
| | | |
| | | /** |
| | | * 延期天数 |
| | | */ |
| | | private Integer extensionNum; |
| | | |
| | | /** |
| | | * 延期理由 |
| | | */ |
| | | private String remake; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | |
| | | /** |
| | | * 作废理由 |
| | | */ |
| | | private String invalidReason; |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.entity; |
| | | |
| | | |
| | | import com.moral.api.pojo.bean.BaseDelEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class ApproveTable extends BaseDelEntity<ApproveTable> { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 模块类型 |
| | | */ |
| | | private Integer approveModule; |
| | | |
| | | /** |
| | | * 关联id |
| | | */ |
| | | private Integer relationId; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | private String stateName; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 附件表 |
| | | * </p> |
| | | * |
| | | * @author moral |
| | | * @since 2023-09-21 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class FileTable extends Model<FileTable> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value = "file_id", type = IdType.AUTO) |
| | | private Integer fileId; |
| | | |
| | | /** |
| | | * 模块 |
| | | */ |
| | | private Integer fileModule; |
| | | |
| | | /** |
| | | * 关联主键id |
| | | */ |
| | | private Integer relationId; |
| | | |
| | | /** |
| | | * 附件名称 |
| | | */ |
| | | private String fileName; |
| | | |
| | | /** |
| | | * 附件类型1图片2视频 |
| | | */ |
| | | private Integer fileType; |
| | | |
| | | /** |
| | | * 附件路径地址 |
| | | */ |
| | | private String fileAddress; |
| | | |
| | | /** |
| | | * 附件大小 |
| | | */ |
| | | private Integer fileSize; |
| | | |
| | | /** |
| | | * 是否删除 |
| | | */ |
| | | private Integer isDel; |
| | | |
| | | /** |
| | | * 创建人id |
| | | */ |
| | | private Integer createId; |
| | | |
| | | /** |
| | | * 创建人姓名 |
| | | */ |
| | | private String createName; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.fileId; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.entity; |
| | | |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class ResponsibilityUnit extends Model<ResponsibilityUnit> { |
| | | |
| | | //责任单位id |
| | | @TableId(value = "unit_id", type = IdType.AUTO) |
| | | private Integer unitId; |
| | | |
| | | private String unitName; |
| | | |
| | | private Integer areaCode; |
| | | |
| | | private Integer parentCode; |
| | | //0是生效 1是失效 |
| | | private Integer state; |
| | | //0是未删 1是以删 |
| | | private String isDel; |
| | | //0是为作废 1是已作废 |
| | | private Integer isInvalid; |
| | | |
| | | private String invalidReason; |
| | | |
| | | private Integer createId; |
| | | |
| | | private String createName; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | private Integer updateId; |
| | | |
| | | private String updateName; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | @TableField(exist = false) |
| | | private String areaName; |
| | | |
| | | @TableField(exist = false) |
| | | private String parentName; |
| | | } |
| | |
| | | package com.moral.api.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | |
| | | */ |
| | | private String wechat; |
| | | |
| | | |
| | | private Integer unitId; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | |
| | | */ |
| | | private String isDelete; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer unitCode; |
| | | |
| | | |
| | | } |
| | |
| | | package com.moral.api.exception; |
| | | |
| | | import com.alibaba.druid.wall.violation.ErrorCode; |
| | | import com.moral.api.utils.StringUtils; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import com.moral.constant.ResultMessage; |
| | | import com.moral.exception.TokenException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.support.DefaultMessageSourceResolvable; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.validation.FieldError; |
| | | import org.springframework.web.bind.MethodArgumentNotValidException; |
| | | import org.springframework.web.bind.annotation.ControllerAdvice; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.ResponseStatus; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | @ControllerAdvice |
| | |
| | | @ResponseBody |
| | | @ResponseStatus(HttpStatus.OK) |
| | | public ResultMessage handleUserNotExistException(BusinessException ex) { |
| | | return ResultMessage.fail(ResponseCodeEnum.FAIL.getCode(), "请求用户数据失败"); |
| | | return ResultMessage.fail(ResponseCodeEnum.FAIL.getCode(), ex.getMsg()); |
| | | } |
| | | |
| | | @ExceptionHandler |
| | | public ResultMessage exceptionHandler(MethodArgumentNotValidException e){ |
| | | List<String> collect = e.getBindingResult().getFieldErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage) |
| | | .collect(Collectors.toList()); |
| | | return ResultMessage.fail(ResponseCodeEnum.FAIL.getCode(), StringUtils.join(collect, ",")); |
| | | } |
| | | |
| | | /** |
New file |
| | |
| | | package com.moral.api.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.moral.api.entity.AllocationExtension; |
| | | import com.moral.api.pojo.ext.allocationextension.AllocationExtensionExt; |
| | | import com.moral.api.pojo.ext.allocationextension.AllocationExtensionPageExt; |
| | | import com.moral.api.pojo.query.allocationextension.AllocationExtensionPageCond; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 Mapper 接口 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | public interface AllocationExtensionMapper extends BaseMapper<AllocationExtension> { |
| | | |
| | | |
| | | /** |
| | | * 查询单个详情 |
| | | * @param id |
| | | * @return AllocationExtensionExt |
| | | */ |
| | | AllocationExtensionExt extOne(@Param("id") Integer id); |
| | | |
| | | /** |
| | | * 查询分页详情 |
| | | * @param page |
| | | * @param allocation |
| | | * @return AllocationExtensionPageExt |
| | | */ |
| | | Page<AllocationExtensionPageExt> extPage(Page page, @Param("allocation") AllocationExtensionPageCond allocation); |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.moral.api.entity.Allocation; |
| | | import com.moral.api.pojo.ext.allocation.AllocationExt; |
| | | import com.moral.api.pojo.ext.allocation.AllocationListExt; |
| | | import com.moral.api.pojo.ext.allocation.AllocationPageExt; |
| | | import com.moral.api.pojo.query.allocation.AllocationListCond; |
| | | import com.moral.api.pojo.query.allocation.AllocationPageCond; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface AllocationMapper extends BaseMapper<Allocation> { |
| | | |
| | | /** |
| | | * 查询单个详情 |
| | | * @param id |
| | | * @return AllocationExt |
| | | */ |
| | | AllocationExt extOne(@Param("id") Integer id); |
| | | |
| | | Page<AllocationPageExt> extPage(Page page, @Param("allocation") AllocationPageCond allocationPageCond); |
| | | |
| | | /** |
| | | * 查询列表详情 |
| | | * @param allocationListCond |
| | | * @return AllocationListExt |
| | | */ |
| | | List<AllocationListExt> extList(@Param("allocation") AllocationListCond allocationListCond); |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.mapper; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.moral.api.entity.ApproveTable; |
| | | |
| | | public interface ApproveTableMapper extends BaseMapper<ApproveTable> { |
| | | } |
New file |
| | |
| | | package com.moral.api.mapper; |
| | | |
| | | import com.moral.api.entity.FileTable; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 附件表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author moral |
| | | * @since 2023-09-21 |
| | | */ |
| | | public interface FileTableMapper extends BaseMapper<FileTable> { |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.mapper; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.moral.api.entity.ResponsibilityUnit; |
| | | |
| | | public interface ResponsibilityUnitMapper extends BaseMapper<ResponsibilityUnit> { |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.bean; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.FieldStrategy; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import lombok.Getter; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @ClassName BaseCreateEntity |
| | | * @Description TODO |
| | | * @Author @cjl |
| | | * @Date 2023-09-25 10:54 |
| | | * @Version 1.0 |
| | | */ |
| | | @Getter |
| | | @SuppressWarnings("unchecked") |
| | | public abstract class BaseCreateEntity <T extends Serializable> implements BaseEntity<T>{ |
| | | /** |
| | | * 创建人ID |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NOT_NULL) |
| | | private Integer createId; |
| | | |
| | | /** |
| | | * 创建人姓名 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NOT_NULL) |
| | | private String createName; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NOT_NULL) |
| | | private Date createTime; |
| | | |
| | | public T setCreateUserId(Integer createId) { |
| | | this.createId = createId; |
| | | return (T) this; |
| | | } |
| | | |
| | | public T setCreateUserName(String createName) { |
| | | this.createName = createName; |
| | | return (T) this; |
| | | } |
| | | |
| | | public T setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | return (T) this; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.bean; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.FieldStrategy; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @ClassName BaseDelEntity |
| | | * @Description TODO |
| | | * @Author @cjl |
| | | * @Date 2023-09-25 11:01 |
| | | * @Version 1.0 |
| | | */ |
| | | public abstract class BaseDelEntity <T extends Serializable> extends BaseUpdateEntity<T>{ |
| | | /** |
| | | * 是否删除 |
| | | */ |
| | | @TableLogic |
| | | @TableField(fill = FieldFill.INSERT_UPDATE, updateStrategy = FieldStrategy.NOT_NULL) |
| | | private Integer isDel; |
| | | |
| | | public T setIsDel(Integer isDel) { |
| | | this.isDel = isDel; |
| | | return (T) this; |
| | | } |
| | | |
| | | public Integer getIsDel() { |
| | | return isDel; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.bean; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @ClassName BaseEntity |
| | | * @Description TODO |
| | | * @Author @cjl |
| | | * @Date 2023-09-25 10:56 |
| | | * @Version 1.0 |
| | | */ |
| | | public interface BaseEntity <T extends Serializable> extends Serializable{ |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.bean; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.FieldStrategy; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @ClassName BaseInvalidEntity |
| | | * @Description TODO |
| | | * @Author @cjl |
| | | * @Date 2023-09-25 11:00 |
| | | * @Version 1.0 |
| | | */ |
| | | public abstract class BaseInvalidEntity <T extends Serializable> extends BaseDelEntity<T>{ |
| | | /** |
| | | * 是否作废 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NOT_NULL) |
| | | private Integer isInvalid; |
| | | |
| | | public T setIsInvalid(Integer isInvalid) { |
| | | this.isInvalid = isInvalid; |
| | | return (T) this; |
| | | } |
| | | |
| | | public Integer getIsInvalid() { |
| | | return isInvalid; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.bean; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.FieldStrategy; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import lombok.Getter; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @ClassName BaseUpdateEntity |
| | | * @Description TODO |
| | | * @Author @cjl |
| | | * @Date 2023-09-25 10:57 |
| | | * @Version 1.0 |
| | | */ |
| | | @Getter |
| | | @SuppressWarnings("unchecked") |
| | | public abstract class BaseUpdateEntity <T extends Serializable> extends BaseCreateEntity<T>{ |
| | | /** |
| | | * 更新人ID |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE, updateStrategy = FieldStrategy.NOT_NULL) |
| | | private Integer updateId; |
| | | |
| | | /** |
| | | * 更新人姓名 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE, updateStrategy = FieldStrategy.NOT_NULL) |
| | | private String updateName; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE, updateStrategy = FieldStrategy.NOT_NULL) |
| | | private Date updateTime; |
| | | |
| | | public T setUpdateId(Integer updateId) { |
| | | this.updateId = updateId; |
| | | return (T) this; |
| | | } |
| | | |
| | | public T setUpdateName(String updateName) { |
| | | this.updateName = updateName; |
| | | return (T) this; |
| | | } |
| | | |
| | | public T setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | return (T) this; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.dto.allocation; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | @Data |
| | | public class AllocationUnitDto { |
| | | |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer allocationId; |
| | | |
| | | /** |
| | | *交办单号 |
| | | */ |
| | | private String allocationNum; |
| | | |
| | | /** |
| | | * 自查or核查 |
| | | */ |
| | | private String escalationType; |
| | | |
| | | /** |
| | | * 上报时间 |
| | | */ |
| | | private Date escalationTime; |
| | | |
| | | /** |
| | | * 污染位置 |
| | | */ |
| | | private String pollutePosition; |
| | | |
| | | /** |
| | | * 责任单位名字 |
| | | */ |
| | | private String unitName; |
| | | |
| | | /** |
| | | * 污染分类名字 |
| | | */ |
| | | private String polluteTypeName; |
| | | |
| | | /** |
| | | * 整改类型名字 |
| | | */ |
| | | private String changeTypeName; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 期限天数 |
| | | */ |
| | | private Integer changeDay; |
| | | |
| | | /** |
| | | * 上报单位名字 |
| | | */ |
| | | private String escalationUnitName; |
| | | |
| | | /** |
| | | * 上报人 |
| | | */ |
| | | private String escalationName; |
| | | |
| | | /** |
| | | * 排查方式id |
| | | */ |
| | | private String investigationTypeName; |
| | | |
| | | /** |
| | | * 问题描述 |
| | | */ |
| | | private String problemDescribe; |
| | | |
| | | /** |
| | | * 是否整改 |
| | | */ |
| | | private Integer isChange; |
| | | |
| | | /** |
| | | * 整改反馈 |
| | | */ |
| | | private String changeDescribe; |
| | | /** |
| | | * 整改人性名 |
| | | */ |
| | | private String changeName; |
| | | |
| | | /** |
| | | * 整改时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date changeTime; |
| | | |
| | | /** |
| | | * 考核分值 |
| | | */ |
| | | private Integer checkScore; |
| | | /** |
| | | * 考核理由 |
| | | */ |
| | | private String checkDescribe; |
| | | /** |
| | | * 考核人 |
| | | */ |
| | | private String checkName; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 考核时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date checkTime; |
| | | /** |
| | | * 状态 0 创建 1 整改 2 |
| | | */ |
| | | private String state; |
| | | /** |
| | | * 是否删除 |
| | | */ |
| | | private String isDel; |
| | | /** |
| | | * 是否作废 |
| | | */ |
| | | private String isInvalid; |
| | | /** |
| | | * 作废理由 |
| | | */ |
| | | private String invalidReason; |
| | | |
| | | private Integer createId; |
| | | |
| | | private String createName; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | private Integer updateId; |
| | | |
| | | private String updateName; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.dto.allocation; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class AllocationUnitViewDto { |
| | | |
| | | |
| | | |
| | | private String unitName; |
| | | |
| | | /** |
| | | * 总数 |
| | | */ |
| | | private Integer total; |
| | | |
| | | /** |
| | | * 完成数 |
| | | */ |
| | | private Integer number; |
| | | /** |
| | | *未完成数 |
| | | */ |
| | | private Integer unNumber; |
| | | |
| | | /** |
| | | * 完成率 |
| | | */ |
| | | private String rate; |
| | | |
| | | |
| | | /** |
| | | * 减分 |
| | | */ |
| | | private Integer deduction; |
| | | |
| | | /** |
| | | * 加分 |
| | | */ |
| | | private Integer marks; |
| | | /** |
| | | * 总分 |
| | | */ |
| | | private Integer totalPoints; |
| | | } |
| | |
| | | @JsonFormat(shape = JsonFormat.Shape.OBJECT) |
| | | public enum AllocationApproveEnum implements IntegerValueEnum{ |
| | | /** |
| | | *草稿 |
| | | */ |
| | | DRAFT(9, "草稿"), |
| | | /** |
| | | *新建 |
| | | */ |
| | | NEW_BUILT(10, "新建"), |
| | | /** |
| | | *整改中 |
| | | */ |
| | | UNDER_RECTIFICATION(20, "整改中"), |
| | | // CHANGE(19, "整改"), |
| | | /** |
| | | *整改中 |
| | | */ |
| | | UNDER_RECTIFICATION(20, "整改"), |
| | | /** |
| | | *审批中 |
| | | */ |
New file |
| | |
| | | package com.moral.api.pojo.enums; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.EnumValue; |
| | | import com.fasterxml.jackson.annotation.JsonCreator; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.moral.api.exception.BusinessException; |
| | | import lombok.Getter; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName StateEnum |
| | | * @Description TODO |
| | | * @Author @lizijie |
| | | * @Date 2023-09-20 11:11 |
| | | * @Version 1.0 |
| | | */ |
| | | @Getter |
| | | @JsonFormat(shape = JsonFormat.Shape.OBJECT) |
| | | public enum AllocationEscalationTypeEnum implements IntegerValueEnum { |
| | | |
| | | /** |
| | | *自查 |
| | | */ |
| | | SELF(1, "自查"), |
| | | /** |
| | | *核查 |
| | | */ |
| | | CHECK(2, "核查"), |
| | | ; |
| | | |
| | | @EnumValue |
| | | public final Integer value; |
| | | public final String name; |
| | | |
| | | AllocationEscalationTypeEnum(Integer value, String name) { |
| | | this.value = value; |
| | | this.name = name; |
| | | } |
| | | |
| | | private static Map<Integer, AllocationEscalationTypeEnum> valueMap = new HashMap<>(); |
| | | static { |
| | | for (AllocationEscalationTypeEnum v : AllocationEscalationTypeEnum.values()) { |
| | | valueMap.put(v.value, v); |
| | | } |
| | | } |
| | | @JsonCreator |
| | | public static AllocationEscalationTypeEnum getByValue(Integer value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | AllocationEscalationTypeEnum result = valueMap.get(value); |
| | | if (result == null) { |
| | | throw new BusinessException("枚举转换异常" + value); |
| | | } |
| | | return result; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.enums; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.EnumValue; |
| | | import com.fasterxml.jackson.annotation.JsonCreator; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.moral.api.exception.BusinessException; |
| | | import lombok.Getter; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName InvestigationEnum |
| | | * @Description TODO |
| | | * @Author @cjl |
| | | * @Date 2023-09-20 14:47 |
| | | * @Version 1.0 |
| | | */ |
| | | @Getter |
| | | @JsonFormat(shape = JsonFormat.Shape.OBJECT) |
| | | public enum AllocationExtensionApproveEnum implements IntegerValueEnum{ |
| | | |
| | | /** |
| | | *未申请 |
| | | */ |
| | | NOT_AAPPROVE(10, "未审批"), |
| | | /** |
| | | *申请中 |
| | | */ |
| | | APPLYING(30, "审批中"), |
| | | /** |
| | | *通过 |
| | | */ |
| | | PASS(40, "通过"), |
| | | /** |
| | | *拒绝 |
| | | */ |
| | | REFUSE(50, "拒绝"), |
| | | |
| | | ; |
| | | |
| | | @EnumValue |
| | | public final Integer value; |
| | | public final String name; |
| | | |
| | | AllocationExtensionApproveEnum(Integer value, String name) { |
| | | this.value = value; |
| | | this.name = name; |
| | | } |
| | | |
| | | private static Map<Integer, AllocationExtensionApproveEnum> valueMap = new HashMap<>(); |
| | | static { |
| | | for (AllocationExtensionApproveEnum v : AllocationExtensionApproveEnum.values()) { |
| | | valueMap.put(v.value, v); |
| | | } |
| | | } |
| | | @JsonCreator |
| | | public static AllocationExtensionApproveEnum getByValue(Integer value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | AllocationExtensionApproveEnum result = valueMap.get(value); |
| | | if (result == null) { |
| | | throw new BusinessException("枚举转换异常" + value); |
| | | } |
| | | return result; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.enums; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.EnumValue; |
| | | import com.fasterxml.jackson.annotation.JsonCreator; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.moral.api.exception.BusinessException; |
| | | import lombok.Getter; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName StateEnum |
| | | * @Description TODO |
| | | * @Author @lizijie |
| | | * @Date 2023-09-20 11:11 |
| | | * @Version 1.0 |
| | | */ |
| | | @Getter |
| | | @JsonFormat(shape = JsonFormat.Shape.OBJECT) |
| | | public enum FileTableEnum implements IntegerValueEnum { |
| | | /** |
| | | *交办单基础 |
| | | */ |
| | | ALLOCATION_FOUNDATION(1010201, "交办单基础"), |
| | | /** |
| | | *交办单整改 |
| | | */ |
| | | ALLOCATION_RECTIFICATION(1010202, "交办单整改"), |
| | | /** |
| | | *交办单审批 |
| | | */ |
| | | ALLOCATION_APPROVE(1010203, "交办单审批"), |
| | | |
| | | /** |
| | | *延期申请 |
| | | */ |
| | | ALLOCATION_EXTENSION(1251701, "延期申请"), |
| | | |
| | | ; |
| | | |
| | | @EnumValue |
| | | public final Integer value; |
| | | public final String name; |
| | | |
| | | FileTableEnum(Integer value, String name) { |
| | | this.value = value; |
| | | this.name = name; |
| | | } |
| | | |
| | | private static Map<Integer, FileTableEnum> valueMap = new HashMap<>(); |
| | | static { |
| | | for (FileTableEnum v : FileTableEnum.values()) { |
| | | valueMap.put(v.value, v); |
| | | } |
| | | } |
| | | @JsonCreator |
| | | public static FileTableEnum getByValue(Integer value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | FileTableEnum result = valueMap.get(value); |
| | | if (result == null) { |
| | | throw new BusinessException("枚举转换异常" + value); |
| | | } |
| | | return result; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.enums; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.EnumValue; |
| | | import com.fasterxml.jackson.annotation.JsonCreator; |
| | | import lombok.Getter; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName FileType |
| | | * @Description |
| | | * @Author fan |
| | | * @Date 2021/2/1 13:48 |
| | | * @Version 1.0 |
| | | **/ |
| | | @Getter |
| | | public enum FileType { |
| | | |
| | | /** |
| | | * 其他 |
| | | */ |
| | | NON(-1), |
| | | /** |
| | | * 图片 |
| | | */ |
| | | PICTURE(1), |
| | | /** |
| | | * word |
| | | */ |
| | | WORD(2), |
| | | /** |
| | | * excel |
| | | */ |
| | | EXCEL(3), |
| | | /** |
| | | * pdf |
| | | */ |
| | | PDF(4), |
| | | /** |
| | | * 压缩包 |
| | | */ |
| | | ZIP(5), |
| | | ; |
| | | |
| | | @EnumValue |
| | | private final Integer value; |
| | | |
| | | FileType(Integer value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | private static final Map<Integer, FileType> VALUE_MAP = new HashMap<>(); |
| | | |
| | | static { |
| | | for (FileType var : values()) { |
| | | VALUE_MAP.put(var.getValue(), var); |
| | | } |
| | | } |
| | | |
| | | @JsonCreator |
| | | public static FileType getEnumByCode(Integer value) { |
| | | FileType fileType = VALUE_MAP.get(value); |
| | | if (fileType == null) { |
| | | throw new RuntimeException("enum not find element, [" + value + "]"); |
| | | } |
| | | return fileType; |
| | | } |
| | | } |
| | |
| | | /** |
| | | *未生效 |
| | | */ |
| | | NOT_EFFECTIVE(10, "未生效"), |
| | | NOT_EFFECTIVE(0, "未生效"), |
| | | /** |
| | | *已生效 |
| | | */ |
| | | TAKE_EFFECT(20, "已生效"); |
| | | TAKE_EFFECT(1, "已生效"); |
| | | |
| | | @EnumValue |
| | | public final Integer value; |
| | |
| | | /** |
| | | *已生效 |
| | | */ |
| | | No(0, "否"); |
| | | NO(0, "否"); |
| | | |
| | | @EnumValue |
| | | public final Integer value; |
New file |
| | |
| | | package com.moral.api.pojo.ext.allocation; |
| | | |
| | | import com.moral.api.entity.Allocation; |
| | | import com.moral.api.pojo.vo.approvetable.ApproveTableListVo; |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | public class AllocationExt extends Allocation { |
| | | |
| | | @ApiModelProperty(value = "基础附件") |
| | | private List<FileVo> fileBaseList; |
| | | |
| | | @ApiModelProperty(value = "整改附件") |
| | | private List<FileVo> fileChangeList; |
| | | |
| | | @ApiModelProperty(value = "审批附件") |
| | | private List<FileVo> fileApproveList; |
| | | |
| | | @ApiModelProperty(value = "流程状态") |
| | | private List<ApproveTableListVo> approveList; |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.ext.allocation; |
| | | |
| | | import com.moral.api.entity.Allocation; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | public class AllocationListExt extends Allocation { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.moral.api.pojo.ext.allocation; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.moral.api.entity.Allocation; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * @ClassName AllocationPageExt |
| | | * @Description TODO |
| | | * @Author @cjl |
| | | * @Date 2023-09-25 14:34 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | public class AllocationPageExt extends Allocation { |
| | | |
| | | |
| | | private Integer applyState; |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.ext.allocationextension; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.moral.api.entity.AllocationExtension; |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | public class AllocationExtensionExt extends AllocationExtension { |
| | | |
| | | @ApiModelProperty(value = "交办单号") |
| | | private String allocationNum; |
| | | |
| | | |
| | | @ApiModelProperty(value = "上报时间") |
| | | private Date escalationTime; |
| | | |
| | | |
| | | @ApiModelProperty(value = "污染位置") |
| | | private String pollutePosition; |
| | | |
| | | @ApiModelProperty(value = "责任单位id") |
| | | private Integer unitId; |
| | | |
| | | @ApiModelProperty(value = "污染分类id") |
| | | private Integer polluteType; |
| | | |
| | | @ApiModelProperty(value = "整改类型id") |
| | | private Integer changeType; |
| | | |
| | | @ApiModelProperty(value = "期限天数") |
| | | private Integer changeDay; |
| | | |
| | | @ApiModelProperty(value = "上报单位id") |
| | | private Integer escalationUnitId; |
| | | |
| | | @ApiModelProperty(value = "上报人") |
| | | private String escalationName; |
| | | |
| | | @ApiModelProperty(value = "排查方式id") |
| | | private Integer investigationType; |
| | | |
| | | @ApiModelProperty(value = "问题描述") |
| | | private String problemDescribe; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "基础附件") |
| | | private List<FileVo> fileBaseList; |
| | | |
| | | @ApiModelProperty(value = "延期附件") |
| | | private List<FileVo> fileList; |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.ext.allocationextension; |
| | | |
| | | import com.moral.api.entity.AllocationExtension; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | public class AllocationExtensionListExt extends AllocationExtension { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.moral.api.pojo.ext.allocationextension; |
| | | |
| | | import com.moral.api.entity.AllocationExtension; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | public class AllocationExtensionPageExt extends AllocationExtension { |
| | | |
| | | @ApiModelProperty(value = "交办单号") |
| | | private String allocationNum; |
| | | |
| | | @ApiModelProperty(value = "上报时间") |
| | | private Date escalationTime; |
| | | @ApiModelProperty(value = "责任单位id") |
| | | private Integer unitId; |
| | | |
| | | @ApiModelProperty(value = "污染分类id") |
| | | private Integer polluteType; |
| | | |
| | | @ApiModelProperty(value = "整改类型id") |
| | | private Integer changeType; |
| | | |
| | | @ApiModelProperty(value = "期限天数") |
| | | private Integer changeDay; |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.OrderItem; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * @Description |
| | | * |
| | | * @Date 2020/10/27 10:59 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "排序对象", description = "排序对象") |
| | | public class OrderByItem { |
| | | |
| | | @ApiModelProperty(value = "排序字段名") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "排序顺序") |
| | | private OrderType order; |
| | | |
| | | public OrderItem convertOrderItem() { |
| | | OrderItem orderItem = new OrderItem(); |
| | | switch (order) { |
| | | case ASC: |
| | | orderItem = OrderItem.asc(this.name); |
| | | break; |
| | | case DESC: |
| | | orderItem = OrderItem.desc(this.name); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return orderItem; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.EnumValue; |
| | | import com.fasterxml.jackson.annotation.JsonCreator; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Getter; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description |
| | | * |
| | | * @Date 2020/10/27 11:00 |
| | | * @Version 1.0 |
| | | */ |
| | | @Getter |
| | | @JsonFormat(shape = JsonFormat.Shape.OBJECT) |
| | | public enum OrderType { |
| | | |
| | | /** |
| | | * ASC |
| | | */ |
| | | ASC("ascending"), |
| | | /** |
| | | * DESC |
| | | */ |
| | | DESC("descending"), |
| | | ; |
| | | |
| | | private static Map<String, OrderType> valueMap = new HashMap<>(); |
| | | |
| | | static { |
| | | for (OrderType orderType : OrderType.values()) { |
| | | valueMap.put(orderType.code, orderType); |
| | | } |
| | | } |
| | | |
| | | @EnumValue |
| | | public final String code; |
| | | |
| | | OrderType(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | @JsonCreator |
| | | public static OrderType getByValue(String code) { |
| | | OrderType result = valueMap.get(code); |
| | | if (result == null) { |
| | | throw new IllegalArgumentException("No element matches " + code); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "分页对象", description = "分页对象") |
| | | public class PageCond { |
| | | |
| | | @ApiModelProperty(value = "排序") |
| | | private List<OrderByItem> orders; |
| | | |
| | | @ApiModelProperty(value = "每页数量") |
| | | private long pageSize; |
| | | |
| | | @ApiModelProperty(value = "当前页码") |
| | | private long currentPage; |
| | | |
| | | public List<OrderByItem> orders() { |
| | | return this.orders; |
| | | } |
| | | |
| | | public Page convertPage() { |
| | | Page page = new Page(); |
| | | page.setCurrent(this.currentPage); |
| | | page.setSize(this.pageSize); |
| | | if (CollectionUtils.isNotEmpty(orders)) { |
| | | page.setOrders(this.orders.stream().map(orderByItem -> orderByItem.convertOrderItem()).collect(Collectors.toList())); |
| | | } |
| | | return page; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.allocation; |
| | | |
| | | import com.moral.api.entity.Allocation; |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="Allocation - 新增对象", description="Allocation - 新增对象") |
| | | public class AllocationAddCond implements Serializable { |
| | | |
| | | |
| | | @ApiModelProperty(value = "上报时间") |
| | | @NotNull(message = "上报时间不能为空!") |
| | | private Date escalationTime; |
| | | |
| | | @ApiModelProperty(value = "污染位置") |
| | | private String pollutePosition; |
| | | |
| | | @ApiModelProperty(value = "责任单位id") |
| | | private Integer unitId; |
| | | |
| | | @ApiModelProperty(value = "污染分类id") |
| | | private Integer polluteType; |
| | | |
| | | @ApiModelProperty(value = "整改类型id") |
| | | private Integer changeType; |
| | | |
| | | @ApiModelProperty(value = "期限天数") |
| | | private Integer changeDay; |
| | | |
| | | @ApiModelProperty(value = "上报单位id") |
| | | private Integer escalationUnitId; |
| | | |
| | | @ApiModelProperty(value = "上报人") |
| | | private String escalationName; |
| | | |
| | | @ApiModelProperty(value = "排查方式id") |
| | | private Integer investigationType; |
| | | |
| | | @ApiModelProperty(value = "问题描述") |
| | | private String problemDescribe; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | @NotNull(message = "状态不能为空!") |
| | | private Integer state; |
| | | |
| | | |
| | | @ApiModelProperty(value = "基础附件") |
| | | private List<FileVo> fileBaseList; |
| | | |
| | | |
| | | public Allocation convert() { |
| | | Allocation allocation = BeanConverts.convert(this, Allocation.class); |
| | | return allocation; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.allocation; |
| | | |
| | | import com.moral.api.entity.Allocation; |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="Allocation - 更新整改对象", description="Allocation - 更新整改对象") |
| | | public class AllocationChangeCond implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @NotNull(message = "主键id不能为空!") |
| | | private Integer allocationId; |
| | | |
| | | @ApiModelProperty(value = "是否整改") |
| | | @NotNull(message = "是否整改不能为空!") |
| | | private Integer isChange; |
| | | |
| | | @ApiModelProperty(value = "整改反馈") |
| | | private String changeDescribe; |
| | | |
| | | @ApiModelProperty(value = "整改人性名") |
| | | @NotEmpty(message = "整改人性名不能为空!") |
| | | private String changeName; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | @NotNull(message = "状态不能为空!") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "整改附件") |
| | | private List<FileVo> fileChangeList; |
| | | |
| | | public Allocation convert() { |
| | | Allocation allocation = BeanConverts.convert(this, Allocation.class); |
| | | return allocation; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.allocation; |
| | | |
| | | import com.moral.api.entity.Allocation; |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="Allocation - 更新考核对象", description="Allocation - 更新考核对象") |
| | | public class AllocationCheckCond implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @NotNull(message = "主键id不能为空!") |
| | | private Integer allocationId; |
| | | |
| | | @ApiModelProperty(value = "考核分值") |
| | | @NotNull(message = "考核分值不能为空!") |
| | | private Integer checkScore; |
| | | |
| | | @ApiModelProperty(value = "考核理由") |
| | | private String checkDescribe; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | @NotNull(message = "状态不能为空!") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "审批附件") |
| | | private List<FileVo> fileApproveList; |
| | | |
| | | public Allocation convert() { |
| | | Allocation allocation = BeanConverts.convert(this, Allocation.class); |
| | | return allocation; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.allocation; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="Allocation - 列表查询对象", description="Allocation - 列表查询对象") |
| | | public class AllocationListCond implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "责任单位id") |
| | | private Integer unitId; |
| | | |
| | | @ApiModelProperty(value = "污染分类id") |
| | | private Integer polluteType; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | private String endTime; |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.allocation; |
| | | |
| | | import com.moral.api.pojo.query.PageCond; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="Allocation - 分页查询对象", description="Allocation - 分页查询对象") |
| | | public class AllocationPageCond implements Serializable{ |
| | | |
| | | @ApiModelProperty(value = "责任单位id") |
| | | private Integer unitId; |
| | | |
| | | @ApiModelProperty(value = "污染分类id") |
| | | private Integer polluteType; |
| | | |
| | | @ApiModelProperty(value = "流程状态") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "排查方式id") |
| | | private Integer investigationType; |
| | | |
| | | @ApiModelProperty(value = "整改类型id") |
| | | private Integer changeType; |
| | | |
| | | |
| | | @ApiModelProperty(value = "是否作废") |
| | | private Integer isInvalid; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty(value = "分页参数") |
| | | private PageCond page; |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.allocation; |
| | | |
| | | import com.moral.api.entity.Allocation; |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="Allocation - 更新对象", description="Allocation - 更新对象") |
| | | public class AllocationUpdateCond implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @NotNull(message = "主键id不能为空!") |
| | | private Integer allocationId; |
| | | |
| | | @ApiModelProperty(value = "上报时间") |
| | | @NotNull(message = "上报时间不能为空!") |
| | | private Date escalationTime; |
| | | |
| | | @ApiModelProperty(value = "污染位置") |
| | | @NotEmpty(message = "污染位置不能为空!") |
| | | private String pollutePosition; |
| | | |
| | | @ApiModelProperty(value = "责任单位id") |
| | | @NotNull(message = "责任单位不能为空!") |
| | | private Integer unitId; |
| | | |
| | | @ApiModelProperty(value = "污染分类id") |
| | | @NotNull(message = "污染分类不能为空!") |
| | | private Integer polluteType; |
| | | |
| | | @ApiModelProperty(value = "整改类型id") |
| | | @NotNull(message = "整改类型不能为空!") |
| | | private Integer changeType; |
| | | |
| | | @ApiModelProperty(value = "期限天数") |
| | | private Integer changeDay; |
| | | |
| | | @ApiModelProperty(value = "上报单位id") |
| | | @NotNull(message = "上报单位不能为空!") |
| | | private Integer escalationUnitId; |
| | | |
| | | @ApiModelProperty(value = "上报人") |
| | | @NotEmpty(message = "上报人不能为空!") |
| | | private String escalationName; |
| | | |
| | | @ApiModelProperty(value = "排查方式id") |
| | | @NotNull(message = "排查方式不能为空!") |
| | | private Integer investigationType; |
| | | |
| | | @ApiModelProperty(value = "问题描述") |
| | | private String problemDescribe; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | @NotNull(message = "状态不能为空!") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "基础附件") |
| | | private List<FileVo> fileBaseList; |
| | | |
| | | public Allocation convert() { |
| | | Allocation allocation = BeanConverts.convert(this, Allocation.class); |
| | | return allocation; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.allocationextension; |
| | | |
| | | import com.moral.api.entity.AllocationExtension; |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="AllocationExtension - 新增对象", description="AllocationExtension - 新增对象") |
| | | public class AllocationExtensionAddCond implements Serializable { |
| | | |
| | | |
| | | @ApiModelProperty(value = "交办单id") |
| | | @NotNull(message = "交办单id不能为空!") |
| | | private Integer allocationId; |
| | | |
| | | @ApiModelProperty(value = "延期天数") |
| | | @NotNull(message = "延期天数不能为空!") |
| | | private Integer extensionNum; |
| | | |
| | | @ApiModelProperty(value = "延期理由") |
| | | @NotEmpty(message = "延期理由不能为空!") |
| | | private String remake; |
| | | |
| | | @ApiModelProperty(value = "附件") |
| | | private List<FileVo> fileList; |
| | | public AllocationExtension convert() { |
| | | AllocationExtension allocationExtension = BeanConverts.convert(this, AllocationExtension.class); |
| | | return allocationExtension; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.allocationextension; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="AllocationExtension - 列表查询对象", description="AllocationExtension - 列表查询对象") |
| | | public class AllocationExtensionListCond implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "ID") |
| | | private Integer id; |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.allocationextension; |
| | | |
| | | import com.moral.api.pojo.query.PageCond; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="AllocationExtension - 分页查询对象", description="AllocationExtension - 分页查询对象") |
| | | public class AllocationExtensionPageCond implements Serializable{ |
| | | |
| | | @ApiModelProperty(value = "责任单位id") |
| | | private Integer unitId; |
| | | |
| | | @ApiModelProperty(value = "污染分类id") |
| | | private Integer polluteType; |
| | | |
| | | @ApiModelProperty(value = "流程状态") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "排查方式id") |
| | | private Integer investigationType; |
| | | |
| | | @ApiModelProperty(value = "整改类型id") |
| | | private Integer changeType; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty(value = "分页参数") |
| | | private PageCond page; |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.allocationextension; |
| | | |
| | | import com.moral.api.entity.AllocationExtension; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="AllocationExtension - 更新对象", description="AllocationExtension - 更新对象") |
| | | public class AllocationExtensionUpdateCond implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "交办单id") |
| | | private Integer allocationId; |
| | | |
| | | @ApiModelProperty(value = "延期天数") |
| | | private Integer extensionNum; |
| | | |
| | | @ApiModelProperty(value = "延期理由") |
| | | private String remake; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "是否删除") |
| | | private Integer isDel; |
| | | |
| | | @ApiModelProperty(value = "是否作废") |
| | | private Integer isInvalid; |
| | | |
| | | @ApiModelProperty(value = "作废理由") |
| | | private String invalidReason; |
| | | |
| | | @ApiModelProperty(value = "创建人id") |
| | | private Integer createId; |
| | | |
| | | @ApiModelProperty(value = "创建人姓名") |
| | | private String createName; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "更新人id") |
| | | private Integer updateId; |
| | | |
| | | @ApiModelProperty(value = "更新人姓名") |
| | | private String updateName; |
| | | |
| | | @ApiModelProperty(value = "更新时间") |
| | | private Date updateTime; |
| | | |
| | | |
| | | |
| | | public AllocationExtension convert() { |
| | | AllocationExtension allocationExtension = BeanConverts.convert(this, AllocationExtension.class); |
| | | return allocationExtension; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.approvetable; |
| | | |
| | | import com.moral.api.entity.ApproveTable; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 流程表 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="ApproveTable - 新增对象", description="ApproveTable - 新增对象") |
| | | public class ApproveTableAddCond implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "流程主键id") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "模块") |
| | | private Integer approveModule; |
| | | |
| | | @ApiModelProperty(value = "关联主键id") |
| | | private Integer relationId; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String stateName; |
| | | |
| | | @ApiModelProperty(value = "是否删除") |
| | | private Integer isDel; |
| | | |
| | | @ApiModelProperty(value = "创建人id") |
| | | private Integer createId; |
| | | |
| | | @ApiModelProperty(value = "创建人姓名") |
| | | private String createName; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "更新人id") |
| | | private Integer updateId; |
| | | |
| | | @ApiModelProperty(value = "更新人姓名") |
| | | private String updateName; |
| | | |
| | | @ApiModelProperty(value = "更新时间") |
| | | private Date updateTime; |
| | | |
| | | |
| | | |
| | | public ApproveTable convert() { |
| | | ApproveTable approveTable = BeanConverts.convert(this, ApproveTable.class); |
| | | return approveTable; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.approvetable; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 流程表 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="ApproveTable - 列表查询对象", description="ApproveTable - 列表查询对象") |
| | | public class ApproveTableListCond implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "ID") |
| | | private Integer id; |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.approvetable; |
| | | |
| | | import com.moral.api.pojo.query.PageCond; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 流程表 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="ApproveTable - 分页查询对象", description="ApproveTable - 分页查询对象") |
| | | public class ApproveTablePageCond implements Serializable{ |
| | | |
| | | @ApiModelProperty(value = "ID") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "分页参数") |
| | | private PageCond page; |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.query.approvetable; |
| | | |
| | | import com.moral.api.entity.ApproveTable; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 流程表 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="ApproveTable - 更新对象", description="ApproveTable - 更新对象") |
| | | public class ApproveTableUpdateCond implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "流程主键id") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "模块") |
| | | private Integer approveModule; |
| | | |
| | | @ApiModelProperty(value = "关联主键id") |
| | | private Integer relationId; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String stateName; |
| | | |
| | | @ApiModelProperty(value = "是否删除") |
| | | private Integer isDel; |
| | | |
| | | @ApiModelProperty(value = "创建人id") |
| | | private Integer createId; |
| | | |
| | | @ApiModelProperty(value = "创建人姓名") |
| | | private String createName; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "更新人id") |
| | | private Integer updateId; |
| | | |
| | | @ApiModelProperty(value = "更新人姓名") |
| | | private String updateName; |
| | | |
| | | @ApiModelProperty(value = "更新时间") |
| | | private Date updateTime; |
| | | |
| | | |
| | | |
| | | public ApproveTable convert() { |
| | | ApproveTable approveTable = BeanConverts.convert(this, ApproveTable.class); |
| | | return approveTable; |
| | | } |
| | | } |
| | |
| | | private List<Map<String, Object>> ChangeEnum; |
| | | private List<Map<String, Object>> YesOrNo; |
| | | |
| | | private List<Map<String, Object>> AllocationApproveEnum; |
| | | private List<Map<String, Object>> FileTableEnum; |
| | | |
| | | private List<Map<String, Object>> AllocationExtensionApproveEnum; |
| | | |
| | | |
| | | public static List<Map<String, Object>> enumArray2Map(Enum[] enums) { |
| | |
| | | return this; |
| | | } |
| | | |
| | | public DictionaryVo setFileTableEnum(com.moral.api.pojo.enums.FileTableEnum[] enumResult) { |
| | | this.FileTableEnum = enumArray2Map(enumResult); |
| | | return this; |
| | | } |
| | | public DictionaryVo setAllocationApproveEnum(com.moral.api.pojo.enums.AllocationApproveEnum[] enumResult) { |
| | | this.AllocationApproveEnum = enumArray2Map(enumResult); |
| | | return this; |
| | | } |
| | | public DictionaryVo setAllocationExtensionApproveEnum(com.moral.api.pojo.enums.AllocationExtensionApproveEnum[] enumResult) { |
| | | this.AllocationExtensionApproveEnum = enumArray2Map(enumResult); |
| | | return this; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.vo.allocation; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.moral.api.pojo.enums.AllocationApproveEnum; |
| | | import com.moral.api.pojo.ext.allocation.AllocationPageExt; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import com.moral.util.DateUtils; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="Allocation - 分页VO对象", description="Allocation - 分页VO对象") |
| | | public class AllocationPageVo implements Serializable { |
| | | |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | private Integer allocationId; |
| | | |
| | | @ApiModelProperty(value = "交办单号") |
| | | private String allocationNum; |
| | | |
| | | @ApiModelProperty(value = "上报时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd") |
| | | private Date escalationTime; |
| | | |
| | | @ApiModelProperty(value = "责任单位id") |
| | | private Integer unitId; |
| | | |
| | | @ApiModelProperty(value = "污染分类id") |
| | | private Integer polluteType; |
| | | |
| | | @ApiModelProperty(value = "整改类型id") |
| | | private Integer changeType; |
| | | |
| | | @ApiModelProperty(value = "期限天数") |
| | | private Integer changeDay; |
| | | |
| | | @ApiModelProperty(value = "剩余天数") |
| | | private Integer residueDay; |
| | | |
| | | @ApiModelProperty(value = "上报单位id") |
| | | private Integer escalationUnitId; |
| | | |
| | | @ApiModelProperty(value = "上报人") |
| | | private String escalationName; |
| | | |
| | | @ApiModelProperty(value = "排查方式id") |
| | | private Integer investigationType; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "是否作废") |
| | | private Integer isInvalid; |
| | | |
| | | @ApiModelProperty(value = "创建人id") |
| | | private Integer createId; |
| | | |
| | | @ApiModelProperty(value = "创建人姓名") |
| | | private String createName; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "更新人id") |
| | | private Integer updateId; |
| | | |
| | | @ApiModelProperty(value = "更新人姓名") |
| | | private String updateName; |
| | | |
| | | @ApiModelProperty(value = "更新时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty(value = "能否申请延期") |
| | | private Integer applyState; |
| | | |
| | | |
| | | public static AllocationPageVo convert(AllocationPageExt allocationPageExt) { |
| | | AllocationPageVo allocationPageVo = BeanConverts.convert(allocationPageExt, AllocationPageVo.class); |
| | | return allocationPageVo; |
| | | } |
| | | |
| | | public static List<AllocationPageVo> convert(List<AllocationPageExt> allocationPageExtList) { |
| | | return allocationPageExtList.stream().map(AllocationPageVo::convert).collect(Collectors.toList()); |
| | | } |
| | | |
| | | public Integer getResidueDay() { |
| | | int day = this.changeDay; |
| | | if(AllocationApproveEnum.UNDER_RECTIFICATION.value.equals(state)){ |
| | | Date date = new Date(); |
| | | int days = DateUtils.getDays(escalationTime, date); |
| | | return day-days; |
| | | } |
| | | return day; |
| | | } |
| | | |
| | | public Integer getApplyState() { |
| | | return Objects.isNull(applyState)?0:applyState; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.vo.allocation; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.moral.api.pojo.ext.allocation.AllocationExt; |
| | | import com.moral.api.pojo.vo.approvetable.ApproveTableListVo; |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="Allocation - 详情VO对象", description="Allocation - 详情VO对象") |
| | | public class AllocationVo implements Serializable { |
| | | |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | private Integer allocationId; |
| | | |
| | | @ApiModelProperty(value = "交办单号") |
| | | private String allocationNum; |
| | | |
| | | |
| | | @ApiModelProperty(value = "上报时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd") |
| | | private Date escalationTime; |
| | | |
| | | @ApiModelProperty(value = "污染位置") |
| | | private String pollutePosition; |
| | | |
| | | @ApiModelProperty(value = "责任单位id") |
| | | private Integer unitId; |
| | | |
| | | @ApiModelProperty(value = "污染分类id") |
| | | private Integer polluteType; |
| | | |
| | | @ApiModelProperty(value = "整改类型id") |
| | | private Integer changeType; |
| | | |
| | | @ApiModelProperty(value = "期限天数") |
| | | private Integer changeDay; |
| | | |
| | | @ApiModelProperty(value = "上报单位id") |
| | | private Integer escalationUnitId; |
| | | |
| | | @ApiModelProperty(value = "上报人") |
| | | private String escalationName; |
| | | |
| | | @ApiModelProperty(value = "排查方式id") |
| | | private Integer investigationType; |
| | | |
| | | @ApiModelProperty(value = "问题描述") |
| | | private String problemDescribe; |
| | | |
| | | @ApiModelProperty(value = "是否整改") |
| | | private Integer isChange; |
| | | |
| | | @ApiModelProperty(value = "整改反馈") |
| | | private String changeDescribe; |
| | | |
| | | @ApiModelProperty(value = "整改人性名") |
| | | private String changeName; |
| | | |
| | | @ApiModelProperty(value = "整改时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd") |
| | | private Date changeTime; |
| | | |
| | | @ApiModelProperty(value = "考核分值") |
| | | private Integer checkScore; |
| | | |
| | | @ApiModelProperty(value = "考核理由") |
| | | private String checkDescribe; |
| | | |
| | | @ApiModelProperty(value = "考核人") |
| | | private String checkName; |
| | | |
| | | @ApiModelProperty(value = "考核时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date checkTime; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "是否作废") |
| | | private Integer isInvalid; |
| | | |
| | | @ApiModelProperty(value = "作废理由") |
| | | private String invalidReason; |
| | | |
| | | @ApiModelProperty(value = "创建人id") |
| | | private Integer createId; |
| | | |
| | | @ApiModelProperty(value = "创建人姓名") |
| | | private String createName; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "更新人id") |
| | | private Integer updateId; |
| | | |
| | | @ApiModelProperty(value = "更新人姓名") |
| | | private String updateName; |
| | | |
| | | @ApiModelProperty(value = "更新时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty(value = "基础附件") |
| | | private List<FileVo> fileBaseList; |
| | | |
| | | @ApiModelProperty(value = "整改附件") |
| | | private List<FileVo> fileChangeList; |
| | | |
| | | @ApiModelProperty(value = "审批附件") |
| | | private List<FileVo> fileApproveList; |
| | | |
| | | @ApiModelProperty(value = "流程状态") |
| | | private List<ApproveTableListVo> approveList; |
| | | |
| | | |
| | | public static AllocationVo convert(AllocationExt allocationExt) { |
| | | AllocationVo allocationVo = BeanConverts.convert(allocationExt, AllocationVo.class); |
| | | return allocationVo; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.vo.allocationextension; |
| | | |
| | | import com.moral.api.pojo.ext.allocationextension.AllocationExtensionListExt; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="AllocationExtension - 列表VO对象", description="AllocationExtension - 列表VO对象") |
| | | public class AllocationExtensionListVo implements Serializable { |
| | | |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "交办单id") |
| | | private Integer allocationId; |
| | | |
| | | @ApiModelProperty(value = "延期天数") |
| | | private Integer extensionNum; |
| | | |
| | | @ApiModelProperty(value = "延期理由") |
| | | private String remake; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "是否删除") |
| | | private Integer isDel; |
| | | |
| | | @ApiModelProperty(value = "是否作废") |
| | | private Integer isInvalid; |
| | | |
| | | @ApiModelProperty(value = "作废理由") |
| | | private String invalidReason; |
| | | |
| | | @ApiModelProperty(value = "创建人id") |
| | | private Integer createId; |
| | | |
| | | @ApiModelProperty(value = "创建人姓名") |
| | | private String createName; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "更新人id") |
| | | private Integer updateId; |
| | | |
| | | @ApiModelProperty(value = "更新人姓名") |
| | | private String updateName; |
| | | |
| | | @ApiModelProperty(value = "更新时间") |
| | | private Date updateTime; |
| | | |
| | | |
| | | |
| | | public static AllocationExtensionListVo convert(AllocationExtensionListExt allocationExtensionListExt) { |
| | | AllocationExtensionListVo allocationExtensionListVo = BeanConverts.convert(allocationExtensionListExt, AllocationExtensionListVo.class); |
| | | return allocationExtensionListVo; |
| | | } |
| | | |
| | | public static List<AllocationExtensionListVo> convert(List<AllocationExtensionListExt> allocationExtensionListExtList) { |
| | | return allocationExtensionListExtList.stream().map(AllocationExtensionListVo::convert).collect(Collectors.toList()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.vo.allocationextension; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.moral.api.pojo.ext.allocationextension.AllocationExtensionPageExt; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="AllocationExtension - 分页VO对象", description="AllocationExtension - 分页VO对象") |
| | | public class AllocationExtensionPageVo implements Serializable { |
| | | |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "交办单号") |
| | | private String allocationNum; |
| | | |
| | | @ApiModelProperty(value = "上报时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd") |
| | | private Date escalationTime; |
| | | @ApiModelProperty(value = "责任单位id") |
| | | private Integer unitId; |
| | | |
| | | @ApiModelProperty(value = "污染分类id") |
| | | private Integer polluteType; |
| | | |
| | | @ApiModelProperty(value = "整改类型id") |
| | | private Integer changeType; |
| | | |
| | | @ApiModelProperty(value = "期限天数") |
| | | private Integer changeDay; |
| | | |
| | | |
| | | @ApiModelProperty(value = "延期天数") |
| | | private Integer extensionNum; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "上报单位id") |
| | | private Integer escalationUnitId; |
| | | |
| | | @ApiModelProperty(value = "上报人") |
| | | private String escalationName; |
| | | |
| | | @ApiModelProperty(value = "创建人id") |
| | | private Integer createId; |
| | | |
| | | @ApiModelProperty(value = "创建人姓名") |
| | | private String createName; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "更新人id") |
| | | private Integer updateId; |
| | | |
| | | @ApiModelProperty(value = "更新人姓名") |
| | | private String updateName; |
| | | |
| | | @ApiModelProperty(value = "更新时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | |
| | | |
| | | public static AllocationExtensionPageVo convert(AllocationExtensionPageExt allocationExtensionPageExt) { |
| | | AllocationExtensionPageVo allocationExtensionPageVo = BeanConverts.convert(allocationExtensionPageExt, AllocationExtensionPageVo.class); |
| | | return allocationExtensionPageVo; |
| | | } |
| | | |
| | | public static List<AllocationExtensionPageVo> convert(List<AllocationExtensionPageExt> allocationExtensionPageExtList) { |
| | | return allocationExtensionPageExtList.stream().map(AllocationExtensionPageVo::convert).collect(Collectors.toList()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.vo.allocationextension; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.moral.api.pojo.ext.allocationextension.AllocationExtensionExt; |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="AllocationExtension - 详情VO对象", description="AllocationExtension - 详情VO对象") |
| | | public class AllocationExtensionVo implements Serializable { |
| | | |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "交办单号") |
| | | private String allocationNum; |
| | | |
| | | |
| | | @ApiModelProperty(value = "上报时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd") |
| | | private Date escalationTime; |
| | | |
| | | |
| | | @ApiModelProperty(value = "污染位置") |
| | | private String pollutePosition; |
| | | |
| | | @ApiModelProperty(value = "责任单位id") |
| | | private Integer unitId; |
| | | |
| | | @ApiModelProperty(value = "污染分类id") |
| | | private Integer polluteType; |
| | | |
| | | @ApiModelProperty(value = "整改类型id") |
| | | private Integer changeType; |
| | | |
| | | @ApiModelProperty(value = "期限天数") |
| | | private Integer changeDay; |
| | | |
| | | @ApiModelProperty(value = "上报单位id") |
| | | private Integer escalationUnitId; |
| | | |
| | | @ApiModelProperty(value = "上报人") |
| | | private String escalationName; |
| | | |
| | | @ApiModelProperty(value = "排查方式id") |
| | | private Integer investigationType; |
| | | |
| | | @ApiModelProperty(value = "问题描述") |
| | | private String problemDescribe; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "基础附件") |
| | | private List<FileVo> fileBaseList; |
| | | |
| | | @ApiModelProperty(value = "延期附件") |
| | | private List<FileVo> fileList; |
| | | |
| | | |
| | | @ApiModelProperty(value = "延期天数") |
| | | private Integer extensionNum; |
| | | |
| | | @ApiModelProperty(value = "延期理由") |
| | | private String remake; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "是否作废") |
| | | private Integer isInvalid; |
| | | |
| | | @ApiModelProperty(value = "作废理由") |
| | | private String invalidReason; |
| | | |
| | | @ApiModelProperty(value = "创建人id") |
| | | private Integer createId; |
| | | |
| | | @ApiModelProperty(value = "创建人姓名") |
| | | private String createName; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "更新人id") |
| | | private Integer updateId; |
| | | |
| | | @ApiModelProperty(value = "更新人姓名") |
| | | private String updateName; |
| | | |
| | | @ApiModelProperty(value = "更新时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | |
| | | |
| | | public static AllocationExtensionVo convert(AllocationExtensionExt allocationExtensionExt) { |
| | | AllocationExtensionVo allocationExtensionVo = BeanConverts.convert(allocationExtensionExt, AllocationExtensionVo.class); |
| | | return allocationExtensionVo; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.vo.approvetable; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 流程表 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="ApproveTable - 列表VO对象", description="ApproveTable - 列表VO对象") |
| | | public class ApproveTableListVo implements Serializable { |
| | | |
| | | |
| | | @ApiModelProperty(value = "流程主键id") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String stateName; |
| | | |
| | | @ApiModelProperty(value = "创建人id") |
| | | private Integer createId; |
| | | |
| | | @ApiModelProperty(value = "创建人姓名") |
| | | private String createName; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.vo.file; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * @ClassName FileVo |
| | | * @Description TODO |
| | | * @Author @cjl |
| | | * @Date 2023-09-21 14:51 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(description="FileVo - 文件VO对象") |
| | | public class FileVo { |
| | | @ApiModelProperty(value = "ID") |
| | | private Integer fileId; |
| | | |
| | | @ApiModelProperty(value = "文件名称") |
| | | private String fileName; |
| | | |
| | | @ApiModelProperty(value = "类型1图片") |
| | | private Integer fileType; |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.vo.user; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * @ClassName QxUser |
| | | * @Description TODO |
| | | * @Author @cjl |
| | | * @Date 2023-09-21 15:59 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | public class QxUser { |
| | | /** |
| | | * 人员id |
| | | */ |
| | | private Integer userId; |
| | | |
| | | /** |
| | | * 人员性名 |
| | | */ |
| | | private String userName; |
| | | |
| | | /** |
| | | * 账户 |
| | | */ |
| | | private String account; |
| | | /** |
| | | * 所属部门责任单位 |
| | | */ |
| | | private Integer unitId; |
| | | } |
New file |
| | |
| | | package com.moral.api.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.moral.api.entity.AllocationExtension; |
| | | import com.moral.api.pojo.ext.allocationextension.AllocationExtensionExt; |
| | | import com.moral.api.pojo.ext.allocationextension.AllocationExtensionPageExt; |
| | | import com.moral.api.pojo.query.allocationextension.AllocationExtensionAddCond; |
| | | import com.moral.api.pojo.query.allocationextension.AllocationExtensionPageCond; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 服务类 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | public interface AllocationExtensionService extends IService<AllocationExtension> { |
| | | |
| | | /** |
| | | * 根据id查询详情 |
| | | * @param id |
| | | * @return AllocationExtensionExt |
| | | */ |
| | | AllocationExtensionExt extOne(Integer id); |
| | | |
| | | /** |
| | | * 查询分页详情 |
| | | * @param allocationExtensionPageCond |
| | | * @return AllocationExtensionPageExt |
| | | */ |
| | | Page<AllocationExtensionPageExt> extPage(AllocationExtensionPageCond allocationExtensionPageCond); |
| | | |
| | | /** |
| | | * 保存 |
| | | * @param allocationExtensionAddCond |
| | | * @return |
| | | */ |
| | | boolean save(AllocationExtensionAddCond allocationExtensionAddCond); |
| | | |
| | | boolean check(Integer id,Integer state); |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.moral.api.entity.Allocation; |
| | | import com.moral.api.entity.ResponsibilityUnit; |
| | | import com.moral.api.pojo.ext.allocation.AllocationExt; |
| | | import com.moral.api.pojo.ext.allocation.AllocationListExt; |
| | | import com.moral.api.pojo.ext.allocation.AllocationPageExt; |
| | | import com.moral.api.pojo.query.allocation.*; |
| | | import com.moral.api.pojo.dto.allocation.AllocationUnitDto; |
| | | import com.moral.api.pojo.query.allocationextension.AllocationExtensionAddCond; |
| | | |
| | | public interface AllocationService extends IService<Allocation> { |
| | | |
| | | List<Map<String, Object>> sysDictData(String code); |
| | | |
| | | List<ResponsibilityUnit> seleteUnit(); |
| | | |
| | | Integer insertAllocation(AllocationAddCond allocation); |
| | | |
| | | AllocationUnitDto check(Integer id); |
| | | |
| | | void updateAll(AllocationUpdateCond allocationUpdateCond); |
| | | |
| | | List<Allocation> selectAll(Map<String,Object> map); |
| | | |
| | | |
| | | Map<String, Object> selectUnitView(Map<String,Object> map); |
| | | |
| | | List<Map<String,Object>> unitExel(Map<String,Object> map); |
| | | |
| | | Page<AllocationPageExt> extPage(AllocationPageCond allocationPageCond); |
| | | /** |
| | | * 根据id查询详情 |
| | | * @param id |
| | | * @return AllocationExt |
| | | */ |
| | | AllocationExt extOne(Integer id); |
| | | |
| | | AllocationExt oneAllocation(Integer id); |
| | | |
| | | void changeAllocation(AllocationChangeCond changeCond); |
| | | |
| | | void checkAllocation(AllocationCheckCond checkCond); |
| | | |
| | | boolean removeById(Integer id); |
| | | |
| | | boolean invalidResult (Integer id,String invalidReason); |
| | | |
| | | /** |
| | | * 查询列表详情 |
| | | * @param allocationListCond |
| | | * @return AllocationListExt |
| | | */ |
| | | List<AllocationListExt> extList(AllocationListCond allocationListCond); |
| | | |
| | | boolean applyFor (AllocationExtensionAddCond allocationExtensionAddCond); |
| | | } |
New file |
| | |
| | | package com.moral.api.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.moral.api.entity.ApproveTable; |
| | | import com.moral.api.pojo.vo.approvetable.ApproveTableListVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 流程表 服务类 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | public interface ApproveTableService extends IService<ApproveTable> { |
| | | |
| | | |
| | | /** |
| | | * 保存 |
| | | * @param approveTable |
| | | * @return |
| | | */ |
| | | boolean saveResult(ApproveTable approveTable); |
| | | |
| | | List<ApproveTableListVo> listAll(int relationId,int fileModule); |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.service; |
| | | |
| | | import com.moral.api.entity.FileTable; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 附件表 服务类 |
| | | * </p> |
| | | * |
| | | * @author moral |
| | | * @since 2023-09-21 |
| | | */ |
| | | public interface FileTableService extends IService<FileTable> { |
| | | |
| | | FileVo upload(MultipartFile file, Integer sysCode); |
| | | |
| | | List<FileVo> upload(List<MultipartFile>files,Integer sysCode); |
| | | |
| | | void preview(Integer id, HttpServletRequest request, HttpServletResponse response); |
| | | |
| | | void coverPreview(Integer id, HttpServletRequest request, HttpServletResponse response); |
| | | |
| | | void upDateResult(List<FileVo> list,int relationId,int fileModule); |
| | | |
| | | List<FileVo> list(int relationId,int fileModule); |
| | | } |
New file |
| | |
| | | package com.moral.api.service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.moral.api.entity.ResponsibilityUnit; |
| | | |
| | | public interface ResponsibilityUnitService extends IService<ResponsibilityUnit> { |
| | | |
| | | /** |
| | | * 根据上级区域编码或者数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<ResponsibilityUnit> selectUnit(Integer code); |
| | | |
| | | /** |
| | | * 根据本地区域获取单位主体数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | ResponsibilityUnit selectAreaUnit(Integer code); |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.moral.api.entity.Allocation; |
| | | import com.moral.api.entity.AllocationExtension; |
| | | import com.moral.api.exception.BusinessException; |
| | | import com.moral.api.mapper.AllocationExtensionMapper; |
| | | import com.moral.api.pojo.enums.AllocationExtensionApproveEnum; |
| | | import com.moral.api.pojo.enums.FileTableEnum; |
| | | import com.moral.api.pojo.ext.allocation.AllocationExt; |
| | | import com.moral.api.pojo.ext.allocationextension.AllocationExtensionExt; |
| | | import com.moral.api.pojo.ext.allocationextension.AllocationExtensionPageExt; |
| | | import com.moral.api.pojo.query.allocationextension.AllocationExtensionAddCond; |
| | | import com.moral.api.pojo.query.allocationextension.AllocationExtensionPageCond; |
| | | import com.moral.api.service.AllocationExtensionService; |
| | | import com.moral.api.service.AllocationService; |
| | | import com.moral.api.service.FileTableService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * <p> |
| | | * 交办单延期 服务实现类 |
| | | * </p> |
| | | * deyt template generate |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Service |
| | | public class AllocationExtensionServiceImpl extends ServiceImpl<AllocationExtensionMapper, AllocationExtension> implements AllocationExtensionService { |
| | | |
| | | private final AllocationService allocationService; |
| | | private final FileTableService fileTableService; |
| | | |
| | | public AllocationExtensionServiceImpl(AllocationService allocationService, FileTableService fileTableService) { |
| | | this.allocationService = allocationService; |
| | | this.fileTableService = fileTableService; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public AllocationExtensionExt extOne(Integer id) { |
| | | AllocationExtensionExt extensionExt = this.baseMapper.extOne(id); |
| | | AllocationExt extOne = allocationService.oneAllocation(extensionExt.getAllocationId()); |
| | | extensionExt.setAllocationNum(extOne.getAllocationNum()) |
| | | .setEscalationTime(extOne.getEscalationTime()) |
| | | .setPollutePosition(extOne.getPollutePosition()) |
| | | .setUnitId(extOne.getUnitId()) |
| | | .setPolluteType(extOne.getPolluteType()) |
| | | .setChangeType(extOne.getChangeType()) |
| | | .setChangeDay(extOne.getChangeDay()) |
| | | .setEscalationName(extOne.getEscalationName()) |
| | | .setInvestigationType(extOne.getInvestigationType()) |
| | | .setProblemDescribe(extOne.getProblemDescribe()) |
| | | .setEscalationUnitId(extOne.getEscalationUnitId()); |
| | | extensionExt.setFileBaseList(fileTableService.list(extensionExt.getAllocationId(), FileTableEnum.ALLOCATION_FOUNDATION.value)); |
| | | extensionExt.setFileList(fileTableService.list(id, FileTableEnum.ALLOCATION_EXTENSION.value)); |
| | | return extensionExt; |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public Page<AllocationExtensionPageExt> extPage(AllocationExtensionPageCond allocationExtensionPageCond) { |
| | | return this.baseMapper.extPage(allocationExtensionPageCond.getPage().convertPage(), allocationExtensionPageCond); |
| | | } |
| | | |
| | | @Override |
| | | public boolean save(AllocationExtensionAddCond allocationExtensionAddCond) { |
| | | return this.save(allocationExtensionAddCond.convert()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public boolean check(Integer id, Integer state) { |
| | | AllocationExtensionExt extensionExt = this.baseMapper.extOne(id); |
| | | if(!AllocationExtensionApproveEnum.APPLYING.value.equals(extensionExt.getState())){ |
| | | throw new BusinessException("审批中才能发起审批!"); |
| | | } |
| | | AllocationExtension allocationExtension = new AllocationExtension(); |
| | | allocationExtension.setId(id); |
| | | allocationExtension.setState(state); |
| | | this.baseMapper.updateById(allocationExtension); |
| | | if(AllocationExtensionApproveEnum.PASS.value.equals(state)){ |
| | | Allocation allocation = new Allocation(); |
| | | allocation.setAllocationId(extensionExt.getAllocationId()); |
| | | allocation.setChangeDay(extensionExt.getChangeDay()+extensionExt.getExtensionNum()); |
| | | allocationService.updateById(allocation); |
| | | } |
| | | return true; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.moral.api.config.Interceptor.UserHelper; |
| | | import com.moral.api.entity.*; |
| | | import com.moral.api.exception.BusinessException; |
| | | import com.moral.api.pojo.bean.BaseInvalidEntity; |
| | | import com.moral.api.pojo.enums.*; |
| | | import com.moral.api.pojo.ext.allocation.AllocationExt; |
| | | import com.moral.api.pojo.ext.allocation.AllocationListExt; |
| | | import com.moral.api.pojo.ext.allocation.AllocationPageExt; |
| | | import com.moral.api.pojo.query.PageCond; |
| | | import com.moral.api.pojo.query.allocation.*; |
| | | import com.moral.api.pojo.query.allocationextension.AllocationExtensionAddCond; |
| | | import com.moral.api.pojo.vo.approvetable.ApproveTableListVo; |
| | | import com.moral.api.pojo.vo.user.QxUser; |
| | | import com.moral.api.service.AllocationExtensionService; |
| | | import com.moral.api.service.ApproveTableService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | import java.util.*; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.moral.api.entity.Allocation; |
| | | import com.moral.api.entity.ApproveTable; |
| | | import com.moral.api.entity.ResponsibilityUnit; |
| | | import com.moral.api.entity.SysArea; |
| | | import com.moral.api.entity.SysDictData; |
| | | import com.moral.api.entity.SysDictType; |
| | | import com.moral.api.mapper.AllocationMapper; |
| | | import com.moral.api.mapper.ResponsibilityUnitMapper; |
| | | import com.moral.api.mapper.SysDictDataMapper; |
| | | import com.moral.api.mapper.SysDictTypeMapper; |
| | | import com.moral.api.pojo.dto.allocation.AllocationUnitDto; |
| | | import com.moral.api.pojo.dto.allocation.AllocationUnitViewDto; |
| | | import com.moral.api.pojo.enums.AllocationApproveEnum; |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import com.moral.api.service.AllocationService; |
| | | import com.moral.api.service.FileTableService; |
| | | import com.moral.api.service.SysAreaService; |
| | | import com.moral.api.service.SysDictDataService; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.constant.RedisConstants; |
| | | import com.moral.util.DateUtils; |
| | | import com.moral.util.TokenUtils; |
| | | |
| | | |
| | | @Service |
| | | @Slf4j |
| | | public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocation> implements AllocationService { |
| | | |
| | | @Autowired |
| | | private SysDictTypeMapper sysDictTypeMapper; |
| | | @Autowired |
| | | private SysDictDataMapper sysDictDataMapper; |
| | | @Autowired |
| | | private ResponsibilityUnitMapper responsibilityUnitMapper; |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | @Autowired |
| | | private AllocationMapper allocationMapper; |
| | | @Autowired |
| | | private SysAreaService sysAreaService; |
| | | @Autowired |
| | | private ApproveTableService approveTableService; |
| | | @Autowired |
| | | private FileTableService fileTableService; |
| | | @Autowired |
| | | private AllocationExtensionService allocationExtensionService; |
| | | |
| | | /** |
| | | * 根据字典类型获取字典数据 |
| | | * @param dictType |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> sysDictData(String dictType) { |
| | | QueryWrapper<SysDictType> typeQueryWrapper = new QueryWrapper<>(); |
| | | typeQueryWrapper.select("id").eq("name", dictType); |
| | | SysDictType sysDictType = sysDictTypeMapper.selectOne(typeQueryWrapper); |
| | | QueryWrapper<SysDictData> dataQueryWrapper = new QueryWrapper<>(); |
| | | dataQueryWrapper.select("dataKey", "dataValue").eq("dict_type_id", sysDictType.getId()).eq("is_delete", Constants.NOT_DELETE); |
| | | return sysDictDataMapper.selectMaps(dataQueryWrapper); |
| | | } |
| | | |
| | | /** |
| | | * 查询责任主体 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ResponsibilityUnit> seleteUnit() { |
| | | QueryWrapper<ResponsibilityUnit> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("unit_name","unit_id"); |
| | | wrapper.eq("is_del",Constants.NOT_DELETE); |
| | | wrapper.eq("state",0); |
| | | wrapper.eq("is_invalid",0); |
| | | //获取用户信息 |
| | | Map<String, Object> userInfo = (Map<String, Object>) TokenUtils.getUserInfo(); |
| | | Object code = userInfo.get("code"); |
| | | if (!ObjectUtils.isEmpty(code)){ |
| | | wrapper.eq("area_code",code); |
| | | } |
| | | List<ResponsibilityUnit> responsibilityUnits = responsibilityUnitMapper.selectList(wrapper); |
| | | return responsibilityUnits; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加交办单 |
| | | * @param allocationCond |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public Integer insertAllocation(AllocationAddCond allocationCond) { |
| | | Allocation allocation = allocationCond.convert(); |
| | | allocation.setEscalationType(AllocationEscalationTypeEnum.SELF.getValue()); |
| | | String dateString = DateUtils.dateToDateString(new Date(), DateUtils.yyyyMMdd_EN); |
| | | Object o = redisTemplate.opsForValue().get(RedisConstants.JBD_DATA); |
| | | int i; |
| | | if (ObjectUtils.isEmpty(o)){ |
| | | i = 1; |
| | | }else { |
| | | i = Integer.parseInt(o.toString()) + 1; |
| | | } |
| | | //单号 |
| | | String allocationNum = "JBD-" + dateString + String.format("%04d", i); |
| | | allocation.setAllocationNum(allocationNum); |
| | | if(Objects.nonNull(allocationCond.getEscalationUnitId())&&allocationCond.getEscalationUnitId().toString().length()==6) { |
| | | allocation.setEscalationType(AllocationEscalationTypeEnum.CHECK.getValue()); |
| | | } |
| | | if(AllocationApproveEnum.NEW_BUILT.value.equals(allocationCond.getState())) { |
| | | allocation.setState(AllocationApproveEnum.UNDER_RECTIFICATION.value); |
| | | } |
| | | //获取新建图片 |
| | | allocationMapper.insert(allocation); |
| | | redisTemplate.opsForValue().set(RedisConstants.JBD_DATA,i); |
| | | if(AllocationApproveEnum.NEW_BUILT.value.equals(allocationCond.getState())) { |
| | | //添加流程数据 |
| | | ApproveTable approveTable = new ApproveTable(); |
| | | approveTable.setRelationId(allocation.getAllocationId()); |
| | | approveTable.setState(AllocationApproveEnum.NEW_BUILT.value); |
| | | approveTable.setApproveModule(FileTableEnum.ALLOCATION_FOUNDATION.value); |
| | | approveTable.setStateName(AllocationApproveEnum.NEW_BUILT.name); |
| | | approveTableService.saveResult(approveTable); |
| | | } |
| | | fileTableService.upDateResult(allocationCond.getFileBaseList(),allocation.getAllocationId(), FileTableEnum.ALLOCATION_FOUNDATION.value); |
| | | return allocation.getAllocationId(); |
| | | } |
| | | |
| | | /** |
| | | * 查看表单 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public AllocationUnitDto check(Integer id) { |
| | | AllocationUnitDto allocationUnitDto = new AllocationUnitDto(); |
| | | Allocation allocation = allocationMapper.selectById(id); |
| | | BeanUtils.copyProperties(allocation,allocationUnitDto); |
| | | ResponsibilityUnit responsibilityUnit = responsibilityUnitMapper.selectById(allocation.getUnitId()); |
| | | allocationUnitDto.setUnitName(responsibilityUnit.getUnitName()); |
| | | allocationUnitDto.setEscalationUnitName(responsibilityUnit.getUnitName()); |
| | | Map<String, List<SysDictData>> map = (Map<String, List<SysDictData>>) redisTemplate.opsForValue().get(RedisConstants.DICT_DATA_KEY); |
| | | List<SysDictData> contaminate = map.get("contaminate"); |
| | | for (SysDictData sysDictData : contaminate) { |
| | | if (sysDictData.getDataKey().equals(allocation.getPolluteType().toString())){ |
| | | allocationUnitDto.setPolluteTypeName(sysDictData.getDataValue()); |
| | | break; |
| | | } |
| | | } |
| | | allocationUnitDto.setChangeTypeName(allocation.getChangeType()==0?"限期整改":"立即整改"); |
| | | allocationUnitDto.setInvestigationTypeName(allocation.getChangeType()==0?"现场":"无人机"); |
| | | //获取图片 |
| | | return allocationUnitDto; |
| | | } |
| | | |
| | | /** |
| | | * 修改交办单 |
| | | * @param allocationUpdateCond |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public void updateAll(AllocationUpdateCond allocationUpdateCond) { |
| | | AllocationExt allocationExt = oneAllocation(allocationUpdateCond.getAllocationId()); |
| | | if(!AllocationApproveEnum.DRAFT.value.equals(allocationExt.getState())) { |
| | | throw new BusinessException("新建未提交状态,才能编辑!"); |
| | | } |
| | | //获取用户信息 |
| | | Allocation allocation = allocationUpdateCond.convert(); |
| | | if(Objects.nonNull(allocationUpdateCond.getEscalationUnitId())&&allocationUpdateCond.getEscalationUnitId().toString().length()==6) { |
| | | allocation.setEscalationType(AllocationEscalationTypeEnum.CHECK.getValue()); |
| | | } |
| | | if(AllocationApproveEnum.NEW_BUILT.value.equals(allocationUpdateCond.getState())) { |
| | | //添加流程数据 |
| | | ApproveTable approveTable = new ApproveTable(); |
| | | approveTable.setRelationId(allocation.getAllocationId()); |
| | | approveTable.setState(AllocationApproveEnum.NEW_BUILT.value); |
| | | approveTable.setApproveModule(FileTableEnum.ALLOCATION_FOUNDATION.value); |
| | | approveTable.setStateName(AllocationApproveEnum.NEW_BUILT.name); |
| | | approveTableService.saveResult(approveTable); |
| | | } |
| | | fileTableService.upDateResult(allocationUpdateCond.getFileBaseList(),allocation.getAllocationId(), FileTableEnum.ALLOCATION_FOUNDATION.value); |
| | | allocationMapper.updateById(allocation); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据条件查询 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Allocation> selectAll(Map<String, Object> map) { |
| | | |
| | | Object unitId = map.get("unitId"); |
| | | Object state = map.get("state"); |
| | | Object polluteType = map.get("polluteType"); |
| | | Object investigationType = map.get("investigationType"); |
| | | Object changeType = map.get("changeType"); |
| | | Object escalationTime = map.get("escalationTime"); |
| | | Object isInvalid = map.get("isInvalid"); |
| | | // int page = Integer.parseInt(map.get("page").toString()); |
| | | // int size = Integer.parseInt(map.get("size").toString()); |
| | | QueryWrapper<Allocation> wrapper = new QueryWrapper<>(); |
| | | |
| | | //责任主体 |
| | | if (!ObjectUtils.isEmpty(unitId)){ |
| | | wrapper.eq("unit_id",Integer.parseInt(unitId.toString())); |
| | | } |
| | | //流程状态 |
| | | if (!ObjectUtils.isEmpty(state)){ |
| | | wrapper.eq("state",Integer.parseInt(state.toString())); |
| | | } |
| | | //污染分类 |
| | | if (!ObjectUtils.isEmpty(polluteType)){ |
| | | wrapper.eq("pollute_type",Integer.parseInt(polluteType.toString())); |
| | | } |
| | | //排查方式 |
| | | if (!ObjectUtils.isEmpty(investigationType)){ |
| | | wrapper.eq("investigation_type",Integer.parseInt(investigationType.toString())); |
| | | } |
| | | //整改类型 |
| | | if (!ObjectUtils.isEmpty(changeType)){ |
| | | wrapper.eq("change_type",Integer.parseInt(changeType.toString())); |
| | | } |
| | | //是否作废 |
| | | if (!ObjectUtils.isEmpty(isInvalid)){ |
| | | wrapper.eq("is_invalid",Integer.parseInt(isInvalid.toString())); |
| | | } |
| | | if (!ObjectUtils.isEmpty(escalationTime)){ |
| | | // wrapper.eq("is_invalid",Integer.parseInt(isInvalid.toString())); |
| | | } |
| | | List<Allocation> allocations = allocationMapper.selectList(wrapper); |
| | | ArrayList<AllocationUnitDto> rsList = new ArrayList<>(); |
| | | for (Allocation allocation : allocations) { |
| | | AllocationUnitDto allocationUnitDto = new AllocationUnitDto(); |
| | | BeanUtils.copyProperties(allocation,allocationUnitDto); |
| | | allocation.getEscalationTime(); |
| | | Date dateOfDay = DateUtils.getDateOfDay(allocation.getEscalationTime(), allocation.getChangeDay()); |
| | | Date date = new Date(); |
| | | //获取两个日期的天数 |
| | | int days = DateUtils.getDays(dateOfDay, date); |
| | | allocationUnitDto.setChangeDay(days); |
| | | rsList.add(allocationUnitDto); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 表单总览 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> selectUnitView(Map<String, Object> map) { |
| | | QueryWrapper<Allocation> wrapper = new QueryWrapper<>(); |
| | | //获取用户信息 |
| | | // Map<String, Object> userInfo = (Map<String, Object>) TokenUtils.getUserInfo(); |
| | | // Object unitId = userInfo.get("unitId"); |
| | | |
| | | Integer unitId= 17; |
| | | if (!ObjectUtils.isEmpty(unitId)){ |
| | | ResponsibilityUnit responsibilityUnit1 = responsibilityUnitMapper.selectById(unitId); |
| | | Integer areaCode = responsibilityUnit1.getAreaCode(); |
| | | if (areaCode<999999){ |
| | | QueryWrapper<ResponsibilityUnit> wrapper1 = new QueryWrapper<>(); |
| | | wrapper1.eq("parent_code",areaCode); |
| | | List<ResponsibilityUnit> responsibilityUnits = responsibilityUnitMapper.selectList(wrapper1); |
| | | if (ObjectUtils.isEmpty(responsibilityUnits)){ |
| | | return null; |
| | | } |
| | | Map<Integer, List<ResponsibilityUnit>> collect = responsibilityUnits.stream().collect(Collectors.groupingBy(o -> o.getUnitId())); |
| | | List<Integer> collect1 = collect.keySet().stream().collect(Collectors.toList()); |
| | | wrapper.in("unit_id",collect1); |
| | | }else { |
| | | wrapper.eq("unit_id",unitId); |
| | | } |
| | | } |
| | | |
| | | HashMap<String, Object> rsMap = new HashMap<>(); |
| | | HashMap<String, Object> polluteMap = new HashMap<>(); |
| | | ArrayList<AllocationUnitViewDto> allocationUnitViewDtos = new ArrayList<>(); |
| | | |
| | | Object number1 = map.get("number"); |
| | | String startTime=null; |
| | | String endTime=null; |
| | | if (!ObjectUtils.isEmpty(map.get("startTime")) || !ObjectUtils.isEmpty(map.get("startTime"))){ |
| | | startTime = map.get("startTime").toString(); |
| | | endTime = map.get("endTime").toString(); |
| | | |
| | | } |
| | | if (!ObjectUtils.isEmpty(number1)){ |
| | | String s = number1.toString(); |
| | | //当前时间的 |
| | | endTime = DateUtils.getCurDateTime(); |
| | | if (s.equals("-1")){ |
| | | //当前时间的 |
| | | startTime = DateUtils.getDateStringOfMon(Integer.parseInt(s), DateUtils.yyyy_MM_dd_HH_mm_ss_EN); |
| | | } |
| | | if (s.equals("-2")){ |
| | | //当前时间的 |
| | | startTime = DateUtils.getDateStringOfMon(Integer.parseInt(s), DateUtils.yyyy_MM_dd_HH_mm_ss_EN); |
| | | } |
| | | if (s.equals("-3")){ |
| | | startTime = DateUtils.getDateStringOfMon(Integer.parseInt(s), DateUtils.yyyy_MM_dd_HH_mm_ss_EN); |
| | | } |
| | | if (s.equals("-6")){ |
| | | startTime = DateUtils.getDateStringOfMon(Integer.parseInt(s), DateUtils.yyyy_MM_dd_HH_mm_ss_EN); |
| | | } |
| | | if (s.equals("-12")){ |
| | | startTime = DateUtils.getDateStringOfMon(Integer.parseInt(s), DateUtils.yyyy_MM_dd_HH_mm_ss_EN); |
| | | } |
| | | |
| | | } |
| | | |
| | | wrapper.between("escalation_time",startTime,endTime); |
| | | wrapper.eq("is_del",0); |
| | | wrapper.eq("is_invalid",0); |
| | | List<Allocation> allocations = allocationMapper.selectList(wrapper); |
| | | if (ObjectUtils.isEmpty(allocations)){ |
| | | return null; |
| | | } |
| | | int complete=0; |
| | | int unComplete=0; |
| | | for (Allocation allocation : allocations) { |
| | | String state = allocation.getState()+""; |
| | | if (state.equals("40")||state.equals("50")){ |
| | | complete++; |
| | | }else if(state.equals("10")||state.equals("20") ||state.equals("30")) { |
| | | unComplete++; |
| | | } |
| | | } |
| | | //根据污染类型分类 |
| | | Map<Integer, List<Allocation>> polluteTypeMap = allocations.stream().collect(Collectors.groupingBy(o -> o.getPolluteType())); |
| | | Set<Integer> polluteTypes = polluteTypeMap.keySet(); |
| | | for (Integer polluteType : polluteTypes) { |
| | | |
| | | HashMap<String, Object> typeMap = new HashMap<>(); |
| | | List<Allocation> allocations1 = polluteTypeMap.get(polluteType); |
| | | QueryWrapper<SysDictData> sysDictDataQueryWrapper = new QueryWrapper<>(); |
| | | sysDictDataQueryWrapper.eq("dict_type_id",31); |
| | | sysDictDataQueryWrapper.eq("dataKey",polluteType); |
| | | SysDictData sysDictData = sysDictDataMapper.selectOne(sysDictDataQueryWrapper); |
| | | typeMap.put("name",sysDictData.getDataValue()); |
| | | typeMap.put("value",allocations1.size()); |
| | | polluteMap.put("polluteType",typeMap); |
| | | } |
| | | //根据责任单位分类 |
| | | Map<Integer, List<Allocation>> unitMap = allocations.stream().collect(Collectors.groupingBy(o -> o.getUnitId())); |
| | | Set<Integer> unitList = unitMap.keySet(); |
| | | //逾期次数 |
| | | int overdue=0; |
| | | for (Integer integer : unitList) { |
| | | //获取城市 |
| | | ResponsibilityUnit responsibilityUnit = responsibilityUnitMapper.selectById(integer); |
| | | |
| | | SysArea areaByCode = sysAreaService.getAreaByCode(responsibilityUnit.getAreaCode()); |
| | | |
| | | AllocationUnitViewDto allocationUnitViewDto = new AllocationUnitViewDto(); |
| | | List<Allocation> allocations1 = unitMap.get(integer); |
| | | //加分 |
| | | int marks=0; |
| | | //减分 |
| | | int deduction=0; |
| | | int number=0; |
| | | for (Allocation allocation : allocations1) { |
| | | |
| | | Date dateOfDay = DateUtils.getDateOfDay(allocation.getEscalationTime(), allocation.getChangeDay()); |
| | | Date date = new Date(); |
| | | String state = allocation.getState()+""; |
| | | boolean timeBefor = DateUtils.isTimeBefor(date, dateOfDay); |
| | | if (timeBefor && !state.equals("40") && !state.equals("50")){ |
| | | //逾期次数 |
| | | overdue++; |
| | | } |
| | | if (state.equals("40")||state.equals("50")){ |
| | | if (allocation.getCheckScore()>0){ |
| | | marks = marks + allocation.getCheckScore(); |
| | | }else { |
| | | deduction = deduction + allocation.getCheckScore(); |
| | | } |
| | | number++; |
| | | } |
| | | } |
| | | int total = allocations1.size(); |
| | | allocationUnitViewDto.setDeduction(deduction); |
| | | allocationUnitViewDto.setMarks(marks); |
| | | allocationUnitViewDto.setTotal(total); |
| | | allocationUnitViewDto.setTotalPoints(marks+deduction); |
| | | allocationUnitViewDto.setNumber(number); |
| | | String rate = (number * 100 /total)+"%"; |
| | | allocationUnitViewDto.setRate(rate); |
| | | allocationUnitViewDto.setUnNumber(total-number); |
| | | allocationUnitViewDto.setUnitName(areaByCode.getAreaName()); |
| | | allocationUnitViewDtos.add(allocationUnitViewDto); |
| | | } |
| | | rsMap.put("unitView",allocationUnitViewDtos); |
| | | rsMap.put("total",allocations.size()); |
| | | rsMap.put("complete",complete); |
| | | rsMap.put("unComplete",unComplete); |
| | | rsMap.put("overdue",overdue); |
| | | rsMap.put("polluteType",polluteMap); |
| | | return rsMap; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> unitExel(Map<String, Object> map) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Page<AllocationPageExt> extPage(AllocationPageCond allocationPageCond) { |
| | | return this.baseMapper.extPage(allocationPageCond.getPage().convertPage(), allocationPageCond); |
| | | } |
| | | |
| | | @Override |
| | | public AllocationExt extOne(Integer id) { |
| | | AllocationExt allocationExt = oneAllocation(id); |
| | | allocationExt.setFileBaseList(fileTableService.list(id,FileTableEnum.ALLOCATION_FOUNDATION.value)); |
| | | allocationExt.setFileChangeList(fileTableService.list(id,FileTableEnum.ALLOCATION_RECTIFICATION.value)); |
| | | allocationExt.setFileApproveList(fileTableService.list(id,FileTableEnum.ALLOCATION_APPROVE.value)); |
| | | allocationExt.setApproveList(approveTableService.listAll(id, FileTableEnum.ALLOCATION_FOUNDATION.value)); |
| | | return allocationExt; |
| | | } |
| | | |
| | | @Override |
| | | public AllocationExt oneAllocation(Integer id){ |
| | | return this.baseMapper.extOne(id); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void changeAllocation(AllocationChangeCond changeCond) { |
| | | AllocationExt allocationExt = oneAllocation(changeCond.getAllocationId()); |
| | | if(!AllocationApproveEnum.UNDER_RECTIFICATION.value.equals(allocationExt.getState())) { |
| | | throw new BusinessException("整改状态,才能提交审批!"); |
| | | } |
| | | Allocation allocation = new Allocation(); |
| | | allocation.setAllocationId(changeCond.getAllocationId()); |
| | | allocation.setIsChange(changeCond.getIsChange()); |
| | | allocation.setChangeName(changeCond.getChangeName()); |
| | | allocation.setChangeDescribe(changeCond.getChangeDescribe()); |
| | | allocation.setState(changeCond.getState()); |
| | | allocation.setChangeTime(new Date()); |
| | | this.updateById(allocation); |
| | | //添加流程数据 |
| | | ApproveTable approveTable = new ApproveTable(); |
| | | approveTable.setRelationId(allocation.getAllocationId()); |
| | | approveTable.setState(AllocationApproveEnum.UNDER_RECTIFICATION.value); |
| | | approveTable.setStateName(AllocationApproveEnum.UNDER_RECTIFICATION.name); |
| | | approveTable.setApproveModule(FileTableEnum.ALLOCATION_FOUNDATION.value); |
| | | approveTableService.saveResult(approveTable); |
| | | fileTableService.upDateResult(changeCond.getFileChangeList(),allocation.getAllocationId(), FileTableEnum.ALLOCATION_FOUNDATION.value); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void checkAllocation(AllocationCheckCond checkCond) { |
| | | AllocationExt allocationExt = oneAllocation(checkCond.getAllocationId()); |
| | | if(!AllocationApproveEnum.IN_APPROVAL.value.equals(allocationExt.getState())) { |
| | | throw new BusinessException("审批状态,才能进行审批操作!"); |
| | | } |
| | | QxUser qxUser = UserHelper.getCurrentUser(); |
| | | Allocation allocation = new Allocation(); |
| | | allocation.setCheckScore(checkCond.getCheckScore()); |
| | | allocation.setCheckDescribe(checkCond.getCheckDescribe()); |
| | | allocation.setCheckName(qxUser.getUserName()); |
| | | allocation.setCheckTime(new Date()); |
| | | allocation.setState(checkCond.getState()); |
| | | this.updateById(allocation); |
| | | //添加流程数据 |
| | | ApproveTable approveTable = new ApproveTable(); |
| | | approveTable.setRelationId(allocation.getAllocationId()); |
| | | if(AllocationApproveEnum.PASS.value.equals(checkCond.getState())){ |
| | | approveTable.setState(AllocationApproveEnum.PASS.value); |
| | | approveTable.setStateName(AllocationApproveEnum.PASS.name); |
| | | }else { |
| | | approveTable.setState(AllocationApproveEnum.REFUSE.value); |
| | | approveTable.setStateName(AllocationApproveEnum.REFUSE.name); |
| | | } |
| | | approveTable.setApproveModule(FileTableEnum.ALLOCATION_FOUNDATION.value); |
| | | approveTableService.saveResult(approveTable); |
| | | fileTableService.upDateResult(checkCond.getFileApproveList(),checkCond.getAllocationId(), FileTableEnum.ALLOCATION_FOUNDATION.value); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public boolean removeById(Integer id) { |
| | | AllocationExt allocationExt = oneAllocation(id); |
| | | if(!AllocationApproveEnum.DRAFT.value.equals(allocationExt.getState())) { |
| | | throw new BusinessException("新建草稿状态,才能删除!"); |
| | | } |
| | | this.baseMapper.deleteById(id); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public boolean invalidResult(Integer id,String invalidReason) { |
| | | AllocationExt allocationExt = oneAllocation(id); |
| | | if( AllocationApproveEnum.IN_APPROVAL.value >= allocationExt.getState() ) { |
| | | throw new BusinessException("审批结束才能作废!"); |
| | | } |
| | | LambdaUpdateChainWrapper<Allocation> wrapper =lambdaUpdate(); |
| | | wrapper.eq(Allocation::getAllocationId,id).set(Allocation::getInvalidReason,invalidReason).set(BaseInvalidEntity::getIsInvalid, YesOrNo.YES.value); |
| | | return wrapper.update(); |
| | | } |
| | | |
| | | @Override |
| | | public List<AllocationListExt> extList(AllocationListCond allocationListCond) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public boolean applyFor(AllocationExtensionAddCond allocationExtensionAddCond) { |
| | | AllocationExt allocationExt = oneAllocation(allocationExtensionAddCond.getAllocationId()); |
| | | boolean type = false; |
| | | if( !AllocationApproveEnum.UNDER_RECTIFICATION.value.equals(allocationExt.getState())) { |
| | | type = true; |
| | | } |
| | | if(!ChangeEnum.DEADLINE.value.equals(allocationExt.getChangeType())){ |
| | | type = true; |
| | | } |
| | | if(type){ |
| | | throw new BusinessException("只有限期整改类型,状态为整改中,才能发起延期申请!"); |
| | | } |
| | | AllocationExtension allocationExtension = allocationExtensionAddCond.convert(); |
| | | allocationExtension.setState(AllocationExtensionApproveEnum.APPLYING.value); |
| | | allocationExtensionService.save(allocationExtension); |
| | | fileTableService.upDateResult(allocationExtensionAddCond.getFileList(),allocationExtension.getId(), FileTableEnum.ALLOCATION_EXTENSION.value); |
| | | return true; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.moral.api.entity.ApproveTable; |
| | | import com.moral.api.entity.FileTable; |
| | | import com.moral.api.mapper.ApproveTableMapper; |
| | | import com.moral.api.pojo.enums.YesOrNo; |
| | | import com.moral.api.pojo.vo.approvetable.ApproveTableListVo; |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import com.moral.api.service.ApproveTableService; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 流程表 服务实现类 |
| | | * </p> |
| | | * deyt template generate |
| | | * |
| | | * @author JI |
| | | * @since 2023-09-25 |
| | | */ |
| | | @Service |
| | | public class ApproveTableServiceImpl extends ServiceImpl<ApproveTableMapper, ApproveTable> implements ApproveTableService { |
| | | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public boolean saveResult(ApproveTable approveTable) { |
| | | return this.save(approveTable); |
| | | } |
| | | |
| | | @Override |
| | | public List<ApproveTableListVo> listAll(int relationId,int fileModule) { |
| | | List<ApproveTableListVo> list = new ArrayList<>(); |
| | | List<ApproveTable> existsList = this.lambdaQuery().eq(ApproveTable::getRelationId, relationId) |
| | | .eq(ApproveTable::getApproveModule, fileModule) |
| | | .eq(ApproveTable::getIsDel, YesOrNo.NO.value).orderByAsc(ApproveTable::getCreateTime).list(); |
| | | |
| | | existsList.forEach(it->{ |
| | | ApproveTableListVo listVo = BeanConverts.convert(it,ApproveTableListVo.class); |
| | | list.add(listVo); |
| | | }); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.service.impl; |
| | | |
| | | import com.moral.api.config.Interceptor.UserHelper; |
| | | import com.moral.api.entity.FileTable; |
| | | import com.moral.api.exception.BusinessException; |
| | | import com.moral.api.mapper.FileTableMapper; |
| | | import com.moral.api.pojo.enums.FileType; |
| | | import com.moral.api.pojo.enums.YesOrNo; |
| | | import com.moral.api.pojo.vo.file.FileVo; |
| | | import com.moral.api.pojo.vo.user.QxUser; |
| | | import com.moral.api.service.FileTableService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.moral.api.utils.FileTypeUtils; |
| | | import com.moral.api.utils.StringUtils; |
| | | import com.moral.util.DateUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import net.coobird.thumbnailator.Thumbnails; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 附件表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author moral |
| | | * @since 2023-09-21 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class FileTableServiceImpl extends ServiceImpl<FileTableMapper, FileTable> implements FileTableService { |
| | | @Value("${file.path}") |
| | | private String basePath; |
| | | @Override |
| | | public FileVo upload(MultipartFile file, Integer sysCode) { |
| | | String originalFilename = file.getOriginalFilename().replaceAll(StringUtils.SPACE, StringUtils.EMPTY).toLowerCase(); |
| | | String suffix = originalFilename.substring(originalFilename.lastIndexOf(StringUtils.DOT)); |
| | | FileType fileType = FileTypeUtils.getFileType(suffix.toLowerCase()); |
| | | // 处理文件相对路径 系统代码 + 业务代码 + 日期 |
| | | String filePath = getFilePath(sysCode.toString()); |
| | | // 保存文件 |
| | | String targetFolder = basePath.replaceAll(StringUtils.BACKSLASH.concat(StringUtils.BACKSLASH), StringUtils.SLASH).concat(StringUtils.SLASH).concat(filePath); |
| | | //使用uuid 替换上传文件名,避免重复 |
| | | String storageFileName = UUID.randomUUID() + originalFilename.substring(originalFilename.lastIndexOf(StringUtils.DOT)); |
| | | storageFile(file, storageFileName, targetFolder); |
| | | |
| | | // 封装文件信息 |
| | | QxUser user = UserHelper.getCurrentUser(); |
| | | FileTable sysFile = new FileTable(); |
| | | sysFile.setFileName(originalFilename).setFileType(fileType.getValue()).setFileSize((int) file.getSize()).setFileAddress(filePath.concat(storageFileName)) |
| | | .setFileModule(sysCode).setCreateTime(new Date()); |
| | | if (Objects.nonNull(user)) { |
| | | sysFile.setCreateId(user.getUserId()).setCreateName(user.getUserName()); |
| | | } |
| | | save(sysFile); |
| | | return new FileVo().setFileId(sysFile.getFileId()).setFileName(originalFilename).setFileType(fileType.getValue()); |
| | | } |
| | | |
| | | @Override |
| | | public List<FileVo> upload(List<MultipartFile> files, Integer sysCode) { |
| | | List<FileVo> fileList = new LinkedList<>(); |
| | | for (MultipartFile file : files) { |
| | | fileList.add(upload(file, sysCode)); |
| | | } |
| | | return fileList; |
| | | } |
| | | |
| | | @Override |
| | | public void preview(Integer id, HttpServletRequest request, HttpServletResponse response) { |
| | | FileTable sysFile = getById(id); |
| | | File file = new File(handleFileRealPath(sysFile.getFileAddress())); |
| | | String suffix = file.getName().substring(file.getName().lastIndexOf(StringUtils.DOT)); |
| | | if (FileTypeUtils.SUFFIX_MP4.equals(suffix)) { |
| | | videoPreview(file, request, response); |
| | | } else { |
| | | try (OutputStream out = response.getOutputStream(); InputStream in = new FileInputStream(file)) { |
| | | response.setContentType(FileTypeUtils.convertHeaderType(suffix)); |
| | | response.setHeader("Content-Disposition", "inline; filename=" + URLEncoder.encode(sysFile.getFileName(), "UTF-8")); |
| | | int len; |
| | | // 创建数据缓冲区 |
| | | byte[] buffer = new byte[1024]; |
| | | while ((len = in.read(buffer)) > 0) { |
| | | out.write(buffer, 0, len); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("读取文件异常!!! e={}", e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private String getFilePath(String sysCode) { |
| | | return sysCode.concat(StringUtils.SLASH).concat(StringUtils.SLASH).concat(DateUtils.dateToDateString(new Date(),DateUtils.yyyyMMdd_EN)).concat(StringUtils.SLASH); |
| | | } |
| | | |
| | | public void storageFile(MultipartFile file, String originalFilename, String targetFolder) { |
| | | File f = new File(targetFolder, originalFilename); |
| | | try { |
| | | // 保存文件 |
| | | if (!f.getParentFile().exists()) { |
| | | if (!f.getParentFile().mkdirs()) { |
| | | log.error("error:创建文件失败! dir={}", f.getAbsolutePath()); |
| | | } |
| | | } |
| | | file.transferTo(f); |
| | | } catch (IOException e) { |
| | | log.error("error:文件上传失败!!!e={}", e.getMessage()); |
| | | throw new BusinessException("文件上传失败,请重试!"); |
| | | } |
| | | } |
| | | private String handleFileRealPath(String path) { |
| | | return basePath.replaceAll(StringUtils.BACKSLASH.concat(StringUtils.BACKSLASH), StringUtils.SLASH).concat(StringUtils.SLASH).concat(path); |
| | | } |
| | | private void videoPreview(File file, HttpServletRequest request, HttpServletResponse response) { |
| | | String suffix = file.getName().substring(file.getName().lastIndexOf(StringUtils.DOT)); |
| | | //设置属性 |
| | | response.setContentType(FileTypeUtils.convertHeaderType(suffix)); |
| | | response.setHeader("Accept-Ranges", "bytes"); |
| | | response.setHeader("ETag", file.getName()); |
| | | response.setHeader("Last-Modified", new Date().toString()); |
| | | long contentLength = file.length(); |
| | | |
| | | //每次传递实际长度(初始第一次读取少选数据) |
| | | long length = Math.min(contentLength, 1024); |
| | | long start = 0, end = 0; |
| | | String range = request.getHeader("Range"); |
| | | //第一次请求只返回content length来让客户端请求多次实际数据 |
| | | if (range == null) { |
| | | response.setHeader("Content-length", contentLength + ""); |
| | | } else { |
| | | //以后的多次以断点续传的方式来返回视频数据 |
| | | response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);//206 |
| | | |
| | | if (range.startsWith("bytes=")) { |
| | | String[] values = range.split("=")[1].split("-"); |
| | | start = Integer.parseInt(values[0]); |
| | | if (values.length > 1) { |
| | | end = Integer.parseInt(values[1]); |
| | | } |
| | | } |
| | | //无end,每次允许的最大长度 |
| | | long maxSize = 1024 * 1024; //1MB |
| | | if (end > 0) { |
| | | length = end - start + 1; |
| | | response.setHeader("Content-length", "" + length); |
| | | response.setHeader("Content-Range", "bytes " + start + "-" + end + "/" + contentLength); |
| | | } else { |
| | | length = Math.min((contentLength - start), maxSize); |
| | | response.setHeader("Content-length", "" + length); |
| | | response.setHeader("Content-Range", "bytes " + start + "-" + (start + length - 1) + "/" + contentLength); |
| | | } |
| | | } |
| | | try { |
| | | FileInputStream fileInputStream = new FileInputStream(file); |
| | | OutputStream out = response.getOutputStream(); |
| | | //将数据截取并存入byte[]数组中 |
| | | byte[] data = new byte[(int) length]; |
| | | fileInputStream.skip(start); |
| | | fileInputStream.read(data); |
| | | //取出要传给前端的有效数据 |
| | | out.write(data); |
| | | out.close(); |
| | | fileInputStream.close(); |
| | | } catch (Exception e) { |
| | | log.error("读取文件异常!!! e={}", e.getMessage()); |
| | | } |
| | | } |
| | | @Override |
| | | public void coverPreview(Integer id, HttpServletRequest request, HttpServletResponse response) { |
| | | FileTable sysFile = getById(id); |
| | | |
| | | File file = new File(handleFileRealPath(sysFile.getFileAddress())); |
| | | String suffix = file.getName().substring(file.getName().lastIndexOf(StringUtils.DOT)); |
| | | |
| | | try (OutputStream out = response.getOutputStream()) { |
| | | response.setContentType(FileTypeUtils.convertHeaderType(suffix)); |
| | | response.setHeader("Content-Disposition", "inline; filename=" + URLEncoder.encode(sysFile.getFileName(), "UTF-8")); |
| | | Thumbnails.of(file).size(420, 200).toOutputStream(out); |
| | | } catch (Exception e) { |
| | | log.error("读取文件异常!!! e={}", e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void upDateResult(List<FileVo> list,int relationId,int fileModule) { |
| | | List<FileTable> existsList = this.lambdaQuery().eq(FileTable::getRelationId, relationId) |
| | | .eq(FileTable::getFileModule, fileModule) |
| | | .eq(FileTable::getIsDel, YesOrNo.NO.value).list(); |
| | | |
| | | // 新增附件 |
| | | if (!CollectionUtils.isEmpty(list)) { |
| | | List<FileTable> addList = new ArrayList(); |
| | | // 2.2.筛选出需要保存的文件 |
| | | list.forEach(it -> { |
| | | existsList.removeIf(file -> file.getFileId().equals(it.getFileId())); |
| | | FileTable file = new FileTable(); |
| | | BeanUtils.copyProperties(it,file); |
| | | file.setRelationId(relationId); |
| | | addList.add(file); |
| | | }); |
| | | if (!CollectionUtils.isEmpty(addList)) { |
| | | // 保存 |
| | | this.updateBatchById(addList); |
| | | } |
| | | } |
| | | // 删除附件 |
| | | if (!CollectionUtils.isEmpty(existsList)) { |
| | | removeByIds(existsList.stream().map(FileTable::getFileId).collect(Collectors.toList())); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<FileVo> list(int relationId, int fileModule) { |
| | | List<FileVo> list = new ArrayList<>(); |
| | | List<FileTable> existsList = this.lambdaQuery().eq(FileTable::getRelationId, relationId) |
| | | .eq(FileTable::getFileModule, fileModule) |
| | | .eq(FileTable::getIsDel, YesOrNo.NO.value).orderByAsc(FileTable::getCreateTime).list(); |
| | | existsList.forEach(it->{ |
| | | FileVo fileVo = new FileVo(); |
| | | fileVo.setFileId(it.getFileId()); |
| | | fileVo.setFileName(it.getFileName()); |
| | | fileVo.setFileType(it.getFileType()); |
| | | list.add(fileVo); |
| | | }); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.service.impl; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.moral.api.entity.ResponsibilityUnit; |
| | | import com.moral.api.mapper.ResponsibilityUnitMapper; |
| | | import com.moral.api.service.ResponsibilityUnitService; |
| | | |
| | | |
| | | @Service |
| | | public class ResponsibilityUnitServiceImpl extends ServiceImpl<ResponsibilityUnitMapper, ResponsibilityUnit> implements ResponsibilityUnitService { |
| | | |
| | | @Autowired |
| | | private ResponsibilityUnitMapper responsibilityUnitMapper; |
| | | /** |
| | | * 根据上级区域编码或者数据 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ResponsibilityUnit> selectUnit(Integer code) { |
| | | QueryWrapper<ResponsibilityUnit> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("parent_code",code); |
| | | wrapper.eq("is_del",0); |
| | | wrapper.eq("state",0); |
| | | wrapper.eq("is_invalid",0); |
| | | List<ResponsibilityUnit> responsibilityUnits = responsibilityUnitMapper.selectList(wrapper); |
| | | return responsibilityUnits; |
| | | } |
| | | |
| | | /** |
| | | * 根据本地区域获取单位主体数据 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResponsibilityUnit selectAreaUnit(Integer code) { |
| | | QueryWrapper<ResponsibilityUnit> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("area_code",code); |
| | | wrapper.eq("is_del",0); |
| | | wrapper.eq("state",0); |
| | | wrapper.eq("is_invalid",0); |
| | | ResponsibilityUnit responsibilityUnit = responsibilityUnitMapper.selectOne(wrapper); |
| | | return responsibilityUnit; |
| | | } |
| | | } |
| | |
| | | import com.moral.api.entity.Group; |
| | | import com.moral.api.entity.Menu; |
| | | import com.moral.api.entity.Organization; |
| | | import com.moral.api.entity.ResponsibilityUnit; |
| | | import com.moral.api.entity.User; |
| | | import com.moral.api.entity.UserGroup; |
| | | import com.moral.api.entity.UserLog; |
| | | import com.moral.api.mapper.MenuMapper; |
| | | import com.moral.api.mapper.ResponsibilityUnitMapper; |
| | | import com.moral.api.mapper.UserGroupMapper; |
| | | import com.moral.api.mapper.UserLogMapper; |
| | | import com.moral.api.mapper.UserMapper; |
| | | import com.moral.api.pojo.bo.UserBO; |
| | | import com.moral.api.service.ResponsibilityUnitService; |
| | | import com.moral.api.service.UserService; |
| | | import com.moral.api.utils.OperationLogUtils; |
| | | import com.moral.constant.Constants; |
| | |
| | | |
| | | @Autowired |
| | | private OperationLogUtils operationLogUtils; |
| | | |
| | | @Autowired |
| | | private ResponsibilityUnitService responsibilityUnitService; |
| | | |
| | | @Value("${AES.KEY}") |
| | | private String AESKey; |
| | |
| | | userInfo.put("userName", userBo.getUserName()); |
| | | userInfo.put("email", userBo.getEmail()); |
| | | userInfo.put("mobile", userBo.getMobile()); |
| | | userInfo.put("unitId",userBo.getUnitId()); |
| | | userInfo.put("wechat", userBo.getWechat()); |
| | | userInfo.put("expireTime", DateUtils.dateToDateString(userBo.getExpireTime())); |
| | | userInfo.put("isAdmin", userBo.getIsAdmin()); |
| | |
| | | result.put("msg", ResponseCodeEnum.MOBILE_INVALID.getMsg()); |
| | | return result; |
| | | } |
| | | ResponsibilityUnit responsibilityUnit = responsibilityUnitService.selectAreaUnit(user.getUnitCode()); |
| | | user.setUnitId(responsibilityUnit.getUnitId()); |
| | | //密码加密 |
| | | user.setPassword(MD5Utils.saltMD5(password)); |
| | | Map<String, Object> orgInfo = (Map<String, Object>) currentUserInfo.get("organization"); |
| | |
| | | String deleteToken = TokenUtils.hget(userId).toString(); |
| | | TokenUtils.destoryToken(userId, deleteToken); |
| | | } |
| | | ResponsibilityUnit responsibilityUnit = responsibilityUnitService.selectAreaUnit(user.getUnitCode()); |
| | | user.setUnitId(responsibilityUnit.getUnitId()); |
| | | userMapper.updateById(user); |
| | | |
| | | //日志 |
New file |
| | |
| | | package com.moral.api.utils; |
| | | |
| | | import com.moral.api.pojo.enums.FileType; |
| | | |
| | | /** |
| | | * @ClassName: FileTypeUtils |
| | | * @Description: |
| | | * @Author: fan |
| | | * @Date: 2021/2/1 13:41 |
| | | * @Version: 1.0 |
| | | **/ |
| | | public class FileTypeUtils { |
| | | /** |
| | | * 图片后缀 |
| | | */ |
| | | private static final String SUFFIX_JPE = ".jpe"; |
| | | private static final String SUFFIX_JPG = ".jpg"; |
| | | private static final String SUFFIX_PNG = ".png"; |
| | | private static final String SUFFIX_JPEG = ".jpeg"; |
| | | private static final String SUFFIX_BMP = ".bmp"; |
| | | private static final String SUFFIX_GIF = ".gif"; |
| | | |
| | | /** |
| | | * word |
| | | */ |
| | | public static final String SUFFIX_DOC = ".doc"; |
| | | public static final String SUFFIX_DOCX = ".docx"; |
| | | |
| | | /** |
| | | * excel |
| | | */ |
| | | private static final String SUFFIX_XLSX = ".xlsx"; |
| | | private static final String SUFFIX_XLS = ".xls"; |
| | | |
| | | /** |
| | | * pdf |
| | | */ |
| | | public static final String SUFFIX_PDF = ".pdf"; |
| | | |
| | | /** |
| | | * 压缩包 |
| | | */ |
| | | private static final String SUFFIX_ZIP = ".zip"; |
| | | private static final String SUFFIX_RAR = ".rar"; |
| | | private static final String SUFFIX_JAR = ".jar"; |
| | | private static final String SUFFIX_GZIP = ".gzip"; |
| | | |
| | | private static final String SUFFIX_TXT = ".txt"; |
| | | |
| | | /** |
| | | * ppt |
| | | */ |
| | | public static final String SUFFIX_PPT = ".ppt"; |
| | | public static final String SUFFIX_PPTX = ".pptx"; |
| | | |
| | | |
| | | public static final String SUFFIX_MP4 = ".mp4"; |
| | | |
| | | /** |
| | | * @Description 获取文件类型 |
| | | * @author fanhq |
| | | * @date 2020/4/20 15:35 |
| | | * @param suffix |
| | | * @return java.lang.Integer 1. 图片 * 2. word * 3. excel * 4. pdf * 5. 压缩包 |
| | | */ |
| | | public static FileType getFileType(String suffix) { |
| | | switch (suffix) { |
| | | case SUFFIX_JPE: |
| | | case SUFFIX_JPG: |
| | | case SUFFIX_PNG: |
| | | case SUFFIX_JPEG: |
| | | case SUFFIX_BMP: |
| | | return FileType.PICTURE; |
| | | case SUFFIX_DOC: |
| | | case SUFFIX_DOCX: |
| | | return FileType.WORD; |
| | | case SUFFIX_XLSX: |
| | | case SUFFIX_XLS: |
| | | return FileType.EXCEL; |
| | | case SUFFIX_PDF: |
| | | return FileType.PDF; |
| | | case SUFFIX_ZIP: |
| | | case SUFFIX_RAR: |
| | | case SUFFIX_JAR: |
| | | return FileType.ZIP; |
| | | default: |
| | | return FileType.NON; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据文件类型转换响应头类型 |
| | | * @param type |
| | | * @return |
| | | */ |
| | | public static String convertHeaderType(String type) { |
| | | switch (type){ |
| | | case SUFFIX_JPE: |
| | | case SUFFIX_JPG: |
| | | case SUFFIX_JPEG: |
| | | return "image/jpeg"; |
| | | case SUFFIX_PNG: |
| | | return "image/png"; |
| | | case SUFFIX_GIF: |
| | | return "image/gif"; |
| | | case SUFFIX_ZIP: |
| | | return "application/zip"; |
| | | case SUFFIX_GZIP: |
| | | return "application/gzip"; |
| | | case SUFFIX_DOC: |
| | | case SUFFIX_DOCX: |
| | | return "application/msword"; |
| | | case SUFFIX_XLSX: |
| | | case SUFFIX_XLS: |
| | | return "application/x-xls"; |
| | | case SUFFIX_PDF: |
| | | return "application/pdf"; |
| | | case SUFFIX_TXT: |
| | | return "text/plain"; |
| | | case SUFFIX_MP4: |
| | | return "video/mp4"; |
| | | default: |
| | | return "application/octet-stream"; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.utils; |
| | | |
| | | |
| | | import java.io.StringReader; |
| | | import java.io.StringWriter; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.charset.Charset; |
| | | import java.util.Arrays; |
| | | import java.util.Map; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /*** |
| | | * @Author JI |
| | | * @Date 2020/3/27 13:44 |
| | | * @Param |
| | | * @return |
| | | **/ |
| | | public class StringUtils extends org.apache.commons.lang3.StringUtils { |
| | | |
| | | public static final String SPACE = " "; |
| | | public static final String DOT = "."; |
| | | public static final String PERIOD = "。"; |
| | | public static final String SLASH = "/"; |
| | | public static final String BACKSLASH = "\\"; |
| | | public static final String EMPTY = ""; |
| | | public static final String CRLF = "\r\n"; |
| | | public static final String NEWLINE = "\n"; |
| | | public static final String UNDERLINE = "_"; |
| | | public static final String COMMA = ","; |
| | | public static final String COMMA_CN = ","; |
| | | public static final String CONNECTION_LINE = "-"; |
| | | public static final String SEMICOLON = ";"; |
| | | public static final String SEMICOLON_CN = ";"; |
| | | |
| | | public static final String HTML_NBSP = " "; |
| | | public static final String HTML_AMP = "&"; |
| | | public static final String HTML_QUOTE = """; |
| | | public static final String HTML_LT = "<"; |
| | | public static final String HTML_GT = ">"; |
| | | public static final String PLACEHOLDER = "%s"; |
| | | public static final String FILE_SEPARATOR = System.getProperties().getProperty("file.separator"); |
| | | public static final String EMPTY_JSON = "{}"; |
| | | |
| | | |
| | | /*** |
| | | * @Author JI |
| | | * @Description //判断是否为空(空格算空) |
| | | * @Date 2020/3/27 13:55 |
| | | * @Param [str] |
| | | * @return boolean |
| | | **/ |
| | | public static boolean isEmpty(String str) { |
| | | return str == null || "".equals(str.trim()) || "null".equals(str.trim()); |
| | | } |
| | | |
| | | public static boolean isBlank(Map param, String str) { |
| | | return !param.containsKey(str) || param.get(str) == null || "".equals(param.get(str).toString().trim()) || "null".equals(param.get(str).toString().trim()); |
| | | } |
| | | |
| | | public static boolean isNotBlank(Map param, String str) { |
| | | return !isBlank(param, str); |
| | | } |
| | | |
| | | /*** |
| | | * @Author JI |
| | | * @Description //判断是否为不为空(空格算空) |
| | | * @Date 2020/3/27 13:55 |
| | | * @Param [str] |
| | | * @return boolean |
| | | **/ |
| | | public static boolean isNotEmpty(String str) { |
| | | return !isEmpty(str); |
| | | } |
| | | |
| | | /** |
| | | * <p>Checks if a CharSequence is empty (""), null or whitespace only.</p> |
| | | * |
| | | * <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p> |
| | | * |
| | | * <pre> |
| | | * StringUtils.isBlank(null) = true |
| | | * StringUtils.isBlank("") = true |
| | | * StringUtils.isBlank(" ") = true |
| | | * StringUtils.isBlank("bob") = false |
| | | * StringUtils.isBlank(" bob ") = false |
| | | * </pre> |
| | | * |
| | | * @param cs the CharSequence to check, may be null |
| | | * @return {@code true} if the CharSequence is null, empty or whitespace only |
| | | * @since 2.0 |
| | | * @since 3.0 Changed signature from isBlank(String) to isBlank(CharSequence) |
| | | */ |
| | | public static boolean isBlank(final CharSequence cs) { |
| | | int strLen; |
| | | if (cs == null || (strLen = cs.length()) == 0) { |
| | | return true; |
| | | } |
| | | for (int i = 0; i < strLen; i++) { |
| | | if (!Character.isWhitespace(cs.charAt(i))) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 如果字符串是<code>null</code>,则返回指定默认字符串,否则返回字符串本身。 |
| | | * <p> |
| | | * <pre> |
| | | * nullToDefault(null, "default") = "default" |
| | | * nullToDefault("", "default") = "" |
| | | * nullToDefault(" ", "default") = " " |
| | | * nullToDefault("bat", "default") = "bat" |
| | | * </pre> |
| | | * |
| | | * @param str 要转换的字符串 |
| | | * @param defaultStr 默认字符串 |
| | | * @return 字符串本身或指定的默认字符串 |
| | | */ |
| | | public static String nullToDefault(String str, String defaultStr) { |
| | | return (str == null) ? defaultStr : str; |
| | | } |
| | | |
| | | /** |
| | | * 当给定字符串为空字符串时,转换为<code>null</code> |
| | | * |
| | | * @param str 被转换的字符串 |
| | | * @return 转换后的字符串 |
| | | */ |
| | | public static String emptyToNull(String str) { |
| | | return isEmpty(str) ? null : str; |
| | | } |
| | | |
| | | /** |
| | | * 是否包含空字符串 |
| | | * |
| | | * @param strs 字符串列表 |
| | | * @return 是否包含空字符串 |
| | | */ |
| | | public static boolean hasEmpty(String... strs) { |
| | | for (String str : strs) { |
| | | if (isEmpty(str)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 是否全部为空字符串 |
| | | * |
| | | * @param strs 字符串列表 |
| | | * @return 是否全部为空字符串 |
| | | */ |
| | | public static boolean isAllEmpty(String... strs) { |
| | | |
| | | for (String str : strs) { |
| | | if (isNotEmpty(str)) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 是否以指定字符串开头 |
| | | * |
| | | * @param str 被监测字符串 |
| | | * @param prefix 开头字符串 |
| | | * @param isIgnoreCase 是否忽略大小写 |
| | | * @return 是否以指定字符串开头 |
| | | */ |
| | | public static boolean startWith(String str, String prefix, boolean isIgnoreCase) { |
| | | if (isIgnoreCase) { |
| | | return str.toLowerCase().startsWith(prefix.toLowerCase()); |
| | | } else { |
| | | return str.startsWith(prefix); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 是否以指定字符串结尾 |
| | | * |
| | | * @param str 被监测字符串 |
| | | * @param suffix 结尾字符串 |
| | | * @param isIgnoreCase 是否忽略大小写 |
| | | * @return 是否以指定字符串结尾 |
| | | */ |
| | | public static boolean endWith(String str, String suffix, boolean isIgnoreCase) { |
| | | if (isIgnoreCase) { |
| | | return str.toLowerCase().endsWith(suffix.toLowerCase()); |
| | | } else { |
| | | return str.endsWith(suffix); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 是否包含特定字符,忽略大小写,如果给定两个参数都为<code>null</code>,返回true |
| | | * |
| | | * @param str 被检测字符串 |
| | | * @param testStr 被测试是否包含的字符串 |
| | | * @return 是否包含 |
| | | */ |
| | | public static boolean containsIgnoreCase(String str, String testStr) { |
| | | if (null == str) { |
| | | //如果被监测字符串和 |
| | | return null == testStr; |
| | | } |
| | | return str.toLowerCase().contains(testStr.toLowerCase()); |
| | | } |
| | | |
| | | /** |
| | | * 生成set方法名<br/> |
| | | * 例如:name 返回 setName |
| | | * |
| | | * @param fieldName 属性名 |
| | | * @return setXxx |
| | | */ |
| | | public static String genSetter(String fieldName) { |
| | | return upperFirstAndAddPre(fieldName, "set"); |
| | | } |
| | | |
| | | /** |
| | | * 生成get方法名 |
| | | * |
| | | * @param fieldName 属性名 |
| | | * @return getXxx |
| | | */ |
| | | public static String genGetter(String fieldName) { |
| | | return upperFirstAndAddPre(fieldName, "get"); |
| | | } |
| | | |
| | | /** |
| | | * 去掉首部指定长度的字符串并将剩余字符串首字母小写<br/> |
| | | * 例如:str=setName, preLength=3 -> return name |
| | | * |
| | | * @param str 被处理的字符串 |
| | | * @param preLength 去掉的长度 |
| | | * @return 处理后的字符串,不符合规范返回null |
| | | */ |
| | | public static String cutPreAndLowerFirst(String str, int preLength) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | if (str.length() > preLength) { |
| | | char first = Character.toLowerCase(str.charAt(preLength)); |
| | | if (str.length() > preLength + 1) { |
| | | return first + str.substring(preLength + 1); |
| | | } |
| | | return String.valueOf(first); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 原字符串首字母大写并在其首部添加指定字符串 例如:str=name, preString=get -> return getName |
| | | * |
| | | * @param str 被处理的字符串 |
| | | * @param preString 添加的首部 |
| | | * @return 处理后的字符串 |
| | | */ |
| | | public static String upperFirstAndAddPre(String str, String preString) { |
| | | if (str == null || preString == null) { |
| | | return null; |
| | | } |
| | | return preString + capitalize(str); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 去掉指定前缀 |
| | | * |
| | | * @param str 字符串 |
| | | * @param prefix 前缀 |
| | | * @return 切掉后的字符串,若前缀不是 preffix, 返回原字符串 |
| | | */ |
| | | public static String removePrefix(String str, String prefix) { |
| | | if (isEmpty(str) || isEmpty(prefix)) { |
| | | return str; |
| | | } |
| | | |
| | | if (str.startsWith(prefix)) { |
| | | return str.substring(prefix.length()); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 忽略大小写去掉指定前缀 |
| | | * |
| | | * @param str 字符串 |
| | | * @param prefix 前缀 |
| | | * @return 切掉后的字符串,若前缀不是 prefix, 返回原字符串 |
| | | */ |
| | | public static String removePrefixIgnoreCase(String str, String prefix) { |
| | | if (isEmpty(str) || isEmpty(prefix)) { |
| | | return str; |
| | | } |
| | | |
| | | if (str.toLowerCase().startsWith(prefix.toLowerCase())) { |
| | | return str.substring(prefix.length()); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 去掉指定后缀 |
| | | * |
| | | * @param str 字符串 |
| | | * @param suffix 后缀 |
| | | * @return 切掉后的字符串,若后缀不是 suffix, 返回原字符串 |
| | | */ |
| | | public static String removeSuffix(String str, String suffix) { |
| | | if (isEmpty(str) || isEmpty(suffix)) { |
| | | return str; |
| | | } |
| | | |
| | | if (str.endsWith(suffix)) { |
| | | return str.substring(0, str.length() - suffix.length()); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 获得字符串对应byte数组 |
| | | * |
| | | * @param str 字符串 |
| | | * @param charset 编码,如果为<code>null</code>使用系统默认编码 |
| | | * @return bytes |
| | | */ |
| | | public static byte[] getBytes(String str, Charset charset) { |
| | | if (null == str) { |
| | | return null; |
| | | } |
| | | return null == charset ? str.getBytes() : str.getBytes(charset); |
| | | } |
| | | |
| | | /** |
| | | * 忽略大小写去掉指定后缀 |
| | | * |
| | | * @param str 字符串 |
| | | * @param suffix 后缀 |
| | | * @return 切掉后的字符串,若后缀不是 suffix, 返回原字符串 |
| | | */ |
| | | public static String removeSuffixIgnoreCase(String str, String suffix) { |
| | | if (isEmpty(str) || isEmpty(suffix)) { |
| | | return str; |
| | | } |
| | | |
| | | if (str.toLowerCase().endsWith(suffix.toLowerCase())) { |
| | | return str.substring(0, str.length() - suffix.length()); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 如果给定字符串不是以prefix开头的,在开头补充 prefix |
| | | * |
| | | * @param str 字符串 |
| | | * @param prefix 前缀 |
| | | * @return 补充后的字符串 |
| | | */ |
| | | public static String addPrefixIfNot(String str, String prefix) { |
| | | if (isEmpty(str) || isEmpty(prefix)) { |
| | | return str; |
| | | } |
| | | if (!str.startsWith(prefix)) { |
| | | str = prefix + str; |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 如果给定字符串不是以suffix结尾的,在尾部补充 suffix |
| | | * |
| | | * @param str 字符串 |
| | | * @param suffix 后缀 |
| | | * @return 补充后的字符串 |
| | | */ |
| | | public static String addSuffixIfNot(String str, String suffix) { |
| | | if (isEmpty(str) || isEmpty(suffix)) { |
| | | return str; |
| | | } |
| | | if (!str.endsWith(suffix)) { |
| | | str += suffix; |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 清理空白字符 |
| | | * |
| | | * @param str 被清理的字符串 |
| | | * @return 清理后的字符串 |
| | | */ |
| | | public static String cleanBlank(String str) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | |
| | | return str.replaceAll("\\s*", EMPTY); |
| | | } |
| | | |
| | | /** |
| | | * 切分字符串<br> |
| | | * from jodd |
| | | * |
| | | * @param str 被切分的字符串 |
| | | * @param delimiter 分隔符 |
| | | * @return 字符串 |
| | | */ |
| | | public static String[] split(String str, String delimiter) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | if (str.trim().length() == 0) { |
| | | return new String[]{str}; |
| | | } |
| | | // del length |
| | | int dellen = delimiter.length(); |
| | | // one more for the last |
| | | int maxparts = (str.length() / dellen) + 2; |
| | | int[] positions = new int[maxparts]; |
| | | |
| | | int i, j = 0; |
| | | int count = 0; |
| | | positions[0] = -dellen; |
| | | while ((i = str.indexOf(delimiter, j)) != -1) { |
| | | count++; |
| | | positions[count] = i; |
| | | j = i + dellen; |
| | | } |
| | | count++; |
| | | positions[count] = str.length(); |
| | | |
| | | String[] result = new String[count]; |
| | | |
| | | for (i = 0; i < count; i++) { |
| | | result[i] = str.substring(positions[i] + dellen, positions[i + 1]); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 改进JDK subString<br> |
| | | * index从0开始计算,最后一个字符为-1<br> |
| | | * 如果from和to位置一样,返回 "" <br> |
| | | * 如果from或to为负数,则按照length从后向前数位置,如果绝对值大于字符串长度,则from归到0,to归到length<br> |
| | | * 如果经过修正的index中from大于to,则互换from和to |
| | | * example: <br> |
| | | * abcdefgh 2 3 -> c <br> |
| | | * abcdefgh 2 -3 -> cde <br> |
| | | * |
| | | * @param string String |
| | | * @param fromIndex 开始的index(包括) |
| | | * @param toIndex 结束的index(不包括) |
| | | * @return 字串 |
| | | */ |
| | | public static String sub(String string, int fromIndex, int toIndex) { |
| | | int len = string.length(); |
| | | if (fromIndex < 0) { |
| | | fromIndex = len + fromIndex; |
| | | if (fromIndex < 0) { |
| | | fromIndex = 0; |
| | | } |
| | | } else if (fromIndex >= len) { |
| | | fromIndex = len - 1; |
| | | } |
| | | if (toIndex < 0) { |
| | | toIndex = len + toIndex; |
| | | if (toIndex < 0) { |
| | | toIndex = len; |
| | | } |
| | | } else if (toIndex > len) { |
| | | toIndex = len; |
| | | } |
| | | if (toIndex < fromIndex) { |
| | | int tmp = fromIndex; |
| | | fromIndex = toIndex; |
| | | toIndex = tmp; |
| | | } |
| | | if (fromIndex == toIndex) { |
| | | return EMPTY; |
| | | } |
| | | char[] strArray = string.toCharArray(); |
| | | char[] newStrArray = Arrays.copyOfRange(strArray, fromIndex, toIndex); |
| | | return new String(newStrArray); |
| | | } |
| | | |
| | | /** |
| | | * 切割前部分 |
| | | * |
| | | * @param string 字符串 |
| | | * @param toIndex 切割到的位置(不包括) |
| | | * @return 切割后的字符串 |
| | | */ |
| | | public static String subPre(String string, int toIndex) { |
| | | return sub(string, 0, toIndex); |
| | | } |
| | | |
| | | /** |
| | | * 切割后部分 |
| | | * |
| | | * @param string 字符串 |
| | | * @param fromIndex 切割开始的位置(包括) |
| | | * @return 切割后的字符串 |
| | | */ |
| | | public static String subSuf(String string, int fromIndex) { |
| | | if (isEmpty(string)) { |
| | | return null; |
| | | } |
| | | return sub(string, fromIndex, string.length()); |
| | | } |
| | | |
| | | /** |
| | | * 给定字符串是否被字符包围 |
| | | * |
| | | * @param str 字符串 |
| | | * @param prefix 前缀 |
| | | * @param suffix 后缀 |
| | | * @return 是否包围,空串不包围 |
| | | */ |
| | | public static boolean isSurround(String str, String prefix, String suffix) { |
| | | if (StringUtils.isBlank(str)) { |
| | | return false; |
| | | } |
| | | if (str.length() < (prefix.length() + suffix.length())) { |
| | | return false; |
| | | } |
| | | |
| | | return str.startsWith(prefix) && str.endsWith(suffix); |
| | | } |
| | | |
| | | // /** |
| | | // * 给定字符串是否被字符包围 |
| | | // * |
| | | // * @param str 字符串 |
| | | // * @param prefix 前缀 |
| | | // * @param suffix 后缀 |
| | | // * @return 是否包围,空串不包围 |
| | | // */ |
| | | // public static boolean isSurround(String str, char prefix, char suffix) { |
| | | // if (StringUtils.isBlank(str)) { |
| | | // return false; |
| | | // } |
| | | // if (str.length() < 2) { |
| | | // return false; |
| | | // } |
| | | // |
| | | // return str.charAt(0) == prefix && str.charAt(str.length() - 1) == suffix; |
| | | // } |
| | | |
| | | /** |
| | | * 重复某个字符 |
| | | * |
| | | * @param c 被重复的字符 |
| | | * @param count 重复的数目 |
| | | * @return 重复字符字符串 |
| | | */ |
| | | public static String repeat(char c, int count) { |
| | | char[] result = new char[count]; |
| | | for (int i = 0; i < count; i++) { |
| | | result[i] = c; |
| | | } |
| | | return new String(result); |
| | | } |
| | | |
| | | /** |
| | | * 重复某个字符串 |
| | | * |
| | | * @param str 被重复的字符 |
| | | * @param count 重复的数目 |
| | | * @return 重复字符字符串 |
| | | */ |
| | | public static String repeat(String str, int count) { |
| | | |
| | | // 检查 |
| | | final int len = str.length(); |
| | | final long longSize = (long) len * (long) count; |
| | | final int size = (int) longSize; |
| | | if (size != longSize) { |
| | | throw new ArrayIndexOutOfBoundsException("Required String length is too large: " + longSize); |
| | | } |
| | | |
| | | final char[] array = new char[size]; |
| | | str.getChars(0, len, array, 0); |
| | | int n; |
| | | // n <<= 1相当于n *2 |
| | | for (n = len; n < size - n; n <<= 1) { |
| | | System.arraycopy(array, 0, array, n, n); |
| | | } |
| | | System.arraycopy(array, 0, array, n, size - n); |
| | | return new String(array); |
| | | } |
| | | |
| | | /** |
| | | * 比较两个字符串(大小写敏感)。 |
| | | * <p> |
| | | * <pre> |
| | | * equals(null, null) = true |
| | | * equals(null, "abc") = false |
| | | * equals("abc", null) = false |
| | | * equals("abc", "abc") = true |
| | | * equals("abc", "ABC") = false |
| | | * </pre> |
| | | * |
| | | * @param str1 要比较的字符串1 |
| | | * @param str2 要比较的字符串2 |
| | | * @return 如果两个字符串相同,或者都是<code>null</code>,则返回<code>true</code> |
| | | */ |
| | | public static boolean equals(String str1, String str2) { |
| | | if (str1 == null) { |
| | | return str2 == null; |
| | | } |
| | | |
| | | return str1.equals(str2); |
| | | } |
| | | |
| | | /** |
| | | * 比较两个字符串(大小写不敏感)。 |
| | | * <p> |
| | | * <pre> |
| | | * equalsIgnoreCase(null, null) = true |
| | | * equalsIgnoreCase(null, "abc") = false |
| | | * equalsIgnoreCase("abc", null) = false |
| | | * equalsIgnoreCase("abc", "abc") = true |
| | | * equalsIgnoreCase("abc", "ABC") = true |
| | | * </pre> |
| | | * |
| | | * @param str1 要比较的字符串1 |
| | | * @param str2 要比较的字符串2 |
| | | * @return 如果两个字符串相同,或者都是<code>null</code>,则返回<code>true</code> |
| | | */ |
| | | public static boolean equalsIgnoreCase(String str1, String str2) { |
| | | if (str1 == null) { |
| | | return str2 == null; |
| | | } |
| | | |
| | | return str1.equalsIgnoreCase(str2); |
| | | } |
| | | |
| | | /** |
| | | * 格式化文本, {} 表示占位符<br> |
| | | * 例如:format("aaa {} ccc", "bbb") ----> aaa bbb ccc |
| | | * |
| | | * @param template 文本模板,被替换的部分用 {} 表示 |
| | | * @param values 参数值 |
| | | * @return 格式化后的文本 |
| | | */ |
| | | public static String format(String template, Object... values) { |
| | | if (isBlank(template)) { |
| | | return template; |
| | | } |
| | | |
| | | final StringBuilder sb = new StringBuilder(); |
| | | final int length = template.length(); |
| | | |
| | | int valueIndex = 0; |
| | | char currentChar; |
| | | for (int i = 0; i < length; i++) { |
| | | if (valueIndex >= values.length) { |
| | | sb.append(sub(template, i, length)); |
| | | break; |
| | | } |
| | | |
| | | currentChar = template.charAt(i); |
| | | if (currentChar == '{') { |
| | | final char nextChar = template.charAt(++i); |
| | | if (nextChar == '}') { |
| | | sb.append(values[valueIndex++]); |
| | | } else { |
| | | sb.append('{').append(nextChar); |
| | | } |
| | | } else { |
| | | sb.append(currentChar); |
| | | } |
| | | |
| | | } |
| | | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 格式化文本,使用 {varName} 占位<br> |
| | | * map = {a: "aValue", b: "bValue"} |
| | | * format("{a} and {b}", map) ----> aValue and bValue |
| | | * |
| | | * @param template 文本模板,被替换的部分用 {key} 表示 |
| | | * @param map 参数值对 |
| | | * @return 格式化后的文本 |
| | | */ |
| | | public static String format(String template, Map<?, ?> map) { |
| | | if (null == map || map.isEmpty()) { |
| | | return template; |
| | | } |
| | | |
| | | for (Map.Entry<?, ?> entry : map.entrySet()) { |
| | | template = template.replace("{" + entry.getKey() + "}", entry.getValue().toString()); |
| | | } |
| | | return template; |
| | | } |
| | | |
| | | /** |
| | | * 编码字符串 |
| | | * |
| | | * @param str 字符串 |
| | | * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 |
| | | * @return 编码后的字节码 |
| | | */ |
| | | public static byte[] bytes(String str, String charset) { |
| | | return bytes(str, isBlank(charset) ? Charset.defaultCharset() : Charset.forName(charset)); |
| | | } |
| | | |
| | | /** |
| | | * 编码字符串 |
| | | * |
| | | * @param str 字符串 |
| | | * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 |
| | | * @return 编码后的字节码 |
| | | */ |
| | | public static byte[] bytes(String str, Charset charset) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (null == charset) { |
| | | return str.getBytes(); |
| | | } |
| | | return str.getBytes(charset); |
| | | } |
| | | |
| | | /** |
| | | * 将byte数组转为字符串 |
| | | * |
| | | * @param bytes byte数组 |
| | | * @param charset 字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(byte[] bytes, String charset) { |
| | | return str(bytes, isBlank(charset) ? Charset.defaultCharset() : Charset.forName(charset)); |
| | | } |
| | | |
| | | /** |
| | | * 解码字节码 |
| | | * |
| | | * @param data 字符串 |
| | | * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 |
| | | * @return 解码后的字符串 |
| | | */ |
| | | public static String str(byte[] data, Charset charset) { |
| | | if (data == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (null == charset) { |
| | | return new String(data); |
| | | } |
| | | return new String(data, charset); |
| | | } |
| | | |
| | | /** |
| | | * 将编码的byteBuffer数据转换为字符串 |
| | | * |
| | | * @param data 数据 |
| | | * @param charset 字符集,如果为空使用当前系统字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(ByteBuffer data, String charset) { |
| | | if (data == null) { |
| | | return null; |
| | | } |
| | | |
| | | return str(data, Charset.forName(charset)); |
| | | } |
| | | |
| | | /** |
| | | * 将编码的byteBuffer数据转换为字符串 |
| | | * |
| | | * @param data 数据 |
| | | * @param charset 字符集,如果为空使用当前系统字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(ByteBuffer data, Charset charset) { |
| | | if (null == charset) { |
| | | charset = Charset.defaultCharset(); |
| | | } |
| | | return charset.decode(data).toString(); |
| | | } |
| | | |
| | | /** |
| | | * 字符串转换为byteBuffer |
| | | * |
| | | * @param str 字符串 |
| | | * @param charset 编码 |
| | | * @return byteBuffer |
| | | */ |
| | | public static ByteBuffer byteBuffer(String str, String charset) { |
| | | return ByteBuffer.wrap(StringUtils.bytes(str, charset)); |
| | | } |
| | | |
| | | /** |
| | | * 以 conjunction 为分隔符将多个对象转换为字符串 |
| | | * |
| | | * @param conjunction 分隔符 |
| | | * @param objs 数组 |
| | | * @return 连接后的字符串 |
| | | */ |
| | | public static String join(String conjunction, Object... objs) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | boolean isFirst = true; |
| | | for (Object item : objs) { |
| | | if (isFirst) { |
| | | isFirst = false; |
| | | } else { |
| | | sb.append(conjunction); |
| | | } |
| | | sb.append(item); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 将驼峰式命名的字符串转换为下划线方式。如果转换前的驼峰式命名的字符串为空,则返回空字符串。</br> |
| | | * 例如:HelloWorld->hello_world |
| | | * |
| | | * @param camelCaseStr 转换前的驼峰式命名的字符串 |
| | | * @return 转换后下划线大写方式命名的字符串 |
| | | */ |
| | | public static String camelCaseToPath(String camelCaseStr) { |
| | | if (camelCaseStr == null) { |
| | | return null; |
| | | } |
| | | |
| | | final int length = camelCaseStr.length(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | char c; |
| | | boolean isPreUpperCase = false; |
| | | for (int i = 0; i < length; i++) { |
| | | c = camelCaseStr.charAt(i); |
| | | boolean isNextUpperCase = true; |
| | | if (i < (length - 1)) { |
| | | isNextUpperCase = Character.isUpperCase(camelCaseStr.charAt(i + 1)); |
| | | } |
| | | if (Character.isUpperCase(c)) { |
| | | if (!isPreUpperCase || !isNextUpperCase) { |
| | | if (i > 0) { |
| | | sb.append("/"); |
| | | } |
| | | } |
| | | isPreUpperCase = true; |
| | | } else { |
| | | isPreUpperCase = false; |
| | | } |
| | | sb.append(Character.toLowerCase(c)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 将驼峰式命名的字符串转换为下划线方式。如果转换前的驼峰式命名的字符串为空,则返回空字符串。</br> |
| | | * 例如:HelloWorld->hello_world |
| | | * |
| | | * @param camelCaseStr 转换前的驼峰式命名的字符串 |
| | | * @return 转换后下划线大写方式命名的字符串 |
| | | */ |
| | | public static String camelCaseToUnderline(String camelCaseStr) { |
| | | if (camelCaseStr == null) { |
| | | return null; |
| | | } |
| | | |
| | | final int length = camelCaseStr.length(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | char c; |
| | | boolean isPreUpperCase = false; |
| | | for (int i = 0; i < length; i++) { |
| | | c = camelCaseStr.charAt(i); |
| | | boolean isNextUpperCase = true; |
| | | if (i < (length - 1)) { |
| | | isNextUpperCase = Character.isUpperCase(camelCaseStr.charAt(i + 1)); |
| | | } |
| | | if (Character.isUpperCase(c)) { |
| | | if (!isPreUpperCase || !isNextUpperCase) { |
| | | if (i > 0) { |
| | | sb.append(UNDERLINE); |
| | | } |
| | | } |
| | | isPreUpperCase = true; |
| | | } else { |
| | | isPreUpperCase = false; |
| | | } |
| | | sb.append(Character.toLowerCase(c)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 将下划线方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br> |
| | | * 例如:hello_world->HelloWorld |
| | | * |
| | | * @param name 转换前的下划线大写方式命名的字符串 |
| | | * @return 转换后的驼峰式命名的字符串 |
| | | */ |
| | | public static String underlineToCamelCase(String name) { |
| | | if (name == null) { |
| | | return null; |
| | | } |
| | | if (name.contains(UNDERLINE)) { |
| | | name = name.toLowerCase(); |
| | | |
| | | StringBuilder sb = new StringBuilder(name.length()); |
| | | boolean upperCase = false; |
| | | for (int i = 0; i < name.length(); i++) { |
| | | char c = name.charAt(i); |
| | | |
| | | if (c == '_') { |
| | | upperCase = true; |
| | | } else if (upperCase) { |
| | | sb.append(Character.toUpperCase(c)); |
| | | upperCase = false; |
| | | } else { |
| | | sb.append(c); |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } else { |
| | | return name; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 包装指定字符串 |
| | | * |
| | | * @param str 被包装的字符串 |
| | | * @param prefix 前缀 |
| | | * @param suffix 后缀 |
| | | * @return 包装后的字符串 |
| | | */ |
| | | public static String wrap(String str, String prefix, String suffix) { |
| | | return format("{}{}{}", prefix, str, suffix); |
| | | } |
| | | |
| | | /** |
| | | * 指定字符串是否被包装 |
| | | * |
| | | * @param str 字符串 |
| | | * @param prefix 前缀 |
| | | * @param suffix 后缀 |
| | | * @return 是否被包装 |
| | | */ |
| | | public static boolean isWrap(String str, String prefix, String suffix) { |
| | | return str.startsWith(prefix) && str.endsWith(suffix); |
| | | } |
| | | |
| | | /** |
| | | * 指定字符串是否被同一字符包装(前后都有这些字符串) |
| | | * |
| | | * @param str 字符串 |
| | | * @param wrapper 包装字符串 |
| | | * @return 是否被包装 |
| | | */ |
| | | public static boolean isWrap(String str, String wrapper) { |
| | | return isWrap(str, wrapper, wrapper); |
| | | } |
| | | |
| | | /** |
| | | * 指定字符串是否被同一字符包装(前后都有这些字符串) |
| | | * |
| | | * @param str 字符串 |
| | | * @param wrapper 包装字符 |
| | | * @return 是否被包装 |
| | | */ |
| | | public static boolean isWrap(String str, char wrapper) { |
| | | return isWrap(str, wrapper, wrapper); |
| | | } |
| | | |
| | | /** |
| | | * 指定字符串是否被包装 |
| | | * |
| | | * @param str 字符串 |
| | | * @param prefixChar 前缀 |
| | | * @param suffixChar 后缀 |
| | | * @return 是否被包装 |
| | | */ |
| | | public static boolean isWrap(String str, char prefixChar, char suffixChar) { |
| | | return str.charAt(0) == prefixChar && str.charAt(str.length() - 1) == suffixChar; |
| | | } |
| | | |
| | | /** |
| | | * 创建StringBuilder对象 |
| | | * |
| | | * @return StringBuilder对象 |
| | | */ |
| | | public static StringBuilder builder() { |
| | | return new StringBuilder(); |
| | | } |
| | | |
| | | /** |
| | | * 创建StringBuilder对象 |
| | | * |
| | | * @return StringBuilder对象 |
| | | */ |
| | | public static StringBuilder builder(int capacity) { |
| | | return new StringBuilder(capacity); |
| | | } |
| | | |
| | | /** |
| | | * 创建StringBuilder对象 |
| | | * |
| | | * @return StringBuilder对象 |
| | | */ |
| | | public static StringBuilder builder(String... strs) { |
| | | final StringBuilder sb = new StringBuilder(); |
| | | for (String str : strs) { |
| | | sb.append(str); |
| | | } |
| | | return sb; |
| | | } |
| | | |
| | | |
| | | public static String concatLikeStart(String value) { |
| | | return concatLike(value, 1); |
| | | } |
| | | |
| | | public static String concatLikeEnd(String value) { |
| | | return concatLike(value, 2); |
| | | } |
| | | |
| | | public static String concatLikeAll(String value) { |
| | | return concatLike(value, -1); |
| | | } |
| | | |
| | | /** |
| | | * @param value |
| | | * @param type |
| | | * @return |
| | | */ |
| | | public static String concatLike(String value, Integer type) { |
| | | if (isEmpty(value)) { |
| | | return null; |
| | | } |
| | | StringBuilder builder = new StringBuilder(value.length() + 3); |
| | | switch (type) { |
| | | case 1: |
| | | builder.append("%").append(value); |
| | | break; |
| | | case 2: |
| | | builder.append(value).append("%"); |
| | | break; |
| | | case 3: |
| | | builder.append(value); |
| | | break; |
| | | default: |
| | | builder.append("%").append(value).append("%"); |
| | | } |
| | | return builder.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 获得StringReader |
| | | * |
| | | * @param str 字符串 |
| | | * @return StringReader |
| | | */ |
| | | public static StringReader getReader(String str) { |
| | | return new StringReader(str); |
| | | } |
| | | |
| | | /** |
| | | * 获得StringWriter |
| | | * |
| | | * @return StringWriter |
| | | */ |
| | | public static StringWriter getWriter() { |
| | | return new StringWriter(); |
| | | } |
| | | |
| | | /** |
| | | * 编码字符串 |
| | | * |
| | | * @param str 字符串 |
| | | * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 |
| | | * @return 编码后的字节码 |
| | | */ |
| | | public static byte[] encode(String str, String charset) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (isBlank(charset)) { |
| | | return str.getBytes(); |
| | | } |
| | | try { |
| | | return str.getBytes(charset); |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new RuntimeException(format("Charset [{}] unsupported!", charset)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 解码字节码 |
| | | * |
| | | * @param data 字符串 |
| | | * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 |
| | | * @return 解码后的字符串 |
| | | */ |
| | | public static String decode(byte[] data, String charset) { |
| | | if (data == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (isBlank(charset)) { |
| | | return new String(data); |
| | | } |
| | | try { |
| | | return new String(data, charset); |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new RuntimeException(format("Charset [{}] unsupported!", charset)); |
| | | } |
| | | } |
| | | |
| | | // /** |
| | | // * 首字母变大写 |
| | | // */ |
| | | // public static String firstCharToUpperCase(String str) { |
| | | // char firstChar = str.charAt(0); |
| | | // if (firstChar >= 'a' && firstChar <= 'z') { |
| | | // char[] arr = str.toCharArray(); |
| | | // arr[0] -= ('a' - 'A'); |
| | | // return new String(arr); |
| | | // } |
| | | // return str; |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * Description:把数字转化为指定长度的字符串编号,不足位数字前补0,超过或与指定长度相等返回原数值 |
| | | * 例如:23转化为4位字符编号 => "0023" |
| | | * |
| | | * @param val 原数值 |
| | | * @param num 字符串长度 |
| | | * @return java.lang.String |
| | | * @author fanhq |
| | | * @date 2020/4/17 9:44 |
| | | */ |
| | | public static String intToStringCode(Integer val, Integer num) { |
| | | int i = num - val.toString().length(); |
| | | StringBuffer sbf = new StringBuffer(); |
| | | for (int k = 0; k < i; k++) { |
| | | sbf.append("0"); |
| | | } |
| | | return sbf.append(val.toString()).toString(); |
| | | } |
| | | |
| | | public static String match(String message, String regex) { |
| | | Pattern p = Pattern.compile(regex); |
| | | Matcher m = p.matcher(message); |
| | | while (m.find()) { |
| | | return m.group(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static String lpad(Integer length, String data, char text) { |
| | | if (data.length() >= length) { |
| | | return data; |
| | | } |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | for (int i = data.length(); i < length; i++) { |
| | | stringBuffer.append(text); |
| | | } |
| | | return stringBuffer.append(data).toString(); |
| | | } |
| | | } |
| | |
| | | - /webjars/** |
| | | - /verificationCode/** |
| | | - /static/** |
| | | |
| | | - /file/preview/** |
| | | AES: |
| | | KEY: |
| | | AD42F7787B035B7580000EF93BE20BAD |
| | | TOKEN: |
| | | KEY: |
| | | foh3wi2ooghiCh5 |
| | | foh3wi2ooghiCh5 |
| | | file: |
| | | path: /data/upload/ |
| | |
| | | application: |
| | | name: screen-api |
| | | redis: |
| | | host: r-bp1xdlb9wfc6zt0msppd.redis.rds.aliyuncs.com |
| | | host: r-bp1xdlb9wfc6zt0msppd13.redis.rds.aliyuncs.com |
| | | port: 6379 |
| | | password: moral_123456 |
| | | password: QX_moral_2023 |
| | | timeout: 30000 |
| | | jedis: |
| | | pool: |
| | |
| | | max-wait: 30000 |
| | | min-idle: 32 |
| | | tokenRedis: |
| | | host: r-bp1xdlb9wfc6zt0msppd.redis.rds.aliyuncs.com |
| | | host: r-bp1xdlb9wfc6zt0msppd13.redis.rds.aliyuncs.com |
| | | port: 6379 |
| | | password: moral_123456 |
| | | password: QX_moral_2023 |
| | | timeout: 30000 |
| | | database: 15 |
| | | pool: |
| | |
| | | filters: stat |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | max-wait: 60000 |
| | | url: jdbc:mysql://rm-bp1pr3rx9m3fnkwsk8o2.mysql.rds.aliyuncs.com:3306/moral?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | url: jdbc:mysql://rm-bp1pr3rx9m3fnkwsk8o13.mysql.rds.aliyuncs.com:3306/moral?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: moral_qx |
| | | password: moral_qx_12345 |
| | | password: QX_moral_2023 |
| | | test-on-borrow: false |
| | | sql-script-encoding: utf-8 |
| | | pool-prepared-statements: true |
| | |
| | | - /webjars/** |
| | | - /verificationCode/** |
| | | - /static/** |
| | | - /file/** |
| | | - /doc.html |
| | | - /file/preview/** |
| | | |
| | | |
| | | AES: |
| | |
| | | KEY: |
| | | foh3wi2ooghiCh5 |
| | | |
| | | file: |
| | | path: E:\upload |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.moral.api.mapper.AllocationExtensionMapper"> |
| | | |
| | | <!-- 通用查询映射结果 deyt template generate --> |
| | | <resultMap id="BaseResultMap" type="com.moral.api.entity.AllocationExtension"> |
| | | <id column="id" property="id" /> |
| | | <result column="allocation_id" property="allocationId" /> |
| | | <result column="extension_num" property="extensionNum" /> |
| | | <result column="remake" property="remake" /> |
| | | <result column="state" property="state" /> |
| | | <result column="invalid_reason" property="invalidReason" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, allocation_id, extension_num, remake, state, is_del, is_invalid, invalid_reason, create_id, create_name, create_time, update_id, update_name, update_time |
| | | </sql> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="AllocationExtension_Column_List"> |
| | | allocationextension.id, allocationextension.allocation_id, allocationextension.extension_num, allocationextension.remake, allocationextension.state, allocationextension.is_del, allocationextension.is_invalid, allocationextension.invalid_reason, allocationextension.create_id, allocationextension.create_name, allocationextension.create_time, allocationextension.update_id, allocationextension.update_name, allocationextension.update_time |
| | | </sql> |
| | | |
| | | |
| | | <select id="extOne" resultType="com.moral.api.pojo.ext.allocationextension.AllocationExtensionExt"> |
| | | SELECT |
| | | <include refid="AllocationExtension_Column_List"/> |
| | | FROM allocation_extension allocationextension |
| | | where allocationextension.id = #{id} and allocationextension.is_del = 0 |
| | | </select> |
| | | |
| | | |
| | | <select id="extPage" resultType="com.moral.api.pojo.ext.allocationextension.AllocationExtensionPageExt"> |
| | | SELECT |
| | | <include refid="AllocationExtension_Column_List"/>, |
| | | t1.allocation_num,t1.escalation_time,t1.unit_id,t1.pollute_type,t1.change_type,t1.change_day,t1.escalation_unit_id,t1.escalation_name |
| | | FROM allocation_extension allocationextension |
| | | left join allocation t1 on allocationextension.allocation_id = t1.allocation_id |
| | | <where> |
| | | 1 = 1 and allocationextension.is_del = 0 |
| | | |
| | | <if test="allocation.unitId != null and allocation.unitId != 0"> |
| | | and t1.unit_id = #{allocation.unitId} |
| | | </if> |
| | | <if test="allocation.polluteType != null and allocation.polluteType != 0"> |
| | | and t1.pollute_type = #{allocation.polluteType} |
| | | </if> |
| | | <if test="allocation.state != null and allocation.state != 0"> |
| | | and t1.state = #{allocation.state} |
| | | </if> |
| | | <if test="allocation.investigationType != null and allocation.investigationType != 0"> |
| | | and t1.investigation_type = #{allocation.investigationType} |
| | | </if> |
| | | <if test="allocation.changeType != null and allocation.changeType != 0"> |
| | | and t1.change_type = #{allocation.changeType} |
| | | </if> |
| | | |
| | | <if test="allocation.startTime != null and allocation.startTime != '' "> |
| | | and date(t1.escalation_time) <![CDATA[>=]]> #{allocation.startTime} |
| | | </if> |
| | | <if test="allocation.endTime != null and allocation.endTime !='' "> |
| | | and date(t1.escalation_time) <![CDATA[<=]]> #{allocation.endTime} |
| | | </if> |
| | | |
| | | </where> |
| | | order by t1.escalation_time desc,t1.allocation_id desc |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.moral.api.mapper.AllocationMapper"> |
| | | |
| | | <!-- 通用查询映射结果 deyt template generate --> |
| | | <resultMap id="BaseResultMap" type="com.moral.api.entity.Allocation"> |
| | | <id column="allocation_id" property="allocationId" /> |
| | | <result column="allocation_num" property="allocationNum" /> |
| | | <result column="escalation_type" property="escalationType" /> |
| | | <result column="escalation_time" property="escalationTime" /> |
| | | <result column="pollute_position" property="pollutePosition" /> |
| | | <result column="unit_id" property="unitId" /> |
| | | <result column="pollute_type" property="polluteType" /> |
| | | <result column="change_type" property="changeType" /> |
| | | <result column="change_day" property="changeDay" /> |
| | | <result column="escalation_unit_id" property="escalationUnitId" /> |
| | | <result column="escalation_name" property="escalationName" /> |
| | | <result column="investigation_type" property="investigationType" /> |
| | | <result column="problem_describe" property="problemDescribe" /> |
| | | <result column="is_change" property="isChange" /> |
| | | <result column="change_describe" property="changeDescribe" /> |
| | | <result column="change_name" property="changeName" /> |
| | | <result column="change_time" property="changeTime" /> |
| | | <result column="check_score" property="checkScore" /> |
| | | <result column="check_describe" property="checkDescribe" /> |
| | | <result column="check_name" property="checkName" /> |
| | | <result column="check_time" property="checkTime" /> |
| | | <result column="state" property="state" /> |
| | | <result column="invalid_reason" property="invalidReason" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | allocation_id, allocation_num, escalation_type, escalation_time, pollute_position, unit_id, pollute_type, change_type, change_day, escalation_unit_id, escalation_name, investigation_type, problem_describe, is_change, change_describe, change_name, change_time, check_score, check_describe, check_name, check_time, state, is_del, is_invalid, invalid_reason, create_id, create_name, create_time, update_id, update_name, update_time |
| | | </sql> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Allocation_Column_List"> |
| | | allocation.allocation_id, allocation.allocation_num, allocation.escalation_type, allocation.escalation_time, allocation.pollute_position, allocation.unit_id, allocation.pollute_type, allocation.change_type, allocation.change_day, allocation.escalation_unit_id, allocation.escalation_name, allocation.investigation_type, allocation.problem_describe, allocation.is_change, allocation.change_describe, allocation.change_name, allocation.change_time, allocation.check_score, allocation.check_describe, allocation.check_name, allocation.check_time, allocation.state, allocation.is_del, allocation.is_invalid, allocation.invalid_reason, allocation.create_id, allocation.create_name, allocation.create_time, allocation.update_id, allocation.update_name, allocation.update_time |
| | | </sql> |
| | | |
| | | |
| | | <select id="extOne" resultType="com.moral.api.pojo.ext.allocation.AllocationExt"> |
| | | SELECT |
| | | <include refid="Allocation_Column_List"/> |
| | | FROM allocation allocation |
| | | where allocation.allocation_id = #{id} and allocation.is_del = 0 |
| | | </select> |
| | | |
| | | <select id="extList" resultType="com.moral.api.pojo.ext.allocation.AllocationListExt"> |
| | | SELECT |
| | | <include refid="Allocation_Column_List"/> |
| | | FROM allocation allocation |
| | | <where> |
| | | 1 = 1 |
| | | <if test="allocation.id != null and allocation.id != 0"> |
| | | and allocation.allocation_id = #{allocation.id} and allocation.is_del = 0 |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="extPage" resultType="com.moral.api.pojo.ext.allocation.AllocationPageExt"> |
| | | SELECT |
| | | <include refid="Allocation_Column_List"/>,t1.id as applyState |
| | | FROM allocation allocation |
| | | left join allocation_extension t1 on t1.allocation_id = allocation.allocation_id and t1.is_del =0 and t1.is_invalid = 0 and t1.state = 30 |
| | | <where> |
| | | 1 = 1 and allocation.is_del = 0 |
| | | <if test="allocation.unitId != null and allocation.unitId != 0"> |
| | | and allocation.unit_id = #{allocation.unitId} |
| | | </if> |
| | | <if test="allocation.polluteType != null and allocation.polluteType != 0"> |
| | | and allocation.pollute_type = #{allocation.polluteType} |
| | | </if> |
| | | <if test="allocation.state != null and allocation.state != 0"> |
| | | and allocation.state = #{allocation.state} |
| | | </if> |
| | | <if test="allocation.investigationType != null and allocation.investigationType != 0"> |
| | | and allocation.investigation_type = #{allocation.investigationType} |
| | | </if> |
| | | <if test="allocation.changeType != null and allocation.changeType != 0"> |
| | | and allocation.change_type = #{allocation.changeType} |
| | | </if> |
| | | <if test="allocation.isInvalid != null and allocation.isInvalid != 0"> |
| | | and allocation.is_invalid = #{allocation.isInvalid} |
| | | </if> |
| | | <if test="allocation.startTime != null and allocation.startTime != '' "> |
| | | and date(allocation.escalation_time) <![CDATA[>=]]> #{allocation.startTime} |
| | | </if> |
| | | <if test="allocation.endTime != null and allocation.endTime !='' "> |
| | | and date(allocation.escalation_time) <![CDATA[<=]]> #{allocation.endTime} |
| | | </if> |
| | | </where> |
| | | order by allocation.escalation_time desc,allocation.allocation_id desc |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.moral.api.mapper.FileTableMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.moral.api.entity.FileTable"> |
| | | <id column="file_id" property="fileId" /> |
| | | <result column="file_module" property="fileModule" /> |
| | | <result column="relation_id" property="relationId" /> |
| | | <result column="file_name" property="fileName" /> |
| | | <result column="file_type" property="fileType" /> |
| | | <result column="file_address" property="fileAddress" /> |
| | | <result column="file_size" property="fileSize" /> |
| | | <result column="is_del" property="isDel" /> |
| | | <result column="create_id" property="createId" /> |
| | | <result column="create_name" property="createName" /> |
| | | <result column="create_time" property="createTime" /> |
| | | </resultMap> |
| | | |
| | | </mapper> |
| | |
| | | * */ |
| | | public static final String SYSTEM_DICT_TYPE_PURCHASER = "purchaser"; |
| | | |
| | | /** |
| | | * 污染字典类型 |
| | | */ |
| | | public static final String WU_RAN_LEI_XING = "contaminate"; |
| | | |
| | | |
| | | |
| | | /* |
| | | * 未校准数据表后缀 |
| | | * */ |
New file |
| | |
| | | package com.moral.constant; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "分页信息", description = "分页信息") |
| | | public class PageInfo { |
| | | |
| | | @ApiModelProperty(value = "每页数量") |
| | | private long pageSize; |
| | | |
| | | @ApiModelProperty(value = "当前页码") |
| | | private long currentPage; |
| | | |
| | | @ApiModelProperty(value = "总页数") |
| | | private long totalPage; |
| | | |
| | | @ApiModelProperty(value = "总记录数") |
| | | private long totalNum; |
| | | } |
New file |
| | |
| | | package com.moral.constant; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "分页结果", description = "分页结果") |
| | | public class PageResult<T> { |
| | | |
| | | @ApiModelProperty(value = "分页信息") |
| | | private PageInfo page; |
| | | |
| | | @ApiModelProperty(value = "记录") |
| | | private List<T> list; |
| | | |
| | | public PageResult() { |
| | | } |
| | | |
| | | public PageResult(Page page) { |
| | | this.page = new PageInfo().setCurrentPage(page.getCurrent()) |
| | | .setPageSize(page.getSize()) |
| | | .setTotalPage(page.getPages()) |
| | | .setTotalNum(page.getTotal()); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | public static final String DATE_COORDINATE="data_coordinate"; |
| | | |
| | | |
| | | public static final String JBD_DATA="allocation_num"; |
| | | } |
New file |
| | |
| | | package com.moral.api.controller; |
| | | |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import org.apache.ibatis.annotations.Update; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.moral.api.entity.ResponsibilityUnit; |
| | | import com.moral.api.service.ResponsibilityUnitService; |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import com.moral.constant.ResultMessage; |
| | | import com.moral.util.WebUtils; |
| | | |
| | | @Api(tags = "责任单位") |
| | | @RestController |
| | | @RequestMapping("unit") |
| | | public class ResponsibilityUnitController { |
| | | |
| | | |
| | | @Autowired |
| | | private ResponsibilityUnitService responsibilityUnitService; |
| | | |
| | | |
| | | /** |
| | | * 新增表单 |
| | | * @param responsibilityUnit |
| | | * @return |
| | | */ |
| | | @PostMapping("insert") |
| | | public ResultMessage insert(@RequestBody ResponsibilityUnit responsibilityUnit){ |
| | | |
| | | Integer insert = responsibilityUnitService.insert(responsibilityUnit); |
| | | if (insert<0){ |
| | | return ResultMessage.fail(ResponseCodeEnum.ROLE_IS_EXIST.getCode(),ResponseCodeEnum.ROLE_IS_EXIST.getMsg()); |
| | | } |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 查询表单 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @GetMapping("selectUint") |
| | | public ResultMessage selectUint(HttpServletRequest request){ |
| | | Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null); |
| | | |
| | | Map<String, Object> map = responsibilityUnitService.selectUnit(parameters); |
| | | |
| | | return ResultMessage.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * 修改表单 |
| | | * @param responsibilityUnit |
| | | * @return |
| | | */ |
| | | @PostMapping("update") |
| | | public ResultMessage updateUnit(@RequestBody ResponsibilityUnit responsibilityUnit){ |
| | | Integer integer = responsibilityUnitService.updateUnit(responsibilityUnit); |
| | | if (integer<0){ |
| | | return ResultMessage.fail(ResponseCodeEnum.ROLE_IS_EXIST.getCode(),ResponseCodeEnum.ROLE_IS_EXIST.getMsg()); |
| | | } |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 改变状态 |
| | | * @param unitId |
| | | * @return |
| | | */ |
| | | @GetMapping("state") |
| | | public ResultMessage state(Integer unitId){ |
| | | if (ObjectUtils.isEmpty(unitId)){ |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | responsibilityUnitService.updateState(unitId); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 是否作废 |
| | | * @param unitId |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @GetMapping("invalid") |
| | | public ResultMessage invalid(Integer unitId,String code){ |
| | | if (ObjectUtils.isEmpty(unitId)){ |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | responsibilityUnitService.updateInvalid(unitId,code); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 是否删除 |
| | | * @param unitId |
| | | * @return |
| | | */ |
| | | @GetMapping("delete") |
| | | public ResultMessage delete(Integer unitId){ |
| | | responsibilityUnitService.removeById(unitId); |
| | | return ResultMessage.ok(); |
| | | } |
| | | } |
| | |
| | | return ResultMessage.ok(sysAreas); |
| | | } |
| | | |
| | | @GetMapping("area/queryCity") |
| | | public ResultMessage queryCity(){ |
| | | List<SysArea> sysAreas = sysAreaService.queryCity(); |
| | | return ResultMessage.ok(sysAreas); |
| | | } |
| | | |
| | | @GetMapping("area/code") |
| | | public ResultMessage queryCode(Integer code){ |
| | | List<SysArea> sysAreas = sysAreaService.selectCode(code); |
| | | return ResultMessage.ok(sysAreas); |
| | | } |
| | | |
| | | /** |
| | | * @Description: 查询日志接口 |
| | | * @Param: [form] |
New file |
| | |
| | | package com.moral.api.entity; |
| | | |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class ResponsibilityUnit extends Model<ResponsibilityUnit> { |
| | | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | //责任单位id |
| | | @TableId(value = "unit_id", type = IdType.AUTO) |
| | | private Integer unitId; |
| | | /** |
| | | * 单位名称 |
| | | */ |
| | | private String unitName; |
| | | /** |
| | | * 所属编码 |
| | | */ |
| | | private Integer areaCode; |
| | | /** |
| | | * 上级编码 |
| | | */ |
| | | private Integer parentCode; |
| | | //0是生效 1是失效 |
| | | private String state; |
| | | //0是未删 1是以删 |
| | | private String isDel; |
| | | //0是未作废 1是已作废 |
| | | private Integer isInvalid; |
| | | //作废理由 |
| | | private String invalidReason; |
| | | |
| | | private String value; |
| | | |
| | | private Integer createId; |
| | | |
| | | private String createName; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | private Integer updateId; |
| | | |
| | | private String updateName; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | @TableField(exist = false) |
| | | private String areaName; |
| | | |
| | | @TableField(exist = false) |
| | | private String parentName; |
| | | |
| | | @TableField(exist = false) |
| | | private List<Object> parentCodeList; |
| | | } |
New file |
| | |
| | | package com.moral.api.mapper; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.moral.api.entity.ResponsibilityUnit; |
| | | |
| | | public interface ResponsibilityUnitMapper extends BaseMapper<ResponsibilityUnit> { |
| | | } |
New file |
| | |
| | | package com.moral.api.service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.moral.api.entity.ResponsibilityUnit; |
| | | |
| | | public interface ResponsibilityUnitService extends IService<ResponsibilityUnit> { |
| | | |
| | | |
| | | Integer insert(ResponsibilityUnit responsibilityUnit); |
| | | |
| | | Map<String, Object> selectUnit(Map<String, Object> parameters); |
| | | |
| | | Integer updateUnit(ResponsibilityUnit responsibilityUnit); |
| | | |
| | | void updateState(Integer unitId); |
| | | |
| | | void updateInvalid(Integer unitId,String code); |
| | | } |
| | |
| | | List<SysArea> querySysArea(); |
| | | |
| | | |
| | | SysArea select(Integer code); |
| | | |
| | | /** |
| | | * 查询除了乡镇以外的地区 |
| | | * @return |
| | | */ |
| | | List<SysArea> queryCity(); |
| | | |
| | | |
| | | List<SysArea> selectCode(Integer code); |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.service.impl; |
| | | |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.moral.api.entity.ResponsibilityUnit; |
| | | import com.moral.api.entity.SysArea; |
| | | import com.moral.api.mapper.ResponsibilityUnitMapper; |
| | | import com.moral.api.pojo.redisBean.AccountInfoDTO; |
| | | import com.moral.api.service.ResponsibilityUnitService; |
| | | import com.moral.api.service.SysAreaService; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.util.TokenUtils; |
| | | |
| | | @Service |
| | | public class ResponsibilityUnitServiceImpl extends ServiceImpl<ResponsibilityUnitMapper, ResponsibilityUnit> implements ResponsibilityUnitService { |
| | | |
| | | |
| | | @Autowired |
| | | private ResponsibilityUnitMapper responsibilityUnitMapper; |
| | | @Autowired |
| | | private SysAreaService sysAreaService; |
| | | |
| | | |
| | | /** |
| | | * 新增表单 |
| | | * @param responsibilityUnit |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer insert(ResponsibilityUnit responsibilityUnit) { |
| | | HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); |
| | | String token = request.getHeader("token"); |
| | | AccountInfoDTO accountInfoDTO = (AccountInfoDTO) TokenUtils.getUserInfoByToken(token); |
| | | QueryWrapper<ResponsibilityUnit> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("unit_name",responsibilityUnit.getUnitName()); |
| | | |
| | | List<ResponsibilityUnit> units = responsibilityUnitMapper.selectList(wrapper); |
| | | if (ObjectUtils.isEmpty(units)){ |
| | | responsibilityUnit.setIsDel(Constants.NOT_DELETE); |
| | | responsibilityUnit.setCreateTime(new Date()); |
| | | responsibilityUnit.setIsInvalid(0); |
| | | responsibilityUnit.setCreateId(accountInfoDTO.getAccount().getId()); |
| | | responsibilityUnit.setCreateName(accountInfoDTO.getAccount().getUserName()); |
| | | responsibilityUnit.setCreateTime(new Date()); |
| | | responsibilityUnit.setUpdateId(accountInfoDTO.getAccount().getId()); |
| | | responsibilityUnit.setUpdateName(accountInfoDTO.getAccount().getUserName()); |
| | | responsibilityUnit.setUpdateTime(new Date()); |
| | | responsibilityUnit.setValue(JSONArray.toJSONString(responsibilityUnit.getParentCodeList())); |
| | | responsibilityUnitMapper.insert(responsibilityUnit); |
| | | return 200; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | /** |
| | | * 查询表单 |
| | | * @param parameters |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> selectUnit(Map<String, Object> parameters) { |
| | | QueryWrapper<ResponsibilityUnit> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_del",Constants.NOT_DELETE); |
| | | int page = Integer.parseInt(parameters.get("page").toString()); |
| | | int size = Integer.parseInt(parameters.get("size").toString()); |
| | | Object parentName1 = parameters.get("parentCode"); |
| | | Object areaName1 = parameters.get("areaCode"); |
| | | //名称模糊查询 |
| | | if (!ObjectUtils.isEmpty(parameters.get("name"))){ |
| | | wrapper.like("unit_name",parameters.get("name").toString()); |
| | | } |
| | | //上级区域查询 |
| | | if (!ObjectUtils.isEmpty(parentName1)){ |
| | | wrapper.eq("parent_code",Integer.parseInt(parentName1.toString())); |
| | | } |
| | | //所属区域查询 |
| | | if (!ObjectUtils.isEmpty(areaName1)){ |
| | | wrapper.eq("parent_code",Integer.parseInt(areaName1.toString())); |
| | | } |
| | | Page<ResponsibilityUnit> pageList = new Page<>(page, size); |
| | | Page<ResponsibilityUnit> responsibilityUnitPage = responsibilityUnitMapper.selectPage(pageList, wrapper); |
| | | for (ResponsibilityUnit record : responsibilityUnitPage.getRecords()) { |
| | | Integer areaCode = record.getAreaCode(); |
| | | SysArea sysArea= sysAreaService.select(areaCode); |
| | | Integer parentCode = record.getParentCode(); |
| | | SysArea parentArea = sysAreaService.select(parentCode); |
| | | if (ObjectUtils.isEmpty(sysArea) || ObjectUtils.isEmpty(parentArea)){ |
| | | continue; |
| | | } |
| | | record.setAreaName(sysArea.getAreaName()); |
| | | record.setParentName(parentArea.getAreaName()); |
| | | record.setParentCodeList(JSONObject.parseObject(record.getValue(),List.class)); |
| | | } |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("total", pageList.getTotal()); |
| | | result.put("totalPage", pageList.getPages()); |
| | | result.put("current", pageList.getCurrent()); |
| | | result.put("pageSize", pageList.getSize()); |
| | | result.put("item", responsibilityUnitPage.getRecords()); |
| | | // responsibilityUnitPage.getOrders() |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改表单 |
| | | * @param responsibilityUnit |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer updateUnit(ResponsibilityUnit responsibilityUnit) { |
| | | QueryWrapper<ResponsibilityUnit> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("unit_name",responsibilityUnit.getUnitName()); |
| | | wrapper.eq("area_code",responsibilityUnit.getAreaCode()); |
| | | ResponsibilityUnit responsibilityUnit2 = responsibilityUnitMapper.selectOne(wrapper); |
| | | if (ObjectUtils.isEmpty(responsibilityUnit2)){ |
| | | AccountInfoDTO account = getAccount(); |
| | | responsibilityUnit.setUpdateId(account.getAccount().getId()); |
| | | responsibilityUnit.setUpdateName(account.getAccount().getUserName()); |
| | | responsibilityUnit.setUpdateTime(new Date()); |
| | | responsibilityUnit.setValue(JSONArray.toJSONString(responsibilityUnit.getParentCodeList())); |
| | | // responsibilityUnit.setParentCodeList(JSONObject.parseObject(responsibilityUnit.getValue(),List.class)); |
| | | responsibilityUnitMapper.updateById(responsibilityUnit); |
| | | return 200; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改状态 |
| | | * |
| | | */ |
| | | @Override |
| | | public void updateState(Integer unitId) { |
| | | ResponsibilityUnit responsibilityUnit = responsibilityUnitMapper.selectById(unitId); |
| | | responsibilityUnit.setState(Constants.NOT_DELETE); |
| | | AccountInfoDTO account = getAccount(); |
| | | responsibilityUnit.setUpdateId(account.getAccount().getId()); |
| | | responsibilityUnit.setUpdateName(account.getAccount().getUserName()); |
| | | responsibilityUnit.setUpdateTime(new Date()); |
| | | responsibilityUnitMapper.updateById(responsibilityUnit); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否作废 |
| | | * @param unitId |
| | | * @param code |
| | | */ |
| | | @Override |
| | | public void updateInvalid(Integer unitId, String code) { |
| | | ResponsibilityUnit responsibilityUnit = responsibilityUnitMapper.selectById(unitId); |
| | | |
| | | responsibilityUnit.setIsInvalid(1); |
| | | if (!ObjectUtils.isEmpty(code)){ |
| | | responsibilityUnit.setInvalidReason(code); |
| | | } |
| | | AccountInfoDTO account = getAccount(); |
| | | responsibilityUnit.setUpdateId(account.getAccount().getId()); |
| | | responsibilityUnit.setUpdateName(account.getAccount().getUserName()); |
| | | responsibilityUnit.setUpdateTime(new Date()); |
| | | responsibilityUnitMapper.updateById(responsibilityUnit); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * @return |
| | | */ |
| | | private AccountInfoDTO getAccount(){ |
| | | HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); |
| | | String token = request.getHeader("token"); |
| | | AccountInfoDTO accountInfoDTO = (AccountInfoDTO) TokenUtils.getUserInfoByToken(token); |
| | | return accountInfoDTO; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.moral.api.entity.SysArea; |
| | | import com.moral.api.mapper.SysAreaMapper; |
| | | import com.moral.api.service.SysAreaService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | * @since 2021-04-07 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class SysAreaServiceImpl extends ServiceImpl<SysAreaMapper, SysArea> implements SysAreaService { |
| | | |
| | | @Autowired |
| | |
| | | return sysAreas; |
| | | } |
| | | |
| | | @Override |
| | | public SysArea select(Integer code) { |
| | | QueryWrapper<SysArea> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("area_code",code); |
| | | SysArea sysArea = sysAreaMapper.selectOne(wrapper); |
| | | return sysArea; |
| | | } |
| | | |
| | | /** |
| | | * 查询除了乡镇以外的地区 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SysArea> queryCity() { |
| | | //取出所有地区 |
| | | List<SysArea> sysAreas = sysAreaMapper.selectList(null); |
| | | //创建Map key为地区码 value为地区对象 供组装使用 |
| | | Map<Integer, SysArea> areaMap = new HashMap<>(); |
| | | for (SysArea sysArea : sysAreas) { |
| | | areaMap.put(sysArea.getAreaCode(), sysArea); |
| | | sysArea.setChildren(new ArrayList<>());//初始化children集合 |
| | | } |
| | | //遍历所有城市,判断是否有父城市,如果有则添加到父城市中。 |
| | | int i=0; |
| | | for (SysArea sysArea : sysAreas) { |
| | | Integer parentCode = sysArea.getParentCode(); |
| | | String s = sysArea.getAreaCode().toString(); |
| | | if (!parentCode.equals(0)) { |
| | | if (s.length()>7){ |
| | | continue; |
| | | } |
| | | SysArea parentArea = areaMap.get(parentCode); |
| | | if (ObjectUtils.isEmpty(parentArea)){ |
| | | continue; |
| | | } |
| | | List<SysArea> children = parentArea.getChildren(); |
| | | children.add(sysArea); |
| | | // parentArea.getChildren().add(sysArea); |
| | | } |
| | | } |
| | | //移除集合中非父顶级城市 |
| | | sysAreas.removeIf(new Predicate<SysArea>() { |
| | | @Override |
| | | public boolean test(SysArea sysArea) { |
| | | if (sysArea.getParentCode().equals(0)) |
| | | return false; |
| | | return true; |
| | | } |
| | | }); |
| | | return sysAreas; |
| | | } |
| | | |
| | | @Override |
| | | public List<SysArea> selectCode(Integer code) { |
| | | QueryWrapper<SysArea> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("parent_code",code); |
| | | List<SysArea> sysAreas = sysAreaMapper.selectList(wrapper); |
| | | return sysAreas; |
| | | |
| | | } |
| | | |
| | | |
| | | private List<SysArea> querySysAreaFromDB() { |
| | | //取出所有地区 |
| | |
| | | Integer parentCode = sysArea.getParentCode(); |
| | | if (!parentCode.equals(0)) { |
| | | SysArea parentArea = areaMap.get(parentCode); |
| | | parentArea.getChildren().add(sysArea); |
| | | if (ObjectUtils.isEmpty(parentArea)){ |
| | | continue; |
| | | } |
| | | List<SysArea> children = parentArea.getChildren(); |
| | | children.add(sysArea); |
| | | // parentArea.getChildren().add(sysArea); |
| | | |
| | | } |
| | | } |
| | | //移除集合中非父顶级城市 |