出库导入记录报表

master
yinq 3 years ago
parent 2fc4a7993d
commit 18618a08d9

@ -0,0 +1,140 @@
package com.foreverwin.mesnac.anomaly.controller;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.CommonMethods;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.foreverwin.mesnac.anomaly.service.OutStoreService;
import com.foreverwin.mesnac.anomaly.model.OutStore;
import java.time.LocalDateTime;
import java.util.List;
/**
*
* @author YinQ
* @since 2022-09-15
*/
@RestController
@RequestMapping("/Z-OUT-STORE")
public class OutStoreController {
@Autowired
public OutStoreService outStoreService;
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getOutStoreById(@PathVariable String id) {
return R.ok( outStoreService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getOutStoreList(OutStore outStore){
List<OutStore> result;
QueryWrapper<OutStore> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(outStore);
result = outStoreService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<OutStore> frontPage, OutStore outStore){
IPage result;
QueryWrapper<OutStore> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(outStore);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(OutStore::getHandle, frontPage.getGlobalQuery())
.or().like(OutStore::getFactory, frontPage.getGlobalQuery())
.or().like(OutStore::getStockLocation, frontPage.getGlobalQuery())
.or().like(OutStore::getProjectNo, frontPage.getGlobalQuery())
.or().like(OutStore::getItem, frontPage.getGlobalQuery())
.or().like(OutStore::getItemDescription, frontPage.getGlobalQuery())
.or().like(OutStore::getImportUser, frontPage.getGlobalQuery())
.or().like(OutStore::getOther1, frontPage.getGlobalQuery())
.or().like(OutStore::getOther2, frontPage.getGlobalQuery())
.or().like(OutStore::getOther3, frontPage.getGlobalQuery())
);
}
result = outStoreService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param outStore
* @return null
*/
@PostMapping
public R save(@RequestBody OutStore outStore) {
String handle = StringUtil.createQUID();
String user = CommonMethods.getUser();
LocalDateTime now = LocalDateTime.now();
outStore.setHandle(handle);
if (StringUtil.isBlank(outStore.getImportUser())){
outStore.setImportUser(user);
}
outStore.setImportDateTime(now);
return R.ok(outStoreService.save(outStore));
}
/**
*
* @param outStore
* @return null
*/
@PutMapping
public R updateById(@RequestBody OutStore outStore) {
return R.ok(outStoreService.updateById(outStore));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(outStoreService.removeById(id));
}
/**
*
* @param ids ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.POST, value = "/delete-batch")
public R removeByIds(List<String> ids){
return R.ok(outStoreService.removeByIds(ids));
}
}

@ -0,0 +1,18 @@
package com.foreverwin.mesnac.anomaly.mapper;
import com.foreverwin.mesnac.anomaly.model.OutStore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper
* </p>
*
* @author YinQ
* @since 2022-09-15
*/
@Repository
public interface OutStoreMapper extends BaseMapper<OutStore> {
}

@ -0,0 +1,106 @@
package com.foreverwin.mesnac.anomaly.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.foreverwin.mesnac.common.model.ExcelColumn;
import lombok.Data;
/**
* <p>
*
* </p>
*
* @author YinQ
* @since 2022-09-15
*/
@TableName("Z_OUT_STORE")
@Data
public class OutStore extends Model<OutStore> {
/**
*
*/
@TableId(value = "HANDLE", type = IdType.INPUT)
@ExcelColumn(value = "HANDLE")
private String handle;
/**
*
*/
@TableField("FACTORY")
@ExcelColumn(value = "工厂")
private String factory;
/**
*
*/
@TableField("STOCK_LOCATION")
@ExcelColumn(value = "库存地点")
private String stockLocation;
/**
*
*/
@TableField("PROJECT_NO")
@ExcelColumn(value = "项目号")
private String projectNo;
/**
*
*/
@TableField("ITEM")
@ExcelColumn(value = "物料编号")
private String item;
/**
*
*/
@TableField("ITEM_DESCRIPTION")
@ExcelColumn(value = "物料描述")
private String itemDescription;
/**
*
*/
@TableField("QTY")
@ExcelColumn(value = "数量")
private Long qty;
/**
*
*/
@TableField("POSTING_DATE_TIME")
@ExcelColumn(value = "过账日期")
private LocalDateTime postingDateTime;
/**
*
*/
@TableField("IMPORT_USER")
@ExcelColumn(value = "导入人员")
private String importUser;
/**
*
*/
@TableField("IMPORT_DATE_TIME")
@ExcelColumn(value = "导入时间")
private LocalDateTime importDateTime;
@TableField("OTHER1")
@ExcelColumn(value = "OTHER1")
private String other1;
@TableField("OTHER2")
@ExcelColumn(value = "OTHER2")
private String other2;
@ExcelColumn(value = "OTHER3")
@TableField("OTHER3")
private String other3;
@TableField(exist = false)
@ExcelColumn(value = "SEQ")
private Integer SEQ;
}

@ -0,0 +1,30 @@
package com.foreverwin.mesnac.anomaly.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.anomaly.model.OutStore;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author YinQ
* @since 2022-09-15
*/
public interface OutStoreService extends IService<OutStore> {
/**
*
* @param frontPage
* @return
*/
IPage<OutStore> selectPage(FrontPage<OutStore> frontPage, OutStore outStore);
List<OutStore> selectList(OutStore outStore);
boolean outStoreImportFile(List<OutStore> outStoreList);
}

@ -0,0 +1,70 @@
package com.foreverwin.mesnac.anomaly.service.impl;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.anomaly.model.OutStore;
import com.foreverwin.mesnac.anomaly.mapper.OutStoreMapper;
import com.foreverwin.mesnac.anomaly.service.OutStoreService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author YinQ
* @since 2022-09-15
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class OutStoreServiceImpl extends ServiceImpl<OutStoreMapper, OutStore> implements OutStoreService {
@Autowired
private OutStoreMapper outStoreMapper;
@Override
public IPage<OutStore> selectPage(FrontPage<OutStore> frontPage, OutStore outStore) {
QueryWrapper<OutStore> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(outStore);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<OutStore> selectList(OutStore outStore) {
QueryWrapper<OutStore> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(outStore);
return super.list(queryWrapper);
}
@Override
public boolean outStoreImportFile(List<OutStore> outStoreList) {
String user = CommonMethods.getUser();
LocalDateTime now = LocalDateTime.now();
try {
for (OutStore outStore : outStoreList) {
String handle = StringUtil.createQUID();
outStore.setHandle(handle);
if (StringUtil.isBlank(outStore.getImportUser())){
outStore.setImportUser(user);
}
outStore.setImportDateTime(now);
}
super.saveBatch(outStoreList);
return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
}

@ -0,0 +1,450 @@
<?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.foreverwin.mesnac.anomaly.mapper.OutStoreMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.anomaly.model.OutStore">
<id column="HANDLE" property="handle" />
<result column="FACTORY" property="factory" />
<result column="STOCK_LOCATION" property="stockLocation" />
<result column="PROJECT_NO" property="projectNo" />
<result column="ITEM" property="item" />
<result column="ITEM_DESCRIPTION" property="itemDescription" />
<result column="QTY" property="qty" />
<result column="POSTING_DATE_TIME" property="postingDateTime" />
<result column="IMPORT_USER" property="importUser" />
<result column="IMPORT_DATE_TIME" property="importDateTime" />
<result column="OTHER1" property="other1" />
<result column="OTHER2" property="other2" />
<result column="OTHER3" property="other3" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, FACTORY, STOCK_LOCATION, PROJECT_NO, ITEM, ITEM_DESCRIPTION, QTY, POSTING_DATE_TIME, IMPORT_USER, IMPORT_DATE_TIME, OTHER1, OTHER2, OTHER3,ROWNUM SEQ
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_OUT_STORE WHERE HANDLE=#{handle}
</select>
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_OUT_STORE
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</select>
<select id="selectBatchIds" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_OUT_STORE WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</select>
<select id="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_OUT_STORE
<where>
<if test="ew.entity.handle!=null">
HANDLE=#{ew.handle}
</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.stockLocation!=null"> AND STOCK_LOCATION=#{ew.entity.stockLocation}</if>
<if test="ew.entity.projectNo!=null"> AND PROJECT_NO=#{ew.entity.projectNo}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.itemDescription!=null"> AND ITEM_DESCRIPTION=#{ew.entity.itemDescription}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.postingDateTime!=null"> AND POSTING_DATE_TIME=#{ew.entity.postingDateTime}</if>
<if test="ew.entity.importUser!=null"> AND IMPORT_USER=#{ew.entity.importUser}</if>
<if test="ew.entity.importDateTime!=null"> AND IMPORT_DATE_TIME=#{ew.entity.importDateTime}</if>
<if test="ew.entity.other1!=null"> AND OTHER1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER3=#{ew.entity.other3}</if>
</where>
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM Z_OUT_STORE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.stockLocation!=null"> AND STOCK_LOCATION=#{ew.entity.stockLocation}</if>
<if test="ew.entity.projectNo!=null"> AND PROJECT_NO=#{ew.entity.projectNo}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.itemDescription!=null"> AND ITEM_DESCRIPTION=#{ew.entity.itemDescription}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.postingDateTime!=null"> AND POSTING_DATE_TIME=#{ew.entity.postingDateTime}</if>
<if test="ew.entity.importUser!=null"> AND IMPORT_USER=#{ew.entity.importUser}</if>
<if test="ew.entity.importDateTime!=null"> AND IMPORT_DATE_TIME=#{ew.entity.importDateTime}</if>
<if test="ew.entity.other1!=null"> AND OTHER1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER3=#{ew.entity.other3}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectList" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_OUT_STORE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.stockLocation!=null"> AND STOCK_LOCATION=#{ew.entity.stockLocation}</if>
<if test="ew.entity.projectNo!=null"> AND PROJECT_NO=#{ew.entity.projectNo}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.itemDescription!=null"> AND ITEM_DESCRIPTION=#{ew.entity.itemDescription}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.postingDateTime!=null"> AND POSTING_DATE_TIME=#{ew.entity.postingDateTime}</if>
<if test="ew.entity.importUser!=null"> AND IMPORT_USER=#{ew.entity.importUser}</if>
<if test="ew.entity.importDateTime!=null"> AND IMPORT_DATE_TIME=#{ew.entity.importDateTime}</if>
<if test="ew.entity.other1!=null"> AND OTHER1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER3=#{ew.entity.other3}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMaps" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_OUT_STORE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.stockLocation!=null"> AND STOCK_LOCATION=#{ew.entity.stockLocation}</if>
<if test="ew.entity.projectNo!=null"> AND PROJECT_NO=#{ew.entity.projectNo}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.itemDescription!=null"> AND ITEM_DESCRIPTION=#{ew.entity.itemDescription}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.postingDateTime!=null"> AND POSTING_DATE_TIME=#{ew.entity.postingDateTime}</if>
<if test="ew.entity.importUser!=null"> AND IMPORT_USER=#{ew.entity.importUser}</if>
<if test="ew.entity.importDateTime!=null"> AND IMPORT_DATE_TIME=#{ew.entity.importDateTime}</if>
<if test="ew.entity.other1!=null"> AND OTHER1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER3=#{ew.entity.other3}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectObjs" resultType="Object">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_OUT_STORE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.stockLocation!=null"> AND STOCK_LOCATION=#{ew.entity.stockLocation}</if>
<if test="ew.entity.projectNo!=null"> AND PROJECT_NO=#{ew.entity.projectNo}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.itemDescription!=null"> AND ITEM_DESCRIPTION=#{ew.entity.itemDescription}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.postingDateTime!=null"> AND POSTING_DATE_TIME=#{ew.entity.postingDateTime}</if>
<if test="ew.entity.importUser!=null"> AND IMPORT_USER=#{ew.entity.importUser}</if>
<if test="ew.entity.importDateTime!=null"> AND IMPORT_DATE_TIME=#{ew.entity.importDateTime}</if>
<if test="ew.entity.other1!=null"> AND OTHER1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER3=#{ew.entity.other3}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectPage" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_OUT_STORE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.stockLocation!=null"> AND STOCK_LOCATION=#{ew.entity.stockLocation}</if>
<if test="ew.entity.projectNo!=null"> AND PROJECT_NO=#{ew.entity.projectNo}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.itemDescription!=null"> AND ITEM_DESCRIPTION=#{ew.entity.itemDescription}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.postingDateTime!=null"> AND POSTING_DATE_TIME=#{ew.entity.postingDateTime}</if>
<if test="ew.entity.importUser!=null"> AND IMPORT_USER=#{ew.entity.importUser}</if>
<if test="ew.entity.importDateTime!=null"> AND IMPORT_DATE_TIME=#{ew.entity.importDateTime}</if>
<if test="ew.entity.other1!=null"> AND OTHER1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER3=#{ew.entity.other3}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMapsPage" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_OUT_STORE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.stockLocation!=null"> AND STOCK_LOCATION=#{ew.entity.stockLocation}</if>
<if test="ew.entity.projectNo!=null"> AND PROJECT_NO=#{ew.entity.projectNo}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.itemDescription!=null"> AND ITEM_DESCRIPTION=#{ew.entity.itemDescription}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.postingDateTime!=null"> AND POSTING_DATE_TIME=#{ew.entity.postingDateTime}</if>
<if test="ew.entity.importUser!=null"> AND IMPORT_USER=#{ew.entity.importUser}</if>
<if test="ew.entity.importDateTime!=null"> AND IMPORT_DATE_TIME=#{ew.entity.importDateTime}</if>
<if test="ew.entity.other1!=null"> AND OTHER1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER3=#{ew.entity.other3}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<insert id="insert" parameterType="com.foreverwin.mesnac.anomaly.model.OutStore">
INSERT INTO Z_OUT_STORE
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="factory!=null">FACTORY,</if>
<if test="stockLocation!=null">STOCK_LOCATION,</if>
<if test="projectNo!=null">PROJECT_NO,</if>
<if test="item!=null">ITEM,</if>
<if test="itemDescription!=null">ITEM_DESCRIPTION,</if>
<if test="qty!=null">QTY,</if>
<if test="postingDateTime!=null">POSTING_DATE_TIME,</if>
<if test="importUser!=null">IMPORT_USER,</if>
<if test="importDateTime!=null">IMPORT_DATE_TIME,</if>
<if test="other1!=null">OTHER1,</if>
<if test="other2!=null">OTHER2,</if>
<if test="other3!=null">OTHER3,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="factory!=null">#{factory},</if>
<if test="stockLocation!=null">#{stockLocation},</if>
<if test="projectNo!=null">#{projectNo},</if>
<if test="item!=null">#{item},</if>
<if test="itemDescription!=null">#{itemDescription},</if>
<if test="qty!=null">#{qty},</if>
<if test="postingDateTime!=null">#{postingDateTime},</if>
<if test="importUser!=null">#{importUser},</if>
<if test="importDateTime!=null">#{importDateTime},</if>
<if test="other1!=null">#{other1},</if>
<if test="other2!=null">#{other2},</if>
<if test="other3!=null">#{other3},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.anomaly.model.OutStore">
INSERT INTO Z_OUT_STORE
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{factory},
#{stockLocation},
#{projectNo},
#{item},
#{itemDescription},
#{qty},
#{postingDateTime},
#{importUser},
#{importDateTime},
#{other1},
#{other2},
#{other3},
</trim>
</insert>
<update id="updateById">
UPDATE Z_OUT_STORE <trim prefix="SET" suffixOverrides=",">
<if test="et.factory!=null">FACTORY=#{et.factory},</if>
<if test="et.stockLocation!=null">STOCK_LOCATION=#{et.stockLocation},</if>
<if test="et.projectNo!=null">PROJECT_NO=#{et.projectNo},</if>
<if test="et.item!=null">ITEM=#{et.item},</if>
<if test="et.itemDescription!=null">ITEM_DESCRIPTION=#{et.itemDescription},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.postingDateTime!=null">POSTING_DATE_TIME=#{et.postingDateTime},</if>
<if test="et.importUser!=null">IMPORT_USER=#{et.importUser},</if>
<if test="et.importDateTime!=null">IMPORT_DATE_TIME=#{et.importDateTime},</if>
<if test="et.other1!=null">OTHER1=#{et.other1},</if>
<if test="et.other2!=null">OTHER2=#{et.other2},</if>
<if test="et.other3!=null">OTHER3=#{et.other3},</if>
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="updateAllColumnById">
UPDATE Z_OUT_STORE <trim prefix="SET" suffixOverrides=",">
FACTORY=#{et.factory},
STOCK_LOCATION=#{et.stockLocation},
PROJECT_NO=#{et.projectNo},
ITEM=#{et.item},
ITEM_DESCRIPTION=#{et.itemDescription},
QTY=#{et.qty},
POSTING_DATE_TIME=#{et.postingDateTime},
IMPORT_USER=#{et.importUser},
IMPORT_DATE_TIME=#{et.importDateTime},
OTHER1=#{et.other1},
OTHER2=#{et.other2},
OTHER3=#{et.other3},
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="update">
UPDATE Z_OUT_STORE <trim prefix="SET" suffixOverrides=",">
<if test="et.factory!=null">FACTORY=#{et.factory},</if>
<if test="et.stockLocation!=null">STOCK_LOCATION=#{et.stockLocation},</if>
<if test="et.projectNo!=null">PROJECT_NO=#{et.projectNo},</if>
<if test="et.item!=null">ITEM=#{et.item},</if>
<if test="et.itemDescription!=null">ITEM_DESCRIPTION=#{et.itemDescription},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.postingDateTime!=null">POSTING_DATE_TIME=#{et.postingDateTime},</if>
<if test="et.importUser!=null">IMPORT_USER=#{et.importUser},</if>
<if test="et.importDateTime!=null">IMPORT_DATE_TIME=#{et.importDateTime},</if>
<if test="et.other1!=null">OTHER1=#{et.other1},</if>
<if test="et.other2!=null">OTHER2=#{et.other2},</if>
<if test="et.other3!=null">OTHER3=#{et.other3},</if>
</trim>
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
HANDLE=#{ew.entity.handle}
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.stockLocation!=null"> AND STOCK_LOCATION=#{ew.entity.stockLocation}</if>
<if test="ew.entity.projectNo!=null"> AND PROJECT_NO=#{ew.entity.projectNo}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.itemDescription!=null"> AND ITEM_DESCRIPTION=#{ew.entity.itemDescription}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.postingDateTime!=null"> AND POSTING_DATE_TIME=#{ew.entity.postingDateTime}</if>
<if test="ew.entity.importUser!=null"> AND IMPORT_USER=#{ew.entity.importUser}</if>
<if test="ew.entity.importDateTime!=null"> AND IMPORT_DATE_TIME=#{ew.entity.importDateTime}</if>
<if test="ew.entity.other1!=null"> AND OTHER1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER3=#{ew.entity.other3}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</update>
<delete id="deleteById">
DELETE FROM Z_OUT_STORE WHERE HANDLE=#{handle}
</delete>
<delete id="deleteByMap">
DELETE FROM Z_OUT_STORE
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</delete>
<delete id="delete">
DELETE FROM Z_OUT_STORE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.stockLocation!=null"> AND STOCK_LOCATION=#{ew.entity.stockLocation}</if>
<if test="ew.entity.projectNo!=null"> AND PROJECT_NO=#{ew.entity.projectNo}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.itemDescription!=null"> AND ITEM_DESCRIPTION=#{ew.entity.itemDescription}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.postingDateTime!=null"> AND POSTING_DATE_TIME=#{ew.entity.postingDateTime}</if>
<if test="ew.entity.importUser!=null"> AND IMPORT_USER=#{ew.entity.importUser}</if>
<if test="ew.entity.importDateTime!=null"> AND IMPORT_DATE_TIME=#{ew.entity.importDateTime}</if>
<if test="ew.entity.other1!=null"> AND OTHER1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER3=#{ew.entity.other3}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</delete>
<delete id="deleteBatchIds">
DELETE FROM Z_OUT_STORE WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
</mapper>

@ -1,5 +1,10 @@
package com.foreverwin.mesnac.dataimport.controller;
import com.foreverwin.mesnac.anomaly.model.OutStore;
import com.foreverwin.mesnac.anomaly.model.TemporaryFix;
import com.foreverwin.mesnac.anomaly.service.OutStoreService;
import com.foreverwin.mesnac.anomaly.service.TemporaryFixService;
import com.foreverwin.mesnac.common.util.ExcelUtils;
import com.foreverwin.mesnac.dataimport.util.APResult;
import com.foreverwin.mesnac.dataimport.util.ImportRequest;
import com.foreverwin.mesnac.common.model.ExportTemplate;
@ -27,6 +32,12 @@ public class DataImportController {
@Autowired
private MasterDataImportServiceImpl masterDataImportService;
@Autowired
public TemporaryFixService temporaryFixService;
@Autowired
public OutStoreService outStoreService;
@PostMapping("/import")
public String importFile(@PathParam("fileType") String fileType, @PathParam("site") String site, @PathParam("handleType") final String handleType, @PathParam("mode") final String mode, @PathParam("user") String user, @RequestParam("file") MultipartFile multipartFile) {
ImportRequest importRequest = new ImportRequest();
@ -65,4 +76,36 @@ public class DataImportController {
}
return R.failed();
}
@PostMapping("/temporaryFixImportFile")
public R temporaryFixImportFile(@PathParam("fileType") String fileType, @PathParam("site") String site, @PathParam("handleType") final String handleType, @PathParam("mode") final String mode, @PathParam("user") String user, @RequestParam("file") MultipartFile multipartFile) {
try {
//String name = multipartFile.getOriginalFilename();
List<TemporaryFix> temporaryFixList = ExcelUtils.readExcel(fileType, TemporaryFix.class, multipartFile, null);
temporaryFixList = temporaryFixService.temporaryFixImportFile(temporaryFixList);
if (temporaryFixList.equals(null)){
return R.failed("导入数据失败");
}
boolean result = temporaryFixService.saveBatch(temporaryFixList);
return R.ok(result);
} catch (Exception e) {
e.printStackTrace();
return R.failed(e.getMessage());
}
}
@PostMapping("/outStoreImportFile")
public R outStoreImportFile(@PathParam("fileType") String fileType, @PathParam("site") String site, @PathParam("handleType") final String handleType, @PathParam("mode") final String mode, @PathParam("user") String user, @RequestParam("file") MultipartFile multipartFile) {
try {
List<OutStore> outStoreList = ExcelUtils.readExcel(fileType, OutStore.class, multipartFile, null);
if (outStoreService.outStoreImportFile(outStoreList)){
return R.ok("导入数据成功");
}
return R.failed("导入数据失败");
} catch (Exception e) {
e.printStackTrace();
return R.failed(e.getMessage());
}
}
}

Loading…
Cancel
Save