Commit 6d748685 authored by dahai's avatar dahai

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

parents c2d36cdb d538ee0d
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;
import com.yxproject.start.entity.FileNameDicEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.*;
/**
* @auther zhangyusheng
......@@ -14,4 +12,8 @@ public interface FileNameDicMapper {
@Insert("INSERT INTO FILE_NAME_DIC (FILE_NAME,UPLOAD_DATE) VALUES (#{fileName},#{uploadDate})")
@Options(useGeneratedKeys=true, keyProperty="fileId", keyColumn="fileId")
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;
import com.sun.xml.internal.bind.v2.TODO;
import com.yxproject.start.entity.PersonPostEntity;
import org.apache.ibatis.annotations.*;
import java.util.List;
......@@ -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))")
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} );")
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')")
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 {
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;
import com.yxproject.start.entity.PersonPostEntity;
import com.yxproject.start.mapper.FileNameDicMapper;
import com.yxproject.start.mapper.PersonPostMapper;
import com.yxproject.start.mapper.PreproPersonMapper;
import com.yxproject.start.service.PersonPostService;
......@@ -19,6 +20,8 @@ import java.util.List;
public class PersonPostServiceImpl implements PersonPostService {
@Autowired
private PersonPostMapper personPostMapper;
@Autowired
private FileNameDicMapper fileNameDicMapper;
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -31,8 +34,24 @@ public class PersonPostServiceImpl implements PersonPostService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateIsPost(String fileId, String creatTime) {
fileNameDicMapper.updataState(fileId);
personPostMapper.updateIsPost(fileId,creatTime);
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;
}
}
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