实验室信息管理系统的架构说明

  1. 数据库层:用于存储实验室的各种信息,包括实验室设备、试剂、文献、人员等。

  2. 应用层:用于实现实验室信息管理系统的各种功能,包括设备管理、试剂管理、文献管理、人员管理、实验计划管理、实验数据管理等。

  3. 用户界面层:用于提供用户与实验室信息管理系统进行交互的界面,包括Web界面、移动端界面等。

  4. 安全层:用于保障实验室信息的安全性,包括用户身份验证、数据加密、访问控制等。

  5. 数据分析层:用于对实验室信息进行分析和挖掘,以提供决策支持和优化实验室管理。

  6. 通信层:用于实现实验室信息管理系统与其他系统的数据交换和通信,包括与仪器设备的通信、与实验室信息系统的集成等。

实验室信息管理系统的架构说明_第1张图片

package co.fuyond;import co.fuyond.annotation.AnonymousAccess;

import co.fuyond.utils.SpringContextHolder;

import com.binarywang.spring.starter.wxjava.miniapp.config.WxMaAutoConfiguration;

import org.mybatis.spring.annotation.MapperScan;

import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;

import org.springframework.boot.web.servlet.server.ServletWebServerFactory;

import org.springframework.context.annotation.Bean;

import org.springframework.scheduling.annotation.EnableAsync;

import org.springframework.transaction.annotation.EnableTransactionManagement;

import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.web.bind.annotation.RestController;@EnableAsync

@RestController

@SpringBootApplication(exclude = {WxMaAutoConfiguration.class})

@EnableTransactionManagement

@MapperScan(basePackages = {"co.fuyond.modules.*.service.mapper", "co.fuyond.config", "co.fuyond.mapper"})

public class AppRun {

    public static void main(String[] args) {

        SpringApplication.run(AppRun.class, args);

        System.out.println(

                "              __                  \n" +

                        "  __ __ ___  / /  ___   ___       \n" +

                        " / // /(_-< / _ \\/ _ \\ / _ \\   \n" +

                        " \\_, //___//_//_/\\___// .__/    \n" +

                        "/___/                /_/          \n " + "\n系统管理后台启动成功 \n");

    }    @Bean

    public SpringContextHolder springContextHolder() {

        return new SpringContextHolder();

    }    @Bean

    public ServletWebServerFactory webServerFactory() {

        TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory();

        fa.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "[]{}"));

        return fa;

    }    /**

     * 访问首页提示

     *

     * @return /

     */

    @GetMapping("/")

    @AnonymousAccess

    public String index() {

        return "Backend service started successfully";

    }

}

package co.fuyond.config;import org.springframework.beans.factory.annotation.Value;

        import org.springframework.context.annotation.Bean;

        import org.springframework.context.annotation.Configuration;

        import org.springframework.web.cors.CorsConfiguration;

        import org.springframework.web.cors.UrlBasedCorsConfigurationSource;

        import org.springframework.web.filter.CorsFilter;

        import org.springframework.web.servlet.config.annotation.EnableWebMvc;

        import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;

        import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;@Configuration(proxyBeanMethods = false)

@EnableWebMvc

public class ConfigurerAdapter implements WebMvcConfigurer {

    @Value("${file.path}")

    private String path;

    @Value("${file.avatar}")

    private String avatar;    @Bean

    public CorsFilter corsFilter() {

        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();

        CorsConfiguration config = new CorsConfiguration();

        // 允许cookies跨域

        config.setAllowCredentials(true);

        // #允许向该服务器提交请求的URI,*表示全部允许,在SpringMVC中,如果设成*,会自动转成当前请求头中的Origin

        config.addAllowedOriginPattern("*");

        // #允许访问的头信息,*表示全部

        config.addAllowedHeader("*");

        // 预检请求的缓存时间(秒),即在这个时间段里,对于相同的跨域请求不会再预检了

        config.setMaxAge(18000L);

        // 允许提交请求的方法类型,*表示全部允许

        config.addAllowedMethod("OPTIONS");

        config.addAllowedMethod("HEAD");

        config.addAllowedMethod("GET");

        config.addAllowedMethod("PUT");

        config.addAllowedMethod("POST");

        config.addAllowedMethod("DELETE");

        config.addAllowedMethod("PATCH");

        source.registerCorsConfiguration("/**", config);

        return new CorsFilter(source);

    }    @Override

    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        String avatarUtl = "file:" + avatar.replace("\\", "/");

        String pathUtl = "file:" + path.replace("\\", "/");

        registry.addResourceHandler("/avatar/**").addResourceLocations(avatarUtl).setCachePeriod(0);

        registry.addResourceHandler("/file/**").addResourceLocations(pathUtl).setCachePeriod(0);

        registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/").setCachePeriod(0);

    }

}

package co.fuyond.config;

        import co.fuyond.modules.system.domain.Dept;

        import co.fuyond.modules.system.service.DeptService;

        import co.fuyond.modules.system.service.RoleService;

        import co.fuyond.modules.system.service.UserService;

        import co.fuyond.modules.system.service.dto.RoleSmallDto;

        import co.fuyond.modules.system.service.dto.UserDto;

        import co.fuyond.utils.SecurityUtils;

        import org.springframework.stereotype.Component;

        import java.util.ArrayList;

        import java.util.HashSet;

        import java.util.List;

        import java.util.Set;/**

 * 数据权限配置

 *

 * @author hupeng

 */

@Component

public class DataScope {

    private final String[] scopeType = {"全部", "本级", "自定义"};

    private final UserService userService;

    private final RoleService roleService;

    private final DeptService deptService;    public DataScope(UserService userService, RoleService roleService, DeptService deptService) {

        this.userService = userService;

        this.roleService = roleService;

        this.deptService = deptService;

    }    public Set getDeptIds() {

        UserDto user = userService.findByName(SecurityUtils.getUsername());        // 用于存储部门id

        Set deptIds = new HashSet<>();        // 查询用户角色

        List roleSet = roleService.findByUsersId(user.getId());

        for (RoleSmallDto role : roleSet) {

            if (scopeType[0].equals(role.getDataScope())) {

                return new HashSet<>();

            }            // 存储本级的数据权限

            if (scopeType[1].equals(role.getDataScope())) {

                deptIds.add(user.getDept().getId());

            }            // 存储自定义的数据权限

            if (scopeType[2].equals(role.getDataScope())) {

                Set depts = deptService.findByRoleIds(role.getId());

                for (Dept dept : depts) {

                    deptIds.add(dept.getId());

                    List deptChildren = deptService.findByPid(dept.getId());

                    if (deptChildren != null && deptChildren.size() != 0) {

                        deptIds.addAll(getDeptChildren(deptChildren));

                    }

                }

            }

        }

        return deptIds;

    }    public List getDeptChildren(List deptList) {

        List list = new ArrayList<>();

        deptList.forEach(dept -> {

                    if (dept != null && dept.getEnabled()) {

                        List depts = deptService.findByPid(dept.getId());

                        if (deptList.size() != 0) {

                            list.addAll(getDeptChildren(depts));

                        }

                        list.add(dept.getId());

                    }

                }

        );

        return list;

    }

}

package co.fuyond.config;

        import com.baomidou.mybatisplus.annotation.DbType;

        import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;

        import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;

        import org.springframework.context.annotation.Bean;

        import org.springframework.context.annotation.Configuration;/**

 * MybatisPlus配置

 */

@Configuration(proxyBeanMethods = false)

public class MybatisPlusConfig {

    /**

     * mybatis-plus分页插件

     */

    @Bean

    public MybatisPlusInterceptor mybatisPlusInterceptor() {

        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();

        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));

        return interceptor;

    }

}

package co.fuyond.config;import org.springframework.context.annotation.Bean;

        import org.springframework.context.annotation.Configuration;

        import org.springframework.web.socket.server.standard.ServerEndpointExporter;/**

 * @author: ZhangHouYing

 */

@Configuration(proxyBeanMethods = false)

public class WebSocketConfig {

    @Bean

    public ServerEndpointExporter serverEndpointExporter() {

        return new ServerEndpointExporter();

    }

}package co.fuyond.config.thread;import lombok.extern.slf4j.Slf4j;

        import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;

        import org.springframework.context.annotation.Configuration;

        import org.springframework.scheduling.annotation.AsyncConfigurer;

        import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;import java.util.concurrent.Executor;

        import java.util.concurrent.ThreadPoolExecutor;/**

 * 异步任务线程池装配类

 *

 * @author https://juejin.im/entry/5abb8f6951882555677e9da2

 */

@Slf4j

@Configuration(proxyBeanMethods = false)

public class AsyncTaskExecutePool implements AsyncConfigurer {

    /**

     * 注入配置类

     */

    private final AsyncTaskProperties config;    public AsyncTaskExecutePool(AsyncTaskProperties config) {

        this.config = config;

    }    @Override

    public Executor getAsyncExecutor() {

        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();

        //核心线程池大小

        executor.setCorePoolSize(config.getCorePoolSize());

        //最大线程数

        executor.setMaxPoolSize(config.getMaxPoolSize());

        //队列容量

        executor.setQueueCapacity(config.getQueueCapacity());

        //活跃时间

        executor.setKeepAliveSeconds(config.getKeepAliveSeconds());

        //线程名字前缀

        executor.setThreadNamePrefix("el-async-");

        // setRejectedExecutionHandler:当pool已经达到max size的时候,如何处理新任务

        // CallerRunsPolicy:不在新线程中执行任务,而是由调用者所在的线程来执行

        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());

        executor.initialize();

        return executor;

    }    @Override

    public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {

        return (throwable, method, objects) -> {

            log.error("====" + throwable.getMessage() + "====", throwable);

            log.error("exception method:" + method.getName());

        };

    }

}package co.fuyond.config.thread;import lombok.Data;

        import org.springframework.boot.context.properties.ConfigurationProperties;

        import org.springframework.stereotype.Component;/**

 * 线程池配置属性类

 *

 * @author https://juejin.im/entry/5abb8f6951882555677e9da2

 */

@Data

@Component

@ConfigurationProperties(prefix = "task.pool")

public class AsyncTaskProperties {

    private int corePoolSize;

    private int maxPoolSize;

    private int keepAliveSeconds;

    private int queueCapacity;

}package co.fuyond.config.thread;import org.springframework.stereotype.Component;import java.util.concurrent.ThreadFactory;

        import java.util.concurrent.atomic.AtomicInteger;@Component

public class TheadFactoryName implements ThreadFactory {

    private static final AtomicInteger POOL_NUMBER = new AtomicInteger(1);

    private final ThreadGroup group;

    private final AtomicInteger threadNumber = new AtomicInteger(1);

    private final String namePrefix;    public TheadFactoryName() {

        this("el-pool");

    }    private TheadFactoryName(String name) {

        SecurityManager s = System.getSecurityManager();

        group = (s != null) ? s.getThreadGroup() :

                Thread.currentThread().getThreadGroup();

        //此时namePrefix就是 name + 第几个用这个工厂创建线程池的

        this.namePrefix = name +

                POOL_NUMBER.getAndIncrement();

    }    @Override

    public Thread newThread(Runnable r) {

        //此时线程的名字 就是 namePrefix + -thread- + 这个线程池中第几个执行的线程

        Thread t = new Thread(group, r,

                namePrefix + "-thread-" + threadNumber.getAndIncrement(),

                0);

        if (t.isDaemon()) {

            t.setDaemon(false);

        }

        if (t.getPriority() != Thread.NORM_PRIORITY) {

            t.setPriority(Thread.NORM_PRIORITY);

        }

        return t;

    }

}package co.fuyond.config.thread;import co.fuyond.utils.SpringContextHolder;import java.util.concurrent.ArrayBlockingQueue;

        import java.util.concurrent.ThreadPoolExecutor;

        import java.util.concurrent.TimeUnit;public class ThreadPoolExecutorUtil {

    public static ThreadPoolExecutor getPoll() {

        AsyncTaskProperties properties = SpringContextHolder.getBean(AsyncTaskProperties.class);

        return new ThreadPoolExecutor(

                properties.getCorePoolSize(),

                properties.getMaxPoolSize(),

                properties.getKeepAliveSeconds(),

                TimeUnit.SECONDS,

                new ArrayBlockingQueue<>(properties.getQueueCapacity()),

                new TheadFactoryName()

        );

    }

}

package co.fuyond.controller;

        import co.fuyond.domain.HrAgreement;        import co.fuyond.domain.PageResult;        import co.fuyond.dozer.service.IGenerator;        import co.fuyond.dto.HrAgreementDto;        import co.fuyond.dto.HrAgreementQueryCriteria;        import co.fuyond.modules.logging.aop.log.Log;        import co.fuyond.service.HrAgreementService;        import io.swagger.annotations.Api;        import io.swagger.annotations.ApiOperation;        import lombok.AllArgsConstructor;        import org.springframework.beans.factory.annotation.Autowired;        import org.springframework.data.domain.Pageable;        import org.springframework.http.HttpStatus;        import org.springframework.http.ResponseEntity;        import org.springframework.security.access.prepost.PreAuthorize;        import org.springframework.validation.annotation.Validated;        import org.springframework.web.bind.annotation.*;

        import javax.servlet.http.HttpServletResponse;        import java.io.IOException;        import java.util.Arrays;

/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */@AllArgsConstructor@Api(tags = "WEBhr_agreement管理")@RestController@RequestMapping("/api/hrAgreement")public class HrAgreementController {

    private final IGenerator generator;    @Autowired    private HrAgreementService hrAgreementService;

    @Log("导出数据")    @ApiOperation("导出数据")    @GetMapping(value = "/download")    @PreAuthorize("@el.check('admin','hrAgreement:list')")    public void download(HttpServletResponse response, HrAgreementQueryCriteria criteria) throws IOException {        hrAgreementService.download(generator.convert(hrAgreementService.queryAll(criteria), HrAgreementDto.class), response);    }

    @GetMapping    @Log("查询hr_agreement")    @ApiOperation("查询hr_agreement")    @PreAuthorize("@el.check('admin','hrAgreement:list')")    public ResponseEntity> getHrAgreements(HrAgreementQueryCriteria criteria, Pageable pageable) {        return new ResponseEntity<>(hrAgreementService.queryAll(criteria, pageable), HttpStatus.OK);    }

    @PostMapping    @Log("新增hr_agreement")    @ApiOperation("新增hr_agreement")    @PreAuthorize("@el.check('admin','hrAgreement:add')")    public ResponseEntity create(@Validated @RequestBody HrAgreement resources) {        return new ResponseEntity<>(hrAgreementService.save(resources), HttpStatus.CREATED);    }

    @PutMapping    @Log("修改hr_agreement")    @ApiOperation("修改hr_agreement")    @PreAuthorize("@el.check('admin','hrAgreement:edit')")    public ResponseEntity update(@Validated @RequestBody HrAgreement resources) {        hrAgreementService.updateById(resources);        return new ResponseEntity<>(HttpStatus.NO_CONTENT);    }

    @Log("删除hr_agreement")    @ApiOperation("删除hr_agreement")    @PreAuthorize("@el.check('admin','hrAgreement:del')")    @DeleteMapping    public ResponseEntity deleteAll(@RequestBody Long[] ids) {        Arrays.asList(ids).forEach(id -> {            hrAgreementService.removeById(id);        });        return new ResponseEntity<>(HttpStatus.OK);    }}package co.fuyond.controller;

        import co.fuyond.domain.HrBanner;        import co.fuyond.domain.PageResult;        import co.fuyond.dozer.service.IGenerator;        import co.fuyond.dto.HrBannerDto;        import co.fuyond.dto.HrBannerQueryCriteria;        import co.fuyond.modules.logging.aop.log.Log;        import co.fuyond.service.HrBannerService;        import io.swagger.annotations.Api;        import io.swagger.annotations.ApiOperation;        import lombok.AllArgsConstructor;        import org.springframework.beans.factory.annotation.Autowired;        import org.springframework.data.domain.Pageable;        import org.springframework.http.HttpStatus;        import org.springframework.http.ResponseEntity;        import org.springframework.security.access.prepost.PreAuthorize;        import org.springframework.validation.annotation.Validated;        import org.springframework.web.bind.annotation.*;

        import javax.servlet.http.HttpServletResponse;        import java.io.IOException;        import java.util.Arrays;

/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */@AllArgsConstructor@Api(tags = "hr_banner管理")@RestController@RequestMapping("/api/hrBanner")public class HrBannerController {

    private final IGenerator generator;    @Autowired    private HrBannerService hrBannerService;

    @Log("导出数据")    @ApiOperation("导出数据")    @GetMapping(value = "/download")    @PreAuthorize("@el.check('admin','hrBanner:list')")    public void download(HttpServletResponse response, HrBannerQueryCriteria criteria) throws IOException {        hrBannerService.download(generator.convert(hrBannerService.queryAll(criteria), HrBannerDto.class), response);    }

    @GetMapping    @Log("查询hr_banner")    @ApiOperation("查询hr_banner")    @PreAuthorize("@el.check('admin','hrBanner:list')")    public ResponseEntity> getHrBanners(HrBannerQueryCriteria criteria, Pageable pageable) {        return new ResponseEntity<>(hrBannerService.queryAll(criteria, pageable), HttpStatus.OK);    }

    @PostMapping    @Log("新增hr_banner")    @ApiOperation("新增hr_banner")    @PreAuthorize("@el.check('admin','hrBanner:add')")    public ResponseEntity create(@Validated @RequestBody HrBanner resources) {        return new ResponseEntity<>(hrBannerService.save(resources), HttpStatus.CREATED);    }

    @PutMapping    @Log("修改hr_banner")    @ApiOperation("修改hr_banner")    @PreAuthorize("@el.check('admin','hrBanner:edit')")    public ResponseEntity update(@Validated @RequestBody HrBanner resources) {        hrBannerService.updateById(resources);        return new ResponseEntity<>(HttpStatus.NO_CONTENT);    }

    @Log("删除hr_banner")    @ApiOperation("删除hr_banner")    @PreAuthorize("@el.check('admin','hrBanner:del')")    @DeleteMapping    public ResponseEntity deleteAll(@RequestBody Long[] ids) {        Arrays.asList(ids).forEach(id -> {            hrBannerService.removeById(id);        });        return new ResponseEntity<>(HttpStatus.OK);    }}

package co.fuyond.controller;import co.fuyond.domain.HrDelivery;

        import co.fuyond.domain.PageResult;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.dto.HrDeliveryDto;

        import co.fuyond.dto.HrDeliveryQueryCriteria;

        import co.fuyond.dto.HrResumeDto;

        import co.fuyond.dto.HrResumeQueryCriteria;

        import co.fuyond.modules.logging.aop.log.Log;

        import co.fuyond.modules.security.security.vo.JwtUser;

        import co.fuyond.service.HrDeliveryService;

        import co.fuyond.service.HrResumeService;

        import co.fuyond.vo.HrStudentResumeVo;

        import io.swagger.annotations.Api;

        import io.swagger.annotations.ApiOperation;

        import lombok.AllArgsConstructor;

        import org.springframework.beans.factory.annotation.Autowired;

        import org.springframework.data.domain.Pageable;

        import org.springframework.http.HttpStatus;

        import org.springframework.http.ResponseEntity;

        import org.springframework.security.access.prepost.PreAuthorize;

        import org.springframework.security.core.annotation.AuthenticationPrincipal;

        import org.springframework.security.core.userdetails.UserDetails;

        import org.springframework.validation.annotation.Validated;

        import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.ArrayList;

        import java.util.Arrays;

        import java.util.List;/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */

