Commit 0e45c02e authored by suichenguang's avatar suichenguang

自主删除个人邮寄信息

parent 6d711bfa
...@@ -16,7 +16,10 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -16,7 +16,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context; import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
...@@ -37,16 +40,18 @@ public class ImportXmlApi { ...@@ -37,16 +40,18 @@ public class ImportXmlApi {
* @return 成功返回 上传完成 失败返回 异常信息 * @return 成功返回 上传完成 失败返回 异常信息
*/ */
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
@RequestMapping("getXMLToCheck") @RequestMapping("getXMLToCheck")
public String getXMLToCheck(@Context HttpServletResponse resp, @Context HttpServletRequest requ) { public String getXMLToCheck(@Context HttpServletResponse resp, @Context HttpServletRequest requ) {
System.out.println("输入:"+requ);
System.out.println("输入2:"+resp);
YXJSONResponse yxresp = new YXJSONResponse(); YXJSONResponse yxresp = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8"); resp.setCharacterEncoding("UTF-8");
String filename = ""; String filename = "";
DiskFileItemFactory factory = new DiskFileItemFactory(); DiskFileItemFactory factory = new DiskFileItemFactory();
// 设置缓冲区的大小为100KB,如果不指定,那么缓冲区的大小默认是10KB // 设置缓冲区的大小为100KB,如果不指定,那么缓冲区的大小默认是10KB
factory.setSizeThreshold(1024 * 100); factory.setSizeThreshold(1024 * 100);
ServletFileUpload upload = new ServletFileUpload(factory); ServletFileUpload upload = new ServletFileUpload(factory);
upload.setHeaderEncoding("UTF-8"); upload.setHeaderEncoding("UTF-8");
// 设置上传单个文件的大小的最大值,目前是设置为1024*1024*10字节,也就是10MB // 设置上传单个文件的大小的最大值,目前是设置为1024*1024*10字节,也就是10MB
......
package com.yxproject.start.api;
import com.yxproject.start.entity.PersonPostEntity;
import com.yxproject.start.service.PersonPostService;
import net.sf.json.JSONObject;
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.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* 自主选择删除个人邮寄信息
*/
@RestController
@RequestMapping("personPostApi")
public class PersonPostApi {
@Autowired
PersonPostService personPostService;
/**
* 按条件查询个人邮寄信息
* @param jsonStr
* @return
*/
@RequestMapping("findPersonalData")
public List<PersonPostEntity> findPersonalData(@RequestBody String jsonStr){
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
String applicantName = jsonObject.getString("applicantName");
String orderNumber = jsonObject.getString("orderNumber");
String state = jsonObject.getString("state");
String latticeMouthInformation = jsonObject.getString("latticeMouthInformation");
List<String> getToCounty = new ArrayList<>();
getToCounty.add(jsonObject.getString("getToCounty"));
String uploadDate = jsonObject.getString("uploadDate");
String firstIndex = jsonObject.getString("firstIndex");
String pageSize = jsonObject.getString("pageSize");
List<PersonPostEntity> list = personPostService.findPersonalData(applicantName,orderNumber,state,latticeMouthInformation,getToCounty,uploadDate,firstIndex,pageSize);
return list;
}
/**
* 按条件删除个人邮寄信息
* @param jsonStr
* @return
*/
@RequestMapping("deletePersonalData")
public boolean deletePersonalData(@RequestBody String jsonStr){
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
String applicantName = jsonObject.getString("applicantName");
String orderNumber = jsonObject.getString("orderNumber");
String state = jsonObject.getString("state");
String latticeMouthInformation = jsonObject.getString("latticeMouthInformation");
List<String> getToCounty = new ArrayList<>();
getToCounty.add(jsonObject.getString("getToCounty"));
String uploadDate = jsonObject.getString("uploadDate");
personPostService.deletePersonalData(applicantName,orderNumber,state,latticeMouthInformation,getToCounty,uploadDate);
return true;
}
}
package com.yxproject.start.mapper; package com.yxproject.start.mapper;
import com.yxproject.start.entity.FileNameDicEntity; import com.yxproject.start.entity.FileNameDicEntity;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
/** /**
* @auther zhangyusheng * @auther zhangyusheng
...@@ -14,4 +12,8 @@ public interface FileNameDicMapper { ...@@ -14,4 +12,8 @@ public interface FileNameDicMapper {
@Insert("INSERT INTO FILE_NAME_DIC (FILE_NAME,UPLOAD_DATE) VALUES (#{fileName},#{uploadDate})") @Insert("INSERT INTO FILE_NAME_DIC (FILE_NAME,UPLOAD_DATE) VALUES (#{fileName},#{uploadDate})")
@Options(useGeneratedKeys=true, keyProperty="fileId", keyColumn="fileId") @Options(useGeneratedKeys=true, keyProperty="fileId", keyColumn="fileId")
public long saveFileNameDic(FileNameDicEntity fileNameDicEntity); public long saveFileNameDic(FileNameDicEntity fileNameDicEntity);
@Update("Updata FILE_NAME_DIC.STATE = 1 WHERE FILE_ID = #{fileId}")
public boolean updataState(@Param("fileId")String fileId);
} }
package com.yxproject.start.mapper; package com.yxproject.start.mapper;
import com.sun.xml.internal.bind.v2.TODO;
import com.yxproject.start.entity.PersonPostEntity; import com.yxproject.start.entity.PersonPostEntity;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import java.util.List; import java.util.List;
...@@ -14,10 +15,36 @@ public interface PersonPostMapper { ...@@ -14,10 +15,36 @@ public interface PersonPostMapper {
@Update("insert into PERSON_POST ( WAYBILL_NUMBER,BACK_WAYBILL_NUMBER,ORDER_NUMBER,CREATE_DATE,OPENID,WC_PLAY_ORDER_NUMBER,PLAY_STATE,ORDER_STATE,APPLICANT_NAME,SENDER_NAME,SENDER_PHONE,SENDER_ADDRESS,RECIPIENT_NAME,RECIPIENT_PHONE,RECIPIENT_ADDRESS,ORDER_BLANK_NUMBER,GET_TO_PROVINCE,GET_TO_CITY,GET_TO_COUNTY,BUSINESS_TYPE,LATTICE_MOUTH_INFORMATION,NATURE_OF_THE_INTERNAL,NATURE_OF_THE_INFORMATION,FIRST_WHITE,UPLOAD_DATE) values (#{waybillNumber},#{backWaybillNumber},#{orderNumber},#{createDate},#{openid},#{wcPlayOrderNumber},#{playState},#{orderState},#{applicantName},#{senderName},#{senderPhone},#{senderAddress},#{recipientName},#{recipientPhone},#{recipientAddress},#{orderBlankNumber},#{getToProvince},#{getToCity},#{getToCounty},#{businessType},#{latticeMouthInformation},#{natureOfTheInternal},#{natureOfTheInformation},#{firstWhite},#(uploadDate))") @Update("insert into PERSON_POST ( WAYBILL_NUMBER,BACK_WAYBILL_NUMBER,ORDER_NUMBER,CREATE_DATE,OPENID,WC_PLAY_ORDER_NUMBER,PLAY_STATE,ORDER_STATE,APPLICANT_NAME,SENDER_NAME,SENDER_PHONE,SENDER_ADDRESS,RECIPIENT_NAME,RECIPIENT_PHONE,RECIPIENT_ADDRESS,ORDER_BLANK_NUMBER,GET_TO_PROVINCE,GET_TO_CITY,GET_TO_COUNTY,BUSINESS_TYPE,LATTICE_MOUTH_INFORMATION,NATURE_OF_THE_INTERNAL,NATURE_OF_THE_INFORMATION,FIRST_WHITE,UPLOAD_DATE) values (#{waybillNumber},#{backWaybillNumber},#{orderNumber},#{createDate},#{openid},#{wcPlayOrderNumber},#{playState},#{orderState},#{applicantName},#{senderName},#{senderPhone},#{senderAddress},#{recipientName},#{recipientPhone},#{recipientAddress},#{orderBlankNumber},#{getToProvince},#{getToCity},#{getToCounty},#{businessType},#{latticeMouthInformation},#{natureOfTheInternal},#{natureOfTheInformation},#{firstWhite},#(uploadDate))")
public boolean savePersonPost(PersonPostEntity personPostEntity); public boolean savePersonPost(PersonPostEntity personPostEntity);
@Update("update prepro_person p set IS_POST=1 where p.JMSFZSLH in ( select p.JMSFZSLH from prepro_person p left join files files on p.file_id=files.ID \n" + @Update("update prepro_person p set IS_POST=9 where p.JMSFZSLH in ( select p.JMSFZSLH from prepro_person p left join files files on p.file_id=files.ID \n" +
"where JMSFZSLH in(select FIRST_WHITE from person_post where FILE_ID=#{fileId}) and files.CREAT_TIME=#{creatTime} );") "where JMSFZSLH in(select FIRST_WHITE from person_post where FILE_ID=#{fileId}) and files.CREAT_TIME=#{creatTime} );")
public boolean updateIsPost(@Param("fileId")String fileId,@Param("creatTime") String creatTime); public boolean updateIsPost(@Param("fileId")String fileId,@Param("creatTime") String creatTime);
@Select("SELECT * FROM PERSON_POST WHERE ID_CARD=idCard AND BEGIN_USEFUL_LIFE=to_date(#{startDate},'yyyyMMdd') AND VALID_PERIOD_END=to_date(#{endDate},'yyyyMMdd')") @Select("SELECT * FROM PERSON_POST WHERE ID_CARD=idCard AND BEGIN_USEFUL_LIFE=to_date(#{startDate},'yyyyMMdd') AND VALID_PERIOD_END=to_date(#{endDate},'yyyyMMdd')")
public List<PersonPostEntity> findAllByIdCardAndStartDateAndEndDate(String idCard, String startDate, String endDate); public List<PersonPostEntity> findAllByIdCardAndStartDateAndEndDate(String idCard, String startDate, String endDate);
//TODO getToCounty是List
@Select("SELECT * FROM PERSON_POST " +
" LEFT JOIN FILE_NAME_DIC ON FILE_NAME_DIC.FILE_ID=PERSON_POST.FILE_ID" +
"WHERE 1=1" +
" <when test='applicantName!=null'> and PERSON_POST.APPLICANT_NAME = #{applicantName} </when>" +
" <when test='orderNumber!=null'> and PERSON_POST.ORDER_NUMBER=#{orderNumber} </when>" +
" <when test='state!=null'> and PERSON_POST.STATE=#{state} </when>" +
" <when test='latticeMouthInformation!=null'> and PERSON_POST.LATTICE_MOUTH_INFORMATION=#{latticeMouthInformation} </when>" +
" <when test='getToCounty!=null'> and PERSON_POST.GET_TO_COUNTY =#{getToCounty} </when>" +
" <when test='uploadDate!=null'> and FILE_NAME_DIC.UPLOAD_DATE=#{uploadDate} </when>" +
"PERSON_POST limit #{firstIndex},#{pageSize}")
public List<PersonPostEntity> findAllPersonalData(@Param("applicantName")String applicantName,@Param("orderNumber")String orderNumber,@Param("state")String state,@Param("latticeMouthInformation")String latticeMouthInformation,List<String> getToCounty,@Param("uploadDate")String uploadDate,@Param("firstIndex")String firstIndex,@Param("pageSize")String pageSize);
@Delete("DELETE PERSON_POST " +
"WHERE 1=1" +
" <when test='applicantName!=null'> and PERSON_POST.APPLICANT_NAME = #{applicantName} </when>" +
" <when test='orderNumber!=null'> and PERSON_POST.ORDER_NUMBER=#{orderNumber} </when>" +
" <when test='state!=null'> and PERSON_POST.STATE=#{state} </when>" +
" <when test='latticeMouthInformation!=null'> and PERSON_POST.LATTICE_MOUTH_INFORMATION=#{latticeMouthInformation} </when>" +
" <when test='getToCounty!=null'> and PERSON_POST.GET_TO_COUNTY =#{getToCounty} </when>" +
" <when test='uploadDate!=null'> and FILE_NAME_DIC.UPLOAD_DATE=#{uploadDate} </when>")
public boolean deleteAllPersonalData(@Param("applicantName")String applicantName,@Param("orderNumber")String orderNumber,@Param("state")String state,@Param("latticeMouthInformation")String latticeMouthInformation,List<String> getToCounty ,@Param("uploadDate")String uploadDate);
} }
...@@ -21,4 +21,8 @@ public interface PersonPostService { ...@@ -21,4 +21,8 @@ public interface PersonPostService {
public boolean savePersonPost(List<PersonPostEntity> personPostEntities); public boolean savePersonPost(List<PersonPostEntity> personPostEntities);
public List<PersonPostEntity> findPersonalData(String applicantName,String orderNumber,String state,String latticeMouthInformation,List<String> getToCounty,String uploadDate,String firstIndex,String pageSize);
public boolean deletePersonalData(String applicantName,String orderNumber,String state,String latticeMouthInformation,List<String> getToCounty,String uploadDate);
} }
package com.yxproject.start.service.impl; package com.yxproject.start.service.impl;
import com.yxproject.start.entity.PersonPostEntity; import com.yxproject.start.entity.PersonPostEntity;
import com.yxproject.start.mapper.FileNameDicMapper;
import com.yxproject.start.mapper.PersonPostMapper; import com.yxproject.start.mapper.PersonPostMapper;
import com.yxproject.start.mapper.PreproPersonMapper; import com.yxproject.start.mapper.PreproPersonMapper;
import com.yxproject.start.service.PersonPostService; import com.yxproject.start.service.PersonPostService;
...@@ -19,6 +20,8 @@ import java.util.List; ...@@ -19,6 +20,8 @@ import java.util.List;
public class PersonPostServiceImpl implements PersonPostService { public class PersonPostServiceImpl implements PersonPostService {
@Autowired @Autowired
private PersonPostMapper personPostMapper; private PersonPostMapper personPostMapper;
@Autowired
private FileNameDicMapper fileNameDicMapper;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -31,8 +34,24 @@ public class PersonPostServiceImpl implements PersonPostService { ...@@ -31,8 +34,24 @@ public class PersonPostServiceImpl implements PersonPostService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public boolean updateIsPost(String fileId, String creatTime) { public boolean updateIsPost(String fileId, String creatTime) {
fileNameDicMapper.updataState(fileId);
personPostMapper.updateIsPost(fileId,creatTime); personPostMapper.updateIsPost(fileId,creatTime);
return true; return true;
} }
@Override
public List<PersonPostEntity> findPersonalData(String applicantName,String orderNumber,String state,String latticeMouthInformation,List<String> getToCounty,String uploadDate,String firstIndex,String pageSize){
List<PersonPostEntity> list = personPostMapper.findAllPersonalData(applicantName,orderNumber,state,latticeMouthInformation,getToCounty,uploadDate,firstIndex,pageSize);
return list;
}
@Override
public boolean deletePersonalData(String applicantName, String orderNumber, String state, String latticeMouthInformation, List<String> getToCounty, String uploadDate) {
personPostMapper.deleteAllPersonalData(applicantName,orderNumber,state,latticeMouthInformation,getToCounty,uploadDate);
return true;
}
} }
...@@ -72,8 +72,6 @@ public class IDCardFactory { ...@@ -72,8 +72,6 @@ public class IDCardFactory {
preproPersonEntity.setSjrTxdz(e.attributeValue("SJR_TXDZ")); preproPersonEntity.setSjrTxdz(e.attributeValue("SJR_TXDZ"));
preproPersonEntityList.add(preproPersonEntity); preproPersonEntityList.add(preproPersonEntity);
} }
resultMap.put("preproPerson",preproPersonEntityList); resultMap.put("preproPerson",preproPersonEntityList);
filesEntity.setRecordNumber((long)recordlist.size()); filesEntity.setRecordNumber((long)recordlist.size());
resultMap.put("file",filesEntity); resultMap.put("file",filesEntity);
......
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