Commit 0c19b6274172335177078c8ba27e2248f23db013

Authored by wxy
1 parent 416e1e27

未成年人新增修改

juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/MinorController.java
... ... @@ -121,10 +121,18 @@ public class MinorController {
121 121 @ApiOperation(value = "未成年人-添加", notes = "未成年人-添加")
122 122 @PostMapping(value = "/add")
123 123 public Result<?> add(@RequestBody MinorPage minorPage) {
124   - Minor minor = new Minor();
125   - BeanUtils.copyProperties(minorPage, minor);
126   - minorService.saveMain(minor, minorPage.getFamilyList());
127   - return Result.OK("添加成功!");
  124 +// Integer count=0;
  125 +// if(oConvertUtils.isNotEmpty(minorPage) && oConvertUtils.isNotEmpty(minorPage.getIdentity())){
  126 +// count=minorService.getMinorByIdCard(minorPage.getIdentity());
  127 +// }
  128 +// if(count==0){
  129 + Minor minor = new Minor();
  130 + BeanUtils.copyProperties(minorPage, minor);
  131 + minorService.saveMain(minor, minorPage.getFamilyList());
  132 + return Result.OK("添加成功!");
  133 +// }else {
  134 +// return Result.error("身份证号重复!");
  135 +// }
128 136 }
129 137  
130 138 /**
... ... @@ -271,11 +279,6 @@ public class MinorController {
271 279 @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
272 280 public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
273 281 MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
274   - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
275   - String sysOrgCode="";
276   - if(oConvertUtils.isNotEmpty(sysUser) && oConvertUtils.isNotEmpty(sysUser.getOrgCode())){
277   - sysOrgCode=sysUser.getOrgCode();
278   - }
279 282 Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
280 283 for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
281 284 MultipartFile file = entity.getValue();// 获取上传文件对象
... ... @@ -291,21 +294,9 @@ public class MinorController {
291 294 //获取Excel文档中的第一个表单
292 295 Sheet sht0 = workbook.getSheetAt(0);
293 296 List<Minor> minorPages=new ExcelImportServiceUtil().importExcel(new ArrayList<>(),sht0, Minor.class, params,pictures);
294   - if(oConvertUtils.isNotEmpty(minorPages) && oConvertUtils.isNotEmpty(sysOrgCode)){
295   - String finalSysOrgCode = sysOrgCode;
296   - minorPages.stream().forEach(minor -> {
297   - minor.setSysOrgCode(finalSysOrgCode);
298   - });
299   - }
300 297 //获取Excel文档中的第二个表单
301 298 Sheet sht1 = workbook.getSheetAt(1);
302 299 List<Family> families=new ExcelImportServiceUtil().importExcel(new ArrayList<>(),sht1, Family.class, params,pictures);
303   - if(oConvertUtils.isNotEmpty(families) && oConvertUtils.isNotEmpty(sysOrgCode)){
304   - String finalSysOrgCode = sysOrgCode;
305   - minorPages.stream().forEach(family -> {
306   - family.setSysOrgCode(finalSysOrgCode);
307   - });
308   - }
309 300 minorService.saveMain(minorPages,families);
310 301 return Result.OK();
311 302 } catch (Exception e) {
... ...
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/MinorMapper.java
... ... @@ -28,5 +28,11 @@ public interface MinorMapper extends BaseMapper&lt;Minor&gt; {
28 28 */
29 29 IPage<Minor> queryPageList(Page page,@Param("name") String name,@Param("sysOrgCode") String sysOrgCode);
30 30  
  31 + /**
  32 + * 根据身份证号查询总数
  33 + * @param identity
  34 + * @return
  35 + */
  36 + Integer getMinorByIdCard(@Param("identity") String identity);
31 37  
32 38 }
... ...
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/MinorMapper.xml
... ... @@ -43,7 +43,12 @@
43 43 <if test="sysOrgCode!=null and sysOrgCode!=''">
44 44 and sys_org_code like concat(#{sysOrgCode},'%')
45 45 </if>
46   - ORDER BY create_time
  46 + ORDER BY create_time desc
  47 + </select>
  48 +
  49 + <select id="getMinorByIdCard" parameterType="java.lang.String" >
  50 + select count(*)
  51 + from mr_minor where identity =#{identity };
47 52 </select>
48 53  
49 54 </mapper>
50 55 \ No newline at end of file
... ...
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IMinorService.java
... ... @@ -3,6 +3,7 @@ package org.jeecg.modules.system.service;
3 3 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 5 import com.baomidou.mybatisplus.extension.service.IService;
  6 +import org.apache.ibatis.annotations.Param;
6 7 import org.jeecg.modules.system.entity.Family;
7 8 import org.jeecg.modules.system.entity.Minor;
8 9 import org.jeecg.modules.system.entity.SysDepart;
... ... @@ -52,4 +53,11 @@ public interface IMinorService extends IService&lt;Minor&gt; {
52 53 *
53 54 */
54 55 public void saveMain(List<Minor> minor,List<Family> familyList) ;
  56 +
  57 + /**
  58 + * 根据身份证号查询总数
  59 + * @param identity
  60 + * @return
  61 + */
  62 + Integer getMinorByIdCard(String identity);
55 63 }
... ...
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MinorServiceImpl.java
... ... @@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 5 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 6 import javassist.bytecode.analysis.Executor;
  7 +import org.apache.ibatis.annotations.Param;
  8 +import org.apache.shiro.SecurityUtils;
  9 +import org.jeecg.common.system.vo.LoginUser;
7 10 import org.jeecg.common.util.oConvertUtils;
8 11 import org.jeecg.modules.system.entity.Family;
9 12 import org.jeecg.modules.system.entity.Minor;
... ... @@ -20,10 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
20 23  
21 24 import javax.annotation.Resource;
22 25 import java.io.Serializable;
23   -import java.util.ArrayList;
24   -import java.util.Collection;
25   -import java.util.List;
26   -import java.util.Random;
  26 +import java.util.*;
27 27 import java.util.concurrent.CountDownLatch;
28 28 import java.util.concurrent.ExecutorService;
29 29 import java.util.concurrent.Executors;
... ... @@ -56,53 +56,79 @@ public class MinorServiceImpl extends ServiceImpl&lt;MinorMapper, Minor&gt; implements
56 56 @Override
57 57 @Transactional
58 58 public void saveMain(Minor minor, List<Family> familyList) {
59   - minorMapper.insert(minor);
  59 +
60 60 if(familyList!=null && familyList.size()>0) {
61 61 //判断家庭成员信息里的数据是否包含未成年人,默认包含
62 62 Boolean falg=true;
  63 + //家庭成员是否有人犯罪,默认没有人犯罪
  64 + Boolean isCrime=false;
63 65 //户籍信息去重
64 66 List<Family> families= familyList.stream().distinct().collect(Collectors.toList());
65 67 for(Family entity:families) {
66 68 if(!entity.getIdentity().equals(minor.getIdentity())) {
67 69 falg = false;
68 70 }
69   - //外键设置
70   - familyMapper.insert(entity);
  71 + if(oConvertUtils.isNotEmpty(entity.getCrime()) && entity.getCrime().equals(Family.IS_CRIME)){
  72 + isCrime=true;
  73 + }
71 74 }
72   - if(!falg){
73   - Family family=new Family();
74   - family.setCrime(Family.IS_NOT_CRIME);
75   - family.setName(minor.getName());
76   - family.setHouseholdNum(minor.getHouseholdNum());
77   - family.setIdentity(minor.getIdentity());
78   - family.setNumber(minor.getNumber());
79   - family.setGender(minor.getGender());
80   - family.setAddress(minor.getAddress());
81   - family.setRelation(minor.getRelation());
  75 + if(isCrime){
  76 + minor.setReason(String.valueOf(Minor.ATTENTION_REASON_CRIME));
82 77 }
83 78 }
  79 +
  80 + familyMapper.insertBatch(familyList);
  81 + minorMapper.insert(minor);
84 82 }
85 83  
86 84 @Override
87 85 @Transactional
88 86 public void updateMain(Minor minor,List<Family> familyList) {
89   - minorMapper.updateById(minor);
90   -
91 87 //1.先删除子表数据
92 88 if(oConvertUtils.isNotEmpty(minor) && oConvertUtils.isNotEmpty(minor.getHouseholdNum())){
93 89 familyMapper.deleteByHouseholdNum(minor.getHouseholdNum());
94 90 }
95   -
96 91 //2.子表数据重新插入
97 92 if(familyList!=null && familyList.size()>0) {
  93 + //判断家庭成员信息里的数据是否包含未成年人,默认包含
  94 + Boolean falg=true;
  95 + //家庭成员是否有人犯罪,默认没有人犯罪
  96 + Boolean isCrime=false;
98 97 //户籍信息去重
99 98 List<Family> families= familyList.stream().distinct().collect(Collectors.toList());
100   - for(Family entity:familyList) {
101   - //外键设置
102   - entity.setMinorId(minor.getId());
103   - familyMapper.insert(entity);
  99 + for(Family entity:families) {
  100 + if(!entity.getIdentity().equals(minor.getIdentity())) {
  101 + falg = false;
  102 + }
  103 + if(oConvertUtils.isNotEmpty(entity.getCrime()) && entity.getCrime().equals(Family.IS_CRIME)){
  104 + isCrime=true;
  105 + }
104 106 }
  107 +// if(!falg){
  108 +// Family family=new Family();
  109 +// family.setCrime(Family.IS_NOT_CRIME);
  110 +// family.setName(minor.getName());
  111 +// family.setHouseholdNum(minor.getHouseholdNum());
  112 +// family.setIdentity(minor.getIdentity());
  113 +// family.setNumber(minor.getNumber());
  114 +// family.setGender(minor.getGender());
  115 +// family.setAddress(minor.getAddress());
  116 +// family.setRelation(minor.getRelation());
  117 +// families.add(family);
  118 +// }
  119 + if(isCrime){
  120 + if(oConvertUtils.isNotEmpty(minor.getReason())){
  121 + if(!minor.getReason().contains(String.valueOf(Minor.ATTENTION_REASON_CRIME))){
  122 + minor.setReason(minor.getReason()+","+Minor.ATTENTION_REASON_CRIME);
  123 + }
  124 + }else {
  125 + minor.setReason(String.valueOf(Minor.ATTENTION_REASON_CRIME));
  126 + }
  127 + }
  128 + familyMapper.insertBatch(familyList);
105 129 }
  130 +
  131 + minorMapper.updateById(minor);
106 132 }
107 133  
108 134 @Override
... ... @@ -153,8 +179,56 @@ public class MinorServiceImpl extends ServiceImpl&lt;MinorMapper, Minor&gt; implements
153 179 @Override
154 180 @Transactional
155 181 public void saveMain(List<Minor> minors, List<Family> familyList) {
156   - minorMapper.insertBatch(minors);
  182 + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
  183 + String sysOrgCode="";
  184 + if(oConvertUtils.isNotEmpty(sysUser) && oConvertUtils.isNotEmpty(sysUser.getOrgCode())){
  185 + sysOrgCode=sysUser.getOrgCode();
  186 + }
  187 + Date createTime=new Date();
  188 + //存放是否犯罪为是的户号和某一个家庭成员的信息
  189 + Map<String,Family> houseFamily=new HashMap<>();
  190 + if(oConvertUtils.isNotEmpty(familyList) ){
  191 + String finalSysOrgCode = sysOrgCode;
  192 + familyList.stream().forEach(family -> {
  193 + if(oConvertUtils.isNotEmpty(family)){
  194 + family.setCreateTime(createTime);
  195 + family.setSysOrgCode(finalSysOrgCode);
  196 + if(oConvertUtils.isNotEmpty(family.getCrime()) && oConvertUtils.isNotEmpty(family.getHouseholdNum())){
  197 + houseFamily.put(family.getHouseholdNum(),family);
  198 + }
  199 + }
  200 + });
  201 + }
  202 + if(oConvertUtils.isNotEmpty(minors)){
  203 + String finalSysOrgCode = sysOrgCode;
  204 + minors.stream().forEach(minor -> {
  205 + if(oConvertUtils.isNotEmpty(minor)){
  206 + minor.setCreateTime(createTime);
  207 + if(oConvertUtils.isNotEmpty(houseFamily) && oConvertUtils.isNotEmpty(minor.getHouseholdNum())){
  208 + String houseNum=minor.getHouseholdNum();
  209 + Family family=houseFamily.get(houseNum);
  210 + if(oConvertUtils.isNotEmpty(family) && oConvertUtils.isNotEmpty(family.getSysOrgCode())){
  211 + minor.setSysOrgCode(family.getSysOrgCode());
  212 + if(oConvertUtils.isNotEmpty(minor.getReason())){
  213 + if(!minor.getReason().contains(String.valueOf(Minor.ATTENTION_REASON_CRIME))){
  214 + minor.setReason(minor.getReason()+","+Minor.ATTENTION_REASON_CRIME);
  215 + }
  216 + }else {
  217 + minor.setReason(String.valueOf(Minor.ATTENTION_REASON_CRIME));
  218 + }
  219 + }else {
  220 + minor.setSysOrgCode(finalSysOrgCode);
  221 + }
  222 + //1.先删除子表数据
  223 + familyMapper.deleteByHouseholdNum(minor.getHouseholdNum());
  224 + }else {
  225 + minor.setSysOrgCode(finalSysOrgCode);
  226 + }
  227 + }
  228 + });
  229 + }
157 230 familyMapper.insertBatch(familyList);
  231 + minorMapper.insertBatch(minors);
158 232 }
159 233  
160 234  
... ... @@ -209,4 +283,14 @@ public class MinorServiceImpl extends ServiceImpl&lt;MinorMapper, Minor&gt; implements
209 283  
210 284 System.out.println("主线程完成");
211 285 }
  286 +
  287 + /**
  288 + * 根据身份证号查询总数
  289 + * @param identity
  290 + * @return
  291 + */
  292 + @Override
  293 + public Integer getMinorByIdCard(String identity){
  294 + return minorMapper.getMinorByIdCard(identity);
  295 + }
212 296 }
... ...
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/vo/MinorPage.java
... ... @@ -100,7 +100,7 @@ public class MinorPage {
100 100 @Excel(name = "重点关注原因", width = 15,dicCode = "attention_reason")
101 101 @ApiModelProperty(value = "重点关注原因")
102 102 @Dict(dicCode = "attention_reason")
103   - private Integer reason;
  103 + private String reason;
104 104 /**特殊原因*/
105 105 @Excel(name = "特殊原因", width = 15)
106 106 @ApiModelProperty(value = "特殊原因")
... ...
juvenile-prosecution-vue/src/views/business/MinorList.vue
... ... @@ -60,7 +60,7 @@
60 60 :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
61 61 @change="handleTableChange">
62 62 <span slot="longText" slot-scope="text,record">
63   - <j-ellipsis :value="text" :length="18" />
  63 + <j-ellipsis :value="text" :length="15" />
64 64 </span>
65 65 <span slot="action" slot-scope="text, record">
66 66 <a @click="handleEdit(record)">编辑</a>
... ... @@ -171,7 +171,8 @@ export default {
171 171 {
172 172 title: '学校名称',
173 173 align: 'center',
174   - dataIndex: 'schoolName'
  174 + dataIndex: 'schoolName',
  175 + scopedSlots: { customRender: 'longText' }
175 176 },
176 177 {
177 178 title: '入学年份',
... ... @@ -207,7 +208,8 @@ export default {
207 208 {
208 209 title: '重点关注原因',
209 210 align: 'center',
210   - dataIndex: 'reason_dictText'
  211 + dataIndex: 'reason_dictText',
  212 + scopedSlots: { customRender: 'longText' }
211 213 },
212 214 {
213 215 title: '操作',
... ...
juvenile-prosecution-vue/src/views/business/modules/MinorModal.vue
... ... @@ -78,7 +78,11 @@
78 78 </a-col>
79 79 <a-col :span="12">
80 80 <a-form-model-item label="重点关注原因" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="reason">
81   - <j-dict-select-tag v-model="model.reason" dictCode="attention_reason" placeholder="请选择重点关注原因" />
  81 + <j-multi-select-tag
  82 + v-model="model.reason"
  83 + dictCode="attention_reason"
  84 + placeholder="请选择重点关注原因">
  85 + </j-multi-select-tag>
82 86 </a-form-model-item>
83 87 </a-col>
84 88 <a-col :span="12">
... ... @@ -166,7 +170,7 @@ export default {
166 170 width: '230px',
167 171 type: FormTypes.input,
168 172 defaultValue: '',
169   - placeholder: '请输入${title}',
  173 + placeholder: '请输入',
170 174 validateRules: [{ required: true, message: '${title}不能为空' }]
171 175 },
172 176 {
... ... @@ -175,8 +179,7 @@ export default {
175 179 width: '230px',
176 180 type: FormTypes.input,
177 181 defaultValue: '',
178   - placeholder: '请输入${title}',
179   - validateRules: [{ required: true, message: '${title}不能为空' }]
  182 + placeholder: '请输入',
180 183 },
181 184 {
182 185 title: '姓名',
... ... @@ -184,7 +187,7 @@ export default {
184 187 width: '100px',
185 188 type: FormTypes.input,
186 189 defaultValue: '',
187   - placeholder: '请输入${title}',
  190 + placeholder: '请输入',
188 191 validateRules: [{ required: true, message: '${title}不能为空' }]
189 192 },
190 193 {
... ... @@ -193,7 +196,7 @@ export default {
193 196 width: '190px',
194 197 type: FormTypes.input,
195 198 defaultValue: '',
196   - placeholder: '请输入${title}',
  199 + placeholder: '请输入',
197 200 validateRules: [{
198 201 // pattern: '/(^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{7}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)/',
199 202 pattern: '^\\d{6}(18|19|20)?\\d{2}(0[1-9]|1[012])(0[1-9]|[12]\\d|3[01])\\d{3}(\\d|[xX])$',
... ... @@ -206,7 +209,7 @@ export default {
206 209 width: '120px',
207 210 type: FormTypes.input,
208 211 defaultValue: '',
209   - placeholder: '请输入${title}',
  212 + placeholder: '请输入',
210 213 validateRules: [{ required: true, message: '${title}不能为空' }]
211 214 },
212 215 {
... ... @@ -215,8 +218,7 @@ export default {
215 218 width: '180px',
216 219 type: FormTypes.input,
217 220 defaultValue: '',
218   - placeholder: '请输入${title}',
219   - validateRules: [{ required: true, message: '${title}不能为空' }]
  221 + placeholder: '请输入',
220 222 },
221 223 {
222 224 title: '现住址',
... ... @@ -224,7 +226,7 @@ export default {
224 226 width: '200px',
225 227 type: FormTypes.input_pop,
226 228 defaultValue: '',
227   - placeholder: '请输入${title}'
  229 + placeholder: '请输入'
228 230 },
229 231 {
230 232 title: '是否犯罪',
... ... @@ -233,8 +235,7 @@ export default {
233 235 type: FormTypes.select,
234 236 options: [],
235 237 dictCode: 'is_crime',
236   - placeholder: '请选择${title}',
237   - validateRules: [{ required: true, message: '${title}不能为空' }]
  238 + placeholder: '请选择',
238 239 },
239 240 {
240 241 title: '犯罪原因',
... ... @@ -242,7 +243,7 @@ export default {
242 243 width: '200px',
243 244 type: FormTypes.input_pop,
244 245 defaultValue: '',
245   - placeholder: '请输入${title}'
  246 + placeholder: '请输入'
246 247 },
247 248 {
248 249 title: '其他参考信息',
... ... @@ -250,7 +251,7 @@ export default {
250 251 width: '200px',
251 252 type: FormTypes.input_pop,
252 253 defaultValue: '',
253   - placeholder: '请输入${title}'
  254 + placeholder: '请输入'
254 255 }
255 256 ]
256 257 }
... ...