@AllArgsConstructor

@Api(tags = "WEB简历投递管理")

@RestController

@RequestMapping("/api/hrDelivery")

public class HrDeliveryController {

    private final IGenerator generator;

    @Autowired

    private HrDeliveryService hrDeliveryService;

    @Autowired

    private HrResumeService hrResumeService;    @Log("导出数据")

    @ApiOperation("web导出数据")

    @GetMapping(value = "/download")

    @PreAuthorize("@el.check('admin','hrDelivery:list')")

    public void download(HttpServletResponse response, HrDeliveryQueryCriteria criteria) throws IOException {

        hrDeliveryService.download(generator.convert(hrDeliveryService.queryAll(criteria), HrDeliveryDto.class), response);

    }    @GetMapping

    @Log("查询hr_delivery")

    @ApiOperation("web查询hr_delivery")

    @PreAuthorize("@el.check('admin','hrDelivery:list')")

    public ResponseEntity> getHrDeliverys(HrDeliveryQueryCriteria criteria, Pageable pageable) {

        return new ResponseEntity<>(hrDeliveryService.queryAll(criteria, pageable), HttpStatus.OK);

    }    @PostMapping

    @Log("新增hr_delivery")

    @ApiOperation("web新增hr_delivery")

    @PreAuthorize("@el.check('admin','hrDelivery:add')")

    public ResponseEntity create(@Validated @RequestBody HrDelivery resources) {

        return new ResponseEntity<>(hrDeliveryService.save(resources), HttpStatus.CREATED);

    }    @PutMapping

    @Log("修改hr_delivery")

    @ApiOperation("web修改hr_delivery")

    @PreAuthorize("@el.check('admin','hrDelivery:edit')")

    public ResponseEntity update(@Validated @RequestBody HrDelivery resources) {

        hrDeliveryService.updateById(resources);

        return new ResponseEntity<>(HttpStatus.NO_CONTENT);

    }    @Log("删除hr_delivery")

    @ApiOperation("web删除hr_delivery")

    @PreAuthorize("@el.check('admin','hrDelivery:del')")

    @DeleteMapping

    public ResponseEntity deleteAll(@RequestBody Long[] ids) {

        Arrays.asList(ids).forEach(id -> {

            hrDeliveryService.removeById(id);

        });

        return new ResponseEntity<>(HttpStatus.OK);

    }    /**

     * 获取单个简历详细信息

     *

     * @param resumeId 简历id

     * @return 简历全部信息

     */

    @GetMapping("/studentResumeInfo")

    @PreAuthorize("@el.check('admin','hrDelivery:list')")

    public ResponseEntity getStudentResumesInfo(@RequestParam Long resumeId) {

        HrStudentResumeVo resumeVo = hrResumeService.getStudentResumesInfo(resumeId);

        return new ResponseEntity<>(resumeVo, HttpStatus.OK);

    }    /**

     * 获取当前企业收到的简历

     *

     * @param userDetails 当前登录信息

     * @param pageable    分页参数

     * @param criteria    查询条件

     * @return 简历信息

     */

    @GetMapping("/studentResume")

    @PreAuthorize("@el.check('admin','hrDelivery:list')")

    public ResponseEntity> getStudentResumes(@AuthenticationPrincipal UserDetails userDetails, Pageable pageable, HrResumeQueryCriteria criteria) {

        JwtUser user = (JwtUser) userDetails;

        if (user.getEnterpriseAuthentication().equals(1)) {

            return new ResponseEntity<>(hrDeliveryService.getStudentResumesByEnterpriseId(user.getEnterpriseInfoId(), criteria, pageable), HttpStatus.OK);

        }

        return null;

    }    /**

     * 根据招聘id获取招聘下所有简历信息

     *

     * @param employmentId 招聘id

     * @return 简历信息

     */

    @GetMapping("/getResumeByEmploymentId")

    @PreAuthorize("@el.check('admin','hrDelivery:list')")

    public ResponseEntity> getResumeByEmploymentId(@RequestParam Long employmentId) {

        ArrayList resumeVos = hrResumeService.getResumeInfoByEmploymentId(employmentId);

        return new ResponseEntity<>(resumeVos, HttpStatus.OK);

    }

}package co.fuyond.controller;import co.fuyond.domain.HrEmployment;

        import co.fuyond.domain.PageResult;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.dto.HrEmploymentDto;

        import co.fuyond.dto.HrEmploymentEnterpriseInfoDto;

        import co.fuyond.dto.HrEmploymentQueryCriteria;

        import co.fuyond.modules.logging.aop.log.Log;

        import co.fuyond.modules.security.security.vo.JwtUser;

        import co.fuyond.service.HrEmploymentService;

        import io.swagger.annotations.Api;

        import io.swagger.annotations.ApiOperation;

        import lombok.AllArgsConstructor;

        import org.springframework.beans.factory.annotation.Autowired;

        import org.springframework.data.domain.Pageable;

        import org.springframework.http.HttpStatus;

        import org.springframework.http.ResponseEntity;

        import org.springframework.security.access.prepost.PreAuthorize;

        import org.springframework.security.core.annotation.AuthenticationPrincipal;

        import org.springframework.security.core.userdetails.UserDetails;

        import org.springframework.validation.annotation.Validated;

        import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.Arrays;/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */

@AllArgsConstructor

@Api(tags = "WEB招聘信息管理")

@RestController

@RequestMapping("/api/hrEmployment")

public class HrEmploymentController {

    private final IGenerator generator;

    @Autowired

    private HrEmploymentService hrEmploymentService;    @Log("导出数据")

    @ApiOperation("web导出数据")

    @GetMapping(value = "/download")

    @PreAuthorize("@el.check('admin','hrEmployment:list')")

    public void download(HttpServletResponse response, HrEmploymentQueryCriteria criteria) throws IOException {

        hrEmploymentService.download(generator.convert(hrEmploymentService.queryAll(criteria), HrEmploymentDto.class), response);

    }    @GetMapping

    @Log("查询hr_employment")

    @ApiOperation("web查询hr_employment")

    @PreAuthorize("@el.check('admin','hrEmployment:list')")

    public ResponseEntity> getHrEmployments(HrEmploymentQueryCriteria criteria, Pageable pageable) {

        return new ResponseEntity<>(hrEmploymentService.queryAll(criteria, pageable), HttpStatus.OK);

    }    @PostMapping

    @Log("新增hr_employment")

    @ApiOperation("web新增hr_employment")

    @PreAuthorize("@el.check('admin','hrEmployment:add')")

    public ResponseEntity create(@Validated @RequestBody HrEmployment resources, @AuthenticationPrincipal UserDetails userDetails) {

        JwtUser user = (JwtUser) userDetails;

        resources.setEnterpriseInfoId(user.getEnterpriseInfoId());

        return new ResponseEntity<>(hrEmploymentService.save(resources), HttpStatus.CREATED);

    }    @PutMapping

    @Log("修改hr_employment")

    @ApiOperation("web修改hr_employment")

    @PreAuthorize("@el.check('admin','hrEmployment:edit')")

    public ResponseEntity update(@Validated @RequestBody HrEmployment resources) {

        hrEmploymentService.updateById(resources);

        return new ResponseEntity<>(HttpStatus.NO_CONTENT);

    }    @Log("删除hr_employment")

    @ApiOperation("web删除hr_employment")

    @PreAuthorize("@el.check('admin','hrEmployment:del')")

    @DeleteMapping

    public ResponseEntity deleteAll(@RequestBody Long[] ids) {

        Arrays.asList(ids).forEach(id -> {

            hrEmploymentService.delById(id);

        });

        return new ResponseEntity<>(HttpStatus.OK);

    }    /**

     * web获取招聘信息和企业部分信息

     *

     * @param name     搜索招聘/企业名字

     * @param pageable 分页参数

     * @return

     */

    @GetMapping("/getInfo")

    @PreAuthorize("@el.check('admin','hrEmployment:list')")

    public ResponseEntity> getAndEnterpriseInfo(String name, Pageable pageable) {

        return new ResponseEntity<>(hrEmploymentService.findAndEnterpriseInfo(name, pageable), HttpStatus.OK);

    }

}package co.fuyond.controller;import co.fuyond.domain.HrEnterpriseInfo;

        import co.fuyond.domain.PageResult;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.dto.HrEnterpriseInfoDto;

        import co.fuyond.dto.HrEnterpriseInfoQueryCriteria;

        import co.fuyond.modules.logging.aop.log.Log;

        import co.fuyond.modules.security.security.vo.JwtUser;

        import co.fuyond.modules.system.domain.User;

        import co.fuyond.modules.system.domain.UsersRoles;

        import co.fuyond.modules.system.service.UserService;

        import co.fuyond.modules.system.service.UsersRolesService;

        import co.fuyond.service.HrEnterpriseInfoService;

        import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

        import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;

        import io.swagger.annotations.Api;

        import io.swagger.annotations.ApiOperation;

        import lombok.AllArgsConstructor;

        import org.springframework.beans.factory.annotation.Autowired;

        import org.springframework.data.domain.Pageable;

        import org.springframework.http.HttpStatus;

        import org.springframework.http.ResponseEntity;

        import org.springframework.security.access.prepost.PreAuthorize;

        import org.springframework.security.core.annotation.AuthenticationPrincipal;

        import org.springframework.security.core.userdetails.UserDetails;

        import org.springframework.validation.annotation.Validated;

        import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.Arrays;

        import java.util.List;/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */

@AllArgsConstructor

@Api(tags = "WEB企业信息管理")

@RestController

@RequestMapping("/api/hrEnterpriseInfo")

public class HrEnterpriseInfoController {

    private final IGenerator generator;

    @Autowired

    private HrEnterpriseInfoService hrEnterpriseInfoService;

    @Autowired

    private UserService userService;

    @Autowired

    private UsersRolesService usersRolesService;    @Log("导出数据")

    @ApiOperation("web导出数据")

    @GetMapping(value = "/download")

    @PreAuthorize("@el.check('admin','hrEnterpriseInfo:list')")

    public void download(HttpServletResponse response, HrEnterpriseInfoQueryCriteria criteria) throws IOException {

        hrEnterpriseInfoService.download(generator.convert(hrEnterpriseInfoService.queryAll(criteria), HrEnterpriseInfoDto.class), response);

    }    @GetMapping

    @Log("查询hr_enterprise_info")

    @ApiOperation("web查询hr_enterprise_info")

    @PreAuthorize("@el.check('admin','hrEnterpriseInfo:list')")

    public ResponseEntity> getHrEnterpriseInfos(HrEnterpriseInfoQueryCriteria criteria, Pageable pageable) {

        PageResult pageResult = hrEnterpriseInfoService.queryAll(criteria, pageable);

        for (HrEnterpriseInfoDto dto : pageResult.getContent()) {

            User user = userService.getOne(new QueryWrapper().eq("enterprise_info_id", dto.getId()).select("id", "enterprise_authentication"));

            if (user != null && user.getEnterpriseAuthentication() != null) {

                dto.setEnterpriseAuthentication(user.getEnterpriseAuthentication());

            }

        }

        return new ResponseEntity<>(pageResult, HttpStatus.OK);

    }    @PostMapping

    @Log("新增hr_enterprise_info")

    @ApiOperation("web新增hr_enterprise_info")

    @PreAuthorize("@el.check('admin','hrEnterpriseInfo:add')")

    public ResponseEntity create(@Validated @RequestBody HrEnterpriseInfo resources) {

        return new ResponseEntity<>(hrEnterpriseInfoService.save(resources), HttpStatus.CREATED);

    }    @PutMapping

    @Log("修改hr_enterprise_info")

    @ApiOperation("web修改hr_enterprise_info")

    @PreAuthorize("@el.check('admin','hrEnterpriseInfo:edit')")

    public ResponseEntity update(@Validated @RequestBody HrEnterpriseInfo resources) {

        hrEnterpriseInfoService.updateById(resources);

        return new ResponseEntity<>(HttpStatus.NO_CONTENT);

    }    @Log("删除hr_enterprise_info")

    @ApiOperation("web删除hr_enterprise_info")

    @PreAuthorize("@el.check('admin','hrEnterpriseInfo:del')")

    @DeleteMapping

    public ResponseEntity deleteAll(@RequestBody Long[] ids) {

        Arrays.asList(ids).forEach(id -> {

            List users = userService.list(new QueryWrapper().eq("enterprise_info_id", id));

            for (User user : users) {

                usersRolesService.remove(new QueryWrapper().eq("user_id", user.getId()).eq("role_id", 6));

            }

            userService.update(new UpdateWrapper().eq("enterprise_info_id", id).set("enterprise_info_id", null).set("enterprise_authentication", 0));

            hrEnterpriseInfoService.removeById(id);

        });

        return new ResponseEntity<>(HttpStatus.OK);

    }    /**

     * 注册企业认证

     *

     * @param resources   企业信息

     * @param userDetails 登录用户信息

     * @return

     */

    @PostMapping("/registered")

    @PreAuthorize("@el.check('admin','hrEnterpriseInfo:add')")

    public ResponseEntity registeredEnterprise(@Validated @RequestBody HrEnterpriseInfo resources, @AuthenticationPrincipal UserDetails userDetails) {

        JwtUser jwtUser = (JwtUser) userDetails;

        resources.setCreateUserId(jwtUser.getId());

        hrEnterpriseInfoService.saveOrUpdate(resources);

        User user = new User();

        user.setId(jwtUser.getId());

        user.setEnterpriseInfoId(resources.getId());

        user.setEnterpriseAuthentication(0);

        boolean save = userService.updateById(user);

        return new ResponseEntity<>(save, HttpStatus.CREATED);

    }    /**

     * 通过企业认证

     *

     * @param id 企业信息id

     * @return

     */

    @PutMapping("/passAuthentication/{id}")

    @PreAuthorize("@el.check('admin','hrEnterpriseInfo:passAuthentication')")

    public ResponseEntity passAuthentication(@PathVariable String id) {

        User user = userService.getOne(new QueryWrapper().eq("enterprise_info_id", id));

        UsersRoles usersRoles = new UsersRoles();

        usersRoles.setUserId(user.getId());

        usersRoles.setRoleId(6L);

        usersRolesService.save(usersRoles);

        boolean save = userService.update(new UpdateWrapper().eq("enterprise_info_id", id).set("enterprise_authentication", 1));

        return new ResponseEntity<>(save, HttpStatus.CREATED);

    }    /**

     * 驳回企业认证

     *

     * @param id 企业信息id

     * @return

     */

    @PutMapping("/rejectAuthentication/{id}")

    @PreAuthorize("@el.check('admin','hrEnterpriseInfo:rejectAuthentication')")

    public ResponseEntity rejectAuthentication(@PathVariable String id) {

        boolean save = userService.update(new UpdateWrapper().eq("enterprise_info_id", id).set("enterprise_authentication", 3));

        return new ResponseEntity<>(save, HttpStatus.CREATED);

    }    /**

     * 判断当前用户是否已提交企业认证

     *

     * @param userDetails 当前登录用户

     * @return 是否已提交

     */

    @GetMapping("/isSubmit")

    @PreAuthorize("@el.check('admin','hrEnterpriseInfo:isSubmit')")

    public ResponseEntity isSubmit(@AuthenticationPrincipal UserDetails userDetails) {

        JwtUser user = (JwtUser) userDetails;

        User newUser = userService.getById(user.getId());

        if (newUser.getEnterpriseInfoId() == null || newUser.getEnterpriseAuthentication().equals(3)) {

            return new ResponseEntity<>(false, HttpStatus.OK);

        } else {

            return new ResponseEntity<>(true, HttpStatus.OK);

        }

    }

}

package co.fuyond.controller;

        import co.fuyond.domain.HrEnterprisePrescription;        import co.fuyond.domain.PageResult;        import co.fuyond.dozer.service.IGenerator;        import co.fuyond.dto.HrEnterprisePrescriptionDto;        import co.fuyond.dto.HrEnterprisePrescriptionQueryCriteria;        import co.fuyond.modules.logging.aop.log.Log;        import co.fuyond.service.HrEnterprisePrescriptionService;        import io.swagger.annotations.Api;        import io.swagger.annotations.ApiOperation;        import lombok.AllArgsConstructor;        import org.springframework.beans.factory.annotation.Autowired;        import org.springframework.data.domain.Pageable;        import org.springframework.http.HttpStatus;        import org.springframework.http.ResponseEntity;        import org.springframework.security.access.prepost.PreAuthorize;        import org.springframework.validation.annotation.Validated;        import org.springframework.web.bind.annotation.*;

        import javax.servlet.http.HttpServletResponse;        import java.io.IOException;        import java.util.Arrays;

/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */@AllArgsConstructor@Api(tags = "WEBhr_enterprise_prescription管理")@RestController@RequestMapping("/api/hrEnterprisePrescription")public class HrEnterprisePrescriptionController {

    private final IGenerator generator;    @Autowired    private HrEnterprisePrescriptionService hrEnterprisePrescriptionService;

    @Log("导出数据")    @ApiOperation("导出数据")    @GetMapping(value = "/download")    @PreAuthorize("@el.check('admin','hrEnterprisePrescription:list')")    public void download(HttpServletResponse response, HrEnterprisePrescriptionQueryCriteria criteria) throws IOException {        hrEnterprisePrescriptionService.download(generator.convert(hrEnterprisePrescriptionService.queryAll(criteria), HrEnterprisePrescriptionDto.class), response);    }

    @GetMapping    @Log("查询hr_enterprise_prescription")    @ApiOperation("查询hr_enterprise_prescription")    @PreAuthorize("@el.check('admin','hrEnterprisePrescription:list')")    public ResponseEntity> getHrEnterprisePrescriptions(HrEnterprisePrescriptionQueryCriteria criteria, Pageable pageable) {        return new ResponseEntity<>(hrEnterprisePrescriptionService.queryAll(criteria, pageable), HttpStatus.OK);    }

    @PostMapping    @Log("新增hr_enterprise_prescription")    @ApiOperation("新增hr_enterprise_prescription")    @PreAuthorize("@el.check('admin','hrEnterprisePrescription:add')")    public ResponseEntity create(@Validated @RequestBody HrEnterprisePrescription resources) {        return new ResponseEntity<>(hrEnterprisePrescriptionService.save(resources), HttpStatus.CREATED);    }

    @PutMapping    @Log("修改hr_enterprise_prescription")    @ApiOperation("修改hr_enterprise_prescription")    @PreAuthorize("@el.check('admin','hrEnterprisePrescription:edit')")    public ResponseEntity update(@Validated @RequestBody HrEnterprisePrescription resources) {        hrEnterprisePrescriptionService.updateById(resources);        return new ResponseEntity<>(HttpStatus.NO_CONTENT);    }

    @Log("删除hr_enterprise_prescription")    @ApiOperation("删除hr_enterprise_prescription")    @PreAuthorize("@el.check('admin','hrEnterprisePrescription:del')")    @DeleteMapping    public ResponseEntity deleteAll(@RequestBody Long[] ids) {        Arrays.asList(ids).forEach(id -> {            hrEnterprisePrescriptionService.removeById(id);        });        return new ResponseEntity<>(HttpStatus.OK);    }}

package co.fuyond.controller;import co.fuyond.domain.HrFinancialInstitution;

        import co.fuyond.domain.PageResult;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.dto.HrFinancialInstitutionDto;

        import co.fuyond.dto.HrFinancialInstitutionQueryCriteria;

        import co.fuyond.modules.logging.aop.log.Log;

        import co.fuyond.service.HrFinancialInstitutionService;

        import io.swagger.annotations.Api;

        import io.swagger.annotations.ApiOperation;

        import lombok.AllArgsConstructor;

        import org.springframework.beans.factory.annotation.Autowired;

        import org.springframework.data.domain.Pageable;

        import org.springframework.http.HttpStatus;

        import org.springframework.http.ResponseEntity;

        import org.springframework.security.access.prepost.PreAuthorize;

        import org.springframework.validation.annotation.Validated;

        import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.Arrays;/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */

@AllArgsConstructor

@Api(tags = "WEBhr_financial_institution管理")

@RestController

@RequestMapping("/api/hrFinancialInstitution")

public class HrFinancialInstitutionController {

    private final IGenerator generator;

    @Autowired

    private HrFinancialInstitutionService hrFinancialInstitutionService;    @Log("导出数据")

    @ApiOperation("web导出数据")

    @GetMapping(value = "/download")

    @PreAuthorize("@el.check('admin','hrFinancialInstitution:list')")

    public void download(HttpServletResponse response, HrFinancialInstitutionQueryCriteria criteria) throws IOException {

        hrFinancialInstitutionService.download(generator.convert(hrFinancialInstitutionService.queryAll(criteria), HrFinancialInstitutionDto.class), response);

    }    @GetMapping

    @Log("查询hr_financial_institution")

    @ApiOperation("web查询hr_financial_institution")

    @PreAuthorize("@el.check('admin','hrFinancialInstitution:list')")

    public ResponseEntity> getHrFinancialInstitutions(HrFinancialInstitutionQueryCriteria criteria, Pageable pageable) {

        return new ResponseEntity<>(hrFinancialInstitutionService.queryAll(criteria, pageable), HttpStatus.OK);

    }    @PostMapping

    @Log("新增hr_financial_institution")

    @ApiOperation("web新增hr_financial_institution")

    @PreAuthorize("@el.check('admin','hrFinancialInstitution:add')")

    public ResponseEntity create(@Validated @RequestBody HrFinancialInstitution resources) {

        return new ResponseEntity<>(hrFinancialInstitutionService.save(resources), HttpStatus.CREATED);

    }    @PutMapping

    @Log("修改hr_financial_institution")

    @ApiOperation("web修改hr_financial_institution")

    @PreAuthorize("@el.check('admin','hrFinancialInstitution:edit')")

    public ResponseEntity update(@Validated @RequestBody HrFinancialInstitution resources) {

        hrFinancialInstitutionService.updateById(resources);

        return new ResponseEntity<>(HttpStatus.NO_CONTENT);

    }    @Log("删除hr_financial_institution")

    @ApiOperation("web删除hr_financial_institution")

    @PreAuthorize("@el.check('admin','hrFinancialInstitution:del')")

    @DeleteMapping

    public ResponseEntity deleteAll(@RequestBody Long[] ids) {

        Arrays.asList(ids).forEach(id -> {

            hrFinancialInstitutionService.removeById(id);

        });

        return new ResponseEntity<>(HttpStatus.OK);

    }

}package co.fuyond.controller;import co.fuyond.domain.HrHistory;

        import co.fuyond.domain.PageResult;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.dto.HrHistoryDto;

        import co.fuyond.dto.HrHistoryQueryCriteria;

        import co.fuyond.modules.logging.aop.log.Log;

        import co.fuyond.service.HrHistoryService;

        import io.swagger.annotations.Api;

        import io.swagger.annotations.ApiOperation;

        import lombok.AllArgsConstructor;

        import org.springframework.beans.factory.annotation.Autowired;

        import org.springframework.data.domain.Pageable;

        import org.springframework.http.HttpStatus;

        import org.springframework.http.ResponseEntity;

        import org.springframework.security.access.prepost.PreAuthorize;

        import org.springframework.validation.annotation.Validated;

        import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.Arrays;/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */

@AllArgsConstructor

@Api(tags = "WEBhr_history管理")

@RestController

@RequestMapping("/api/hrHistory")

public class HrHistoryController {

    private final IGenerator generator;

    @Autowired

    private HrHistoryService hrHistoryService;    @Log("导出数据")

    @ApiOperation("web导出数据")

    @GetMapping(value = "/download")

    @PreAuthorize("@el.check('admin','hrHistory:list')")

    public void download(HttpServletResponse response, HrHistoryQueryCriteria criteria) throws IOException {

        hrHistoryService.download(generator.convert(hrHistoryService.queryAll(criteria), HrHistoryDto.class), response);

    }    @GetMapping

    @Log("查询hr_history")

    @ApiOperation("web查询hr_history")

    @PreAuthorize("@el.check('admin','hrHistory:list')")

    public ResponseEntity> getHrHistorys(HrHistoryQueryCriteria criteria, Pageable pageable) {

        return new ResponseEntity<>(hrHistoryService.queryAll(criteria, pageable), HttpStatus.OK);

    }    @PostMapping

    @Log("新增hr_history")

    @ApiOperation("web新增hr_history")

    @PreAuthorize("@el.check('admin','hrHistory:add')")

    public ResponseEntity create(@Validated @RequestBody HrHistory resources) {

        return new ResponseEntity<>(hrHistoryService.save(resources), HttpStatus.CREATED);

    }    @PutMapping

    @Log("修改hr_history")

    @ApiOperation("web修改hr_history")

    @PreAuthorize("@el.check('admin','hrHistory:edit')")

    public ResponseEntity update(@Validated @RequestBody HrHistory resources) {

        hrHistoryService.updateById(resources);

        return new ResponseEntity<>(HttpStatus.NO_CONTENT);

    }    @Log("删除hr_history")

    @ApiOperation("web删除hr_history")

    @PreAuthorize("@el.check('admin','hrHistory:del')")

    @DeleteMapping

    public ResponseEntity deleteAll(@RequestBody Long[] ids) {

        Arrays.asList(ids).forEach(id -> {

            hrHistoryService.removeById(id);

        });

        return new ResponseEntity<>(HttpStatus.OK);

    }

}

package co.fuyond.controller;

        import co.fuyond.domain.HrInterview;        import co.fuyond.domain.PageResult;        import co.fuyond.dozer.service.IGenerator;        import co.fuyond.dto.HrInterviewDto;        import co.fuyond.dto.HrInterviewQueryCriteria;        import co.fuyond.modules.logging.aop.log.Log;        import co.fuyond.service.HrInterviewService;        import io.swagger.annotations.Api;        import io.swagger.annotations.ApiOperation;        import lombok.AllArgsConstructor;        import org.springframework.beans.factory.annotation.Autowired;        import org.springframework.data.domain.Pageable;        import org.springframework.http.HttpStatus;        import org.springframework.http.ResponseEntity;        import org.springframework.security.access.prepost.PreAuthorize;        import org.springframework.validation.annotation.Validated;        import org.springframework.web.bind.annotation.*;

        import javax.servlet.http.HttpServletResponse;        import java.io.IOException;        import java.util.Arrays;

/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */@AllArgsConstructor@Api(tags = "WEB面试阶段管理")@RestController@RequestMapping("/api/hrInterview")public class HrInterviewController {

    private final IGenerator generator;    @Autowired    private HrInterviewService hrInterviewService;

    @Log("导出数据")    @ApiOperation("导出数据")    @GetMapping(value = "/download")    @PreAuthorize("@el.check('admin','hrInterview:list')")    public void download(HttpServletResponse response, HrInterviewQueryCriteria criteria) throws IOException {        hrInterviewService.download(generator.convert(hrInterviewService.queryAll(criteria), HrInterviewDto.class), response);    }

    @GetMapping    @Log("查询hr_interview")    @ApiOperation("查询hr_interview")    @PreAuthorize("@el.check('admin','hrInterview:list')")    public ResponseEntity> getHrInterviews(HrInterviewQueryCriteria criteria, Pageable pageable) {        return new ResponseEntity<>(hrInterviewService.queryAll(criteria, pageable), HttpStatus.OK);    }

    @PostMapping    @Log("新增hr_interview")    @ApiOperation("新增hr_interview")    @PreAuthorize("@el.check('admin','hrInterview:add')")    public ResponseEntity create(@Validated @RequestBody HrInterview resources) {        return new ResponseEntity<>(hrInterviewService.save(resources), HttpStatus.CREATED);    }

    @PutMapping    @Log("修改hr_interview")    @ApiOperation("修改hr_interview")    @PreAuthorize("@el.check('admin','hrInterview:edit')")    public ResponseEntity update(@Validated @RequestBody HrInterview resources) {        hrInterviewService.updateById(resources);        return new ResponseEntity<>(HttpStatus.NO_CONTENT);    }

    @Log("删除hr_interview")    @ApiOperation("删除hr_interview")    @PreAuthorize("@el.check('admin','hrInterview:del')")    @DeleteMapping    public ResponseEntity deleteAll(@RequestBody Long[] ids) {        Arrays.asList(ids).forEach(id -> {            hrInterviewService.removeById(id);        });        return new ResponseEntity<>(HttpStatus.OK);    }}

package co.fuyond.controller;import co.fuyond.domain.HrMentor;

        import co.fuyond.domain.PageResult;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.dto.HrMentorDto;

        import co.fuyond.dto.HrMentorQueryCriteria;

        import co.fuyond.modules.logging.aop.log.Log;

        import co.fuyond.service.HrMentorService;

        import io.swagger.annotations.Api;

        import io.swagger.annotations.ApiOperation;

        import lombok.AllArgsConstructor;

        import org.springframework.beans.factory.annotation.Autowired;

        import org.springframework.data.domain.Pageable;

        import org.springframework.http.HttpStatus;

        import org.springframework.http.ResponseEntity;

        import org.springframework.security.access.prepost.PreAuthorize;

        import org.springframework.validation.annotation.Validated;

        import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.Arrays;/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */

@AllArgsConstructor

@Api(tags = "WEBhr_mentor管理")

@RestController

@RequestMapping("/api/hrMentor")

public class HrMentorController {

    private final IGenerator generator;

    @Autowired

    private HrMentorService hrMentorService;    @Log("导出数据")

    @ApiOperation("web导出数据")

    @GetMapping(value = "/download")

    @PreAuthorize("@el.check('admin','hrMentor:list')")

    public void download(HttpServletResponse response, HrMentorQueryCriteria criteria) throws IOException {

        hrMentorService.download(generator.convert(hrMentorService.queryAll(criteria), HrMentorDto.class), response);

    }    @GetMapping

    @Log("查询hr_mentor")

    @ApiOperation("web查询hr_mentor")

    @PreAuthorize("@el.check('admin','hrMentor:list')")

    public ResponseEntity> getHrMentors(HrMentorQueryCriteria criteria, Pageable pageable) {

        return new ResponseEntity<>(hrMentorService.queryAll(criteria, pageable), HttpStatus.OK);

    }    @PostMapping

    @Log("新增hr_mentor")

    @ApiOperation("web新增hr_mentor")

    @PreAuthorize("@el.check('admin','hrMentor:add')")

    public ResponseEntity create(@Validated @RequestBody HrMentor resources) {

        return new ResponseEntity<>(hrMentorService.save(resources), HttpStatus.CREATED);

    }    @PutMapping

    @Log("修改hr_mentor")

    @ApiOperation("web修改hr_mentor")

    @PreAuthorize("@el.check('admin','hrMentor:edit')")

    public ResponseEntity update(@Validated @RequestBody HrMentor resources) {

        hrMentorService.updateById(resources);

        return new ResponseEntity<>(HttpStatus.NO_CONTENT);

    }    @Log("删除hr_mentor")

    @ApiOperation("web删除hr_mentor")

    @PreAuthorize("@el.check('admin','hrMentor:del')")

    @DeleteMapping

    public ResponseEntity deleteAll(@RequestBody Long[] ids) {

        Arrays.asList(ids).forEach(id -> {

            hrMentorService.removeById(id);

        });

        return new ResponseEntity<>(HttpStatus.OK);

    }

}package co.fuyond.controller;import co.fuyond.domain.HrPositionInfos;

        import co.fuyond.domain.PageResult;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.dto.HrPositionInfosDto;

        import co.fuyond.dto.HrPositionInfosQueryCriteria;

        import co.fuyond.modules.logging.aop.log.Log;

        import co.fuyond.service.HrPositionInfosService;

        import io.swagger.annotations.Api;

        import io.swagger.annotations.ApiOperation;

        import lombok.AllArgsConstructor;

        import org.springframework.beans.factory.annotation.Autowired;

        import org.springframework.data.domain.Pageable;

        import org.springframework.http.HttpStatus;

        import org.springframework.http.ResponseEntity;

        import org.springframework.security.access.prepost.PreAuthorize;

        import org.springframework.validation.annotation.Validated;

        import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.Arrays;/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */

@AllArgsConstructor

@Api(tags = "WEBhr_position_infos管理")

@RestController

@RequestMapping("/api/hrPositionInfos")

public class HrPositionInfosController {

    private final IGenerator generator;

    @Autowired

    private HrPositionInfosService hrPositionInfosService;    @Log("导出数据")

    @ApiOperation("web导出数据")

    @GetMapping(value = "/download")

    @PreAuthorize("@el.check('admin','hrPositionInfos:list')")

    public void download(HttpServletResponse response, HrPositionInfosQueryCriteria criteria) throws IOException {

        hrPositionInfosService.download(generator.convert(hrPositionInfosService.queryAll(criteria), HrPositionInfosDto.class), response);

    }    @GetMapping

    @Log("查询hr_position_infos")

    @ApiOperation("web查询hr_position_infos")

    @PreAuthorize("@el.check('admin','hrPositionInfos:list')")

    public ResponseEntity> getHrPositionInfoss(HrPositionInfosQueryCriteria criteria, Pageable pageable) {

        return new ResponseEntity<>(hrPositionInfosService.queryAll(criteria, pageable), HttpStatus.OK);

    }    @PostMapping

    @Log("新增hr_position_infos")

    @ApiOperation("web新增hr_position_infos")

    @PreAuthorize("@el.check('admin','hrPositionInfos:add')")

    public ResponseEntity create(@Validated @RequestBody HrPositionInfos resources) {

        return new ResponseEntity<>(hrPositionInfosService.save(resources), HttpStatus.CREATED);

    }    @PutMapping

    @Log("修改hr_position_infos")

    @ApiOperation("web修改hr_position_infos")

    @PreAuthorize("@el.check('admin','hrPositionInfos:edit')")

    public ResponseEntity update(@Validated @RequestBody HrPositionInfos resources) {

        hrPositionInfosService.updateById(resources);

        return new ResponseEntity<>(HttpStatus.NO_CONTENT);

    }    @Log("删除hr_position_infos")

    @ApiOperation("web删除hr_position_infos")

    @PreAuthorize("@el.check('admin','hrPositionInfos:del')")

    @DeleteMapping

    public ResponseEntity deleteAll(@RequestBody Long[] ids) {

        Arrays.asList(ids).forEach(id -> {

            hrPositionInfosService.removeById(id);

        });

        return new ResponseEntity<>(HttpStatus.OK);

    }

}

package co.fuyond.controller;

        import co.fuyond.domain.HrPrescriptionHistory;        import co.fuyond.domain.PageResult;        import co.fuyond.dozer.service.IGenerator;        import co.fuyond.dto.HrPrescriptionHistoryDto;        import co.fuyond.dto.HrPrescriptionHistoryQueryCriteria;        import co.fuyond.modules.logging.aop.log.Log;        import co.fuyond.service.HrPrescriptionHistoryService;        import io.swagger.annotations.Api;        import io.swagger.annotations.ApiOperation;        import lombok.AllArgsConstructor;        import org.springframework.beans.factory.annotation.Autowired;        import org.springframework.data.domain.Pageable;        import org.springframework.http.HttpStatus;        import org.springframework.http.ResponseEntity;        import org.springframework.security.access.prepost.PreAuthorize;        import org.springframework.validation.annotation.Validated;        import org.springframework.web.bind.annotation.*;

        import javax.servlet.http.HttpServletResponse;        import java.io.IOException;        import java.util.Arrays;

/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */@AllArgsConstructor@Api(tags = "WEBhr_prescription_history管理")@RestController@RequestMapping("/api/hrPrescriptionHistory")public class HrPrescriptionHistoryController {

    private final IGenerator generator;    @Autowired    private HrPrescriptionHistoryService hrPrescriptionHistoryService;

    @Log("导出数据")    @ApiOperation("导出数据")    @GetMapping(value = "/download")    @PreAuthorize("@el.check('admin','hrPrescriptionHistory:list')")    public void download(HttpServletResponse response, HrPrescriptionHistoryQueryCriteria criteria) throws IOException {        hrPrescriptionHistoryService.download(generator.convert(hrPrescriptionHistoryService.queryAll(criteria), HrPrescriptionHistoryDto.class), response);    }

    @GetMapping    @Log("查询hr_prescription_history")    @ApiOperation("查询hr_prescription_history")    @PreAuthorize("@el.check('admin','hrPrescriptionHistory:list')")    public ResponseEntity> getHrPrescriptionHistorys(HrPrescriptionHistoryQueryCriteria criteria, Pageable pageable) {        return new ResponseEntity<>(hrPrescriptionHistoryService.queryAll(criteria, pageable), HttpStatus.OK);    }

    @PostMapping    @Log("新增hr_prescription_history")    @ApiOperation("新增hr_prescription_history")    @PreAuthorize("@el.check('admin','hrPrescriptionHistory:add')")    public ResponseEntity create(@Validated @RequestBody HrPrescriptionHistory resources) {        return new ResponseEntity<>(hrPrescriptionHistoryService.save(resources), HttpStatus.CREATED);    }

    @PutMapping    @Log("修改hr_prescription_history")    @ApiOperation("修改hr_prescription_history")    @PreAuthorize("@el.check('admin','hrPrescriptionHistory:edit')")    public ResponseEntity update(@Validated @RequestBody HrPrescriptionHistory resources) {        hrPrescriptionHistoryService.updateById(resources);        return new ResponseEntity<>(HttpStatus.NO_CONTENT);    }

    @Log("删除hr_prescription_history")    @ApiOperation("删除hr_prescription_history")    @PreAuthorize("@el.check('admin','hrPrescriptionHistory:del')")    @DeleteMapping    public ResponseEntity deleteAll(@RequestBody Long[] ids) {        Arrays.asList(ids).forEach(id -> {            hrPrescriptionHistoryService.removeById(id);        });        return new ResponseEntity<>(HttpStatus.OK);    }}

package co.fuyond.controller;import co.fuyond.domain.HrProjectInfos;

        import co.fuyond.domain.PageResult;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.dto.HrProjectInfosDto;

        import co.fuyond.dto.HrProjectInfosQueryCriteria;

        import co.fuyond.modules.logging.aop.log.Log;

        import co.fuyond.service.HrProjectInfosService;

        import io.swagger.annotations.Api;

        import io.swagger.annotations.ApiOperation;

        import lombok.AllArgsConstructor;

        import org.springframework.beans.factory.annotation.Autowired;

        import org.springframework.data.domain.Pageable;

        import org.springframework.http.HttpStatus;

        import org.springframework.http.ResponseEntity;

        import org.springframework.security.access.prepost.PreAuthorize;

        import org.springframework.validation.annotation.Validated;

        import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.Arrays;/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */

@AllArgsConstructor

@Api(tags = "WEBhr_project_infos管理")

@RestController

@RequestMapping("/api/hrProjectInfos")

public class HrProjectInfosController {

    private final IGenerator generator;

    @Autowired

    private HrProjectInfosService hrProjectInfosService;    @Log("导出数据")

    @ApiOperation("web导出数据")

    @GetMapping(value = "/download")

    @PreAuthorize("@el.check('admin','hrProjectInfos:list')")

    public void download(HttpServletResponse response, HrProjectInfosQueryCriteria criteria) throws IOException {

        hrProjectInfosService.download(generator.convert(hrProjectInfosService.queryAll(criteria), HrProjectInfosDto.class), response);

    }    @GetMapping

    @Log("查询hr_project_infos")

    @ApiOperation("web查询hr_project_infos")

    @PreAuthorize("@el.check('admin','hrProjectInfos:list')")

    public ResponseEntity> getHrProjectInfoss(HrProjectInfosQueryCriteria criteria, Pageable pageable) {

        return new ResponseEntity<>(hrProjectInfosService.queryAll(criteria, pageable), HttpStatus.OK);

    }    @PostMapping

    @Log("新增hr_project_infos")

    @ApiOperation("web新增hr_project_infos")

    @PreAuthorize("@el.check('admin','hrProjectInfos:add')")

    public ResponseEntity create(@Validated @RequestBody HrProjectInfos resources) {

        return new ResponseEntity<>(hrProjectInfosService.save(resources), HttpStatus.CREATED);

    }    @PutMapping

    @Log("修改hr_project_infos")

    @ApiOperation("web修改hr_project_infos")

    @PreAuthorize("@el.check('admin','hrProjectInfos:edit')")

    public ResponseEntity update(@Validated @RequestBody HrProjectInfos resources) {

        hrProjectInfosService.updateById(resources);

        return new ResponseEntity<>(HttpStatus.NO_CONTENT);

    }    @Log("删除hr_project_infos")

    @ApiOperation("web删除hr_project_infos")

    @PreAuthorize("@el.check('admin','hrProjectInfos:del')")

    @DeleteMapping

    public ResponseEntity deleteAll(@RequestBody Long[] ids) {

        Arrays.asList(ids).forEach(id -> {

            hrProjectInfosService.removeById(id);

        });

        return new ResponseEntity<>(HttpStatus.OK);

    }

}package co.fuyond.controller;import co.fuyond.domain.HrPromotion;

        import co.fuyond.domain.PageResult;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.dto.HrPromotionDto;

        import co.fuyond.dto.HrPromotionQueryCriteria;

        import co.fuyond.modules.logging.aop.log.Log;

        import co.fuyond.service.HrPromotionService;

        import io.swagger.annotations.Api;

        import io.swagger.annotations.ApiOperation;

        import lombok.AllArgsConstructor;

        import org.springframework.beans.factory.annotation.Autowired;

        import org.springframework.data.domain.Pageable;

        import org.springframework.http.HttpStatus;

        import org.springframework.http.ResponseEntity;

        import org.springframework.security.access.prepost.PreAuthorize;

        import org.springframework.validation.annotation.Validated;

        import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.Arrays;/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */

@AllArgsConstructor

@Api(tags = "WEBhr_promotion管理")

@RestController

@RequestMapping("/api/hrPromotion")

public class HrPromotionController {

    private final IGenerator generator;

    @Autowired

    private HrPromotionService hrPromotionService;    @Log("导出数据")

    @ApiOperation("web导出数据")

    @GetMapping(value = "/download")

    @PreAuthorize("@el.check('admin','hrPromotion:list')")

    public void download(HttpServletResponse response, HrPromotionQueryCriteria criteria) throws IOException {

        hrPromotionService.download(generator.convert(hrPromotionService.queryAll(criteria), HrPromotionDto.class), response);

    }    @GetMapping

    @Log("查询hr_promotion")

    @ApiOperation("web查询hr_promotion")

    @PreAuthorize("@el.check('admin','hrPromotion:list')")

    public ResponseEntity> getHrPromotions(HrPromotionQueryCriteria criteria, Pageable pageable) {

        return new ResponseEntity<>(hrPromotionService.queryAll(criteria, pageable), HttpStatus.OK);

    }    @PostMapping

    @Log("新增hr_promotion")

    @ApiOperation("web新增hr_promotion")

    @PreAuthorize("@el.check('admin','hrPromotion:add')")

    public ResponseEntity create(@Validated @RequestBody HrPromotion resources) {

        return new ResponseEntity<>(hrPromotionService.save(resources), HttpStatus.CREATED);

    }    @PutMapping

    @Log("修改hr_promotion")

    @ApiOperation("web修改hr_promotion")

    @PreAuthorize("@el.check('admin','hrPromotion:edit')")

    public ResponseEntity update(@Validated @RequestBody HrPromotion resources) {

        hrPromotionService.updateById(resources);

        return new ResponseEntity<>(HttpStatus.NO_CONTENT);

    }    @Log("删除hr_promotion")

    @ApiOperation("web删除hr_promotion")

    @PreAuthorize("@el.check('admin','hrPromotion:del')")

    @DeleteMapping

    public ResponseEntity deleteAll(@RequestBody Long[] ids) {

        Arrays.asList(ids).forEach(id -> {

            hrPromotionService.removeById(id);

        });

        return new ResponseEntity<>(HttpStatus.OK);

    }

}

package co.fuyond.controller;

        import co.fuyond.domain.HrResumeAward;        import co.fuyond.domain.PageResult;        import co.fuyond.dozer.service.IGenerator;        import co.fuyond.dto.HrResumeAwardDto;        import co.fuyond.dto.HrResumeAwardQueryCriteria;        import co.fuyond.modules.logging.aop.log.Log;        import co.fuyond.service.HrResumeAwardService;        import io.swagger.annotations.Api;        import io.swagger.annotations.ApiOperation;        import lombok.AllArgsConstructor;        import org.springframework.beans.factory.annotation.Autowired;        import org.springframework.data.domain.Pageable;        import org.springframework.http.HttpStatus;        import org.springframework.http.ResponseEntity;        import org.springframework.security.access.prepost.PreAuthorize;        import org.springframework.validation.annotation.Validated;        import org.springframework.web.bind.annotation.*;

        import javax.servlet.http.HttpServletResponse;        import java.io.IOException;        import java.util.Arrays;

/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */@AllArgsConstructor@Api(tags = "WEBhr_resume_award管理")@RestController@RequestMapping("/api/hrResumeAward")public class HrResumeAwardController {

    private final IGenerator generator;    @Autowired    private HrResumeAwardService hrResumeAwardService;

    @Log("导出数据")    @ApiOperation("导出数据")    @GetMapping(value = "/download")    @PreAuthorize("@el.check('admin','hrResumeAward:list')")    public void download(HttpServletResponse response, HrResumeAwardQueryCriteria criteria) throws IOException {        hrResumeAwardService.download(generator.convert(hrResumeAwardService.queryAll(criteria), HrResumeAwardDto.class), response);    }

    @GetMapping    @Log("查询hr_resume_award")    @ApiOperation("查询hr_resume_award")    @PreAuthorize("@el.check('admin','hrResumeAward:list')")    public ResponseEntity> getHrResumeAwards(HrResumeAwardQueryCriteria criteria, Pageable pageable) {        return new ResponseEntity<>(hrResumeAwardService.queryAll(criteria, pageable), HttpStatus.OK);    }

    @PostMapping    @Log("新增hr_resume_award")    @ApiOperation("新增hr_resume_award")    @PreAuthorize("@el.check('admin','hrResumeAward:add')")    public ResponseEntity create(@Validated @RequestBody HrResumeAward resources) {        return new ResponseEntity<>(hrResumeAwardService.save(resources), HttpStatus.CREATED);    }

    @PutMapping    @Log("修改hr_resume_award")    @ApiOperation("修改hr_resume_award")    @PreAuthorize("@el.check('admin','hrResumeAward:edit')")    public ResponseEntity update(@Validated @RequestBody HrResumeAward resources) {        hrResumeAwardService.updateById(resources);        return new ResponseEntity<>(HttpStatus.NO_CONTENT);    }

    @Log("删除hr_resume_award")    @ApiOperation("删除hr_resume_award")    @PreAuthorize("@el.check('admin','hrResumeAward:del')")    @DeleteMapping    public ResponseEntity deleteAll(@RequestBody Long[] ids) {        Arrays.asList(ids).forEach(id -> {            hrResumeAwardService.removeById(id);        });        return new ResponseEntity<>(HttpStatus.OK);    }}

package co.fuyond.controller;import co.fuyond.domain.HrResume;

        import co.fuyond.domain.PageResult;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.dto.HrResumeDto;

        import co.fuyond.dto.HrResumeQueryCriteria;

        import co.fuyond.modules.logging.aop.log.Log;

        import co.fuyond.service.HrResumeService;

        import io.swagger.annotations.Api;

        import io.swagger.annotations.ApiOperation;

        import lombok.AllArgsConstructor;

        import org.springframework.beans.factory.annotation.Autowired;

        import org.springframework.data.domain.Pageable;

        import org.springframework.http.HttpStatus;

        import org.springframework.http.ResponseEntity;

        import org.springframework.security.access.prepost.PreAuthorize;

        import org.springframework.validation.annotation.Validated;

        import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.Arrays;/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */

@AllArgsConstructor

@Api(tags = "WEBhr_resume管理")

@RestController

@RequestMapping("/api/hrResume")

public class HrResumeController {

    private final IGenerator generator;

    @Autowired

    private HrResumeService hrResumeService;    @Log("导出数据")

    @ApiOperation("web导出数据")

    @GetMapping(value = "/download")

    @PreAuthorize("@el.check('admin','hrResume:list')")

    public void download(HttpServletResponse response, HrResumeQueryCriteria criteria) throws IOException {

        hrResumeService.download(generator.convert(hrResumeService.queryAll(criteria), HrResumeDto.class), response);

    }    @GetMapping

    @Log("查询hr_resume")

    @ApiOperation("web查询hr_resume")

    @PreAuthorize("@el.check('admin','hrResume:list')")

    public ResponseEntity> getHrResumes(HrResumeQueryCriteria criteria, Pageable pageable) {

        return new ResponseEntity<>(hrResumeService.queryAll(criteria, pageable), HttpStatus.OK);

    }    @PostMapping

    @Log("新增hr_resume")

    @ApiOperation("web新增hr_resume")

    @PreAuthorize("@el.check('admin','hrResume:add')")

    public ResponseEntity create(@Validated @RequestBody HrResume resources) {

        return new ResponseEntity<>(hrResumeService.save(resources), HttpStatus.CREATED);

    }    @PutMapping

    @Log("修改hr_resume")

    @ApiOperation("web修改hr_resume")

    @PreAuthorize("@el.check('admin','hrResume:edit')")

    public ResponseEntity update(@Validated @RequestBody HrResume resources) {

        hrResumeService.updateById(resources);

        return new ResponseEntity<>(HttpStatus.NO_CONTENT);

    }    @Log("删除hr_resume")

    @ApiOperation("web删除hr_resume")

    @PreAuthorize("@el.check('admin','hrResume:del')")

    @DeleteMapping

    public ResponseEntity deleteAll(@RequestBody Long[] ids) {

        Arrays.asList(ids).forEach(id -> {

            hrResumeService.removeById(id);

        });

        return new ResponseEntity<>(HttpStatus.OK);

    }

}

package co.fuyond.controller;

        import co.fuyond.domain.HrResumeEducation;        import co.fuyond.domain.PageResult;        import co.fuyond.dozer.service.IGenerator;        import co.fuyond.dto.HrResumeEducationDto;        import co.fuyond.dto.HrResumeEducationQueryCriteria;        import co.fuyond.modules.logging.aop.log.Log;        import co.fuyond.service.HrResumeEducationService;        import io.swagger.annotations.Api;        import io.swagger.annotations.ApiOperation;        import lombok.AllArgsConstructor;        import org.springframework.beans.factory.annotation.Autowired;        import org.springframework.data.domain.Pageable;        import org.springframework.http.HttpStatus;        import org.springframework.http.ResponseEntity;        import org.springframework.security.access.prepost.PreAuthorize;        import org.springframework.validation.annotation.Validated;        import org.springframework.web.bind.annotation.*;

        import javax.servlet.http.HttpServletResponse;        import java.io.IOException;        import java.util.Arrays;

/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */@AllArgsConstructor@Api(tags = "WEBhr_resume_education管理")@RestController@RequestMapping("/api/hrResumeEducation")public class HrResumeEducationController {

    private final IGenerator generator;    @Autowired    private HrResumeEducationService hrResumeEducationService;

    @Log("导出数据")    @ApiOperation("导出数据")    @GetMapping(value = "/download")    @PreAuthorize("@el.check('admin','hrResumeEducation:list')")    public void download(HttpServletResponse response, HrResumeEducationQueryCriteria criteria) throws IOException {        hrResumeEducationService.download(generator.convert(hrResumeEducationService.queryAll(criteria), HrResumeEducationDto.class), response);    }

    @GetMapping    @Log("查询hr_resume_education")    @ApiOperation("查询hr_resume_education")    @PreAuthorize("@el.check('admin','hrResumeEducation:list')")    public ResponseEntity> getHrResumeEducations(HrResumeEducationQueryCriteria criteria, Pageable pageable) {        return new ResponseEntity<>(hrResumeEducationService.queryAll(criteria, pageable), HttpStatus.OK);    }

    @PostMapping    @Log("新增hr_resume_education")    @ApiOperation("新增hr_resume_education")    @PreAuthorize("@el.check('admin','hrResumeEducation:add')")    public ResponseEntity create(@Validated @RequestBody HrResumeEducation resources) {        return new ResponseEntity<>(hrResumeEducationService.save(resources), HttpStatus.CREATED);    }

    @PutMapping    @Log("修改hr_resume_education")    @ApiOperation("修改hr_resume_education")    @PreAuthorize("@el.check('admin','hrResumeEducation:edit')")    public ResponseEntity update(@Validated @RequestBody HrResumeEducation resources) {        hrResumeEducationService.updateById(resources);        return new ResponseEntity<>(HttpStatus.NO_CONTENT);    }

    @Log("删除hr_resume_education")    @ApiOperation("删除hr_resume_education")    @PreAuthorize("@el.check('admin','hrResumeEducation:del')")    @DeleteMapping    public ResponseEntity deleteAll(@RequestBody Long[] ids) {        Arrays.asList(ids).forEach(id -> {            hrResumeEducationService.removeById(id);        });        return new ResponseEntity<>(HttpStatus.OK);    }}package co.fuyond.controller;

        import co.fuyond.domain.HrResumeWork;        import co.fuyond.domain.PageResult;        import co.fuyond.dozer.service.IGenerator;        import co.fuyond.dto.HrResumeWorkDto;        import co.fuyond.dto.HrResumeWorkQueryCriteria;        import co.fuyond.modules.logging.aop.log.Log;        import co.fuyond.service.HrResumeWorkService;        import io.swagger.annotations.Api;        import io.swagger.annotations.ApiOperation;        import lombok.AllArgsConstructor;        import org.springframework.beans.factory.annotation.Autowired;        import org.springframework.data.domain.Pageable;        import org.springframework.http.HttpStatus;        import org.springframework.http.ResponseEntity;        import org.springframework.security.access.prepost.PreAuthorize;        import org.springframework.validation.annotation.Validated;        import org.springframework.web.bind.annotation.*;

        import javax.servlet.http.HttpServletResponse;        import java.io.IOException;        import java.util.Arrays;

/**

 * @author liutao

 * @createDate 2023-03-27 13:24:00

 */@AllArgsConstructor@Api(tags = "WEBhr_resume_work管理")@RestController@RequestMapping("/api/hrResumeWork")public class HrResumeWorkController {

    private final IGenerator generator;    @Autowired    private HrResumeWorkService hrResumeWorkService;

    @Log("导出数据")    @ApiOperation("导出数据")    @GetMapping(value = "/download")    @PreAuthorize("@el.check('admin','hrResumeWork:list')")    public void download(HttpServletResponse response, HrResumeWorkQueryCriteria criteria) throws IOException {        hrResumeWorkService.download(generator.convert(hrResumeWorkService.queryAll(criteria), HrResumeWorkDto.class), response);    }

    @GetMapping    @Log("查询hr_resume_work")    @ApiOperation("查询hr_resume_work")    @PreAuthorize("@el.check('admin','hrResumeWork:list')")    public ResponseEntity> getHrResumeWorks(HrResumeWorkQueryCriteria criteria, Pageable pageable) {        return new ResponseEntity<>(hrResumeWorkService.queryAll(criteria, pageable), HttpStatus.OK);    }

    @PostMapping    @Log("新增hr_resume_work")    @ApiOperation("新增hr_resume_work")    @PreAuthorize("@el.check('admin','hrResumeWork:add')")    public ResponseEntity create(@Validated @RequestBody HrResumeWork resources) {        return new ResponseEntity<>(hrResumeWorkService.save(resources), HttpStatus.CREATED);    }

    @PutMapping    @Log("修改hr_resume_work")    @ApiOperation("修改hr_resume_work")    @PreAuthorize("@el.check('admin','hrResumeWork:edit')")    public ResponseEntity update(@Validated @RequestBody HrResumeWork resources) {        hrResumeWorkService.updateById(resources);        return new ResponseEntity<>(HttpStatus.NO_CONTENT);    }

    @Log("删除hr_resume_work")    @ApiOperation("删除hr_resume_work")    @PreAuthorize("@el.check('admin','hrResumeWork:del')")    @DeleteMapping    public ResponseEntity deleteAll(@RequestBody Long[] ids) {        Arrays.asList(ids).forEach(id -> {            hrResumeWorkService.removeById(id);        });        return new ResponseEntity<>(HttpStatus.OK);    }}

package co.fuyond.modules.tools.rest;import co.fuyond.modules.tools.domain.VerificationCode;

        import co.fuyond.modules.tools.domain.vo.EmailVo;

        import co.fuyond.modules.tools.service.EmailConfigService;

        import co.fuyond.modules.tools.service.VerificationCodeService;

        import co.fuyond.utils.FyConstant;

        import io.swagger.annotations.Api;

        import io.swagger.annotations.ApiOperation;

        import org.springframework.http.HttpStatus;

        import org.springframework.http.ResponseEntity;

        import org.springframework.web.bind.annotation.*;@RestController

