Commit 840b5151 authored by suichenguang's avatar suichenguang

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/java/com/yxproject/start/api/BizApi.java
#	src/main/java/com/yxproject/start/api/ExportExcelApi.java
#	src/main/java/com/yxproject/start/api/ReadExcelApi.java
#	src/main/java/com/yxproject/start/utils/ExportExcel.java
parents ce55e450 c1e98ab7
package com.yxproject.start.api;
import com.yxproject.start.service.PoliceStationApplyReasonService;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
*/
@RestController
@RequestMapping("api")
public class BizApi {
@Autowired
private PoliceStationApplyReasonService policeStationApplyReasonService;
/**
* 保存派出所申领表数据
* @param taskIdList
* @return
*/
@RequestMapping("savePoliceApplicationData")
public int savePoliceApplicationData(@RequestBody String taskIdList) {
JSONArray jsonArray = JSONArray.fromObject(taskIdList);
int i = policeStationApplyReasonService.getAndSavePoliceStationApplyReason(jsonArray);
return i;
}
}
//package com.yxproject.start.api;
//
//import com.yxproject.start.entity.PersonPostAbnormalEntity;
//import com.yxproject.start.entity.RedoRegistrationEntity;
//import com.yxproject.start.entity.TemporaryCertificateEntity;
//import com.yxproject.start.utils.ExportExcel;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.List;
//
//@RestController
//@RequestMapping("exportExcel")
//public class ExportExcelApi {
// /**
// * 导出临时证信息
// */
// @RequestMapping("ExportTemporaryCertificate")
// public boolean ExportTemporaryCertificate(){
// PersonPostAbnormalEntity temporaryCertificate = new PersonPostAbnormalEntity();
// ExportExcel obj = new ExportExcel();
// obj.exportTemporaryCertificateExcel((List<TemporaryCertificateEntity>) temporaryCertificate);
// return true;
// }
// /**
// * 导出重做证件信息
// */
// @RequestMapping("ExportRedoRegistration")
// public boolean ExportRedoRegistration(){
// RedoRegistrationEntity redoRegistration = new RedoRegistrationEntity();
// ExportExcel obj = new ExportExcel();
// obj.exportRedoRegistrationExcel((List<RedoRegistrationEntity>) redoRegistration);
// return true;
// }
//
//}
This diff is collapsed.
package com.yxproject.start.dto;
/**
* @author Administrator
*/
public class PoliceApplyCountDto {
private String policeStationCode;
private String drawType;
private int applyCount;
public String getPoliceStationCode() {
return policeStationCode;
}
public void setPoliceStationCode(String policeStationCode) {
this.policeStationCode = policeStationCode;
}
public String getDrawType() {
return drawType;
}
public void setDrawType(String drawType) {
this.drawType = drawType;
}
public int getApplyCount() {
return applyCount;
}
public void setApplyCount(int applyCount) {
this.applyCount = applyCount;
}
}
package com.yxproject.start.entity;
import javax.persistence.*;
@Entity
@Table(name = "TASK_STATE_DIC", schema = "AUXILIARY", catalog = "")
public class TaskStateDicEntity {
private long taskStateId;
private String taskState;
@Id
@Column(name = "TASK_STATE_ID")
public long getTaskStateId() {
return taskStateId;
}
public void setTaskStateId(long taskStateId) {
this.taskStateId = taskStateId;
}
@Basic
@Column(name = "TASK_STATE")
public String getTaskState() {
return taskState;
}
public void setTaskState(String taskState) {
this.taskState = taskState;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TaskStateDicEntity that = (TaskStateDicEntity) o;
if (taskStateId != that.taskStateId) return false;
if (taskState != null ? !taskState.equals(that.taskState) : that.taskState != null) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (taskStateId ^ (taskStateId >>> 32));
result = 31 * result + (taskState != null ? taskState.hashCode() : 0);
return result;
}
}
package com.yxproject.start.mapper;
import com.yxproject.start.dto.PoliceApplyCountDto;
import com.yxproject.start.entity.PoliceStationApplyReasonEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @author Administrator
*/
@Mapper
public interface PoliceStationApplyReasonMapper {
@Select("SELECT SUBSTR(B.UPLOAD_NO,0,9) police_station_code,B.DRAW_TYPE,count(b.UPLOAD_NO) apply_count from GROUP_NO a\n" +
" LEFT JOIN PROD_APPLY_INFO_T@prod_link b ON a.GROUP_NO=substr(b.ACCEPT_NO,0,8)\n" +
"WHERE TASK_ID=#{taskId} GROUP BY SUBSTR(B.UPLOAD_NO,0,9),B.DRAW_TYPE")
public List<PoliceApplyCountDto> getPoliceStationApplyReason(@Param("taskId") String taskId);
@Insert("INSERT INTO POLICE_STATION_APPLY_REASON(SAVE_DATE,TASK_ID,POLICE_STATION_CODE,APPLY_CODE,APPLY_COUNT)\n" +
"VALUES(SYSDATE,#{taskId},#{policeStationCode},#{drawType},#{applyCount})")
public int savePoliceStationApplyReason(@Param("taskId") String taskId,@Param("policeStationCode")String policeStationCode,@Param("drawType")String drawType,@Param("applyCount")int applyCount);
}
package com.yxproject.start.service;
import net.sf.json.JSONArray;
public interface PoliceStationApplyReasonService {
public int getAndSavePoliceStationApplyReason(JSONArray jsonArray);
}
package com.yxproject.start.service.impl;
import com.yxproject.start.dto.PoliceApplyCountDto;
import com.yxproject.start.entity.PoliceStationApplyReasonEntity;
import com.yxproject.start.mapper.PoliceStationApplyReasonMapper;
import com.yxproject.start.service.PoliceStationApplyReasonService;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class PoliceStationApplyReasonServiceImpl implements PoliceStationApplyReasonService{
@Autowired
private PoliceStationApplyReasonMapper policeStationApplyReasonMapper;
@Override
@Transactional(rollbackFor=Exception.class)
public int getAndSavePoliceStationApplyReason(JSONArray taskIdArray) {
int count = 0;
for (Object object:taskIdArray){
List<PoliceApplyCountDto> list = policeStationApplyReasonMapper.getPoliceStationApplyReason(object.toString());
System.out.println(object.toString());
System.out.println(list);
for(int i=0;i<list.size();i++){
int saveCount = policeStationApplyReasonMapper.savePoliceStationApplyReason(object.toString(),list.get(i).getPoliceStationCode(),list.get(i).getDrawType(),list.get(i).getApplyCount());
count+=saveCount;
}
}
return count;
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment