作者 张晓杰

修改工资信息导入模板下载,新增基础信息导出,物料下拉追加规格型号

... ... @@ -7,6 +7,7 @@ import org.jeecg.modules.erp.meterial.entity.TblMaterial;
import org.jeecg.modules.erp.meterial.entity.TblMaterialPart;
import java.util.List;
import java.util.Map;
/**
* @Description: tbl_material
... ... @@ -24,4 +25,6 @@ public interface TblMaterialMapper extends BaseMapper<TblMaterial> {
@Select("select part_number from tbl_material where part_number like CONCAT('%',#{partNumber},'%')")
List<String> queryPartNumber(@Param("partNumber") String partNumber);
List<Map<String,String>> getOptions();
}
... ...
... ... @@ -10,5 +10,7 @@
WHERE
id = #{subclassId}
</select>
<select id="getOptions" resultType="java.util.Map">
SELECT part_number as partNumber,CONCAT(product_name,if(spec != '' ,' - ',''),if(spec != '',spec,''),if(type != '',' - ',''),if(type != '',type,'')) productName from tbl_material
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* @Description: tbl_material
... ... @@ -47,5 +48,6 @@ public interface ITblMaterialService extends IService<TblMaterial> {
List<String> queryPartNumber(String partNum);
// List<Map<String,String>> getAll();
List<TblMaterial> getAll();
}
... ...
... ... @@ -14,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* @Description: tbl_material
... ... @@ -91,9 +92,12 @@ public class TblMaterialServiceImpl extends ServiceImpl<TblMaterialMapper, TblMa
}
@Override
// public List<Map<String,String>> getAll() {
// return tblMaterialMapper.getOptions();
// }
public List<TblMaterial> getAll() {
QueryWrapper<TblMaterial> queryWrapper = new QueryWrapper<>();
return this.list(queryWrapper);
return this.list();
}
}
... ...
... ... @@ -36,6 +36,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
... ... @@ -104,16 +105,17 @@ public class TblOrderFormController extends JeecgController<TblOrderForm, ITblOr
* @param tblOrderForm
* @return
*/
@Transactional(rollbackFor = Exception.class)
@AutoLog(value = "订单表-添加")
@ApiOperation(value="订单表-添加", notes="订单表-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody TblOrderForm tblOrderForm) {
// 产品类型
String type = tblOrderForm.getProductType() + DateUtil.format(new Date(), "YYYYMM");
Integer count = tblOrderFormService.getCountByType(type);
log.info("订单编号:"+ count);
String orderId= type + StrUtil.padPre(String.valueOf(count+1),4, '0');
tblOrderForm.setOrderId(orderId);
String orderId = tblOrderFormService.getCountByType(type);
log.info("订单编号:"+ orderId);
String orderIdNew= type + StrUtil.padPre(String.valueOf(Integer.valueOf(orderId.substring(8))+1),4, '0');
tblOrderForm.setOrderId(orderIdNew);
//任务下达日期
tblOrderForm.setOrderDate(new Date());
//是否分派设计 0 未分派 1已分派
... ... @@ -133,6 +135,7 @@ public class TblOrderFormController extends JeecgController<TblOrderForm, ITblOr
* @param tblOrderForm
* @return
*/
@Transactional(rollbackFor = Exception.class)
@AutoLog(value = "订单表-编辑")
@ApiOperation(value="订单表-编辑", notes="订单表-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
... ... @@ -194,15 +197,17 @@ public class TblOrderFormController extends JeecgController<TblOrderForm, ITblOr
* @param id
* @return
*/
@Transactional(rollbackFor = Exception.class)
@AutoLog(value = "订单表-通过id删除")
@ApiOperation(value="订单表-通过id删除", notes="订单表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
TblOrderForm orderForm = tblOrderFormService.getById(id);
if (!orderForm.getStatus().equals("未下单")){
return Result.error("订单已开始,不允许删除");
}
tblOrderFormService.delMain(id);
// TblOrderForm orderForm = tblOrderFormService.getById(id);
// if (!orderForm.getStatus().equals("未下单")){
// return Result.error("订单已开始,不允许删除");
// }
// tblOrderFormService.delMain(id);
tblOrderFormService.removeById(id);
return Result.OK("删除成功!");
}
... ...
... ... @@ -19,7 +19,7 @@ public interface TblOrderFormMapper extends BaseMapper<TblOrderForm> {
List<TblOrderForm> pageTblOrderFormDate(Integer integer);
Integer getCountByType(String productType);
String getMaxorderIdByType(String productType);
TblOrderForm selectOneById(String id);
... ...
... ... @@ -30,9 +30,9 @@
<!-- tbl_order_form a-->
<!-- LEFT JOIN tbl_product_type b on a.product_type = b.product_type_id-->
<!-- </select>-->
<select id="getCountByType" parameterType="java.lang.String" resultType="java.lang.Integer">
<select id="getMaxorderIdByType" parameterType="java.lang.String" resultType="java.lang.String">
SELECT
count(product_type)
max(order_id)
FROM
tbl_order_form
WHERE
... ...
... ... @@ -35,7 +35,7 @@ public interface ITblOrderFormService extends IService<TblOrderForm> {
List<TblOrderForm> pageTblOrderFormDate(Integer integer);
Integer getCountByType(String productType);
String getCountByType(String productType);
TblOrderForm selectOneById(String id);
... ...
... ... @@ -51,8 +51,8 @@ public class TblOrderFormServiceImpl extends ServiceImpl<TblOrderFormMapper, Tbl
}
@Override
public Integer getCountByType(String productType) {
return tblOrderFormMapper.getCountByType(productType);
public String getCountByType(String productType) {
return tblOrderFormMapper.getMaxorderIdByType(productType);
}
@Override
... ...
... ... @@ -11,12 +11,16 @@ import org.apache.poi.ss.formula.functions.T;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.erp.salary.entity.TblSalaryBase;
import org.jeecg.modules.erp.salary.entity.TblSalarySuanfa;
import org.jeecg.modules.erp.salary.service.ITblSalarySuanfaService;
import org.jeecg.modules.erp.salary.service.TblSalaryBaseService;
import org.jeecg.modules.erp.trad.entity.TblTradTender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
... ... @@ -31,7 +35,7 @@ import java.util.*;
@RestController
@RequestMapping("/salary/base")
@Slf4j
public class TblSalaryBaseController {
public class TblSalaryBaseController extends JeecgController<TblSalaryBase, TblSalaryBaseService> {
@Autowired
private TblSalaryBaseService tblSalaryBaseService;
... ... @@ -145,4 +149,15 @@ public class TblSalaryBaseController {
}
return Result.OK(tblSalaryBase);
}
/**
* 导出excel
*
* @param request
* @param tblSalaryBase
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, TblSalaryBase tblSalaryBase) {
return super.exportXls(request, tblSalaryBase, TblSalaryBase.class, "基础信息");
}
}
... ...
... ... @@ -19,7 +19,9 @@ import org.jeecg.modules.erp.salary.entity.TblSalaryCalculationVo;
import org.jeecg.modules.erp.salary.service.ITblSalaryCalculationService;
import org.jeecg.modules.erp.salary.service.ITblSalaryCalculationVoService;
import org.jeecg.modules.erp.salary.service.TblSalaryBaseService;
import org.jeecg.modules.erp.utils.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.format.annotation.DateTimeFormat;
... ... @@ -267,29 +269,42 @@ public class TblSalaryCalculationController extends JeecgController2<TblSalaryCa
}
}
@Value("${jeecg.path.webapp}")
private String webapp;
// @GetMapping("/download/{fileName}")
// public void downloadFile( @PathVariable("fileName")String fileName,HttpServletResponse response) throws IOException {
// // 获取要下载的文件路径(假设文件名为example.pdf)
//// String filePath = webapp + "/工资导入.xlsx";
// String filePath = webapp + fileName;
//
// // 创建 Resource 对象
// Resource resource = new ClassPathResource(filePath);
//
// // 设置下载响应头
// response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(resource.getFilename(),"UTF-8"));
// response.setContentType("application/vnd.ms-excel");
// response.setContentLength((int) resource.contentLength());
//
// // 将文件内容写入响应流
// try (InputStream inputStream = resource.getInputStream();
// OutputStream outputStream = response.getOutputStream()) {
// byte[] buffer = new byte[4096];
// int bytesRead;
// while ((bytesRead = inputStream.read(buffer)) != -1) {
// outputStream.write(buffer, 0, bytesRead);
// }
// }
// }
@GetMapping("/download/{fileName}")
public void downloadFile(HttpServletResponse response) throws IOException {
// 获取要下载的文件路径(假设文件名为example.pdf)
String filePath = "templates/工资导入.xlsx";
// 创建 Resource 对象
Resource resource = new ClassPathResource(filePath);
// 设置下载响应头
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(resource.getFilename(),"UTF-8"));
response.setContentType("application/vnd.ms-excel");
response.setContentLength((int) resource.contentLength());
// 将文件内容写入响应流
try (InputStream inputStream = resource.getInputStream();
OutputStream outputStream = response.getOutputStream()) {
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
}
public void downloadFile(@PathVariable("fileName")String fileName,HttpServletResponse response) throws IOException {
String realFileName = System.currentTimeMillis()+"_" + fileName;
String filePath = webapp +"/"+ fileName;
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream());
}
}
... ...
... ... @@ -153,7 +153,7 @@ public class TblSalarySuanfaController extends JeecgController<TblSalarySuanfa,
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, TblSalarySuanfa tblSalarySuanfa) {
return super.exportXls(request, tblSalarySuanfa, TblSalarySuanfa.class, "tbl_salary_suanfa");
return super.exportXls(request, tblSalarySuanfa, TblSalarySuanfa.class, "工资算法");
}
/**
... ...
... ... @@ -191,9 +191,9 @@ jeecg:
uploadType: local
path:
#文件上传根目录 设置
upload: /opt/upFiles
upload: ${user.dir}/opt/upFiles
#webapp文件路径
webapp: /opt/webapp
webapp: ${user.dir}/opt/webapp
shiro:
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
#阿里云oss存储和大鱼短信秘钥配置
... ...
... ... @@ -187,9 +187,9 @@ jeecg:
uploadType: local
path:
#文件上传根目录 设置
upload: /opt/jeecg-boot/upload
upload: ${user.dir}/opt/jeecg-boot/upload
#webapp文件路径
webapp: /opt/jeecg-boot/webapp
webapp: ${user.dir}/opt/jeecg-boot/webapp
shiro:
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo
#阿里云oss存储和大鱼短信秘钥配置
... ...