@RequestMapping("/api/code")

@Api(tags = "工具:验证码管理")

public class VerificationCodeController {

    private final VerificationCodeService verificationCodeService;

    private final EmailConfigService emailService;    public VerificationCodeController(VerificationCodeService verificationCodeService, EmailConfigService emailService) {

        this.verificationCodeService = verificationCodeService;

        this.emailService = emailService;

    }    @PostMapping(value = "/resetEmail")

    @ApiOperation("重置邮箱,发送验证码")

    public ResponseEntity resetEmail(@RequestBody VerificationCode code) throws Exception {

        code.setScenes(FyConstant.RESET_MAIL);

        EmailVo emailVo = verificationCodeService.sendEmail(code);

        emailService.send(emailVo, emailService.find());

        return new ResponseEntity<>(HttpStatus.OK);

    }    @PostMapping(value = "/email/resetPass")

    @ApiOperation("重置密码,发送验证码")

    public ResponseEntity resetPass(@RequestParam String email) throws Exception {

        VerificationCode code = new VerificationCode();

        code.setType("email");

        code.setValue(email);

        code.setScenes(FyConstant.RESET_MAIL);

        EmailVo emailVo = verificationCodeService.sendEmail(code);

        emailService.send(emailVo, emailService.find());

        return new ResponseEntity<>(HttpStatus.OK);

    }    @GetMapping(value = "/validated")

    @ApiOperation("验证码验证")

    public ResponseEntity validated(VerificationCode code) {

        verificationCodeService.validated(code);

        return new ResponseEntity<>(HttpStatus.OK);

    }

}package co.fuyond.modules.tools.service;import co.fuyond.common.service.BaseService;

        import co.fuyond.modules.tools.domain.AlipayConfig;

        import co.fuyond.modules.tools.domain.vo.TradeVo;/**

 * @author hupeng

 */

public interface AlipayConfigService extends BaseService {

    /**

     * 处理来自PC的交易请求

     *

     * @param alipay 支付宝配置

     * @param trade  交易详情

     * @return String

     * @throws Exception 异常

     */

    String toPayAsPc(AlipayConfig alipay, TradeVo trade) throws Exception;    /**

     * 处理来自手机网页的交易请求

     *

     * @param alipay 支付宝配置

     * @param trade  交易详情

     * @return String

     * @throws Exception 异常

     */

    String toPayAsWeb(AlipayConfig alipay, TradeVo trade) throws Exception;    /**

     * 查询配置

     *

     * @return AlipayConfig

     */

    AlipayConfig find();    /**

     * 更新配置

     *

     * @param alipayConfig 支付宝配置

     * @return AlipayConfig

     */

    void update(AlipayConfig alipayConfig);

}package co.fuyond.modules.tools.service;import co.fuyond.common.service.BaseService;

        import co.fuyond.modules.tools.domain.EmailConfig;

        import co.fuyond.modules.tools.domain.vo.EmailVo;

        import org.springframework.scheduling.annotation.Async;/**

 * @author hupeng

 */

public interface EmailConfigService extends BaseService {

    /**

     * 更新邮件配置

     *

     * @param emailConfig 邮件配置

     * @param old         旧的配置

     * @return EmailConfig

     */

    void update(EmailConfig emailConfig, EmailConfig old);    /**

     * 查询配置

     *

     * @return EmailConfig 邮件配置

     */

    EmailConfig find();    /**

     * 发送邮件

     *

     * @param emailVo     邮件发送的内容

     * @param emailConfig 邮件配置

     * @throws Exception /

     */

    @Async

    void send(EmailVo emailVo, EmailConfig emailConfig) throws Exception;

}package co.fuyond.modules.tools.service;import co.fuyond.common.service.BaseService;

        import co.fuyond.modules.tools.domain.LocalStorage;

        import co.fuyond.modules.tools.service.dto.LocalStorageDto;

        import co.fuyond.modules.tools.service.dto.LocalStorageQueryCriteria;

        import org.springframework.data.domain.Pageable;

        import org.springframework.web.multipart.MultipartFile;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.List;

        import java.util.Map;/**

 * @author hupeng

 */

public interface LocalStorageService extends BaseService {

    /**

     * 分页查询

     *

     * @param criteria 条件

     * @param pageable 分页参数

     * @return /

     */

    Map queryAll(LocalStorageQueryCriteria criteria, Pageable pageable);    /**

     * 查询全部数据

     *

     * @param criteria 条件

     * @return /

     */

    List queryAll(LocalStorageQueryCriteria criteria);    /**

     * 根据ID查询

     *

     * @param id /

     * @return /

     */

    LocalStorageDto findById(Long id);    /**

     * 上传

     *

     * @param name 文件名称

     * @param file 文件

     * @return /

     */

    LocalStorageDto create(String name, MultipartFile file);    /**

     * 多选删除

     *

     * @param ids /

     */

    void deleteAll(Long[] ids);    /**

     * 导出数据

     *

     * @param localStorageDtos 待导出的数据

     * @param response         /

     * @throws IOException /

     */

    void download(List localStorageDtos, HttpServletResponse response) throws IOException;    /**

     * 修改文件

     *

     * @param resources

     */

    void updateLocalStorage(LocalStorageDto resources);

}

package co.fuyond.modules.mp.listener;

        import cn.hutool.core.util.NumberUtil;

        import cn.hutool.core.util.ObjectUtil;

        import cn.hutool.core.util.StrUtil;

        import co.fuyond.constant.ShopConstants;

        import co.fuyond.enums.BillDetailEnum;

        import co.fuyond.enums.PayTypeEnum;

        import co.fuyond.event.TemplateBean;

        import co.fuyond.event.TemplateEvent;

        import co.fuyond.event.TemplateListenEnum;

        import co.fuyond.modules.activity.domain.YxUserExtract;

        import co.fuyond.modules.activity.service.YxUserExtractService;

        import co.fuyond.modules.customer.domain.YxStoreCustomer;

        import co.fuyond.modules.customer.service.YxStoreCustomerService;

        import co.fuyond.modules.mp.service.WeiXinSubscribeService;

        import co.fuyond.modules.mp.service.WeixinPayService;

        import co.fuyond.modules.mp.service.WeixinTemplateService;

        import co.fuyond.modules.user.domain.YxUser;

        import co.fuyond.modules.user.service.YxUserBillService;

        import co.fuyond.modules.user.service.YxUserService;

        import co.fuyond.modules.user.service.dto.WechatUserDto;

        import com.github.binarywang.wxpay.exception.WxPayException;

        import lombok.extern.slf4j.Slf4j;

        import org.springframework.beans.factory.annotation.Autowired;

        import org.springframework.context.ApplicationEvent;

        import org.springframework.context.event.SmartApplicationListener;

        import org.springframework.scheduling.annotation.Async;

        import org.springframework.stereotype.Component;import java.math.BigDecimal;

        import java.util.Date;

        import java.util.List;

        import java.util.UUID;/**

 * @author hupeng

 * 异步监听模板通知事件

 */

@Slf4j

@Component

public class TemplateListener implements SmartApplicationListener {

    @Autowired

    private YxUserService userService;

    @Autowired

    private WeixinTemplateService weixinTemplateService;

    @Autowired

    private WeixinPayService weixinPayService;

    @Autowired

    private WeiXinSubscribeService weiXinSubscribeService;

    @Autowired

    private YxUserExtractService yxUserExtractService;

    @Autowired

    private WeixinPayService payService;

    @Autowired

    private YxUserBillService billService;

    @Autowired

    private YxStoreCustomerService yxStoreCustomerService;    //@Autowired

    //private MqProducer mqProducer;    @Override

    public boolean supportsEventType(Class aClass) {

        return aClass == TemplateEvent.class;

    }    @Async

    @Override

    public void onApplicationEvent(ApplicationEvent applicationEvent) {

        //转换事件类型

        TemplateEvent templateEvent = (TemplateEvent) applicationEvent;

        //获取注册用户对象信息

        TemplateBean templateBean = templateEvent.getTemplateBean();

        log.info("模板事件类型:{}", templateBean.getTemplateType());

        switch (TemplateListenEnum.toType(templateBean.getTemplateType())) {

            case TYPE_1:

                weixinTemplateService.paySuccessNotice(templateBean.getOrderId()

                        , templateBean.getPrice(), templateBean.getUid());

                weiXinSubscribeService.paySuccessNotice(templateBean.getOrderId()

                        , templateBean.getPrice(), templateBean.getUid());

                /**************给客服发送消息**************/

                try {

                    List yxStoreCustomers = yxStoreCustomerService.lambdaQuery().eq(YxStoreCustomer::getIsEnable, ShopConstants.FY_ONE_NUM).list();

                    yxStoreCustomers.forEach(msg -> {

                        if (StrUtil.isNotBlank(msg.getOpenId())) {

                            weixinTemplateService.paySuccessNoticeToKefu(templateBean.getOrderId()

                                    , templateBean.getPrice(), msg.getOpenId());

                        }

                    });

                } catch (Exception e) {

                    log.error("消息发送失败:{}", e);

                }

             

        try {

            wxPayService.refundV2(wxPayRefundRequest);

        } catch (WxPayException e) {

            log.info("退款错误信息:{}", e.getMessage());

            throw new BusinessException(e.getMessage());

        }

    }    /**

     * 企业打款

     *

     * @param openid   微信openid

     * @param no       单号

     * @param userName 用户姓名

     * @param amount   金额

     * @throws WxPayException

     */

    public void entPay(String openid, String no, String userName, Integer amount) throws WxPayException {

        WxPayService wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WECHAT);

        EntPayRequest entPayRequest = new EntPayRequest();

        entPayRequest.setOpenid(openid);

        entPayRequest.setPartnerTradeNo(no);

        entPayRequest.setCheckName("FORCE_CHECK");

        entPayRequest.setReUserName(userName);

        entPayRequest.setAmount(amount);

        entPayRequest.setDescription("提现");

        entPayRequest.setSpbillCreateIp(IpUtil.getLocalIP());

        wxPayService.getEntPayService().entPay(entPayRequest);

    }    /**

     * 返回H5 url

     *

     * @return url

     */

    private String getApiUrl() {

        String apiUrl = redisUtils.getY(ShopKeyUtils.getApiUrl());

        if (StrUtil.isBlank(apiUrl)) {

            throw new FyException("请配置移动端api地址");

        }

        return apiUrl;

    }

}

package co.fuyond.modules.mp.service;

        import cn.binarywang.wx.miniapp.api.WxMaService;        import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;        import cn.hutool.core.util.StrUtil;        import co.fuyond.api.FyException;        import co.fuyond.constant.ShopConstants;        import co.fuyond.enums.ShopCommonEnum;        import co.fuyond.modules.mp.config.WxMaConfiguration;        import co.fuyond.modules.mp.domain.YxWechatTemplate;        import co.fuyond.modules.mp.enums.WechatTempateEnum;        import co.fuyond.modules.user.domain.YxUser;        import co.fuyond.modules.user.service.YxUserService;        import co.fuyond.modules.user.service.dto.WechatUserDto;        import me.chanjar.weixin.common.error.WxErrorException;        import org.springframework.beans.factory.annotation.Autowired;        import org.springframework.stereotype.Service;

        import java.text.SimpleDateFormat;        import java.util.Date;        import java.util.HashMap;        import java.util.Map;

/**

 * 小程序订阅消息通知

 */@Servicepublic class WeiXinSubscribeService {

    @Autowired    private YxUserService userService;    @Autowired    private YxWechatTemplateService yxWechatTemplateService;    /**

     * 充值成功通知

     *

     * @param time  时间

     * @param price 金额

     * @param uid   uid

     */    public void rechargeSuccessNotice(String time, String price, Long uid) {        String openid = this.getUserOpenid(uid);

        if (StrUtil.isBlank(openid)) {            return;        }

        Map map = new HashMap<>();        map.put("first", "您的账户金币发生变动,详情如下:");        map.put("keyword1", "充值");        map.put("keyword2", time);        map.put("keyword3", price);        map.put("remark", ShopConstants.FY_WECHAT_PUSH_REMARK);        String tempId = this.getTempId(WechatTempateEnum.RECHARGE_SUCCESS.getValue());        if (StrUtil.isNotBlank(tempId)) {            this.sendSubscribeMsg(openid, tempId, "/user/account", map);        }    }

    /**

     * 支付成功通知

     *

     * @param orderId 订单号

     * @param price   金额

     * @param uid     uid

     */    public void paySuccessNotice(String orderId, String price, Long uid) {

        String openid = this.getUserOpenid(uid);        if (StrUtil.isBlank(openid)) {            return;        }        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");        Map map = new HashMap<>();        map.put("amount1", price);        map.put("date2", simpleDateFormat.format(new Date()));        map.put("character_string3", orderId);        map.put("time4", simpleDateFormat.format(new Date()));        map.put("thing5", "fy");        String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());        if (StrUtil.isNotBlank(tempId)) {            this.sendSubscribeMsg(openid, tempId, "/order/detail/" + orderId, map);        }    }

    /**

     * 退款成功通知

     *

     * @param orderId 订单号

     * @param price   金额

     * @param uid     uid

     * @param time    时间

     */    public void refundSuccessNotice(String orderId, String price, Long uid, String time) {

        String openid = this.getUserOpenid(uid);

        if (StrUtil.isBlank(openid)) {            return;        }

        Map map = new HashMap<>();        map.put("first", "您的订单退款申请被通过,钱款将很快还至您的支付账户。");        //订单号        map.put("keyword1", orderId);        map.put("keyword2", price);        map.put("keyword3", time);        map.put("remark", ShopConstants.FY_WECHAT_PUSH_REMARK);        String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());        if (StrUtil.isNotBlank(tempId)) {            this.sendSubscribeMsg(openid, tempId, "/order/detail/" + orderId, map);        }    }

    /**

     * 成功通知

     *

     * @param orderId      单号

     * @param deliveryName

     * @param deliveryId   单号

     * @param uid          uid

     */    public void deliverySuccessNotice(String orderId, String deliveryName,                                      String deliveryId, Long uid) {

        String openid = this.getUserOpenid(uid);

        if (StrUtil.isEmpty(openid)) {            return;        }

        Map map = new HashMap<>();        map.put("first", "亲,宝贝已经启程了,好想快点来到你身边。");        map.put("keyword2", deliveryName);        map.put("keyword1", orderId);        map.put("keyword3", deliveryId);        map.put("remark", ShopConstants.FY_WECHAT_PUSH_REMARK);        String tempId = this.getTempId(WechatTempateEnum.DELIVERY_SUCCESS.getValue());        if (StrUtil.isNotBlank(tempId)) {            this.sendSubscribeMsg(openid, tempId, "/order/detail/" + orderId, map);        }    }

    /**

     * 构建小程序一次性订阅消息

     *

     * @param openId     单号

     * @param templateId 模板id

     * @param page       跳转页面

     * @param map        map内容

     * @return String

     */    private void sendSubscribeMsg(String openId, String templateId, String page, Map map) {        WxMaSubscribeMessage wxMaSubscribeMessage = WxMaSubscribeMessage.builder()                .toUser(openId)                .templateId(templateId)                .page(page)                .build();        map.forEach((k, v) -> {

            wxMaSubscribeMessage.addData(new WxMaSubscribeMessage.MsgData(k, v));

        });        WxMaService wxMaService = WxMaConfiguration.getWxMaService();        try {            wxMaService.getMsgService().sendSubscribeMsg(wxMaSubscribeMessage);        } catch (WxErrorException e) {            e.printStackTrace();        }    }

    /**

     * 获取模板消息id

     *

     * @param key 模板key

     * @return string

     */    private String getTempId(String key) {        YxWechatTemplate yxWechatTemplate = yxWechatTemplateService.lambdaQuery()                .eq(YxWechatTemplate::getType, "subscribe")                .eq(YxWechatTemplate::getTempkey, key)                .one();        if (yxWechatTemplate == null) {            throw new FyException("请后台配置key:" + key + "订阅消息id");        }        if (ShopCommonEnum.IS_STATUS_0.getValue().equals(yxWechatTemplate.getStatus())) {            return "";        }        return yxWechatTemplate.getTempid();    }

    /**

     * 获取openid

     *

     * @param uid uid

     * @return String

     */    private String getUserOpenid(Long uid) {        YxUser yxUser = userService.getById(uid);        if (yxUser == null) {            return "";        }

        WechatUserDto wechatUserDto = yxUser.getWxProfile();        if (wechatUserDto == null) {            return "";        }        if (StrUtil.isBlank(wechatUserDto.getRoutineOpenid())) {            return "";        }        return wechatUserDto.getRoutineOpenid();

    }}

package co.fuyond.modules.mp.service.dto;import lombok.Data;import java.io.Serializable;/**

 * @author hupeng

 */

@Data

public class YxWechatReplyDto implements Serializable {

    /**

     * 微信关键字回复id

     */

    private Integer id;

    /**

     * 关键字

     */

    private String key;

    /**

     * 回复类型

     */

    private String type;

    /**

     * 回复数据

     */

    private String data;

    /**

     * 0=不可用  1 =可用

     */

    private Integer status;

    /**

     * 是否隐藏

     */

    private Integer hide;

}package co.fuyond.modules.mp.service.dto;import lombok.Data;/**

 * @author hupeng

 */

@Data

public class YxWechatReplyQueryCriteria {

}package co.fuyond.modules.mp.service.dto;import lombok.Data;import java.io.Serializable;/**

 * @author hupeng

 */

@Data

public class YxWechatTemplateDto implements Serializable {

    /**

     * 模板id

     */

    private Integer id;

    /**

     * 模板编号

     */

    private String tempkey;

    /**

     * 模板名

     */

    private String name;

    /**

     * 回复内容

     */

    private String content;

    /**

     * 模板ID

     */

    private String tempid;

    /**

     * 添加时间

     */

    private String addTime;

    /**

     * 状态

     */

    private Integer status;

    /**

     * 类型:template:模板消息 subscribe:订阅消息

     */

    private String type;

}package co.fuyond.modules.mp.service.dto;import lombok.Data;/**

 * @author hupeng

 */

@Data

public class YxWechatTemplateQueryCriteria {

}package co.fuyond.modules.mp.service.impl;import co.fuyond.common.service.impl.BaseServiceImpl;

        import co.fuyond.common.utils.QueryHelpPlus;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.modules.mp.domain.YxArticle;

        import co.fuyond.modules.mp.service.YxArticleService;

        import co.fuyond.modules.mp.service.dto.YxArticleDto;

        import co.fuyond.modules.mp.service.dto.YxArticleQueryCriteria;

        import co.fuyond.modules.mp.service.mapper.ArticleMapper;

        import co.fuyond.modules.mp.vo.YxArticleQueryVo;

        import co.fuyond.utils.FileUtil;

        import com.baomidou.mybatisplus.core.metadata.IPage;

        import com.baomidou.mybatisplus.core.toolkit.Wrappers;

        import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

        import com.github.pagehelper.PageInfo;

        import lombok.extern.slf4j.Slf4j;

        import org.springframework.beans.factory.annotation.Value;

        import org.springframework.data.domain.Pageable;

        import org.springframework.stereotype.Service;

        import org.springframework.transaction.annotation.Propagation;

        import org.springframework.transaction.annotation.Transactional;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.ArrayList;

        import java.util.LinkedHashMap;

        import java.util.List;

        import java.util.Map;/**

 * @author hupeng

 */

@Slf4j

@Service

@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)

public class YxArticleServiceImpl extends BaseServiceImpl implements YxArticleService {

    private final IGenerator generator;

    private final ArticleMapper articleMapper;

    @Value("${file.path}")

    private String uploadDirStr;    public YxArticleServiceImpl(IGenerator generator, ArticleMapper articleMapper) {

        this.generator = generator;

        this.articleMapper = articleMapper;

    }    /**

     * 获取列表

     *

     * @param page  页码

     * @param limit 条数

     * @return List

     */

    @Override

    public List getList(int page, int limit) {

        Page pageModel = new Page<>(page, limit);

        IPage pageList = articleMapper.selectPage(pageModel, Wrappers.lambdaQuery()

                .orderByDesc(YxArticle::getId));

        return generator.convert(pageList.getRecords(), YxArticleQueryVo.class);

    }    /**

     * 获取详情

     *

     * @param id id

     * @return YxArticleQueryVo

     */

    @Override

    public YxArticleQueryVo getDetail(int id) {

        return generator.convert(this.getById(id), YxArticleQueryVo.class);

    }    @Override

    public void incVisitNum(int id) {

        articleMapper.incVisitNum(id);

    }    @Override

    //@Cacheable

    public Map queryAll(YxArticleQueryCriteria criteria, Pageable pageable) {

        getPage(pageable);

        PageInfo page = new PageInfo<>(queryAll(criteria));

        Map map = new LinkedHashMap<>(2);

        map.put("content", generator.convert(page.getList(), YxArticleDto.class));

        map.put("totalElements", page.getTotal());

        return map;

    }    @Override

    //@Cacheable

    public List queryAll(YxArticleQueryCriteria criteria) {

        return baseMapper.selectList(QueryHelpPlus.getPredicate(YxArticle.class, criteria));

    }    @Override

    public void download(List all, HttpServletResponse response) throws IOException {

        List> list = new ArrayList<>();

        for (YxArticleDto yxArticle : all) {

            Map map = new LinkedHashMap<>();

            map.put("分类id", yxArticle.getCid());

            map.put("标题", yxArticle.getTitle());

            map.put("作者", yxArticle.getAuthor());

            map.put("图片", yxArticle.getImageInput());

            map.put("简介", yxArticle.getSynopsis());

            map.put(" content", yxArticle.getContent());

            map.put("分享标题", yxArticle.getShareTitle());

            map.put("分享简介", yxArticle.getShareSynopsis());

            map.put("浏览次数", yxArticle.getVisit());

            map.put("排序", yxArticle.getSort());

            map.put("原文链接", yxArticle.getUrl());

            map.put("状态", yxArticle.getStatus());

            map.put("是否隐藏", yxArticle.getHide());

            map.put("管理员id", yxArticle.getAdminId());

            map.put("商户id", yxArticle.getMerId());

            map.put("关联id", yxArticle.getProductId());

            map.put("是否热门(小程序)", yxArticle.getIsHot());

            map.put("是否轮播图(小程序)", yxArticle.getIsBanner());

            list.add(map);

        }

        FileUtil.downloadExcel(list, response);

    }

}package co.fuyond.modules.mp.service.impl;import cn.binarywang.wx.miniapp.api.WxMaService;

        import cn.binarywang.wx.miniapp.bean.live.WxMaLiveGoodInfo;

        import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult;

        import cn.hutool.core.util.ObjectUtil;

        import cn.hutool.http.HttpUtil;

        import cn.hutool.json.JSONUtil;

        import co.fuyond.common.service.impl.BaseServiceImpl;

        import co.fuyond.common.utils.QueryHelpPlus;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.enums.LiveGoodsEnum;

        import co.fuyond.exception.BadRequestException;

        import co.fuyond.modules.mp.config.WxMaConfiguration;

        import co.fuyond.modules.mp.domain.YxWechatLiveGoods;

        import co.fuyond.modules.mp.service.YxWechatLiveGoodsService;

        import co.fuyond.modules.mp.service.dto.YxWechatLiveGoodsDto;

        import co.fuyond.modules.mp.service.dto.YxWechatLiveGoodsQueryCriteria;

        import co.fuyond.modules.mp.service.mapper.YxWechatLiveGoodsMapper;

        import co.fuyond.utils.FileUtil;

        import com.github.pagehelper.PageInfo;

        import lombok.extern.slf4j.Slf4j;

        import me.chanjar.weixin.common.api.WxConsts;

        import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;

        import me.chanjar.weixin.common.error.WxErrorException;

        import org.springframework.beans.factory.annotation.Value;

        import org.springframework.data.domain.Pageable;

        import org.springframework.stereotype.Service;

        import org.springframework.transaction.annotation.Propagation;

        import org.springframework.transaction.annotation.Transactional;import javax.servlet.http.HttpServletResponse;

        import java.io.File;

        import java.io.IOException;

        import java.util.ArrayList;

        import java.util.LinkedHashMap;

        import java.util.List;

        import java.util.Map;/**

 * @author hupeng

 */

@Slf4j

@Service

//@CacheConfig(cacheNames = "yxWechatLiveGoods")

@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = Exception.class)

