/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the yifu4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.yifu.cloud.plus.v1.yifu.social.controller;

import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialSoldierPushService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialSoldierService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 社保士兵
 *
 * @author hgw
 * @date 2024-5-8 14:37:00
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/tsocialsoldier")
@Tag(name = "社保士兵")
public class TSocialSoldierController {

	private final TSocialSoldierService tSocialSoldierService;
	private final TSocialSoldierPushService tSocialSoldierPushService;

	/**
	 * @param addId 任务id，可为空
	 * @Description: 1获取社保士兵状态
	 * @Author: hgw
	 * @Date: 2024/5/11 19:25
	 * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
	 **/
	@Operation(description = "获取社保士兵状态")
	@GetMapping("/getFiveJob")
	public R<String> getFiveJob(@RequestParam(required = false) String addId) {
		return tSocialSoldierService.getFiveJob(addId);
	}

	/**
	 * @param dispatchIdList 派单id
	 * @Description: 推送社保士兵
	 * @Author: hgw
	 * @Date: 2024/5/11 19:25
	 * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
	 **/
	@Operation(description = "推送社保士兵")
	@PostMapping("/pushSoldier")
	public R<String> pushSoldier(@RequestBody(required = false) List<String> dispatchIdList) {
		return tSocialSoldierPushService.pushSoldier(dispatchIdList);
	}

	/**
	 * @Description: 1定时任务获取社保士兵状态
	 * @Author: hgw
	 * @Date: 2024/5/11 19:26
	 * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
	 **/
	@Operation(description = "1定时任务获取社保士兵状态")
	@PostMapping("/inner/doInnerGetFiveJob")
	@SysLog("每日1定时任务获取社保士兵状态")
	@Inner
	public R<String> doInnerGetFiveJob() {
		return tSocialSoldierService.getFiveJob(null);
	}

	/**
	 * @Description: 2定时任务推送社保士兵
	 * @Author: hgw
	 * @Date: 2024/5/11 19:26
	 * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
	 **/
	@Operation(description = "2定时任务推送社保士兵")
	@PostMapping("/inner/doInnerPushSoldier")
	@SysLog("每日2定时任务推送社保士兵")
	@Inner
	public R<String> doInnerPushSoldier() {
		return tSocialSoldierPushService.pushSoldier(null);
	}
}
