From 8853292babb2ad94de4a3207966f1e83b767cd2d Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Sun, 17 Sep 2023 16:38:34 +0800
Subject: [PATCH] 新增流程节点进程查询接口

---
 src/main/java/org/springblade/modules/social/controller/SocialController.java |   46 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/springblade/modules/social/controller/SocialController.java b/src/main/java/org/springblade/modules/social/controller/SocialController.java
index 806b5ba..78ca007 100644
--- a/src/main/java/org/springblade/modules/social/controller/SocialController.java
+++ b/src/main/java/org/springblade/modules/social/controller/SocialController.java
@@ -38,6 +38,8 @@
 import org.springblade.modules.social.service.ISocialService;
 import org.springblade.modules.social.vo.SocialVO;
 import org.springblade.modules.system.excel.UserExcel;
+import org.springblade.modules.system.service.MyAsyncService;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -48,6 +50,7 @@
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -63,6 +66,8 @@
 public class SocialController extends BladeController {
 
 	private final ISocialService socialService;
+
+	private final MyAsyncService myAsyncService;
 
 	/**
 	 * 详情
@@ -104,8 +109,27 @@
 	@ApiOperationSupport(order = 4)
 	@ApiOperation(value = "新增", notes = "传入social")
 	public R save(@Valid @RequestBody Social social) {
+		//更新用户是否缴纳社保状态
 		socialService.upSoil(social.getCardid());
-		return R.status(socialService.save(social));
+		//新增社保缴纳记录
+		boolean save = socialService.save(social);
+		if (save){
+			String sql =
+			"insert into sys_socil(id,namb,sex,nation,telephone,cardid,residence,amount,insuredtime,deptid) " +
+				"values(" + "'" + social.getId() + "'"
+				+ "," + "'" + social.getNamb() + "'"
+				+ "," + "'" + social.getSex() + "'" +
+				"," + "'" + social.getNation() + "'" +
+				"," + "'" + social.getTelephone() + "'" +
+				"," + "'" + social.getCardid() + "'" +
+				"," + "'" + social.getResidence() + "'" +
+				"," + "'" + social.getAmount() + "'" +
+				"," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(social.getInsuredtime()) + "'" +
+				"," + "'" + social.getDeptid() + "'" + ")";
+			myAsyncService.dataSync(sql);
+		}
+		//返回
+		return R.status(save);
 	}
 
 	/**
@@ -135,8 +159,18 @@
 	@PostMapping("/remove")
 	@ApiOperationSupport(order = 8)
 	@ApiOperation(value = "删除", notes = "传入ids")
+	@Transactional(rollbackFor = Exception.class)
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-		return R.status(socialService.removeByIds(Func.toLongList(ids)));
+		boolean remove = socialService.removeByIds(Func.toLongList(ids));
+		if (remove) {
+			List<String> list = Arrays.asList(ids.split(","));
+			list.forEach(s -> {
+				//内网同步删除
+				String s1 = "delete from sys_socil where id = " + "'" + s + "'";
+				myAsyncService.dataSync(s1);
+			});
+		}
+		return R.status(remove);
 	}
 
 
@@ -166,8 +200,8 @@
 		socialExcel.setBirthday(new SimpleDateFormat("yyyy/MM/dd").parse("1999/5/1"));
 		socialExcel.setTelephone("13112341234");
 		socialExcel.setCardid("360XXX19XXXXXX****");
-		socialExcel.setResidence("江西省南昌市***********");
-		socialExcel.setAddress("江西省南昌市***********");
+		socialExcel.setResidence("山西省晋城市***********");
+		socialExcel.setAddress("山西省晋城市***********");
 		socialExcel.setNature("城镇");
 		socialExcel.setAmount("1000.00");
 		socialExcel.setInsuredtime(new SimpleDateFormat("yyyy/MM/dd").parse("2020/5/1"));
@@ -180,8 +214,8 @@
 		socialExcel1.setBirthday(new SimpleDateFormat("yyyy/MM/dd").parse("1999/5/1"));
 		socialExcel1.setTelephone("13112341234");
 		socialExcel1.setCardid("360XXX19XXXXXX****");
-		socialExcel1.setResidence("江西省南昌市***********");
-		socialExcel1.setAddress("江西省南昌市***********");
+		socialExcel1.setResidence("山西省晋城市***********");
+		socialExcel1.setAddress("山西省晋城市***********");
 		socialExcel1.setNature("农村");
 		socialExcel1.setAmount("1000.00");
 		socialExcel1.setInsuredtime(new SimpleDateFormat("yyyy/MM/dd").parse("2020/5/1"));

--
Gitblit v1.9.3