public class YxWechatLiveGoodsServiceImpl extends BaseServiceImpl implements YxWechatLiveGoodsService {

    private final IGenerator generator;

    @Value("${file.path}")

    private String uploadDirStr;    public YxWechatLiveGoodsServiceImpl(IGenerator generator) {

        this.generator = generator;

    }    /**

     * 同步更新审核状态

     *

     * @return

     */

    //@Cacheable

    @Override

    public boolean synchroWxOlLive(List goodsIds) {

        try {

            WxMaService wxMaService = WxMaConfiguration.getWxMaService();

            WxMaLiveResult liveInfos = wxMaService.getLiveGoodsService().getGoodsWareHouse(goodsIds);

            List convert = generator.convert(liveInfos.getGoods(), YxWechatLiveGoods.class);

            this.saveOrUpdateBatch(convert);

        } catch (WxErrorException e) {

            e.printStackTrace();

        }

        return true;

    }    @Override

    public void removeGoods(Long id) {

        this.removeById(id);

        try {

            WxMaService wxMaService = WxMaConfiguration.getWxMaService();

            wxMaService.getLiveGoodsService().deleteGoods(id.intValue());

        } catch (WxErrorException e) {

            e.printStackTrace();

        }

    }    /**

     * 更新信息

     *

     * @param resources

     */

    @Override

    public void updateGoods(YxWechatLiveGoods resources) {

        YxWechatLiveGoods wechatLiveGoods = this.getById(resources.getGoodsId());

        try {

            WxMaService wxMaService = WxMaConfiguration.getWxMaService();

            WxMaLiveGoodInfo goods = generator.convert(resources, WxMaLiveGoodInfo.class);

            if (ObjectUtil.isNotEmpty(wechatLiveGoods)) {

                /** 审核状态 0:未审核,1:审核中,2:审核通过,3审核失败 */

                if (LiveGoodsEnum.IS_Audit_2.getValue().equals(wechatLiveGoods.getAuditStatus())) {

                } else if (LiveGoodsEnum.IS_Audit_0.getValue().equals(wechatLiveGoods.getAuditStatus())) {

                    resources.setCoverImgUrl(uploadPhotoToWx(wxMaService, resources.getCoverImgeUrl()).getMediaId());

                } else if (LiveGoodsEnum.IS_Audit_1.getValue().equals(wechatLiveGoods.getAuditStatus())) {

                    throw new BadRequestException("审核中不允许修改");

                } else if (LiveGoodsEnum.IS_Audit_3.getValue().equals(wechatLiveGoods.getAuditStatus())) {

                    resources.setCoverImgUrl(uploadPhotoToWx(wxMaService, resources.getCoverImgeUrl()).getMediaId());

                    wxMaService.getLiveGoodsService().updateGoods(goods);

                    wxMaService.getLiveGoodsService().auditGoods(goods.getGoodsId());

                    return;

                }

            }

            boolean wxMaLiveResult = wxMaService.getLiveGoodsService().updateGoods(goods);

            this.saveOrUpdate(resources);

        } catch (WxErrorException e) {

            throw new BadRequestException(e.toString());

        }

    }    /**

     * 查询数据分页

     *

     * @param criteria 条件

     * @param pageable 分页参数

     * @return Map

     */

    @Override

    //@Cacheable

    public Map queryAll(YxWechatLiveGoodsQueryCriteria criteria, Pageable pageable) {

        getPage(pageable);

        PageInfo page = new PageInfo<>(queryAll(criteria));

        Map map = new LinkedHashMap<>(2);

        List goodsDtos = generator.convert(page.getList(), YxWechatLiveGoodsDto.class);

        goodsDtos.forEach(i -> {

            i.setId(i.getGoodsId());

        });

        map.put("content", goodsDtos);

        map.put("totalElements", page.getTotal());

        return map;

    }    /**

     * 查询所有数据不分页

     *

     * @param criteria 条件参数

     * @return List

     */

    @Override

    //@Cacheable

    public List queryAll(YxWechatLiveGoodsQueryCriteria criteria) {

        return baseMapper.selectList(QueryHelpPlus.getPredicate(YxWechatLiveGoods.class, criteria));

    }    /**

     * 导出数据

     *

     * @param all      待导出的数据

     * @param response /

     * @throws IOException /

     */

    @Override

    public void download(List all, HttpServletResponse response) throws IOException {

        List> list = new ArrayList<>();

        for (YxWechatLiveGoodsDto yxWechatLiveGoods : all) {

            Map map = new LinkedHashMap<>();

            map.put("关联id", yxWechatLiveGoods.getProductId());

            map.put("图片", yxWechatLiveGoods.getCoverImgeUrl());

            map.put("小程序路径", yxWechatLiveGoods.getUrl());

            map.put("价格类型 1:一口价(只需要传入price,price2不传) 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传) 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传)", yxWechatLiveGoods.getPriceType());

            map.put(" price", yxWechatLiveGoods.getPrice());

            map.put(" price2", yxWechatLiveGoods.getPrice2());

            map.put("名称", yxWechatLiveGoods.getName());

            map.put("1, 2:表示是为api添加,否则是控制台添加的", yxWechatLiveGoods.getThirdPartyTag());

            map.put("审核单id", yxWechatLiveGoods.getAuditId());

            map.put("审核状态 0:未审核,1:审核中,2:审核通过,3审核失败", yxWechatLiveGoods.getAuditStatus());

            list.add(map);

        }

        FileUtil.downloadExcel(list, response);

    }    /**

     * 保存信息

     *

     * @param resources

     * @return

     */

    @Override

    public boolean saveGoods(YxWechatLiveGoods resources) {

        WxMaService wxMaService = WxMaConfiguration.getWxMaService();

        try {

            resources.setCoverImgUrl(uploadPhotoToWx(wxMaService, resources.getCoverImgeUrl()).getMediaId());

            WxMaLiveGoodInfo goods = generator.convert(resources, WxMaLiveGoodInfo.class);

            WxMaLiveResult wxMaLiveResult = wxMaService.getLiveGoodsService().addGoods(goods);

            resources.setGoodsId(Long.valueOf(wxMaLiveResult.getGoodsId()));

            resources.setAuditId(Long.valueOf(wxMaLiveResult.getAuditId()));

            this.save(resources);

        } catch (WxErrorException e) {

            throw new BadRequestException(e.toString());

        }

        return true;

    }    /**

     * 上传临时素材

     *

     * @param wxMaService WxMaService

     * @param picPath     图片路径

     * @return WxMpMaterialUploadResult

     * @throws WxErrorException

     */

    private WxMediaUploadResult uploadPhotoToWx(WxMaService wxMaService, String picPath) throws WxErrorException {

        String filename = (int) System.currentTimeMillis() + ".png";

        String downloadPath = uploadDirStr + filename;

        long size = HttpUtil.downloadFile(picPath, cn.hutool.core.io.FileUtil.file(downloadPath));

        picPath = downloadPath;

        File picFile = new File(picPath);

        log.info("picFile name : {}", picFile.getName());

        WxMediaUploadResult wxMediaUploadResult = wxMaService.getMediaService().uploadMedia(WxConsts.MediaFileType.IMAGE, picFile);

        log.info("wxMpMaterialUploadResult : {}", JSONUtil.toJsonStr(wxMediaUploadResult));

        return wxMediaUploadResult;

    }

}package co.fuyond.modules.mp.service.impl;import cn.binarywang.wx.miniapp.api.WxMaService;

        import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult;

        import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;

        import cn.hutool.http.HttpUtil;

        import cn.hutool.json.JSONUtil;

        import co.fuyond.common.service.impl.BaseServiceImpl;

        import co.fuyond.common.utils.QueryHelpPlus;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.exception.BadRequestException;

        import co.fuyond.modules.mp.config.WxMaConfiguration;

        import co.fuyond.modules.mp.domain.YxWechatLive;

        import co.fuyond.modules.mp.domain.YxWechatLiveGoods;

        import co.fuyond.modules.mp.service.YxWechatLiveGoodsService;

        import co.fuyond.modules.mp.service.YxWechatLiveService;

        import co.fuyond.modules.mp.service.dto.*;

        import co.fuyond.modules.mp.service.mapper.YxWechatLiveMapper;

        import co.fuyond.modules.mp.vo.WechatLiveVo;

        import co.fuyond.utils.FileUtil;

        import co.fuyond.utils.OrderUtil;

        import co.fuyond.utils.StringUtils;

        import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

        import com.baomidou.mybatisplus.core.metadata.IPage;

        import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

        import com.github.pagehelper.PageHelper;

        import com.github.pagehelper.PageInfo;

        import com.google.gson.JsonObject;

        import lombok.extern.slf4j.Slf4j;

        import me.chanjar.weixin.common.api.WxConsts;

        import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;

        import me.chanjar.weixin.common.enums.WxType;

        import me.chanjar.weixin.common.error.WxError;

        import me.chanjar.weixin.common.error.WxErrorException;

        import me.chanjar.weixin.common.util.json.GsonParser;

        import org.springframework.beans.factory.annotation.Value;

        import org.springframework.data.domain.Pageable;

        import org.springframework.stereotype.Service;

        import org.springframework.transaction.annotation.Propagation;

        import org.springframework.transaction.annotation.Transactional;import javax.servlet.http.HttpServletResponse;

        import java.io.File;

        import java.io.IOException;

        import java.util.ArrayList;

        import java.util.LinkedHashMap;

        import java.util.List;

        import java.util.Map;import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Broadcast.Room.CREATE_ROOM;/**

 * @author hupeng

 */

@Service

//@CacheConfig(cacheNames = "yxWechatLive")

@Slf4j

@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = Exception.class)

public class YxWechatLiveServiceImpl extends BaseServiceImpl implements YxWechatLiveService {

    private final IGenerator generator;

    @Value("${file.path}")

    private String uploadDirStr;

    private final YxWechatLiveGoodsService wechatLiveGoodsService;

    private final YxWechatLiveMapper wechatLiveMapper;    public YxWechatLiveServiceImpl(IGenerator generator, YxWechatLiveGoodsService wechatLiveGoodsService, YxWechatLiveMapper wechatLiveMapper) {

        this.generator = generator;

        this.wechatLiveGoodsService = wechatLiveGoodsService;

        this.wechatLiveMapper = wechatLiveMapper;

    }    /**

     * 同步间

     *

     * @return

     */

    //@Cacheable

    @Override

    public boolean synchroWxOlLive() {

        try {

            WxMaService wxMaService = WxMaConfiguration.getWxMaService();

            List liveInfos = wxMaService.getLiveService().getLiveInfos();

            List convert = generator.convert(liveInfos, YxWechatLive.class);

            this.saveOrUpdateBatch(convert);

        } catch (WxErrorException e) {

            e.printStackTrace();

        }

        return true;

    }    @Override

    //@Cacheable

    public WechatLiveVo queryAll(YxWechatLiveQueryCriteria criteria, Pageable pageable) {

        String order = null;

        if (pageable.getSort() != null) {

            order = pageable.getSort().toString();

            order = order.replace(":", "");

            if ("UNSORTED".equals(order)) {

                order = "start_time desc";

            }

        }

        PageHelper.startPage(pageable.getPageNumber() + 1, pageable.getPageSize(), order);

        PageInfo page = new PageInfo<>(queryAll(criteria));

        WechatLiveVo wechatLiveVo = new WechatLiveVo();

//            List liveInfos = wxMaLiveService.getLiveInfos();

        List liveDtos = generator.convert(page.getList(), YxWechatLiveDto.class);

        //获取所有

        liveDtos.forEach(i -> {

            if (StringUtils.isNotBlank(i.getProductId())) {

                List wechatLiveGoodsDtos = generator.convert(

                        wechatLiveGoodsService.list(new LambdaQueryWrapper().in(YxWechatLiveGoods::getGoodsId, i.getProductId().split(",")))

                        , YxWechatLiveGoodsDto.class);

                i.setProduct(wechatLiveGoodsDtos);

            }

            i.setId(i.getRoomId());

        });

        wechatLiveVo.setContent(liveDtos);

        wechatLiveVo.setTotalElements(page.getTotal());

        wechatLiveVo.setPageNumber(page.getPageNum());

        wechatLiveVo.setLastPage(page.getPages());

        return wechatLiveVo;

    }    @Override

    public boolean addGoods(UpdateGoodsDto resources) {

        YxWechatLive wechatLive = new YxWechatLive();

        WxMaService wxMaService = WxMaConfiguration.getWxMaService();

        if (StringUtils.isNotBlank(resources.getProductId())) {

            wechatLive.setRoomId(Long.valueOf(resources.getRoomId()));

            wechatLive.setProductId(resources.getProductId());

            String[] productIds = resources.getProductId().split(",");

            List pids = new ArrayList<>();

            for (String productId : productIds) {

                pids.add(Integer.valueOf(productId));

            }

            //添加

            try {

                wxMaService.getLiveService().addGoodsToRoom(resources.getRoomId().intValue(), pids);

                this.saveOrUpdate(wechatLive);

            } catch (WxErrorException e) {

                e.printStackTrace();

            }

        }

        return true;

    }    @Override

    public boolean saveLive(YxWechatLive resources) {

        WxMaService wxMaService = WxMaConfiguration.getWxMaService();

        try {

            resources.setFeedsImg(uploadPhotoToWx(wxMaService, resources.getFeedsImg()).getMediaId());

            resources.setStartTime(Long.valueOf(OrderUtil.dateToTimestamp(resources.getStartDate())));

            resources.setEndTime(Long.valueOf(OrderUtil.dateToTimestamp(resources.getEndDate())));

            resources.setAnchorImg(uploadPhotoToWx(wxMaService, resources.getAnchorImge()).getMediaId());

            resources.setCoverImg(uploadPhotoToWx(wxMaService, resources.getCoverImge()).getMediaId());

            resources.setShareImg(uploadPhotoToWx(wxMaService, resources.getShareImge()).getMediaId());

            WxMaLiveInfo.RoomInfo roomInfo = generator.convert(resources, WxMaLiveInfo.RoomInfo.class);

            Integer status = this.createRoom(roomInfo);

            resources.setRoomId(Long.valueOf(status));

            if (StringUtils.isNotBlank(resources.getProductId())) {

                String[] productIds = resources.getProductId().split(",");

                List pids = new ArrayList<>();

                for (String productId : productIds) {

                    pids.add(Integer.valueOf(productId));

                }

                //添加

                wxMaService.getLiveService().addGoodsToRoom(status, pids);

            }

            this.save(resources);

        } catch (WxErrorException e) {

            e.printStackTrace();

            throw new BadRequestException(e.toString());

        }

        return false;

    }    @Override

