Commit 0cb56db4 by 雷紫添

后盖先原则

parent 8dfc3f1f
......@@ -13,5 +13,6 @@ import java.util.List;
public interface RycjDao {
int insertRycj(Rycj rycj);
Rycj selectByPrimaryKey(String taskid);
int updateByPrimaryKey(Rycj Rycj);
}
......@@ -47,12 +47,13 @@ public class JccjServiceImpl implements JccjService {
Map<String, Object> res = new HashMap<>();
if(sf){
res.put("status_code", "010101");
res.put("message", "存入成功");
res.put("message", "入省库成功");
res.put("taskid", jccj.getTaskid());
}
else{
res.put("status_code", "010102");
res.put("message", "存入失败");
res.put("status_code", "010104");
res.put("message", "存入省库失败");
res.put("taskid", jccj.getTaskid());
}
return res;
}
......
......@@ -10,6 +10,7 @@ import com.founder.util.RequertUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
......@@ -22,8 +23,7 @@ import java.util.Date;
public class RycjServiceImpl implements RycjService {
@Autowired
private RycjDao rycjDao;
/*@Autowired
private AutoSeqService autoSeqService;*/
@Value(value = "${ftpfilePath}")
private String ftpfilePath;
......@@ -44,7 +44,7 @@ public class RycjServiceImpl implements RycjService {
Rycj rycj=new Rycj();
SimpleDateFormat sf = new SimpleDateFormat("yyyyMM");
String dateString = sf.format(new Date());
// rycj.setXxzjbh( autoSeqService.xxzjbhFnVal("TB_ST_RYCJ",jccj.getUser_dept()));
rycj.setTaskid(jccj.getTaskid());
rycj.setRycj_dzwjgs(".zip");
rycj.setRycj_dzwjwz(ftpfilePath+"/"+dateString+"/"+rycj.getTaskid()+rycj.getRycj_dzwjgs());
rycj.setRycj_bt(dateString);
......@@ -61,15 +61,24 @@ public class RycjServiceImpl implements RycjService {
InputStream in = new ByteArrayInputStream(data);
boolean bool = false;
try {
int rows =rycjDao.insertRycj(rycj);
Rycj yrycj= rycjDao.selectByPrimaryKey(jccj.getTaskid());
if(yrycj!=null){
int rows =rycjDao.updateByPrimaryKey(rycj);
bool= FtpUtil.uploadFile(ftpserverip,ftpport,ftpuser,ftppass,ftpbathPath,yrycj.getRycj_bt(),rycj.getTaskid()+rycj.getRycj_dzwjgs(),in);
bool= FtpUtil.uploadFile(ftpserverip,ftpport,ftpuser,ftppass,ftpbathPath,dateString,rycj.getTaskid()+rycj.getRycj_dzwjgs(),in);
if (rows > 0) {
bool = true;
}
}else {
int rows = rycjDao.insertRycj(rycj);
bool = FtpUtil.uploadFile(ftpserverip, ftpport, ftpuser, ftppass, ftpbathPath, dateString, rycj.getTaskid() + rycj.getRycj_dzwjgs(), in);
if (rows>0){
bool=true;
if (rows > 0) {
bool = true;
}
}
}catch (Exception e){
System.out.print("增加失败"+e.getMessage());
System.out.print("增加或更新失败"+e.getMessage());
}
return bool;
}
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.founder.dao.RycjDao">
<resultMap id="rycj" type="com.founder.model.Rycj">
<id column="TASKID" property="taskid" jdbcType="VARCHAR" />
<result column="RYCJ_BT" property="rycj_bt" jdbcType="VARCHAR"/>
</resultMap>
<select id="selectByPrimaryKey" resultMap="rycj" parameterType="java.lang.String"
resultType="com.founder.model.Rycj">
select
RYCJ_BT,
TASKID
from TB_ST_RYCJ
where TASKID = #{ TASKID,jdbcType=VARCHAR }
</select>
<update id="updateByPrimaryKey" parameterType="com.founder.model.Rycj" >
update TB_ST_RYCJ
set
USER_ID = #{ user_id , jdbcType=VARCHAR }
,USER_DEPT = #{ user_dept , jdbcType=VARCHAR }
, STATUS_CODE = #{ status_code , jdbcType=VARCHAR }
, VERSION = #{ version , jdbcType=VARCHAR }
where TASKID = #{ taskid,jdbcType=VARCHAR }
</update>
<insert id="insertRycj" parameterType="com.founder.model.Rycj">
INSERT INTO TB_ST_RYCJ (
......
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