    //@Cacheable

    public List queryAll(YxWechatLiveQueryCriteria criteria) {

        return baseMapper.selectList(QueryHelpPlus.getPredicate(YxWechatLive.class, criteria));

    }    @Override

    //@Cacheable

    public List getLiveReplay(Integer roomId) {

        WxMaService wxMaService = WxMaConfiguration.getWxMaService();

        WxMaLiveResult get_replay = new WxMaLiveResult();

        try {

            get_replay = wxMaService.getLiveService().getLiveReplay("get_replay", roomId, 0, 100);

        } catch (WxErrorException e) {

            e.printStackTrace();

        }

        return get_replay.getLiveReplay();

    }    @Override

    public void download(List all, HttpServletResponse response) throws IOException {

        List> list = new ArrayList<>();

        for (YxWechatLiveDto yxWechatLive : all) {

            Map map = new LinkedHashMap<>();

            map.put("标题", yxWechatLive.getName());

            map.put("背景图", yxWechatLive.getCoverImge());

            map.put("分享图片", yxWechatLive.getShareImge());

            map.put("间状态", yxWechatLive.getLiveStatus());

            map.put("开始时间", yxWechatLive.getStartTime());

            map.put("预计结束时间", yxWechatLive.getEndTime());

            map.put("昵称", yxWechatLive.getAnchorName());

            map.put("微信号", yxWechatLive.getAnchorWechat());

            map.put("头像", yxWechatLive.getAnchorImge());

            map.put("间类型 1:推流 0:手机", yxWechatLive.getType());

            map.put("横屏、竖屏 【1:横屏,0:竖屏】", yxWechatLive.getScreenType());

            map.put("是否关闭货架 【0:开启,1:关闭】", yxWechatLive.getCloseLike());

            map.put("是否关闭评论 【0:开启,1:关闭】", yxWechatLive.getCloseComment());

            list.add(map);

        }

        FileUtil.downloadExcel(list, response);

    }    @Override

    public Integer createRoom(WxMaLiveInfo.RoomInfo roomInfo) throws WxErrorException {

        WxMaService wxMaService = WxMaConfiguration.getWxMaService();

        String responseContent = wxMaService.post(CREATE_ROOM, WxMaGsonBuilder.create().toJson(roomInfo));

        JsonObject jsonObject = GsonParser.parse(responseContent);

        if (jsonObject.get("errcode").getAsInt() != 0) {

            throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));

        }

        return jsonObject.get("roomId").getAsInt();

    }    /**

     * 上传临时素材

     *

     * @param wxMaService WxMaService

     * @param picPath     图片路径

     * @return WxMpMaterialUploadResult

     * @throws WxErrorException

     */

    private WxMediaUploadResult uploadPhotoToWx(WxMaService wxMaService, String picPath) throws WxErrorException {

        String filename = (int) System.currentTimeMillis() + ".png";

        String downloadPath = uploadDirStr + filename;

        long size = HttpUtil.downloadFile(picPath, cn.hutool.core.io.FileUtil.file(downloadPath));

        picPath = downloadPath;

        File picFile = new File(picPath);

        log.info("picFile name : {}", picFile.getName());

        WxMediaUploadResult wxMediaUploadResult = wxMaService.getMediaService().uploadMedia(WxConsts.MediaFileType.IMAGE, picFile);

        log.info("wxMpMaterialUploadResult : {}", JSONUtil.toJsonStr(wxMediaUploadResult));

        return wxMediaUploadResult;

    }    /**

     * 间列表

     *

     * @param page  页码

     * @param limit 条数

     * @param order ProductEnum

     * @return List

     */

    @Override

    public List getList(int page, int limit, int order) {

        //todo 添加状态判断

        LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>();

        wrapper.orderByDesc(YxWechatLive::getStartTime);

        Page pageModel = new Page<>(page, limit);

        IPage pageList = wechatLiveMapper.selectPage(pageModel, wrapper);

        return generator.convert(pageList.getRecords(), YxWechatLiveDto.class);

    }

}package co.fuyond.modules.mp.service.impl;import co.fuyond.common.service.impl.BaseServiceImpl;

        import co.fuyond.common.utils.QueryHelpPlus;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.modules.mp.domain.YxWechatMenu;

        import co.fuyond.modules.mp.service.YxWechatMenuService;

        import co.fuyond.modules.mp.service.dto.YxWechatMenuDto;

        import co.fuyond.modules.mp.service.dto.YxWechatMenuQueryCriteria;

        import co.fuyond.modules.mp.service.mapper.WechatMenuMapper;

        import co.fuyond.utils.FileUtil;

        import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

        import com.github.pagehelper.PageInfo;

        import lombok.AllArgsConstructor;

        import org.springframework.data.domain.Pageable;

        import org.springframework.stereotype.Service;

        import org.springframework.transaction.annotation.Propagation;

        import org.springframework.transaction.annotation.Transactional;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.ArrayList;

        import java.util.LinkedHashMap;

        import java.util.List;

        import java.util.Map;// 默认不使用缓存

//import org.springframework.cache.annotation.CacheConfig;

//import org.springframework.cache.annotation.CacheEvict;

//import org.springframework.cache.annotation.Cacheable;/**

        *@author hupeng*/@Service

@AllArgsConstructor

//@CacheConfig(cacheNames = "yxWechatMenu")

@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)

public class YxWechatMenuServiceImpl extends BaseServiceImpl implements YxWechatMenuService {

    private final IGenerator generator;    @Override

//@Cacheable

    public Map queryAll(YxWechatMenuQueryCriteria criteria, Pageable pageable) {

        getPage(pageable);

        PageInfo page = new PageInfo<>(queryAll(criteria));

        Map map = new LinkedHashMap<>(2);

        map.put("content", generator.convert(page.getList(), YxWechatMenuDto.class));

        map.put("totalElements", page.getTotal());

        return map;

    }    @Override

    //@Cacheable

    public List queryAll(YxWechatMenuQueryCriteria criteria) {

        return baseMapper.selectList(QueryHelpPlus.getPredicate(YxWechatMenu.class, criteria));

    }    @Override

    public void download(List all, HttpServletResponse response) throws IOException {

        List> list = new ArrayList<>();

        for (YxWechatMenuDto yxWechatMenu : all) {

            Map map = new LinkedHashMap<>();

            map.put("缓存数据", yxWechatMenu.getResult());

            map.put("缓存时间", yxWechatMenu.getAddTime());

            list.add(map);

        }

        FileUtil.downloadExcel(list, response);

    }    @Override

    public Boolean isExist(String wechat_menus) {

        YxWechatMenu yxWechatMenu = this.getOne(new LambdaQueryWrapper()

                .eq(YxWechatMenu::getKey, wechat_menus));

        if (yxWechatMenu == null) {

            return false;

        }

        return true;

    }

}package co.fuyond.modules.mp.service.impl;import co.fuyond.common.service.impl.BaseServiceImpl;

        import co.fuyond.common.utils.QueryHelpPlus;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.exception.EntityExistException;

        import co.fuyond.modules.mp.domain.YxWechatReply;

        import co.fuyond.modules.mp.service.YxWechatReplyService;

        import co.fuyond.modules.mp.service.dto.YxWechatReplyDto;

        import co.fuyond.modules.mp.service.dto.YxWechatReplyQueryCriteria;

        import co.fuyond.modules.mp.service.mapper.WechatReplyMapper;

        import co.fuyond.utils.FileUtil;

        import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

        import com.github.pagehelper.PageInfo;

        import lombok.AllArgsConstructor;

        import org.springframework.data.domain.Pageable;

        import org.springframework.stereotype.Service;

        import org.springframework.transaction.annotation.Propagation;

        import org.springframework.transaction.annotation.Transactional;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.ArrayList;

        import java.util.LinkedHashMap;

        import java.util.List;

        import java.util.Map;// 默认不使用缓存

//import org.springframework.cache.annotation.CacheConfig;

//import org.springframework.cache.annotation.CacheEvict;

//import org.springframework.cache.annotation.Cacheable;/**

        *@author hupeng*/@Service

@AllArgsConstructor

//@CacheConfig(cacheNames = "yxWechatReply")

@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)

public class YxWechatReplyServiceImpl extends BaseServiceImpl implements YxWechatReplyService {

    private final IGenerator generator;    @Override

//@Cacheable

    public Map queryAll(YxWechatReplyQueryCriteria criteria, Pageable pageable) {

        getPage(pageable);

        PageInfo page = new PageInfo<>(queryAll(criteria));

        Map map = new LinkedHashMap<>(2);

        map.put("content", generator.convert(page.getList(), YxWechatReplyDto.class));

        map.put("totalElements", page.getTotal());

        return map;

    }    @Override

    //@Cacheable

    public List queryAll(YxWechatReplyQueryCriteria criteria) {

        return baseMapper.selectList(QueryHelpPlus.getPredicate(YxWechatReply.class, criteria));

    }    @Override

    public void download(List all, HttpServletResponse response) throws IOException {

        List> list = new ArrayList<>();

        for (YxWechatReplyDto yxWechatReply : all) {

            Map map = new LinkedHashMap<>();

            map.put("关键字", yxWechatReply.getKey());

            map.put("回复类型", yxWechatReply.getType());

            map.put("回复数据", yxWechatReply.getData());

            map.put("0=不可用  1 =可用", yxWechatReply.getStatus());

            map.put("是否隐藏", yxWechatReply.getHide());

            list.add(map);

        }

        FileUtil.downloadExcel(list, response);

    }    @Override

    public YxWechatReply isExist(String key) {

        YxWechatReply yxWechatReply = this.getOne(new LambdaQueryWrapper()

                .eq(YxWechatReply::getKey, key));

        return yxWechatReply;

    }    @Override

    public void create(YxWechatReply yxWechatReply) {

        if (this.isExist(yxWechatReply.getKey()) != null) {

            throw new EntityExistException(YxWechatReply.class, "key", yxWechatReply.getKey());

        }

        this.save(yxWechatReply);

    }    @Override

    public void upDate(YxWechatReply resources) {

        YxWechatReply yxWechatReply = this.getById(resources.getId());

        YxWechatReply yxWechatReply1;

        yxWechatReply1 = this.isExist(resources.getKey());

        if (yxWechatReply1 != null && !yxWechatReply1.getId().equals(yxWechatReply.getId())) {

            throw new EntityExistException(YxWechatReply.class, "key", resources.getKey());

        }

        yxWechatReply.copy(resources);

        this.saveOrUpdate(yxWechatReply);

    }

}package co.fuyond.modules.mp.service.impl;import co.fuyond.common.service.impl.BaseServiceImpl;

        import co.fuyond.common.utils.QueryHelpPlus;

        import co.fuyond.dozer.service.IGenerator;

        import co.fuyond.modules.mp.domain.YxWechatTemplate;

        import co.fuyond.modules.mp.service.YxWechatTemplateService;

        import co.fuyond.modules.mp.service.dto.YxWechatTemplateDto;

        import co.fuyond.modules.mp.service.dto.YxWechatTemplateQueryCriteria;

        import co.fuyond.modules.mp.service.mapper.WechatTemplateMapper;

        import co.fuyond.utils.FileUtil;

        import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

        import com.github.pagehelper.PageInfo;

        import lombok.AllArgsConstructor;

        import org.springframework.data.domain.Pageable;

        import org.springframework.stereotype.Service;

        import org.springframework.transaction.annotation.Propagation;

        import org.springframework.transaction.annotation.Transactional;import javax.servlet.http.HttpServletResponse;

        import java.io.IOException;

        import java.util.ArrayList;

        import java.util.LinkedHashMap;

        import java.util.List;

        import java.util.Map;// 默认不使用缓存

//import org.springframework.cache.annotation.CacheConfig;

//import org.springframework.cache.annotation.CacheEvict;

//import org.springframework.cache.annotation.Cacheable;/**

        *@author hupeng*/@Service

@AllArgsConstructor

//@CacheConfig(cacheNames = "yxWechatTemplate")

@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)

public class YxWechatTemplateServiceImpl extends BaseServiceImpl implements YxWechatTemplateService {

    private final IGenerator generator;    @Override

//@Cacheable

    public Map queryAll(YxWechatTemplateQueryCriteria criteria, Pageable pageable) {

        getPage(pageable);

        PageInfo page = new PageInfo<>(queryAll(criteria));

        Map map = new LinkedHashMap<>(2);

        map.put("content", generator.convert(page.getList(), YxWechatTemplateDto.class));

        map.put("totalElements", page.getTotal());

        return map;

    }    @Override

    //@Cacheable

    public List queryAll(YxWechatTemplateQueryCriteria criteria) {

        return baseMapper.selectList(QueryHelpPlus.getPredicate(YxWechatTemplate.class, criteria));

    }    @Override

    public void download(List all, HttpServletResponse response) throws IOException {

        List> list = new ArrayList<>();

        for (YxWechatTemplateDto yxWechatTemplate : all) {

            Map map = new LinkedHashMap<>();

            map.put("模板编号", yxWechatTemplate.getTempkey());

            map.put("模板名", yxWechatTemplate.getName());

            map.put("回复内容", yxWechatTemplate.getContent());

            map.put("模板ID", yxWechatTemplate.getTempid());

            map.put("添加时间", yxWechatTemplate.getAddTime());

            map.put("状态", yxWechatTemplate.getStatus());

            list.add(map);

        }

        FileUtil.downloadExcel(list, response);

    }    @Override

    public YxWechatTemplate findByTempkey(String recharge_success_key) {

        return this.getOne(new LambdaQueryWrapper()

                .eq(YxWechatTemplate::getTempkey, recharge_success_key));

    }

}package co.fuyond.modules.mp.service.mapper;import co.fuyond.common.mapper.CoreMapper;

        import co.fuyond.modules.mp.domain.YxArticle;

        import org.apache.ibatis.annotations.Param;

        import org.apache.ibatis.annotations.Update;

        import org.springframework.stereotype.Repository;/**

 * @author hupeng

 */

@Repository

public interface ArticleMapper extends CoreMapper {

    @Update("update yx_article set visit=visit+1 " +

            "where id=#{id}")

    int incVisitNum(@Param("id") int id);

}package co.fuyond.modules.mp.service.mapper;import co.fuyond.common.mapper.CoreMapper;

        import co.fuyond.modules.mp.domain.YxWechatMenu;

        import org.springframework.stereotype.Repository;/**

 * @author hupeng

 */

@Repository

public interface WechatMenuMapper extends CoreMapper {

}package co.fuyond.modules.mp.service.mapper;import co.fuyond.common.mapper.CoreMapper;

        import co.fuyond.modules.mp.domain.YxWechatReply;

        import org.springframework.stereotype.Repository;/**

 * @author hupeng

 */

@Repository

public interface WechatReplyMapper extends CoreMapper {

}package co.fuyond.modules.mp.service.mapper;import co.fuyond.common.mapper.CoreMapper;

        import co.fuyond.modules.mp.domain.YxWechatTemplate;

        import org.springframework.stereotype.Repository;/**

 * @author hupeng

 */

@Repository

public interface WechatTemplateMapper extends CoreMapper {

}package co.fuyond.modules.mp.service.mapper;import co.fuyond.common.mapper.CoreMapper;

        import co.fuyond.modules.mp.domain.YxWechatLiveGoods;

        import org.springframework.stereotype.Repository;/**

 * @author hupeng

 */

@Repository

public interface YxWechatLiveGoodsMapper extends CoreMapper {

}package co.fuyond.modules.mp.service.mapper;import co.fuyond.common.mapper.CoreMapper;

        import co.fuyond.modules.mp.domain.YxWechatLive;

        import org.springframework.stereotype.Repository;/**

 * @author hupeng

 */

@Repository

public interface YxWechatLiveMapper extends CoreMapper {

}package co.fuyond.modules.mp.utils;

        import co.fuyond.modules.user.service.dto.WechatUserDto;

        import com.alibaba.fastjson.JSONObject;/**

 * @ClassName FyUtils

 * @Author hupeng <[email protected]>

 **/

public class FyUtils {

    public static WechatUserDto getWechtUser(String str) {

        return JSONObject.parseObject(str, WechatUserDto.class);

    }

}package co.fuyond.modules.mp.utils;import com.google.gson.Gson;

        import com.google.gson.GsonBuilder;/**

 * @author Binary Wang(https://github.com/binarywang)

 */

public class JsonUtils {

    public static String toJson(Object obj) {

        Gson gson = new GsonBuilder()

                .setPrettyPrinting()

                .create();

        return gson.toJson(obj);

    }

}package co.fuyond.modules.mp.utils;import java.util.HashMap;

        import java.util.Map;/**

 * URLUtils

 *

 * @author Kevin

 */

public class URLUtils {

    /**

     * 获取URL中的某个参数

     *

     * @param url

     * @param name

     * @return

     */

    public static String getParam(String url, String name) {

        return urlSplit(url).get(name);

    }    /**

     * 去掉url中的路径,留下请求参数部分

     *

     * @param strURL url地址

     * @return url请求参数部分

     */

    private static String truncateUrlPage(String strURL) {

        String strAllParam = null;

        String[] arrSplit = null;

        strURL = strURL.trim().toLowerCase();

        arrSplit = strURL.split("[?]");

        if (strURL.length() > 1) {

            if (arrSplit.length > 1) {

                for (int i = 1; i < arrSplit.length; i++) {

                    strAllParam = arrSplit[i];

                }

            }

        }

        return strAllParam;

    }  

    /**

     * 订单确认收货

     * @param orderId 单号

     * @param uid uid

     */

    void takeOrder(String orderId,Long uid);

    /**

     * 订单

     * @param verifyCode 码

     * @param isConfirm OrderInfoEnum

     * @param uid uid

     * @return YxStoreOrderQueryVo

     */

    YxStoreOrderQueryVo verifyOrder(String verifyCode, Integer isConfirm , Long uid);

    /**

     * 订单列表

     * @param uid 用户id

     * @param type OrderStatusEnum

     * @param page page

     * @param limit limit

     * @return list

     */

    Map orderList(Long uid,int type,int page,int limit);

    /**

     * 获取某个用户的订单统计数据

     * @param uid uid>0 取用户 否则取所有

     * @return UserOrderCountVo

     */

    UserOrderCountVo orderData(Long uid);

    /**

     * 处理订单返回的状态

     * @param order order

     * @return YxStoreOrderQueryVo

     */

    YxStoreOrderQueryVo handleOrder(YxStoreOrderQueryVo order);

    /**

     * 支付成功后操作

     * @param orderId 订单号

     * @param payType 支付方式

     */

    void paySuccess(String orderId,String payType);

    /**

     * 余额支付

     * @param orderId 订单号

     * @param uid 用户id

     */

    void yuePay(String orderId,Long uid);

    /**

     * 积分兑换

     * @param orderId 订单号

     * @param uid 用户id

     */

    void integralPay(String orderId,Long uid);

    String aliPay(String orderId) throws Exception;

    /**

     * 创建订单

     * @param userInfo 用户信息

     * @param key key

     * @param param param

     * @return YxStoreOrder

     */

    YxStoreOrder createOrder(YxUser userInfo, String key, OrderParam param);

    /**

     *计算订单价格

     * @param userInfo 用户

     * @param key 订单缓存key

     * @param couponId 优惠券id

     * @param useIntegral 使用积分 1-表示使用

     * @param shippingType 类型 OrderInfoEnum

     * @return ComputeVo

     */

    ComputeVo computedOrder(YxUser userInfo, String key, String couponId,

                            String useIntegral, String shippingType,String addressId);

    /**

     * 订单信息

     * @param unique 唯一值或者单号

     * @param uid 用户id

     * @return YxStoreOrderQueryVo

     */

    YxStoreOrderQueryVo getOrderInfo(String unique, Long uid);

/**

 * @author :LionCity

 * @description:

 * @modified By:

 * @version:

 */

@Data

public class YxOrderNowOrderStatusDto implements Serializable {

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")

    private Date cacheKeyCreateOrder;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")

    private Date paySuccess;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")

    private Date deliveryGoods;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")

    private Date orderVerific;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")

    private Date userTakeDelivery;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")

    private Date checkOrderOver;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")

    private Date applyRefund;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")

    private Date refundOrderSuccess;

    private int size;

}

package co.fuyond.modules.order.service.dto;

import lombok.Data;

import java.io.Serializable;

/**

* @author hupeng

 */

@Data

public class YxStoreOrderCartInfoDto implements Serializable {

    private Integer id;

    /** 订单id */

    private Integer oid;

    /**

     * 订单号

     */

    private String orderId;

    /** id */

    private Integer cartId;

    /** ID */

    private Integer productId;

    /** 详细信息 */

    private String cartInfo;

    /** 唯一id */

    private String unique;

}

/**

* @author hupeng

 */

@Service

@AllArgsConstructor

@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)

public class YxExpressServiceImpl extends BaseServiceImpl implements YxExpressService {

    private final IGenerator generator;

    @Override

    //@Cacheable

    public Map queryAll(YxExpressQueryCriteria criteria, Pageable pageable) {

        getPage(pageable);

        PageInfo page = new PageInfo<>(queryAll(criteria));

        Map map = new LinkedHashMap<>(2);

        map.put("content", generator.convert(page.getList(), YxExpressDto.class));

        map.put("totalElements", page.getTotal());

        return map;

    }

    @Override

    //@Cacheable

    public List queryAll(YxExpressQueryCriteria criteria){

        return baseMapper.selectList(QueryHelpPlus.getPredicate(YxExpress.class, criteria));

    }

    @Override

    public void download(List all, HttpServletResponse response) throws IOException {

        List> list = new ArrayList<>();

        for (YxExpressDto yxExpress : all) {

            Map map = new LinkedHashMap<>();

            map.put("简称", yxExpress.getCode());

            map.put("全称", yxExpress.getName());

            map.put("排序", yxExpress.getSort());

            map.put("是否显示", yxExpress.getIsShow());

            list.add(map);

        }

        FileUtil.downloadExcel(list, response);

    }

}

package co.fuyond.modules.order.service.impl;

import cn.hutool.core.util.IdUtil;

import co.fuyond.common.service.impl.BaseServiceImpl;

import co.fuyond.common.utils.QueryHelpPlus;

import co.fuyond.dozer.service.IGenerator;

import co.fuyond.modules.cart.vo.YxStoreCartQueryVo;

import co.fuyond.modules.order.domain.YxStoreOrderCartInfo;

import co.fuyond.modules.order.service.YxStoreOrderCartInfoService;

import co.fuyond.modules.order.service.dto.YxStoreOrderCartInfoDto;

import co.fuyond.modules.order.service.dto.YxStoreOrderCartInfoQueryCriteria;

import co.fuyond.modules.order.service.mapper.StoreOrderCartInfoMapper;

import co.fuyond.utils.FileUtil;

import com.alibaba.fastjson.JSONObject;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

import com.github.pagehelper.PageInfo;

import lombok.AllArgsConstructor;

import org.springframework.data.domain.Pageable;

import org.springframework.stereotype.Service;

import org.springframework.transaction.annotation.Propagation;

import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;

import java.io.IOException;

import java.util.ArrayList;

import java.util.LinkedHashMap;

import java.util.List;

import java.util.Map;

/**

* @author hupeng

 */

@Service

@AllArgsConstructor

@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)

public class YxStoreOrderCartInfoServiceImpl extends BaseServiceImpl implements YxStoreOrderCartInfoService {

    private final IGenerator generator;

    @Override

    public YxStoreOrderCartInfo findByUni(String unique) {

       LambdaQueryWrapper wrapper= new LambdaQueryWrapper<>();

        wrapper.eq(YxStoreOrderCartInfo::getUnique,unique);

        return this.baseMapper.selectOne(wrapper);

    }

    @Override

    //@Cacheable

    public Map queryAll(YxStoreOrderCartInfoQueryCriteria criteria, Pageable pageable) {

        getPage(pageable);

        PageInfo page = new PageInfo<>(queryAll(criteria));

        Map map = new LinkedHashMap<>(2);

        map.put("content", generator.convert(page.getList(), YxStoreOrderCartInfoDto.class));

        map.put("totalElements", page.getTotal());

        return map;

    }

    @Override

    //@Cacheable

    public List queryAll(YxStoreOrderCartInfoQueryCriteria criteria){

        return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreOrderCartInfo.class, criteria));

    }

    @Override

    public void download(List all, HttpServletResponse response) throws IOException {

        List> list = new ArrayList<>();

        for (YxStoreOrderCartInfoDto yxStoreOrderCartInfo : all) {

            Map map = new LinkedHashMap<>();

            map.put("订单id", yxStoreOrderCartInfo.getOid());

            map.put("id", yxStoreOrderCartInfo.getCartId());

            map.put("ID", yxStoreOrderCartInfo.getProductId());

            map.put("详细信息", yxStoreOrderCartInfo.getCartInfo());

            map.put("唯一id", yxStoreOrderCartInfo.getUnique());

            list.add(map);

        }

        FileUtil.downloadExcel(list, response);

    }

}

package co.fuyond.modules.order.service.impl;

import cn.hutool.core.bean.BeanUtil;

import cn.hutool.core.date.DateUtil;

import cn.hutool.core.util.IdUtil;

import cn.hutool.core.util.NumberUtil;

import cn.hutool.core.util.ObjectUtil;

import cn.hutool.core.util.StrUtil;

import co.fuyond.api.BusinessException;

import co.fuyond.api.FyException;

import co.fuyond.common.service.impl.BaseServiceImpl;

import co.fuyond.common.utils.QueryHelpPlus;

import co.fuyond.constant.ShopConstants;

import co.fuyond.constant.SystemConfigConstants;

import co.fuyond.dozer.service.IGenerator;

import co.fuyond.enums.*;

import co.fuyond.event.TemplateBean;

import co.fuyond.event.TemplateEvent;

import co.fuyond.event.TemplateListenEnum;

import co.fuyond.exception.BadRequestException;

import co.fuyond.exception.EntityExistException;

import co.fuyond.exception.ErrorRequestException;

import co.fuyond.modules.activity.domain.YxStoreCouponUser;

import co.fuyond.modules.activity.domain.YxStorePink;

import co.fuyond.modules.activity.service.YxStoreBargainService;

import co.fuyond.modules.activity.service.YxStoreBargainUserService;

import co.fuyond.modules.activity.service.YxStoreCouponUserService;

import co.fuyond.modules.activity.service.YxStorePinkService;

import co.fuyond.modules.activity.vo.StoreCouponUserVo;

import co.fuyond.modules.cart.domain.YxStoreCart;

import co.fuyond.modules.cart.service.YxStoreCartService;

import co.fuyond.modules.cart.service.mapper.StoreCartMapper;

import co.fuyond.modules.cart.vo.YxStoreCartQueryVo;

import co.fuyond.modules.order.domain.YxExpress;

import co.fuyond.modules.order.domain.YxStoreOrder;

import co.fuyond.modules.order.domain.YxStoreOrderCartInfo;

import co.fuyond.modules.order.domain.YxStoreOrderStatus;

import co.fuyond.modules.order.param.OrderParam;

import co.fuyond.modules.order.service.YxExpressService;

import co.fuyond.modules.order.service.YxStoreOrderCartInfoService;

import co.fuyond.modules.order.service.YxStoreOrderService;

import co.fuyond.modules.order.service.YxStoreOrderStatusService;

import co.fuyond.modules.order.service.dto.*;

import co.fuyond.modules.order.service.mapper.StoreOrderMapper;

import co.fuyond.modules.order.vo.*;

import co.fuyond.modules.product.domain.YxStoreProductReply;

import co.fuyond.modules.product.service.YxStoreProductReplyService;

import co.fuyond.modules.product.service.YxStoreProductService;

import co.fuyond.modules.product.vo.YxStoreProductQueryVo;

import co.fuyond.modules.sales.domain.StoreAfterSales;

import co.fuyond.modules.sales.service.StoreAfterSalesService;

import co.fuyond.modules.shop.domain.YxSystemStore;

import co.fuyond.modules.shop.service.YxSystemConfigService;

import co.fuyond.modules.shop.service.YxSystemStoreService;

import co.fuyond.modules.shop.service.YxSystemStoreStaffService;

import co.fuyond.modules.template.domain.YxShippingTemplates;

import co.fuyond.modules.template.domain.YxShippingTemplatesFree;

import co.fuyond.modules.template.domain.YxShippingTemplatesRegion;

import co.fuyond.modules.template.service.YxShippingTemplatesFreeService;

import co.fuyond.modules.template.service.YxShippingTemplatesRegionService;

import co.fuyond.modules.template.service.YxShippingTemplatesService;

import co.fuyond.modules.tools.domain.AlipayConfig;

import co.fuyond.modules.tools.domain.vo.TradeVo;

import co.fuyond.modules.tools.service.AlipayConfigService;

import co.fuyond.modules.user.domain.YxUser;

import co.fuyond.modules.user.domain.YxUserAddress;

import co.fuyond.modules.user.service.YxUserAddressService;

import co.fuyond.modules.user.service.YxUserBillService;

import co.fuyond.modules.user.service.YxUserLevelService;

import co.fuyond.modules.user.service.YxUserService;

import co.fuyond.modules.user.service.dto.YxUserDto;

import co.fuyond.modules.user.vo.YxUserQueryVo;

import co.fuyond.utils.FileUtil;

import co.fuyond.utils.OrderUtil;

import co.fuyond.utils.RedisUtils;

import com.alibaba.fastjson.JSON;

import com.alibaba.fastjson.JSONObject;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

import com.baomidou.mybatisplus.core.metadata.IPage;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.github.pagehelper.PageInfo;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.cache.annotation.CacheEvict;

import org.springframework.context.ApplicationEventPublisher;

import org.springframework.data.domain.Pageable;

import org.springframework.data.redis.core.RedisTemplate;

import org.springframework.stereotype.Service;

import org.springframework.transaction.annotation.Propagation;

import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;

import java.io.IOException;

import java.math.BigDecimal;

import java.util.*;

import java.util.concurrent.TimeUnit;

import java.util.stream.Collectors;

@Slf4j

@Service

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)

public class YxStoreOrderServiceImpl extends BaseServiceImpl implements YxStoreOrderService {

    @Autowired

    private IGenerator generator;

    @Autowired

    private YxStorePinkService storePinkService;

    @Autowired

    private YxStoreOrderCartInfoService storeOrderCartInfoService;

    @Autowired

    private YxStoreCartService storeCartService;

    @Autowired

    private YxUserAddressService userAddressService;

    @Autowired

    private YxStoreOrderCartInfoService orderCartInfoService;

    @Autowired

    private YxStoreOrderStatusService orderStatusService;

    @Autowired

    private YxUserBillService billService;

    @Autowired

    private YxStoreCouponUserService couponUserService;

    @Autowired

    private YxUserService userService;

    @Autowired

    private YxStoreProductService productService;

    @Autowired

    private YxStorePinkService pinkService;

    @Autowired

    private YxStoreBargainUserService storeBargainUserService;

    @Autowired

    private YxStoreBargainService storeBargainService;

    @Autowired

    private YxExpressService expressService;

    @Autowired

    private AlipayConfigService alipayService;

    @Autowired

    private YxSystemStoreService systemStoreService;

    @Autowired

    private YxStoreProductReplyService productReplyService;

    @Autowired

    private YxStoreCartService yxStoreCartService;

    @Autowired

    private YxSystemStoreStaffService systemStoreStaffService;

    @Autowired

    private YxShippingTemplatesService shippingTemplatesService;

    @Autowired

    private YxShippingTemplatesRegionService shippingTemplatesRegionService;

    @Autowired

    private YxShippingTemplatesFreeService shippingTemplatesFreeService;

    @Autowired

    private YxSystemConfigService systemConfigService;

    @Autowired

    private YxUserLevelService userLevelService;

    @Autowired

    private StoreOrderMapper yxStoreOrderMapper;

    @Autowired

    private StoreCartMapper storeCartMapper;

    @Autowired

    private RedisUtils redisUtils;

    @Autowired

    private RedisTemplate redisTemplate;

    @Autowired

    private ApplicationEventPublisher publisher;

    @Autowired

    private StoreAfterSalesService storeAfterSalesService;

    /**

     * 返回订单确认数据

     *

     * @param yxUser  yxUser

     * @param cartIds id

     * @return ConfirmOrderVO

     */

    @Override

    public ConfirmOrderVo confirmOrder(YxUser yxUser, String cartIds) {

        Long uid = yxUser.getUid();

        Map cartGroup = yxStoreCartService.getUserProductCartList(uid,

                cartIds, ShopConstants.FY_ONE_NUM);

        if (ObjectUtil.isNotEmpty(cartGroup.get("invalid"))) {

            throw new FyException("有失效的请重新提交");

        }

        if (ObjectUtil.isEmpty(cartGroup.get("valid"))) {

            throw new FyException("请提交");

        }

        OtherDto other = new OtherDto();

        other.setIntegralRatio(systemConfigService.getData(SystemConfigConstants.INTERGRAL_RATIO));

        other.setIntegralFull(systemConfigService.getData(SystemConfigConstants.INTERGRAL_FULL));

        other.setIntegralMax(systemConfigService.getData(SystemConfigConstants.INTERGRAL_MAX));

        // 

        Long combinationId = null;

        Long secKillId = null;

        Long bargainId = null;

        if (cartIds.split(",").length == 1) {

            YxStoreCart cartQueryVo = yxStoreCartService.getById(cartIds);

            combinationId = cartQueryVo.getCombinationId();

            secKillId = cartQueryVo.getSeckillId();

            bargainId = cartQueryVo.getBargainId();

        }

        boolean deduction = false;

        boolean enableIntegral = true;

        //类不参与抵扣

        if ((combinationId != null && combinationId > 0) || (secKillId != null && secKillId > 0)

                || (bargainId != null && bargainId > 0)) {

            deduction = true;

        }

        //获取默认地址

        YxUserAddress userAddress = userAddressService.getOne(Wrappers.lambdaQuery()

                .eq(YxUserAddress::getUid, uid)

                .eq(YxUserAddress::getIsDefault, ShopCommonEnum.DEFAULT_1.getValue()), false);

        List cartInfo = (List) cartGroup.get("valid");

        PriceGroupDto priceGroup = this.getOrderPriceGroup(cartInfo, userAddress);

        //判断积分是否满足订单额度

        if (priceGroup.getTotalPrice().compareTo(new BigDecimal(other.getIntegralFull())) < 0) {

            enableIntegral = false;

        }

        String cacheKey = this.cacheOrderInfo(uid, cartInfo, priceGroup, other);

        //获取可用优惠券

        List productIds = cartInfo.stream()

                .map(YxStoreCartQueryVo::getProductId)

                .map(Object::toString)

                .collect(Collectors.toList());

        List storeCouponUsers = couponUserService

                .getUsableCouponList(uid, priceGroup.getTotalPrice().doubleValue(), productIds);

        StoreCouponUserVo storeCouponUser = null;

        if (storeCouponUsers != null && !storeCouponUsers.isEmpty()) {

            storeCouponUser = storeCouponUsers.get(0);

        }

        return ConfirmOrderVo.builder()

                .addressInfo(userAddress)

                .cartInfo(cartInfo)

                .priceGroup(priceGroup)

                .userInfo(generator.convert(yxUser, YxUserQueryVo.class))

                .orderKey(cacheKey)

                .deduction(deduction)

                .enableIntegral(enableIntegral)

                .enableIntegralNum(Double.valueOf(other.getIntegralMax()))

                //.integralRatio(d)

                .usableCoupon(storeCouponUser)

                .systemStore(systemStoreService.getStoreInfo("", ""))

                .build();

    }

    /**

    * 查询数据分页

    * @param criteria 条件

    * @param pageable 分页参数

    * @return Map

    */

    Map queryAll(YxStoreOrderQueryCriteria criteria, Pageable pageable);

    /**

    * 查询所有数据不分页

    * @param criteria 条件参数

    * @return List

    */

    List queryAll(YxStoreOrderQueryCriteria criteria);

    //YxStoreOrderDto create(YxStoreOrder resources);

    void update(YxStoreOrder resources);

    /**

    * 导出数据

    * @param all 待导出的数据

    * @param response /

    * @throws IOException /

    */

    void download(List all, HttpServletResponse response) throws IOException;

    /**

     * 解析出url参数中的键值对

     * 如 "index.jsp?Action=del&id=123",解析出Action:del,id:123存入map中

     *

     * @param URL url地址

     * @return url请求参数部分

     */

    public static Map urlSplit(String URL) {

        Map mapRequest = new HashMap();

        String[] arrSplit = null;

        String strUrlParam = truncateUrlPage(URL);

        if (strUrlParam == null) {

            return mapRequest;

        }

        arrSplit = strUrlParam.split("[&]");

        for (String strSplit : arrSplit) {

            String[] arrSplitEqual = null;

            arrSplitEqual = strSplit.split("[=]");

            //解析出键值

            if (arrSplitEqual.length > 1) {

                //正确解析

                mapRequest.put(arrSplitEqual[0], arrSplitEqual[1]);

            } else {

                if (arrSplitEqual[0] != "") {

                    //只有参数没有值,不加入

                    mapRequest.put(arrSplitEqual[0], "");

                }

            }

        }

        return mapRequest;

    }

}package co.fuyond.modules.mp.vo;import co.fuyond.modules.mp.service.dto.YxWechatLiveDto;

        import lombok.Data;import java.util.List;@Data

public class WechatLiveVo {

    private List content;

    private Long totalElements;

    private Integer pageNumber;

    private Integer lastPage;

}

 

你可能感兴趣的:(实验室,lims,信息化管理,系统架构)